2 This file is part of GNUnet
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.
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.
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.
22 * @file include/gnunet_sensor_service.h
23 * @brief API to the sensor service
24 * @author Omar Tarabai
26 #ifndef GNUNET_SENSOR_SERVICE_H
27 #define GNUNET_SENSOR_SERVICE_H
30 #include "gnunet_util_lib.h"
35 #if 0 /* keep Emacsens' auto-indent happy */
42 * Handle to the sensor service.
44 struct GNUNET_SENSOR_Handle;
47 * Structure containing brief info about sensor
49 struct SensorInfoShort
58 * First part of version number
60 uint16_t version_major;
63 * Second part of version number
65 uint16_t version_minor;
75 * Type of an iterator over sensor definitions.
78 * @param hello hello message for the peer (can be NULL)
79 * @param error message
81 typedef void (*GNUNET_SENSOR_SensorIteratorCB) (void *cls,
82 const struct SensorInfoShort *
83 sensor, const char *err_msg);
87 * Continuation called with a status result.
90 * @param emsg error message, NULL on success
92 typedef void (*GNUNET_SENSOR_Continuation) (void *cls, const char *emsg);
96 * Connect to the sensor service.
98 * @return NULL on error
100 struct GNUNET_SENSOR_Handle *
101 GNUNET_SENSOR_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
105 * Disconnect from the sensor service
107 * @param h handle to disconnect
110 GNUNET_SENSOR_disconnect (struct GNUNET_SENSOR_Handle *h);
114 * Client asking to iterate all available sensors
116 * @param h Handle to SENSOR service
117 * @param timeout how long to wait until timing out
118 * @param sensorname information on one sensor only, can be NULL to get all
119 * @param sensorname_len length of the sensorname parameter
120 * @param callback the method to call for each sensor
121 * @param callback_cls closure for callback
122 * @return iterator context
124 struct GNUNET_SENSOR_SensorIteratorContext *
125 GNUNET_SENSOR_iterate_sensors (struct GNUNET_SENSOR_Handle *h,
126 struct GNUNET_TIME_Relative timeout,
127 const char *sensorname, size_t sensorname_len,
128 GNUNET_SENSOR_SensorIteratorCB callback,
131 #if 0 /* keep Emacsens' auto-indent happy */