Ignore:
Timestamp:
Mar 18, 2007 5:39:27 PM (18 years ago)
Author:
bennylp
Message:

Changed pj_sockaddr structure and added pjnath project for ICE/STUN stuffs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjnath/stun_transaction.c

    r1062 r1080  
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    1818 */ 
    19 #include <pjlib-util/stun_transaction.h> 
    20 #include <pjlib-util/errno.h> 
     19#include <pjnath/stun_transaction.h> 
     20#include <pjnath/errno.h> 
    2121#include <pj/assert.h> 
    2222#include <pj/log.h> 
     
    3232{ 
    3333    char                 obj_name[PJ_MAX_OBJ_NAME]; 
    34     pj_stun_endpoint    *endpt; 
     34    pj_stun_config      *cfg; 
    3535    pj_stun_tsx_cb       cb; 
    3636    void                *user_data; 
     
    6464 * Create a STUN client transaction. 
    6565 */ 
    66 PJ_DEF(pj_status_t) pj_stun_client_tsx_create(pj_stun_endpoint *endpt, 
     66PJ_DEF(pj_status_t) pj_stun_client_tsx_create(pj_stun_config *cfg, 
    6767                                              pj_pool_t *pool, 
    6868                                              const pj_stun_tsx_cb *cb, 
     
    7171    pj_stun_client_tsx *tsx; 
    7272 
    73     PJ_ASSERT_RETURN(endpt && cb && p_tsx, PJ_EINVAL); 
     73    PJ_ASSERT_RETURN(cfg && cb && p_tsx, PJ_EINVAL); 
    7474    PJ_ASSERT_RETURN(cb->on_send_msg, PJ_EINVAL); 
    7575 
    7676    tsx = PJ_POOL_ZALLOC_T(pool, pj_stun_client_tsx); 
    77     tsx->endpt = endpt; 
     77    tsx->cfg = cfg; 
    7878    pj_memcpy(&tsx->cb, cb, sizeof(*cb)); 
    7979 
     
    9898 
    9999    if (tsx->timer.id != 0) { 
    100         pj_timer_heap_cancel(tsx->endpt->timer_heap, &tsx->timer); 
     100        pj_timer_heap_cancel(tsx->cfg->timer_heap, &tsx->timer); 
    101101        tsx->timer.id = 0; 
    102102    } 
     
    150150        if (tsx->transmit_count == 0) { 
    151151            tsx->retransmit_time.sec = 0; 
    152             tsx->retransmit_time.msec = tsx->endpt->rto_msec; 
     152            tsx->retransmit_time.msec = tsx->cfg->rto_msec; 
    153153 
    154154        } else if (tsx->transmit_count < PJ_STUN_MAX_RETRANSMIT_COUNT-1) { 
     
    169169         * cancel transmission). 
    170170         */; 
    171         status = pj_timer_heap_schedule(tsx->endpt->timer_heap, &tsx->timer, 
     171        status = pj_timer_heap_schedule(tsx->cfg->timer_heap, &tsx->timer, 
    172172                                        &tsx->retransmit_time); 
    173173        if (status != PJ_SUCCESS) { 
     
    183183    if (status != PJ_SUCCESS) { 
    184184        if (tsx->timer.id != 0) { 
    185             pj_timer_heap_cancel(tsx->endpt->timer_heap, &tsx->timer); 
     185            pj_timer_heap_cancel(tsx->cfg->timer_heap, &tsx->timer); 
    186186            tsx->timer.id = 0; 
    187187        } 
     
    236236        tsx->complete = PJ_TRUE; 
    237237        if (tsx->cb.on_complete) { 
    238             tsx->cb.on_complete(tsx, PJLIB_UTIL_ESTUNNOTRESPOND, NULL); 
     238            tsx->cb.on_complete(tsx, PJNATH_ESTUNNOTRESPOND, NULL); 
    239239        } 
    240240        return; 
     
    269269        PJ_LOG(4,(tsx->obj_name,  
    270270                  "STUN rx_msg() error: not response message")); 
    271         return PJLIB_UTIL_ESTUNNOTRESPONSE; 
     271        return PJNATH_ESTUNNOTRESPONSE; 
    272272    } 
    273273 
     
    277277     */ 
    278278    if (tsx->timer.id) { 
    279         pj_timer_heap_cancel(tsx->endpt->timer_heap, &tsx->timer); 
     279        pj_timer_heap_cancel(tsx->cfg->timer_heap, &tsx->timer); 
    280280        tsx->timer.id = 0; 
    281281    } 
     
    301301        status = PJ_SUCCESS; 
    302302    } else { 
    303         status = PJLIB_UTIL_ESTUNTSXFAILED; 
     303        status = PJNATH_ESTUNTSXFAILED; 
    304304    } 
    305305 
Note: See TracChangeset for help on using the changeset viewer.