Ignore:
Timestamp:
Mar 23, 2007 4:34:20 PM (13 years ago)
Author:
bennylp
Message:

ICE (work in progress): integration with PJSUA

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r974 r1098  
    903903    pj_str_t        outbound_proxy[4]; 
    904904 
     905    /** 
     906     * Specify STUN server. This server will be first resolved with DNS SRV 
     907     * to get the actual server address. If DNS SRV resolution failed, or 
     908     * when nameserver is not configured, the server will be resolved using 
     909     * DNS A resolution (i.e. gethostbyname()). 
     910     */ 
     911    pj_str_t        stun_srv; 
     912 
    905913    /**  
    906914     * Number of credentials in the credential array. 
     
    10021010 
    10031011    pj_strdup_with_null(pool, &dst->user_agent, &src->user_agent); 
     1012    pj_strdup_with_null(pool, &dst->stun_srv, &src->stun_srv); 
    10041013} 
    10051014 
     
    13351344 
    13361345/** 
    1337  * This structure describes STUN configuration for SIP and media transport, 
    1338  * and is embedded inside pjsua_transport_config structure. 
    1339  */ 
    1340 typedef struct pjsua_stun_config 
    1341 { 
    1342     /** 
    1343      * The first STUN server IP address or hostname. 
    1344      */ 
    1345     pj_str_t    stun_srv1; 
    1346  
    1347     /** 
    1348      * Port number of the first STUN server. 
    1349      * If zero, default STUN port will be used. 
    1350      */ 
    1351     unsigned    stun_port1; 
    1352      
    1353     /** 
    1354      * Optional second STUN server IP address or hostname, for which the 
    1355      * result of the mapping request will be compared to. If the value 
    1356      * is empty, only one STUN server will be used. 
    1357      */ 
    1358     pj_str_t    stun_srv2; 
    1359  
    1360     /** 
    1361      * Port number of the second STUN server. 
    1362      * If zero, default STUN port will be used. 
    1363      */ 
    1364     unsigned    stun_port2; 
    1365  
    1366 } pjsua_stun_config; 
    1367  
    1368  
    1369  
    1370 /** 
    1371  * Call this function to initialize STUN config with default values. 
    1372  * STUN config is normally embedded inside pjsua_transport_config, so 
    1373  * normally there is no need to call this function and rather just 
    1374  * call pjsua_transport_config_default() instead. 
    1375  * 
    1376  * @param cfg       The STUN config to be initialized. 
    1377  * 
    1378  * \par Python: 
    1379  * The corresponding Python function creates and initialize the config: 
    1380  * \code 
    1381     stun_cfg = py_pjsua.stun_config_default() 
    1382  * \endcode 
    1383  */ 
    1384 PJ_INLINE(void) pjsua_stun_config_default(pjsua_stun_config *cfg) 
    1385 { 
    1386     pj_bzero(cfg, sizeof(*cfg)); 
    1387 } 
    1388  
    1389  
    1390 /** 
    13911346 * Transport configuration for creating transports for both SIP 
    13921347 * and media. Before setting some values to this structure, application 
     
    14361391 
    14371392    /** 
    1438      * Flag to indicate whether STUN should be used. 
    1439      */ 
    1440     pj_bool_t           use_stun; 
    1441  
    1442     /** 
    1443      * STUN configuration, must be specified when STUN is used. 
    1444      */ 
    1445     pjsua_stun_config   stun_config; 
    1446  
    1447     /** 
    14481393     * This specifies TLS settings for TLS transport. It is only be used 
    14491394     * when this transport config is being used to create a SIP TLS 
     
    14691414{ 
    14701415    pj_bzero(cfg, sizeof(*cfg)); 
    1471     pjsua_stun_config_default(&cfg->stun_config); 
    14721416    pjsip_tls_setting_default(&cfg->tls_setting); 
    1473 } 
    1474  
    1475  
    1476 /** 
    1477  * This is a utility function to normalize STUN config. It's only 
    1478  * used internally by the library. 
    1479  * 
    1480  * @param cfg       The STUN config to be initialized. 
    1481  * 
    1482  * \par Python: 
    1483  * \code 
    1484     py_pjsua.normalize_stun_config(cfg) 
    1485  * \code 
    1486  */ 
    1487 PJ_INLINE(void) pjsua_normalize_stun_config( pjsua_stun_config *cfg ) 
    1488 { 
    1489     if (cfg->stun_srv1.slen) { 
    1490  
    1491         if (cfg->stun_port1 == 0) 
    1492             cfg->stun_port1 = 3478; 
    1493  
    1494         if (cfg->stun_srv2.slen == 0) { 
    1495             cfg->stun_srv2 = cfg->stun_srv1; 
    1496             cfg->stun_port2 = cfg->stun_port1; 
    1497         } else { 
    1498             if (cfg->stun_port2 == 0) 
    1499                 cfg->stun_port2 = 3478; 
    1500         } 
    1501  
    1502     } else { 
    1503         cfg->stun_port1 = 0; 
    1504         cfg->stun_srv2.slen = 0; 
    1505         cfg->stun_port2 = 0; 
    1506     } 
    15071417} 
    15081418 
     
    15231433                                           const pjsua_transport_config *src) 
    15241434{ 
     1435    PJ_UNUSED_ARG(pool); 
    15251436    pj_memcpy(dst, src, sizeof(*src)); 
    1526  
    1527     if (src->stun_config.stun_srv1.slen) { 
    1528         pj_strdup_with_null(pool, &dst->stun_config.stun_srv1, 
    1529                             &src->stun_config.stun_srv1); 
    1530     } 
    1531  
    1532     if (src->stun_config.stun_srv2.slen) { 
    1533         pj_strdup_with_null(pool, &dst->stun_config.stun_srv2, 
    1534                             &src->stun_config.stun_srv2); 
    1535     } 
    1536  
    1537     pjsua_normalize_stun_config(&dst->stun_config); 
    15381437} 
    15391438 
     
    35313430    int                 jb_max; 
    35323431 
     3432    /** 
     3433     * Enable ICE 
     3434     */ 
     3435    pj_bool_t           enable_ice; 
     3436 
     3437    /** 
     3438     * Enable ICE media relay. 
     3439     */ 
     3440    pj_bool_t           enable_relay; 
    35333441}; 
    35343442 
Note: See TracChangeset for help on using the changeset viewer.