Changeset 1932


Ignore:
Timestamp:
Apr 17, 2008 5:25:37 PM (16 years ago)
Author:
bennylp
Message:

SIPit ICE test: fixed crashed with ICE negotiation, fixed empty (0.0.0.0) srflx addr, etc.

Location:
pjproject/branches/projects/ice-turn07
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/ice-turn07/pjnath/src/pjnath/ice_session.c

    r1926 r1932  
    107107struct msg_data 
    108108{ 
    109     pj_bool_t                        is_request; 
     109    pj_bool_t   is_request; 
     110    unsigned    cand_id; 
    110111 
    111112    union data { 
     
    115116            unsigned                 ckid; 
    116117        } req; 
    117  
    118         struct response_data { 
    119             unsigned                 cand_id; 
    120         } res; 
    121118    } data; 
    122119}; 
     
    14011398     * completes and on_stun_request_complete() callback is called. 
    14021399     */ 
    1403     msg_data = PJ_POOL_ZALLOC_T(check->tdata->pool, struct msg_data); 
     1400    msg_data = PJ_POOL_ZALLOC_T(ice->pool, struct msg_data); 
    14041401    msg_data->is_request = PJ_TRUE; 
     1402    msg_data->cand_id = lcand - ice->lcand; 
    14051403    msg_data->data.req.ice = ice; 
    14061404    msg_data->data.req.clist = clist; 
     
    16681666    unsigned cand_id; 
    16691667     
    1670     if (msg_data->is_request) { 
    1671         pj_ice_sess_checklist *clist = msg_data->data.req.clist; 
    1672         pj_ice_sess_cand *lcand = clist->checks[msg_data->data.req.ckid].lcand; 
    1673  
    1674         cand_id = lcand - ice->lcand; 
    1675          
    1676     } else { 
    1677         cand_id = msg_data->data.res.cand_id; 
    1678     } 
     1668    cand_id = msg_data->cand_id; 
    16791669 
    16801670    return (*ice->cb.on_tx_pkt)(ice, sd->comp_id, cand_id, 
     
    19401930{ 
    19411931    stun_data *sd; 
    1942     unsigned *param_cand_id; 
     1932    //unsigned *param_cand_id; 
    19431933    const pj_stun_msg *msg = rdata->msg; 
    19441934    struct msg_data *msg_data; 
     
    19621952     *  whether to send packet using local socket or the relay. 
    19631953     */ 
    1964     param_cand_id = (unsigned*)token; 
     1954    //param_cand_id = (unsigned*)token; 
    19651955 
    19661956    /* Reject any requests except Binding request */ 
     
    20732063 
    20742064    /* Create a msg_data to be associated with this response */ 
    2075     msg_data = PJ_POOL_ZALLOC_T(tdata->pool, struct msg_data); 
     2065    msg_data = PJ_POOL_ZALLOC_T(ice->pool, struct msg_data); 
    20762066    msg_data->is_request = PJ_FALSE; 
    2077     msg_data->data.res.cand_id = *param_cand_id; 
     2067    msg_data->cand_id = ((struct msg_data*)token)->cand_id; 
    20782068 
    20792069    /* Send the response */ 
     
    23892379    pj_status_t status = PJ_SUCCESS; 
    23902380    pj_ice_sess_comp *comp; 
     2381    struct msg_data *msg_data; 
    23912382    pj_status_t stun_status; 
    23922383 
     
    24012392    } 
    24022393 
     2394    msg_data = PJ_POOL_ZALLOC_T(ice->pool, struct msg_data); 
     2395    msg_data->is_request = PJ_FALSE; 
     2396    msg_data->cand_id = cand_id; 
     2397 
    24032398    stun_status = pj_stun_msg_check((const pj_uint8_t*)pkt, pkt_size,  
    24042399                                    PJ_STUN_IS_DATAGRAM); 
    24052400    if (stun_status == PJ_SUCCESS) { 
    24062401        status = pj_stun_session_on_rx_pkt(comp->stun_sess, pkt, pkt_size, 
    2407                                            PJ_STUN_IS_DATAGRAM, &cand_id, 
     2402                                           PJ_STUN_IS_DATAGRAM, msg_data, 
    24082403                                           NULL, src_addr, src_addr_len); 
    24092404        if (status != PJ_SUCCESS) { 
  • pjproject/branches/projects/ice-turn07/pjnath/src/pjnath/ice_strans.c

    r1926 r1932  
    954954            } 
    955955 
     956            /* Skip if candidate has no address */ 
     957            if (!pj_sockaddr_has_addr(&cand->addr)) { 
     958                PJ_LOG(5,(ice_st->obj_name,  
     959                          "Candidate %d in component %d is not added", 
     960                          j, i)); 
     961                continue; 
     962            } 
     963 
    956964            if (cand->type == PJ_ICE_CAND_TYPE_RELAYED) { 
    957965                local_addr = &cand->addr; 
     
    964972                                          cand->type, cand->local_pref,  
    965973                                          &cand->foundation, &cand->addr,  
    966                                           &comp->local_addr, NULL,  
     974                                          local_addr, relay_addr,  
    967975                                          sizeof(pj_sockaddr_in),  
    968976                                          (unsigned*)&cand->ice_cand_id); 
     
    13161324    } 
    13171325 
     1326    if (comp->ice_st->ice == NULL) { 
     1327        /* The session is gone */ 
     1328        return; 
     1329    } 
     1330 
    13181331    /* Find candidate ID for this packet */ 
    13191332    for (cand_id=0; cand_id<comp->cand_cnt; ++cand_id) { 
  • pjproject/branches/projects/ice-turn07/pjsip-apps/src/pjsua/pjsua_app.c

    r1926 r1932  
    2323#define NO_LIMIT        (int)0x7FFFFFFF 
    2424 
    25 #if 1 
     25#if 0 
    2626#define TURN_SERVER     "turn.pjsip.org" 
    2727#define TURN_PORT       34780 
    28 #define TURN_TCP        0 
    2928#define TURN_REALM      "pjsip.org" 
    3029#define TURN_USER       "700" 
    3130#define TURN_PASSWD     "700" 
    3231#endif 
     32 
     33#if 1 
     34/* Eyeball test */ 
     35#define TURN_SERVER     "216.187.87.78" 
     36#define TURN_PORT       3478 
     37#define TURN_REALM      "test.eyeball.com" 
     38#define TURN_USER       "sipit6" 
     39#define TURN_PASSWD     "password" 
     40#endif 
     41 
    3342 
    3443 
     
    240249static void default_config(struct app_config *cfg) 
    241250{ 
    242     char tmp[80]; 
     251    char tmp[120]; 
    243252    unsigned i; 
    244253 
    245254    pjsua_config_default(&cfg->cfg); 
    246     pj_ansi_sprintf(tmp, "PJSUA v%s/%s", pj_get_version(), PJ_OS_NAME); 
     255    pj_ansi_sprintf(tmp, "PJSUA v%s/%s (http://pjsip.org)", pj_get_version(), PJ_OS_NAME); 
    247256    pj_strdup2_with_null(app_config.pool, &cfg->cfg.user_agent, tmp); 
    248257 
Note: See TracChangeset for help on using the changeset viewer.