aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_service_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-09-19 13:26:44 +0000
committerChristian Grothoff <christian@grothoff.org>2016-09-19 13:26:44 +0000
commit64fda257bdaf166ed3d96dce3a01ea14017a2a3e (patch)
treee33c077dcb46d06755fb4d0b37f829d7f6a0731e /src/include/gnunet_service_lib.h
parent08f1726b6552ac29830637e9f7be4d42e2ea4294 (diff)
downloadgnunet-64fda257bdaf166ed3d96dce3a01ea14017a2a3e.tar.gz
gnunet-64fda257bdaf166ed3d96dce3a01ea14017a2a3e.zip
misc minor fixes for new service MQ API, implementing resolver using new service API
Diffstat (limited to 'src/include/gnunet_service_lib.h')
-rw-r--r--src/include/gnunet_service_lib.h36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h
index 797857ed8..9c7009ef4 100644
--- a/src/include/gnunet_service_lib.h
+++ b/src/include/gnunet_service_lib.h
@@ -336,16 +336,36 @@ GNUNET_SERVICE_ruN_ (int argc,
336 * @param connect_cb function to call whenever a client connects 336 * @param connect_cb function to call whenever a client connects
337 * @param disconnect_cb function to call whenever a client disconnects 337 * @param disconnect_cb function to call whenever a client disconnects
338 * @param cls closure argument for @a service_init_cb, @a connect_cb and @a disconnect_cb 338 * @param cls closure argument for @a service_init_cb, @a connect_cb and @a disconnect_cb
339 * @param handlers NULL-terminated array of message handlers for the service, 339 * @param ... array of message handlers for the service, terminated
340 * by #GNUNET_MQ_handler_end();
340 * the closure will be set to the value returned by 341 * the closure will be set to the value returned by
341 * the @a connect_cb for the respective connection 342 * the @a connect_cb for the respective connection
342 * @return 0 on success, non-zero on error 343 * @return 0 on success, non-zero on error
344 *
345 * Sample invocation:
346 * <code>
347 * GNUNET_SERVICE_MAIN
348 * ("resolver",
349 * GNUNET_SERVICE_OPTION_NONE,
350 * &init_cb,
351 * &connect_cb,
352 * &disconnect_cb,
353 * closure_for_cb,
354 * GNUNET_MQ_hd_var_size (get,
355 * GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST,
356 * struct GNUNET_RESOLVER_GetMessage,
357 * NULL),
358 * GNUNET_MQ_handler_end ());
359 * </code>
343 */ 360 */
344#define GNUNET_SERVICE_MAIN(service_name,service_options,init_cb,connect_cb,disconnect_cb,cls,handlers) \ 361#define GNUNET_SERVICE_MAIN(service_name,service_options,init_cb,connect_cb,disconnect_cb,cls,...) \
345 int \ 362 int \
346 main (int argc,\ 363 main (int argc,\
347 char *const *argv)\ 364 char *const *argv)\
348 { \ 365 { \
366 struct GNUNET_MQ_MessageHandler mh[] = { \
367 __VA_ARGS__ \
368 }; \
349 return GNUNET_SERVICE_ruN_ (argc, \ 369 return GNUNET_SERVICE_ruN_ (argc, \
350 argv, \ 370 argv, \
351 service_name, \ 371 service_name, \
@@ -354,7 +374,7 @@ GNUNET_SERVICE_ruN_ (int argc,
354 connect_cb, \ 374 connect_cb, \
355 disconnect_cb, \ 375 disconnect_cb, \
356 cls, \ 376 cls, \
357 handlers); \ 377 mh); \
358 } 378 }
359 379
360 380
@@ -388,6 +408,16 @@ GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c);
388 408
389 409
390/** 410/**
411 * Obtain the message queue of @a c. Convenience function.
412 *
413 * @param c the client to continue receiving from
414 * @return the message queue of @a c
415 */
416struct GNUNET_MQ_Handle *
417GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c);
418
419
420/**
391 * Disable the warning the server issues if a message is not 421 * Disable the warning the server issues if a message is not
392 * acknowledged in a timely fashion. Use this call if a client is 422 * acknowledged in a timely fashion. Use this call if a client is
393 * intentionally delayed for a while. Only applies to the current 423 * intentionally delayed for a while. Only applies to the current