Ignore:
Timestamp:
Feb 9, 2006 9:30:09 AM (18 years ago)
Author:
bennylp
Message:

Setting svn:eol-style attribute

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c

    • Property svn:keywords set to id
    r141 r167  
    4242struct pjsip_regc 
    4343{ 
    44     pj_pool_t           *pool; 
    45     pjsip_endpoint      *endpt; 
    46     pj_bool_t            _delete_flag; 
    47     int                  pending_tsx; 
    48  
    49     void                *token; 
    50     pjsip_regc_cb       *cb; 
    51  
    52     pj_str_t            str_srv_url; 
    53     pjsip_uri           *srv_url; 
    54     pjsip_cid_hdr       *cid_hdr; 
    55     pjsip_cseq_hdr      *cseq_hdr; 
    56     pjsip_from_hdr      *from_hdr; 
    57     pjsip_to_hdr        *to_hdr; 
    58     char                *contact_buf; 
     44    pj_pool_t                   *pool; 
     45    pjsip_endpoint              *endpt; 
     46    pj_bool_t                   _delete_flag; 
     47    int                         pending_tsx; 
     48 
     49    void                        *token; 
     50    pjsip_regc_cb               *cb; 
     51 
     52    pj_str_t                    str_srv_url; 
     53    pjsip_uri                   *srv_url; 
     54    pjsip_cid_hdr               *cid_hdr; 
     55    pjsip_cseq_hdr              *cseq_hdr; 
     56    pjsip_from_hdr              *from_hdr; 
     57    pjsip_to_hdr                *to_hdr; 
     58    char                        *contact_buf; 
    5959    pjsip_generic_string_hdr    *contact_hdr; 
    60     pjsip_expires_hdr   *expires_hdr; 
    61     pjsip_contact_hdr   *unreg_contact_hdr; 
    62     pjsip_expires_hdr   *unreg_expires_hdr; 
    63     pj_uint32_t          expires; 
     60    pjsip_expires_hdr           *expires_hdr; 
     61    pjsip_contact_hdr           *unreg_contact_hdr; 
     62    pjsip_expires_hdr           *unreg_expires_hdr; 
     63    pj_uint32_t                  expires; 
     64    pjsip_route_hdr              route_set; 
    6465 
    6566    /* Authorization sessions. */ 
    66     pjsip_auth_clt_sess auth_sess; 
     67    pjsip_auth_clt_sess         auth_sess; 
    6768 
    6869    /* Auto refresh registration. */ 
    69     pj_bool_t            auto_reg; 
    70     pj_timer_entry      timer; 
     70    pj_bool_t                   auto_reg; 
     71    pj_timer_entry              timer; 
    7172}; 
    7273 
     
    99100    if (status != PJ_SUCCESS) 
    100101        return status; 
     102 
     103    pj_list_init(&regc->route_set); 
    101104 
    102105    /* Done */ 
     
    247250    PJ_ASSERT_RETURN(regc && count && cred, PJ_EINVAL); 
    248251    return pjsip_auth_clt_set_credentials(&regc->auth_sess, count, cred); 
     252} 
     253 
     254PJ_DEF(pj_status_t) pjsip_regc_set_route_set( pjsip_regc *regc, 
     255                                              const pjsip_route_hdr *route_set) 
     256{ 
     257    const pjsip_route_hdr *chdr; 
     258 
     259    PJ_ASSERT_RETURN(regc && route_set, PJ_EINVAL); 
     260 
     261    pj_list_init(&regc->route_set); 
     262 
     263    chdr = route_set->next; 
     264    while (chdr != route_set) { 
     265        pj_list_push_back(&regc->route_set, pjsip_hdr_clone(regc->pool, chdr)); 
     266        chdr = chdr->next; 
     267    } 
     268 
     269    return PJ_SUCCESS; 
    249270} 
    250271 
     
    273294    /* Add cached authorization headers. */ 
    274295    pjsip_auth_clt_init_req( &regc->auth_sess, tdata ); 
     296 
     297    /* Add Route headers from route set, ideally after Via header */ 
     298    if (!pj_list_empty(&regc->route_set)) { 
     299        pjsip_hdr *route_pos; 
     300        const pjsip_route_hdr *route; 
     301 
     302        route_pos = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); 
     303        if (!route_pos) 
     304            route_pos = &tdata->msg->hdr; 
     305 
     306        route = regc->route_set.next; 
     307        while (route != &regc->route_set) { 
     308            pjsip_hdr *new_hdr = pjsip_hdr_shallow_clone(tdata->pool, route); 
     309            pj_list_insert_after(route_pos, new_hdr); 
     310            route_pos = new_hdr; 
     311            route = route->next; 
     312        } 
     313    } 
    275314 
    276315    /* Done. */ 
Note: See TracChangeset for help on using the changeset viewer.