Changeset 74
- Timestamp:
- Nov 21, 2005 5:07:18 PM (19 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/build/test_pjsip.dsp
r65 r74 43 43 # PROP Target_Dir "" 44 44 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 45 # ADD CPP /nologo /MD /W3 /Zi /O2 / I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "PJ_WIN32" /D "PJ_M_I386" /FR /FD /c45 # ADD CPP /nologo /MD /W3 /Zi /O2 /Ob2 /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "PJ_WIN32" /D "PJ_M_I386" /FR /FD /c 46 46 # SUBTRACT CPP /YX 47 47 # ADD BASE RSC /l 0x409 /d "NDEBUG" -
pjproject/trunk/pjsip/include/pjsip/sip_parser.h
r65 r74 68 68 { 69 69 PJ_DECL_LIST_MEMBER(struct pjsip_parser_err_report); 70 int except ion_code; /**< Error exception (e.g. PJSIP_SYN_ERR_EXCEPTION) */70 int except_code; /**< Error exception (e.g. PJSIP_SYN_ERR_EXCEPTION) */ 71 71 int line; /**< Line number. */ 72 72 int col; /**< Column number. */ -
pjproject/trunk/pjsip/src/pjsip-simple/event_notify.c
r65 r74 337 337 338 338 } 339 PJ_ DEFAULT{339 PJ_CATCH_ANY { 340 340 PJ_LOG(4,(THIS_FILE, "event_sub%p (%s): caught exception %d during init", 341 341 sub, state[sub->state].ptr, PJ_GET_EXCEPTION())); -
pjproject/trunk/pjsip/src/pjsip-ua/sip_dialog.c
r65 r74 757 757 PJ_LOG(5, (dlg->obj_name, "request data %s created", tdata->obj_name)); 758 758 } 759 PJ_ DEFAULT{759 PJ_CATCH_ANY { 760 760 /* Failed! Delete transmit data. */ 761 761 if (tdata) { -
pjproject/trunk/pjsip/src/pjsip/sip_parser.c
r65 r74 184 184 185 185 /* Case insensitive comparison */ 186 #define parser_stricmp(s tr1, str2) pj_stricmp(&str1, &str2)186 #define parser_stricmp(s1, s2) (pj_stricmp_alnum(&s1, &s2)) 187 187 188 188 … … 552 552 msg = int_parse_msg(&context, err_list); 553 553 } 554 PJ_ DEFAULT{554 PJ_CATCH_ANY { 555 555 msg = NULL; 556 556 } … … 581 581 rdata->msg_info.msg = int_parse_msg(&context, &rdata->msg_info.parse_err); 582 582 } 583 PJ_ DEFAULT{583 PJ_CATCH_ANY { 584 584 rdata->msg_info.msg = NULL; 585 585 } … … 657 657 /* Found a valid Content-Length header. */ 658 658 content_length = pj_strtoul(&str_clen); 659 } 659 } 660 PJ_CATCH_ANY { 661 content_length = -1; 662 } 660 663 PJ_END 661 664 … … 692 695 unsigned option) 693 696 { 694 PJ_USE_EXCEPTION;695 697 pj_scanner scanner; 696 698 pjsip_uri *uri = NULL; 699 PJ_USE_EXCEPTION; 697 700 698 701 init_sip_parser(); … … 703 706 PJ_TRY { 704 707 uri = int_parse_uri_or_name_addr(&scanner, pool, option); 708 } 709 PJ_CATCH_ANY { 710 uri = NULL; 705 711 } 706 712 PJ_END; … … 739 745 pjsip_parser_err_report *err_list) 740 746 { 741 PJ_USE_EXCEPTION;742 747 int ch; 743 748 pjsip_msg *msg; … … 745 750 pj_scanner *scanner = ctx->scanner; 746 751 pj_pool_t *pool = ctx->pool; 752 PJ_USE_EXCEPTION; 747 753 748 754 /* Skip leading newlines. */ … … 801 807 802 808 } 803 PJ_ DEFAULT{809 PJ_CATCH_ANY { 804 810 /* Exception was thrown during parsing. 805 811 * Skip until newline, and parse next header. … … 816 822 817 823 err_info = pj_pool_alloc(pool, sizeof(*err_info)); 818 err_info->except ion_code = PJ_GET_EXCEPTION();824 err_info->except_code = PJ_GET_EXCEPTION(); 819 825 err_info->line = scanner->line; 820 826 err_info->col = scanner->col; … … 1080 1086 { 1081 1087 pj_str_t scheme; 1082 pjsip_url *url ;1088 pjsip_url *url = NULL; 1083 1089 int colon; 1084 1090 int skip_ws = scanner->skip_ws; 1085 int hsep = '?';1086 1091 scanner->skip_ws = 0; 1087 1092 … … 1115 1120 1116 1121 /* Get URL parameters. */ 1117 while ( parse_params && *scanner->curptr == ';' ) { 1122 if (parse_params) { 1123 while (*scanner->curptr == ';' ) { 1118 1124 pj_str_t pname, pvalue; 1119 1125 … … 1144 1150 pj_list_insert_before(&url->other_param, p); 1145 1151 } 1152 } 1146 1153 } 1147 1154 1148 1155 /* Get header params. */ 1149 while (parse_params && *scanner->curptr == hsep) { 1156 if (parse_params && *scanner->curptr == '?') { 1157 do { 1150 1158 pjsip_param *param; 1151 1159 param = pj_pool_alloc(pool, sizeof(pjsip_param)); 1152 1160 int_parse_hparam(scanner, pool, ¶m->name, ¶m->value); 1153 1161 pj_list_insert_before(&url->header_param, param); 1154 hsep = '&';1162 } while (*scanner->curptr == '&'); 1155 1163 } 1156 1164 … … 1775 1783 1776 1784 } 1777 PJ_ DEFAULT{1785 PJ_CATCH_ANY { 1778 1786 hdr = NULL; 1779 1787 } -
pjproject/trunk/pjsip/src/pjsip/sip_uri.c
r65 r74 47 47 const pjsip_param *p = param_list->next; 48 48 while (p != param_list) { 49 if (pj_stricmp (&p->name, name)==0)49 if (pj_stricmp_alnum(&p->name, name)==0) 50 50 return p; 51 51 p = p->next; -
pjproject/trunk/pjsip/src/pjsip/sip_util.c
r65 r74 323 323 contact, call_id, cseq, param_text); 324 324 } 325 PJ_ DEFAULT{325 PJ_CATCH_ANY { 326 326 status = PJ_ENOMEM; 327 327 goto on_error; … … 394 394 contact, call_id, cseq, param_text); 395 395 } 396 PJ_ DEFAULT{396 PJ_CATCH_ANY { 397 397 status = PJ_ENOMEM; 398 398 goto on_error; -
pjproject/trunk/pjsip/src/test-pjsip/uri.c
r65 r74 30 30 #define PARAM_CHAR ALPHANUM MARK "[]/:&+$" 31 31 32 #define POOL_SIZE 400033 #define LOOP_COUNT 1000 32 #define POOL_SIZE 8000 33 #define LOOP_COUNT 10000 34 34 #define AVERAGE_URL_LEN 80 35 35 #define THREAD_COUNT 4 36 36 37 static pj_ uint32_t parse_len;38 static pj_timestamp parse_time, print_time ;37 static pj_highprec_t parse_len, print_len, cmp_len; 38 static pj_timestamp parse_time, print_time, cmp_time; 39 39 40 40 … … 84 84 PJ_SUCCESS, 85 85 "sip:user:password@localhost:5060", 86 &create_uri2, 87 }, 86 &create_uri2, }, 88 87 { 89 88 /* Port is specified should not match unspecified port. */ … … 499 498 /* Parse URI text. */ 500 499 pj_get_timestamp(&t1); 501 parse_len +=entry->len;500 parse_len = parse_len + entry->len; 502 501 parsed_uri = pjsip_parse_uri(pool, entry->str, entry->len, 0); 503 502 if (!parsed_uri) { … … 533 532 s1.slen = len; 534 533 534 print_len = print_len + len; 535 535 pj_get_timestamp(&t2); 536 536 pj_sub_timestamp(&t2, &t1); … … 546 546 547 547 /* Full comparison of parsed URI with reference URI. */ 548 pj_get_timestamp(&t1); 548 549 status = pjsip_uri_cmp(PJSIP_URI_IN_OTHER, parsed_uri, ref_uri); 549 550 if (status != 0) { … … 566 567 } 567 568 569 cmp_len = cmp_len + len; 570 pj_get_timestamp(&t2); 571 pj_sub_timestamp(&t2, &t1); 572 pj_add_timestamp(&cmp_time, &t2); 573 568 574 /* Compare text. */ 569 575 if (pj_strcmp(&s1, &s2) != 0) { … … 582 588 pj_status_t status; 583 589 pj_timestamp zero; 584 pj_highprec_t avg_parse, avg_print; 590 pj_time_val elapsed; 591 pj_highprec_t avg_parse, avg_print, avg_cmp, kbytes; 585 592 586 593 zero.u32.hi = zero.u32.lo = 0; … … 599 606 600 607 PJ_LOG(3,("", " benchmarking...")); 601 parse_len = 0;608 parse_len = print_len = cmp_len = 0; 602 609 parse_time.u32.hi = parse_time.u32.lo = 0; 603 610 print_time.u32.hi = print_time.u32.lo = 0; 604 pool = pjsip_endpt_create_pool(endpt, "", POOL_SIZE, POOL_SIZE);611 cmp_time.u32.hi = cmp_time.u32.lo = 0; 605 612 for (loop=0; loop<LOOP_COUNT; ++loop) { 613 pool = pjsip_endpt_create_pool(endpt, "", POOL_SIZE, POOL_SIZE); 606 614 for (i=0; i<PJ_ARRAY_SIZE(uri_test_array); ++i) { 607 615 status = do_uri_test(pool, &uri_test_array[i]); … … 609 617 PJ_LOG(3,("uri_test", " error %d when testing entry %d", 610 618 status, i)); 619 pjsip_endpt_destroy_pool(endpt, pool); 611 620 goto on_return; 612 621 } 613 622 } 614 } 615 623 pjsip_endpt_destroy_pool(endpt, pool); 624 } 625 626 kbytes = parse_len; 627 pj_highprec_mod(kbytes, 1000000); 628 pj_highprec_div(kbytes, 100000); 629 elapsed = pj_elapsed_time(&zero, &parse_time); 616 630 avg_parse = pj_elapsed_usec(&zero, &parse_time); 617 631 pj_highprec_mul(avg_parse, AVERAGE_URL_LEN); … … 619 633 avg_parse = 1000000 / avg_parse; 620 634 635 PJ_LOG(3,("", " %u.%u MB of urls parsed in %d.%03ds (avg=%d urls/sec)", 636 (unsigned)(parse_len/1000000), (unsigned)kbytes, 637 elapsed.sec, elapsed.msec, 638 (unsigned)avg_parse)); 639 640 kbytes = print_len; 641 pj_highprec_mod(kbytes, 1000000); 642 pj_highprec_div(kbytes, 100000); 643 elapsed = pj_elapsed_time(&zero, &print_time); 621 644 avg_print = pj_elapsed_usec(&zero, &print_time); 622 645 pj_highprec_mul(avg_print, AVERAGE_URL_LEN); … … 624 647 avg_print = 1000000 / avg_print; 625 648 626 PJ_LOG(3,("", " done. Average parse=%d url/sec, print=%d url/sec", 627 (unsigned)avg_parse, (unsigned)avg_print)); 649 PJ_LOG(3,("", " %u.%u MB of urls printed in %d.%03ds (avg=%d urls/sec)", 650 (unsigned)(print_len/1000000), (unsigned)kbytes, 651 elapsed.sec, elapsed.msec, 652 (unsigned)avg_print)); 653 654 kbytes = cmp_len; 655 pj_highprec_mod(kbytes, 1000000); 656 pj_highprec_div(kbytes, 100000); 657 elapsed = pj_elapsed_time(&zero, &cmp_time); 658 avg_cmp = pj_elapsed_usec(&zero, &cmp_time); 659 pj_highprec_mul(avg_cmp, AVERAGE_URL_LEN); 660 pj_highprec_div(avg_cmp, cmp_len); 661 avg_cmp = 1000000 / avg_cmp; 662 663 PJ_LOG(3,("", " %u.%u MB of urls compared in %d.%03ds (avg=%d urls/sec)", 664 (unsigned)(cmp_len/1000000), (unsigned)kbytes, 665 elapsed.sec, elapsed.msec, 666 (unsigned)avg_cmp)); 628 667 629 668 PJ_LOG(3,("", " multithreaded test")); … … 631 670 632 671 on_return: 633 pjsip_endpt_destroy_pool(endpt, pool);634 672 return status; 635 673 }
Note: See TracChangeset
for help on using the changeset viewer.