~ubuntu-branches/ubuntu/raring/libnice/raring

« back to all changes in this revision

Viewing changes to agent/discovery.c

  • Committer: robert.ancell at canonical
  • Date: 2011-02-07 04:17:01 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: robert.ancell@canonical.com-20110207041701-psaqkjc1v3it3ttk
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
  uint8_t *password;
142
142
  size_t password_len;
143
143
  size_t buffer_len = 0;
 
144
  StunUsageTurnCompatibility turn_compat = agent_to_turn_compatibility (agent);
144
145
 
145
146
  g_assert (user_data == NULL);
146
147
 
160
161
  password = (uint8_t *)cand->turn->password;
161
162
  password_len = (size_t) strlen (cand->turn->password);
162
163
 
163
 
  if (agent_to_turn_compatibility (agent) == STUN_USAGE_TURN_COMPATIBILITY_MSN) {
 
164
  if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
 
165
      turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
164
166
    username = g_base64_decode ((gchar *)username, &username_len);
165
167
    password = g_base64_decode ((gchar *)password, &password_len);
166
168
  }
188
190
 
189
191
  }
190
192
 
191
 
  if (agent_to_turn_compatibility (agent) == STUN_USAGE_TURN_COMPATIBILITY_MSN) {
 
193
  if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
 
194
      turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
192
195
    g_free (username);
193
196
    g_free (password);
194
197
  }
403
406
    NiceCandidate *candidate)
404
407
{
405
408
 
406
 
  if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
 
409
  if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
 
410
      agent->compatibility == NICE_COMPATIBILITY_OC2007) {
407
411
    guchar username[32];
408
412
    guchar password[16];
409
413
 
458
462
  candidate->base_addr = *address;
459
463
  if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
460
464
    candidate->priority = nice_candidate_jingle_priority (candidate);
461
 
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN)  {
 
465
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
 
466
             agent->compatibility == NICE_COMPATIBILITY_OC2007)  {
462
467
    candidate->priority = nice_candidate_msn_priority (candidate);
463
468
  } else {
464
469
    candidate->priority = nice_candidate_ice_priority (candidate);
486
491
    goto errors;
487
492
 
488
493
  component->sockets = g_slist_append (component->sockets, udp_socket);
489
 
  agent_signal_new_candidate (agent, candidate);
490
494
 
491
495
  return candidate;
492
496
 
523
527
 
524
528
  if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
525
529
    candidate->priority = nice_candidate_jingle_priority (candidate);
526
 
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN)  {
 
530
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
 
531
             agent->compatibility == NICE_COMPATIBILITY_OC2007)  {
527
532
    candidate->priority = nice_candidate_msn_priority (candidate);
528
533
  } else {
529
534
    candidate->priority =  nice_candidate_ice_priority_full
580
585
 
581
586
  if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
582
587
    candidate->priority = nice_candidate_jingle_priority (candidate);
583
 
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN)  {
 
588
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
 
589
             agent->compatibility == NICE_COMPATIBILITY_OC2007)  {
584
590
    candidate->priority = nice_candidate_msn_priority (candidate);
585
591
  } else {
586
592
    candidate->priority =  nice_candidate_ice_priority_full
656
662
  candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP;
657
663
  if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
658
664
    candidate->priority = nice_candidate_jingle_priority (candidate);
659
 
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN)  {
 
665
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
 
666
             agent->compatibility == NICE_COMPATIBILITY_OC2007)  {
660
667
    candidate->priority = nice_candidate_msn_priority (candidate);
661
668
  } else {
662
669
    candidate->priority = nice_candidate_ice_priority_full
670
677
 
671
678
  priv_assign_foundation (agent, candidate);
672
679
 
673
 
  if (agent->compatibility == NICE_COMPATIBILITY_MSN &&
 
680
  if ((agent->compatibility == NICE_COMPATIBILITY_MSN ||
 
681
       agent->compatibility == NICE_COMPATIBILITY_OC2007) &&
674
682
      remote && local) {
675
683
    guchar *new_username = NULL;
676
684
    guchar *decoded_local = NULL;
751
759
    candidate->priority = priority;
752
760
  } else if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
753
761
    candidate->priority = nice_candidate_jingle_priority (candidate);
754
 
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN)  {
 
762
  } else if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
 
763
             agent->compatibility == NICE_COMPATIBILITY_OC2007)  {
755
764
    candidate->priority = nice_candidate_msn_priority (candidate);
756
765
  } else {
757
766
    candidate->priority = nice_candidate_ice_priority_full
763
772
 
764
773
  priv_assign_remote_foundation (agent, candidate);
765
774
 
766
 
  if (agent->compatibility == NICE_COMPATIBILITY_MSN &&
 
775
  if ((agent->compatibility == NICE_COMPATIBILITY_MSN ||
 
776
       agent->compatibility == NICE_COMPATIBILITY_OC2007) &&
767
777
      remote && local) {
768
778
    guchar *new_username = NULL;
769
779
    guchar *decoded_local = NULL;
860
870
          size_t username_len = (size_t) strlen (cand->turn->username);
861
871
          uint8_t *password = (uint8_t *)cand->turn->password;
862
872
          size_t password_len = (size_t) strlen (cand->turn->password);
 
873
          StunUsageTurnCompatibility turn_compat =
 
874
              agent_to_turn_compatibility (agent);
863
875
 
864
 
          if (agent_to_turn_compatibility (agent) ==
865
 
              STUN_USAGE_TURN_COMPATIBILITY_MSN) {
 
876
          if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
 
877
              turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
866
878
            username = g_base64_decode ((gchar *)username, &username_len);
867
879
            password = g_base64_decode ((gchar *)password, &password_len);
868
880
          }
874
886
              -1, -1,
875
887
              username, username_len,
876
888
              password, password_len,
877
 
              agent_to_turn_compatibility (agent));
 
889
              turn_compat);
878
890
 
879
 
          if (agent_to_turn_compatibility (agent) ==
880
 
              STUN_USAGE_TURN_COMPATIBILITY_MSN) {
 
891
          if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
 
892
              turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
881
893
            g_free (cand->msn_turn_username);
882
894
            g_free (cand->msn_turn_password);
883
895
            cand->msn_turn_username = username;
886
898
        }
887
899
 
888
900
        if (buffer_len > 0) {
889
 
          stun_timer_start (&cand->timer);
 
901
          stun_timer_start (&cand->timer, 200,
 
902
              STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS);
890
903
 
891
904
          /* send the conncheck */
892
905
          nice_socket_send (cand->nicesock, &cand->server,