Ignore:
Timestamp:
Apr 14, 2008 1:48:39 AM (16 years ago)
Author:
bennylp
Message:

More ticket #485: huge changeset to integrate TURN with ICE and PJSUA-LIB/pjsua. Still experimental

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/ice-turn07/pjnath/include/pjnath/ice_strans.h

    r1487 r1926  
    2626 */ 
    2727#include <pjnath/ice_session.h> 
     28#include <pjnath/turn_sock.h> 
    2829#include <pjlib-util/resolver.h> 
    2930#include <pj/ioqueue.h> 
     
    9293 *        has completed, either successfully or with failure. 
    9394 * 
    94  * After the ICE stream transport is created, application may set up the 
    95  * STUN servers to be used to obtain STUN server reflexive and relayed 
    96  * candidate, by calling #pj_ice_strans_set_stun_domain() or  
    97  * #pj_ice_strans_set_stun_srv(). 
    98  * 
    9995 * Application then creates each component by calling  
    10096 * #pj_ice_strans_create_comp(); this would create an actual socket 
     
    336332    pj_uint8_t           ka_tsx_id[12]; /**< ID for keep STUN alives    */ 
    337333 
     334    pj_turn_sock        *turn_relay;    /**< TURN relay object.         */ 
     335 
    338336    pj_sockaddr          local_addr;    /**< Local/base address.        */ 
    339337 
     
    356354 
    357355/** 
     356 * This structure describes ICE stream transport configuration. 
     357 */ 
     358typedef struct pj_ice_strans_cfg 
     359{ 
     360    /** 
     361     * STUN config. This setting is mandatory. 
     362     */ 
     363    pj_stun_config      stun_cfg; 
     364 
     365    /** 
     366     * STUN server address, if STUN is enabled. 
     367     * 
     368     * Default is to have no TURN server. 
     369     */ 
     370    pj_sockaddr         stun_srv; 
     371 
     372    /** 
     373     * TURN server address, if TURN is enabled. 
     374     * 
     375     * Default is to have no TURN server. 
     376     */ 
     377    pj_sockaddr         turn_srv; 
     378 
     379    /** 
     380     * Type of connection to the TURN server. 
     381     * 
     382     * Default is PJ_TURN_TP_UDP. 
     383     */ 
     384    pj_turn_tp_type     turn_conn_type; 
     385 
     386    /** 
     387     * Credential to be used for the TURN session. 
     388     * 
     389     * Default is to have no credential. 
     390     */ 
     391    pj_stun_auth_cred   turn_cred; 
     392 
     393    /** 
     394     * Optional TURN Allocate parameter. 
     395     * 
     396     * Default is all empty. 
     397     */ 
     398    pj_turn_alloc_param turn_alloc_param; 
     399 
     400} pj_ice_strans_cfg; 
     401 
     402 
     403/** 
    358404 * This structure represents the ICE stream transport. 
    359405 */ 
     
    364410    pj_pool_t               *pool;      /**< Pool used by this object.  */ 
    365411    void                    *user_data; /**< Application data.          */ 
    366     pj_stun_config           stun_cfg;  /**< STUN settings.             */ 
     412    pj_ice_strans_cfg        cfg;       /**< Configuration.             */ 
    367413    pj_ice_strans_cb         cb;        /**< Application callback.      */ 
    368414 
     
    371417    unsigned                 comp_cnt;  /**< Number of components.      */ 
    372418    pj_ice_strans_comp     **comp;      /**< Components array.          */ 
    373  
    374     pj_dns_resolver         *resolver;  /**< The resolver instance.     */ 
    375     pj_bool_t                has_rjob;  /**< Has pending resolve?       */ 
    376     pj_sockaddr_in           stun_srv;  /**< STUN server address.       */ 
    377     pj_sockaddr_in           turn_srv;  /**< TURN server address.       */ 
    378419 
    379420    pj_timer_entry           ka_timer;  /**< STUN keep-alive timer.     */ 
     
    388429 * function. 
    389430 * 
    390  * @param stun_cfg      The STUN settings. 
     431 * @param cfg           Configuration. 
    391432 * @param name          Optional name for logging identification. 
    392433 * @param comp_cnt      Number of components. 
     
    400441 *                      successfully. 
    401442 */ 
    402 PJ_DECL(pj_status_t) pj_ice_strans_create(pj_stun_config *stun_cfg, 
     443PJ_DECL(pj_status_t) pj_ice_strans_create(const pj_ice_strans_cfg *cfg, 
    403444                                          const char *name, 
    404445                                          unsigned comp_cnt, 
     
    417458 */ 
    418459PJ_DECL(pj_status_t) pj_ice_strans_destroy(pj_ice_strans *ice_st); 
    419  
    420  
    421 /** 
    422  * Set the domain to be used when resolving the STUN servers. If application 
    423  * wants to utillize STUN, then STUN server must be specified, either by 
    424  * calling this function or by calling #pj_ice_strans_set_stun_srv(). 
    425  * 
    426  * If application calls this function, then the STUN/TURN servers will 
    427  * be resolved by querying DNS SRV records for the specified domain. 
    428  * 
    429  * @param ice_st        The ICE stream transport. 
    430  * @param resolver      The resolver instance that will be used to 
    431  *                      resolve the STUN/TURN servers. 
    432  * @param domain        The target domain. 
    433  * 
    434  * @return              PJ_SUCCESS if DNS SRV resolution job can be 
    435  *                      started. The resolution process itself will 
    436  *                      complete asynchronously. 
    437  */ 
    438 PJ_DECL(pj_status_t) pj_ice_strans_set_stun_domain(pj_ice_strans *ice_st, 
    439                                                    pj_dns_resolver *resolver, 
    440                                                    const pj_str_t *domain); 
    441  
    442 /** 
    443  * Set the STUN and TURN server addresses. If application 
    444  * wants to utillize STUN, then STUN server must be specified, either by 
    445  * calling this function or by calling #pj_ice_strans_set_stun_domain(). 
    446  * 
    447  * With this function, the STUN and TURN server addresses will be  
    448  * assigned immediately, that is no DNS resolution will need to be  
    449  * performed. 
    450  * 
    451  * @param ice_st        The ICE stream transport. 
    452  * @param stun_srv      The STUN server address, or NULL if STUN 
    453  *                      reflexive candidate is not to be used. 
    454  * @param turn_srv      The TURN server address, or NULL if STUN 
    455  *                      relay candidate is not to be used. 
    456  * 
    457  * @return              PJ_SUCCESS, or the appropriate error code. 
    458  */ 
    459 PJ_DECL(pj_status_t)  
    460 pj_ice_strans_set_stun_srv( pj_ice_strans *ice_st, 
    461                             const pj_sockaddr_in *stun_srv, 
    462                             const pj_sockaddr_in *turn_srv); 
    463460 
    464461/** 
Note: See TracChangeset for help on using the changeset viewer.