diff options
author | LRN <lrn1986@gmail.com> | 2013-03-20 18:50:18 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2013-03-20 18:50:18 +0000 |
commit | 346748a3a55e197fe206e87b0520cef85ab9fda3 (patch) | |
tree | 37bc351cba1af84ee12e8d5dcd6d596f0456da3f /src/include/gnunet_arm_service.h | |
parent | 41646c7ce6e3d1711beb4b95da08afbd5b79d097 (diff) | |
download | gnunet-346748a3a55e197fe206e87b0520cef85ab9fda3.tar.gz gnunet-346748a3a55e197fe206e87b0520cef85ab9fda3.zip |
Simplify ARM alloc/connect
Diffstat (limited to 'src/include/gnunet_arm_service.h')
-rw-r--r-- | src/include/gnunet_arm_service.h | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h index 4d0f083f7..4cc247d19 100644 --- a/src/include/gnunet_arm_service.h +++ b/src/include/gnunet_arm_service.h | |||
@@ -179,11 +179,12 @@ struct GNUNET_ARM_Handle; | |||
179 | * Function called whenever we connect to or disconnect from ARM. | 179 | * Function called whenever we connect to or disconnect from ARM. |
180 | * | 180 | * |
181 | * @param cls closure | 181 | * @param cls closure |
182 | * @param connected GNUNET_YES if connected, GNUNET_NO if disconnected | 182 | * @param connected GNUNET_YES if connected, GNUNET_NO if disconnected, |
183 | * GNUNET_SYSERR if there was an error. | ||
183 | * @param error GNUNET_YES if we encountered a permanent error, and there | 184 | * @param error GNUNET_YES if we encountered a permanent error, and there |
184 | * will be no re-connection. | 185 | * will be no re-connection. |
185 | */ | 186 | */ |
186 | typedef void (*GNUNET_ARM_ConnectionStatusCallback) (void *cls, struct GNUNET_ARM_Handle *arm, unsigned char connected, unsigned char error); | 187 | typedef void (*GNUNET_ARM_ConnectionStatusCallback) (void *cls, struct GNUNET_ARM_Handle *arm, char connected); |
187 | 188 | ||
188 | 189 | ||
189 | /** | 190 | /** |
@@ -217,28 +218,18 @@ typedef void (*GNUNET_ARM_ServiceListCallback) (void *cls, struct GNUNET_ARM_Han | |||
217 | 218 | ||
218 | 219 | ||
219 | /** | 220 | /** |
220 | * Setup a context for communicating with ARM. Note that this | 221 | * Set up a context for communicating with ARM, then |
221 | * can be done even if the ARM service is not yet running. | 222 | * start connecting to the ARM service using that context. |
222 | * Never fails. | ||
223 | * | 223 | * |
224 | * @param cfg configuration to use (needed to contact ARM; | 224 | * @param cfg configuration to use (needed to contact ARM; |
225 | * the ARM service may internally use a different | 225 | * the ARM service may internally use a different |
226 | * configuration to determine how to start the service). | 226 | * configuration to determine how to start the service). |
227 | * @return context to use for further ARM operations | 227 | * @param conn_status will be called when connecting/disconnecting |
228 | */ | ||
229 | struct GNUNET_ARM_Handle * | ||
230 | GNUNET_ARM_alloc (const struct GNUNET_CONFIGURATION_Handle *cfg); | ||
231 | |||
232 | /** | ||
233 | * Start connecting to the ARM service using the context. | ||
234 | * @param conn_status called when we (dis)connect from/to ARM. | ||
235 | * It's also called on connection errors. | ||
236 | * @param cls closure for conn_status | 228 | * @param cls closure for conn_status |
237 | * | 229 | * @return context to use for further ARM operations, NULL on error. |
238 | * @param h ARM handle | ||
239 | */ | 230 | */ |
240 | void | 231 | struct GNUNET_ARM_Handle * |
241 | GNUNET_ARM_connect (struct GNUNET_ARM_Handle *h, | 232 | GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
242 | GNUNET_ARM_ConnectionStatusCallback conn_status, void *cls); | 233 | GNUNET_ARM_ConnectionStatusCallback conn_status, void *cls); |
243 | 234 | ||
244 | 235 | ||
@@ -321,27 +312,18 @@ typedef void (*GNUNET_ARM_ServiceStatusCallback) (void *cls, struct GNUNET_ARM_M | |||
321 | 312 | ||
322 | 313 | ||
323 | /** | 314 | /** |
324 | * Setup a context for monitoring ARM. Note that this | 315 | * Setup a context for monitoring ARM, then |
325 | * can be done even if the ARM service is not yet running. | 316 | * start connecting to the ARM service for monitoring using that context. |
326 | * Never fails. | ||
327 | * | 317 | * |
328 | * @param cfg configuration to use (needed to contact ARM; | 318 | * @param cfg configuration to use (needed to contact ARM; |
329 | * the ARM service may internally use a different | 319 | * the ARM service may internally use a different |
330 | * configuration to determine how to start the service). | 320 | * configuration to determine how to start the service). |
331 | * @return context to use for further ARM monitor operations | ||
332 | */ | ||
333 | struct GNUNET_ARM_MonitorHandle * | ||
334 | GNUNET_ARM_monitor_alloc (const struct GNUNET_CONFIGURATION_Handle *cfg); | ||
335 | |||
336 | /** | ||
337 | * Start connecting to the ARM service for monitoring using the context. | ||
338 | * | ||
339 | * @param h ARM monitor handle | ||
340 | * @param cont callback to invoke on status updates | 321 | * @param cont callback to invoke on status updates |
341 | * @param cont_cls closure | 322 | * @param cont_cls closure |
323 | * @return context to use for further ARM monitor operations, NULL on error. | ||
342 | */ | 324 | */ |
343 | void | 325 | struct GNUNET_ARM_MonitorHandle * |
344 | GNUNET_ARM_monitor (struct GNUNET_ARM_MonitorHandle *h, | 326 | GNUNET_ARM_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg, |
345 | GNUNET_ARM_ServiceStatusCallback cont, void *cont_cls); | 327 | GNUNET_ARM_ServiceStatusCallback cont, void *cont_cls); |
346 | 328 | ||
347 | 329 | ||
@@ -352,7 +334,7 @@ GNUNET_ARM_monitor (struct GNUNET_ARM_MonitorHandle *h, | |||
352 | * @param h the handle that was being used | 334 | * @param h the handle that was being used |
353 | */ | 335 | */ |
354 | void | 336 | void |
355 | GNUNET_ARM_monitor_disconnect (struct GNUNET_ARM_MonitorHandle *h); | 337 | GNUNET_ARM_monitor_disconnect_and_free (struct GNUNET_ARM_MonitorHandle *h); |
356 | 338 | ||
357 | 339 | ||
358 | #if 0 /* keep Emacsens' auto-indent happy */ | 340 | #if 0 /* keep Emacsens' auto-indent happy */ |