Ignore:
Timestamp:
Jun 6, 2008 2:47:10 PM (16 years ago)
Author:
bennylp
Message:

Major major modifications related to ticket #485 (support for TURN-07):

  • Added STUN socket transport pj_stun_sock
  • Integration of TURN-07 to ICE
  • Major refactoring in ICE stream transport to make it simpler
  • Major modification (i.e. API change) in almost everywhere else
  • Much more elaborate STUN, TURN, and ICE tests in pjnath-test
File:
1 edited

Legend:

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

    r1654 r1988  
    130130 
    131131/** 
     132 * Forward declaration for checklist. 
     133 */ 
     134typedef struct pj_ice_sess_checklist pj_ice_sess_checklist; 
     135 
     136/** 
    132137 * This enumeration describes the type of an ICE candidate. 
    133138 */ 
     
    192197 
    193198} pj_ice_sess_comp; 
     199 
     200 
     201/** 
     202 * Data structure to be attached to internal message processing. 
     203 */ 
     204typedef struct pj_ice_msg_data 
     205{ 
     206    unsigned    transport_id; 
     207    pj_bool_t   has_req_data; 
     208 
     209    union data { 
     210        struct request_data { 
     211            pj_ice_sess             *ice; 
     212            pj_ice_sess_checklist   *clist; 
     213            unsigned                 ckid; 
     214        } req; 
     215    } data; 
     216} pj_ice_msg_data; 
    194217 
    195218 
     
    205228{ 
    206229    /** 
     230     * The candidate type, as described in #pj_ice_cand_type enumeration. 
     231     */ 
     232    pj_ice_cand_type     type; 
     233 
     234    /**  
     235     * Status of this candidate. The value will be PJ_SUCCESS if candidate 
     236     * address has been resolved successfully, PJ_EPENDING when the address 
     237     * resolution process is in progress, or other value when the address  
     238     * resolution has completed with failure. 
     239     */ 
     240    pj_status_t          status; 
     241 
     242    /** 
    207243     * The component ID of this candidate. Note that component IDs starts 
    208244     * with one for RTP and two for RTCP. In other words, it's not zero 
    209245     * based. 
    210246     */ 
    211     pj_uint32_t          comp_id; 
    212  
    213     /** 
    214      * The candidate type, as described in #pj_ice_cand_type enumeration. 
    215      */ 
    216     pj_ice_cand_type     type; 
     247    pj_uint8_t           comp_id; 
     248 
     249    /** 
     250     * Transport ID to be used to send packets for this candidate. 
     251     */ 
     252    pj_uint8_t           transport_id; 
     253 
     254    /** 
     255     * Local preference value, which typically is 65535. 
     256     */ 
     257    pj_uint16_t          local_pref; 
    217258 
    218259    /** 
     
    384425 * candidate pairs that an agent will use to generate checks. 
    385426 */ 
    386 typedef struct pj_ice_sess_checklist 
     427struct pj_ice_sess_checklist 
    387428{ 
    388429    /** 
     
    406447    pj_timer_entry           timer; 
    407448 
    408 } pj_ice_sess_checklist; 
     449}; 
    409450 
    410451 
     
    431472     * @param ice           The ICE session. 
    432473     * @param comp_id       ICE component ID. 
     474     * @param transport_id  Transport ID. 
    433475     * @param pkt           The STUN packet. 
    434476     * @param size          The size of the packet. 
     
    437479     */ 
    438480    pj_status_t (*on_tx_pkt)(pj_ice_sess *ice, unsigned comp_id,  
     481                             unsigned transport_id, 
    439482                             const void *pkt, pj_size_t size, 
    440483                             const pj_sockaddr_t *dst_addr, 
     
    447490     * @param ice           The ICE session. 
    448491     * @param comp_id       ICE component ID. 
     492     * @param transport_id  Transport ID. 
    449493     * @param pkt           The whole packet. 
    450494     * @param size          Size of the packet. 
     
    454498     */ 
    455499    void        (*on_rx_data)(pj_ice_sess *ice, unsigned comp_id, 
     500                              unsigned transport_id,  
    456501                              void *pkt, pj_size_t size, 
    457502                              const pj_sockaddr_t *src_addr, 
     
    497542 
    498543    unsigned             comp_id;       /**< Component ID.              */ 
     544    unsigned             transport_id;  /**< Transport ID.              */ 
    499545 
    500546    pj_sockaddr          src_addr;      /**< Source address of request  */ 
     
    553599    unsigned             rcand_cnt;                 /**< # of remote cand.  */ 
    554600    pj_ice_sess_cand     rcand[PJ_ICE_MAX_CAND];    /**< Array of cand.     */ 
     601 
     602    /* Array of transport datas */ 
     603    pj_ice_msg_data      tp_data[4]; 
    555604 
    556605    /* List of eearly checks */ 
     
    580629 */ 
    581630PJ_DECL(const char*) pj_ice_get_cand_type_name(pj_ice_cand_type type); 
     631 
     632 
     633/** 
     634 * This is a utility function to retrieve the string name for the 
     635 * particular role type. 
     636 * 
     637 * @param role          Role type. 
     638 * 
     639 * @return              The string representation of the role. 
     640 */ 
     641PJ_DECL(const char*) pj_ice_sess_role_name(pj_ice_sess_role role); 
    582642 
    583643 
     
    686746 * @param ice           ICE session instance. 
    687747 * @param comp_id       Component ID of this candidate. 
     748 * @param transport_id  Transport ID to be used to send packets for this 
     749 *                      candidate. 
    688750 * @param type          Candidate type. 
    689751 * @param local_pref    Local preference for this candidate, which 
     
    700762PJ_DECL(pj_status_t) pj_ice_sess_add_cand(pj_ice_sess *ice, 
    701763                                          unsigned comp_id, 
     764                                          unsigned transport_id, 
    702765                                          pj_ice_cand_type type, 
    703766                                          pj_uint16_t local_pref, 
     
    798861 * @param ice           The ICE session. 
    799862 * @param comp_id       Component ID. 
     863 * @param transport_id  Number to identify where this packet was received 
     864 *                      from. This parameter will be returned back to 
     865 *                      application in \a on_tx_pkt() callback. 
    800866 * @param pkt           Incoming packet. 
    801867 * @param pkt_size      Size of incoming packet. 
     
    807873PJ_DECL(pj_status_t) pj_ice_sess_on_rx_pkt(pj_ice_sess *ice, 
    808874                                           unsigned comp_id, 
     875                                           unsigned transport_id, 
    809876                                           void *pkt, 
    810877                                           pj_size_t pkt_size, 
Note: See TracChangeset for help on using the changeset viewer.