- Timestamp:
- Nov 3, 2009 2:29:31 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pjlib-test/ssl_sock.c
r2971 r2981 31 31 #if INCLUDE_SSLSOCK_TEST 32 32 33 /* Global vars */ 34 static int clients_num; 33 35 34 36 struct send_key { … … 67 69 { 68 70 pj_pool_t *pool; /* pool */ 71 pj_bool_t is_server; /* server role flag */ 72 pj_bool_t is_verbose; /* verbose flag, e.g: cert info */ 69 73 pj_bool_t echo; /* echo received data */ 70 74 pj_status_t err; /* error flag */ … … 110 114 void *read_buf[1]; 111 115 pj_ssl_sock_info info; 112 const char *tmp_st; 113 char buf[64]; 116 char buf1[64], buf2[64]; 114 117 115 118 if (status != PJ_SUCCESS) { … … 124 127 } 125 128 126 pj_sockaddr_print((pj_sockaddr_t*)&info.remote_addr, buf, sizeof(buf), 1); 127 PJ_LOG(3, ("", "...Connected to %s!", buf)); 128 129 /* Print cipher name */ 130 tmp_st = pj_ssl_cipher_name(info.cipher); 131 if (tmp_st == NULL) 132 tmp_st = "[Unknown]"; 133 PJ_LOG(3, ("", ".....Cipher: %s", tmp_st)); 134 135 /* Print certificates info */ 136 if (info.local_cert_info.subject.slen) { 137 PJ_LOG(3, ("", ".....Local certificate info:")); 138 dump_cert_info(".......", &info.local_cert_info); 139 } 140 if (info.remote_cert_info.subject.slen) { 141 PJ_LOG(3, ("", ".....Remote certificate info:")); 142 dump_cert_info(".......", &info.remote_cert_info); 129 pj_sockaddr_print((pj_sockaddr_t*)&info.local_addr, buf1, sizeof(buf1), 1); 130 pj_sockaddr_print((pj_sockaddr_t*)&info.remote_addr, buf2, sizeof(buf2), 1); 131 PJ_LOG(3, ("", "...Connected %s -> %s!", buf1, buf2)); 132 133 if (st->is_verbose) { 134 const char *tmp_st; 135 136 /* Print cipher name */ 137 tmp_st = pj_ssl_cipher_name(info.cipher); 138 if (tmp_st == NULL) 139 tmp_st = "[Unknown]"; 140 PJ_LOG(3, ("", ".....Cipher: %s", tmp_st)); 141 142 /* Print certificates info */ 143 if (info.local_cert_info.subject.slen) { 144 PJ_LOG(3, ("", ".....Local certificate info:")); 145 dump_cert_info(".......", &info.local_cert_info); 146 } 147 if (info.remote_cert_info.subject.slen) { 148 PJ_LOG(3, ("", ".....Remote certificate info:")); 149 dump_cert_info(".......", &info.remote_cert_info); 150 } 143 151 } 144 152 … … 171 179 on_return: 172 180 st->err = status; 181 182 if (st->err != PJ_SUCCESS) { 183 pj_ssl_sock_close(ssock); 184 clients_num--; 185 return PJ_FALSE; 186 } 187 173 188 return PJ_TRUE; 174 189 } … … 180 195 int src_addr_len) 181 196 { 182 struct test_state * st = (struct test_state*)197 struct test_state *parent_st = (struct test_state*) 183 198 pj_ssl_sock_get_user_data(ssock); 199 struct test_state *st; 184 200 void *read_buf[1]; 185 pj_ssl_sock_info info;186 201 pj_status_t status; 187 const char *tmp_st;188 char buf[64];189 202 190 203 PJ_UNUSED_ARG(src_addr_len); 191 204 192 status = pj_ssl_sock_get_info(newsock, &info); 193 if (status != PJ_SUCCESS) { 194 app_perror("...ERROR pj_ssl_sock_get_info()", status); 195 goto on_return; 196 } 197 198 pj_sockaddr_print(src_addr, buf, sizeof(buf), 1); 199 PJ_LOG(3, ("", "...Accepted connection from %s", buf)); 200 201 /* Print cipher name */ 202 tmp_st = pj_ssl_cipher_name(info.cipher); 203 if (tmp_st == NULL) 204 tmp_st = "[Unknown]"; 205 PJ_LOG(3, ("", ".....Cipher: %s", tmp_st)); 206 207 /* Print certificates info */ 208 if (info.local_cert_info.subject.slen) { 209 PJ_LOG(3, ("", ".....Local certificate info:")); 210 dump_cert_info(".......", &info.local_cert_info); 211 } 212 if (info.remote_cert_info.subject.slen) { 213 PJ_LOG(3, ("", ".....Remote certificate info:")); 214 dump_cert_info(".......", &info.remote_cert_info); 215 } 216 205 /* Duplicate parent test state to newly accepted test state */ 206 st = pj_pool_zalloc(parent_st->pool, sizeof(struct test_state)); 207 *st = *parent_st; 217 208 pj_ssl_sock_set_user_data(newsock, st); 209 210 if (st->is_verbose) { 211 pj_ssl_sock_info info; 212 char buf[64]; 213 const char *tmp_st; 214 215 status = pj_ssl_sock_get_info(newsock, &info); 216 if (status != PJ_SUCCESS) { 217 app_perror("...ERROR pj_ssl_sock_get_info()", status); 218 goto on_return; 219 } 220 221 pj_sockaddr_print(src_addr, buf, sizeof(buf), 1); 222 PJ_LOG(3, ("", "...Accepted connection from %s", buf)); 223 224 /* Print cipher name */ 225 tmp_st = pj_ssl_cipher_name(info.cipher); 226 if (tmp_st == NULL) 227 tmp_st = "[Unknown]"; 228 PJ_LOG(3, ("", ".....Cipher: %s", tmp_st)); 229 230 /* Print certificates info */ 231 if (info.local_cert_info.subject.slen) { 232 PJ_LOG(3, ("", ".....Local certificate info:")); 233 dump_cert_info(".......", &info.local_cert_info); 234 } 235 if (info.remote_cert_info.subject.slen) { 236 PJ_LOG(3, ("", ".....Remote certificate info:")); 237 dump_cert_info(".......", &info.remote_cert_info); 238 } 239 } 218 240 219 241 /* Start sending data */ … … 222 244 223 245 size = st->send_str_len - st->sent; 224 status = pj_ssl_sock_send( ssock, (pj_ioqueue_op_key_t*)&st->send_key,246 status = pj_ssl_sock_send(newsock, (pj_ioqueue_op_key_t*)&st->send_key, 225 247 st->send_str + st->sent, &size, 0); 226 248 if (status != PJ_SUCCESS && status != PJ_EPENDING) { … … 245 267 on_return: 246 268 st->err = status; 269 270 if (st->err != PJ_SUCCESS) { 271 pj_ssl_sock_close(newsock); 272 return PJ_FALSE; 273 } 274 247 275 return PJ_TRUE; 248 276 } … … 306 334 st->check_echo_ptr += consumed; 307 335 308 if (st->send_str_len == st->recv) 336 /* Echo received completely */ 337 if (st->send_str_len == st->recv) { 338 pj_ssl_sock_info info; 339 char buf[64]; 340 341 status = pj_ssl_sock_get_info(ssock, &info); 342 if (status != PJ_SUCCESS) { 343 app_perror("...ERROR pj_ssl_sock_get_info()", status); 344 goto on_return; 345 } 346 347 pj_sockaddr_print((pj_sockaddr_t*)&info.local_addr, buf, sizeof(buf), 1); 348 PJ_LOG(3, ("", "...%s successfully recv %d bytes echo", buf, st->recv)); 309 349 st->done = PJ_TRUE; 350 } 310 351 } 311 352 } … … 322 363 on_return: 323 364 st->err = status; 365 366 if (st->err != PJ_SUCCESS || st->done) { 367 pj_ssl_sock_close(ssock); 368 if (!st->is_server) 369 clients_num--; 370 return PJ_FALSE; 371 } 372 324 373 return PJ_TRUE; 325 374 } … … 333 382 PJ_UNUSED_ARG(op_key); 334 383 335 if (sent < 1) {336 st->err ++;384 if (sent < 0) { 385 st->err = -sent; 337 386 } else { 338 387 st->sent += sent; … … 348 397 if (status != PJ_SUCCESS && status != PJ_EPENDING) { 349 398 app_perror("...ERROR pj_ssl_sock_send()", status); 350 st->err ++;399 st->err = status; 351 400 break; 352 401 } … … 357 406 break; 358 407 } 408 } 409 410 if (st->err != PJ_SUCCESS) { 411 pj_ssl_sock_close(ssock); 412 if (!st->is_server) 413 clients_num--; 414 return PJ_FALSE; 359 415 } 360 416 … … 377 433 pj_str_t tmp_st; 378 434 379 pool = pj_pool_create(mem, "http _get", 256, 256, NULL);435 pool = pj_pool_create(mem, "https_get", 256, 256, NULL); 380 436 381 437 status = pj_ioqueue_create(pool, 4, &ioqueue); … … 387 443 state.send_str = HTTP_REQ; 388 444 state.send_str_len = pj_ansi_strlen(state.send_str); 445 state.is_verbose = PJ_TRUE; 389 446 390 447 pj_ssl_sock_param_default(¶m); … … 431 488 432 489 on_return: 433 if (ssock )490 if (ssock && !state.err && !state.done) 434 491 pj_ssl_sock_close(ssock); 435 492 if (ioqueue) … … 442 499 443 500 444 static int echo_test(pj_ssl_sock_proto proto, pj_ssl_cipher srv_cipher,445 pj_ssl_cipher cli_cipher)501 static int echo_test(pj_ssl_sock_proto srv_proto, pj_ssl_sock_proto cli_proto, 502 pj_ssl_cipher srv_cipher, pj_ssl_cipher cli_cipher) 446 503 { 447 504 pj_pool_t *pool = NULL; … … 452 509 struct test_state state_serv = { 0 }; 453 510 struct test_state state_cli = { 0 }; 454 pj_sockaddr laddr, raddr; 455 pj_str_t tmp_st; 511 pj_sockaddr addr, listen_addr; 456 512 pj_ssl_cipher ciphers[1]; 457 513 pj_ssl_cert_t *cert = NULL; 458 514 pj_status_t status; 459 515 460 pool = pj_pool_create(mem, " echo", 256, 256, NULL);516 pool = pj_pool_create(mem, "ssl_echo", 256, 256, NULL); 461 517 462 518 status = pj_ioqueue_create(pool, 4, &ioqueue); … … 481 537 482 538 pj_ssl_sock_param_default(¶m); 483 param.proto = proto;484 539 param.cb.on_accept_complete = &ssl_on_accept_complete; 485 540 param.cb.on_connect_complete = &ssl_on_connect_complete; … … 487 542 param.cb.on_data_sent = &ssl_on_data_sent; 488 543 param.ioqueue = ioqueue; 489 param.ciphers_num = 1;490 544 param.ciphers = ciphers; 491 545 546 /* Init default bind address */ 547 { 548 pj_str_t tmp_st; 549 pj_sockaddr_init(PJ_AF_INET, &addr, pj_strset2(&tmp_st, "127.0.0.1"), 0); 550 } 551 492 552 /* SERVER */ 553 param.proto = srv_proto; 493 554 param.user_data = &state_serv; 555 param.ciphers_num = (srv_cipher == -1)? 0 : 1; 494 556 ciphers[0] = srv_cipher; 495 557 496 558 state_serv.pool = pool; 497 559 state_serv.echo = PJ_TRUE; 560 state_serv.is_server = PJ_TRUE; 561 state_serv.is_verbose = PJ_TRUE; 498 562 499 563 status = pj_ssl_sock_create(pool, ¶m, &ssock_serv); … … 507 571 } 508 572 509 pj_sockaddr_init(PJ_AF_INET, &laddr, pj_strset2(&tmp_st, "127.0.0.1"), 0); 510 status = pj_ssl_sock_start_accept(ssock_serv, pool, &laddr, pj_sockaddr_get_len(&laddr)); 511 if (status != PJ_SUCCESS) { 512 goto on_return; 573 status = pj_ssl_sock_start_accept(ssock_serv, pool, &addr, pj_sockaddr_get_len(&addr)); 574 if (status != PJ_SUCCESS) { 575 goto on_return; 576 } 577 578 /* Get listener address */ 579 { 580 pj_ssl_sock_info info; 581 582 pj_ssl_sock_get_info(ssock_serv, &info); 583 pj_sockaddr_cp(&listen_addr, &info.local_addr); 513 584 } 514 585 515 586 /* CLIENT */ 587 param.proto = cli_proto; 516 588 param.user_data = &state_cli; 589 param.ciphers_num = (cli_cipher == -1)? 0 : 1; 517 590 ciphers[0] = cli_cipher; 518 591 519 592 state_cli.pool = pool; 520 593 state_cli.check_echo = PJ_TRUE; 594 state_cli.is_verbose = PJ_TRUE; 521 595 522 596 { … … 539 613 } 540 614 541 { 542 pj_ssl_sock_info info; 543 544 pj_ssl_sock_get_info(ssock_serv, &info); 545 pj_sockaddr_cp(&raddr, &info.local_addr); 546 } 547 548 status = pj_ssl_sock_start_connect(ssock_cli, pool, &laddr, &raddr, pj_sockaddr_get_len(&raddr)); 615 status = pj_ssl_sock_start_connect(ssock_cli, pool, &addr, &listen_addr, pj_sockaddr_get_len(&addr)); 549 616 if (status == PJ_SUCCESS) { 550 617 ssl_on_connect_complete(ssock_cli, PJ_SUCCESS); … … 576 643 577 644 PJ_LOG(3, ("", "...Done!")); 578 PJ_LOG(3, ("", ".....Server sent/recv: %d/%d bytes", state_serv.sent, state_serv.recv)); 579 PJ_LOG(3, ("", ".....Client sent/recv: %d/%d bytes", state_cli.sent, state_cli.recv)); 645 PJ_LOG(3, ("", ".....Sent/recv: %d/%d bytes", state_cli.sent, state_cli.recv)); 580 646 581 647 on_return: 582 if (ssock_serv) 648 if (ssock_serv) 583 649 pj_ssl_sock_close(ssock_serv); 584 if (ssock_cli )650 if (ssock_cli && !state_cli.err && !state_cli.done) 585 651 pj_ssl_sock_close(ssock_cli); 586 652 if (ioqueue) … … 637 703 638 704 639 /* Set ms_timeout to 0 to disable timer */ 705 /* Raw TCP socket try to connect to SSL socket server, once 706 * connection established, it will just do nothing, SSL socket 707 * server should be able to close the connection after specified 708 * timeout period (set ms_timeout to 0 to disable timer). 709 */ 640 710 static int client_non_ssl(unsigned ms_timeout) 641 711 { … … 651 721 struct test_state state_cli = { 0 }; 652 722 pj_sockaddr listen_addr; 653 pj_str_t tmp_st;654 723 pj_ssl_cert_t *cert = NULL; 655 724 pj_status_t status; 656 725 657 pool = pj_pool_create(mem, " echo", 256, 256, NULL);726 pool = pj_pool_create(mem, "ssl_accept_raw_tcp", 256, 256, NULL); 658 727 659 728 status = pj_ioqueue_create(pool, 4, &ioqueue); … … 694 763 param.user_data = &state_serv; 695 764 state_serv.pool = pool; 765 state_serv.is_server = PJ_TRUE; 766 state_serv.is_verbose = PJ_TRUE; 696 767 697 768 status = pj_ssl_sock_create(pool, ¶m, &ssock_serv); … … 705 776 } 706 777 707 pj_sockaddr_init(PJ_AF_INET, &listen_addr, pj_strset2(&tmp_st, "127.0.0.1"), 0); 778 /* Init bind address */ 779 { 780 pj_str_t tmp_st; 781 pj_sockaddr_init(PJ_AF_INET, &listen_addr, pj_strset2(&tmp_st, "127.0.0.1"), 0); 782 } 783 708 784 status = pj_ssl_sock_start_accept(ssock_serv, pool, &listen_addr, pj_sockaddr_get_len(&listen_addr)); 709 785 if (status != PJ_SUCCESS) { … … 711 787 } 712 788 789 /* Update listener address */ 713 790 { 714 791 pj_ssl_sock_info info; … … 767 844 768 845 on_return: 769 if (ssock_serv) 846 if (ssock_serv) 770 847 pj_ssl_sock_close(ssock_serv); 771 848 if (asock_cli) … … 782 859 783 860 861 static int perf_test(unsigned clients, unsigned ms_handshake_timeout) 862 { 863 pj_pool_t *pool = NULL; 864 pj_ioqueue_t *ioqueue = NULL; 865 pj_timer_heap_t *timer = NULL; 866 pj_ssl_sock_t *ssock_serv = NULL; 867 pj_ssl_sock_t **ssock_cli = NULL; 868 pj_ssl_sock_param param; 869 struct test_state state_serv = { 0 }; 870 struct test_state *state_cli = NULL; 871 pj_sockaddr addr, listen_addr; 872 pj_ssl_cert_t *cert = NULL; 873 pj_status_t status; 874 unsigned i, cli_err = 0, tot_sent = 0, tot_recv = 0; 875 pj_time_val start; 876 877 pool = pj_pool_create(mem, "ssl_perf", 256, 256, NULL); 878 879 status = pj_ioqueue_create(pool, PJ_IOQUEUE_MAX_HANDLES, &ioqueue); 880 if (status != PJ_SUCCESS) { 881 goto on_return; 882 } 883 884 status = pj_timer_heap_create(pool, PJ_IOQUEUE_MAX_HANDLES, &timer); 885 if (status != PJ_SUCCESS) { 886 goto on_return; 887 } 888 889 /* Set cert */ 890 { 891 pj_str_t tmp1, tmp2, tmp3, tmp4; 892 893 status = pj_ssl_cert_load_from_files(pool, 894 pj_strset2(&tmp1, (char*)CERT_CA_FILE), 895 pj_strset2(&tmp2, (char*)CERT_FILE), 896 pj_strset2(&tmp3, (char*)CERT_PRIVKEY_FILE), 897 pj_strset2(&tmp4, (char*)CERT_PRIVKEY_PASS), 898 &cert); 899 if (status != PJ_SUCCESS) { 900 goto on_return; 901 } 902 } 903 904 pj_ssl_sock_param_default(¶m); 905 param.cb.on_accept_complete = &ssl_on_accept_complete; 906 param.cb.on_connect_complete = &ssl_on_connect_complete; 907 param.cb.on_data_read = &ssl_on_data_read; 908 param.cb.on_data_sent = &ssl_on_data_sent; 909 param.ioqueue = ioqueue; 910 param.timer_heap = timer; 911 param.timeout.sec = 0; 912 param.timeout.msec = ms_handshake_timeout; 913 pj_time_val_normalize(¶m.timeout); 914 915 /* Init default bind address */ 916 { 917 pj_str_t tmp_st; 918 pj_sockaddr_init(PJ_AF_INET, &addr, pj_strset2(&tmp_st, "127.0.0.1"), 0); 919 } 920 921 /* SERVER */ 922 param.user_data = &state_serv; 923 924 state_serv.pool = pool; 925 state_serv.echo = PJ_TRUE; 926 state_serv.is_server = PJ_TRUE; 927 928 status = pj_ssl_sock_create(pool, ¶m, &ssock_serv); 929 if (status != PJ_SUCCESS) { 930 goto on_return; 931 } 932 933 status = pj_ssl_sock_set_certificate(ssock_serv, pool, cert); 934 if (status != PJ_SUCCESS) { 935 goto on_return; 936 } 937 938 status = pj_ssl_sock_start_accept(ssock_serv, pool, &addr, pj_sockaddr_get_len(&addr)); 939 if (status != PJ_SUCCESS) { 940 goto on_return; 941 } 942 943 /* Get listening address for clients to connect to */ 944 { 945 pj_ssl_sock_info info; 946 char buf[64]; 947 948 pj_ssl_sock_get_info(ssock_serv, &info); 949 pj_sockaddr_cp(&listen_addr, &info.local_addr); 950 951 pj_sockaddr_print((pj_sockaddr_t*)&listen_addr, buf, sizeof(buf), 1); 952 PJ_LOG(3, ("", "...Listener ready at %s", buf)); 953 } 954 955 956 /* CLIENTS */ 957 clients_num = clients; 958 param.timeout.sec = 0; 959 param.timeout.msec = 0; 960 961 /* Init random seed */ 962 { 963 pj_time_val now; 964 965 pj_gettimeofday(&now); 966 pj_srand((pj_rand()%now.sec) * (pj_rand()%now.msec)); 967 } 968 969 /* Allocate SSL socket pointers and test state */ 970 ssock_cli = pj_pool_calloc(pool, clients, sizeof(pj_ssl_sock_t*)); 971 state_cli = pj_pool_calloc(pool, clients, sizeof(struct test_state)); 972 973 /* Setup clients */ 974 for (i = 0; i < clients; ++i) { 975 param.user_data = &state_cli[i]; 976 977 state_cli[i].pool = pool; 978 state_cli[i].check_echo = PJ_TRUE; 979 state_cli[i].send_str_len = (pj_rand() % 5 + 1) * 1024 + pj_rand() % 1024; 980 state_cli[i].send_str = pj_pool_alloc(pool, state_cli[i].send_str_len); 981 { 982 unsigned j; 983 for (j = 0; j < state_cli[i].send_str_len; ++j) 984 state_cli[i].send_str[j] = (char)(pj_rand() % 256); 985 } 986 987 status = pj_ssl_sock_create(pool, ¶m, &ssock_cli[i]); 988 if (status != PJ_SUCCESS) { 989 app_perror("...ERROR pj_ssl_sock_create()", status); 990 cli_err++; 991 clients_num--; 992 continue; 993 } 994 995 status = pj_ssl_sock_start_connect(ssock_cli[i], pool, &addr, &listen_addr, pj_sockaddr_get_len(&addr)); 996 if (status == PJ_SUCCESS) { 997 ssl_on_connect_complete(ssock_cli[i], PJ_SUCCESS); 998 } else if (status == PJ_EPENDING) { 999 status = PJ_SUCCESS; 1000 } else { 1001 app_perror("...ERROR pj_ssl_sock_create()", status); 1002 pj_ssl_sock_close(ssock_cli[i]); 1003 ssock_cli[i] = NULL; 1004 clients_num--; 1005 cli_err++; 1006 continue; 1007 } 1008 } 1009 1010 /* Get start timestamp */ 1011 pj_gettimeofday(&start); 1012 1013 /* Wait until everything has been sent/received or error */ 1014 while (clients_num) 1015 { 1016 #ifdef PJ_SYMBIAN 1017 pj_symbianos_poll(-1, 1000); 1018 #else 1019 pj_time_val delay = {0, 100}; 1020 pj_ioqueue_poll(ioqueue, &delay); 1021 pj_timer_heap_poll(timer, &delay); 1022 #endif 1023 } 1024 1025 if (state_serv.err != PJ_SUCCESS) { 1026 status = state_serv.err; 1027 goto on_return; 1028 } 1029 1030 PJ_LOG(3, ("", "...Done!")); 1031 1032 /* SSL setup and data transfer duration */ 1033 { 1034 pj_time_val stop; 1035 1036 pj_gettimeofday(&stop); 1037 PJ_TIME_VAL_SUB(stop, start); 1038 1039 PJ_LOG(3, ("", ".....Setup & data transfer duration: %d.%03ds", stop.sec, stop.msec)); 1040 } 1041 1042 /* Check clients status */ 1043 for (i = 0; i < clients; ++i) { 1044 if (state_cli[i].err != PJ_SUCCESS) 1045 cli_err++; 1046 1047 tot_sent += state_cli[1].sent; 1048 tot_recv += state_cli[1].recv; 1049 } 1050 1051 PJ_LOG(3, ("", ".....Clients: %d (%d errors)", clients, cli_err)); 1052 PJ_LOG(3, ("", ".....Total sent/recv: %d/%d bytes", tot_sent, tot_recv)); 1053 1054 on_return: 1055 if (ssock_serv) 1056 pj_ssl_sock_close(ssock_serv); 1057 1058 for (i = 0; i < clients; ++i) { 1059 if (ssock_cli[i] && !state_cli[i].err && !state_cli[i].done) 1060 pj_ssl_sock_close(ssock_cli[i]); 1061 } 1062 if (ioqueue) 1063 pj_ioqueue_destroy(ioqueue); 1064 if (pool) 1065 pj_pool_release(pool); 1066 1067 return status; 1068 } 1069 1070 784 1071 int ssl_sock_test(void) 785 1072 { … … 791 1078 return ret; 792 1079 1080 // Disable this test as requiring internet connection. 793 1081 #if 0 794 1082 PJ_LOG(3,("", "..https client test")); … … 799 1087 800 1088 PJ_LOG(3,("", "..echo test w/ TLSv1 and TLS_RSA_WITH_DES_CBC_SHA cipher")); 801 ret = echo_test(PJ_SSL_SOCK_PROTO_TLS1, TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_DES_CBC_SHA); 1089 ret = echo_test(PJ_SSL_SOCK_PROTO_TLS1, PJ_SSL_SOCK_PROTO_TLS1, 1090 TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_DES_CBC_SHA); 802 1091 if (ret != 0) 803 1092 return ret; 804 1093 805 1094 PJ_LOG(3,("", "..echo test w/ SSLv23 and TLS_RSA_WITH_AES_256_CBC_SHA cipher")); 806 ret = echo_test(PJ_SSL_SOCK_PROTO_SSL23, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA); 1095 ret = echo_test(PJ_SSL_SOCK_PROTO_SSL23, PJ_SSL_SOCK_PROTO_SSL23, 1096 TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA); 807 1097 if (ret != 0) 808 1098 return ret; 809 1099 1100 PJ_LOG(3,("", "..echo test w/ incompatible proto")); 1101 ret = echo_test(PJ_SSL_SOCK_PROTO_TLS1, PJ_SSL_SOCK_PROTO_SSL3, 1102 TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_DES_CBC_SHA); 1103 if (ret == 0) 1104 return PJ_EBUG; 1105 810 1106 PJ_LOG(3,("", "..echo test w/ incompatible ciphers")); 811 ret = echo_test(PJ_SSL_SOCK_PROTO_DEFAULT, TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA); 812 if (ret != PJ_EEOF) 813 return ret; 1107 ret = echo_test(PJ_SSL_SOCK_PROTO_DEFAULT, PJ_SSL_SOCK_PROTO_DEFAULT, 1108 TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA); 1109 if (ret == 0) 1110 return PJ_EBUG; 814 1111 815 1112 PJ_LOG(3,("", "..client non-SSL timeout in 5 secs")); 816 1113 ret = client_non_ssl(5000); 1114 if (ret != 0) 1115 return ret; 1116 1117 PJ_LOG(3,("", "..performance test")); 1118 ret = perf_test(PJ_IOQUEUE_MAX_HANDLES/2 - 1, 0); 817 1119 if (ret != 0) 818 1120 return ret;
Note: See TracChangeset
for help on using the changeset viewer.