Changeset 5350 for pjproject/trunk/pjnath/src/pjnath-test/sess_auth.c
- Timestamp:
- Jun 21, 2016 6:55:10 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath-test/sess_auth.c
r4537 r5350 230 230 /* Instantiate standard server */ 231 231 static int create_std_server(pj_stun_auth_type auth_type, 232 pj_bool_t responding) 232 pj_bool_t responding, 233 pj_bool_t use_ipv6) 233 234 { 234 235 pj_pool_t *pool; … … 267 268 268 269 /* Create socket */ 269 status = pj_sock_socket( pj_AF_INET(), pj_SOCK_DGRAM(), 0, &server->sock);270 status = pj_sock_socket(GET_AF(use_ipv6), pj_SOCK_DGRAM(), 0, &server->sock); 270 271 if (status != PJ_SUCCESS) { 271 272 destroy_server(); … … 274 275 275 276 /* Bind */ 276 pj_sockaddr_in _init(&server->addr.ipv4, NULL, 0);277 pj_sockaddr_init(GET_AF(use_ipv6), &server->addr, NULL, 0); 277 278 status = pj_sock_bind(server->sock, &server->addr, pj_sockaddr_get_len(&server->addr)); 278 279 if (status != PJ_SUCCESS) { … … 290 291 } 291 292 292 status = pj_gethostip( pj_AF_INET(), &addr);293 status = pj_gethostip(GET_AF(use_ipv6), &addr); 293 294 if (status != PJ_SUCCESS) { 294 295 destroy_server(); … … 453 454 const char *password, 454 455 pj_bool_t dummy_mi, 455 456 pj_bool_t use_ipv6, 456 457 pj_bool_t expected_error, 457 458 pj_status_t expected_code, … … 466 467 pj_stun_tx_data *tdata; 467 468 pj_status_t status; 469 pj_sockaddr addr; 468 470 int rc = 0; 469 471 470 PJ_LOG(3,(THIS_FILE, " %s test ", title));472 PJ_LOG(3,(THIS_FILE, " %s test (%s)", title, use_ipv6?"IPv6":"IPv4")); 471 473 472 474 /* Create client */ … … 494 496 495 497 /* Create client socket */ 496 status = pj_sock_socket( pj_AF_INET(), pj_SOCK_DGRAM(), 0, &client->sock);498 status = pj_sock_socket(GET_AF(use_ipv6), pj_SOCK_DGRAM(), 0, &client->sock); 497 499 if (status != PJ_SUCCESS) { 498 500 destroy_client_server(); … … 501 503 502 504 /* Bind client socket */ 503 status = pj_sock_bind_in(client->sock, 0, 0); 505 pj_sockaddr_init(GET_AF(use_ipv6), &addr, NULL, 0); 506 status = pj_sock_bind(client->sock, &addr, pj_sockaddr_get_len(&addr)); 504 507 if (status != PJ_SUCCESS) { 505 508 destroy_client_server(); … … 529 532 530 533 /* Create the server */ 531 status = create_std_server(server_auth_type, server_responding );534 status = create_std_server(server_auth_type, server_responding, use_ipv6); 532 535 if (status != 0) { 533 536 destroy_client_server(); … … 681 684 done: 682 685 destroy_client_server(); 686 687 /* If IPv6 is enabled, test again for IPv4. */ 688 if ((rc == 0) && use_ipv6) { 689 rc = run_client_test(title, 690 server_responding, 691 server_auth_type, 692 client_auth_type, 693 realm, 694 username, 695 nonce, 696 password, 697 dummy_mi, 698 0, 699 expected_error, 700 expected_code, 701 expected_realm, 702 expected_nonce, 703 more_check); 704 } 705 683 706 return rc; 684 707 } … … 779 802 NULL, // password 780 803 PJ_FALSE, // dummy MI 804 USE_IPV6, // use IPv6 781 805 PJ_TRUE, // expected error 782 806 PJNATH_ESTUNTIMEDOUT,// expected code … … 809 833 NULL, // password 810 834 PJ_FALSE, // dummy MI 835 USE_IPV6, // use IPv6 811 836 PJ_TRUE, // expected error 812 837 PJ_STATUS_FROM_STUN_CODE(400),// expected code … … 833 858 "anotherpass", // password 834 859 PJ_FALSE, // dummy MI 860 USE_IPV6, // use IPv6 835 861 PJ_TRUE, // expected error 836 862 PJ_STATUS_FROM_STUN_CODE(401),// expected code … … 861 887 "anotherpass", // password 862 888 PJ_FALSE, // dummy MI 889 USE_IPV6, // use IPv6 863 890 PJ_TRUE, // expected error 864 891 PJ_STATUS_FROM_STUN_CODE(401),// expected code … … 883 910 NULL, // password 884 911 PJ_TRUE, // dummy MI 912 USE_IPV6, // use IPv6 885 913 PJ_TRUE, // expected error 886 914 PJ_STATUS_FROM_STUN_CODE(400), // expected code … … 903 931 PASSWORD, // password 904 932 PJ_FALSE, // dummy MI 933 USE_IPV6, // use IPv6 905 934 PJ_FALSE, // expected error 906 935 PJ_SUCCESS, // expected code … … 929 958 PASSWORD, // password 930 959 PJ_TRUE, // dummy MI 960 USE_IPV6, // use IPv6 931 961 PJ_TRUE, // expected error 932 962 PJ_STATUS_FROM_STUN_CODE(401), // expected code … … 962 992 NULL, // client password 963 993 PJ_FALSE, // client dummy MI 994 USE_IPV6, // use IPv6 964 995 PJ_TRUE, // expected error 965 996 PJ_STATUS_FROM_STUN_CODE(401), // expected code … … 988 1019 PASSWORD, // client password 989 1020 PJ_TRUE, // client dummy MI 1021 USE_IPV6, // use IPv6 990 1022 PJ_TRUE, // expected error 991 1023 PJ_STATUS_FROM_STUN_CODE(400), // expected code … … 1008 1040 PASSWORD, // client password 1009 1041 PJ_TRUE, // client dummy MI 1042 USE_IPV6, // use IPv6 1010 1043 PJ_TRUE, // expected error 1011 1044 PJ_STATUS_FROM_STUN_CODE(400), // expected code … … 1028 1061 PASSWORD, // client password 1029 1062 PJ_TRUE, // client dummy MI 1063 USE_IPV6, // use IPv6 1030 1064 PJ_TRUE, // expected error 1031 1065 PJ_STATUS_FROM_STUN_CODE(400), // expected code … … 1064 1098 "somepassword", // client password 1065 1099 PJ_FALSE, // client dummy MI 1100 USE_IPV6, // use IPv6 1066 1101 PJ_TRUE, // expected error 1067 1102 PJ_STATUS_FROM_STUN_CODE(401), // expected code … … 1084 1119 PASSWORD, // client password 1085 1120 PJ_FALSE, // client dummy MI 1121 USE_IPV6, // use IPv6 1086 1122 PJ_FALSE, // expected error 1087 1123 0, // expected code … … 1114 1150 PASSWORD, // client password 1115 1151 PJ_FALSE, // client dummy MI 1152 USE_IPV6, // use IPv6 1116 1153 PJ_TRUE, // expected error 1117 1154 PJ_STATUS_FROM_STUN_CODE(401), // expected code
Note: See TracChangeset
for help on using the changeset viewer.