diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-04 16:42:45 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-04 16:42:45 +0000 |
commit | 167ec1e3caa5068b8cd64b09b503a72d0d308a13 (patch) | |
tree | 890374de2b29f07874669620b6921be00e249f33 /src/conversation | |
parent | 84fafd05402d39d86ee385b4410b06afcfbd6671 (diff) | |
download | gnunet-167ec1e3caa5068b8cd64b09b503a72d0d308a13.tar.gz gnunet-167ec1e3caa5068b8cd64b09b503a72d0d308a13.zip |
-transmit hangup
Diffstat (limited to 'src/conversation')
-rw-r--r-- | src/conversation/gnunet-service-conversation-new.c | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/src/conversation/gnunet-service-conversation-new.c b/src/conversation/gnunet-service-conversation-new.c index d28d214ab..6b33f6092 100644 --- a/src/conversation/gnunet-service-conversation-new.c +++ b/src/conversation/gnunet-service-conversation-new.c | |||
@@ -201,6 +201,7 @@ handle_client_register_message (void *cls, | |||
201 | line = GNUNET_SERVER_client_get_user_context (client, struct Line); | 201 | line = GNUNET_SERVER_client_get_user_context (client, struct Line); |
202 | if (NULL != line) | 202 | if (NULL != line) |
203 | { | 203 | { |
204 | GNUNET_break (0); | ||
204 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 205 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
205 | return; | 206 | return; |
206 | } | 207 | } |
@@ -229,9 +230,34 @@ handle_client_pickup_message (void *cls, | |||
229 | const struct GNUNET_MessageHeader *message) | 230 | const struct GNUNET_MessageHeader *message) |
230 | { | 231 | { |
231 | const struct ClientPhonePickupMessage *msg; | 232 | const struct ClientPhonePickupMessage *msg; |
233 | struct GNUNET_MQ_Envelope *e; | ||
234 | struct MeshPhonePickupMessage *mppm; | ||
235 | const char *meta; | ||
236 | struct Line *line; | ||
237 | size_t len; | ||
232 | 238 | ||
233 | msg = (struct ClientPhonePickupMessage *) message; | 239 | msg = (struct ClientPhonePickupMessage *) message; |
234 | GNUNET_break (0); // FIXME | 240 | meta = (const char *) &msg[1]; |
241 | len = ntohs (msg->header.size) - sizeof (struct ClientPhonePickupMessage); | ||
242 | if ( (0 == len) || | ||
243 | ('\0' != meta[len - 1]) ) | ||
244 | { | ||
245 | meta = NULL; | ||
246 | len = 0; | ||
247 | } | ||
248 | line = GNUNET_SERVER_client_get_user_context (client, struct Line); | ||
249 | if (NULL == line) | ||
250 | { | ||
251 | GNUNET_break (0); | ||
252 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
253 | return; | ||
254 | } | ||
255 | line->status = LS_CALLEE_CONNECTED; | ||
256 | e = GNUNET_MQ_msg_extra (mppm, | ||
257 | len, | ||
258 | GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP); | ||
259 | memcpy (&mppm[1], meta, len); | ||
260 | GNUNET_MQ_send (line->reliable_mq, e); | ||
235 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 261 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
236 | } | 262 | } |
237 | 263 | ||
@@ -249,9 +275,34 @@ handle_client_hangup_message (void *cls, | |||
249 | const struct GNUNET_MessageHeader *message) | 275 | const struct GNUNET_MessageHeader *message) |
250 | { | 276 | { |
251 | const struct ClientPhoneHangupMessage *msg; | 277 | const struct ClientPhoneHangupMessage *msg; |
278 | struct GNUNET_MQ_Envelope *e; | ||
279 | struct MeshPhoneHangupMessage *mhum; | ||
280 | const char *meta; | ||
281 | struct Line *line; | ||
282 | size_t len; | ||
252 | 283 | ||
253 | msg = (struct ClientPhoneHangupMessage *) message; | 284 | msg = (struct ClientPhoneHangupMessage *) message; |
254 | GNUNET_break (0); // FIXME | 285 | meta = (const char *) &msg[1]; |
286 | len = ntohs (msg->header.size) - sizeof (struct ClientPhoneHangupMessage); | ||
287 | if ( (0 == len) || | ||
288 | ('\0' != meta[len - 1]) ) | ||
289 | { | ||
290 | meta = NULL; | ||
291 | len = 0; | ||
292 | } | ||
293 | line = GNUNET_SERVER_client_get_user_context (client, struct Line); | ||
294 | if (NULL == line) | ||
295 | { | ||
296 | GNUNET_break (0); | ||
297 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
298 | return; | ||
299 | } | ||
300 | line->status = LS_CALLEE_LISTEN; | ||
301 | e = GNUNET_MQ_msg_extra (mhum, | ||
302 | len, | ||
303 | GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP); | ||
304 | memcpy (&mhum[1], meta, len); | ||
305 | GNUNET_MQ_send (line->reliable_mq, e); | ||
255 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 306 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
256 | } | 307 | } |
257 | 308 | ||
@@ -388,6 +439,8 @@ handle_mesh_ring_message (void *cls, | |||
388 | line->status = LS_CALLEE_RINGING; | 439 | line->status = LS_CALLEE_RINGING; |
389 | line->remote_line = ntohl (msg->source_line); | 440 | line->remote_line = ntohl (msg->source_line); |
390 | line->tunnel_reliable = tunnel; | 441 | line->tunnel_reliable = tunnel; |
442 | line->reliable_mq = GNUNET_MESH_mq_create (line->tunnel_reliable); | ||
443 | *tunnel_ctx = line; | ||
391 | cring.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING); | 444 | cring.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING); |
392 | cring.header.size = htons (sizeof (cring)); | 445 | cring.header.size = htons (sizeof (cring)); |
393 | cring.reserved = htonl (0); | 446 | cring.reserved = htonl (0); |