Ignore:
Timestamp:
Aug 7, 2012 2:18:15 AM (12 years ago)
Author:
bennylp
Message:

Fixed #1412: Account specific NAT settings: STUN, ICE, and TURN

File:
1 edited

Legend:

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

    r4212 r4218  
    25682568 
    25692569/** 
     2570 * This enumeration controls the use of STUN in the account. 
     2571 */ 
     2572typedef enum pjsua_stun_use 
     2573{ 
     2574    /** 
     2575     * Follow the default setting in the global \a pjsua_config. 
     2576     */ 
     2577    PJSUA_STUN_USE_DEFAULT, 
     2578 
     2579    /** 
     2580     * Disable STUN. If STUN is not enabled in the global \a pjsua_config, 
     2581     * this setting has no effect. 
     2582     */ 
     2583    PJSUA_STUN_USE_DISABLED 
     2584 
     2585} pjsua_stun_use; 
     2586 
     2587/** 
     2588 * This enumeration controls the use of ICE settings in the account. 
     2589 */ 
     2590typedef enum pjsua_ice_config_use 
     2591{ 
     2592    /** 
     2593     * Use the default settings in the global \a pjsua_media_config. 
     2594     */ 
     2595    PJSUA_ICE_CONFIG_USE_DEFAULT, 
     2596 
     2597    /** 
     2598     * Use the custom \a pjsua_ice_config setting in the account. 
     2599     */ 
     2600    PJSUA_ICE_CONFIG_USE_CUSTOM 
     2601 
     2602} pjsua_ice_config_use; 
     2603 
     2604/** 
     2605 * This enumeration controls the use of TURN settings in the account. 
     2606 */ 
     2607typedef enum pjsua_turn_config_use 
     2608{ 
     2609    /** 
     2610     * Use the default setting in the global \a pjsua_media_config. 
     2611     */ 
     2612    PJSUA_TURN_CONFIG_USE_DEFAULT, 
     2613 
     2614    /** 
     2615     * Use the custom \a pjsua_turn_config setting in the account. 
     2616     */ 
     2617    PJSUA_TURN_CONFIG_USE_CUSTOM 
     2618 
     2619} pjsua_turn_config_use; 
     2620 
     2621/** 
     2622 * ICE setting. This setting is used in the pjsua_acc_config. 
     2623 */ 
     2624typedef struct pjsua_ice_config 
     2625{ 
     2626    /** 
     2627     * Enable ICE. 
     2628     */ 
     2629    pj_bool_t           enable_ice; 
     2630 
     2631    /** 
     2632     * Set the maximum number of host candidates. 
     2633     * 
     2634     * Default: -1 (maximum not set) 
     2635     */ 
     2636    int                 ice_max_host_cands; 
     2637 
     2638    /** 
     2639     * ICE session options. 
     2640     */ 
     2641    pj_ice_sess_options ice_opt; 
     2642 
     2643    /** 
     2644     * Disable RTCP component. 
     2645     * 
     2646     * Default: no 
     2647     */ 
     2648    pj_bool_t           ice_no_rtcp; 
     2649 
     2650} pjsua_ice_config; 
     2651 
     2652/** 
     2653 * TURN setting. This setting is used in the pjsua_acc_config. 
     2654 */ 
     2655typedef struct pjsua_turn_config 
     2656{ 
     2657    /** 
     2658     * Enable TURN candidate in ICE. 
     2659     */ 
     2660    pj_bool_t           enable_turn; 
     2661 
     2662    /** 
     2663     * Specify TURN domain name or host name, in in "DOMAIN:PORT" or 
     2664     * "HOST:PORT" format. 
     2665     */ 
     2666    pj_str_t            turn_server; 
     2667 
     2668    /** 
     2669     * Specify the connection type to be used to the TURN server. Valid 
     2670     * values are PJ_TURN_TP_UDP or PJ_TURN_TP_TCP. 
     2671     * 
     2672     * Default: PJ_TURN_TP_UDP 
     2673     */ 
     2674    pj_turn_tp_type     turn_conn_type; 
     2675 
     2676    /** 
     2677     * Specify the credential to authenticate with the TURN server. 
     2678     */ 
     2679    pj_stun_auth_cred   turn_auth_cred; 
     2680 
     2681} pjsua_turn_config; 
     2682 
     2683/** 
    25702684 * This structure describes account configuration to be specified when 
    25712685 * adding a new account with #pjsua_acc_add(). Application MUST initialize 
     
    29683082 
    29693083    /** 
     3084     * Control the use of STUN for the SIP signaling. 
     3085     * 
     3086     * Default: PJSUA_STUN_USE_DEFAULT 
     3087     */ 
     3088    pjsua_stun_use              sip_stun_use; 
     3089 
     3090    /** 
     3091     * Control the use of STUN for the media transports. 
     3092     * 
     3093     * Default: PJSUA_STUN_USE_DEFAULT 
     3094     */ 
     3095    pjsua_stun_use              media_stun_use; 
     3096 
     3097    /** 
     3098     * Control the use of ICE in the account. By default, the settings in the 
     3099     * \a pjsua_media_config will be used. 
     3100     * 
     3101     * Default: PJSUA_ICE_CONFIG_USE_DEFAULT 
     3102     */ 
     3103    pjsua_ice_config_use        ice_cfg_use; 
     3104 
     3105    /** 
     3106     * The custom ICE setting for this account. This setting will only be 
     3107     * used if \a ice_cfg_use is set to PJSUA_ICE_CONFIG_USE_CUSTOM 
     3108     */ 
     3109    pjsua_ice_config            ice_cfg; 
     3110 
     3111    /** 
     3112     * Control the use of TURN in the account. By default, the settings in the 
     3113     * \a pjsua_media_config will be used 
     3114     * 
     3115     * Default: PJSUA_TURN_CONFIG_USE_DEFAULT 
     3116     */ 
     3117    pjsua_turn_config_use       turn_cfg_use; 
     3118 
     3119    /** 
     3120     * The custom TURN setting for this account. This setting will only be 
     3121     * used if \a turn_cfg_use is set to PJSUA_TURN_CONFIG_USE_CUSTOM 
     3122     */ 
     3123    pjsua_turn_config           turn_cfg; 
     3124 
     3125    /** 
    29703126     * Specify whether secure media transport should be used for this account. 
    29713127     * Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and 
     
    29743130     * Default: #PJSUA_DEFAULT_USE_SRTP 
    29753131     */ 
    2976     pjmedia_srtp_use    use_srtp; 
     3132    pjmedia_srtp_use            use_srtp; 
    29773133 
    29783134    /** 
     
    30703226} pjsua_acc_config; 
    30713227 
     3228 
     3229/** 
     3230 * Initialize ICE config from a media config. If the \a pool argument 
     3231 * is NULL, a simple memcpy() will be used. 
     3232 * 
     3233 * @param pool      Memory to duplicate strings. 
     3234 * @param dst       Destination config. 
     3235 * @param src       Source config. 
     3236 */ 
     3237PJ_DECL(void) pjsua_ice_config_from_media_config(pj_pool_t *pool, 
     3238                                              pjsua_ice_config *dst, 
     3239                                              const pjsua_media_config *src); 
     3240 
     3241/** 
     3242 * Clone. If the \a pool argument is NULL, a simple memcpy() will be used. 
     3243 * 
     3244 * @param pool      Memory to duplicate strings. 
     3245 * @param dst       Destination config. 
     3246 * @param src       Source config. 
     3247 */ 
     3248PJ_DECL(void) pjsua_ice_config_dup( pj_pool_t *pool, 
     3249                                    pjsua_ice_config *dst, 
     3250                                    const pjsua_ice_config *src); 
     3251 
     3252/** 
     3253 * Initialize TURN config from a media config. If the \a pool argument 
     3254 * is NULL, a simple memcpy() will be used. 
     3255 * 
     3256 * @param pool      Memory to duplicate strings. 
     3257 * @param dst       Destination config. 
     3258 * @param src       Source config. 
     3259 */ 
     3260PJ_DECL(void) pjsua_turn_config_from_media_config(pj_pool_t *pool, 
     3261                                               pjsua_turn_config *dst, 
     3262                                               const pjsua_media_config *src); 
     3263 
     3264/** 
     3265 * Clone. If the \a pool argument is NULL, a simple memcpy() will be used. 
     3266 * 
     3267 * @param pool      Memory to duplicate strings. 
     3268 * @param dst       Destination config. 
     3269 * @param src       Source config. 
     3270 */ 
     3271PJ_DECL(void) pjsua_turn_config_dup(pj_pool_t *pool, 
     3272                                    pjsua_turn_config *dst, 
     3273                                    const pjsua_turn_config *src); 
    30723274 
    30733275/** 
Note: See TracChangeset for help on using the changeset viewer.