Ignore:
Timestamp:
Jun 28, 2006 4:46:49 PM (17 years ago)
Author:
bennylp
Message:

Major improvements in PJSIP to support TCP. The changes fall into these categories: (1) the TCP transport implementation itself (*.[hc]), (2) bug-fix in SIP transaction when using reliable transports, (3) support for TCP transport in PJSUA-LIB/PJSUA, and (4) changes in PJSIP-TEST to support TCP testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r544 r563  
    3030    pjsua_logging_config    log_cfg; 
    3131    pjsua_media_config      media_cfg; 
     32    pj_bool_t               no_tcp; 
     33    pj_bool_t               no_udp; 
    3234    pjsua_transport_config  udp_cfg; 
    3335    pjsua_transport_config  rtp_cfg; 
     
    9698    puts  (""); 
    9799    puts  ("Transport Options:"); 
    98     puts  ("  --local-port=port   Set TCP/UDP port"); 
     100    puts  ("  --local-port=port   Set TCP/UDP port. This implicitly enables both "); 
     101    puts  ("                      TCP and UDP transports on the specified port, unless"); 
     102    puts  ("                      if TCP or UDP is disabled."); 
     103    puts  ("  --no-tcp            Disable TCP transport."); 
     104    puts  ("  --no-udp            Disable UDP transport."); 
    99105    puts  ("  --outbound=url      Set the URL of global outbound proxy server"); 
    100106    puts  ("                      May be specified multiple times"); 
     
    240246           OPT_COMPLEXITY, OPT_QUALITY, OPT_PTIME, 
    241247           OPT_NEXT_ACCOUNT, OPT_NEXT_CRED, OPT_MAX_CALLS,  
    242            OPT_DURATION, 
     248           OPT_DURATION, OPT_NO_TCP, OPT_NO_UDP, 
    243249    }; 
    244250    struct pj_getopt_option long_options[] = { 
     
    252258        { "null-audio", 0, 0, OPT_NULL_AUDIO}, 
    253259        { "local-port", 1, 0, OPT_LOCAL_PORT}, 
     260        { "no-tcp",     0, 0, OPT_NO_TCP}, 
     261        { "no-udp",     0, 0, OPT_NO_UDP}, 
    254262        { "proxy",      1, 0, OPT_PROXY}, 
    255263        { "outbound",   1, 0, OPT_OUTBOUND_PROXY}, 
     
    385393            break; 
    386394 
     395        case OPT_NO_UDP: /* no-udp */ 
     396            if (cfg->no_tcp) { 
     397              PJ_LOG(1,(THIS_FILE,"Error: can not disable both TCP and UDP")); 
     398              return PJ_EINVAL; 
     399            } 
     400 
     401            cfg->no_udp = PJ_TRUE; 
     402            break; 
     403 
     404        case OPT_NO_TCP: /* no-tcp */ 
     405            if (cfg->no_udp) { 
     406              PJ_LOG(1,(THIS_FILE,"Error: can not disable both TCP and UDP")); 
     407              return PJ_EINVAL; 
     408            } 
     409 
     410            cfg->no_tcp = PJ_TRUE; 
     411            break; 
     412 
    387413        case OPT_PROXY:   /* proxy */ 
    388414            if (pjsua_verify_sip_url(pj_optarg) != 0) { 
     
    20472073pj_status_t app_init(int argc, char *argv[]) 
    20482074{ 
    2049     pjsua_transport_id transport_id; 
     2075    pjsua_transport_id transport_id = -1; 
    20502076    unsigned i; 
    20512077    pj_status_t status; 
     
    20972123    } 
    20982124 
    2099     /* Add UDP transport */ 
    2100     status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, 
    2101                                     &app_config.udp_cfg,  
    2102                                     &transport_id); 
    2103     if (status != PJ_SUCCESS) 
     2125 
     2126    /* Add TCP transport unless it's disabled */ 
     2127    if (!app_config.no_tcp) { 
     2128        status = pjsua_transport_create(PJSIP_TRANSPORT_TCP, 
     2129                                        &app_config.udp_cfg,  
     2130                                        &transport_id); 
     2131        if (status != PJ_SUCCESS) 
     2132            goto on_error; 
     2133 
     2134        /* Add local account */ 
     2135        pjsua_acc_add_local(transport_id, PJ_TRUE, &current_acc); 
     2136        pjsua_acc_set_online_status(current_acc, PJ_TRUE); 
     2137 
     2138    } 
     2139 
     2140 
     2141    /* Add UDP transport unless it's disabled. */ 
     2142    if (!app_config.no_udp) { 
     2143        status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, 
     2144                                        &app_config.udp_cfg,  
     2145                                        &transport_id); 
     2146        if (status != PJ_SUCCESS) 
     2147            goto on_error; 
     2148 
     2149        /* Add local account */ 
     2150        pjsua_acc_add_local(transport_id, PJ_TRUE, &current_acc); 
     2151        pjsua_acc_set_online_status(current_acc, PJ_TRUE); 
     2152    } 
     2153 
     2154    if (transport_id == -1) { 
     2155        PJ_LOG(3,(THIS_FILE, "Error: no transport is configured")); 
     2156        status = -1; 
    21042157        goto on_error; 
    2105  
    2106     /* Add local account */ 
    2107     pjsua_acc_add_local(transport_id, PJ_TRUE, &current_acc); 
    2108     pjsua_acc_set_online_status(current_acc, PJ_TRUE); 
     2158    } 
    21092159 
    21102160 
Note: See TracChangeset for help on using the changeset viewer.