aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/conversation_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-02 17:10:22 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-02 17:10:22 +0000
commit17e35f0a3eabb698ac7a0e34e096d64ab3a6d123 (patch)
treef5f84f055e5ef8afcadc046d69d4e300bef1ed2f /src/conversation/conversation_api.c
parent1e0fa3c5117a2c3306b6bfa4a9d100ebde33b833 (diff)
downloadgnunet-17e35f0a3eabb698ac7a0e34e096d64ab3a6d123.tar.gz
gnunet-17e35f0a3eabb698ac7a0e34e096d64ab3a6d123.zip
-fix indentation, minor leaks
Diffstat (limited to 'src/conversation/conversation_api.c')
-rw-r--r--src/conversation/conversation_api.c102
1 files changed, 55 insertions, 47 deletions
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index c3fe8c960..5bd88c01f 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -81,54 +81,54 @@ struct GNUNET_CONVERSATION_CallInformation
81struct GNUNET_CONVERSATION_Handle 81struct GNUNET_CONVERSATION_Handle
82{ 82{
83 83
84 /** 84 /**
85 * Our configuration. 85 * Our configuration.
86 */ 86 */
87 const struct GNUNET_CONFIGURATION_Handle *cfg; 87 const struct GNUNET_CONFIGURATION_Handle *cfg;
88 88
89 /** 89 /**
90 * Handle to the server connection, to send messages later 90 * Handle to the server connection, to send messages later
91 */ 91 */
92 struct GNUNET_CLIENT_Connection *client; 92 struct GNUNET_CLIENT_Connection *client;
93 93
94 /** 94 /**
95 * GNS handle 95 * GNS handle
96 */ 96 */
97 struct GNUNET_GNS_Handle *gns; 97 struct GNUNET_GNS_Handle *gns;
98 98
99 /** 99 /**
100 * Namestore handle 100 * Namestore handle
101 */ 101 */
102 struct GNUNET_NAMESTORE_Handle *namestore; 102 struct GNUNET_NAMESTORE_Handle *namestore;
103 103
104 /** 104 /**
105 * TXT record for gns 105 * TXT record for gns
106 */ 106 */
107 int txt_record_set; 107 int txt_record_set;
108 108
109 /** 109 /**
110 * Callback for incoming calls 110 * Callback for incoming calls
111 */ 111 */
112 GNUNET_CONVERSATION_CallHandler *call_handler; 112 GNUNET_CONVERSATION_CallHandler *call_handler;
113 113
114 /** 114 /**
115 * Callback for rejected calls 115 * Callback for rejected calls
116 */ 116 */
117 GNUNET_CONVERSATION_RejectHandler *reject_handler; 117 GNUNET_CONVERSATION_RejectHandler *reject_handler;
118 118
119 /** 119 /**
120 * Callback for notifications 120 * Callback for notifications
121 */ 121 */
122 GNUNET_CONVERSATION_NotificationHandler *notification_handler; 122 GNUNET_CONVERSATION_NotificationHandler *notification_handler;
123 123
124 /** 124 /**
125 * Callback for missed calls 125 * Callback for missed calls
126 */ 126 */
127 GNUNET_CONVERSATION_MissedCallHandler *missed_call_handler; 127 GNUNET_CONVERSATION_MissedCallHandler *missed_call_handler;
128 128
129 /** 129 /**
130 * The pointer to the call 130 * The pointer to the call
131 */ 131 */
132 struct GNUNET_CONVERSATION_CallInformation *call; 132 struct GNUNET_CONVERSATION_CallInformation *call;
133}; 133};
134 134
@@ -210,26 +210,24 @@ check_gns_cb (void *cls, uint32_t rd_count,
210 { 210 {
211 h->txt_record_set = GNUNET_YES; 211 h->txt_record_set = GNUNET_YES;
212 } 212 }
213
214 return;
215} 213}
216 214
215
217/** 216/**
218* Check if the gns txt record for conversation exits 217 * Check if the gns txt record for conversation exits
219*/ 218 */
220static void 219static void
221check_gns (struct GNUNET_CONVERSATION_Handle *h) 220check_gns (struct GNUNET_CONVERSATION_Handle *h)
222{ 221{
223 GNUNET_GNS_lookup (h->gns, "conversation.gads", 222 GNUNET_GNS_lookup (h->gns, "conversation.gns",
224 NULL /* FIXME_ZONE */, 223 NULL /* FIXME_ZONE */,
225 GNUNET_DNSPARSER_TYPE_TXT, 224 GNUNET_DNSPARSER_TYPE_TXT,
226 GNUNET_NO, 225 GNUNET_NO,
227 NULL, 226 NULL,
228 &check_gns_cb, h); 227 &check_gns_cb, h);
229
230 return;
231} 228}
232 229
230
233/******************************************************************************/ 231/******************************************************************************/
234/*********************** RECEIVE HANDLERS ****************************/ 232/*********************** RECEIVE HANDLERS ****************************/
235/******************************************************************************/ 233/******************************************************************************/
@@ -241,7 +239,8 @@ check_gns (struct GNUNET_CONVERSATION_Handle *h)
241 * @param msg message received, NULL on timeout or fatal error 239 * @param msg message received, NULL on timeout or fatal error
242 */ 240 */
243static void 241static void
244receive_message_cb (void *cls, const struct GNUNET_MessageHeader *msg) 242receive_message_cb (void *cls,
243 const struct GNUNET_MessageHeader *msg)
245{ 244{
246 struct GNUNET_CONVERSATION_Handle *h = cls; 245 struct GNUNET_CONVERSATION_Handle *h = cls;
247 struct ServerClientSessionInitiateMessage *imsg; 246 struct ServerClientSessionInitiateMessage *imsg;
@@ -532,6 +531,7 @@ accept_call (struct GNUNET_CONVERSATION_Handle *h)
532 &transmit_session_accept_message, h); 531 &transmit_session_accept_message, h);
533} 532}
534 533
534
535/** 535/**
536 * Auxiliary function to reject a call. 536 * Auxiliary function to reject a call.
537 * 537 *
@@ -547,6 +547,7 @@ reject_call (struct GNUNET_CONVERSATION_Handle *h)
547 &transmit_session_reject_message, h); 547 &transmit_session_reject_message, h);
548} 548}
549 549
550
550/** 551/**
551 * Auxiliary function to terminate a call. 552 * Auxiliary function to terminate a call.
552 * 553 *
@@ -563,9 +564,10 @@ terminate_call (struct GNUNET_CONVERSATION_Handle *h)
563 h); 564 h);
564} 565}
565 566
567
566/** 568/**
567* 569 *
568*/ 570 */
569static void 571static void
570gns_call_cb (void *cls, uint32_t rd_count, 572gns_call_cb (void *cls, uint32_t rd_count,
571 const struct GNUNET_NAMESTORE_RecordData *rd) 573 const struct GNUNET_NAMESTORE_RecordData *rd)
@@ -635,15 +637,17 @@ gns_lookup_and_call (struct GNUNET_CONVERSATION_Handle *h, const char *callee)
635/******************************************************************************/ 637/******************************************************************************/
636 638
637struct GNUNET_CONVERSATION_Handle * 639struct GNUNET_CONVERSATION_Handle *
638GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, 640GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
639 GNUNET_CONVERSATION_CallHandler * call_handler, 641 void *cls,
640 GNUNET_CONVERSATION_RejectHandler * reject_handler, 642 GNUNET_CONVERSATION_CallHandler call_handler,
641 GNUNET_CONVERSATION_NotificationHandler * notification_handler, 643 GNUNET_CONVERSATION_RejectHandler reject_handler,
642 GNUNET_CONVERSATION_MissedCallHandler * missed_call_handler) 644 GNUNET_CONVERSATION_NotificationHandler notification_handler,
645 GNUNET_CONVERSATION_MissedCallHandler missed_call_handler)
643{ 646{
644 struct GNUNET_CONVERSATION_Handle *h; 647 struct GNUNET_CONVERSATION_Handle *h;
645 648
646 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "GNUNET_CONVERSATION_connect()\n"); 649 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
650 "GNUNET_CONVERSATION_connect()\n");
647 h = GNUNET_malloc (sizeof (struct GNUNET_CONVERSATION_Handle)); 651 h = GNUNET_malloc (sizeof (struct GNUNET_CONVERSATION_Handle));
648 652
649 h->cfg = cfg; 653 h->cfg = cfg;
@@ -690,6 +694,7 @@ GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void
690 return h; 694 return h;
691} 695}
692 696
697
693void 698void
694GNUNET_CONVERSATION_disconnect (struct GNUNET_CONVERSATION_Handle *handle) 699GNUNET_CONVERSATION_disconnect (struct GNUNET_CONVERSATION_Handle *handle)
695{ 700{
@@ -732,6 +737,7 @@ GNUNET_CONVERSATION_call (struct GNUNET_CONVERSATION_Handle *h,
732 initiate_call (h, peer); 737 initiate_call (h, peer);
733} 738}
734 739
740
735void 741void
736GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *h) 742GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *h)
737{ 743{
@@ -741,6 +747,7 @@ GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *h)
741 terminate_call (h); 747 terminate_call (h);
742} 748}
743 749
750
744void 751void
745GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *h) 752GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *h)
746{ 753{
@@ -750,6 +757,7 @@ GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *h)
750 accept_call (h); 757 accept_call (h);
751} 758}
752 759
760
753void 761void
754GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *h) 762GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *h)
755{ 763{