Ignore:
Timestamp:
Apr 2, 2007 11:44:47 AM (18 years ago)
Author:
bennylp
Message:

Ticket #205: merged proxy functionalities from stable to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_msg.c

    r974 r1127  
    248248} 
    249249 
     250PJ_DEF(pjsip_msg*) pjsip_msg_clone( pj_pool_t *pool, const pjsip_msg *src) 
     251{ 
     252    pjsip_msg *dst; 
     253    const pjsip_hdr *sh; 
     254 
     255    dst = pjsip_msg_create(pool, src->type); 
     256 
     257    /* Clone request/status line */ 
     258    if (src->type == PJSIP_REQUEST_MSG) { 
     259        pjsip_method_copy(pool, &dst->line.req.method, &src->line.req.method); 
     260        dst->line.req.uri = pjsip_uri_clone(pool, src->line.req.uri); 
     261    } else { 
     262        dst->line.status.code = src->line.status.code; 
     263        pj_strdup(pool, &dst->line.status.reason, &src->line.status.reason); 
     264    } 
     265 
     266    /* Clone headers */ 
     267    sh = src->hdr.next; 
     268    while (sh != &src->hdr) { 
     269        pjsip_hdr *dh = pjsip_hdr_clone(pool, sh); 
     270        pjsip_msg_add_hdr(dst, dh); 
     271        sh = sh->next; 
     272    } 
     273 
     274    /* Clone message body */ 
     275    if (src->body) { 
     276        dst->body = pjsip_msg_body_clone(pool, src->body); 
     277    } 
     278 
     279    return dst; 
     280} 
     281 
    250282PJ_DEF(void*)  pjsip_msg_find_hdr( const pjsip_msg *msg,  
    251283                                   pjsip_hdr_e hdr_type, const void *start) 
Note: See TracChangeset for help on using the changeset viewer.