aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOmar Tarabai <tarabai@devegypt.com>2014-04-14 12:16:18 +0000
committerOmar Tarabai <tarabai@devegypt.com>2014-04-14 12:16:18 +0000
commitb56fa794970ac54860a61bbdb7d60c2b517d127a (patch)
tree17da97f433a62af353eb79e400e03b778631150e /src
parenta3485503b228317cb7a9813a1049cb510384d577 (diff)
downloadgnunet-b56fa794970ac54860a61bbdb7d60c2b517d127a.tar.gz
gnunet-b56fa794970ac54860a61bbdb7d60c2b517d127a.zip
SENSOR service integration
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_protocols.h26
-rw-r--r--src/include/gnunet_sensor_service.h111
-rw-r--r--src/sensor/gnunet-sensor.c4
-rw-r--r--src/sensor/gnunet-service-sensor.c4
-rw-r--r--src/sensor/sensor_api.c4
-rw-r--r--src/sensor/test_sensor_api.c4
6 files changed, 144 insertions, 9 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 726d367a7..39ce58377 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2407,9 +2407,33 @@ extern "C"
2407#define GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_SECRET_READY 783 2407#define GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_SECRET_READY 783
2408 2408
2409 2409
2410/*******************************************************************************
2411 * SENSOR message types
2412 ******************************************************************************/
2413
2414/**
2415 * Request information about all sensors
2416 */
2417#define GNUNET_MESSAGE_TYPE_SENSOR_GETALL 800
2418
2419/**
2420 * Request information about one sensor
2421 */
2422#define GNUNET_MESSAGE_TYPE_SENSOR_GET 801
2423
2424/**
2425 * Message carrying sensor information
2426 */
2427#define GNUNET_MESSAGE_TYPE_SENSOR_INFO 802
2428
2429/**
2430 * End of an iteration sequence
2431 */
2432#define GNUNET_MESSAGE_TYPE_SENSOR_END 803
2433
2410 2434
2411/** 2435/**
2412 * Next available: 800 2436 * Next available: 830
2413 */ 2437 */
2414 2438
2415 2439
diff --git a/src/include/gnunet_sensor_service.h b/src/include/gnunet_sensor_service.h
new file mode 100644
index 000000000..8f5b806f8
--- /dev/null
+++ b/src/include/gnunet_sensor_service.h
@@ -0,0 +1,111 @@
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
34extern "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 */
45struct GNUNET_SENSOR_Handle;
46
47/**
48 * Structure containing brief info about sensor
49 */
50struct 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 */
82typedef 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 */
92typedef 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 */
100struct GNUNET_SENSOR_Handle *
101GNUNET_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
diff --git a/src/sensor/gnunet-sensor.c b/src/sensor/gnunet-sensor.c
index dd06d6e0b..ead7c5e0d 100644
--- a/src/sensor/gnunet-sensor.c
+++ b/src/sensor/gnunet-sensor.c
@@ -23,8 +23,8 @@
23 * @brief sensor tool 23 * @brief sensor tool
24 * @author Omar Tarabai 24 * @author Omar Tarabai
25 */ 25 */
26#include <gnunet/platform.h> 26#include "platform.h"
27#include <gnunet/gnunet_util_lib.h> 27#include "gnunet_util_lib.h"
28#include "gnunet_sensor_service.h" 28#include "gnunet_sensor_service.h"
29 29
30static int ret; 30static int ret;
diff --git a/src/sensor/gnunet-service-sensor.c b/src/sensor/gnunet-service-sensor.c
index 28c608e94..08b54453a 100644
--- a/src/sensor/gnunet-service-sensor.c
+++ b/src/sensor/gnunet-service-sensor.c
@@ -23,8 +23,8 @@
23 * @brief sensor service implementation 23 * @brief sensor service implementation
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include <gnunet/platform.h> 26#include "platform.h"
27#include <gnunet/gnunet_util_lib.h> 27#include "gnunet_util_lib.h"
28#include "sensor.h" 28#include "sensor.h"
29 29
30/** 30/**
diff --git a/src/sensor/sensor_api.c b/src/sensor/sensor_api.c
index 19ead13b3..985c29a0f 100644
--- a/src/sensor/sensor_api.c
+++ b/src/sensor/sensor_api.c
@@ -23,8 +23,8 @@
23 * @brief API for sensor 23 * @brief API for sensor
24 * @author Omar Tarabai 24 * @author Omar Tarabai
25 */ 25 */
26#include <gnunet/platform.h> 26#include "platform.h"
27#include <gnunet/gnunet_util_lib.h> 27#include "gnunet_util_lib.h"
28#include "sensor.h" 28#include "sensor.h"
29 29
30#define LOG(kind,...) GNUNET_log_from (kind, "sensor-api",__VA_ARGS__) 30#define LOG(kind,...) GNUNET_log_from (kind, "sensor-api",__VA_ARGS__)
diff --git a/src/sensor/test_sensor_api.c b/src/sensor/test_sensor_api.c
index 0967f2b3f..b7ebf8ff6 100644
--- a/src/sensor/test_sensor_api.c
+++ b/src/sensor/test_sensor_api.c
@@ -21,8 +21,8 @@
21 * @file sensor/test_sensor_api.c 21 * @file sensor/test_sensor_api.c
22 * @brief testcase for sensor_api.c 22 * @brief testcase for sensor_api.c
23 */ 23 */
24#include <gnunet/platform.h> 24#include "platform.h"
25#include <gnunet/gnunet_util_lib.h> 25#include "gnunet_util_lib.h"
26#include "gnunet_sensor_service.h" 26#include "gnunet_sensor_service.h"
27 27
28 28