aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/conversation_api_call.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/conversation_api_call.c')
-rw-r--r--src/conversation/conversation_api_call.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/conversation/conversation_api_call.c b/src/conversation/conversation_api_call.c
index 7e4a147a0..816920f0f 100644
--- a/src/conversation/conversation_api_call.c
+++ b/src/conversation/conversation_api_call.c
@@ -91,11 +91,6 @@ struct GNUNET_CONVERSATION_Call
91 struct GNUNET_IDENTITY_Ego *caller_id; 91 struct GNUNET_IDENTITY_Ego *caller_id;
92 92
93 /** 93 /**
94 * GNS zone to use to resolve @e callee.
95 */
96 struct GNUNET_IDENTITY_Ego *zone_id;
97
98 /**
99 * Target callee as a GNS address/name. 94 * Target callee as a GNS address/name.
100 */ 95 */
101 char *callee; 96 char *callee;
@@ -133,7 +128,7 @@ struct GNUNET_CONVERSATION_Call
133 /** 128 /**
134 * Active GNS lookup (or NULL). 129 * Active GNS lookup (or NULL).
135 */ 130 */
136 struct GNUNET_GNS_LookupRequest *gns_lookup; 131 struct GNUNET_GNS_LookupWithTldRequest *gns_lookup;
137 132
138 /** 133 /**
139 * Target phone record, only valid after the lookup is done. 134 * Target phone record, only valid after the lookup is done.
@@ -197,6 +192,7 @@ handle_call_suspend (void *cls,
197{ 192{
198 struct GNUNET_CONVERSATION_Call *call = cls; 193 struct GNUNET_CONVERSATION_Call *call = cls;
199 194
195 (void) msg;
200 switch (call->state) 196 switch (call->state)
201 { 197 {
202 case CS_LOOKUP: 198 case CS_LOOKUP:
@@ -242,6 +238,7 @@ handle_call_resume (void *cls,
242{ 238{
243 struct GNUNET_CONVERSATION_Call *call = cls; 239 struct GNUNET_CONVERSATION_Call *call = cls;
244 240
241 (void) msg;
245 switch (call->state) 242 switch (call->state)
246 { 243 {
247 case CS_LOOKUP: 244 case CS_LOOKUP:
@@ -291,6 +288,7 @@ handle_call_picked_up (void *cls,
291{ 288{
292 struct GNUNET_CONVERSATION_Call *call = cls; 289 struct GNUNET_CONVERSATION_Call *call = cls;
293 290
291 (void) msg;
294 switch (call->state) 292 switch (call->state)
295 { 293 {
296 case CS_LOOKUP: 294 case CS_LOOKUP:
@@ -334,6 +332,7 @@ handle_call_hangup (void *cls,
334 GNUNET_CONVERSATION_CallEventHandler eh; 332 GNUNET_CONVERSATION_CallEventHandler eh;
335 void *eh_cls; 333 void *eh_cls;
336 334
335 (void) msg;
337 switch (call->state) 336 switch (call->state)
338 { 337 {
339 case CS_LOOKUP: 338 case CS_LOOKUP:
@@ -369,6 +368,8 @@ static int
369check_call_audio (void *cls, 368check_call_audio (void *cls,
370 const struct ClientAudioMessage *am) 369 const struct ClientAudioMessage *am)
371{ 370{
371 (void) cls;
372 (void) am;
372 /* any payload is OK */ 373 /* any payload is OK */
373 return GNUNET_OK; 374 return GNUNET_OK;
374} 375}
@@ -421,23 +422,25 @@ handle_call_audio (void *cls,
421 * Iterator called on obtained result for a GNS lookup. 422 * Iterator called on obtained result for a GNS lookup.
422 * 423 *
423 * @param cls closure with the `struct GNUNET_CONVERSATION_Call` 424 * @param cls closure with the `struct GNUNET_CONVERSATION_Call`
425 * @param was_gns #GNUNET_NO if name was not a GNS name
424 * @param rd_count number of records in @a rd 426 * @param rd_count number of records in @a rd
425 * @param rd the records in reply 427 * @param rd the records in reply
426 */ 428 */
427static void 429static void
428handle_gns_response (void *cls, 430handle_gns_response (void *cls,
431 int was_gns,
429 uint32_t rd_count, 432 uint32_t rd_count,
430 const struct GNUNET_GNSRECORD_Data *rd) 433 const struct GNUNET_GNSRECORD_Data *rd)
431{ 434{
432 struct GNUNET_CONVERSATION_Call *call = cls; 435 struct GNUNET_CONVERSATION_Call *call = cls;
433 uint32_t i;
434 struct GNUNET_MQ_Envelope *e; 436 struct GNUNET_MQ_Envelope *e;
435 struct ClientCallMessage *ccm; 437 struct ClientCallMessage *ccm;
436 438
439 (void) was_gns;
437 GNUNET_break (NULL != call->gns_lookup); 440 GNUNET_break (NULL != call->gns_lookup);
438 GNUNET_break (CS_LOOKUP == call->state); 441 GNUNET_break (CS_LOOKUP == call->state);
439 call->gns_lookup = NULL; 442 call->gns_lookup = NULL;
440 for (i=0;i<rd_count;i++) 443 for (uint32_t i=0;i<rd_count;i++)
441 { 444 {
442 if (GNUNET_GNSRECORD_TYPE_PHONE == rd[i].record_type) 445 if (GNUNET_GNSRECORD_TYPE_PHONE == rd[i].record_type)
443 { 446 {
@@ -481,6 +484,7 @@ call_error_handler (void *cls,
481{ 484{
482 struct GNUNET_CONVERSATION_Call *call = cls; 485 struct GNUNET_CONVERSATION_Call *call = cls;
483 486
487 (void) error;
484 if (CS_SHUTDOWN == call->state) 488 if (CS_SHUTDOWN == call->state)
485 { 489 {
486 GNUNET_CONVERSATION_call_stop (call); 490 GNUNET_CONVERSATION_call_stop (call);
@@ -522,7 +526,6 @@ fail_call (struct GNUNET_CONVERSATION_Call *call)
522 * 526 *
523 * @param cfg configuration to use, specifies our phone service 527 * @param cfg configuration to use, specifies our phone service
524 * @param caller_id identity of the caller 528 * @param caller_id identity of the caller
525 * @param zone_id GNS zone to use to resolve @a callee
526 * @param callee GNS name of the callee (used to locate the callee's record) 529 * @param callee GNS name of the callee (used to locate the callee's record)
527 * @param speaker speaker to use (will be used automatically immediately once the 530 * @param speaker speaker to use (will be used automatically immediately once the
528 * #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated); we will NOT generate 531 * #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated); we will NOT generate
@@ -536,7 +539,6 @@ fail_call (struct GNUNET_CONVERSATION_Call *call)
536struct GNUNET_CONVERSATION_Call * 539struct GNUNET_CONVERSATION_Call *
537GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg, 540GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
538 struct GNUNET_IDENTITY_Ego *caller_id, 541 struct GNUNET_IDENTITY_Ego *caller_id,
539 struct GNUNET_IDENTITY_Ego *zone_id,
540 const char *callee, 542 const char *callee,
541 struct GNUNET_SPEAKER_Handle *speaker, 543 struct GNUNET_SPEAKER_Handle *speaker,
542 struct GNUNET_MICROPHONE_Handle *mic, 544 struct GNUNET_MICROPHONE_Handle *mic,
@@ -568,7 +570,6 @@ GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
568 call), 570 call),
569 GNUNET_MQ_handler_end () 571 GNUNET_MQ_handler_end ()
570 }; 572 };
571 struct GNUNET_CRYPTO_EcdsaPublicKey my_zone;
572 573
573 call->mq = GNUNET_CLIENT_connect (cfg, 574 call->mq = GNUNET_CLIENT_connect (cfg,
574 "conversation", 575 "conversation",
@@ -583,7 +584,6 @@ GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
583 } 584 }
584 call->cfg = cfg; 585 call->cfg = cfg;
585 call->caller_id = caller_id; 586 call->caller_id = caller_id;
586 call->zone_id = zone_id;
587 call->callee = GNUNET_strdup (callee); 587 call->callee = GNUNET_strdup (callee);
588 call->speaker = speaker; 588 call->speaker = speaker;
589 call->mic = mic; 589 call->mic = mic;
@@ -596,15 +596,17 @@ GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
596 return NULL; 596 return NULL;
597 } 597 }
598 call->state = CS_LOOKUP; 598 call->state = CS_LOOKUP;
599 GNUNET_IDENTITY_ego_get_public_key (call->zone_id, 599 call->gns_lookup = GNUNET_GNS_lookup_with_tld (call->gns,
600 &my_zone); 600 call->callee,
601 call->gns_lookup = GNUNET_GNS_lookup (call->gns, 601 GNUNET_GNSRECORD_TYPE_PHONE,
602 call->callee, 602 GNUNET_NO,
603 &my_zone, 603 &handle_gns_response,
604 GNUNET_GNSRECORD_TYPE_PHONE, 604 call);
605 GNUNET_NO, 605 if (NULL == call->gns_lookup)
606 &handle_gns_response, call); 606 {
607 GNUNET_assert (NULL != call->gns_lookup); 607 GNUNET_CONVERSATION_call_stop (call);
608 return NULL;
609 }
608 return call; 610 return call;
609} 611}
610 612
@@ -634,7 +636,7 @@ GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call)
634 } 636 }
635 if (NULL != call->gns_lookup) 637 if (NULL != call->gns_lookup)
636 { 638 {
637 GNUNET_GNS_lookup_cancel (call->gns_lookup); 639 GNUNET_GNS_lookup_with_tld_cancel (call->gns_lookup);
638 call->gns_lookup = NULL; 640 call->gns_lookup = NULL;
639 } 641 }
640 if (NULL != call->gns) 642 if (NULL != call->gns)