aboutsummaryrefslogtreecommitdiff
path: root/src/conversation
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-15 19:13:14 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-15 19:13:14 +0000
commitb3a34c936616c5c0339463449934fe045ff367e8 (patch)
treef1c9d404f7e50cb8cb7074a856ff3b4689b53486 /src/conversation
parentdd594a4b0a7dbc57ea49f8a797a7a412e53baa53 (diff)
downloadgnunet-b3a34c936616c5c0339463449934fe045ff367e8.tar.gz
gnunet-b3a34c936616c5c0339463449934fe045ff367e8.zip
-fix FTBFS
Diffstat (limited to 'src/conversation')
-rw-r--r--src/conversation/Makefile.am3
-rw-r--r--src/conversation/gnunet-service-conversation.c107
2 files changed, 91 insertions, 19 deletions
diff --git a/src/conversation/Makefile.am b/src/conversation/Makefile.am
index 010e87e6c..a12404bbe 100644
--- a/src/conversation/Makefile.am
+++ b/src/conversation/Makefile.am
@@ -47,7 +47,8 @@ libgnunetspeaker_la_LDFLAGS = \
47 47
48 48
49libgnunetconversation_la_SOURCES = \ 49libgnunetconversation_la_SOURCES = \
50 conversation_api.c 50 conversation_api.c \
51 conversation_api_call.c
51libgnunetconversation_la_LIBADD = \ 52libgnunetconversation_la_LIBADD = \
52 $(top_builddir)/src/gns/libgnunetgns.la \ 53 $(top_builddir)/src/gns/libgnunetgns.la \
53 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 54 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index 8e6e114df..9e3b48719 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -673,7 +673,7 @@ handle_mesh_ring_message (void *cls,
673 const struct MeshPhoneRingMessage *msg; 673 const struct MeshPhoneRingMessage *msg;
674 struct Line *line; 674 struct Line *line;
675 struct GNUNET_MQ_Envelope *e; 675 struct GNUNET_MQ_Envelope *e;
676 struct MeshPhoneBusyMessage *busy; 676 struct MeshPhoneHangupMessage *hang_up;
677 struct ClientPhoneRingMessage cring; 677 struct ClientPhoneRingMessage cring;
678 678
679 msg = (const struct MeshPhoneRingMessage *) message; 679 msg = (const struct MeshPhoneRingMessage *) message;
@@ -697,9 +697,9 @@ handle_mesh_ring_message (void *cls,
697 if (NULL == line) 697 if (NULL == line)
698 { 698 {
699 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 699 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
700 _("No available phone for incoming call on line %u, sending BUSY signal\n"), 700 _("No available phone for incoming call on line %u, sending HANG_UP signal\n"),
701 ntohl (msg->remote_line)); 701 ntohl (msg->remote_line));
702 e = GNUNET_MQ_msg (busy, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY); 702 e = GNUNET_MQ_msg (hang_up, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP);
703 GNUNET_MQ_notify_sent (e, 703 GNUNET_MQ_notify_sent (e,
704 &mq_done_destroy_channel, 704 &mq_done_destroy_channel,
705 channel); 705 channel);
@@ -714,7 +714,7 @@ handle_mesh_ring_message (void *cls,
714 *channel_ctx = line; 714 *channel_ctx = line;
715 cring.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING); 715 cring.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING);
716 cring.header.size = htons (sizeof (cring)); 716 cring.header.size = htons (sizeof (cring));
717 cring.reserved = htonl (0); 717 cring.cid = htonl (0 /* FIXME */);
718 cring.caller_id = msg->caller_id; 718 cring.caller_id = msg->caller_id;
719 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 719 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
720 "Sending RING message to client\n"); 720 "Sending RING message to client\n");
@@ -901,7 +901,7 @@ handle_mesh_pickup_message (void *cls,
901 901
902 902
903/** 903/**
904 * Function to handle a busy message incoming over mesh 904 * Function to handle a suspend message incoming over mesh
905 * 905 *
906 * @param cls closure, NULL 906 * @param cls closure, NULL
907 * @param channel the channel over which the message arrived 907 * @param channel the channel over which the message arrived
@@ -910,22 +910,90 @@ handle_mesh_pickup_message (void *cls,
910 * @return #GNUNET_OK 910 * @return #GNUNET_OK
911 */ 911 */
912static int 912static int
913handle_mesh_busy_message (void *cls, 913handle_mesh_suspend_message (void *cls,
914 struct GNUNET_MESH_Channel *channel, 914 struct GNUNET_MESH_Channel *channel,
915 void **channel_ctx, 915 void **channel_ctx,
916 const struct GNUNET_MessageHeader *message) 916 const struct GNUNET_MessageHeader *message)
917{ 917{
918 struct Line *line = *channel_ctx; 918 struct Line *line = *channel_ctx;
919 struct ClientPhoneBusyMessage busy; 919 struct ClientPhoneSuspendMessage suspend;
920 920
921 if (NULL == line) 921 if (NULL == line)
922 { 922 {
923 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 923 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
924 "HANGUP message received for non-existing line, dropping channel.\n"); 924 "SUSPEND message received for non-existing line, dropping channel.\n");
925 return GNUNET_SYSERR;
926 }
927 suspend.header.size = sizeof (suspend);
928 suspend.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND);
929 suspend.cid = htonl (0 /* FIXME */);
930 GNUNET_MESH_receive_done (channel);
931 *channel_ctx = NULL;
932 switch (line->status)
933 {
934 case LS_CALLEE_LISTEN:
935 GNUNET_break (0);
936 return GNUNET_SYSERR;
937 case LS_CALLEE_RINGING:
938 GNUNET_break_op (0);
939 break;
940 case LS_CALLEE_CONNECTED:
941 GNUNET_break_op (0);
942 break;
943 case LS_CALLEE_SHUTDOWN:
944 GNUNET_break_op (0);
945 break;
946 case LS_CALLER_CALLING:
947 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
948 "Sending SUSPEND message to client\n");
949 GNUNET_SERVER_notification_context_unicast (nc,
950 line->client,
951 &suspend.header,
952 GNUNET_NO);
953 line->status = LS_CALLER_SHUTDOWN;
954 mq_done_finish_caller_shutdown (line);
955 break;
956 case LS_CALLER_CONNECTED:
957 GNUNET_break_op (0);
958 line->status = LS_CALLER_SHUTDOWN;
959 mq_done_finish_caller_shutdown (line);
960 break;
961 case LS_CALLER_SHUTDOWN:
962 GNUNET_break_op (0);
963 mq_done_finish_caller_shutdown (line);
964 break;
965 }
966 return GNUNET_OK;
967}
968
969
970/**
971 * Function to handle a resume message incoming over mesh
972 *
973 * @param cls closure, NULL
974 * @param channel the channel over which the message arrived
975 * @param channel_ctx the channel context, can be NULL
976 * @param message the incoming message
977 * @return #GNUNET_OK
978 */
979static int
980handle_mesh_resume_message (void *cls,
981 struct GNUNET_MESH_Channel *channel,
982 void **channel_ctx,
983 const struct GNUNET_MessageHeader *message)
984{
985 struct Line *line = *channel_ctx;
986 struct ClientPhoneResumeMessage resume;
987
988 if (NULL == line)
989 {
990 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
991 "RESUME message received for non-existing line, dropping channel.\n");
925 return GNUNET_SYSERR; 992 return GNUNET_SYSERR;
926 } 993 }
927 busy.header.size = sizeof (busy); 994 resume.header.size = sizeof (resume);
928 busy.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY); 995 resume.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME);
996 resume.cid = htonl (0 /* FIXME */);
929 GNUNET_MESH_receive_done (channel); 997 GNUNET_MESH_receive_done (channel);
930 *channel_ctx = NULL; 998 *channel_ctx = NULL;
931 switch (line->status) 999 switch (line->status)
@@ -944,10 +1012,10 @@ handle_mesh_busy_message (void *cls,
944 break; 1012 break;
945 case LS_CALLER_CALLING: 1013 case LS_CALLER_CALLING:
946 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1014 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
947 "Sending BUSY message to client\n"); 1015 "Sending SUSPEND message to client\n");
948 GNUNET_SERVER_notification_context_unicast (nc, 1016 GNUNET_SERVER_notification_context_unicast (nc,
949 line->client, 1017 line->client,
950 &busy.header, 1018 &resume.header,
951 GNUNET_NO); 1019 GNUNET_NO);
952 line->status = LS_CALLER_SHUTDOWN; 1020 line->status = LS_CALLER_SHUTDOWN;
953 mq_done_finish_caller_shutdown (line); 1021 mq_done_finish_caller_shutdown (line);
@@ -1216,9 +1284,12 @@ run (void *cls,
1216 {&handle_mesh_pickup_message, 1284 {&handle_mesh_pickup_message,
1217 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP, 1285 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP,
1218 0}, 1286 0},
1219 {&handle_mesh_busy_message, 1287 {&handle_mesh_suspend_message,
1220 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY, 1288 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND,
1221 sizeof (struct MeshPhoneBusyMessage)}, 1289 sizeof (struct MeshPhoneSuspendMessage)},
1290 {&handle_mesh_resume_message,
1291 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME,
1292 sizeof (struct MeshPhoneResumeMessage)},
1222 {&handle_mesh_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO, 1293 {&handle_mesh_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO,
1223 0}, 1294 0},
1224 {NULL, 0, 0} 1295 {NULL, 0, 0}