Lines Matching defs:scan
90 #define SIP_URI_ISURLESCAPE(scan, end) \
91 ((scan) + 2 < (end) && (scan)[0] == '%' && \
92 SIP_URI_ISHEX((scan)[1]) && SIP_URI_ISHEX((scan[2])))
300 sip_uri_parse_tel(char *scan, char *uend)
307 if (scan == uend)
309 if (*scan == '+') {
310 ++scan;
313 mark = scan;
315 while (scan < uend && SIP_URI_ISPHONEDIGIT(*scan))
316 ++scan;
318 while (scan < uend &&
319 (SIP_URI_ISPHONEDIGIT(*scan) ||
320 SIP_URI_ISDTMFDIGIT(*scan) ||
321 sip_uri_isEscapedPound(&scan, uend) ||
322 *scan == 'p' || *scan == 'w')) {
323 ++scan;
326 if (mark == scan || (scan < uend && *scan != ';'))
332 if (uend - scan > 6 && !sip_uri_url_casecmp(scan, ";isub=", 6)) {
333 scan += 6;
334 mark = scan;
335 while (scan < uend && SIP_URI_ISPHONEDIGIT(*scan))
336 ++scan;
337 if (mark == scan || (scan < uend && *scan != ';'))
344 if (uend - scan > 7 && !sip_uri_url_casecmp(scan, ";postd=", 7)) {
345 scan += 7;
346 mark = scan;
347 while (scan < uend &&
348 (SIP_URI_ISPHONEDIGIT(*scan) ||
349 SIP_URI_ISDTMFDIGIT(*scan) ||
350 sip_uri_isEscapedPound(&scan, uend) ||
351 *scan == 'p' || *scan == 'w')) {
352 ++scan;
354 if (mark == scan || (scan < uend && *scan != ';'))
362 if (uend - scan > 15 &&
363 !sip_uri_url_casecmp(scan, ";phone-context=", 15)) {
364 scan += 15;
365 mark = scan;
366 while (scan < uend && *scan != ';')
367 ++scan;
368 ret = sip_uri_parse_tel_areaspe(mark, scan);
377 while (scan < uend && ret) {
378 if (uend - scan > 15 &&
379 !sip_uri_url_casecmp(scan, ";phone-context=", 15)) {
380 scan += 15;
381 mark = scan;
382 while (scan < uend && *scan != ';')
383 ++scan;
384 ret = sip_uri_parse_tel_areaspe(mark, scan);
385 } else if (uend - scan > 5 &&
386 !sip_uri_url_casecmp(scan, ";tsp=", 5)) {
387 scan += 5;
388 mark = scan;
389 while (scan < uend && *scan != ';')
390 ++scan;
391 ret = sip_uri_parse_tel_servicepro(mark, scan);
393 ++scan;
394 mark = scan;
395 while (scan < uend && (*scan != ';' || quote)) {
396 if (sip_uri_hexVal(scan, uend) == 0x22) {
398 scan += 3;
400 ++scan;
403 ret = sip_uri_parse_tel_futureext(mark, scan);
406 return (ret && scan == uend);
428 sip_uri_parse_tel_areaspe(char *scan, char *uend)
432 if (scan == uend)
438 if (*scan == '+') {
439 ++scan;
440 if (scan == uend)
442 while (scan < uend && SIP_URI_ISPHONEDIGIT(*scan))
443 ++scan;
447 } else if (SIP_URI_ISPHONEDIGIT(*scan) || SIP_URI_ISDTMFDIGIT(*scan) ||
448 sip_uri_isEscapedPound(&scan, uend) ||
449 *scan == 'p' || *scan == 'w') {
450 ++scan;
451 while (scan < uend &&
452 (SIP_URI_ISPHONEDIGIT(*scan) ||
453 SIP_URI_ISDTMFDIGIT(*scan) ||
454 sip_uri_isEscapedPound(&scan, uend) ||
455 *scan == 'p' || *scan == 'w')) {
456 ++scan;
474 if (*scan == '!' || *scan == '$' || *scan == '&' ||
475 *scan == '\'' || *scan == ',' || *scan == '/' ||
476 *scan == '=' || *scan == '?' || *scan == '_' ||
477 (*scan >= 'E' && *scan <= 'Z' &&
478 *scan != 'P' && *scan != 'W') ||
479 (*scan >= 'e' && *scan <= 'z' &&
480 *scan != 'p' && *scan != 'w')) {
481 ++scan;
483 uri_hexValue = sip_uri_hexVal(scan, uend);
495 scan += 3;
503 while (scan < uend) {
504 if (SIP_URI_ISUNRESERVED(*scan) ||
505 (SIP_URI_ISUSER(*scan) && *scan != ';')) {
506 ++scan;
508 uri_hexValue = sip_uri_hexVal(scan, uend);
512 scan += 3;
519 if (scan < uend)
525 sip_uri_hexVal(char *scan, char *uend)
529 if (SIP_URI_ISURLESCAPE(scan, uend)) {
530 ret = (SIP_URI_ISDIGIT(scan[1]) ? (scan[1] - '0') :
531 (tolower(scan[1]) - 'a' + 10)) * 16 +
532 (SIP_URI_ISDIGIT(scan[2]) ? (scan[2] - '0') :
533 (tolower(scan[2]) - 'a' + 10));
544 sip_uri_parse_tel_servicepro(char *scan, char *uend)
548 if (scan == uend)
554 if (sip_uri_hexVal(scan, uend) == 0x20 && scan + 3 == uend)
556 while (scan < uend) {
557 mark = scan;
558 while (scan < uend && (*scan == '-'|| SIP_URI_ISALNUM(*scan)))
559 ++scan;
560 if ((scan < uend && *scan != '.') ||
561 !SIP_URI_ISALPHA(*mark) || !SIP_URI_ISALNUM(*(scan - 1))) {
564 if (scan < uend)
565 ++scan;
568 if (scan < uend)
580 sip_uri_parse_tel_futureext(char *scan, char *uend)
585 if (scan == uend)
591 mark = scan;
592 while (scan < uend && sip_uri_isTokenchar(&scan, uend))
594 if (mark == scan ||
595 (scan < uend && (*scan != '=' || scan + 1 == uend))) {
598 if (scan == uend)
600 ++scan;
605 if (sip_uri_isTokenchar(&scan, uend)) {
606 while (sip_uri_isTokenchar(&scan, uend))
608 if (scan < uend) {
609 if (*scan != '?')
611 ++scan;
612 mark = scan;
613 while (sip_uri_isTokenchar(&scan, uend))
615 if (mark == scan)
619 uri_hexValue = sip_uri_hexVal(scan, uend);
622 scan += 3;
623 while (scan < uend && sip_uri_hexVal(scan, uend) != 0x22) {
627 if (sip_uri_hexVal(scan, uend) == 0x5c) {
628 scan += 3;
629 if (scan < uend) {
630 if (SIP_URI_ISUNRESERVED(*scan) ||
631 SIP_URI_ISUSER(*scan)) {
632 ++scan;
633 } else if (sip_uri_hexVal(scan, uend) >=
635 sip_uri_hexVal(scan, uend) <=
637 scan += 3;
645 if (SIP_URI_ISUNRESERVED(*scan) ||
646 SIP_URI_ISUSER(*scan)) {
647 ++scan;
650 sip_uri_hexVal(scan, uend);
657 scan += 3;
664 if (scan == uend ||
665 (scan < uend && sip_uri_hexVal(scan, uend) != 0x22)) {
668 scan += 3;
671 if (scan < uend)
684 char *scan = *pscan;
687 if (scan == uend)
693 if ((SIP_URI_ISUNRESERVED(*scan) && *scan != '(' && *scan != ')') ||
694 *scan == '$' || *scan == '&' || *scan == '+') {
695 ++scan;
696 *pscan = scan;
700 uri_hexValue = sip_uri_hexVal(scan, uend);
709 scan += 3;
710 *pscan = scan;
723 char *scan = *pscan;
725 if (scan == uend)
727 if (*scan == '%' && scan + 2 < uend && scan[1] == '2' &&
728 scan[2] == '3') {
729 scan += 2;
730 *pscan = scan;
740 sip_uri_parse_scheme(_sip_uri_t *outurl, char *scan, char *uend)
742 if (scan == uend) {
746 outurl->sip_uri_scheme.sip_str_ptr = scan;
747 outurl->sip_uri_scheme.sip_str_len = uend - scan;
749 if (scan < uend && SIP_URI_ISALPHA(*scan)) {
750 ++scan;
751 while (scan < uend && SIP_URI_ISSCHEME(*scan))
752 ++scan;
754 if (scan < uend)
780 sip_uri_parse_params(_sip_uri_t *outurl, char *scan, char *uend)
791 if (scan == uend || *scan != ';' || scan + 1 == uend) {
796 while (scan < uend) {
797 mark = ++scan;
798 while (scan < uend && *scan != ';')
799 ++scan;
800 if (scan == mark) {
819 equal = memchr(mark, '=', scan - mark);
821 param->param_name.sip_str_len = scan - mark;
824 while (mark < scan && (SIP_URI_ISPARAM(*mark) ||
825 SIP_URI_ISURLESCAPE(mark, scan))) {
831 param->param_value.sip_str_len = scan - equal - 1;
833 if (mark == equal || equal + 1 == scan) {
844 if (scan - equal == 1) {
850 while (mark < scan && SIP_URI_ISTOKEN(*mark))
854 if (scan - equal == 1) {
862 if (mark < scan &&
876 if (mark < scan && SIP_URI_ISDIGIT(*mark)) {
878 scan);
884 if (!gothost && mark < scan && *mark == '[') {
886 scan);
892 if (!gothost && mark < scan) {
895 scan))) {
901 mark = scan;
907 while (mark < scan && (SIP_URI_ISPARAM(*mark) ||
908 SIP_URI_ISURLESCAPE(mark, scan) ||
914 if (mark < scan) {
930 sip_uri_parse_headers(_sip_uri_t *outurl, char *scan, char *uend)
935 if (scan == uend || *scan != '?' || scan + 1 == uend) {
939 outurl->sip_uri_headers.sip_str_ptr = scan + 1;
940 outurl->sip_uri_headers.sip_str_len = uend - (scan + 1);
942 while (scan < uend) {
943 mark = ++scan;
944 while (scan < uend && *scan != '&')
945 ++scan;
946 if (scan == mark) {
950 equal = memchr(mark, '=', scan - mark);
955 while (mark < scan &&
957 SIP_URI_ISURLESCAPE(mark, scan) || mark == equal)) {
960 if (mark < scan) {
974 sip_uri_parse_abs_opaque(_sip_uri_t *outurl, char *scan, char *uend)
976 if (scan == uend) {
980 outurl->sip_uri_opaque.sip_str_ptr = scan;
981 outurl->sip_uri_opaque.sip_str_len = uend - scan;
983 if (SIP_URI_ISUNRESERVED(*scan) || SIP_URI_ISURLESCAPE(scan, uend) ||
984 SIP_URI_ISOTHER(*scan) || *scan == ';' || *scan == '?' ||
985 *scan == ':' || *scan == '@' || *scan == '&') {
986 ++scan;
991 while (scan < uend && (SIP_URI_ISRESERVED(*scan) ||
992 SIP_URI_ISUNRESERVED(*scan) || SIP_URI_ISURLESCAPE(scan, uend))) {
993 ++scan;
995 if (scan < uend)
1005 sip_uri_parse_abs_query(_sip_uri_t *outurl, char *scan, char *uend)
1007 if (uend == scan || *scan != '?' || scan + 1 == uend)
1009 ++scan;
1010 outurl->sip_uri_query.sip_str_ptr = scan;
1011 outurl->sip_uri_query.sip_str_len = uend - scan;
1013 while (scan < uend && (SIP_URI_ISRESERVED(*scan) ||
1014 SIP_URI_ISUNRESERVED(*scan) || SIP_URI_ISURLESCAPE(scan, uend))) {
1015 ++scan;
1017 if (scan < uend)
1031 sip_uri_parse_abs_path(_sip_uri_t *outurl, char *scan, char *uend)
1033 if (scan == uend || *scan != '/')
1035 outurl->sip_uri_path.sip_str_ptr = scan;
1036 outurl->sip_uri_path.sip_str_len = uend - scan;
1038 ++scan;
1039 while (scan < uend && (SIP_URI_ISPCHAR(*scan) ||
1040 SIP_URI_ISUNRESERVED(*scan) || SIP_URI_ISURLESCAPE(scan, uend) ||
1041 *scan == '/' || *scan == ';')) {
1042 ++scan;
1044 if (scan < uend)
1052 sip_uri_parse_abs_regname(_sip_uri_t *outurl, char *scan, char *uend)
1054 if (scan == uend)
1056 outurl->sip_uri_regname.sip_str_ptr = scan;
1057 outurl->sip_uri_regname.sip_str_len = uend - scan;
1059 while (scan < uend && (SIP_URI_ISUNRESERVED(*scan) ||
1060 SIP_URI_ISURLESCAPE(scan, uend) || SIP_URI_ISREGNAME(*scan))) {
1061 ++scan;
1063 if (scan < uend)
1072 sip_uri_parse_password(_sip_uri_t *outurl, char *scan, char *uend)
1074 if (scan == uend || *scan != ':' || scan + 1 == uend)
1076 ++scan;
1077 outurl->sip_uri_password.sip_str_ptr = scan;
1078 outurl->sip_uri_password.sip_str_len = uend - scan;
1080 while (scan < uend && (SIP_URI_ISUNRESERVED(*scan) ||
1081 SIP_URI_ISURLESCAPE(scan, uend) || SIP_URI_ISOTHER(*scan) ||
1082 *scan == '&')) {
1083 ++scan;
1085 if (scan < uend)
1094 sip_uri_parse_user(_sip_uri_t *outurl, char *scan, char *uend)
1096 if (scan == uend) {
1100 outurl->sip_uri_user.sip_str_ptr = scan;
1101 outurl->sip_uri_user.sip_str_len = uend - scan;
1103 if (sip_uri_parse_tel(scan, uend)) {
1106 while (scan < uend && (SIP_URI_ISUNRESERVED(*scan) ||
1107 SIP_URI_ISURLESCAPE(scan, uend) || SIP_URI_ISUSER(*scan))) {
1108 ++scan;
1110 if (scan < uend)
1120 sip_uri_parse_port(_sip_uri_t *outurl, char *scan, char *uend)
1122 if (scan == uend || *scan != ':' || scan + 1 == uend) {
1126 ++scan;
1130 if (SIP_URI_ISDIGIT(*scan)) {
1131 outurl->sip_uri_port = *scan - '0';
1132 while (++scan < uend && SIP_URI_ISDIGIT(*scan)) {
1134 outurl->sip_uri_port * 10 + (*scan - '0');
1142 if (scan < uend) {
1156 sip_uri_parse_ipv4(char *scan, char *uend)
1162 if (!SIP_URI_ISDIGIT(*scan))
1164 val = *scan - '0';
1165 while (++scan < uend && SIP_URI_ISDIGIT(*scan)) {
1166 val = val * 10 + (*scan - '0');
1171 if (*scan != '.')
1173 ++scan;
1177 if (j == 4 && scan == uend)
1195 sip_uri_parse_ipv6(char *scan, char *uend)
1202 if (*scan != '[')
1204 ++scan;
1210 if (scan + 1 < uend && scan[0] == ':' && scan[1] == ':') {
1212 scan += 2;
1220 while (scan < uend && j < 15) {
1221 if (!SIP_URI_ISHEX(*scan))
1223 mark = scan;
1224 val = SIP_URI_HEXVAL(*scan);
1225 while (++scan < uend && SIP_URI_ISHEX(*scan)) {
1226 val = val * 16 + SIP_URI_HEXVAL(*scan);
1234 if (scan == uend)
1237 if (*scan == '.' && (j == 12 || (zpad != -1 && j < 12)) &&
1242 scan = mark + 1;
1254 if (*scan == ':') {
1258 if (++scan < uend && *scan == ':') {
1262 if (++scan < uend && *scan == ']') {
1263 ++scan;
1267 } else if (*scan == ']' && (j == 16 || zpad != -1)) {
1268 ++scan;
1284 if (scan == uend)
1296 sip_uri_parse_hostname(char *scan, char *uend)
1300 if (scan < uend && SIP_URI_ISALNUM(*scan)) {
1302 sawalpha = SIP_URI_ISALPHA(*scan);
1303 while (SIP_URI_ISHOST(*scan))
1304 ++scan;
1305 if (*scan != '.')
1307 ++scan;
1308 } while (scan < uend && SIP_URI_ISALNUM(*scan));
1311 if (sawalpha && scan == uend)
1326 char *scan = *pscan;
1332 mark = scan;
1333 while (scan < uend && *scan != '@')
1334 ++scan;
1338 if (scan < uend && *scan == '@') {
1343 while (mark < scan && *mark != ':')
1350 sip_uri_parse_password(outurl, mark, scan);
1351 mark = ++scan;
1354 scan = mark;
1355 if (scan < uend && *scan == '[') { /* look for an IPv6 address */
1356 while (scan < uend && *scan != ']')
1357 ++scan;
1358 if (scan < uend) {
1359 ++scan;
1360 if (sip_uri_parse_ipv6(mark, scan))
1364 while (scan < uend && ((issip && !SIP_URI_ISSIPHDELIM(*scan)) ||
1365 (!issip && !SIP_URI_ISABSHDELIM(*scan)))) {
1366 ++scan;
1372 if (mark < scan && SIP_URI_ISDIGIT(*mark) &&
1373 sip_uri_parse_ipv4(mark, scan)) {
1380 if (!gothost && mark < scan &&
1381 sip_uri_parse_hostname(mark, scan)) {
1394 outurl->sip_uri_host.sip_str_len = scan - mark;
1396 mark = scan;
1400 if (scan < uend && *scan == ':') {
1401 while (scan < uend && ((issip && !SIP_URI_ISSIPDELIM(*scan)) ||
1402 (!issip && !SIP_URI_ISABSDELIM(*scan)))) {
1403 ++scan;
1405 sip_uri_parse_port(outurl, mark, scan);
1411 *pscan = scan;
1422 char *scan;
1464 mark = scan = str;
1465 while (scan < uend && *scan != ':')
1466 ++scan;
1467 if (scan == uend || !sip_uri_parse_scheme(outurl, mark, scan)) {
1482 ++scan; /* skip ':' */
1488 sip_uri_parse_netpath(outurl, &scan, uend, B_TRUE);
1493 if (scan < uend && *scan == ';') {
1494 mark = scan;
1495 while (scan < uend && *scan != '?')
1496 ++scan;
1497 sip_uri_parse_params(outurl, mark, scan);
1503 if (scan < uend && *scan == '?')
1504 sip_uri_parse_headers(outurl, scan, uend);
1505 } else if (scan < uend && scan[0] == '/') { /* parse absoluteURL */
1506 ++scan;
1514 if (scan < uend && *scan == '/') {
1515 ++scan;
1516 mark = scan;
1520 sip_uri_parse_netpath(outurl, &scan, uend, B_FALSE);
1530 scan = mark;
1531 while (scan < uend && *scan != '/' &&
1532 *scan != '?') {
1533 ++scan;
1535 sip_uri_parse_abs_regname(outurl, mark, scan);
1565 --scan;
1570 if (scan < uend && *scan == '/') {
1571 mark = scan;
1572 while (scan < uend && *scan != '?')
1573 ++scan;
1574 sip_uri_parse_abs_path(outurl, mark, scan);
1580 if (scan < uend && *scan == '?')
1581 sip_uri_parse_abs_query(outurl, scan, uend);
1586 sip_uri_parse_abs_opaque(outurl, scan, uend);