diff options
author | Gabor X Toth <*@tg-x.net> | 2014-07-30 21:18:05 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2014-07-30 21:18:05 +0000 |
commit | 831718fa44b2c56577aa4e36a479fef6debb8cea (patch) | |
tree | 448006c73980613dac5f877d75d52e614d2df920 /src/util | |
parent | b084e26e380fa2a4fe5b970668bdd83a2ad8acc7 (diff) | |
download | gnunet-831718fa44b2c56577aa4e36a479fef6debb8cea.tar.gz gnunet-831718fa44b2c56577aa4e36a479fef6debb8cea.zip |
client manager: documentation
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/client_manager.c | 79 |
1 files changed, 53 insertions, 26 deletions
diff --git a/src/util/client_manager.c b/src/util/client_manager.c index 6ab2c7c6d..f27c5e392 100644 --- a/src/util/client_manager.c +++ b/src/util/client_manager.c | |||
@@ -207,9 +207,12 @@ schedule_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
207 | /** | 207 | /** |
208 | * Transmit next message to service. | 208 | * Transmit next message to service. |
209 | * | 209 | * |
210 | * @param cls The struct GNUNET_PSYC_Channel. | 210 | * @param cls |
211 | * @param size Number of bytes available in @a buf. | 211 | * struct GNUNET_CLIENT_MANAGER_Connection |
212 | * @param buf Where to copy the message. | 212 | * @param size |
213 | * Number of bytes available in @a buf. | ||
214 | * @param buf | ||
215 | * Where to copy the message. | ||
213 | * | 216 | * |
214 | * @return Number of bytes copied to @a buf. | 217 | * @return Number of bytes copied to @a buf. |
215 | */ | 218 | */ |
@@ -292,8 +295,10 @@ transmit_next (struct GNUNET_CLIENT_MANAGER_Connection *mgr) | |||
292 | /** | 295 | /** |
293 | * Try again to connect to the service. | 296 | * Try again to connect to the service. |
294 | * | 297 | * |
295 | * @param cls Channel handle. | 298 | * @param cls |
296 | * @param tc Scheduler context. | 299 | * Channel handle. |
300 | * @param tc | ||
301 | * Scheduler context. | ||
297 | */ | 302 | */ |
298 | static void | 303 | static void |
299 | schedule_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 304 | schedule_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
@@ -314,9 +319,12 @@ schedule_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
314 | /** | 319 | /** |
315 | * Connect to service. | 320 | * Connect to service. |
316 | * | 321 | * |
317 | * @param cfg Configuration to use. | 322 | * @param cfg |
318 | * @param service_name Service name to connect to. | 323 | * Configuration to use. |
319 | * @param handlers Message handlers. | 324 | * @param service_name |
325 | * Service name to connect to. | ||
326 | * @param handlers | ||
327 | * Message handlers. | ||
320 | * | 328 | * |
321 | * @return Client manager connection handle. | 329 | * @return Client manager connection handle. |
322 | */ | 330 | */ |
@@ -340,20 +348,24 @@ GNUNET_CLIENT_MANAGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
340 | /** | 348 | /** |
341 | * Disconnect from the service. | 349 | * Disconnect from the service. |
342 | * | 350 | * |
343 | * @param mgr Client manager connection. | 351 | * @param mgr |
344 | * @param transmit_queue Transmit pending messages in queue before disconnecting. | 352 | * Client manager connection. |
345 | * @param disconnect_cb Function called after disconnected from the service. | 353 | * @param transmit_queue |
346 | * @param disconnect_cls Closure for @a disconnect_cb. | 354 | * Transmit pending messages in queue before disconnecting. |
355 | * @param disconnect_cb | ||
356 | * Function called after disconnected from the service. | ||
357 | * @param cls | ||
358 | * Closure for @a disconnect_cb. | ||
347 | */ | 359 | */ |
348 | void | 360 | void |
349 | GNUNET_CLIENT_MANAGER_disconnect (struct GNUNET_CLIENT_MANAGER_Connection *mgr, | 361 | GNUNET_CLIENT_MANAGER_disconnect (struct GNUNET_CLIENT_MANAGER_Connection *mgr, |
350 | int transmit_queue, | 362 | int transmit_queue, |
351 | GNUNET_ContinuationCallback disconnect_cb, | 363 | GNUNET_ContinuationCallback disconnect_cb, |
352 | void *disconnect_cls) | 364 | void *cls) |
353 | { | 365 | { |
354 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting (%d)\n", transmit_queue); | 366 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting (%d)\n", transmit_queue); |
355 | mgr->disconnect_cb = disconnect_cb; | 367 | mgr->disconnect_cb = disconnect_cb; |
356 | mgr->disconnect_cls = disconnect_cls; | 368 | mgr->disconnect_cls = cls; |
357 | if (NULL != mgr->tmit_head) | 369 | if (NULL != mgr->tmit_head) |
358 | { | 370 | { |
359 | if (GNUNET_YES == transmit_queue) | 371 | if (GNUNET_YES == transmit_queue) |
@@ -395,7 +407,8 @@ GNUNET_CLIENT_MANAGER_disconnect (struct GNUNET_CLIENT_MANAGER_Connection *mgr, | |||
395 | /** | 407 | /** |
396 | * Reschedule connect to the service using exponential back-off. | 408 | * Reschedule connect to the service using exponential back-off. |
397 | * | 409 | * |
398 | * @param mgr Client manager connection. | 410 | * @param mgr |
411 | * Client manager connection. | ||
399 | */ | 412 | */ |
400 | void | 413 | void |
401 | GNUNET_CLIENT_MANAGER_reconnect (struct GNUNET_CLIENT_MANAGER_Connection *mgr) | 414 | GNUNET_CLIENT_MANAGER_reconnect (struct GNUNET_CLIENT_MANAGER_Connection *mgr) |
@@ -426,8 +439,11 @@ GNUNET_CLIENT_MANAGER_reconnect (struct GNUNET_CLIENT_MANAGER_Connection *mgr) | |||
426 | /** | 439 | /** |
427 | * Add a message to the end of the transmission queue. | 440 | * Add a message to the end of the transmission queue. |
428 | * | 441 | * |
429 | * @param mgr Client manager connection. | 442 | * @param mgr |
430 | * @param msg Message to transmit. It is free()'d after transmission. | 443 | * Client manager connection. |
444 | * @param msg | ||
445 | * Message to transmit, should be allocated with GNUNET_malloc() or | ||
446 | * GNUNET_new(), as it is freed with GNUNET_free() after transmission. | ||
431 | */ | 447 | */ |
432 | void | 448 | void |
433 | GNUNET_CLIENT_MANAGER_transmit (struct GNUNET_CLIENT_MANAGER_Connection *mgr, | 449 | GNUNET_CLIENT_MANAGER_transmit (struct GNUNET_CLIENT_MANAGER_Connection *mgr, |
@@ -443,8 +459,11 @@ GNUNET_CLIENT_MANAGER_transmit (struct GNUNET_CLIENT_MANAGER_Connection *mgr, | |||
443 | /** | 459 | /** |
444 | * Add a message to the beginning of the transmission queue. | 460 | * Add a message to the beginning of the transmission queue. |
445 | * | 461 | * |
446 | * @param mgr Client manager connection. | 462 | * @param mgr |
447 | * @param msg Message to transmit. It is free()'d after transmission. | 463 | * Client manager connection. |
464 | * @param msg | ||
465 | * Message to transmit, should be allocated with GNUNET_malloc() or | ||
466 | * GNUNET_new(), as it is freed with GNUNET_free() after transmission. | ||
448 | */ | 467 | */ |
449 | void | 468 | void |
450 | GNUNET_CLIENT_MANAGER_transmit_now (struct GNUNET_CLIENT_MANAGER_Connection *mgr, | 469 | GNUNET_CLIENT_MANAGER_transmit_now (struct GNUNET_CLIENT_MANAGER_Connection *mgr, |
@@ -460,7 +479,8 @@ GNUNET_CLIENT_MANAGER_transmit_now (struct GNUNET_CLIENT_MANAGER_Connection *mgr | |||
460 | /** | 479 | /** |
461 | * Drop all queued messages. | 480 | * Drop all queued messages. |
462 | * | 481 | * |
463 | * @param mgr Client manager connection. | 482 | * @param mgr |
483 | * Client manager connection. | ||
464 | */ | 484 | */ |
465 | void | 485 | void |
466 | GNUNET_CLIENT_MANAGER_drop_queue (struct GNUNET_CLIENT_MANAGER_Connection *mgr) | 486 | GNUNET_CLIENT_MANAGER_drop_queue (struct GNUNET_CLIENT_MANAGER_Connection *mgr) |
@@ -479,7 +499,8 @@ GNUNET_CLIENT_MANAGER_drop_queue (struct GNUNET_CLIENT_MANAGER_Connection *mgr) | |||
479 | /** | 499 | /** |
480 | * Obtain client connection handle. | 500 | * Obtain client connection handle. |
481 | * | 501 | * |
482 | * @param mgr Client manager connection handle. | 502 | * @param mgr |
503 | * Client manager connection. | ||
483 | * | 504 | * |
484 | * @return Client connection handle. | 505 | * @return Client connection handle. |
485 | */ | 506 | */ |
@@ -494,8 +515,11 @@ GNUNET_CLIENT_MANAGER_get_client (struct GNUNET_CLIENT_MANAGER_Connection *mgr) | |||
494 | * Return user context associated with the given client. | 515 | * Return user context associated with the given client. |
495 | * Note: you should probably use the macro (call without the underscore). | 516 | * Note: you should probably use the macro (call without the underscore). |
496 | * | 517 | * |
497 | * @param mgr Client manager connection. | 518 | * @param mgr |
498 | * @param size Number of bytes in user context struct (for verification only). | 519 | * Client manager connection. |
520 | * @param size | ||
521 | * Number of bytes in user context struct (for verification only). | ||
522 | * | ||
499 | * @return User context. | 523 | * @return User context. |
500 | */ | 524 | */ |
501 | void * | 525 | void * |
@@ -514,9 +538,12 @@ GNUNET_CLIENT_MANAGER_get_user_context_ (struct GNUNET_CLIENT_MANAGER_Connection | |||
514 | * Set user context to be associated with the given client. | 538 | * Set user context to be associated with the given client. |
515 | * Note: you should probably use the macro (call without the underscore). | 539 | * Note: you should probably use the macro (call without the underscore). |
516 | * | 540 | * |
517 | * @param mgr Client manager connection. | 541 | * @param mgr |
518 | * @param ctx User context. | 542 | * Client manager connection. |
519 | * @param size Number of bytes in user context struct (for verification only). | 543 | * @param ctx |
544 | * User context. | ||
545 | * @param size | ||
546 | * Number of bytes in user context struct (for verification only). | ||
520 | */ | 547 | */ |
521 | void | 548 | void |
522 | GNUNET_CLIENT_MANAGER_set_user_context_ (struct GNUNET_CLIENT_MANAGER_Connection *mgr, | 549 | GNUNET_CLIENT_MANAGER_set_user_context_ (struct GNUNET_CLIENT_MANAGER_Connection *mgr, |