diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-09-27 11:02:56 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-09-27 11:02:56 +0200 |
commit | 7ecc3a03a0670a1620c603502c9958b95e6dc1d0 (patch) | |
tree | 69d76fd05cbf0facae18b99b526c16426bf9b1c6 /src/messenger/messenger_api.c | |
parent | 1fef34e55a00816bdb237e87ff14d54e6575f763 (diff) | |
download | gnunet-7ecc3a03a0670a1620c603502c9958b95e6dc1d0.tar.gz gnunet-7ecc3a03a0670a1620c603502c9958b95e6dc1d0.zip |
-indentation of parameters
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/messenger/messenger_api.c')
-rw-r--r-- | src/messenger/messenger_api.c | 90 |
1 files changed, 61 insertions, 29 deletions
diff --git a/src/messenger/messenger_api.c b/src/messenger/messenger_api.c index f7c73f769..ef6244e19 100644 --- a/src/messenger/messenger_api.c +++ b/src/messenger/messenger_api.c | |||
@@ -70,14 +70,16 @@ GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | static int | 72 | static int |
73 | check_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) | 73 | check_get_name (void *cls, |
74 | const struct GNUNET_MESSENGER_NameMessage *msg) | ||
74 | { | 75 | { |
75 | GNUNET_MQ_check_zero_termination(msg); | 76 | GNUNET_MQ_check_zero_termination(msg); |
76 | return GNUNET_OK; | 77 | return GNUNET_OK; |
77 | } | 78 | } |
78 | 79 | ||
79 | static void | 80 | static void |
80 | handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) | 81 | handle_get_name (void *cls, |
82 | const struct GNUNET_MESSENGER_NameMessage *msg) | ||
81 | { | 83 | { |
82 | struct GNUNET_MESSENGER_Handle *handle = cls; | 84 | struct GNUNET_MESSENGER_Handle *handle = cls; |
83 | 85 | ||
@@ -89,7 +91,8 @@ handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) | |||
89 | } | 91 | } |
90 | 92 | ||
91 | static int | 93 | static int |
92 | check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) | 94 | check_get_key (void *cls, |
95 | const struct GNUNET_MESSENGER_KeyMessage *msg) | ||
93 | { | 96 | { |
94 | const uint16_t full_length = ntohs (msg->header.size); | 97 | const uint16_t full_length = ntohs (msg->header.size); |
95 | 98 | ||
@@ -107,7 +110,8 @@ check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) | |||
107 | } | 110 | } |
108 | 111 | ||
109 | static void | 112 | static void |
110 | handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) | 113 | handle_get_key (void *cls, |
114 | const struct GNUNET_MESSENGER_KeyMessage *msg) | ||
111 | { | 115 | { |
112 | struct GNUNET_MESSENGER_Handle *handle = cls; | 116 | struct GNUNET_MESSENGER_Handle *handle = cls; |
113 | 117 | ||
@@ -129,7 +133,8 @@ handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) | |||
129 | } | 133 | } |
130 | 134 | ||
131 | static void | 135 | static void |
132 | handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg) | 136 | handle_member_id (void *cls, |
137 | const struct GNUNET_MESSENGER_MemberMessage *msg) | ||
133 | { | 138 | { |
134 | struct GNUNET_MESSENGER_Handle *handle = cls; | 139 | struct GNUNET_MESSENGER_Handle *handle = cls; |
135 | 140 | ||
@@ -150,7 +155,8 @@ handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg) | |||
150 | } | 155 | } |
151 | 156 | ||
152 | static void | 157 | static void |
153 | handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | 158 | handle_room_open (void *cls, |
159 | const struct GNUNET_MESSENGER_RoomMessage *msg) | ||
154 | { | 160 | { |
155 | struct GNUNET_MESSENGER_Handle *handle = cls; | 161 | struct GNUNET_MESSENGER_Handle *handle = cls; |
156 | 162 | ||
@@ -162,7 +168,8 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
162 | } | 168 | } |
163 | 169 | ||
164 | static void | 170 | static void |
165 | handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | 171 | handle_room_entry (void *cls, |
172 | const struct GNUNET_MESSENGER_RoomMessage *msg) | ||
166 | { | 173 | { |
167 | struct GNUNET_MESSENGER_Handle *handle = cls; | 174 | struct GNUNET_MESSENGER_Handle *handle = cls; |
168 | 175 | ||
@@ -175,7 +182,8 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
175 | } | 182 | } |
176 | 183 | ||
177 | static void | 184 | static void |
178 | handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | 185 | handle_room_close (void *cls, |
186 | const struct GNUNET_MESSENGER_RoomMessage *msg) | ||
179 | { | 187 | { |
180 | struct GNUNET_MESSENGER_Handle *handle = cls; | 188 | struct GNUNET_MESSENGER_Handle *handle = cls; |
181 | 189 | ||
@@ -187,7 +195,8 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
187 | } | 195 | } |
188 | 196 | ||
189 | static int | 197 | static int |
190 | check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) | 198 | check_recv_message (void *cls, |
199 | const struct GNUNET_MESSENGER_RecvMessage *msg) | ||
191 | { | 200 | { |
192 | const uint16_t full_length = ntohs (msg->header.size); | 201 | const uint16_t full_length = ntohs (msg->header.size); |
193 | 202 | ||
@@ -209,7 +218,8 @@ check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) | |||
209 | } | 218 | } |
210 | 219 | ||
211 | static void | 220 | static void |
212 | handle_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) | 221 | handle_recv_message (void *cls, |
222 | const struct GNUNET_MESSENGER_RecvMessage *msg) | ||
213 | { | 223 | { |
214 | struct GNUNET_MESSENGER_Handle *handle = cls; | 224 | struct GNUNET_MESSENGER_Handle *handle = cls; |
215 | 225 | ||
@@ -255,7 +265,8 @@ static void | |||
255 | reconnect (struct GNUNET_MESSENGER_Handle *handle); | 265 | reconnect (struct GNUNET_MESSENGER_Handle *handle); |
256 | 266 | ||
257 | static void | 267 | static void |
258 | send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) | 268 | send_open_room (struct GNUNET_MESSENGER_Handle *handle, |
269 | struct GNUNET_MESSENGER_Room *room) | ||
259 | { | 270 | { |
260 | struct GNUNET_MESSENGER_RoomMessage *msg; | 271 | struct GNUNET_MESSENGER_RoomMessage *msg; |
261 | struct GNUNET_MQ_Envelope *env; | 272 | struct GNUNET_MQ_Envelope *env; |
@@ -266,7 +277,8 @@ send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_ | |||
266 | } | 277 | } |
267 | 278 | ||
268 | static void | 279 | static void |
269 | send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, | 280 | send_enter_room (struct GNUNET_MESSENGER_Handle *handle, |
281 | struct GNUNET_MESSENGER_Room *room, | ||
270 | const struct GNUNET_PeerIdentity *door) | 282 | const struct GNUNET_PeerIdentity *door) |
271 | { | 283 | { |
272 | struct GNUNET_MESSENGER_RoomMessage *msg; | 284 | struct GNUNET_MESSENGER_RoomMessage *msg; |
@@ -279,7 +291,8 @@ send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER | |||
279 | } | 291 | } |
280 | 292 | ||
281 | static void | 293 | static void |
282 | send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) | 294 | send_close_room (struct GNUNET_MESSENGER_Handle *handle, |
295 | struct GNUNET_MESSENGER_Room *room) | ||
283 | { | 296 | { |
284 | struct GNUNET_MESSENGER_RoomMessage *msg; | 297 | struct GNUNET_MESSENGER_RoomMessage *msg; |
285 | struct GNUNET_MQ_Envelope *env; | 298 | struct GNUNET_MQ_Envelope *env; |
@@ -290,7 +303,9 @@ send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER | |||
290 | } | 303 | } |
291 | 304 | ||
292 | static int | 305 | static int |
293 | iterate_reset_room (void *cls, const struct GNUNET_HashCode *key, void *value) | 306 | iterate_reset_room (void *cls, |
307 | const struct GNUNET_HashCode *key, | ||
308 | void *value) | ||
294 | { | 309 | { |
295 | struct GNUNET_MESSENGER_Handle *handle = cls; | 310 | struct GNUNET_MESSENGER_Handle *handle = cls; |
296 | struct GNUNET_MESSENGER_Room *room = value; | 311 | struct GNUNET_MESSENGER_Room *room = value; |
@@ -329,7 +344,9 @@ callback_reconnect (void *cls) | |||
329 | } | 344 | } |
330 | 345 | ||
331 | static int | 346 | static int |
332 | iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value) | 347 | iterate_close_room (void *cls, |
348 | const struct GNUNET_HashCode *key, | ||
349 | void *value) | ||
333 | { | 350 | { |
334 | struct GNUNET_MESSENGER_Handle *handle = cls; | 351 | struct GNUNET_MESSENGER_Handle *handle = cls; |
335 | struct GNUNET_MESSENGER_Room *room = value; | 352 | struct GNUNET_MESSENGER_Room *room = value; |
@@ -340,7 +357,8 @@ iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
340 | } | 357 | } |
341 | 358 | ||
342 | static void | 359 | static void |
343 | callback_mq_error (void *cls, enum GNUNET_MQ_Error error) | 360 | callback_mq_error (void *cls, |
361 | enum GNUNET_MQ_Error error) | ||
344 | { | 362 | { |
345 | struct GNUNET_MESSENGER_Handle *handle = cls; | 363 | struct GNUNET_MESSENGER_Handle *handle = cls; |
346 | 364 | ||
@@ -402,9 +420,12 @@ reconnect (struct GNUNET_MESSENGER_Handle *handle) | |||
402 | } | 420 | } |
403 | 421 | ||
404 | struct GNUNET_MESSENGER_Handle* | 422 | struct GNUNET_MESSENGER_Handle* |
405 | GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, | 423 | GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
406 | GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, | 424 | const char *name, |
407 | GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) | 425 | GNUNET_MESSENGER_IdentityCallback identity_callback, |
426 | void *identity_cls, | ||
427 | GNUNET_MESSENGER_MessageCallback msg_callback, | ||
428 | void *msg_cls) | ||
408 | { | 429 | { |
409 | struct GNUNET_MESSENGER_Handle *handle = create_handle (cfg, identity_callback, identity_cls, msg_callback, msg_cls); | 430 | struct GNUNET_MESSENGER_Handle *handle = create_handle (cfg, identity_callback, identity_cls, msg_callback, msg_cls); |
410 | 431 | ||
@@ -475,7 +496,8 @@ GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle) | |||
475 | } | 496 | } |
476 | 497 | ||
477 | int | 498 | int |
478 | GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) | 499 | GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, |
500 | const char *name) | ||
479 | { | 501 | { |
480 | if (!handle) | 502 | if (!handle) |
481 | return GNUNET_SYSERR; | 503 | return GNUNET_SYSERR; |
@@ -517,7 +539,8 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle) | |||
517 | } | 539 | } |
518 | 540 | ||
519 | struct GNUNET_MESSENGER_Room* | 541 | struct GNUNET_MESSENGER_Room* |
520 | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 542 | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, |
543 | const struct GNUNET_HashCode *key) | ||
521 | { | 544 | { |
522 | if ((!handle) || (!key)) | 545 | if ((!handle) || (!key)) |
523 | return NULL; | 546 | return NULL; |
@@ -541,7 +564,8 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct | |||
541 | } | 564 | } |
542 | 565 | ||
543 | struct GNUNET_MESSENGER_Room* | 566 | struct GNUNET_MESSENGER_Room* |
544 | GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | 567 | GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, |
568 | const struct GNUNET_PeerIdentity *door, | ||
545 | const struct GNUNET_HashCode *key) | 569 | const struct GNUNET_HashCode *key) |
546 | { | 570 | { |
547 | if ((!handle) || (!door) || (!key)) | 571 | if ((!handle) || (!door) || (!key)) |
@@ -583,7 +607,9 @@ struct GNUNET_MESSENGER_RoomFind | |||
583 | }; | 607 | }; |
584 | 608 | ||
585 | static int | 609 | static int |
586 | iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value) | 610 | iterate_find_room (void* cls, |
611 | const struct GNUNET_HashCode *key, | ||
612 | void *value) | ||
587 | { | 613 | { |
588 | struct GNUNET_MESSENGER_RoomFind *find = cls; | 614 | struct GNUNET_MESSENGER_RoomFind *find = cls; |
589 | struct GNUNET_MESSENGER_Room *room = value; | 615 | struct GNUNET_MESSENGER_Room *room = value; |
@@ -602,8 +628,10 @@ iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value) | |||
602 | } | 628 | } |
603 | 629 | ||
604 | int | 630 | int |
605 | GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, | 631 | GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, |
606 | GNUNET_MESSENGER_MemberCallback callback, void *cls) | 632 | const struct GNUNET_MESSENGER_Contact *contact, |
633 | GNUNET_MESSENGER_MemberCallback callback, | ||
634 | void *cls) | ||
607 | { | 635 | { |
608 | if (!handle) | 636 | if (!handle) |
609 | return GNUNET_SYSERR; | 637 | return GNUNET_SYSERR; |
@@ -628,7 +656,8 @@ GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room) | |||
628 | } | 656 | } |
629 | 657 | ||
630 | const struct GNUNET_MESSENGER_Contact* | 658 | const struct GNUNET_MESSENGER_Contact* |
631 | GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) | 659 | GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, |
660 | const struct GNUNET_HashCode *hash) | ||
632 | { | 661 | { |
633 | if ((!room) || (!hash)) | 662 | if ((!room) || (!hash)) |
634 | return NULL; | 663 | return NULL; |
@@ -655,7 +684,8 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact | |||
655 | } | 684 | } |
656 | 685 | ||
657 | void | 686 | void |
658 | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 687 | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, |
688 | const struct GNUNET_MESSENGER_Message *message, | ||
659 | const struct GNUNET_MESSENGER_Contact *contact) | 689 | const struct GNUNET_MESSENGER_Contact *contact) |
660 | { | 690 | { |
661 | if ((!room) || (!message)) | 691 | if ((!room) || (!message)) |
@@ -723,7 +753,8 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct | |||
723 | } | 753 | } |
724 | 754 | ||
725 | const struct GNUNET_MESSENGER_Message* | 755 | const struct GNUNET_MESSENGER_Message* |
726 | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) | 756 | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, |
757 | const struct GNUNET_HashCode *hash) | ||
727 | { | 758 | { |
728 | if ((!room) || (!hash)) | 759 | if ((!room) || (!hash)) |
729 | return NULL; | 760 | return NULL; |
@@ -745,7 +776,8 @@ GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const st | |||
745 | } | 776 | } |
746 | 777 | ||
747 | int | 778 | int |
748 | GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, | 779 | GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, |
780 | GNUNET_MESSENGER_MemberCallback callback, | ||
749 | void *cls) | 781 | void *cls) |
750 | { | 782 | { |
751 | if (!room) | 783 | if (!room) |