diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-21 16:53:37 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-21 16:53:37 +0100 |
commit | d02945974366f76bcb63b83834175848d1cc937a (patch) | |
tree | 79fccb135ef687bb9a1f7a494eb9bcc563482fc4 | |
parent | 40537b04870c1fb34a231f85666ca39a6e4a6cbe (diff) | |
download | gnunet-d02945974366f76bcb63b83834175848d1cc937a.tar.gz gnunet-d02945974366f76bcb63b83834175848d1cc937a.zip |
converting conversation to use new CADET API
-rw-r--r-- | src/ats-tests/template_perf_ats.conf | 2 | ||||
-rw-r--r-- | src/cadet/Makefile.am | 4 | ||||
-rw-r--r-- | src/conversation/Makefile.am | 2 | ||||
-rw-r--r-- | src/conversation/gnunet-service-conversation.c | 502 | ||||
-rw-r--r-- | src/conversation/test_conversation.conf | 1 |
5 files changed, 245 insertions, 266 deletions
diff --git a/src/ats-tests/template_perf_ats.conf b/src/ats-tests/template_perf_ats.conf index 05d11449d..ba4cbe030 100644 --- a/src/ats-tests/template_perf_ats.conf +++ b/src/ats-tests/template_perf_ats.conf | |||
@@ -14,6 +14,8 @@ USE_INCLUDED_HELLOS = NO | |||
14 | #PREFIX = valgrind --leak-check=yes | 14 | #PREFIX = valgrind --leak-check=yes |
15 | 15 | ||
16 | [ats] | 16 | [ats] |
17 | PREFIX = valgrind | ||
18 | |||
17 | # Network specific inbound/outbound quotas | 19 | # Network specific inbound/outbound quotas |
18 | UNSPECIFIED_QUOTA_IN = 128 KiB | 20 | UNSPECIFIED_QUOTA_IN = 128 KiB |
19 | UNSPECIFIED_QUOTA_OUT = 128 KiB | 21 | UNSPECIFIED_QUOTA_OUT = 128 KiB |
diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am index 74791d66e..6f38c6a94 100644 --- a/src/cadet/Makefile.am +++ b/src/cadet/Makefile.am | |||
@@ -149,12 +149,12 @@ ld_cadet_test_lib = \ | |||
149 | $(top_builddir)/src/util/libgnunetutil.la \ | 149 | $(top_builddir)/src/util/libgnunetutil.la \ |
150 | $(top_builddir)/src/testing/libgnunettesting.la \ | 150 | $(top_builddir)/src/testing/libgnunettesting.la \ |
151 | libgnunetcadettest.a \ | 151 | libgnunetcadettest.a \ |
152 | libgnunetcadet.la \ | 152 | libgnunetcadetnew.la \ |
153 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | 153 | $(top_builddir)/src/testbed/libgnunettestbed.la \ |
154 | $(top_builddir)/src/statistics/libgnunetstatistics.la | 154 | $(top_builddir)/src/statistics/libgnunetstatistics.la |
155 | 155 | ||
156 | dep_cadet_test_lib = \ | 156 | dep_cadet_test_lib = \ |
157 | libgnunetcadet.la \ | 157 | libgnunetcadetnew.la \ |
158 | libgnunetcadettest.a \ | 158 | libgnunetcadettest.a \ |
159 | $(top_builddir)/src/statistics/libgnunetstatistics.la | 159 | $(top_builddir)/src/statistics/libgnunetstatistics.la |
160 | 160 | ||
diff --git a/src/conversation/Makefile.am b/src/conversation/Makefile.am index cc2938144..83313e7f8 100644 --- a/src/conversation/Makefile.am +++ b/src/conversation/Makefile.am | |||
@@ -180,7 +180,7 @@ gnunet_service_conversation_LDADD = \ | |||
180 | libgnunetconversation.la \ | 180 | libgnunetconversation.la \ |
181 | libgnunetspeaker.la \ | 181 | libgnunetspeaker.la \ |
182 | libgnunetmicrophone.la \ | 182 | libgnunetmicrophone.la \ |
183 | $(top_builddir)/src/cadet/libgnunetcadet.la \ | 183 | $(top_builddir)/src/cadet/libgnunetcadetnew.la \ |
184 | $(top_builddir)/src/util/libgnunetutil.la \ | 184 | $(top_builddir)/src/util/libgnunetutil.la \ |
185 | $(INTLLIBS) | 185 | $(INTLLIBS) |
186 | gnunet_service_conversation_LDFLAGS = \ | 186 | gnunet_service_conversation_LDFLAGS = \ |
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c index 08458f278..4e1ac0d15 100644 --- a/src/conversation/gnunet-service-conversation.c +++ b/src/conversation/gnunet-service-conversation.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2013, 2016 GNUnet e.V. | 3 | Copyright (C) 2013, 2016, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -226,9 +226,9 @@ static struct Channel * | |||
226 | find_channel_by_line (struct Line *line, | 226 | find_channel_by_line (struct Line *line, |
227 | uint32_t cid) | 227 | uint32_t cid) |
228 | { | 228 | { |
229 | struct Channel *ch; | 229 | for (struct Channel *ch = line->channel_head; |
230 | 230 | NULL != ch; | |
231 | for (ch = line->channel_head; NULL != ch; ch = ch->next) | 231 | ch = ch->next) |
232 | if (cid == ch->cid) | 232 | if (cid == ch->cid) |
233 | return ch; | 233 | return ch; |
234 | return NULL; | 234 | return NULL; |
@@ -314,11 +314,6 @@ destroy_line_cadet_channels (struct Channel *ch) | |||
314 | { | 314 | { |
315 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 315 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
316 | "Destroying cadet channels\n"); | 316 | "Destroying cadet channels\n"); |
317 | if (NULL != ch->mq) | ||
318 | { | ||
319 | GNUNET_MQ_destroy (ch->mq); | ||
320 | ch->mq = NULL; | ||
321 | } | ||
322 | if (NULL != ch->channel) | 317 | if (NULL != ch->channel) |
323 | GNUNET_CADET_channel_destroy (ch->channel); | 318 | GNUNET_CADET_channel_destroy (ch->channel); |
324 | } | 319 | } |
@@ -586,59 +581,6 @@ handle_client_resume_message (void *cls, | |||
586 | 581 | ||
587 | 582 | ||
588 | /** | 583 | /** |
589 | * Function to handle call request from the client | ||
590 | * | ||
591 | * @param cls the `struct Line` the message is about | ||
592 | * @param msg the message from the client | ||
593 | */ | ||
594 | static void | ||
595 | handle_client_call_message (void *cls, | ||
596 | const struct ClientCallMessage *msg) | ||
597 | { | ||
598 | struct Line *line = cls; | ||
599 | struct Channel *ch; | ||
600 | struct GNUNET_MQ_Envelope *e; | ||
601 | struct CadetPhoneRingMessage *ring; | ||
602 | struct CadetPhoneRingInfoPS rs; | ||
603 | |||
604 | line->line_port = msg->line_port; | ||
605 | rs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING); | ||
606 | rs.purpose.size = htonl (sizeof (struct CadetPhoneRingInfoPS)); | ||
607 | rs.line_port = line->line_port; | ||
608 | rs.target_peer = msg->target; | ||
609 | rs.expiration_time | ||
610 | = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (RING_TIMEOUT)); | ||
611 | |||
612 | ch = GNUNET_new (struct Channel); | ||
613 | ch->line = line; | ||
614 | GNUNET_CONTAINER_DLL_insert (line->channel_head, | ||
615 | line->channel_tail, | ||
616 | ch); | ||
617 | ch->status = CS_CALLER_CALLING; | ||
618 | ch->channel = GNUNET_CADET_channel_create (cadet, | ||
619 | ch, | ||
620 | &msg->target, | ||
621 | &msg->line_port, | ||
622 | GNUNET_CADET_OPTION_RELIABLE); | ||
623 | ch->mq = GNUNET_CADET_mq_create (ch->channel); | ||
624 | e = GNUNET_MQ_msg (ring, | ||
625 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING); | ||
626 | GNUNET_CRYPTO_ecdsa_key_get_public (&msg->caller_id, | ||
627 | &ring->caller_id); | ||
628 | ring->expiration_time = rs.expiration_time; | ||
629 | GNUNET_assert (GNUNET_OK == | ||
630 | GNUNET_CRYPTO_ecdsa_sign (&msg->caller_id, | ||
631 | &rs.purpose, | ||
632 | &ring->signature)); | ||
633 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
634 | "Sending RING message via CADET\n"); | ||
635 | GNUNET_MQ_send (ch->mq, | ||
636 | e); | ||
637 | GNUNET_SERVICE_client_continue (line->client); | ||
638 | } | ||
639 | |||
640 | |||
641 | /** | ||
642 | * Transmission of audio data via cadet channel finished. | 584 | * Transmission of audio data via cadet channel finished. |
643 | * | 585 | * |
644 | * @param cls the `struct Channel` we are transmitting for | 586 | * @param cls the `struct Channel` we are transmitting for |
@@ -750,26 +692,18 @@ handle_client_audio_message (void *cls, | |||
750 | * Function to handle a ring message incoming over cadet | 692 | * Function to handle a ring message incoming over cadet |
751 | * | 693 | * |
752 | * @param cls closure, NULL | 694 | * @param cls closure, NULL |
753 | * @param channel the channel over which the message arrived | 695 | * @param msg the incoming message |
754 | * @param channel_ctx the channel context, can be NULL | ||
755 | * or point to the `struct Channel` | ||
756 | * @param message the incoming message | ||
757 | * @return #GNUNET_OK | ||
758 | */ | 696 | */ |
759 | static int | 697 | static void |
760 | handle_cadet_ring_message (void *cls, | 698 | handle_cadet_ring_message (void *cls, |
761 | struct GNUNET_CADET_Channel *channel, | 699 | const struct CadetPhoneRingMessage *msg) |
762 | void **channel_ctx, | ||
763 | const struct GNUNET_MessageHeader *message) | ||
764 | { | 700 | { |
765 | struct Channel *ch = *channel_ctx; | 701 | struct Channel *ch = cls; |
766 | struct Line *line = ch->line; | 702 | struct Line *line = ch->line; |
767 | const struct CadetPhoneRingMessage *msg; | ||
768 | struct GNUNET_MQ_Envelope *env; | 703 | struct GNUNET_MQ_Envelope *env; |
769 | struct ClientPhoneRingMessage *cring; | 704 | struct ClientPhoneRingMessage *cring; |
770 | struct CadetPhoneRingInfoPS rs; | 705 | struct CadetPhoneRingInfoPS rs; |
771 | 706 | ||
772 | msg = (const struct CadetPhoneRingMessage *) message; | ||
773 | rs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING); | 707 | rs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING); |
774 | rs.purpose.size = htonl (sizeof (struct CadetPhoneRingInfoPS)); | 708 | rs.purpose.size = htonl (sizeof (struct CadetPhoneRingInfoPS)); |
775 | rs.line_port = line->line_port; | 709 | rs.line_port = line->line_port; |
@@ -783,7 +717,8 @@ handle_cadet_ring_message (void *cls, | |||
783 | &msg->caller_id)) | 717 | &msg->caller_id)) |
784 | { | 718 | { |
785 | GNUNET_break_op (0); | 719 | GNUNET_break_op (0); |
786 | return GNUNET_SYSERR; | 720 | destroy_line_cadet_channels (ch); |
721 | return; | ||
787 | } | 722 | } |
788 | if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (msg->expiration_time)).rel_value_us) | 723 | if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (msg->expiration_time)).rel_value_us) |
789 | { | 724 | { |
@@ -792,14 +727,16 @@ handle_cadet_ring_message (void *cls, | |||
792 | /* Note that our reliance on time here is awkward; better would be | 727 | /* Note that our reliance on time here is awkward; better would be |
793 | to use a more complex challenge-response protocol against | 728 | to use a more complex challenge-response protocol against |
794 | replay attacks. Left for future work ;-). */ | 729 | replay attacks. Left for future work ;-). */ |
795 | return GNUNET_SYSERR; | 730 | destroy_line_cadet_channels (ch); |
731 | return; | ||
796 | } | 732 | } |
797 | if (CS_CALLEE_INIT != ch->status) | 733 | if (CS_CALLEE_INIT != ch->status) |
798 | { | 734 | { |
799 | GNUNET_break_op (0); | 735 | GNUNET_break_op (0); |
800 | return GNUNET_SYSERR; | 736 | destroy_line_cadet_channels (ch); |
737 | return; | ||
801 | } | 738 | } |
802 | GNUNET_CADET_receive_done (channel); | 739 | GNUNET_CADET_receive_done (ch->channel); |
803 | ch->status = CS_CALLEE_RINGING; | 740 | ch->status = CS_CALLEE_RINGING; |
804 | env = GNUNET_MQ_msg (cring, | 741 | env = GNUNET_MQ_msg (cring, |
805 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING); | 742 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING); |
@@ -810,34 +747,27 @@ handle_cadet_ring_message (void *cls, | |||
810 | (unsigned int) ch->cid); | 747 | (unsigned int) ch->cid); |
811 | GNUNET_MQ_send (line->mq, | 748 | GNUNET_MQ_send (line->mq, |
812 | env); | 749 | env); |
813 | return GNUNET_OK; | ||
814 | } | 750 | } |
815 | 751 | ||
816 | 752 | ||
817 | /** | 753 | /** |
818 | * Function to handle a hangup message incoming over cadet | 754 | * Function to handle a hangup message incoming over cadet |
819 | * | 755 | * |
820 | * @param cls closure, NULL | 756 | * @param cls closure, our `struct Channel *` |
821 | * @param channel the channel over which the message arrived | ||
822 | * @param channel_ctx the channel context, can be NULL | ||
823 | * or point to the `struct Channel` | ||
824 | * @param message the incoming message | 757 | * @param message the incoming message |
825 | * @return #GNUNET_OK | ||
826 | */ | 758 | */ |
827 | static int | 759 | static void |
828 | handle_cadet_hangup_message (void *cls, | 760 | handle_cadet_hangup_message (void *cls, |
829 | struct GNUNET_CADET_Channel *channel, | 761 | const struct CadetPhoneHangupMessage *message) |
830 | void **channel_ctx, | ||
831 | const struct GNUNET_MessageHeader *message) | ||
832 | { | 762 | { |
833 | struct Channel *ch = *channel_ctx; | 763 | struct Channel *ch = cls; |
834 | struct Line *line = ch->line; | 764 | struct Line *line = ch->line; |
835 | struct GNUNET_MQ_Envelope *env; | 765 | struct GNUNET_MQ_Envelope *env; |
836 | struct ClientPhoneHangupMessage *hup; | 766 | struct ClientPhoneHangupMessage *hup; |
837 | enum ChannelStatus status; | 767 | enum ChannelStatus status; |
838 | uint32_t cid; | 768 | uint32_t cid; |
839 | 769 | ||
840 | GNUNET_CADET_receive_done (channel); | 770 | GNUNET_CADET_receive_done (ch->channel); |
841 | cid = ch->cid; | 771 | cid = ch->cid; |
842 | status = ch->status; | 772 | status = ch->status; |
843 | destroy_line_cadet_channels (ch); | 773 | destroy_line_cadet_channels (ch); |
@@ -845,17 +775,18 @@ handle_cadet_hangup_message (void *cls, | |||
845 | { | 775 | { |
846 | case CS_CALLEE_INIT: | 776 | case CS_CALLEE_INIT: |
847 | GNUNET_break_op (0); | 777 | GNUNET_break_op (0); |
848 | return GNUNET_OK; | 778 | destroy_line_cadet_channels (ch); |
779 | return; | ||
849 | case CS_CALLEE_RINGING: | 780 | case CS_CALLEE_RINGING: |
850 | case CS_CALLEE_CONNECTED: | 781 | case CS_CALLEE_CONNECTED: |
851 | break; | 782 | break; |
852 | case CS_CALLEE_SHUTDOWN: | 783 | case CS_CALLEE_SHUTDOWN: |
853 | return GNUNET_OK; | 784 | return; |
854 | case CS_CALLER_CALLING: | 785 | case CS_CALLER_CALLING: |
855 | case CS_CALLER_CONNECTED: | 786 | case CS_CALLER_CONNECTED: |
856 | break; | 787 | break; |
857 | case CS_CALLER_SHUTDOWN: | 788 | case CS_CALLER_SHUTDOWN: |
858 | return GNUNET_OK; | 789 | return; |
859 | } | 790 | } |
860 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 791 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
861 | "Sending HANG UP message to client\n"); | 792 | "Sending HANG UP message to client\n"); |
@@ -864,33 +795,25 @@ handle_cadet_hangup_message (void *cls, | |||
864 | hup->cid = cid; | 795 | hup->cid = cid; |
865 | GNUNET_MQ_send (line->mq, | 796 | GNUNET_MQ_send (line->mq, |
866 | env); | 797 | env); |
867 | return GNUNET_OK; | ||
868 | } | 798 | } |
869 | 799 | ||
870 | 800 | ||
871 | /** | 801 | /** |
872 | * Function to handle a pickup message incoming over cadet | 802 | * Function to handle a pickup message incoming over cadet |
873 | * | 803 | * |
874 | * @param cls closure, NULL | 804 | * @param cls closure, our `struct Channel *` |
875 | * @param channel the channel over which the message arrived | ||
876 | * @param channel_ctx the channel context, can be NULL | ||
877 | * or point to the `struct Channel` | ||
878 | * @param message the incoming message | 805 | * @param message the incoming message |
879 | * @return #GNUNET_OK if message was OK, | ||
880 | * #GNUNET_SYSERR if message violated the protocol | ||
881 | */ | 806 | */ |
882 | static int | 807 | static void |
883 | handle_cadet_pickup_message (void *cls, | 808 | handle_cadet_pickup_message (void *cls, |
884 | struct GNUNET_CADET_Channel *channel, | 809 | const struct CadetPhonePickupMessage *message) |
885 | void **channel_ctx, | ||
886 | const struct GNUNET_MessageHeader *message) | ||
887 | { | 810 | { |
888 | struct Channel *ch = *channel_ctx; | 811 | struct Channel *ch = cls; |
889 | struct Line *line = ch->line; | 812 | struct Line *line = ch->line; |
890 | struct GNUNET_MQ_Envelope *env; | 813 | struct GNUNET_MQ_Envelope *env; |
891 | struct ClientPhonePickedupMessage *pick; | 814 | struct ClientPhonePickedupMessage *pick; |
892 | 815 | ||
893 | GNUNET_CADET_receive_done (channel); | 816 | GNUNET_CADET_receive_done (ch->channel); |
894 | switch (ch->status) | 817 | switch (ch->status) |
895 | { | 818 | { |
896 | case CS_CALLEE_INIT: | 819 | case CS_CALLEE_INIT: |
@@ -898,21 +821,21 @@ handle_cadet_pickup_message (void *cls, | |||
898 | case CS_CALLEE_CONNECTED: | 821 | case CS_CALLEE_CONNECTED: |
899 | GNUNET_break_op (0); | 822 | GNUNET_break_op (0); |
900 | destroy_line_cadet_channels (ch); | 823 | destroy_line_cadet_channels (ch); |
901 | return GNUNET_SYSERR; | 824 | return; |
902 | case CS_CALLEE_SHUTDOWN: | 825 | case CS_CALLEE_SHUTDOWN: |
903 | GNUNET_break_op (0); | 826 | GNUNET_break_op (0); |
904 | destroy_line_cadet_channels (ch); | 827 | destroy_line_cadet_channels (ch); |
905 | return GNUNET_SYSERR; | 828 | return; |
906 | case CS_CALLER_CALLING: | 829 | case CS_CALLER_CALLING: |
907 | ch->status = CS_CALLER_CONNECTED; | 830 | ch->status = CS_CALLER_CONNECTED; |
908 | break; | 831 | break; |
909 | case CS_CALLER_CONNECTED: | 832 | case CS_CALLER_CONNECTED: |
910 | GNUNET_break_op (0); | 833 | GNUNET_break_op (0); |
911 | return GNUNET_OK; | 834 | return; |
912 | case CS_CALLER_SHUTDOWN: | 835 | case CS_CALLER_SHUTDOWN: |
913 | GNUNET_break_op (0); | 836 | GNUNET_break_op (0); |
914 | mq_done_finish_caller_shutdown (ch); | 837 | mq_done_finish_caller_shutdown (ch); |
915 | return GNUNET_SYSERR; | 838 | return; |
916 | } | 839 | } |
917 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 840 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
918 | "Sending PICKED UP message to client\n"); | 841 | "Sending PICKED UP message to client\n"); |
@@ -921,32 +844,25 @@ handle_cadet_pickup_message (void *cls, | |||
921 | pick->cid = ch->cid; | 844 | pick->cid = ch->cid; |
922 | GNUNET_MQ_send (line->mq, | 845 | GNUNET_MQ_send (line->mq, |
923 | env); | 846 | env); |
924 | return GNUNET_OK; | ||
925 | } | 847 | } |
926 | 848 | ||
927 | 849 | ||
928 | /** | 850 | /** |
929 | * Function to handle a suspend message incoming over cadet | 851 | * Function to handle a suspend message incoming over cadet |
930 | * | 852 | * |
931 | * @param cls closure, NULL | 853 | * @param cls closure, our `struct Channel *` |
932 | * @param channel the channel over which the message arrived | ||
933 | * @param channel_ctx the channel context, can be NULL | ||
934 | * or point to the `struct Channel` | ||
935 | * @param message the incoming message | 854 | * @param message the incoming message |
936 | * @return #GNUNET_OK | ||
937 | */ | 855 | */ |
938 | static int | 856 | static void |
939 | handle_cadet_suspend_message (void *cls, | 857 | handle_cadet_suspend_message (void *cls, |
940 | struct GNUNET_CADET_Channel *channel, | 858 | const struct CadetPhoneSuspendMessage *message) |
941 | void **channel_ctx, | ||
942 | const struct GNUNET_MessageHeader *message) | ||
943 | { | 859 | { |
944 | struct Channel *ch = *channel_ctx; | 860 | struct Channel *ch = cls; |
945 | struct Line *line = ch->line; | 861 | struct Line *line = ch->line; |
946 | struct GNUNET_MQ_Envelope *env; | 862 | struct GNUNET_MQ_Envelope *env; |
947 | struct ClientPhoneSuspendMessage *suspend; | 863 | struct ClientPhoneSuspendMessage *suspend; |
948 | 864 | ||
949 | GNUNET_CADET_receive_done (channel); | 865 | GNUNET_CADET_receive_done (ch->channel); |
950 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 866 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
951 | "Suspending channel CID: %u\n", | 867 | "Suspending channel CID: %u\n", |
952 | ch->cid); | 868 | ch->cid); |
@@ -962,7 +878,7 @@ handle_cadet_suspend_message (void *cls, | |||
962 | ch->suspended_remote = GNUNET_YES; | 878 | ch->suspended_remote = GNUNET_YES; |
963 | break; | 879 | break; |
964 | case CS_CALLEE_SHUTDOWN: | 880 | case CS_CALLEE_SHUTDOWN: |
965 | return GNUNET_OK; | 881 | return; |
966 | case CS_CALLER_CALLING: | 882 | case CS_CALLER_CALLING: |
967 | GNUNET_break_op (0); | 883 | GNUNET_break_op (0); |
968 | break; | 884 | break; |
@@ -970,51 +886,39 @@ handle_cadet_suspend_message (void *cls, | |||
970 | ch->suspended_remote = GNUNET_YES; | 886 | ch->suspended_remote = GNUNET_YES; |
971 | break; | 887 | break; |
972 | case CS_CALLER_SHUTDOWN: | 888 | case CS_CALLER_SHUTDOWN: |
973 | return GNUNET_OK; | 889 | return; |
974 | } | 890 | } |
975 | env = GNUNET_MQ_msg (suspend, | 891 | env = GNUNET_MQ_msg (suspend, |
976 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND); | 892 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND); |
977 | suspend->cid = ch->cid; | 893 | suspend->cid = ch->cid; |
978 | GNUNET_MQ_send (line->mq, | 894 | GNUNET_MQ_send (line->mq, |
979 | env); | 895 | env); |
980 | return GNUNET_OK; | ||
981 | } | 896 | } |
982 | 897 | ||
983 | 898 | ||
984 | /** | 899 | /** |
985 | * Function to handle a resume message incoming over cadet | 900 | * Function to handle a resume message incoming over cadet |
986 | * | 901 | * |
987 | * @param cls closure, NULL | 902 | * @param cls closure, our `struct Channel *` |
988 | * @param channel the channel over which the message arrived | 903 | * @param msg the incoming message |
989 | * @param channel_ctx the channel context, can be NULL | ||
990 | * or point to the `struct Channel` | ||
991 | * @param message the incoming message | ||
992 | * @return #GNUNET_OK | ||
993 | */ | 904 | */ |
994 | static int | 905 | static void |
995 | handle_cadet_resume_message (void *cls, | 906 | handle_cadet_resume_message (void *cls, |
996 | struct GNUNET_CADET_Channel *channel, | 907 | const struct CadetPhoneResumeMessage *msg) |
997 | void **channel_ctx, | ||
998 | const struct GNUNET_MessageHeader *message) | ||
999 | { | 908 | { |
1000 | struct Channel *ch = *channel_ctx; | 909 | struct Channel *ch = cls; |
1001 | struct Line *line; | 910 | struct Line *line; |
1002 | struct GNUNET_MQ_Envelope *env; | 911 | struct GNUNET_MQ_Envelope *env; |
1003 | struct ClientPhoneResumeMessage *resume; | 912 | struct ClientPhoneResumeMessage *resume; |
1004 | 913 | ||
1005 | if (NULL == ch) | ||
1006 | { | ||
1007 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1008 | "RESUME message received for non-existing line, dropping channel.\n"); | ||
1009 | return GNUNET_SYSERR; | ||
1010 | } | ||
1011 | line = ch->line; | 914 | line = ch->line; |
1012 | GNUNET_CADET_receive_done (channel); | 915 | GNUNET_CADET_receive_done (ch->channel); |
1013 | if (GNUNET_YES != ch->suspended_remote) | 916 | if (GNUNET_YES != ch->suspended_remote) |
1014 | { | 917 | { |
1015 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 918 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1016 | "RESUME message received for non-suspended channel, dropping channel.\n"); | 919 | "RESUME message received for non-suspended channel, dropping channel.\n"); |
1017 | return GNUNET_SYSERR; | 920 | destroy_line_cadet_channels (ch); |
921 | return; | ||
1018 | } | 922 | } |
1019 | switch (ch->status) | 923 | switch (ch->status) |
1020 | { | 924 | { |
@@ -1028,7 +932,7 @@ handle_cadet_resume_message (void *cls, | |||
1028 | ch->suspended_remote = GNUNET_NO; | 932 | ch->suspended_remote = GNUNET_NO; |
1029 | break; | 933 | break; |
1030 | case CS_CALLEE_SHUTDOWN: | 934 | case CS_CALLEE_SHUTDOWN: |
1031 | return GNUNET_OK; | 935 | return; |
1032 | case CS_CALLER_CALLING: | 936 | case CS_CALLER_CALLING: |
1033 | GNUNET_break (0); | 937 | GNUNET_break (0); |
1034 | break; | 938 | break; |
@@ -1036,41 +940,47 @@ handle_cadet_resume_message (void *cls, | |||
1036 | ch->suspended_remote = GNUNET_NO; | 940 | ch->suspended_remote = GNUNET_NO; |
1037 | break; | 941 | break; |
1038 | case CS_CALLER_SHUTDOWN: | 942 | case CS_CALLER_SHUTDOWN: |
1039 | return GNUNET_OK; | 943 | return; |
1040 | } | 944 | } |
1041 | env = GNUNET_MQ_msg (resume, | 945 | env = GNUNET_MQ_msg (resume, |
1042 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME); | 946 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME); |
1043 | resume->cid = ch->cid; | 947 | resume->cid = ch->cid; |
1044 | GNUNET_MQ_send (line->mq, | 948 | GNUNET_MQ_send (line->mq, |
1045 | env); | 949 | env); |
1046 | return GNUNET_OK; | ||
1047 | } | 950 | } |
1048 | 951 | ||
1049 | 952 | ||
1050 | /** | 953 | /** |
1051 | * Function to handle an audio message incoming over cadet | 954 | * Function to check an audio message incoming over cadet |
1052 | * | 955 | * |
1053 | * @param cls closure, NULL | 956 | * @param cls closure, our `struct Channel *` |
1054 | * @param channel the channel over which the message arrived | 957 | * @param msg the incoming message |
1055 | * @param channel_ctx the channel context, can be NULL | 958 | * @return #GNUNET_OK (always) |
1056 | * or point to the `struct Channel` | ||
1057 | * @param message the incoming message | ||
1058 | * @return #GNUNET_OK | ||
1059 | */ | 959 | */ |
1060 | static int | 960 | static int |
961 | check_cadet_audio_message (void *cls, | ||
962 | const struct CadetAudioMessage *msg) | ||
963 | { | ||
964 | return GNUNET_OK; /* any payload is fine */ | ||
965 | } | ||
966 | |||
967 | |||
968 | /** | ||
969 | * Function to handle an audio message incoming over cadet | ||
970 | * | ||
971 | * @param cls closure, our `struct Channel *` | ||
972 | * @param msg the incoming message | ||
973 | */ | ||
974 | static void | ||
1061 | handle_cadet_audio_message (void *cls, | 975 | handle_cadet_audio_message (void *cls, |
1062 | struct GNUNET_CADET_Channel *channel, | 976 | const struct CadetAudioMessage *msg) |
1063 | void **channel_ctx, | ||
1064 | const struct GNUNET_MessageHeader *message) | ||
1065 | { | 977 | { |
1066 | struct Channel *ch = *channel_ctx; | 978 | struct Channel *ch = cls; |
1067 | const struct CadetAudioMessage *msg; | 979 | size_t msize = ntohs (msg->header.size) - sizeof (struct CadetAudioMessage); |
1068 | size_t msize = ntohs (message->size) - sizeof (struct CadetAudioMessage); | ||
1069 | struct GNUNET_MQ_Envelope *env; | 980 | struct GNUNET_MQ_Envelope *env; |
1070 | struct ClientAudioMessage *cam; | 981 | struct ClientAudioMessage *cam; |
1071 | 982 | ||
1072 | msg = (const struct CadetAudioMessage *) message; | 983 | GNUNET_CADET_receive_done (ch->channel); |
1073 | GNUNET_CADET_receive_done (channel); | ||
1074 | if ( (GNUNET_YES == ch->suspended_local) || | 984 | if ( (GNUNET_YES == ch->suspended_local) || |
1075 | (GNUNET_YES == ch->suspended_remote) ) | 985 | (GNUNET_YES == ch->suspended_remote) ) |
1076 | { | 986 | { |
@@ -1078,7 +988,7 @@ handle_cadet_audio_message (void *cls, | |||
1078 | "Received %u bytes of AUDIO data on suspended channel CID %u; dropping\n", | 988 | "Received %u bytes of AUDIO data on suspended channel CID %u; dropping\n", |
1079 | (unsigned int) msize, | 989 | (unsigned int) msize, |
1080 | ch->cid); | 990 | ch->cid); |
1081 | return GNUNET_OK; | 991 | return; |
1082 | } | 992 | } |
1083 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 993 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1084 | "Forwarding %u bytes of AUDIO data to client CID %u\n", | 994 | "Forwarding %u bytes of AUDIO data to client CID %u\n", |
@@ -1093,44 +1003,6 @@ handle_cadet_audio_message (void *cls, | |||
1093 | msize); | 1003 | msize); |
1094 | GNUNET_MQ_send (ch->line->mq, | 1004 | GNUNET_MQ_send (ch->line->mq, |
1095 | env); | 1005 | env); |
1096 | return GNUNET_OK; | ||
1097 | } | ||
1098 | |||
1099 | |||
1100 | /** | ||
1101 | * Method called whenever another peer has added us to a channel | ||
1102 | * the other peer initiated. | ||
1103 | * | ||
1104 | * @param cls the `struct Line` receiving a connection | ||
1105 | * @param channel new handle to the channel | ||
1106 | * @param initiator peer that started the channel | ||
1107 | * @param port port | ||
1108 | * @param options channel option flags | ||
1109 | * @return initial channel context for the channel | ||
1110 | */ | ||
1111 | static void * | ||
1112 | inbound_channel (void *cls, | ||
1113 | struct GNUNET_CADET_Channel *channel, | ||
1114 | const struct GNUNET_PeerIdentity *initiator, | ||
1115 | const struct GNUNET_HashCode *port, | ||
1116 | enum GNUNET_CADET_ChannelOption options) | ||
1117 | { | ||
1118 | struct Line *line = cls; | ||
1119 | struct Channel *ch; | ||
1120 | |||
1121 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1122 | "Received incoming cadet channel on line %p\n", | ||
1123 | line); | ||
1124 | ch = GNUNET_new (struct Channel); | ||
1125 | ch->status = CS_CALLEE_INIT; | ||
1126 | ch->line = line; | ||
1127 | ch->channel = channel; | ||
1128 | ch->mq = GNUNET_CADET_mq_create (ch->channel); | ||
1129 | ch->cid = line->cid_gen++; | ||
1130 | GNUNET_CONTAINER_DLL_insert (line->channel_head, | ||
1131 | line->channel_tail, | ||
1132 | ch); | ||
1133 | return ch; | ||
1134 | } | 1006 | } |
1135 | 1007 | ||
1136 | 1008 | ||
@@ -1140,26 +1012,16 @@ inbound_channel (void *cls, | |||
1140 | * | 1012 | * |
1141 | * @param cls closure (set from #GNUNET_CADET_connect) | 1013 | * @param cls closure (set from #GNUNET_CADET_connect) |
1142 | * @param channel connection to the other end (henceforth invalid) | 1014 | * @param channel connection to the other end (henceforth invalid) |
1143 | * @param channel_ctx place where local state associated | ||
1144 | * with the channel is stored; | ||
1145 | * may point to the `struct Channel` | ||
1146 | */ | 1015 | */ |
1147 | static void | 1016 | static void |
1148 | inbound_end (void *cls, | 1017 | inbound_end (void *cls, |
1149 | const struct GNUNET_CADET_Channel *channel, | 1018 | const struct GNUNET_CADET_Channel *channel) |
1150 | void *channel_ctx) | ||
1151 | { | 1019 | { |
1152 | struct Channel *ch = channel_ctx; | 1020 | struct Channel *ch = cls; |
1153 | struct Line *line; | 1021 | struct Line *line = ch->line; |
1154 | struct GNUNET_MQ_Envelope *env; | 1022 | struct GNUNET_MQ_Envelope *env; |
1155 | struct ClientPhoneHangupMessage *hup; | 1023 | struct ClientPhoneHangupMessage *hup; |
1156 | 1024 | ||
1157 | if (NULL == ch) | ||
1158 | { | ||
1159 | GNUNET_break (0); | ||
1160 | return; | ||
1161 | } | ||
1162 | line = ch->line; | ||
1163 | GNUNET_assert (channel == ch->channel); | 1025 | GNUNET_assert (channel == ch->channel); |
1164 | ch->channel = NULL; | 1026 | ch->channel = NULL; |
1165 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1027 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1185,7 +1047,6 @@ inbound_end (void *cls, | |||
1185 | } | 1047 | } |
1186 | break; | 1048 | break; |
1187 | } | 1049 | } |
1188 | destroy_line_cadet_channels (ch); | ||
1189 | if (NULL != line) | 1050 | if (NULL != line) |
1190 | GNUNET_CONTAINER_DLL_remove (line->channel_head, | 1051 | GNUNET_CONTAINER_DLL_remove (line->channel_head, |
1191 | line->channel_tail, | 1052 | line->channel_tail, |
@@ -1195,6 +1056,116 @@ inbound_end (void *cls, | |||
1195 | 1056 | ||
1196 | 1057 | ||
1197 | /** | 1058 | /** |
1059 | * Function to handle call request from the client | ||
1060 | * | ||
1061 | * @param cls the `struct Line` the message is about | ||
1062 | * @param msg the message from the client | ||
1063 | */ | ||
1064 | static void | ||
1065 | handle_client_call_message (void *cls, | ||
1066 | const struct ClientCallMessage *msg) | ||
1067 | { | ||
1068 | struct Line *line = cls; | ||
1069 | struct Channel *ch = GNUNET_new (struct Channel); | ||
1070 | struct GNUNET_MQ_MessageHandler cadet_handlers[] = { | ||
1071 | GNUNET_MQ_hd_fixed_size (cadet_hangup_message, | ||
1072 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP, | ||
1073 | struct CadetPhoneHangupMessage, | ||
1074 | ch), | ||
1075 | GNUNET_MQ_hd_fixed_size (cadet_pickup_message, | ||
1076 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP, | ||
1077 | struct CadetPhonePickupMessage, | ||
1078 | ch), | ||
1079 | GNUNET_MQ_hd_fixed_size (cadet_suspend_message, | ||
1080 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND, | ||
1081 | struct CadetPhoneSuspendMessage, | ||
1082 | ch), | ||
1083 | GNUNET_MQ_hd_fixed_size (cadet_resume_message, | ||
1084 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME, | ||
1085 | struct CadetPhoneResumeMessage, | ||
1086 | ch), | ||
1087 | GNUNET_MQ_hd_var_size (cadet_audio_message, | ||
1088 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO, | ||
1089 | struct CadetAudioMessage, | ||
1090 | ch), | ||
1091 | GNUNET_MQ_handler_end () | ||
1092 | }; | ||
1093 | struct GNUNET_MQ_Envelope *e; | ||
1094 | struct CadetPhoneRingMessage *ring; | ||
1095 | struct CadetPhoneRingInfoPS rs; | ||
1096 | |||
1097 | line->line_port = msg->line_port; | ||
1098 | rs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING); | ||
1099 | rs.purpose.size = htonl (sizeof (struct CadetPhoneRingInfoPS)); | ||
1100 | rs.line_port = line->line_port; | ||
1101 | rs.target_peer = msg->target; | ||
1102 | rs.expiration_time | ||
1103 | = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (RING_TIMEOUT)); | ||
1104 | ch->line = line; | ||
1105 | GNUNET_CONTAINER_DLL_insert (line->channel_head, | ||
1106 | line->channel_tail, | ||
1107 | ch); | ||
1108 | ch->status = CS_CALLER_CALLING; | ||
1109 | ch->channel = GNUNET_CADET_channel_creatE (cadet, | ||
1110 | ch, | ||
1111 | &msg->target, | ||
1112 | &msg->line_port, | ||
1113 | GNUNET_CADET_OPTION_RELIABLE, | ||
1114 | NULL, | ||
1115 | &inbound_end, | ||
1116 | cadet_handlers); | ||
1117 | ch->mq = GNUNET_CADET_get_mq (ch->channel); | ||
1118 | e = GNUNET_MQ_msg (ring, | ||
1119 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING); | ||
1120 | GNUNET_CRYPTO_ecdsa_key_get_public (&msg->caller_id, | ||
1121 | &ring->caller_id); | ||
1122 | ring->expiration_time = rs.expiration_time; | ||
1123 | GNUNET_assert (GNUNET_OK == | ||
1124 | GNUNET_CRYPTO_ecdsa_sign (&msg->caller_id, | ||
1125 | &rs.purpose, | ||
1126 | &ring->signature)); | ||
1127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1128 | "Sending RING message via CADET\n"); | ||
1129 | GNUNET_MQ_send (ch->mq, | ||
1130 | e); | ||
1131 | GNUNET_SERVICE_client_continue (line->client); | ||
1132 | } | ||
1133 | |||
1134 | |||
1135 | /** | ||
1136 | * Method called whenever another peer has added us to a channel | ||
1137 | * the other peer initiated. | ||
1138 | * | ||
1139 | * @param cls the `struct Line` receiving a connection | ||
1140 | * @param channel new handle to the channel | ||
1141 | * @param initiator peer that started the channel | ||
1142 | * @return initial channel context for the channel | ||
1143 | */ | ||
1144 | static void * | ||
1145 | inbound_channel (void *cls, | ||
1146 | struct GNUNET_CADET_Channel *channel, | ||
1147 | const struct GNUNET_PeerIdentity *initiator) | ||
1148 | { | ||
1149 | struct Line *line = cls; | ||
1150 | struct Channel *ch; | ||
1151 | |||
1152 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1153 | "Received incoming cadet channel on line %p\n", | ||
1154 | line); | ||
1155 | ch = GNUNET_new (struct Channel); | ||
1156 | ch->status = CS_CALLEE_INIT; | ||
1157 | ch->line = line; | ||
1158 | ch->channel = channel; | ||
1159 | ch->mq = GNUNET_CADET_get_mq (ch->channel); | ||
1160 | ch->cid = line->cid_gen++; | ||
1161 | GNUNET_CONTAINER_DLL_insert (line->channel_head, | ||
1162 | line->channel_tail, | ||
1163 | ch); | ||
1164 | return ch; | ||
1165 | } | ||
1166 | |||
1167 | |||
1168 | /** | ||
1198 | * A client connected. Initialize the `struct Line` data structure. | 1169 | * A client connected. Initialize the `struct Line` data structure. |
1199 | * | 1170 | * |
1200 | * @param cls closure, NULL | 1171 | * @param cls closure, NULL |
@@ -1260,12 +1231,42 @@ handle_client_register_message (void *cls, | |||
1260 | const struct ClientPhoneRegisterMessage *msg) | 1231 | const struct ClientPhoneRegisterMessage *msg) |
1261 | { | 1232 | { |
1262 | struct Line *line = cls; | 1233 | struct Line *line = cls; |
1234 | struct GNUNET_MQ_MessageHandler cadet_handlers[] = { | ||
1235 | GNUNET_MQ_hd_fixed_size (cadet_ring_message, | ||
1236 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING, | ||
1237 | struct CadetPhoneRingMessage, | ||
1238 | NULL), | ||
1239 | GNUNET_MQ_hd_fixed_size (cadet_hangup_message, | ||
1240 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP, | ||
1241 | struct CadetPhoneHangupMessage, | ||
1242 | NULL), | ||
1243 | GNUNET_MQ_hd_fixed_size (cadet_pickup_message, | ||
1244 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP, | ||
1245 | struct CadetPhonePickupMessage, | ||
1246 | NULL), | ||
1247 | GNUNET_MQ_hd_fixed_size (cadet_suspend_message, | ||
1248 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND, | ||
1249 | struct CadetPhoneSuspendMessage, | ||
1250 | NULL), | ||
1251 | GNUNET_MQ_hd_fixed_size (cadet_resume_message, | ||
1252 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME, | ||
1253 | struct CadetPhoneResumeMessage, | ||
1254 | NULL), | ||
1255 | GNUNET_MQ_hd_var_size (cadet_audio_message, | ||
1256 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO, | ||
1257 | struct CadetAudioMessage, | ||
1258 | NULL), | ||
1259 | GNUNET_MQ_handler_end () | ||
1260 | }; | ||
1263 | 1261 | ||
1264 | line->line_port = msg->line_port; | 1262 | line->line_port = msg->line_port; |
1265 | line->port = GNUNET_CADET_open_port (cadet, | 1263 | line->port = GNUNET_CADET_open_porT (cadet, |
1266 | &msg->line_port, | 1264 | &msg->line_port, |
1267 | &inbound_channel, | 1265 | &inbound_channel, |
1268 | line); | 1266 | line, |
1267 | NULL, | ||
1268 | &inbound_end, | ||
1269 | cadet_handlers); | ||
1269 | GNUNET_SERVICE_client_continue (line->client); | 1270 | GNUNET_SERVICE_client_continue (line->client); |
1270 | } | 1271 | } |
1271 | 1272 | ||
@@ -1298,35 +1299,11 @@ run (void *cls, | |||
1298 | const struct GNUNET_CONFIGURATION_Handle *c, | 1299 | const struct GNUNET_CONFIGURATION_Handle *c, |
1299 | struct GNUNET_SERVICE_Handle *service) | 1300 | struct GNUNET_SERVICE_Handle *service) |
1300 | { | 1301 | { |
1301 | static struct GNUNET_CADET_MessageHandler cadet_handlers[] = { | ||
1302 | {&handle_cadet_ring_message, | ||
1303 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING, | ||
1304 | sizeof (struct CadetPhoneRingMessage)}, | ||
1305 | {&handle_cadet_hangup_message, | ||
1306 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP, | ||
1307 | sizeof (struct CadetPhoneHangupMessage)}, | ||
1308 | {&handle_cadet_pickup_message, | ||
1309 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP, | ||
1310 | sizeof (struct CadetPhonePickupMessage)}, | ||
1311 | {&handle_cadet_suspend_message, | ||
1312 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND, | ||
1313 | sizeof (struct CadetPhoneSuspendMessage)}, | ||
1314 | {&handle_cadet_resume_message, | ||
1315 | GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME, | ||
1316 | sizeof (struct CadetPhoneResumeMessage)}, | ||
1317 | {&handle_cadet_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO, | ||
1318 | 0}, | ||
1319 | {NULL, 0, 0} | ||
1320 | }; | ||
1321 | |||
1322 | cfg = c; | 1302 | cfg = c; |
1323 | GNUNET_assert (GNUNET_OK == | 1303 | GNUNET_assert (GNUNET_OK == |
1324 | GNUNET_CRYPTO_get_peer_identity (cfg, | 1304 | GNUNET_CRYPTO_get_peer_identity (cfg, |
1325 | &my_identity)); | 1305 | &my_identity)); |
1326 | cadet = GNUNET_CADET_connect (cfg, | 1306 | cadet = GNUNET_CADET_connecT (cfg); |
1327 | NULL, | ||
1328 | &inbound_end, | ||
1329 | cadet_handlers); | ||
1330 | if (NULL == cadet) | 1307 | if (NULL == cadet) |
1331 | { | 1308 | { |
1332 | GNUNET_break (0); | 1309 | GNUNET_break (0); |
@@ -1338,7 +1315,6 @@ run (void *cls, | |||
1338 | } | 1315 | } |
1339 | 1316 | ||
1340 | 1317 | ||
1341 | |||
1342 | /** | 1318 | /** |
1343 | * Define "main" method using service macro. | 1319 | * Define "main" method using service macro. |
1344 | */ | 1320 | */ |
@@ -1353,26 +1329,26 @@ GNUNET_SERVICE_MAIN | |||
1353 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER, | 1329 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER, |
1354 | struct ClientPhoneRegisterMessage, | 1330 | struct ClientPhoneRegisterMessage, |
1355 | NULL), | 1331 | NULL), |
1356 | GNUNET_MQ_hd_fixed_size (client_pickup_message, | 1332 | GNUNET_MQ_hd_fixed_size (client_pickup_message, |
1357 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP, | 1333 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP, |
1358 | struct ClientPhonePickupMessage, | 1334 | struct ClientPhonePickupMessage, |
1359 | NULL), | 1335 | NULL), |
1360 | GNUNET_MQ_hd_fixed_size (client_suspend_message, | 1336 | GNUNET_MQ_hd_fixed_size (client_suspend_message, |
1361 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND, | 1337 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND, |
1362 | struct ClientPhoneSuspendMessage, | 1338 | struct ClientPhoneSuspendMessage, |
1363 | NULL), | 1339 | NULL), |
1364 | GNUNET_MQ_hd_fixed_size (client_resume_message, | 1340 | GNUNET_MQ_hd_fixed_size (client_resume_message, |
1365 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME, | 1341 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME, |
1366 | struct ClientPhoneResumeMessage, | 1342 | struct ClientPhoneResumeMessage, |
1367 | NULL), | 1343 | NULL), |
1368 | GNUNET_MQ_hd_fixed_size (client_hangup_message, | 1344 | GNUNET_MQ_hd_fixed_size (client_hangup_message, |
1369 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, | 1345 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, |
1370 | struct ClientPhoneHangupMessage, | 1346 | struct ClientPhoneHangupMessage, |
1371 | NULL), | 1347 | NULL), |
1372 | GNUNET_MQ_hd_fixed_size (client_call_message, | 1348 | GNUNET_MQ_hd_fixed_size (client_call_message, |
1373 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL, | 1349 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL, |
1374 | struct ClientCallMessage, | 1350 | struct ClientCallMessage, |
1375 | NULL), | 1351 | NULL), |
1376 | GNUNET_MQ_hd_var_size (client_audio_message, | 1352 | GNUNET_MQ_hd_var_size (client_audio_message, |
1377 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, | 1353 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, |
1378 | struct ClientAudioMessage, | 1354 | struct ClientAudioMessage, |
diff --git a/src/conversation/test_conversation.conf b/src/conversation/test_conversation.conf index 46ea95d52..e0fd8200c 100644 --- a/src/conversation/test_conversation.conf +++ b/src/conversation/test_conversation.conf | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | [conversation] | 3 | [conversation] |
4 | LINE=1 | 4 | LINE=1 |
5 | PREFIX = valgrind | ||
5 | 6 | ||
6 | [nse] | 7 | [nse] |
7 | WORKBITS = 0 | 8 | WORKBITS = 0 |