aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_mq_lib.h
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-09-08 12:33:09 +0000
committerng0 <ng0@n0.is>2019-09-08 12:33:09 +0000
commitd41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch)
tree9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/include/gnunet_mq_lib.h
parenta0fce305c565c0937d917a92712f15e9c5736260 (diff)
downloadgnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz
gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip
uncrustify as demanded.
Diffstat (limited to 'src/include/gnunet_mq_lib.h')
-rw-r--r--src/include/gnunet_mq_lib.h258
1 files changed, 125 insertions, 133 deletions
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h
index f3073d54b..1839a68bd 100644
--- a/src/include/gnunet_mq_lib.h
+++ b/src/include/gnunet_mq_lib.h
@@ -16,7 +16,7 @@
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21/** 21/**
22 * @author Florian Dold 22 * @author Florian Dold
@@ -50,9 +50,9 @@
50 * @return the MQ message 50 * @return the MQ message
51 */ 51 */
52#define GNUNET_MQ_msg_extra(mvar, esize, type) \ 52#define GNUNET_MQ_msg_extra(mvar, esize, type) \
53 GNUNET_MQ_msg_ (((struct GNUNET_MessageHeader **) &(mvar)), \ 53 GNUNET_MQ_msg_(((struct GNUNET_MessageHeader **)&(mvar)), \
54 (esize) + sizeof *(mvar), \ 54 (esize) + sizeof *(mvar), \
55 (type)) 55 (type))
56 56
57/** 57/**
58 * Allocate a GNUNET_MQ_Envelope. 58 * Allocate a GNUNET_MQ_Envelope.
@@ -64,7 +64,7 @@
64 * @param type type of the message 64 * @param type type of the message
65 * @return the allocated envelope 65 * @return the allocated envelope
66 */ 66 */
67#define GNUNET_MQ_msg(mvar, type) GNUNET_MQ_msg_extra (mvar, 0, type) 67#define GNUNET_MQ_msg(mvar, type) GNUNET_MQ_msg_extra(mvar, 0, type)
68 68
69 69
70/** 70/**
@@ -74,7 +74,7 @@
74 * @param type type of the message 74 * @param type type of the message
75 */ 75 */
76#define GNUNET_MQ_msg_header(type) \ 76#define GNUNET_MQ_msg_header(type) \
77 GNUNET_MQ_msg_ (NULL, sizeof (struct GNUNET_MessageHeader), type) 77 GNUNET_MQ_msg_(NULL, sizeof(struct GNUNET_MessageHeader), type)
78 78
79 79
80/** 80/**
@@ -86,7 +86,7 @@
86 * @param type type of the message 86 * @param type type of the message
87 */ 87 */
88#define GNUNET_MQ_msg_header_extra(mh, esize, type) \ 88#define GNUNET_MQ_msg_header_extra(mh, esize, type) \
89 GNUNET_MQ_msg_ (&mh, (esize) + sizeof (struct GNUNET_MessageHeader), type) 89 GNUNET_MQ_msg_(&mh, (esize) + sizeof(struct GNUNET_MessageHeader), type)
90 90
91 91
92/** 92/**
@@ -102,11 +102,11 @@
102#define GNUNET_MQ_msg_nested_mh(mvar, type, mh) \ 102#define GNUNET_MQ_msg_nested_mh(mvar, type, mh) \
103 ({ \ 103 ({ \
104 struct GNUNET_MQ_Envelope *_ev; \ 104 struct GNUNET_MQ_Envelope *_ev; \
105 _ev = GNUNET_MQ_msg_nested_mh_ ((struct GNUNET_MessageHeader **) &(mvar), \ 105 _ev = GNUNET_MQ_msg_nested_mh_((struct GNUNET_MessageHeader **)&(mvar), \
106 sizeof (*(mvar)), \ 106 sizeof(*(mvar)), \
107 (type), \ 107 (type), \
108 (mh)); \ 108 (mh)); \
109 (void) (mvar)->header; /* type check */ \ 109 (void)(mvar)->header; /* type check */ \
110 _ev; \ 110 _ev; \
111 }) 111 })
112 112
@@ -120,8 +120,8 @@
120 * or NULL if the given message in @a var does not have any space after the message struct 120 * or NULL if the given message in @a var does not have any space after the message struct
121 */ 121 */
122#define GNUNET_MQ_extract_nested_mh(var) \ 122#define GNUNET_MQ_extract_nested_mh(var) \
123 GNUNET_MQ_extract_nested_mh_ ((struct GNUNET_MessageHeader *) (var), \ 123 GNUNET_MQ_extract_nested_mh_((struct GNUNET_MessageHeader *)(var), \
124 sizeof (*(var))) 124 sizeof(*(var)))
125 125
126 126
127/** 127/**
@@ -133,8 +133,8 @@
133 * OR NULL in case of a malformed message. 133 * OR NULL in case of a malformed message.
134 */ 134 */
135const struct GNUNET_MessageHeader * 135const struct GNUNET_MessageHeader *
136GNUNET_MQ_extract_nested_mh_ (const struct GNUNET_MessageHeader *mh, 136GNUNET_MQ_extract_nested_mh_(const struct GNUNET_MessageHeader *mh,
137 uint16_t base_size); 137 uint16_t base_size);
138 138
139 139
140/** 140/**
@@ -150,7 +150,7 @@ struct GNUNET_MQ_Envelope;
150 * @return message contained in the envelope 150 * @return message contained in the envelope
151 */ 151 */
152const struct GNUNET_MessageHeader * 152const struct GNUNET_MessageHeader *
153GNUNET_MQ_env_get_msg (const struct GNUNET_MQ_Envelope *env); 153GNUNET_MQ_env_get_msg(const struct GNUNET_MQ_Envelope *env);
154 154
155 155
156/** 156/**
@@ -160,7 +160,7 @@ GNUNET_MQ_env_get_msg (const struct GNUNET_MQ_Envelope *env);
160 * @return next one, or NULL 160 * @return next one, or NULL
161 */ 161 */
162const struct GNUNET_MQ_Envelope * 162const struct GNUNET_MQ_Envelope *
163GNUNET_MQ_env_next (const struct GNUNET_MQ_Envelope *env); 163GNUNET_MQ_env_next(const struct GNUNET_MQ_Envelope *env);
164 164
165 165
166/** 166/**
@@ -173,10 +173,10 @@ GNUNET_MQ_env_next (const struct GNUNET_MQ_Envelope *env);
173 * @param nested_mh the message to append to the message after base_size 173 * @param nested_mh the message to append to the message after base_size
174 */ 174 */
175struct GNUNET_MQ_Envelope * 175struct GNUNET_MQ_Envelope *
176GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp, 176GNUNET_MQ_msg_nested_mh_(struct GNUNET_MessageHeader **mhp,
177 uint16_t base_size, 177 uint16_t base_size,
178 uint16_t type, 178 uint16_t type,
179 const struct GNUNET_MessageHeader *nested_mh); 179 const struct GNUNET_MessageHeader *nested_mh);
180 180
181 181
182/** 182/**
@@ -188,8 +188,7 @@ struct GNUNET_MQ_Handle;
188/** 188/**
189 * Error codes for the queue. 189 * Error codes for the queue.
190 */ 190 */
191enum GNUNET_MQ_Error 191enum GNUNET_MQ_Error {
192{
193 /** 192 /**
194 * Failed to read message from the network. 193 * Failed to read message from the network.
195 * FIXME: Likely not properly distinguished 194 * FIXME: Likely not properly distinguished
@@ -224,9 +223,7 @@ enum GNUNET_MQ_Error
224/** 223/**
225 * Per envelope preferences and priorities. 224 * Per envelope preferences and priorities.
226 */ 225 */
227enum GNUNET_MQ_PriorityPreferences 226enum GNUNET_MQ_PriorityPreferences {
228{
229
230 /** 227 /**
231 * Lowest priority, i.e. background traffic (i.e. NSE, FS). 228 * Lowest priority, i.e. background traffic (i.e. NSE, FS).
232 * This is the default! 229 * This is the default!
@@ -297,7 +294,6 @@ enum GNUNET_MQ_PriorityPreferences
297 * Flag to indicate that out-of-order delivery is OK. 294 * Flag to indicate that out-of-order delivery is OK.
298 */ 295 */
299 GNUNET_MQ_PREF_OUT_OF_ORDER = 256, 296 GNUNET_MQ_PREF_OUT_OF_ORDER = 256,
300
301}; 297};
302 298
303 299
@@ -386,9 +382,9 @@ typedef void (*GNUNET_MQ_ErrorHandler) (void *cls, enum GNUNET_MQ_Error error);
386 * @param[in|out] env element to insert at the tail 382 * @param[in|out] env element to insert at the tail
387 */ 383 */
388void 384void
389GNUNET_MQ_dll_insert_head (struct GNUNET_MQ_Envelope **env_head, 385GNUNET_MQ_dll_insert_head(struct GNUNET_MQ_Envelope **env_head,
390 struct GNUNET_MQ_Envelope **env_tail, 386 struct GNUNET_MQ_Envelope **env_tail,
391 struct GNUNET_MQ_Envelope *env); 387 struct GNUNET_MQ_Envelope *env);
392 388
393 389
394/** 390/**
@@ -404,9 +400,9 @@ GNUNET_MQ_dll_insert_head (struct GNUNET_MQ_Envelope **env_head,
404 * @param[in|out] env element to insert at the tail 400 * @param[in|out] env element to insert at the tail
405 */ 401 */
406void 402void
407GNUNET_MQ_dll_insert_tail (struct GNUNET_MQ_Envelope **env_head, 403GNUNET_MQ_dll_insert_tail(struct GNUNET_MQ_Envelope **env_head,
408 struct GNUNET_MQ_Envelope **env_tail, 404 struct GNUNET_MQ_Envelope **env_tail,
409 struct GNUNET_MQ_Envelope *env); 405 struct GNUNET_MQ_Envelope *env);
410 406
411 407
412/** 408/**
@@ -422,9 +418,9 @@ GNUNET_MQ_dll_insert_tail (struct GNUNET_MQ_Envelope **env_head,
422 * @param[in|out] env element to remove from the DLL 418 * @param[in|out] env element to remove from the DLL
423 */ 419 */
424void 420void
425GNUNET_MQ_dll_remove (struct GNUNET_MQ_Envelope **env_head, 421GNUNET_MQ_dll_remove(struct GNUNET_MQ_Envelope **env_head,
426 struct GNUNET_MQ_Envelope **env_tail, 422 struct GNUNET_MQ_Envelope **env_tail,
427 struct GNUNET_MQ_Envelope *env); 423 struct GNUNET_MQ_Envelope *env);
428 424
429 425
430/** 426/**
@@ -438,7 +434,7 @@ GNUNET_MQ_dll_remove (struct GNUNET_MQ_Envelope **env_head,
438 * Needs to be freed with #GNUNET_free. 434 * Needs to be freed with #GNUNET_free.
439 */ 435 */
440struct GNUNET_MQ_MessageHandler * 436struct GNUNET_MQ_MessageHandler *
441GNUNET_MQ_copy_handlers (const struct GNUNET_MQ_MessageHandler *handlers); 437GNUNET_MQ_copy_handlers(const struct GNUNET_MQ_MessageHandler *handlers);
442 438
443 439
444/** 440/**
@@ -454,9 +450,9 @@ GNUNET_MQ_copy_handlers (const struct GNUNET_MQ_MessageHandler *handlers);
454 * Needs to be freed with #GNUNET_free. 450 * Needs to be freed with #GNUNET_free.
455 */ 451 */
456struct GNUNET_MQ_MessageHandler * 452struct GNUNET_MQ_MessageHandler *
457GNUNET_MQ_copy_handlers2 (const struct GNUNET_MQ_MessageHandler *handlers, 453GNUNET_MQ_copy_handlers2(const struct GNUNET_MQ_MessageHandler *handlers,
458 GNUNET_MQ_MessageCallback agpl_handler, 454 GNUNET_MQ_MessageCallback agpl_handler,
459 void *agpl_cls); 455 void *agpl_cls);
460 456
461 457
462/** 458/**
@@ -466,14 +462,13 @@ GNUNET_MQ_copy_handlers2 (const struct GNUNET_MQ_MessageHandler *handlers,
466 * @return The number of handlers in the array. 462 * @return The number of handlers in the array.
467 */ 463 */
468unsigned int 464unsigned int
469GNUNET_MQ_count_handlers (const struct GNUNET_MQ_MessageHandler *handlers); 465GNUNET_MQ_count_handlers(const struct GNUNET_MQ_MessageHandler *handlers);
470 466
471 467
472/** 468/**
473 * Message handler for a specific message type. 469 * Message handler for a specific message type.
474 */ 470 */
475struct GNUNET_MQ_MessageHandler 471struct GNUNET_MQ_MessageHandler {
476{
477 /** 472 /**
478 * Callback to validate a message of the specified @e type. 473 * Callback to validate a message of the specified @e type.
479 * The closure given to @e mv will be this struct (not @e ctx). 474 * The closure given to @e mv will be this struct (not @e ctx).
@@ -549,12 +544,12 @@ struct GNUNET_MQ_MessageHandler
549 */ 544 */
550#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx) \ 545#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx) \
551 ({ \ 546 ({ \
552 void (*_cb) (void *cls, const str *msg) = &handle_##name; \ 547 void (*_cb)(void *cls, const str *msg) = &handle_ ## name; \
553 ((struct GNUNET_MQ_MessageHandler){NULL, \ 548 ((struct GNUNET_MQ_MessageHandler){ NULL, \
554 (GNUNET_MQ_MessageCallback) _cb, \ 549 (GNUNET_MQ_MessageCallback)_cb, \
555 (ctx), \ 550 (ctx), \
556 (code), \ 551 (code), \
557 sizeof (str)}); \ 552 sizeof(str) }); \
558 }) 553 })
559 554
560 555
@@ -600,14 +595,14 @@ struct GNUNET_MQ_MessageHandler
600 */ 595 */
601#define GNUNET_MQ_hd_var_size(name, code, str, ctx) \ 596#define GNUNET_MQ_hd_var_size(name, code, str, ctx) \
602 __extension__({ \ 597 __extension__({ \
603 int (*_mv) (void *cls, const str *msg) = &check_##name; \ 598 int (*_mv)(void *cls, const str *msg) = &check_ ## name; \
604 void (*_cb) (void *cls, const str *msg) = &handle_##name; \ 599 void (*_cb)(void *cls, const str *msg) = &handle_ ## name; \
605 ((struct GNUNET_MQ_MessageHandler){(GNUNET_MQ_MessageValidationCallback) \ 600 ((struct GNUNET_MQ_MessageHandler){ (GNUNET_MQ_MessageValidationCallback) \
606 _mv, \ 601 _mv, \
607 (GNUNET_MQ_MessageCallback) _cb, \ 602 (GNUNET_MQ_MessageCallback)_cb, \
608 (ctx), \ 603 (ctx), \
609 (code), \ 604 (code), \
610 sizeof (str)}); \ 605 sizeof(str) }); \
611 }) 606 })
612 607
613 608
@@ -623,15 +618,15 @@ struct GNUNET_MQ_MessageHandler
623 */ 618 */
624#define GNUNET_MQ_check_zero_termination(m) \ 619#define GNUNET_MQ_check_zero_termination(m) \
625 { \ 620 { \
626 const char *str = (const char *) &m[1]; \ 621 const char *str = (const char *)&m[1]; \
627 const struct GNUNET_MessageHeader *hdr = \ 622 const struct GNUNET_MessageHeader *hdr = \
628 (const struct GNUNET_MessageHeader *) m; \ 623 (const struct GNUNET_MessageHeader *)m; \
629 uint16_t slen = ntohs (hdr->size) - sizeof (*m); \ 624 uint16_t slen = ntohs(hdr->size) - sizeof(*m); \
630 if ((0 == slen) || (memchr (str, 0, slen) != &str[slen - 1])) \ 625 if ((0 == slen) || (memchr(str, 0, slen) != &str[slen - 1])) \
631 { \ 626 { \
632 GNUNET_break (0); \ 627 GNUNET_break(0); \
633 return GNUNET_NO; \ 628 return GNUNET_NO; \
634 } \ 629 } \
635 } 630 }
636 631
637 632
@@ -650,16 +645,16 @@ struct GNUNET_MQ_MessageHandler
650#define GNUNET_MQ_check_boxed_message(m) \ 645#define GNUNET_MQ_check_boxed_message(m) \
651 { \ 646 { \
652 const struct GNUNET_MessageHeader *inbox = \ 647 const struct GNUNET_MessageHeader *inbox = \
653 (const struct GNUNET_MessageHeader *) &m[1]; \ 648 (const struct GNUNET_MessageHeader *)&m[1]; \
654 const struct GNUNET_MessageHeader *hdr = \ 649 const struct GNUNET_MessageHeader *hdr = \
655 (const struct GNUNET_MessageHeader *) m; \ 650 (const struct GNUNET_MessageHeader *)m; \
656 uint16_t slen = ntohs (hdr->size) - sizeof (*m); \ 651 uint16_t slen = ntohs(hdr->size) - sizeof(*m); \
657 if ((slen < sizeof (struct GNUNET_MessageHeader)) || \ 652 if ((slen < sizeof(struct GNUNET_MessageHeader)) || \
658 (slen != ntohs (inbox->size))) \ 653 (slen != ntohs(inbox->size))) \
659 { \ 654 { \
660 GNUNET_break (0); \ 655 GNUNET_break(0); \
661 return GNUNET_NO; \ 656 return GNUNET_NO; \
662 } \ 657 } \
663 } 658 }
664 659
665 660
@@ -676,8 +671,8 @@ struct GNUNET_MQ_MessageHandler
676 * #GNUNET_SYSERR if message was rejected by check function 671 * #GNUNET_SYSERR if message was rejected by check function
677 */ 672 */
678int 673int
679GNUNET_MQ_handle_message (const struct GNUNET_MQ_MessageHandler *handlers, 674GNUNET_MQ_handle_message(const struct GNUNET_MQ_MessageHandler *handlers,
680 const struct GNUNET_MessageHeader *mh); 675 const struct GNUNET_MessageHeader *mh);
681 676
682 677
683/** 678/**
@@ -689,9 +684,9 @@ GNUNET_MQ_handle_message (const struct GNUNET_MQ_MessageHandler *handlers,
689 * @return the allocated MQ message 684 * @return the allocated MQ message
690 */ 685 */
691struct GNUNET_MQ_Envelope * 686struct GNUNET_MQ_Envelope *
692GNUNET_MQ_msg_ (struct GNUNET_MessageHeader **mhp, 687GNUNET_MQ_msg_(struct GNUNET_MessageHeader **mhp,
693 uint16_t size, 688 uint16_t size,
694 uint16_t type); 689 uint16_t type);
695 690
696 691
697/** 692/**
@@ -701,7 +696,7 @@ GNUNET_MQ_msg_ (struct GNUNET_MessageHeader **mhp,
701 * @return envelope containing @a hdr 696 * @return envelope containing @a hdr
702 */ 697 */
703struct GNUNET_MQ_Envelope * 698struct GNUNET_MQ_Envelope *
704GNUNET_MQ_msg_copy (const struct GNUNET_MessageHeader *hdr); 699GNUNET_MQ_msg_copy(const struct GNUNET_MessageHeader *hdr);
705 700
706 701
707/** 702/**
@@ -712,7 +707,7 @@ GNUNET_MQ_msg_copy (const struct GNUNET_MessageHeader *hdr);
712 * @param mqm the message to discard 707 * @param mqm the message to discard
713 */ 708 */
714void 709void
715GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm); 710GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm);
716 711
717 712
718/** 713/**
@@ -723,7 +718,7 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm);
723 * @return the current envelope 718 * @return the current envelope
724 */ 719 */
725struct GNUNET_MQ_Envelope * 720struct GNUNET_MQ_Envelope *
726GNUNET_MQ_get_current_envelope (struct GNUNET_MQ_Handle *mq); 721GNUNET_MQ_get_current_envelope(struct GNUNET_MQ_Handle *mq);
727 722
728 723
729/** 724/**
@@ -734,7 +729,7 @@ GNUNET_MQ_get_current_envelope (struct GNUNET_MQ_Handle *mq);
734 * @return copy of @a env 729 * @return copy of @a env
735 */ 730 */
736struct GNUNET_MQ_Envelope * 731struct GNUNET_MQ_Envelope *
737GNUNET_MQ_env_copy (struct GNUNET_MQ_Envelope *env); 732GNUNET_MQ_env_copy(struct GNUNET_MQ_Envelope *env);
738 733
739 734
740/** 735/**
@@ -744,7 +739,7 @@ GNUNET_MQ_env_copy (struct GNUNET_MQ_Envelope *env);
744 * @return the last envelope in the queue 739 * @return the last envelope in the queue
745 */ 740 */
746struct GNUNET_MQ_Envelope * 741struct GNUNET_MQ_Envelope *
747GNUNET_MQ_get_last_envelope (struct GNUNET_MQ_Handle *mq); 742GNUNET_MQ_get_last_envelope(struct GNUNET_MQ_Handle *mq);
748 743
749 744
750/** 745/**
@@ -756,8 +751,8 @@ GNUNET_MQ_get_last_envelope (struct GNUNET_MQ_Handle *mq);
756 * @param pp priority and preferences to set for @a env 751 * @param pp priority and preferences to set for @a env
757 */ 752 */
758void 753void
759GNUNET_MQ_env_set_options (struct GNUNET_MQ_Envelope *env, 754GNUNET_MQ_env_set_options(struct GNUNET_MQ_Envelope *env,
760 enum GNUNET_MQ_PriorityPreferences pp); 755 enum GNUNET_MQ_PriorityPreferences pp);
761 756
762 757
763/** 758/**
@@ -767,7 +762,7 @@ GNUNET_MQ_env_set_options (struct GNUNET_MQ_Envelope *env,
767 * @return priority and preferences to use 762 * @return priority and preferences to use
768 */ 763 */
769enum GNUNET_MQ_PriorityPreferences 764enum GNUNET_MQ_PriorityPreferences
770GNUNET_MQ_env_get_options (struct GNUNET_MQ_Envelope *env); 765GNUNET_MQ_env_get_options(struct GNUNET_MQ_Envelope *env);
771 766
772 767
773/** 768/**
@@ -779,8 +774,8 @@ GNUNET_MQ_env_get_options (struct GNUNET_MQ_Envelope *env);
779 * @return combined priority and preferences to use 774 * @return combined priority and preferences to use
780 */ 775 */
781enum GNUNET_MQ_PriorityPreferences 776enum GNUNET_MQ_PriorityPreferences
782GNUNET_MQ_env_combine_options (enum GNUNET_MQ_PriorityPreferences p1, 777GNUNET_MQ_env_combine_options(enum GNUNET_MQ_PriorityPreferences p1,
783 enum GNUNET_MQ_PriorityPreferences p2); 778 enum GNUNET_MQ_PriorityPreferences p2);
784 779
785 780
786/** 781/**
@@ -791,7 +786,7 @@ GNUNET_MQ_env_combine_options (enum GNUNET_MQ_PriorityPreferences p1,
791 * @return NULL if queue is empty (or has no envelope that is not under transmission) 786 * @return NULL if queue is empty (or has no envelope that is not under transmission)
792 */ 787 */
793struct GNUNET_MQ_Envelope * 788struct GNUNET_MQ_Envelope *
794GNUNET_MQ_unsent_head (struct GNUNET_MQ_Handle *mq); 789GNUNET_MQ_unsent_head(struct GNUNET_MQ_Handle *mq);
795 790
796 791
797/** 792/**
@@ -801,8 +796,8 @@ GNUNET_MQ_unsent_head (struct GNUNET_MQ_Handle *mq);
801 * @param pp priority and preferences to use by default 796 * @param pp priority and preferences to use by default
802 */ 797 */
803void 798void
804GNUNET_MQ_set_options (struct GNUNET_MQ_Handle *mq, 799GNUNET_MQ_set_options(struct GNUNET_MQ_Handle *mq,
805 enum GNUNET_MQ_PriorityPreferences pp); 800 enum GNUNET_MQ_PriorityPreferences pp);
806 801
807 802
808/** 803/**
@@ -812,7 +807,7 @@ GNUNET_MQ_set_options (struct GNUNET_MQ_Handle *mq,
812 * @return number of queued, non-transmitted messages 807 * @return number of queued, non-transmitted messages
813 */ 808 */
814unsigned int 809unsigned int
815GNUNET_MQ_get_length (struct GNUNET_MQ_Handle *mq); 810GNUNET_MQ_get_length(struct GNUNET_MQ_Handle *mq);
816 811
817 812
818/** 813/**
@@ -823,7 +818,7 @@ GNUNET_MQ_get_length (struct GNUNET_MQ_Handle *mq);
823 * @param ev the envelope with the message to send. 818 * @param ev the envelope with the message to send.
824 */ 819 */
825void 820void
826GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev); 821GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev);
827 822
828 823
829/** 824/**
@@ -834,8 +829,8 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev);
834 * @param ev the envelope with the message to send. 829 * @param ev the envelope with the message to send.
835 */ 830 */
836void 831void
837GNUNET_MQ_send_copy (struct GNUNET_MQ_Handle *mq, 832GNUNET_MQ_send_copy(struct GNUNET_MQ_Handle *mq,
838 const struct GNUNET_MQ_Envelope *ev); 833 const struct GNUNET_MQ_Envelope *ev);
839 834
840 835
841/** 836/**
@@ -846,7 +841,7 @@ GNUNET_MQ_send_copy (struct GNUNET_MQ_Handle *mq,
846 * @param ev queued envelope to cancel 841 * @param ev queued envelope to cancel
847 */ 842 */
848void 843void
849GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev); 844GNUNET_MQ_send_cancel(struct GNUNET_MQ_Envelope *ev);
850 845
851 846
852/** 847/**
@@ -856,7 +851,7 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev);
856 * @param assoc_data to associate 851 * @param assoc_data to associate
857 */ 852 */
858uint32_t 853uint32_t
859GNUNET_MQ_assoc_add (struct GNUNET_MQ_Handle *mq, void *assoc_data); 854GNUNET_MQ_assoc_add(struct GNUNET_MQ_Handle *mq, void *assoc_data);
860 855
861 856
862/** 857/**
@@ -867,7 +862,7 @@ GNUNET_MQ_assoc_add (struct GNUNET_MQ_Handle *mq, void *assoc_data);
867 * @return the associated data 862 * @return the associated data
868 */ 863 */
869void * 864void *
870GNUNET_MQ_assoc_get (struct GNUNET_MQ_Handle *mq, uint32_t request_id); 865GNUNET_MQ_assoc_get(struct GNUNET_MQ_Handle *mq, uint32_t request_id);
871 866
872 867
873/** 868/**
@@ -878,7 +873,7 @@ GNUNET_MQ_assoc_get (struct GNUNET_MQ_Handle *mq, uint32_t request_id);
878 * @return the associated data 873 * @return the associated data
879 */ 874 */
880void * 875void *
881GNUNET_MQ_assoc_remove (struct GNUNET_MQ_Handle *mq, uint32_t request_id); 876GNUNET_MQ_assoc_remove(struct GNUNET_MQ_Handle *mq, uint32_t request_id);
882 877
883 878
884/** 879/**
@@ -894,13 +889,13 @@ GNUNET_MQ_assoc_remove (struct GNUNET_MQ_Handle *mq, uint32_t request_id);
894 * @return a new message queue 889 * @return a new message queue
895 */ 890 */
896struct GNUNET_MQ_Handle * 891struct GNUNET_MQ_Handle *
897GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send, 892GNUNET_MQ_queue_for_callbacks(GNUNET_MQ_SendImpl send,
898 GNUNET_MQ_DestroyImpl destroy, 893 GNUNET_MQ_DestroyImpl destroy,
899 GNUNET_MQ_CancelImpl cancel, 894 GNUNET_MQ_CancelImpl cancel,
900 void *impl_state, 895 void *impl_state,
901 const struct GNUNET_MQ_MessageHandler *handlers, 896 const struct GNUNET_MQ_MessageHandler *handlers,
902 GNUNET_MQ_ErrorHandler error_handler, 897 GNUNET_MQ_ErrorHandler error_handler,
903 void *cls); 898 void *cls);
904 899
905 900
906/** 901/**
@@ -911,8 +906,8 @@ GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send,
911 * @param handlers_cls new closure to use 906 * @param handlers_cls new closure to use
912 */ 907 */
913void 908void
914GNUNET_MQ_set_handlers_closure (struct GNUNET_MQ_Handle *mq, 909GNUNET_MQ_set_handlers_closure(struct GNUNET_MQ_Handle *mq,
915 void *handlers_cls); 910 void *handlers_cls);
916 911
917 912
918/** 913/**
@@ -925,9 +920,9 @@ GNUNET_MQ_set_handlers_closure (struct GNUNET_MQ_Handle *mq,
925 * @param cb_cls closure for the callback 920 * @param cb_cls closure for the callback
926 */ 921 */
927void 922void
928GNUNET_MQ_notify_sent (struct GNUNET_MQ_Envelope *ev, 923GNUNET_MQ_notify_sent(struct GNUNET_MQ_Envelope *ev,
929 GNUNET_SCHEDULER_TaskCallback cb, 924 GNUNET_SCHEDULER_TaskCallback cb,
930 void *cb_cls); 925 void *cb_cls);
931 926
932 927
933/** 928/**
@@ -936,7 +931,7 @@ GNUNET_MQ_notify_sent (struct GNUNET_MQ_Envelope *ev,
936 * @param mq message queue to destroy 931 * @param mq message queue to destroy
937 */ 932 */
938void 933void
939GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq); 934GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq);
940 935
941 936
942/** 937/**
@@ -956,9 +951,9 @@ struct GNUNET_MQ_DestroyNotificationHandle;
956 * @return handle for #GNUNET_MQ_destroy_notify_cancel(). 951 * @return handle for #GNUNET_MQ_destroy_notify_cancel().
957 */ 952 */
958struct GNUNET_MQ_DestroyNotificationHandle * 953struct GNUNET_MQ_DestroyNotificationHandle *
959GNUNET_MQ_destroy_notify (struct GNUNET_MQ_Handle *mq, 954GNUNET_MQ_destroy_notify(struct GNUNET_MQ_Handle *mq,
960 GNUNET_SCHEDULER_TaskCallback cb, 955 GNUNET_SCHEDULER_TaskCallback cb,
961 void *cb_cls); 956 void *cb_cls);
962 957
963/** 958/**
964 * Cancel registration from #GNUNET_MQ_destroy_notify(). 959 * Cancel registration from #GNUNET_MQ_destroy_notify().
@@ -966,7 +961,7 @@ GNUNET_MQ_destroy_notify (struct GNUNET_MQ_Handle *mq,
966 * @param dnh handle for registration to cancel 961 * @param dnh handle for registration to cancel
967 */ 962 */
968void 963void
969GNUNET_MQ_destroy_notify_cancel ( 964GNUNET_MQ_destroy_notify_cancel(
970 struct GNUNET_MQ_DestroyNotificationHandle *dnh); 965 struct GNUNET_MQ_DestroyNotificationHandle *dnh);
971 966
972 967
@@ -981,8 +976,8 @@ GNUNET_MQ_destroy_notify_cancel (
981 * @param mh message to dispatch 976 * @param mh message to dispatch
982 */ 977 */
983void 978void
984GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, 979GNUNET_MQ_inject_message(struct GNUNET_MQ_Handle *mq,
985 const struct GNUNET_MessageHeader *mh); 980 const struct GNUNET_MessageHeader *mh);
986 981
987 982
988/** 983/**
@@ -996,8 +991,8 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq,
996 * @param error the error type 991 * @param error the error type
997 */ 992 */
998void 993void
999GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq, 994GNUNET_MQ_inject_error(struct GNUNET_MQ_Handle *mq,
1000 enum GNUNET_MQ_Error error); 995 enum GNUNET_MQ_Error error);
1001 996
1002 997
1003/** 998/**
@@ -1011,7 +1006,7 @@ GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq,
1011 * @param mq message queue to send the next message with 1006 * @param mq message queue to send the next message with
1012 */ 1007 */
1013void 1008void
1014GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq); 1009GNUNET_MQ_impl_send_continue(struct GNUNET_MQ_Handle *mq);
1015 1010
1016 1011
1017/** 1012/**
@@ -1025,7 +1020,7 @@ GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq);
1025 * @param mq message queue to send the next message with 1020 * @param mq message queue to send the next message with
1026 */ 1021 */
1027void 1022void
1028GNUNET_MQ_impl_send_in_flight (struct GNUNET_MQ_Handle *mq); 1023GNUNET_MQ_impl_send_in_flight(struct GNUNET_MQ_Handle *mq);
1029 1024
1030 1025
1031/** 1026/**
@@ -1043,7 +1038,7 @@ GNUNET_MQ_impl_send_in_flight (struct GNUNET_MQ_Handle *mq);
1043 * @return message to send, never NULL 1038 * @return message to send, never NULL
1044 */ 1039 */
1045void * 1040void *
1046GNUNET_MQ_impl_state (struct GNUNET_MQ_Handle *mq); 1041GNUNET_MQ_impl_state(struct GNUNET_MQ_Handle *mq);
1047 1042
1048 1043
1049/** 1044/**
@@ -1056,7 +1051,7 @@ GNUNET_MQ_impl_state (struct GNUNET_MQ_Handle *mq);
1056 * @return message to send, never NULL 1051 * @return message to send, never NULL
1057 */ 1052 */
1058const struct GNUNET_MessageHeader * 1053const struct GNUNET_MessageHeader *
1059GNUNET_MQ_impl_current (struct GNUNET_MQ_Handle *mq); 1054GNUNET_MQ_impl_current(struct GNUNET_MQ_Handle *mq);
1060 1055
1061 1056
1062/** 1057/**
@@ -1064,9 +1059,7 @@ GNUNET_MQ_impl_current (struct GNUNET_MQ_Handle *mq);
1064 * 1059 *
1065 * @deprecated will be replaced by `enum GNUNET_MQ_PriorityPreference` 1060 * @deprecated will be replaced by `enum GNUNET_MQ_PriorityPreference`
1066 */ 1061 */
1067enum GNUNET_MQ_PreferenceKind 1062enum GNUNET_MQ_PreferenceKind {
1068{
1069
1070 /** 1063 /**
1071 * No preference was expressed. 1064 * No preference was expressed.
1072 */ 1065 */
@@ -1091,10 +1084,9 @@ enum GNUNET_MQ_PreferenceKind
1091 GNUNET_MQ_PREFERENCE_RELIABILITY = 3 1084 GNUNET_MQ_PREFERENCE_RELIABILITY = 3
1092 1085
1093/** 1086/**
1094 * Number of preference values allowed. 1087 * Number of preference values allowed.
1095 */ 1088 */
1096#define GNUNET_MQ_PREFERENCE_COUNT 4 1089#define GNUNET_MQ_PREFERENCE_COUNT 4
1097
1098}; 1090};
1099 1091
1100 1092
@@ -1107,7 +1099,7 @@ enum GNUNET_MQ_PreferenceKind
1107 * @deprecated will be replaced by `enum GNUNET_MQ_PriorityPreference` 1099 * @deprecated will be replaced by `enum GNUNET_MQ_PriorityPreference`
1108 */ 1100 */
1109const char * 1101const char *
1110GNUNET_MQ_preference_to_string (enum GNUNET_MQ_PreferenceKind type); 1102GNUNET_MQ_preference_to_string(enum GNUNET_MQ_PreferenceKind type);
1111 1103
1112 1104
1113#endif 1105#endif