summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-23 14:22:34 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-23 14:22:34 +0000
commit5742938289524f4c5fba7883742e4dd69cccf11d (patch)
treee16fea8b9d778f9825f897237b0c1880305776a0 /src/include
parentf3edb5a8d6ba6f43f5df18f2e98bc1dae90c9d7a (diff)
downloadgnunet-5742938289524f4c5fba7883742e4dd69cccf11d.tar.gz
gnunet-5742938289524f4c5fba7883742e4dd69cccf11d.zip
refactoring ARM api to use new MQ
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_arm_service.h109
-rw-r--r--src/include/gnunet_testbed_logger_service.h7
-rw-r--r--src/include/gnunet_testing_lib.h18
3 files changed, 72 insertions, 62 deletions
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h
index f21524226..7fb14d3ac 100644
--- a/src/include/gnunet_arm_service.h
+++ b/src/include/gnunet_arm_service.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2009 GNUnet e.V. 3 Copyright (C) 2009, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -48,7 +48,7 @@ extern "C"
48/** 48/**
49 * Version of the arm API. 49 * Version of the arm API.
50 */ 50 */
51#define GNUNET_ARM_VERSION 0x00000002 51#define GNUNET_ARM_VERSION 0x00000003
52 52
53 53
54/** 54/**
@@ -78,12 +78,6 @@ enum GNUNET_ARM_RequestStatus
78 GNUNET_ARM_REQUEST_BUSY = 3, 78 GNUNET_ARM_REQUEST_BUSY = 3,
79 79
80 /** 80 /**
81 * It was discovered that the request would be too long to fit in a message,
82 * and thus it was not sent.
83 */
84 GNUNET_ARM_REQUEST_TOO_LONG = 4,
85
86 /**
87 * Request time ran out before we had a chance to send it. 81 * Request time ran out before we had a chance to send it.
88 */ 82 */
89 GNUNET_ARM_REQUEST_TIMEOUT = 5 83 GNUNET_ARM_REQUEST_TIMEOUT = 5
@@ -180,50 +174,56 @@ enum GNUNET_ARM_Result
180 */ 174 */
181struct GNUNET_ARM_Handle; 175struct GNUNET_ARM_Handle;
182 176
177/**
178 * Handle for an ARM operation.
179 */
180struct GNUNET_ARM_Operation;
181
183 182
184/** 183/**
185 * Function called whenever we connect to or disconnect from ARM. 184 * Function called whenever we connect to or disconnect from ARM.
186 * 185 *
187 * @param cls closure 186 * @param cls closure
188 * @param connected GNUNET_YES if connected, GNUNET_NO if disconnected, 187 * @param connected #GNUNET_YES if connected, #GNUNET_NO if disconnected,
189 * GNUNET_SYSERR if there was an error. 188 * #GNUNET_SYSERR if there was an error.
190 */ 189 */
191typedef void (*GNUNET_ARM_ConnectionStatusCallback) (void *cls, 190typedef void
192 int connected); 191(*GNUNET_ARM_ConnectionStatusCallback) (void *cls,
192 int connected);
193 193
194 194
195/** 195/**
196 * Function called in response to a start/stop request. 196 * Function called in response to a start/stop request.
197 * Will be called when request was not sent successfully, 197 * Will be called when request was not sent successfully,
198 * or when a reply comes. If the request was not sent successfully, 198 * or when a reply comes. If the request was not sent successfully,
199 * 'rs' will indicate that, and 'service' and 'result' will be undefined. 199 * @a rs will indicate that, and @a result will be undefined.
200 * 200 *
201 * @param cls closure 201 * @param cls closure
202 * @param rs status of the request 202 * @param rs status of the request
203 * @param service service name
204 * @param result result of the operation 203 * @param result result of the operation
205 */ 204 */
206typedef void (*GNUNET_ARM_ResultCallback) (void *cls, 205typedef void
207 enum GNUNET_ARM_RequestStatus rs, 206(*GNUNET_ARM_ResultCallback) (void *cls,
208 const char *service, 207 enum GNUNET_ARM_RequestStatus rs,
209 enum GNUNET_ARM_Result result); 208 enum GNUNET_ARM_Result result);
210 209
211 210
212/** 211/**
213 * Callback function invoked when list operation is complete. 212 * Callback function invoked when list operation is complete.
214 * Will be called when request was not sent successfully, 213 * Will be called when request was not sent successfully,
215 * or when a reply comes. If the request was not sent successfully, 214 * or when a reply comes. If the request was not sent successfully,
216 * 'rs' will indicate that, and 'count' and 'list' will be undefined. 215 * @a rs will indicate that, and @a count and @a list will be undefined.
217 * 216 *
218 * @param cls closure 217 * @param cls closure
219 * @param rs status of the request 218 * @param rs status of the request
220 * @param count number of strings in the list 219 * @param count number of strings in the list
221 * @param list list of running services 220 * @param list list of running services
222 */ 221 */
223typedef void (*GNUNET_ARM_ServiceListCallback) (void *cls, 222typedef void
224 enum GNUNET_ARM_RequestStatus rs, 223(*GNUNET_ARM_ServiceListCallback) (void *cls,
225 unsigned int count, 224 enum GNUNET_ARM_RequestStatus rs,
226 const char *const*list); 225 unsigned int count,
226 const char *const*list);
227 227
228 228
229/** 229/**
@@ -234,13 +234,13 @@ typedef void (*GNUNET_ARM_ServiceListCallback) (void *cls,
234 * the ARM service may internally use a different 234 * the ARM service may internally use a different
235 * configuration to determine how to start the service). 235 * configuration to determine how to start the service).
236 * @param conn_status will be called when connecting/disconnecting 236 * @param conn_status will be called when connecting/disconnecting
237 * @param cls closure for conn_status 237 * @param conn_status_cls closure for @a conn_status
238 * @return context to use for further ARM operations, NULL on error. 238 * @return context to use for further ARM operations, NULL on error.
239 */ 239 */
240struct GNUNET_ARM_Handle * 240struct GNUNET_ARM_Handle *
241GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 241GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
242 GNUNET_ARM_ConnectionStatusCallback conn_status, 242 GNUNET_ARM_ConnectionStatusCallback conn_status,
243 void *cls); 243 void *conn_status_cls);
244 244
245 245
246/** 246/**
@@ -249,21 +249,31 @@ GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
249 * @param h the handle that was being used 249 * @param h the handle that was being used
250 */ 250 */
251void 251void
252GNUNET_ARM_disconnect_and_free (struct GNUNET_ARM_Handle *h); 252GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h);
253
254
255/**
256 * Abort an operation. Only prevents the callback from being
257 * called, the operation may still complete.
258 *
259 * @param op operation to cancel
260 */
261void
262GNUNET_ARM_operation_cancel (struct GNUNET_ARM_Operation *op);
253 263
254 264
255/** 265/**
256 * Request a list of running services. 266 * Request a list of running services.
257 * 267 *
258 * @param h handle to ARM 268 * @param h handle to ARM
259 * @param timeout how long to wait before failing for good
260 * @param cont callback to invoke after request is sent or is not sent 269 * @param cont callback to invoke after request is sent or is not sent
261 * @param cont_cls closure for callback 270 * @param cont_cls closure for @a cont
271 * @return handle for the operation, NULL on error
262 */ 272 */
263void 273struct GNUNET_ARM_Operation *
264GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, 274GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h,
265 struct GNUNET_TIME_Relative timeout, 275 GNUNET_ARM_ServiceListCallback cont,
266 GNUNET_ARM_ServiceListCallback cont, void *cont_cls); 276 void *cont_cls);
267 277
268 278
269/** 279/**
@@ -271,20 +281,20 @@ GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h,
271 * Stopping arm itself will not invalidate its handle, and 281 * Stopping arm itself will not invalidate its handle, and
272 * ARM API will try to restore connection to the ARM service, 282 * ARM API will try to restore connection to the ARM service,
273 * even if ARM connection was lost because you asked for ARM to be stopped. 283 * even if ARM connection was lost because you asked for ARM to be stopped.
274 * Call GNUNET_ARM_disconnect_and_free () to free the handle and prevent 284 * Call #GNUNET_ARM_disconnect() to free the handle and prevent
275 * further connection attempts. 285 * further connection attempts.
276 * 286 *
277 * @param h handle to ARM 287 * @param h handle to ARM
278 * @param service_name name of the service 288 * @param service_name name of the service
279 * @param timeout how long to wait before failing for good
280 * @param cont callback to invoke after request is sent or is not sent 289 * @param cont callback to invoke after request is sent or is not sent
281 * @param cont_cls closure for callback 290 * @param cont_cls closure for @a cont
291 * @return handle for the operation, NULL on error
282 */ 292 */
283void 293struct GNUNET_ARM_Operation *
284GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, 294GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
285 const char *service_name, 295 const char *service_name,
286 struct GNUNET_TIME_Relative timeout, 296 GNUNET_ARM_ResultCallback cont,
287 GNUNET_ARM_ResultCallback cont, void *cont_cls); 297 void *cont_cls);
288 298
289 299
290/** 300/**
@@ -293,15 +303,14 @@ GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
293 * @param h handle to ARM 303 * @param h handle to ARM
294 * @param service_name name of the service 304 * @param service_name name of the service
295 * @param std_inheritance inheritance of std streams 305 * @param std_inheritance inheritance of std streams
296 * @param timeout how long to wait before failing for good
297 * @param cont callback to invoke after request is sent or not sent 306 * @param cont callback to invoke after request is sent or not sent
298 * @param cont_cls closure for callback 307 * @param cont_cls closure for @a cont
308 * @return handle for the operation, NULL on error
299 */ 309 */
300void 310struct GNUNET_ARM_Operation *
301GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, 311GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
302 const char *service_name, 312 const char *service_name,
303 enum GNUNET_OS_InheritStdioFlags std_inheritance, 313 enum GNUNET_OS_InheritStdioFlags std_inheritance,
304 struct GNUNET_TIME_Relative timeout,
305 GNUNET_ARM_ResultCallback cont, 314 GNUNET_ARM_ResultCallback cont,
306 void *cont_cls); 315 void *cont_cls);
307 316
@@ -316,13 +325,13 @@ struct GNUNET_ARM_MonitorHandle;
316 * Function called in when a status update arrives. 325 * Function called in when a status update arrives.
317 * 326 *
318 * @param cls closure 327 * @param cls closure
319 * @param arm handle to the arm connection
320 * @param service service name 328 * @param service service name
321 * @param status status of the service 329 * @param status status of the service
322 */ 330 */
323typedef void (*GNUNET_ARM_ServiceStatusCallback) (void *cls, 331typedef void
324 const char *service, 332(*GNUNET_ARM_ServiceStatusCallback) (void *cls,
325 enum GNUNET_ARM_ServiceStatus status); 333 const char *service,
334 enum GNUNET_ARM_ServiceStatus status);
326 335
327 336
328/** 337/**
@@ -333,13 +342,13 @@ typedef void (*GNUNET_ARM_ServiceStatusCallback) (void *cls,
333 * the ARM service may internally use a different 342 * the ARM service may internally use a different
334 * configuration to determine how to start the service). 343 * configuration to determine how to start the service).
335 * @param cont callback to invoke on status updates 344 * @param cont callback to invoke on status updates
336 * @param cont_cls closure 345 * @param cont_cls closure for @a cont
337 * @return context to use for further ARM monitor operations, NULL on error. 346 * @return context to use for further ARM monitor operations, NULL on error.
338 */ 347 */
339struct GNUNET_ARM_MonitorHandle * 348struct GNUNET_ARM_MonitorHandle *
340GNUNET_ARM_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg, 349GNUNET_ARM_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
341 GNUNET_ARM_ServiceStatusCallback cont, 350 GNUNET_ARM_ServiceStatusCallback cont,
342 void *cont_cls); 351 void *cont_cls);
343 352
344 353
345/** 354/**
@@ -348,7 +357,7 @@ GNUNET_ARM_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg,
348 * @param h the handle that was being used 357 * @param h the handle that was being used
349 */ 358 */
350void 359void
351GNUNET_ARM_monitor_disconnect_and_free (struct GNUNET_ARM_MonitorHandle *h); 360GNUNET_ARM_monitor_stop (struct GNUNET_ARM_MonitorHandle *h);
352 361
353#if 0 /* keep Emacsens' auto-indent happy */ 362#if 0 /* keep Emacsens' auto-indent happy */
354{ 363{
diff --git a/src/include/gnunet_testbed_logger_service.h b/src/include/gnunet_testbed_logger_service.h
index ce82da5c2..c10c2ee6b 100644
--- a/src/include/gnunet_testbed_logger_service.h
+++ b/src/include/gnunet_testbed_logger_service.h
@@ -75,7 +75,9 @@ GNUNET_TESTBED_LOGGER_disconnect (struct GNUNET_TESTBED_LOGGER_Handle *h);
75 * @param cls the closure given to GNUNET_TESTBED_LOGGER_send() 75 * @param cls the closure given to GNUNET_TESTBED_LOGGER_send()
76 * @param size the amount of data sent 76 * @param size the amount of data sent
77 */ 77 */
78typedef void (*GNUNET_TESTBED_LOGGER_FlushCompletion) (void *cls, size_t size); 78typedef void
79(*GNUNET_TESTBED_LOGGER_FlushCompletion) (void *cls,
80 size_t size);
79 81
80 82
81/** 83/**
@@ -89,7 +91,8 @@ typedef void (*GNUNET_TESTBED_LOGGER_FlushCompletion) (void *cls, size_t size);
89 */ 91 */
90void 92void
91GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h, 93GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h,
92 const void *data, size_t size); 94 const void *data,
95 size_t size);
93 96
94 97
95/** 98/**
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h
index 72b5ede04..e09068444 100644
--- a/src/include/gnunet_testing_lib.h
+++ b/src/include/gnunet_testing_lib.h
@@ -157,9 +157,7 @@ struct GNUNET_TESTING_System *
157GNUNET_TESTING_system_create_with_portrange (const char *testdir, 157GNUNET_TESTING_system_create_with_portrange (const char *testdir,
158 const char *trusted_ip, 158 const char *trusted_ip,
159 const char *hostname, 159 const char *hostname,
160 const struct 160 const struct GNUNET_TESTING_SharedService *shared_services,
161 GNUNET_TESTING_SharedService *
162 shared_services,
163 uint16_t lowport, 161 uint16_t lowport,
164 uint16_t highport); 162 uint16_t highport);
165 163
@@ -185,12 +183,12 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
185 * GNUnet source code. 183 * GNUnet source code.
186 * 184 *
187 * This is primarily a helper function used internally 185 * This is primarily a helper function used internally
188 * by 'GNUNET_TESTING_peer_configure'. 186 * by #GNUNET_TESTING_peer_configure().
189 * 187 *
190 * @param system the testing system handle 188 * @param system the testing system handle
191 * @param key_number desired pre-created hostkey to obtain 189 * @param key_number desired pre-created hostkey to obtain
192 * @param id set to the peer's identity (hash of the public 190 * @param id set to the peer's identity (hash of the public
193 * key; if NULL, GNUNET_SYSERR is returned immediately 191 * key; if NULL, #GNUNET_SYSERR is returned immediately
194 * @return NULL on error (not enough keys) 192 * @return NULL on error (not enough keys)
195 */ 193 */
196struct GNUNET_CRYPTO_EddsaPrivateKey * 194struct GNUNET_CRYPTO_EddsaPrivateKey *
@@ -227,10 +225,10 @@ GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system,
227 * system. The default configuration will be available in PATHS section under 225 * system. The default configuration will be available in PATHS section under
228 * the option DEFAULTCONFIG after the call. SERVICE_HOME is also set in PATHS 226 * the option DEFAULTCONFIG after the call. SERVICE_HOME is also set in PATHS
229 * section to the temporary directory specific to this configuration. If we run 227 * section to the temporary directory specific to this configuration. If we run
230 * out of "*port" numbers, return SYSERR. 228 * out of "*port" numbers, return #GNUNET_SYSERR.
231 * 229 *
232 * This is primarily a helper function used internally 230 * This is primarily a helper function used internally
233 * by 'GNUNET_TESTING_peer_configure'. 231 * by #GNUNET_TESTING_peer_configure().
234 * 232 *
235 * @param system system to use to coordinate resource usage 233 * @param system system to use to coordinate resource usage
236 * @param cfg template configuration to update 234 * @param cfg template configuration to update
@@ -353,9 +351,9 @@ typedef void
353 * 351 *
354 * @param peer the peer to stop 352 * @param peer the peer to stop
355 * @param cb the callback to signal peer shutdown 353 * @param cb the callback to signal peer shutdown
356 * @param cb_cls closure for the above callback 354 * @param cb_cls closure for the @a cb
357 * @return GNUNET_OK upon successfully giving the request to the ARM API (this 355 * @return #GNUNET_OK upon successfully giving the request to the ARM API (this
358 * does not mean that the peer is successfully stopped); GNUNET_SYSERR 356 * does not mean that the peer is successfully stopped); #GNUNET_SYSERR
359 * upon any error. 357 * upon any error.
360 */ 358 */
361int 359int