diff options
author | Omar Tarabai <tarabai@devegypt.com> | 2014-08-15 18:44:06 +0000 |
---|---|---|
committer | Omar Tarabai <tarabai@devegypt.com> | 2014-08-15 18:44:06 +0000 |
commit | 34e40e006af57ec7cb7c69acf0273321550117dd (patch) | |
tree | 1f4a234675455ab8306dcdfdc8bbc98a3979c6d7 /src/include | |
parent | fd6ca7a4a3366b3166bc7c4c5e02af6f11c917ef (diff) | |
download | gnunet-34e40e006af57ec7cb7c69acf0273321550117dd.tar.gz gnunet-34e40e006af57ec7cb7c69acf0273321550117dd.zip |
sensor: test case + fixes
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_protocols.h | 5 | ||||
-rw-r--r-- | src/include/gnunet_sensor_service.h | 22 | ||||
-rw-r--r-- | src/include/gnunet_sensor_util_lib.h | 20 |
3 files changed, 45 insertions, 2 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 176391580..68472a3f9 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -2458,6 +2458,11 @@ extern "C" | |||
2458 | */ | 2458 | */ |
2459 | #define GNUNET_MESSAGE_TYPE_SENSOR_ANOMALY_FORCE 810 | 2459 | #define GNUNET_MESSAGE_TYPE_SENSOR_ANOMALY_FORCE 810 |
2460 | 2460 | ||
2461 | /** | ||
2462 | * Sensor anomaly report exchanged between peers | ||
2463 | */ | ||
2464 | #define GNUNET_MESSAGE_TYPE_SENSOR_ANOMALY_REPORT_P2P 811 | ||
2465 | |||
2461 | 2466 | ||
2462 | /******************************************************************************* | 2467 | /******************************************************************************* |
2463 | * PEERSTORE message types | 2468 | * PEERSTORE message types |
diff --git a/src/include/gnunet_sensor_service.h b/src/include/gnunet_sensor_service.h index 59e4248ab..250256cef 100644 --- a/src/include/gnunet_sensor_service.h +++ b/src/include/gnunet_sensor_service.h | |||
@@ -49,6 +49,11 @@ struct GNUNET_SENSOR_Handle; | |||
49 | struct GNUNET_SENSOR_IterateContext; | 49 | struct GNUNET_SENSOR_IterateContext; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Context of a force anomaly request | ||
53 | */ | ||
54 | struct GNUNET_SENSOR_ForceAnomalyContext; | ||
55 | |||
56 | /** | ||
52 | * Structure containing brief info about sensor | 57 | * Structure containing brief info about sensor |
53 | */ | 58 | */ |
54 | struct SensorInfoShort | 59 | struct SensorInfoShort |
@@ -147,6 +152,16 @@ GNUNET_SENSOR_iterate (struct GNUNET_SENSOR_Handle *h, | |||
147 | 152 | ||
148 | 153 | ||
149 | /** | 154 | /** |
155 | * Cancel a force anomaly request. | ||
156 | * | ||
157 | * @param fa Force anomaly context returned by GNUNET_SENSOR_force_anomaly() | ||
158 | */ | ||
159 | void | ||
160 | GNUNET_SENSOR_force_anomaly_cancel (struct GNUNET_SENSOR_ForceAnomalyContext | ||
161 | *fa); | ||
162 | |||
163 | |||
164 | /** | ||
150 | * Force an anomaly status change on a given sensor. If the sensor reporting | 165 | * Force an anomaly status change on a given sensor. If the sensor reporting |
151 | * module is running, this will trigger the usual reporting logic, therefore, | 166 | * module is running, this will trigger the usual reporting logic, therefore, |
152 | * please only use this in a test environment. | 167 | * please only use this in a test environment. |
@@ -157,10 +172,13 @@ GNUNET_SENSOR_iterate (struct GNUNET_SENSOR_Handle *h, | |||
157 | * @param h Service handle | 172 | * @param h Service handle |
158 | * @param sensor_name Sensor name to set the anomaly status | 173 | * @param sensor_name Sensor name to set the anomaly status |
159 | * @param anomalous The desired status: #GNUNET_YES / #GNUNET_NO | 174 | * @param anomalous The desired status: #GNUNET_YES / #GNUNET_NO |
175 | * @param cont Continuation function to be called after the request is sent | ||
176 | * @param cont_cls Closure for cont | ||
160 | */ | 177 | */ |
161 | void | 178 | struct GNUNET_SENSOR_ForceAnomalyContext * |
162 | GNUNET_SENSOR_force_anomaly (struct GNUNET_SENSOR_Handle *h, char *sensor_name, | 179 | GNUNET_SENSOR_force_anomaly (struct GNUNET_SENSOR_Handle *h, char *sensor_name, |
163 | int anomalous); | 180 | int anomalous, GNUNET_SENSOR_Continuation cont, |
181 | void *cont_cls); | ||
164 | 182 | ||
165 | #if 0 /* keep Emacsens' auto-indent happy */ | 183 | #if 0 /* keep Emacsens' auto-indent happy */ |
166 | { | 184 | { |
diff --git a/src/include/gnunet_sensor_util_lib.h b/src/include/gnunet_sensor_util_lib.h index 87ae564fa..897fbbaad 100644 --- a/src/include/gnunet_sensor_util_lib.h +++ b/src/include/gnunet_sensor_util_lib.h | |||
@@ -189,6 +189,26 @@ struct GNUNET_SENSOR_SensorInfo | |||
189 | 189 | ||
190 | }; | 190 | }; |
191 | 191 | ||
192 | /** | ||
193 | * Anomaly report received and stored by sensor dashboard. | ||
194 | * Sensor name and peer id are not included because they are part of the | ||
195 | * peerstore key. | ||
196 | */ | ||
197 | struct GNUNET_SENSOR_DashboardAnomalyEntry | ||
198 | { | ||
199 | |||
200 | /** | ||
201 | * New anomaly status | ||
202 | */ | ||
203 | uint16_t anomalous; | ||
204 | |||
205 | /** | ||
206 | * Percentage of neighbors reported the same anomaly | ||
207 | */ | ||
208 | float anomalous_neighbors; | ||
209 | |||
210 | }; | ||
211 | |||
192 | GNUNET_NETWORK_STRUCT_BEGIN | 212 | GNUNET_NETWORK_STRUCT_BEGIN |
193 | 213 | ||
194 | /** | 214 | /** |