aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/conversation_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/conversation_api.c')
-rw-r--r--src/conversation/conversation_api.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index 11eb2b7e7..6e1cbe3fb 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -1,17 +1,17 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013 Christian Grothoff (and other contributing authors)
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
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -75,7 +75,7 @@ struct GNUNET_CONVERSATION_Phone
75 * Our configuration. 75 * Our configuration.
76 */ 76 */
77 const struct GNUNET_CONFIGURATION_Handle *cfg; 77 const struct GNUNET_CONFIGURATION_Handle *cfg;
78 78
79 /** 79 /**
80 * Handle to talk with CONVERSATION service. 80 * Handle to talk with CONVERSATION service.
81 */ 81 */
@@ -103,7 +103,7 @@ struct GNUNET_CONVERSATION_Phone
103 103
104 /** 104 /**
105 * Connection to NAMESTORE (for reverse lookup). 105 * Connection to NAMESTORE (for reverse lookup).
106 */ 106 */
107 struct GNUNET_NAMESTORE_Handle *ns; 107 struct GNUNET_NAMESTORE_Handle *ns;
108 108
109 /** 109 /**
@@ -119,7 +119,7 @@ struct GNUNET_CONVERSATION_Phone
119 /** 119 /**
120 * This phone's record. 120 * This phone's record.
121 */ 121 */
122 struct GNUNET_CONVERSATION_PhoneRecord my_record; 122 struct GNUNET_CONVERSATION_PhoneRecord my_record;
123 123
124 /** 124 /**
125 * My GNS zone. 125 * My GNS zone.
@@ -316,7 +316,7 @@ handle_phone_audio_message (void *cls,
316 316
317 317
318/** 318/**
319 * We encountered an error talking with the conversation service. 319 * We encountered an error talking with the conversation service.
320 * 320 *
321 * @param cls the `struct GNUNET_CONVERSATION_Phone` 321 * @param cls the `struct GNUNET_CONVERSATION_Phone`
322 * @param error details about the error 322 * @param error details about the error
@@ -326,7 +326,7 @@ phone_error_handler (void *cls,
326 enum GNUNET_MQ_Error error) 326 enum GNUNET_MQ_Error error)
327{ 327{
328 struct GNUNET_CONVERSATION_Phone *phone = cls; 328 struct GNUNET_CONVERSATION_Phone *phone = cls;
329 329
330 GNUNET_break (0); 330 GNUNET_break (0);
331 FPRINTF (stderr, 331 FPRINTF (stderr,
332 _("Internal error %d\n"), 332 _("Internal error %d\n"),
@@ -346,15 +346,15 @@ reconnect_phone (struct GNUNET_CONVERSATION_Phone *phone)
346 static struct GNUNET_MQ_MessageHandler handlers[] = 346 static struct GNUNET_MQ_MessageHandler handlers[] =
347 { 347 {
348 { &handle_phone_ring, 348 { &handle_phone_ring,
349 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING, 349 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING,
350 sizeof (struct ClientPhoneRingMessage) }, 350 sizeof (struct ClientPhoneRingMessage) },
351 { &handle_phone_hangup, 351 { &handle_phone_hangup,
352 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, 352 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
353 0 }, 353 0 },
354 { &handle_phone_audio_message, 354 { &handle_phone_audio_message,
355 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, 355 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
356 0 }, 356 0 },
357 { NULL, 0, 0 } 357 { NULL, 0, 0 }
358 }; 358 };
359 struct GNUNET_MQ_Envelope *e; 359 struct GNUNET_MQ_Envelope *e;
360 struct ClientPhoneRegisterMessage *reg; 360 struct ClientPhoneRegisterMessage *reg;
@@ -408,7 +408,7 @@ GNUNET_CONVERSATION_phone_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
408 unsigned long long line; 408 unsigned long long line;
409 409
410 if (GNUNET_OK != 410 if (GNUNET_OK !=
411 GNUNET_CONFIGURATION_get_value_number (cfg, 411 GNUNET_CONFIGURATION_get_value_number (cfg,
412 "CONVERSATION", 412 "CONVERSATION",
413 "LINE", 413 "LINE",
414 &line)) 414 &line))
@@ -478,7 +478,7 @@ transmit_phone_audio (void *cls,
478 struct ClientAudioMessage *am; 478 struct ClientAudioMessage *am;
479 479
480 GNUNET_assert (PS_ACTIVE == phone->state); 480 GNUNET_assert (PS_ACTIVE == phone->state);
481 e = GNUNET_MQ_msg_extra (am, 481 e = GNUNET_MQ_msg_extra (am,
482 data_size, 482 data_size,
483 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); 483 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
484 memcpy (&am[1], data, data_size); 484 memcpy (&am[1], data, data_size);
@@ -487,7 +487,7 @@ transmit_phone_audio (void *cls,
487 487
488 488
489/** 489/**
490 * Picks up a (ringing) phone. This will connect the speaker 490 * Picks up a (ringing) phone. This will connect the speaker
491 * to the microphone of the other party, and vice versa. 491 * to the microphone of the other party, and vice versa.
492 * 492 *
493 * @param phone phone to pick up 493 * @param phone phone to pick up
@@ -630,7 +630,7 @@ struct GNUNET_CONVERSATION_Call
630 * Our configuration. 630 * Our configuration.
631 */ 631 */
632 const struct GNUNET_CONFIGURATION_Handle *cfg; 632 const struct GNUNET_CONFIGURATION_Handle *cfg;
633 633
634 /** 634 /**
635 * Handle to talk with CONVERSATION service. 635 * Handle to talk with CONVERSATION service.
636 */ 636 */
@@ -655,7 +655,7 @@ struct GNUNET_CONVERSATION_Call
655 * Our microphone. 655 * Our microphone.
656 */ 656 */
657 struct GNUNET_MICROPHONE_Handle *mic; 657 struct GNUNET_MICROPHONE_Handle *mic;
658 658
659 /** 659 /**
660 * Function to call with events. 660 * Function to call with events.
661 */ 661 */
@@ -673,7 +673,7 @@ struct GNUNET_CONVERSATION_Call
673 673
674 /** 674 /**
675 * Connection to GNS (can be NULL). 675 * Connection to GNS (can be NULL).
676 */ 676 */
677 struct GNUNET_GNS_Handle *gns; 677 struct GNUNET_GNS_Handle *gns;
678 678
679 /** 679 /**
@@ -754,7 +754,7 @@ transmit_call_audio (void *cls,
754 struct ClientAudioMessage *am; 754 struct ClientAudioMessage *am;
755 755
756 GNUNET_assert (CS_ACTIVE == call->state); 756 GNUNET_assert (CS_ACTIVE == call->state);
757 e = GNUNET_MQ_msg_extra (am, 757 e = GNUNET_MQ_msg_extra (am,
758 data_size, 758 data_size,
759 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); 759 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
760 memcpy (&am[1], data, data_size); 760 memcpy (&am[1], data, data_size);
@@ -782,7 +782,7 @@ handle_call_picked_up (void *cls,
782 metadata = (const char *) &am[1]; 782 metadata = (const char *) &am[1];
783 if ( (0 == size) || 783 if ( (0 == size) ||
784 ('\0' != metadata[size - 1]) ) 784 ('\0' != metadata[size - 1]) )
785 metadata = NULL; 785 metadata = NULL;
786 switch (call->state) 786 switch (call->state)
787 { 787 {
788 case CS_LOOKUP: 788 case CS_LOOKUP:
@@ -830,7 +830,7 @@ handle_call_hangup (void *cls,
830 reason = (const char *) &am[1]; 830 reason = (const char *) &am[1];
831 if ( (0 == size) || 831 if ( (0 == size) ||
832 ('\0' != reason[size - 1]) ) 832 ('\0' != reason[size - 1]) )
833 reason = NULL; 833 reason = NULL;
834 switch (call->state) 834 switch (call->state)
835 { 835 {
836 case CS_LOOKUP: 836 case CS_LOOKUP:
@@ -900,7 +900,7 @@ handle_call_audio_message (void *cls,
900 * @param rd_count number of records in @a rd 900 * @param rd_count number of records in @a rd
901 * @param rd the records in reply 901 * @param rd the records in reply
902 */ 902 */
903static void 903static void
904handle_gns_response (void *cls, 904handle_gns_response (void *cls,
905 uint32_t rd_count, 905 uint32_t rd_count,
906 const struct GNUNET_NAMESTORE_RecordData *rd) 906 const struct GNUNET_NAMESTORE_RecordData *rd)
@@ -919,7 +919,7 @@ handle_gns_response (void *cls,
919 { 919 {
920 GNUNET_break_op (0); 920 GNUNET_break_op (0);
921 continue; 921 continue;
922 } 922 }
923 memcpy (&call->phone_record, 923 memcpy (&call->phone_record,
924 rd[i].data, 924 rd[i].data,
925 rd[i].data_size); 925 rd[i].data_size);
@@ -942,7 +942,7 @@ handle_gns_response (void *cls,
942 942
943 943
944/** 944/**
945 * We encountered an error talking with the conversation service. 945 * We encountered an error talking with the conversation service.
946 * 946 *
947 * @param cls the `struct GNUNET_CONVERSATION_Call` 947 * @param cls the `struct GNUNET_CONVERSATION_Call`
948 * @param error details about the error 948 * @param error details about the error
@@ -972,18 +972,18 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call)
972 static struct GNUNET_MQ_MessageHandler handlers[] = 972 static struct GNUNET_MQ_MessageHandler handlers[] =
973 { 973 {
974 { &handle_call_busy, 974 { &handle_call_busy,
975 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY, 975 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY,
976 sizeof (struct ClientPhoneBusyMessage) }, 976 sizeof (struct ClientPhoneBusyMessage) },
977 { &handle_call_picked_up, 977 { &handle_call_picked_up,
978 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP, 978 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP,
979 0 }, 979 0 },
980 { &handle_call_hangup, 980 { &handle_call_hangup,
981 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, 981 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
982 0 }, 982 0 },
983 { &handle_call_audio_message, 983 { &handle_call_audio_message,
984 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, 984 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
985 0 }, 985 0 },
986 { NULL, 0, 0 } 986 { NULL, 0, 0 }
987 }; 987 };
988 struct GNUNET_CRYPTO_EccPublicSignKey my_zone; 988 struct GNUNET_CRYPTO_EccPublicSignKey my_zone;
989 989
@@ -1013,7 +1013,7 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call)
1013 call->state = CS_LOOKUP; 1013 call->state = CS_LOOKUP;
1014 GNUNET_IDENTITY_ego_get_public_key (call->caller_id, 1014 GNUNET_IDENTITY_ego_get_public_key (call->caller_id,
1015 &my_zone); 1015 &my_zone);
1016 call->gns_lookup = GNUNET_GNS_lookup (call->gns, 1016 call->gns_lookup = GNUNET_GNS_lookup (call->gns,
1017 call->callee, 1017 call->callee,
1018 &my_zone, 1018 &my_zone,
1019 GNUNET_NAMESTORE_TYPE_PHONE, 1019 GNUNET_NAMESTORE_TYPE_PHONE,