Changeset 245:d053353411bb

Show
Ignore:
Timestamp:
10/12/07 19:37:55 (1 year ago)
Author:
vadim@mbdsys.com
Message:

cosmetics

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • phapi/phapi.c

    r244 r245  
    32393239      if (!strncasecmp(phcfg.nattype, "auto", 4)) 
    32403240        { 
    3241                NatType ntype; 
    3242          int resPort = 0, hairpin = 0; 
    3243          int needMappedAddress = 0; 
    3244          StunAddress4 stunServerAddr; 
    3245  
    3246          ntstr = "sym"; 
    3247  
    3248          stunParseServerName(phcfg.stunserver, &stunServerAddr); 
    3249          ph_nat_type = ntype = stunNatType( &stunServerAddr,  phDebugLevel > 1, &resPort, &hairpin,  
     3241          NatType ntype; 
     3242          int resPort = 0, hairpin = 0; 
     3243          int needMappedAddress = 0; 
     3244          StunAddress4 stunServerAddr; 
     3245 
     3246          ntstr = "sym"; 
     3247           
     3248          stunParseServerName(phcfg.stunserver, &stunServerAddr); 
     3249          ph_nat_type = ntype = stunNatType( &stunServerAddr,  phDebugLevel > 1, &resPort, &hairpin,  
    32503250                                      0, 0); 
    32513251 
    32523252 
    3253         switch (ntype) 
    3254           { 
     3253          switch (ntype) 
     3254            { 
     3255               
     3256               
     3257            case StunTypeOpen: 
     3258              ntstr = 0; 
     3259              break; 
    32553260             
    3256              
    3257           case StunTypeOpen: 
    3258             ntstr = 0; 
    3259             break; 
    3260              
    3261           case StunTypeConeNat: 
    3262             ntstr = "fcone"; 
    3263             needMappedAddress = 1; 
    3264             break; 
    3265              
    3266           case StunTypeRestrictedNat: 
    3267             ntstr = "rcone"; 
    3268             needMappedAddress = 1; 
    3269             break; 
    3270              
    3271           case StunTypePortRestrictedNat: 
    3272             ntstr = "prcone"; 
    3273             needMappedAddress = 1; 
    3274             break; 
    3275              
    3276           case StunTypeSymFirewall: 
    3277           case StunTypeSymNat: 
    3278             needMappedAddress = 1; 
    3279             break; 
    3280              
    3281              
    3282           case StunTypeFailure: 
    3283           case StunTypeUnknown: 
    3284           case StunTypeBlocked: 
    3285           default: 
    3286             break; 
     3261            case StunTypeConeNat: 
     3262              ntstr = "fcone"; 
     3263              needMappedAddress = 1; 
     3264              break; 
     3265               
     3266            case StunTypeRestrictedNat: 
     3267              ntstr = "rcone"; 
     3268              needMappedAddress = 1; 
     3269              break; 
     3270               
     3271            case StunTypePortRestrictedNat: 
     3272              ntstr = "prcone"; 
     3273              needMappedAddress = 1; 
     3274              break; 
     3275               
     3276            case StunTypeSymFirewall: 
     3277            case StunTypeSymNat: 
     3278              needMappedAddress = 1; 
     3279              break; 
     3280               
     3281               
     3282            case StunTypeFailure: 
     3283            case StunTypeUnknown: 
     3284            case StunTypeBlocked: 
     3285            default: 
     3286              break; 
    32873287             
    32883288          } 
    32893289         
    3290         if (needMappedAddress) 
    3291          
    3292             StunAddress4 mappedAddr; 
    3293             Socket  sock; 
    3294              
    3295             sock = stunOpenSocket(&stunServerAddr, &mappedAddr, atoi(_get_local_sip_port()), NULL, 0);  
    3296              
    3297             if (-1 !=  (int) sock) 
    3298              
    3299                 ipv4tostr(ph_nat_router_addr, mappedAddr); 
    3300                 snprintf(ph_nat_sip_port_str, sizeof(ph_nat_sip_port_str), "%d", mappedAddr.port); 
    3301                 stunCloseSocket(sock); 
    3302              
    3303              
    3304              
    3305          
    3306          
    3307          
     3290          if (needMappedAddress) 
     3291           
     3292              StunAddress4 mappedAddr; 
     3293              Socket  sock; 
     3294               
     3295              sock = stunOpenSocket(&stunServerAddr, &mappedAddr, atoi(_get_local_sip_port()), NULL, 0);  
     3296               
     3297              if (-1 !=  (int) sock) 
     3298               
     3299                  ipv4tostr(ph_nat_router_addr, mappedAddr); 
     3300                  snprintf(ph_nat_sip_port_str, sizeof(ph_nat_sip_port_str), "%d", mappedAddr.port); 
     3301                  stunCloseSocket(sock); 
     3302               
     3303               
     3304               
     3305           
     3306           
     3307           
    33083308        } 
    33093309      else if (!strncasecmp(phcfg.nattype, "fcone", 5) || 
     
    33153315    } 
    33163316  else if (phcfg.use_tunnel) 
    3317  
    3318        ntstr = "open"; 
    3319  
    3320  
     3317   
     3318      ntstr = "open"; 
     3319   
     3320   
    33213321  if (ntstr) 
    33223322    { 
     
    33243324      if (!phcfg.nat_refresh_time) 
    33253325        phcfg.nat_refresh_time = 15; 
    3326  
     3326       
    33273327      strncpy(ph_nat_type_str, ntstr, sizeof(ph_nat_type_str)); 
    33283328      if (ph_nat_router_addr[0] && strcmp(ntstr, "sym")) 
     
    33323332          eXosip_set_firewallport(ph_nat_sip_port_str); 
    33333333        } 
    3334  
     3334       
    33353335    } 
    33363336  else