SENSOR service integration
[oweals/gnunet.git] / src / include / gnunet_sensor_service.h
1 /*
2       This file is part of GNUnet
3       (C) 
4
5       GNUnet is free software; you can redistribute it and/or modify
6       it under the terms of the GNU General Public License as published
7       by the Free Software Foundation; either version 3, or (at your
8       option) any later version.
9
10       GNUnet is distributed in the hope that it will be useful, but
11       WITHOUT ANY WARRANTY; without even the implied warranty of
12       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13       General Public License for more details.
14
15       You should have received a copy of the GNU General Public License
16       along with GNUnet; see the file COPYING.  If not, write to the
17       Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18       Boston, MA 02111-1307, USA.
19  */
20
21 /**
22  * @file include/gnunet_sensor_service.h
23  * @brief API to the sensor service
24  * @author Omar Tarabai
25  */
26 #ifndef GNUNET_SENSOR_SERVICE_H
27 #define GNUNET_SENSOR_SERVICE_H
28
29 #include <gnunet/platform.h>
30 #include <gnunet/gnunet_util_lib.h>
31 #include "gnunet_protocols_mi.h"
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #if 0                           /* keep Emacsens' auto-indent happy */
37 }
38 #endif
39 #endif
40
41
42 /**
43  * Handle to the sensor service.
44  */
45 struct GNUNET_SENSOR_Handle;
46
47 /**
48  * Structure containing brief info about sensor
49  */
50 struct SensorInfoShort
51 {
52
53   /*
54    * Sensor name
55    */
56   char *name;
57
58   /*
59    * First part of version number
60    */
61   uint16_t version_major;
62
63   /*
64    * Second part of version number
65    */
66   uint16_t version_minor;
67
68   /*
69    * Sensor description
70    */
71   char *description;
72
73 };
74
75 /**
76  * Type of an iterator over sensor definitions.
77  *
78  * @param cls closure
79  * @param hello hello message for the peer (can be NULL)
80  * @param error message
81  */
82 typedef void (*GNUNET_SENSOR_SensorIteratorCB) (void *cls,
83                                              const struct SensorInfoShort *sensor,
84                                              const char *err_msg);
85
86 /**
87  * Continuation called with a status result.
88  *
89  * @param cls closure
90  * @param emsg error message, NULL on success
91  */
92 typedef void (*GNUNET_SENSOR_Continuation)(void *cls,
93                const char *emsg);
94
95 /**
96  * Connect to the sensor service.
97  *
98  * @return NULL on error
99  */
100 struct GNUNET_SENSOR_Handle *
101 GNUNET_SENSOR_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
102
103
104 #if 0                           /* keep Emacsens' auto-indent happy */
105 {
106 #endif
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif