Ignore:
Timestamp:
Dec 2, 2007 3:40:52 PM (16 years ago)
Author:
bennylp
Message:

More ticket #421: fixed SIP messaging components to support IPv6 format

File:
1 edited

Legend:

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

    r1566 r1610  
    10781078                    pvalue->slen -= 2; 
    10791079                } 
     1080            } else if (*scanner->curptr == '[') { 
     1081                /* pvalue can be a quoted IPv6; in this case, the 
     1082                 * '[' and ']' quote characters are to be removed 
     1083                 * from the pvalue.  
     1084                 */ 
     1085                pj_scan_get_char(scanner); 
     1086                pj_scan_get_until_ch(scanner, ']', pvalue); 
     1087                pj_scan_get_char(scanner); 
    10801088            } else if(pj_cis_match(spec, *scanner->curptr)) { 
    10811089                parser_get_and_unescape(scanner, pool, spec, esc_spec, pvalue); 
     
    11581166} 
    11591167 
     1168/* Parse host part: 
     1169 *   host =  hostname / IPv4address / IPv6reference 
     1170 */ 
     1171static void int_parse_host(pj_scanner *scanner, pj_str_t *host) 
     1172{ 
     1173    if (*scanner->curptr == '[') { 
     1174        /* Note: the '[' and ']' characters are removed from the host */ 
     1175        pj_scan_get_char(scanner); 
     1176        pj_scan_get_until_ch(scanner, ']', host); 
     1177        pj_scan_get_char(scanner); 
     1178    } else { 
     1179        pj_scan_get( scanner, &pconst.pjsip_HOST_SPEC, host); 
     1180    } 
     1181} 
     1182 
    11601183/* Parse host:port in URI. */ 
    11611184static void int_parse_uri_host_port( pj_scanner *scanner,  
    11621185                                     pj_str_t *host, int *p_port) 
    11631186{ 
    1164     pj_scan_get( scanner, &pconst.pjsip_HOST_SPEC, host); 
     1187    int_parse_host(scanner, host); 
     1188 
    11651189    /* RFC3261 section 19.1.2: host don't need to be unescaped */ 
    11661190    if (*scanner->curptr == ':') { 
     
    18431867        pj_str_t pname, pvalue; 
    18441868 
    1845         int_parse_param( scanner, pool, &pname, &pvalue, 0); 
     1869        //Parse with PARAM_CHAR instead, to allow IPv6 
     1870        //int_parse_param( scanner, pool, &pname, &pvalue, 0); 
     1871        /* Get ';' character */ 
     1872        pj_scan_get_char(scanner); 
     1873 
     1874        parse_param_imp(scanner, pool, &pname, &pvalue,  
     1875                        &pconst.pjsip_PARAM_CHAR_SPEC, 
     1876                        &pconst.pjsip_PARAM_CHAR_SPEC_ESC, 0); 
    18461877 
    18471878        if (!parser_stricmp(pname, pconst.pjsip_BRANCH_STR) && pvalue.slen) { 
     
    19842015 
    19852016        pj_scan_get( scanner, &pconst.pjsip_TOKEN_SPEC, &hdr->transport); 
    1986         pj_scan_get( scanner, &pconst.pjsip_HOST_SPEC, &hdr->sent_by.host); 
     2017        int_parse_host(scanner, &hdr->sent_by.host); 
    19872018 
    19882019        if (*scanner->curptr==':') { 
Note: See TracChangeset for help on using the changeset viewer.