Ignore:
Timestamp:
May 17, 2009 3:48:53 PM (15 years ago)
Author:
nanang
Message:

Ticket #832: Introduced a new internal param 'hide' for route header to omit printing this route, yet obeyed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/sipit24/pjsip/src/pjsip/sip_msg.c

    r2394 r2702  
    457457    /* Print each of the headers. */ 
    458458    for (hdr=msg->hdr.next; hdr!=&msg->hdr; hdr=hdr->next) { 
    459         len = (*hdr->vptr->print_on)(hdr, p, end-p); 
    460         if (len < 1) 
     459        len = pjsip_hdr_print_on(hdr, p, end-p); 
     460        if (len < 0) 
    461461            return -1; 
    462         p += len; 
    463  
    464         if (p+3 >= end) 
    465             return -1; 
    466  
    467         *p++ = '\r'; 
    468         *p++ = '\n'; 
     462 
     463        if (len > 0) { 
     464            p += len; 
     465            if (p+3 >= end) 
     466                return -1; 
     467 
     468            *p++ = '\r'; 
     469            *p++ = '\n'; 
     470        } 
    469471    } 
    470472 
     
    16021604    char *endbuf = buf + size; 
    16031605    const pjsip_parser_const_t *pc = pjsip_parser_const(); 
     1606    pjsip_sip_uri *sip_uri; 
     1607    pjsip_param *p; 
     1608 
     1609    /* Check the proprietary param 'hide', don't print this header  
     1610     * if it exists in the route URI. 
     1611     */ 
     1612    sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri(hdr->name_addr.uri); 
     1613    p = sip_uri->other_param.next; 
     1614    while (p != &sip_uri->other_param) { 
     1615        const pj_str_t st_hide = {"hide", 4}; 
     1616 
     1617        if (pj_stricmp(&p->name, &st_hide) == 0) { 
     1618            /* Check if param 'hide' is specified without 'lr'. */ 
     1619            pj_assert(sip_uri->lr_param != 0); 
     1620            return 0; 
     1621        } 
     1622        p = p->next; 
     1623    } 
     1624 
    16041625    /* Route and Record-Route don't compact forms */ 
    16051626 
Note: See TracChangeset for help on using the changeset viewer.