aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-30 22:27:18 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-30 22:27:18 +0000
commitc4f4203aaff577fdbe60a7a0976e913dbb77f03e (patch)
tree2fca5cb9cdc7b8c8d046c81453313c275d7dd5cd /src/include
parente9dbabbabb9edd41bb7d7cb907826abdd8edb257 (diff)
downloadgnunet-c4f4203aaff577fdbe60a7a0976e913dbb77f03e.tar.gz
gnunet-c4f4203aaff577fdbe60a7a0976e913dbb77f03e.zip
enable setting per-envelope or per-queue transmission options with MQ API
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_core_service.h44
-rw-r--r--src/include/gnunet_mq_lib.h55
2 files changed, 93 insertions, 6 deletions
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index fa74415d6..6ec486b26 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -247,6 +247,16 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
247 int outbound_hdr_only, 247 int outbound_hdr_only,
248 const struct GNUNET_CORE_MessageHandler *handlers); 248 const struct GNUNET_CORE_MessageHandler *handlers);
249 249
250/**
251 * Disconnect from the core service. This function can only
252 * be called *after* all pending #GNUNET_CORE_notify_transmit_ready
253 * requests have been explicitly cancelled.
254 *
255 * @param handle connection to core to disconnect
256 */
257void
258GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle);
259
250 260
251/** 261/**
252 * Connect to the core service. Note that the connection may complete 262 * Connect to the core service. Note that the connection may complete
@@ -282,14 +292,40 @@ GNUNET_CORE_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg,
282 292
283 293
284/** 294/**
285 * Disconnect from the core service. This function can only 295 * Disconnect from the core service.
286 * be called *after* all pending #GNUNET_CORE_notify_transmit_ready
287 * requests have been explicitly cancelled.
288 * 296 *
289 * @param handle connection to core to disconnect 297 * @param handle connection to core to disconnect
290 */ 298 */
291void 299void
292GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle); 300GNUNET_CORE_disconnecT (struct GNUNET_CORE_Handle *handle);
301
302
303/**
304 * Inquire with CORE what options should be set for a message
305 * so that it is transmitted with the given @a priority and
306 * the given @a cork value.
307 *
308 * @param cork desired corking
309 * @param priority desired message priority
310 * @param[out] flags set to `flags` value for #GNUNET_MQ_set_options()
311 * @return `extra` argument to give to #GNUNET_MQ_set_options()
312 */
313const void *
314GNUNET_CORE_get_mq_options (int cork,
315 enum GNUNET_CORE_Priority priority,
316 uint64_t *flags);
317
318
319/**
320 * Obtain the message queue for a connected peer.
321 *
322 * @param h the core handle
323 * @param pid the identity of the peer
324 * @return NULL if @a pid is not connected
325 */
326struct GNUNET_MQ_Handle *
327GNUNET_CORE_get_mq (const struct GNUNET_CORE_Handle *h,
328 const struct GNUNET_PeerIdentity *pid);
293 329
294 330
295/** 331/**
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h
index 43cefca9f..35313263d 100644
--- a/src/include/gnunet_mq_lib.h
+++ b/src/include/gnunet_mq_lib.h
@@ -106,7 +106,7 @@
106 106
107 107
108/** 108/**
109 * Implementation of the GNUNET_MQ_extract_nexted_mh macro. 109 * Implementation of the #GNUNET_MQ_extract_nexted_mh macro.
110 * 110 *
111 * @param mh message header to extract nested message header from 111 * @param mh message header to extract nested message header from
112 * @param base_size size of the message before the nested message's header appears 112 * @param base_size size of the message before the nested message's header appears
@@ -305,7 +305,7 @@ struct GNUNET_MQ_MessageHandler
305/** 305/**
306 * End-marker for the handlers array 306 * End-marker for the handlers array
307 */ 307 */
308#define GNUNET_MQ_handler_end() {NULL, NULL, NULL, 0, 0} 308#define GNUNET_MQ_handler_end() { NULL, NULL, NULL, 0, 0 }
309 309
310 310
311/** 311/**
@@ -434,6 +434,57 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm);
434 434
435 435
436/** 436/**
437 * Function to obtain the current envelope from
438 * within #GNUNET_MQ_SendImpl implementations.
439 *
440 * @param mq message queue to interrogate
441 * @return the current envelope
442 */
443struct GNUNET_MQ_Envelope *
444GNUNET_MQ_get_current_envelope (struct GNUNET_MQ_Handle *mq);
445
446
447/**
448 * Set application-specific options for this envelope.
449 * Overrides the options set for the queue with
450 * #GNUNET_MQ_set_options() for this message only.
451 *
452 * @param env message to set options for
453 * @param flags flags to use (meaning is queue-specific)
454 * @param extra additional buffer for further data (also queue-specific)
455 */
456void
457GNUNET_MQ_env_set_options (struct GNUNET_MQ_Envelope *env,
458 uint64_t flags,
459 const void *extra);
460
461
462/**
463 * Get application-specific options for this envelope.
464 *
465 * @param env message to set options for
466 * @param[out] flags set to flags to use (meaning is queue-specific)
467 * @return extra additional buffer for further data (also queue-specific)
468 */
469const void *
470GNUNET_MQ_env_get_options (struct GNUNET_MQ_Envelope *env,
471 uint64_t *flags);
472
473
474/**
475 * Set application-specific options for this queue.
476 *
477 * @param mq message queue to set options for
478 * @param flags flags to use (meaning is queue-specific)
479 * @param extra additional buffer for further data (also queue-specific)
480 */
481void
482GNUNET_MQ_set_options (struct GNUNET_MQ_Handle *mq,
483 uint64_t flags,
484 const void *extra);
485
486
487/**
437 * Obtain the current length of the message queue. 488 * Obtain the current length of the message queue.
438 * 489 *
439 * @param mq queue to inspect 490 * @param mq queue to inspect