Ignore:
Timestamp:
Jun 8, 2016 3:17:45 AM (8 years ago)
Author:
nanang
Message:

Re #422: Added IPv6 support to PJNATH, changes:

  • Deprecated 'pj_ice_strans_cfg.af', if set, the value will be ignored, address family setting is now specified via transport setting, i.e: 'pj_ice_strans_cfg.stun_tp/turn_tp'.
  • Deprecated 'pj_ice_strans_cfg.stun/turn', for backward compatibility, this field value will be checked if 'pj_ice_strans_cfg.stun_tp_cnt/turn_tp_cnt' is set to zero.
  • Added 'pj_ice_strans_stun_cfg' & 'pj_ice_strans_stun_cfg' and the corresponding 'pj_ice_strans_stun/turn_cfg_default()'
  • Added 'pj_ice_strans_cfg.stun_tp/turn_tp' as replacement of 'pj_ice_strans_cfg.stun/turn', it is now an array so app can have multiple STUN/TURN transports.
  • Added macro PJ_ICE_MAX_STUN/TURN to specify maximum number of STUN/TURN transports in each ICE component in compile-time.
  • Miscellaneous: fixed socket number limit in concurrency test in pjnath-test, updated pjsua_media.c to use new 'pj_ice_strans_cfg' setting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/include/pjnath/ice_strans.h

    r5282 r5339  
    176176 
    177177/** 
     178 * STUN and local transport settings for ICE stream transport. 
     179 */ 
     180typedef struct pj_ice_strans_stun_cfg 
     181{ 
     182    /** 
     183     * Address family, IPv4 or IPv6. 
     184     * 
     185     * Default value is pj_AF_INET() (IPv4) 
     186     */ 
     187    int                  af; 
     188 
     189    /** 
     190     * Optional configuration for STUN transport. The default 
     191     * value will be initialized with #pj_stun_sock_cfg_default(). 
     192     */ 
     193    pj_stun_sock_cfg     cfg; 
     194 
     195    /** 
     196     * Maximum number of host candidates to be added. If the 
     197     * value is zero, no host candidates will be added. 
     198     * 
     199     * Default: 64 
     200     */ 
     201    unsigned             max_host_cands; 
     202 
     203    /** 
     204     * Include loopback addresses in the host candidates. 
     205     * 
     206     * Default: PJ_FALSE 
     207     */ 
     208    pj_bool_t            loop_addr; 
     209 
     210    /** 
     211     * Specify the STUN server domain or hostname or IP address. 
     212     * If DNS SRV resolution is required, application must fill 
     213     * in this setting with the domain name of the STUN server  
     214     * and set the resolver instance in the \a resolver field. 
     215     * Otherwise if the \a resolver setting is not set, this 
     216     * field will be resolved with hostname resolution and in 
     217     * this case the \a port field must be set. 
     218     * 
     219     * The \a port field should also be set even when DNS SRV 
     220     * resolution is used, in case the DNS SRV resolution fails. 
     221     * 
     222     * When this field is empty, STUN mapped address resolution 
     223     * will not be performed. In this case only ICE host candidates 
     224     * will be added to the ICE transport, unless if \a no_host_cands 
     225     * field is set. In this case, both host and srflx candidates  
     226     * are disabled. 
     227     * 
     228     * If there are more than one STUN candidates per ICE stream 
     229     * transport component, the standard recommends to use the same 
     230     * STUN server for all STUN candidates. 
     231     * 
     232     * The default value is empty. 
     233     */ 
     234    pj_str_t             server; 
     235 
     236    /** 
     237     * The port number of the STUN server, when \a server 
     238     * field specifies a hostname rather than domain name. This 
     239     * field should also be set even when the \a server 
     240     * specifies a domain name, to allow DNS SRV resolution 
     241     * to fallback to DNS A/AAAA resolution when the DNS SRV 
     242     * resolution fails. 
     243     * 
     244     * The default value is PJ_STUN_PORT. 
     245     */ 
     246    pj_uint16_t          port; 
     247 
     248    /** 
     249     * Ignore STUN resolution error and proceed with just local 
     250     * addresses. 
     251     * 
     252     * The default is PJ_FALSE 
     253     */ 
     254    pj_bool_t            ignore_stun_error; 
     255 
     256} pj_ice_strans_stun_cfg; 
     257 
     258 
     259/** 
     260 * TURN transport settings for ICE stream transport. 
     261 */ 
     262typedef struct pj_ice_strans_turn_cfg 
     263{ 
     264    /** 
     265     * Address family, IPv4 or IPv6. 
     266     * 
     267     * Default value is pj_AF_INET() (IPv4) 
     268     */ 
     269    int                  af; 
     270 
     271    /** 
     272     * Optional TURN socket settings. The default values will be 
     273     * initialized by #pj_turn_sock_cfg_default(). This contains 
     274     * settings such as QoS. 
     275     */ 
     276    pj_turn_sock_cfg     cfg; 
     277 
     278    /** 
     279     * Specify the TURN server domain or hostname or IP address. 
     280     * If DNS SRV resolution is required, application must fill 
     281     * in this setting with the domain name of the TURN server  
     282     * and set the resolver instance in the \a resolver field. 
     283     * Otherwise if the \a resolver setting is not set, this 
     284     * field will be resolved with hostname resolution and in 
     285     * this case the \a port field must be set. 
     286     * 
     287     * The \a port field should also be set even when DNS SRV 
     288     * resolution is used, in case the DNS SRV resolution fails. 
     289     * 
     290     * When this field is empty, relay candidate will not be 
     291     * created. 
     292     * 
     293     * The default value is empty. 
     294     */ 
     295    pj_str_t             server; 
     296 
     297    /** 
     298     * The port number of the TURN server, when \a server 
     299     * field specifies a hostname rather than domain name. This 
     300     * field should also be set even when the \a server 
     301     * specifies a domain name, to allow DNS SRV resolution 
     302     * to fallback to DNS A/AAAA resolution when the DNS SRV 
     303     * resolution fails. 
     304     * 
     305     * Default is zero. 
     306     */ 
     307    pj_uint16_t          port; 
     308 
     309    /** 
     310     * Type of connection to the TURN server. 
     311     * 
     312     * Default is PJ_TURN_TP_UDP. 
     313     */ 
     314    pj_turn_tp_type      conn_type; 
     315 
     316    /** 
     317     * Credential to be used for the TURN session. This setting 
     318     * is mandatory. 
     319     * 
     320     * Default is to have no credential. 
     321     */ 
     322    pj_stun_auth_cred    auth_cred; 
     323 
     324    /** 
     325     * Optional TURN Allocate parameter. The default value will be 
     326     * initialized by #pj_turn_alloc_param_default(). 
     327     */ 
     328    pj_turn_alloc_param  alloc_param; 
     329 
     330} pj_ice_strans_turn_cfg; 
     331 
     332 
     333/** 
    178334 * This structure describes ICE stream transport configuration. Application 
    179335 * should initialize the structure by calling #pj_ice_strans_cfg_default() 
     
    183339{ 
    184340    /** 
    185      * Address family, IPv4 or IPv6. Currently only pj_AF_INET() (IPv4) 
    186      * is supported, and this is the default value. 
    187      */ 
    188     int                 af; 
     341     * Warning: this field is deprecated and will be ignored. Please specify 
     342     * transport address family in STUN and TURN transport setting, i.e: 
     343     * \a stun_tp and \a turn_tp. 
     344     */ 
     345    int                  af; 
    189346 
    190347    /** 
     
    214371 
    215372    /** 
    216      * STUN and local transport settings. This specifies the  
    217      * settings for local UDP socket, which will be resolved 
    218      * to get the STUN mapped address. 
    219      */ 
    220     struct { 
    221         /** 
    222          * Optional configuration for STUN transport. The default 
    223          * value will be initialized with #pj_stun_sock_cfg_default(). 
    224          */ 
    225         pj_stun_sock_cfg     cfg; 
    226  
    227         /** 
    228          * Maximum number of host candidates to be added. If the 
    229          * value is zero, no host candidates will be added. 
    230          * 
    231          * Default: 64 
    232          */ 
    233         unsigned             max_host_cands; 
    234  
    235         /** 
    236          * Include loopback addresses in the host candidates. 
    237          * 
    238          * Default: PJ_FALSE 
    239          */ 
    240         pj_bool_t            loop_addr; 
    241  
    242         /** 
    243          * Specify the STUN server domain or hostname or IP address. 
    244          * If DNS SRV resolution is required, application must fill 
    245          * in this setting with the domain name of the STUN server  
    246          * and set the resolver instance in the \a resolver field. 
    247          * Otherwise if the \a resolver setting is not set, this 
    248          * field will be resolved with hostname resolution and in 
    249          * this case the \a port field must be set. 
    250          * 
    251          * The \a port field should also be set even when DNS SRV 
    252          * resolution is used, in case the DNS SRV resolution fails. 
    253          * 
    254          * When this field is empty, STUN mapped address resolution 
    255          * will not be performed. In this case only ICE host candidates 
    256          * will be added to the ICE transport, unless if \a no_host_cands 
    257          * field is set. In this case, both host and srflx candidates  
    258          * are disabled. 
    259          * 
    260          * The default value is empty. 
    261          */ 
    262         pj_str_t             server; 
    263  
    264         /** 
    265          * The port number of the STUN server, when \a server 
    266          * field specifies a hostname rather than domain name. This 
    267          * field should also be set even when the \a server 
    268          * specifies a domain name, to allow DNS SRV resolution 
    269          * to fallback to DNS A/AAAA resolution when the DNS SRV 
    270          * resolution fails. 
    271          * 
    272          * The default value is PJ_STUN_PORT. 
    273          */ 
    274         pj_uint16_t          port; 
    275  
    276         /** 
    277          * Ignore STUN resolution error and proceed with just local 
    278          * addresses. 
    279          * 
    280          * The default is PJ_FALSE 
    281          */ 
    282         pj_bool_t            ignore_stun_error; 
    283  
    284     } stun; 
    285  
    286     /** 
    287      * TURN specific settings. 
    288      */ 
    289     struct { 
    290         /** 
    291          * Optional TURN socket settings. The default values will be 
    292          * initialized by #pj_turn_sock_cfg_default(). This contains 
    293          * settings such as QoS. 
    294          */ 
    295         pj_turn_sock_cfg     cfg; 
    296  
    297         /** 
    298          * Specify the TURN server domain or hostname or IP address. 
    299          * If DNS SRV resolution is required, application must fill 
    300          * in this setting with the domain name of the TURN server  
    301          * and set the resolver instance in the \a resolver field. 
    302          * Otherwise if the \a resolver setting is not set, this 
    303          * field will be resolved with hostname resolution and in 
    304          * this case the \a port field must be set. 
    305          * 
    306          * The \a port field should also be set even when DNS SRV 
    307          * resolution is used, in case the DNS SRV resolution fails. 
    308          * 
    309          * When this field is empty, relay candidate will not be 
    310          * created. 
    311          * 
    312          * The default value is empty. 
    313          */ 
    314         pj_str_t             server; 
    315  
    316         /** 
    317          * The port number of the TURN server, when \a server 
    318          * field specifies a hostname rather than domain name. This 
    319          * field should also be set even when the \a server 
    320          * specifies a domain name, to allow DNS SRV resolution 
    321          * to fallback to DNS A/AAAA resolution when the DNS SRV 
    322          * resolution fails. 
    323          * 
    324          * Default is zero. 
    325          */ 
    326         pj_uint16_t          port; 
    327  
    328         /** 
    329          * Type of connection to the TURN server. 
    330          * 
    331          * Default is PJ_TURN_TP_UDP. 
    332          */ 
    333         pj_turn_tp_type      conn_type; 
    334  
    335         /** 
    336          * Credential to be used for the TURN session. This setting 
    337          * is mandatory. 
    338          * 
    339          * Default is to have no credential. 
    340          */ 
    341         pj_stun_auth_cred    auth_cred; 
    342  
    343         /** 
    344          * Optional TURN Allocate parameter. The default value will be 
    345          * initialized by #pj_turn_alloc_param_default(). 
    346          */ 
    347         pj_turn_alloc_param  alloc_param; 
    348  
    349     } turn; 
     373     * Warning: this field is deprecated, please use \a stun_tp field instead. 
     374     * To maintain backward compatibility, if \a stun_tp_cnt is zero, the 
     375     * value of this field will be copied to \a stun_tp. 
     376     * 
     377     * STUN and local transport settings. This specifies the settings 
     378     * for local UDP socket address and STUN resolved address. 
     379     */ 
     380    pj_ice_strans_stun_cfg stun; 
     381 
     382    /** 
     383     * Number of STUN transports. 
     384     * 
     385     * Default: 0 
     386     */ 
     387    unsigned             stun_tp_cnt; 
     388 
     389    /** 
     390     * STUN and local transport settings. This specifies the settings 
     391     * for local UDP socket address and STUN resolved address. 
     392     */ 
     393    pj_ice_strans_stun_cfg stun_tp[PJ_ICE_MAX_STUN]; 
     394 
     395    /** 
     396     * Warning: this field is deprecated, please use \a turn_tp field instead. 
     397     * To maintain backward compatibility, if \a turn_tp_cnt is zero, the 
     398     * value of this field will be copied to \a turn_tp. 
     399     * 
     400     * TURN transport settings. 
     401     */ 
     402    pj_ice_strans_turn_cfg turn; 
     403 
     404    /** 
     405     * Number of TURN transports. 
     406     * 
     407     * Default: 0 
     408     */ 
     409    unsigned             turn_tp_cnt; 
     410 
     411    /** 
     412     * TURN transport settings. 
     413     */ 
     414    pj_ice_strans_turn_cfg turn_tp[PJ_ICE_MAX_TURN]; 
    350415 
    351416    /** 
     
    467532 
    468533 
     534/**  
     535 * Initialize ICE STUN transport configuration with default values. 
     536 * 
     537 * @param cfg           The configuration to be initialized. 
     538 */ 
     539PJ_DECL(void) pj_ice_strans_stun_cfg_default(pj_ice_strans_stun_cfg *cfg); 
     540 
     541 
     542/**  
     543 * Initialize ICE TURN transport configuration with default values. 
     544 * 
     545 * @param cfg           The configuration to be initialized. 
     546 */ 
     547PJ_DECL(void) pj_ice_strans_turn_cfg_default(pj_ice_strans_turn_cfg *cfg); 
     548 
     549 
    469550/** 
    470551 * Copy configuration. 
Note: See TracChangeset for help on using the changeset viewer.