Ignore:
Timestamp:
Dec 28, 2016 3:40:07 AM (3 years ago)
Author:
nanang
Message:

Re #1900: More merged from trunk (r5512 mistakenly contains merged changes in third-party dir only).

Location:
pjproject/branches/projects/uwp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/uwp

  • pjproject/branches/projects/uwp/pjnath/include/pjnath/ice_strans.h

    r4606 r5513  
    126126    PJ_ICE_STRANS_OP_NEGOTIATION, 
    127127 
    128     /** This operatino is used to report failure in keep-alive operation. 
     128    /** This operation is used to report failure in keep-alive operation. 
    129129     *  Currently it is only used to report TURN Refresh failure. 
    130130     */ 
    131     PJ_ICE_STRANS_OP_KEEP_ALIVE 
     131    PJ_ICE_STRANS_OP_KEEP_ALIVE, 
     132 
     133    /** IP address change notification from STUN keep-alive operation. 
     134     */ 
     135    PJ_ICE_STRANS_OP_ADDR_CHANGE 
    132136 
    133137} pj_ice_strans_op; 
     
    172176 
    173177/** 
     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/** 
    174334 * This structure describes ICE stream transport configuration. Application 
    175335 * should initialize the structure by calling #pj_ice_strans_cfg_default() 
     
    179339{ 
    180340    /** 
    181      * Address family, IPv4 or IPv6. Currently only pj_AF_INET() (IPv4) 
    182      * is supported, and this is the default value. 
    183      */ 
    184     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; 
    185346 
    186347    /** 
     
    210371 
    211372    /** 
    212      * STUN and local transport settings. This specifies the  
    213      * settings for local UDP socket, which will be resolved 
    214      * to get the STUN mapped address. 
    215      */ 
    216     struct { 
    217         /** 
    218          * Optional configuration for STUN transport. The default 
    219          * value will be initialized with #pj_stun_sock_cfg_default(). 
    220          */ 
    221         pj_stun_sock_cfg     cfg; 
    222  
    223         /** 
    224          * Maximum number of host candidates to be added. If the 
    225          * value is zero, no host candidates will be added. 
    226          * 
    227          * Default: 64 
    228          */ 
    229         unsigned             max_host_cands; 
    230  
    231         /** 
    232          * Include loopback addresses in the host candidates. 
    233          * 
    234          * Default: PJ_FALSE 
    235          */ 
    236         pj_bool_t            loop_addr; 
    237  
    238         /** 
    239          * Specify the STUN server domain or hostname or IP address. 
    240          * If DNS SRV resolution is required, application must fill 
    241          * in this setting with the domain name of the STUN server  
    242          * and set the resolver instance in the \a resolver field. 
    243          * Otherwise if the \a resolver setting is not set, this 
    244          * field will be resolved with hostname resolution and in 
    245          * this case the \a port field must be set. 
    246          * 
    247          * The \a port field should also be set even when DNS SRV 
    248          * resolution is used, in case the DNS SRV resolution fails. 
    249          * 
    250          * When this field is empty, STUN mapped address resolution 
    251          * will not be performed. In this case only ICE host candidates 
    252          * will be added to the ICE transport, unless if \a no_host_cands 
    253          * field is set. In this case, both host and srflx candidates  
    254          * are disabled. 
    255          * 
    256          * The default value is empty. 
    257          */ 
    258         pj_str_t             server; 
    259  
    260         /** 
    261          * The port number of the STUN server, when \a server 
    262          * field specifies a hostname rather than domain name. This 
    263          * field should also be set even when the \a server 
    264          * specifies a domain name, to allow DNS SRV resolution 
    265          * to fallback to DNS A/AAAA resolution when the DNS SRV 
    266          * resolution fails. 
    267          * 
    268          * The default value is PJ_STUN_PORT. 
    269          */ 
    270         pj_uint16_t          port; 
    271  
    272         /** 
    273          * Ignore STUN resolution error and proceed with just local 
    274          * addresses. 
    275          * 
    276          * The default is PJ_FALSE 
    277          */ 
    278         pj_bool_t            ignore_stun_error; 
    279  
    280     } stun; 
    281  
    282     /** 
    283      * TURN specific settings. 
    284      */ 
    285     struct { 
    286         /** 
    287          * Optional TURN socket settings. The default values will be 
    288          * initialized by #pj_turn_sock_cfg_default(). This contains 
    289          * settings such as QoS. 
    290          */ 
    291         pj_turn_sock_cfg     cfg; 
    292  
    293         /** 
    294          * Specify the TURN server domain or hostname or IP address. 
    295          * If DNS SRV resolution is required, application must fill 
    296          * in this setting with the domain name of the TURN server  
    297          * and set the resolver instance in the \a resolver field. 
    298          * Otherwise if the \a resolver setting is not set, this 
    299          * field will be resolved with hostname resolution and in 
    300          * this case the \a port field must be set. 
    301          * 
    302          * The \a port field should also be set even when DNS SRV 
    303          * resolution is used, in case the DNS SRV resolution fails. 
    304          * 
    305          * When this field is empty, relay candidate will not be 
    306          * created. 
    307          * 
    308          * The default value is empty. 
    309          */ 
    310         pj_str_t             server; 
    311  
    312         /** 
    313          * The port number of the TURN server, when \a server 
    314          * field specifies a hostname rather than domain name. This 
    315          * field should also be set even when the \a server 
    316          * specifies a domain name, to allow DNS SRV resolution 
    317          * to fallback to DNS A/AAAA resolution when the DNS SRV 
    318          * resolution fails. 
    319          * 
    320          * Default is zero. 
    321          */ 
    322         pj_uint16_t          port; 
    323  
    324         /** 
    325          * Type of connection to the TURN server. 
    326          * 
    327          * Default is PJ_TURN_TP_UDP. 
    328          */ 
    329         pj_turn_tp_type      conn_type; 
    330  
    331         /** 
    332          * Credential to be used for the TURN session. This setting 
    333          * is mandatory. 
    334          * 
    335          * Default is to have no credential. 
    336          */ 
    337         pj_stun_auth_cred    auth_cred; 
    338  
    339         /** 
    340          * Optional TURN Allocate parameter. The default value will be 
    341          * initialized by #pj_turn_alloc_param_default(). 
    342          */ 
    343         pj_turn_alloc_param  alloc_param; 
    344  
    345     } 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]; 
    346415 
    347416    /** 
     
    463532 
    464533 
     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 
    465550/** 
    466551 * Copy configuration. 
Note: See TracChangeset for help on using the changeset viewer.