aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/messenger_api.c
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2021-09-27 11:02:56 +0200
committerTheJackiMonster <thejackimonster@gmail.com>2021-09-27 11:02:56 +0200
commit7ecc3a03a0670a1620c603502c9958b95e6dc1d0 (patch)
tree69d76fd05cbf0facae18b99b526c16426bf9b1c6 /src/messenger/messenger_api.c
parent1fef34e55a00816bdb237e87ff14d54e6575f763 (diff)
downloadgnunet-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.c90
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
72static int 72static int
73check_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) 73check_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
79static void 80static void
80handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) 81handle_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
91static int 93static int
92check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) 94check_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
109static void 112static void
110handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) 113handle_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
131static void 135static void
132handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg) 136handle_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
152static void 157static void
153handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 158handle_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
164static void 170static void
165handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 171handle_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
177static void 184static void
178handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 185handle_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
189static int 197static int
190check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) 198check_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
211static void 220static void
212handle_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) 221handle_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
255reconnect (struct GNUNET_MESSENGER_Handle *handle); 265reconnect (struct GNUNET_MESSENGER_Handle *handle);
256 266
257static void 267static void
258send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) 268send_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
268static void 279static void
269send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, 280send_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
281static void 293static void
282send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) 294send_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
292static int 305static int
293iterate_reset_room (void *cls, const struct GNUNET_HashCode *key, void *value) 306iterate_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
331static int 346static int
332iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value) 347iterate_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
342static void 359static void
343callback_mq_error (void *cls, enum GNUNET_MQ_Error error) 360callback_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
404struct GNUNET_MESSENGER_Handle* 422struct GNUNET_MESSENGER_Handle*
405GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, 423GNUNET_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
477int 498int
478GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) 499GNUNET_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
519struct GNUNET_MESSENGER_Room* 541struct GNUNET_MESSENGER_Room*
520GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) 542GNUNET_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
543struct GNUNET_MESSENGER_Room* 566struct GNUNET_MESSENGER_Room*
544GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, 567GNUNET_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
585static int 609static int
586iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value) 610iterate_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
604int 630int
605GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, 631GNUNET_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
630const struct GNUNET_MESSENGER_Contact* 658const struct GNUNET_MESSENGER_Contact*
631GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) 659GNUNET_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
657void 686void
658GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, 687GNUNET_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
725const struct GNUNET_MESSENGER_Message* 755const struct GNUNET_MESSENGER_Message*
726GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) 756GNUNET_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
747int 778int
748GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, 779GNUNET_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)