aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/gnunet-service-messenger.c')
-rw-r--r--src/messenger/gnunet-service-messenger.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/src/messenger/gnunet-service-messenger.c b/src/messenger/gnunet-service-messenger.c
index 7edd76d32..989157ceb 100644
--- a/src/messenger/gnunet-service-messenger.c
+++ b/src/messenger/gnunet-service-messenger.c
@@ -39,14 +39,16 @@ struct GNUNET_MESSENGER_Client
39struct GNUNET_MESSENGER_Service *messenger; 39struct GNUNET_MESSENGER_Service *messenger;
40 40
41static int 41static int
42check_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) 42check_create (void *cls,
43 const struct GNUNET_MESSENGER_CreateMessage *msg)
43{ 44{
44 GNUNET_MQ_check_zero_termination(msg); 45 GNUNET_MQ_check_zero_termination(msg);
45 return GNUNET_OK; 46 return GNUNET_OK;
46} 47}
47 48
48static void 49static void
49handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) 50handle_create (void *cls,
51 const struct GNUNET_MESSENGER_CreateMessage *msg)
50{ 52{
51 struct GNUNET_MESSENGER_Client *msg_client = cls; 53 struct GNUNET_MESSENGER_Client *msg_client = cls;
52 54
@@ -60,7 +62,8 @@ handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg)
60} 62}
61 63
62static void 64static void
63handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg) 65handle_update (void *cls,
66 const struct GNUNET_MESSENGER_UpdateMessage *msg)
64{ 67{
65 struct GNUNET_MESSENGER_Client *msg_client = cls; 68 struct GNUNET_MESSENGER_Client *msg_client = cls;
66 69
@@ -70,7 +73,8 @@ handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg)
70} 73}
71 74
72static void 75static void
73handle_destroy (void *cls, const struct GNUNET_MESSENGER_DestroyMessage *msg) 76handle_destroy (void *cls,
77 const struct GNUNET_MESSENGER_DestroyMessage *msg)
74{ 78{
75 struct GNUNET_MESSENGER_Client *msg_client = cls; 79 struct GNUNET_MESSENGER_Client *msg_client = cls;
76 80
@@ -78,14 +82,16 @@ handle_destroy (void *cls, const struct GNUNET_MESSENGER_DestroyMessage *msg)
78} 82}
79 83
80static int 84static int
81check_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) 85check_set_name (void *cls,
86 const struct GNUNET_MESSENGER_NameMessage *msg)
82{ 87{
83 GNUNET_MQ_check_zero_termination(msg); 88 GNUNET_MQ_check_zero_termination(msg);
84 return GNUNET_OK; 89 return GNUNET_OK;
85} 90}
86 91
87static void 92static void
88handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) 93handle_set_name (void *cls,
94 const struct GNUNET_MESSENGER_NameMessage *msg)
89{ 95{
90 struct GNUNET_MESSENGER_Client *msg_client = cls; 96 struct GNUNET_MESSENGER_Client *msg_client = cls;
91 97
@@ -99,7 +105,8 @@ handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg)
99} 105}
100 106
101static void 107static void
102handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 108handle_room_open (void *cls,
109 const struct GNUNET_MESSENGER_RoomMessage *msg)
103{ 110{
104 struct GNUNET_MESSENGER_Client *msg_client = cls; 111 struct GNUNET_MESSENGER_Client *msg_client = cls;
105 112
@@ -125,7 +132,8 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
125} 132}
126 133
127static void 134static void
128handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 135handle_room_entry (void *cls,
136 const struct GNUNET_MESSENGER_RoomMessage *msg)
129{ 137{
130 struct GNUNET_MESSENGER_Client *msg_client = cls; 138 struct GNUNET_MESSENGER_Client *msg_client = cls;
131 139
@@ -153,7 +161,8 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
153} 161}
154 162
155static void 163static void
156handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 164handle_room_close (void *cls,
165 const struct GNUNET_MESSENGER_RoomMessage *msg)
157{ 166{
158 struct GNUNET_MESSENGER_Client *msg_client = cls; 167 struct GNUNET_MESSENGER_Client *msg_client = cls;
159 168
@@ -179,7 +188,8 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
179} 188}
180 189
181static int 190static int
182check_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) 191check_send_message (void *cls,
192 const struct GNUNET_MESSENGER_SendMessage *msg)
183{ 193{
184 const uint16_t full_length = ntohs (msg->header.size); 194 const uint16_t full_length = ntohs (msg->header.size);
185 195
@@ -224,7 +234,8 @@ check_for_message:
224} 234}
225 235
226static void 236static void
227handle_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) 237handle_send_message (void *cls,
238 const struct GNUNET_MESSENGER_SendMessage *msg)
228{ 239{
229 struct GNUNET_MESSENGER_Client *msg_client = cls; 240 struct GNUNET_MESSENGER_Client *msg_client = cls;
230 241
@@ -271,7 +282,8 @@ end_handling:
271} 282}
272 283
273static void 284static void
274callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, 285callback_found_message (void *cls,
286 struct GNUNET_MESSENGER_SrvRoom *room,
275 const struct GNUNET_MESSENGER_Message *message, 287 const struct GNUNET_MESSENGER_Message *message,
276 const struct GNUNET_HashCode *hash) 288 const struct GNUNET_HashCode *hash)
277{ 289{
@@ -300,7 +312,8 @@ callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room,
300} 312}
301 313
302static void 314static void
303handle_get_message (void *cls, const struct GNUNET_MESSENGER_GetMessage *msg) 315handle_get_message (void *cls,
316 const struct GNUNET_MESSENGER_GetMessage *msg)
304{ 317{
305 struct GNUNET_MESSENGER_Client *msg_client = cls; 318 struct GNUNET_MESSENGER_Client *msg_client = cls;
306 319
@@ -341,7 +354,9 @@ end_handling:
341} 354}
342 355
343static void* 356static void*
344callback_client_connect (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq) 357callback_client_connect (void *cls,
358 struct GNUNET_SERVICE_Client *client,
359 struct GNUNET_MQ_Handle *mq)
345{ 360{
346 struct GNUNET_MESSENGER_Client *msg_client = GNUNET_new(struct GNUNET_MESSENGER_Client); 361 struct GNUNET_MESSENGER_Client *msg_client = GNUNET_new(struct GNUNET_MESSENGER_Client);
347 362
@@ -352,7 +367,9 @@ callback_client_connect (void *cls, struct GNUNET_SERVICE_Client *client, struct
352} 367}
353 368
354static void 369static void
355callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls) 370callback_client_disconnect (void *cls,
371 struct GNUNET_SERVICE_Client *client,
372 void *internal_cls)
356{ 373{
357 struct GNUNET_MESSENGER_Client *msg_client = internal_cls; 374 struct GNUNET_MESSENGER_Client *msg_client = internal_cls;
358 375
@@ -369,7 +386,9 @@ callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, voi
369 * @param[in/out] service the initialized service 386 * @param[in/out] service the initialized service
370 */ 387 */
371static void 388static void
372run (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service) 389run (void *cls,
390 const struct GNUNET_CONFIGURATION_Handle *config,
391 struct GNUNET_SERVICE_Handle *service)
373{ 392{
374 messenger = create_service (config, service); 393 messenger = create_service (config, service);
375 394