aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_sensor_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_sensor_service.h')
-rw-r--r--src/include/gnunet_sensor_service.h45
1 files changed, 31 insertions, 14 deletions
diff --git a/src/include/gnunet_sensor_service.h b/src/include/gnunet_sensor_service.h
index 4ef2885e6..a31b20e52 100644
--- a/src/include/gnunet_sensor_service.h
+++ b/src/include/gnunet_sensor_service.h
@@ -44,6 +44,11 @@ extern "C"
44struct GNUNET_SENSOR_Handle; 44struct GNUNET_SENSOR_Handle;
45 45
46/** 46/**
47 * Context for an iteration request.
48 */
49struct GNUNET_SENSOR_IterateContext;
50
51/**
47 * Structure containing brief info about sensor 52 * Structure containing brief info about sensor
48 */ 53 */
49struct SensorInfoShort 54struct SensorInfoShort
@@ -72,13 +77,13 @@ struct SensorInfoShort
72}; 77};
73 78
74/** 79/**
75 * Type of an iterator over sensor definitions. 80 * Sensor iterate request callback.
76 * 81 *
77 * @param cls closure 82 * @param cls closure
78 * @param hello hello message for the peer (can be NULL) 83 * @param sensor Brief sensor information
79 * @param error message 84 * @param error message
80 */ 85 */
81typedef void (*GNUNET_SENSOR_SensorIteratorCB) (void *cls, 86typedef void (*GNUNET_SENSOR_SensorIterateCB) (void *cls,
82 const struct SensorInfoShort * 87 const struct SensorInfoShort *
83 sensor, const char *err_msg); 88 sensor, const char *err_msg);
84 89
@@ -93,6 +98,15 @@ typedef void (*GNUNET_SENSOR_Continuation) (void *cls, const char *emsg);
93 98
94 99
95/** 100/**
101 * Disconnect from the sensor service
102 *
103 * @param h handle to disconnect
104 */
105void
106GNUNET_SENSOR_disconnect (struct GNUNET_SENSOR_Handle *h);
107
108
109/**
96 * Connect to the sensor service. 110 * Connect to the sensor service.
97 * 111 *
98 * @return NULL on error 112 * @return NULL on error
@@ -102,30 +116,33 @@ GNUNET_SENSOR_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
102 116
103 117
104/** 118/**
105 * Disconnect from the sensor service 119 * Cancel an iteration request.
120 * This should be called before the iterate callback is called with a NULL value.
106 * 121 *
107 * @param h handle to disconnect 122 * @param ic context of the iterator to cancel
108 */ 123 */
109void 124void
110GNUNET_SENSOR_disconnect (struct GNUNET_SENSOR_Handle *h); 125GNUNET_SENSOR_iterate_cancel (struct GNUNET_SENSOR_IterateContext
126 *ic);
111 127
112 128
113/** 129/**
114 * Client asking to iterate all available sensors 130 * Get one or all sensors loaded by the sensor service.
131 * The callback will be called with each sensor received and once with a NULL
132 * value to signal end of iteration.
115 * 133 *
116 * @param h Handle to SENSOR service 134 * @param h Handle to SENSOR service
117 * @param timeout how long to wait until timing out 135 * @param timeout how long to wait until timing out
118 * @param sensorname information on one sensor only, can be NULL to get all 136 * @param sensorname Name of the required sensor, NULL to get all
119 * @param sensorname_len length of the sensorname parameter 137 * @param callback the function to call for each sensor
120 * @param callback the method to call for each sensor
121 * @param callback_cls closure for callback 138 * @param callback_cls closure for callback
122 * @return iterator context 139 * @return iterator context
123 */ 140 */
124struct GNUNET_SENSOR_SensorIteratorContext * 141struct GNUNET_SENSOR_IterateContext *
125GNUNET_SENSOR_iterate_sensors (struct GNUNET_SENSOR_Handle *h, 142GNUNET_SENSOR_iterate (struct GNUNET_SENSOR_Handle *h,
126 struct GNUNET_TIME_Relative timeout, 143 struct GNUNET_TIME_Relative timeout,
127 const char *sensorname, size_t sensorname_len, 144 const char *sensor_name,
128 GNUNET_SENSOR_SensorIteratorCB callback, 145 GNUNET_SENSOR_SensorIterateCB callback,
129 void *callback_cls); 146 void *callback_cls);
130 147
131#if 0 /* keep Emacsens' auto-indent happy */ 148#if 0 /* keep Emacsens' auto-indent happy */