Changeset 606
- Timestamp:
- Jul 17, 2006 10:04:12 AM (18 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_parser.h
r583 r606 315 315 pjsip_HEX_SPEC, /**< Hexadecimal digits. */ 316 316 pjsip_PARAM_CHAR_SPEC, /**< For scanning pname (or pvalue when it's 317 not quoted.) */317 not quoted.) in URI */ 318 318 pjsip_PARAM_CHAR_SPEC_ESC, /**< Variant without the escape ('%') char */ 319 319 pjsip_HDR_CHAR_SPEC, /**< Chars in hname/havalue in URL. */ … … 357 357 }; 358 358 359 /* Parse parameter in header (matching the character as token) */ 359 360 void pjsip_parse_param_imp( pj_scanner *scanner, pj_pool_t *pool, 360 361 pj_str_t *pname, pj_str_t *pvalue, 361 362 unsigned opt); 363 /* Parse parameter in URL (matching the character as paramchar) */ 364 void pjsip_parse_uri_param_imp( pj_scanner *scanner, pj_pool_t *pool, 365 pj_str_t *pname, pj_str_t *pvalue, 366 unsigned opt); 362 367 void pjsip_concat_param_imp( pj_str_t *param, pj_pool_t *pool, 363 const pj_str_t *pname, const pj_str_t *pvalue, int sepchar); 368 const pj_str_t *pname, const pj_str_t *pvalue, 369 int sepchar); 364 370 void pjsip_parse_end_hdr_imp ( pj_scanner *scanner ); 365 371 -
pjproject/trunk/pjsip/src/pjsip-simple/evsub_msg.c
r197 r606 71 71 72 72 printed = pjsip_param_print_on(&hdr->other_param, p, endbuf-p, 73 &pjsip_ PARAM_CHAR_SPEC,74 &pjsip_ PARAM_CHAR_SPEC, ';');73 &pjsip_TOKEN_SPEC, 74 &pjsip_TOKEN_SPEC, ';'); 75 75 if (printed < 0) 76 76 return printed; … … 181 181 182 182 printed = pjsip_param_print_on( &hdr->other_param, p, endbuf-p, 183 &pjsip_ PARAM_CHAR_SPEC,184 &pjsip_ PARAM_CHAR_SPEC,183 &pjsip_TOKEN_SPEC, 184 &pjsip_TOKEN_SPEC, 185 185 ';'); 186 186 if (printed < 0) -
pjproject/trunk/pjsip/src/pjsip/sip_auth_msg.c
r82 r606 82 82 83 83 printed = pjsip_param_print_on(&cred->other_param, buf, endbuf-buf, 84 &pjsip_ PARAM_CHAR_SPEC,85 &pjsip_ PARAM_CHAR_SPEC, ',');84 &pjsip_TOKEN_SPEC, 85 &pjsip_TOKEN_SPEC, ','); 86 86 if (printed < 0) 87 87 return -1; … … 236 236 237 237 printed = pjsip_param_print_on(&chal->other_param, buf, endbuf-buf, 238 &pjsip_ PARAM_CHAR_SPEC,239 &pjsip_ PARAM_CHAR_SPEC, ',');238 &pjsip_TOKEN_SPEC, 239 &pjsip_TOKEN_SPEC, ','); 240 240 if (printed < 0) 241 241 return -1; -
pjproject/trunk/pjsip/src/pjsip/sip_msg.c
r583 r606 1040 1040 1041 1041 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, 1042 &pjsip_ PARAM_CHAR_SPEC,1043 &pjsip_PARAM_CHAR_SPEC,';');1042 &pjsip_TOKEN_SPEC, &pjsip_TOKEN_SPEC, 1043 ';'); 1044 1044 if (printed < 0) 1045 1045 return printed; … … 1283 1283 1284 1284 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, 1285 &pjsip_ PARAM_CHAR_SPEC,1286 &pjsip_ PARAM_CHAR_SPEC, ';');1285 &pjsip_TOKEN_SPEC, 1286 &pjsip_TOKEN_SPEC, ';'); 1287 1287 if (printed < 0) 1288 1288 return -1; … … 1454 1454 1455 1455 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, 1456 &pjsip_ PARAM_CHAR_SPEC,1457 &pjsip_ PARAM_CHAR_SPEC, ';');1456 &pjsip_TOKEN_SPEC, 1457 &pjsip_TOKEN_SPEC, ';'); 1458 1458 if (printed < 0) 1459 1459 return -1; … … 1673 1673 1674 1674 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, 1675 &pjsip_ PARAM_CHAR_SPEC,1676 &pjsip_ PARAM_CHAR_SPEC, ';');1675 &pjsip_TOKEN_SPEC, 1676 &pjsip_TOKEN_SPEC, ';'); 1677 1677 if (printed < 0) 1678 1678 return -1; -
pjproject/trunk/pjsip/src/pjsip/sip_parser.c
r587 r606 41 41 #define USER_UNRESERVED "&=+$,;?/" 42 42 #define PASS "&=+$," 43 #define TOKEN "-.!%*_ =`'~+" /* '+' is because of app/pidf+xml44 * in Content-Type!*/43 #define TOKEN "-.!%*_`'~+" /* '=' was removed for parsing 44 * param */ 45 45 #define HOST "_-." 46 46 #define HEX_DIGIT "abcdefABCDEF" … … 139 139 pj_str_t *pname, 140 140 pj_str_t *pvalue); 141 static void int_parse_uri_param( pj_scanner *scanner, 142 pj_pool_t *pool, 143 pj_str_t *pname, 144 pj_str_t *pvalue); 141 145 static void int_parse_hparam( pj_scanner *scanner, 142 146 pj_pool_t *pool, … … 325 329 pj_cis_add_str( &pjsip_TOKEN_SPEC, TOKEN); 326 330 331 /* TOKEN must not have '%' */ 332 pj_assert(pj_cis_match(&pjsip_TOKEN_SPEC, '%')==0); 333 327 334 status = pj_cis_dup(&pjsip_HOST_SPEC, &pjsip_ALNUM_SPEC); 328 335 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); … … 1039 1046 } 1040 1047 1048 1041 1049 /* Parse parameter (pname ["=" pvalue]). */ 1042 void pjsip_parse_param_imp(pj_scanner *scanner, pj_pool_t *pool,1050 static void parse_param_imp( pj_scanner *scanner, pj_pool_t *pool, 1043 1051 pj_str_t *pname, pj_str_t *pvalue, 1052 const pj_cis_t *spec, const pj_cis_t *esc_spec, 1044 1053 unsigned option) 1045 1054 { 1046 1055 /* pname */ 1047 parser_get_and_unescape(scanner, pool, &pjsip_PARAM_CHAR_SPEC, 1048 &pjsip_PARAM_CHAR_SPEC_ESC, pname); 1056 parser_get_and_unescape(scanner, pool, spec, esc_spec, pname); 1049 1057 1050 1058 /* init pvalue */ … … 1063 1071 pvalue->slen -= 2; 1064 1072 } 1065 } else if(pj_cis_match(&pjsip_PARAM_CHAR_SPEC, *scanner->curptr)) { 1066 parser_get_and_unescape(scanner, pool, &pjsip_PARAM_CHAR_SPEC, 1067 &pjsip_PARAM_CHAR_SPEC_ESC, pvalue); 1073 } else if(pj_cis_match(spec, *scanner->curptr)) { 1074 parser_get_and_unescape(scanner, pool, spec, esc_spec, pvalue); 1068 1075 } 1069 1076 } … … 1071 1078 } 1072 1079 1073 /* Parse parameter (";" pname ["=" pvalue]). */ 1080 /* Parse parameter (pname ["=" pvalue]) using token. */ 1081 void pjsip_parse_param_imp( pj_scanner *scanner, pj_pool_t *pool, 1082 pj_str_t *pname, pj_str_t *pvalue, 1083 unsigned option) 1084 { 1085 parse_param_imp(scanner, pool, pname, pvalue, &pjsip_TOKEN_SPEC, 1086 &pjsip_TOKEN_SPEC, option); 1087 } 1088 1089 1090 /* Parse parameter (pname ["=" pvalue]) using paramchar. */ 1091 void pjsip_parse_uri_param_imp(pj_scanner *scanner, pj_pool_t *pool, 1092 pj_str_t *pname, pj_str_t *pvalue, 1093 unsigned option) 1094 { 1095 parse_param_imp(scanner, pool, pname, pvalue, &pjsip_PARAM_CHAR_SPEC, 1096 &pjsip_PARAM_CHAR_SPEC_ESC, option); 1097 } 1098 1099 1100 /* Parse parameter (";" pname ["=" pvalue]) in header. */ 1074 1101 static void int_parse_param( pj_scanner *scanner, pj_pool_t *pool, 1075 1102 pj_str_t *pname, pj_str_t *pvalue) … … 1082 1109 PJSIP_PARSE_REMOVE_QUOTE); 1083 1110 } 1111 1112 /* Parse parameter (";" pname ["=" pvalue]) in URI. */ 1113 static void int_parse_uri_param( pj_scanner *scanner, pj_pool_t *pool, 1114 pj_str_t *pname, pj_str_t *pvalue) 1115 { 1116 /* Get ';' character */ 1117 pj_scan_get_char(scanner); 1118 1119 /* Get pname and optionally pvalue */ 1120 pjsip_parse_uri_param_imp(scanner, pool, pname, pvalue, 1121 PJSIP_PARSE_REMOVE_QUOTE); 1122 } 1123 1084 1124 1085 1125 /* Parse header parameter. */ … … 1298 1338 pj_str_t pname, pvalue; 1299 1339 1300 int_parse_ param( scanner, pool, &pname, &pvalue);1340 int_parse_uri_param( scanner, pool, &pname, &pvalue); 1301 1341 1302 1342 if (!parser_stricmp(pname, pjsip_USER_STR) && pvalue.slen) { -
pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c
r583 r606 56 56 static pj_cis_t pjsip_TEL_PNAME_SPEC; 57 57 static pj_cis_t pjsip_TEL_PVALUE_SPEC; 58 static pj_cis_t pjsip_TEL_PVALUE_SPEC_ESC; 58 59 static pj_cis_t pjsip_TEL_PARSING_PVALUE_SPEC; 60 static pj_cis_t pjsip_TEL_PARSING_PVALUE_SPEC_ESC; 59 61 60 62 static pj_str_t pjsip_ISUB_STR = { "isub", 4 }; … … 153 155 pj_cis_add_str(&pjsip_TEL_PVALUE_SPEC, PARAM_CHAR); 154 156 157 status = pj_cis_dup(&pjsip_TEL_PVALUE_SPEC_ESC, &pjsip_TEL_PVALUE_SPEC); 158 pj_cis_del_str(&pjsip_TEL_PVALUE_SPEC_ESC, "%"); 159 155 160 status = pj_cis_dup(&pjsip_TEL_PARSING_PVALUE_SPEC, &pjsip_TEL_URIC_SPEC); 156 161 PJ_ASSERT_RETURN(status==PJ_SUCCESS, status); 157 162 pj_cis_add_cis(&pjsip_TEL_PARSING_PVALUE_SPEC, &pjsip_TEL_PVALUE_SPEC); 158 163 pj_cis_add_str(&pjsip_TEL_PARSING_PVALUE_SPEC, "="); 164 165 status = pj_cis_dup(&pjsip_TEL_PARSING_PVALUE_SPEC_ESC, 166 &pjsip_TEL_PARSING_PVALUE_SPEC); 167 pj_cis_del_str(&pjsip_TEL_PVALUE_SPEC_ESC, "%"); 159 168 160 169 status = pjsip_register_uri_parser("tel", &tel_uri_parse); … … 394 403 if (*scanner->curptr == '=') { 395 404 pj_scan_get_char(scanner); 396 pj_scan_get(scanner, &pjsip_TEL_PARSING_PVALUE_SPEC, &pvalue); 405 406 # if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 407 pj_scan_get_unescape( scanner, 408 &pjsip_TEL_PARSING_PVALUE_SPEC_ESC, 409 &pvalue); 410 # else 411 pj_scan_get(scanner, &pjsip_TEL_PARSING_PVALUE_SPEC, 412 &pvalue); 413 *token = pj_str_unescape(pool, &pvalue); 414 # endif 415 397 416 } else { 398 417 pvalue.slen = 0;
Note: See TracChangeset
for help on using the changeset viewer.