Changeset 1610 for pjproject/trunk/pjsip/src/test-pjsip/msg_test.c
- Timestamp:
- Dec 2, 2007 3:40:52 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/test-pjsip/msg_test.c
r1451 r1610 701 701 702 702 703 #if INCLUDE_BENCHMARKS 703 704 static int msg_benchmark(unsigned *p_detect, unsigned *p_parse, 704 705 unsigned *p_print) … … 776 777 return status; 777 778 } 779 #endif /* INCLUDE_BENCHMARKS */ 778 780 779 781 /*****************************************************************************/ … … 796 798 static int hdr_test_to(pjsip_hdr *h); 797 799 static int hdr_test_via(pjsip_hdr *h); 798 800 static int hdr_test_via_ipv6_1(pjsip_hdr *h); 801 static int hdr_test_via_ipv6_2(pjsip_hdr *h); 802 static int hdr_test_via_ipv6_3(pjsip_hdr *h); 799 803 800 804 801 805 #define GENERIC_PARAM "p0=a;p1=\"ab:;cd\";p2=ab%3acd;p3" 802 806 #define GENERIC_PARAM_PARSED "p0=a;p1=\"ab:;cd\";p2=ab:cd;p3" 803 #define PARAM_CHAR " []/:&+$"807 #define PARAM_CHAR "][/:&+$" 804 808 #define SIMPLE_ADDR_SPEC "sip:host" 805 809 #define ADDR_SPEC SIMPLE_ADDR_SPEC ";"PARAM_CHAR"="PARAM_CHAR ";p1=\";\"" … … 948 952 "SIP/2.0/XYZ host" ";" GENERIC_PARAM, 949 953 &hdr_test_via 954 }, 955 956 { 957 /* Via with IPv6 */ 958 "Via", "v", 959 "SIP/2.0/UDP [::1]", 960 &hdr_test_via_ipv6_1 961 }, 962 963 { 964 /* Via with IPv6 */ 965 "Via", "v", 966 "SIP/2.0/UDP [::1]:5061", 967 &hdr_test_via_ipv6_2 968 }, 969 970 { 971 /* Via with IPv6 */ 972 "Via", "v", 973 "SIP/2.0/UDP [::1];rport=5061;received=::2", 974 &hdr_test_via_ipv6_3 950 975 } 951 976 }; … … 1112 1137 1113 1138 /* 1114 #define PARAM_CHAR " []/:&+$"1139 #define PARAM_CHAR "][/:&+$" 1115 1140 #define SIMPLE_ADDR_SPEC "sip:host" 1116 1141 #define ADDR_SPEC SIMPLE_ADDR_SPEC ";"PARAM_CHAR"="PARAM_CHAR ";p1=\";\"" … … 1433 1458 } 1434 1459 1460 1461 /* 1462 "SIP/2.0/UDP [::1]" 1463 */ 1464 static int hdr_test_via_ipv6_1(pjsip_hdr *h) 1465 { 1466 pjsip_via_hdr *hdr = (pjsip_via_hdr*)h; 1467 1468 if (h->type != PJSIP_H_VIA) 1469 return -2610; 1470 1471 if (pj_strcmp2(&hdr->transport, "UDP")) 1472 return -2615; 1473 1474 if (pj_strcmp2(&hdr->sent_by.host, "::1")) 1475 return -2620; 1476 1477 if (hdr->sent_by.port != 0) 1478 return -2630; 1479 1480 return 0; 1481 } 1482 1483 /* "SIP/2.0/UDP [::1]:5061" */ 1484 static int hdr_test_via_ipv6_2(pjsip_hdr *h) 1485 { 1486 pjsip_via_hdr *hdr = (pjsip_via_hdr*)h; 1487 1488 if (h->type != PJSIP_H_VIA) 1489 return -2710; 1490 1491 if (pj_strcmp2(&hdr->transport, "UDP")) 1492 return -2715; 1493 1494 if (pj_strcmp2(&hdr->sent_by.host, "::1")) 1495 return -2720; 1496 1497 if (hdr->sent_by.port != 5061) 1498 return -2730; 1499 1500 return 0; 1501 } 1502 1503 /* "SIP/2.0/UDP [::1];rport=5061;received=::2" */ 1504 static int hdr_test_via_ipv6_3(pjsip_hdr *h) 1505 { 1506 pjsip_via_hdr *hdr = (pjsip_via_hdr*)h; 1507 1508 if (h->type != PJSIP_H_VIA) 1509 return -2810; 1510 1511 if (pj_strcmp2(&hdr->transport, "UDP")) 1512 return -2815; 1513 1514 if (pj_strcmp2(&hdr->sent_by.host, "::1")) 1515 return -2820; 1516 1517 if (hdr->sent_by.port != 0) 1518 return -2830; 1519 1520 if (pj_strcmp2(&hdr->recvd_param, "::2")) 1521 return -2840; 1522 1523 if (hdr->rport_param != 5061) 1524 return -2850; 1525 1526 return 0; 1527 } 1435 1528 1436 1529 static int hdr_test(void) … … 1534 1627 pj_status_t status; 1535 1628 1629 status = hdr_test(); 1630 if (status != 0) 1631 return status; 1632 1536 1633 status = simple_test(); 1537 1634 if (status != PJ_SUCCESS) 1538 1635 return status; 1539 1636 1540 status = hdr_test(); 1541 if (status != 0) 1542 return status; 1543 1637 #if INCLUDE_BENCHMARKS 1544 1638 for (i=0; i<COUNT; ++i) { 1545 1639 PJ_LOG(3,(THIS_FILE, " benchmarking (%d of %d)..", i+1, COUNT)); … … 1609 1703 "The value is derived from msg-print-per-sec above."); 1610 1704 1705 #endif /* INCLUDE_BENCHMARKS */ 1611 1706 1612 1707 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.