Ignore:
Timestamp:
Mar 20, 2007 8:44:26 AM (17 years ago)
Author:
bennylp
Message:

--

File:
1 edited

Legend:

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

    r1080 r1085  
    2525 */ 
    2626#include <pjnath/types.h> 
    27 #include <pjnath/stun_endpoint.h> 
     27#include <pjnath/stun_session.h> 
    2828#include <pjlib-util/resolver.h> 
    2929#include <pj/sock.h> 
     
    6565 
    6666 
    67 #define PJ_ICE_MAX_CAND     32 
     67#define PJ_ICE_MAX_CAND     16 
    6868#define PJ_ICE_MAX_COMP     8 
    69  
     69#define PJ_ICE_MAX_CHECKS   32 
    7070 
    7171/** 
     
    105105typedef struct pj_ice_check 
    106106{ 
    107     unsigned            local_cand_id; 
     107    unsigned            cand_id; 
     108    pj_uint32_t         comp_id; 
     109    pj_str_t            foundation; 
     110 
    108111    pj_uint64_t         check_prio; 
    109112    pj_ice_check_state  check_state; 
     
    128131    pj_ice_checklist_state   state; 
    129132    unsigned                 count; 
    130     pj_ice_check            *checks; 
     133    pj_ice_check             checks[PJ_ICE_MAX_CHECKS]; 
    131134} pj_ice_checklist; 
    132135 
     
    137140typedef struct pj_ice_cb 
    138141{ 
    139     pj_bool_t (*on_found_cand)(pj_ice *sock, 
    140                                pj_ice_cand_type type, 
    141                                const pj_sockaddr_t *addr, 
    142                                int addr_len); 
     142    pj_status_t (*on_send_pkt)(pj_ice *ice,  
     143                               const void *pkt, pj_size_t size, 
     144                               const pj_sockaddr_t *dst_addr, 
     145                               unsigned addr_len); 
    143146} pj_ice_cb; 
    144147 
     
    154157} pj_ice_state; 
    155158 
     159typedef enum pj_ice_role 
     160{ 
     161    PJ_ICE_ROLE_CONTROLLED, 
     162    PJ_ICE_ROLE_CONTROLLING 
     163} pj_ice_role; 
     164 
    156165/** 
    157166 * ICE structure. 
     
    165174    int                  af; 
    166175    int                  sock_type; 
    167  
     176    pj_ice_role          role; 
    168177    pj_ice_state         state; 
     178 
     179    pj_ice_cb            cb; 
     180 
     181    /* STUN credentials */ 
     182    pj_str_t             tx_uname; 
     183    pj_str_t             tx_pass; 
     184    pj_str_t             rx_uname; 
     185    pj_str_t             rx_pass; 
    169186 
    170187    /* Components */ 
     
    173190 
    174191    /* Local candidates */ 
    175     unsigned             cand_cnt; 
    176     pj_ice_cand          cand[PJ_ICE_MAX_CAND]; 
    177  
    178     /* Checklist */ 
     192    unsigned             lcand_cnt; 
     193    pj_ice_cand          lcand[PJ_ICE_MAX_CAND]; 
     194 
     195    /* Remote candidates */ 
     196    unsigned             rcand_cnt; 
     197    pj_ice_cand          rcand[PJ_ICE_MAX_CAND]; 
     198 
     199    /* Checklists */ 
    179200    pj_ice_checklist     cklist; 
     201    pj_ice_checklist     valid_list; 
    180202 
    181203    /* STUN servers */ 
     
    184206    pj_bool_t            relay_enabled; 
    185207    pj_sockaddr          stun_srv; 
     208 
     209    /* STUN sessions */ 
     210    pj_stun_session     *tx_sess; 
     211    pj_stun_session     *rx_sess; 
    186212}; 
    187213 
     
    189215PJ_DECL(pj_status_t) pj_ice_create(pj_stun_config *cfg, 
    190216                                   const char *name, 
     217                                   pj_ice_role role, 
     218                                   const pj_ice_cb *cb, 
    191219                                   int af, 
    192220                                   int sock_type, 
     
    208236                                          unsigned comp_id, 
    209237                                          pj_sock_t sock); 
    210  
     238PJ_DECL(pj_status_t) pj_ice_set_credentials(pj_ice *ice, 
     239                                            const pj_str_t *local_ufrag, 
     240                                            const pj_str_t *local_pass, 
     241                                            const pj_str_t *remote_ufrag, 
     242                                            const pj_str_t *remote_pass); 
    211243PJ_DECL(pj_status_t) pj_ice_start_gather(pj_ice *ice, 
    212244                                         unsigned flags); 
Note: See TracChangeset for help on using the changeset viewer.