diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-28 21:30:39 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-30 23:35:50 +0000 |
commit | 92ffad1a72bc8c422426d52ac408bd71242dd047 (patch) | |
tree | f592f353068dd2043525dd2cc04d6124a4ed4bc4 /auto_tests/TCP_test.c | |
parent | 623e9ac331df7323660e21c8a2226523a5ee713b (diff) |
Use nullptr as NULL pointer constant instead of NULL or 0.
This changes only code, no string literals or comments.
Diffstat (limited to 'auto_tests/TCP_test.c')
-rw-r--r-- | auto_tests/TCP_test.c | 102 |
1 files changed, 53 insertions, 49 deletions
diff --git a/auto_tests/TCP_test.c b/auto_tests/TCP_test.c index 79d83800..26a95942 100644 --- a/auto_tests/TCP_test.c +++ b/auto_tests/TCP_test.c | |||
@@ -1,4 +1,6 @@ | |||
1 | #ifndef _XOPEN_SOURCE | ||
1 | #define _XOPEN_SOURCE 600 | 2 | #define _XOPEN_SOURCE 600 |
3 | #endif | ||
2 | 4 | ||
3 | #ifdef HAVE_CONFIG_H | 5 | #ifdef HAVE_CONFIG_H |
4 | #include "config.h" | 6 | #include "config.h" |
@@ -29,6 +31,7 @@ | |||
29 | # undef TOX_AF_INET6 | 31 | # undef TOX_AF_INET6 |
30 | # define TOX_AF_INET6 TOX_AF_INET | 32 | # define TOX_AF_INET6 TOX_AF_INET |
31 | # define get_ip6_loopback get_ip4_loopback | 33 | # define get_ip6_loopback get_ip4_loopback |
34 | # define IP6 IP4 | ||
32 | #endif | 35 | #endif |
33 | 36 | ||
34 | static inline IP get_loopback() | 37 | static inline IP get_loopback() |
@@ -51,8 +54,8 @@ START_TEST(test_basic) | |||
51 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; | 54 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; |
52 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; | 55 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; |
53 | crypto_new_keypair(self_public_key, self_secret_key); | 56 | crypto_new_keypair(self_public_key, self_secret_key); |
54 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, NULL); | 57 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, nullptr); |
55 | ck_assert_msg(tcp_s != NULL, "Failed to create TCP relay server"); | 58 | ck_assert_msg(tcp_s != nullptr, "Failed to create TCP relay server"); |
56 | ck_assert_msg(tcp_server_listen_count(tcp_s) == NUM_PORTS, "Failed to bind to all ports"); | 59 | ck_assert_msg(tcp_server_listen_count(tcp_s) == NUM_PORTS, "Failed to bind to all ports"); |
57 | 60 | ||
58 | Socket sock = net_socket(TOX_AF_INET6, TOX_SOCK_STREAM, TOX_PROTO_TCP); | 61 | Socket sock = net_socket(TOX_AF_INET6, TOX_SOCK_STREAM, TOX_PROTO_TCP); |
@@ -236,8 +239,8 @@ START_TEST(test_some) | |||
236 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; | 239 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; |
237 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; | 240 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; |
238 | crypto_new_keypair(self_public_key, self_secret_key); | 241 | crypto_new_keypair(self_public_key, self_secret_key); |
239 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, NULL); | 242 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, nullptr); |
240 | ck_assert_msg(tcp_s != NULL, "Failed to create TCP relay server"); | 243 | ck_assert_msg(tcp_s != nullptr, "Failed to create TCP relay server"); |
241 | ck_assert_msg(tcp_server_listen_count(tcp_s) == NUM_PORTS, "Failed to bind to all ports"); | 244 | ck_assert_msg(tcp_server_listen_count(tcp_s) == NUM_PORTS, "Failed to bind to all ports"); |
242 | 245 | ||
243 | struct sec_TCP_con *con1 = new_TCP_con(tcp_s); | 246 | struct sec_TCP_con *con1 = new_TCP_con(tcp_s); |
@@ -413,8 +416,8 @@ START_TEST(test_client) | |||
413 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; | 416 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; |
414 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; | 417 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; |
415 | crypto_new_keypair(self_public_key, self_secret_key); | 418 | crypto_new_keypair(self_public_key, self_secret_key); |
416 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, NULL); | 419 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, nullptr); |
417 | ck_assert_msg(tcp_s != NULL, "Failed to create TCP relay server"); | 420 | ck_assert_msg(tcp_s != nullptr, "Failed to create TCP relay server"); |
418 | ck_assert_msg(tcp_server_listen_count(tcp_s) == NUM_PORTS, "Failed to bind to all ports"); | 421 | ck_assert_msg(tcp_server_listen_count(tcp_s) == NUM_PORTS, "Failed to bind to all ports"); |
419 | 422 | ||
420 | uint8_t f_public_key[CRYPTO_PUBLIC_KEY_SIZE]; | 423 | uint8_t f_public_key[CRYPTO_PUBLIC_KEY_SIZE]; |
@@ -424,23 +427,23 @@ START_TEST(test_client) | |||
424 | 427 | ||
425 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); | 428 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); |
426 | ip_port_tcp_s.ip = get_loopback(); | 429 | ip_port_tcp_s.ip = get_loopback(); |
427 | TCP_Client_Connection *conn = new_TCP_connection(ip_port_tcp_s, self_public_key, f_public_key, f_secret_key, 0); | 430 | TCP_Client_Connection *conn = new_TCP_connection(ip_port_tcp_s, self_public_key, f_public_key, f_secret_key, nullptr); |
428 | c_sleep(50); | 431 | c_sleep(50); |
429 | do_TCP_connection(conn, NULL); | 432 | do_TCP_connection(conn, nullptr); |
430 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_UNCONFIRMED, "Wrong status. Expected: %u, is: %u", | 433 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_UNCONFIRMED, "Wrong status. Expected: %u, is: %u", |
431 | TCP_CLIENT_UNCONFIRMED, tcp_con_status(conn)); | 434 | TCP_CLIENT_UNCONFIRMED, tcp_con_status(conn)); |
432 | c_sleep(50); | 435 | c_sleep(50); |
433 | do_TCP_server(tcp_s); | 436 | do_TCP_server(tcp_s); |
434 | c_sleep(50); | 437 | c_sleep(50); |
435 | do_TCP_connection(conn, NULL); | 438 | do_TCP_connection(conn, nullptr); |
436 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONFIRMED, "Wrong status. Expected: %u, is: %u", TCP_CLIENT_CONFIRMED, | 439 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONFIRMED, "Wrong status. Expected: %u, is: %u", TCP_CLIENT_CONFIRMED, |
437 | tcp_con_status(conn)); | 440 | tcp_con_status(conn)); |
438 | c_sleep(500); | 441 | c_sleep(500); |
439 | do_TCP_connection(conn, NULL); | 442 | do_TCP_connection(conn, nullptr); |
440 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONFIRMED, "Wrong status. Expected: %u, is: %u", TCP_CLIENT_CONFIRMED, | 443 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONFIRMED, "Wrong status. Expected: %u, is: %u", TCP_CLIENT_CONFIRMED, |
441 | tcp_con_status(conn)); | 444 | tcp_con_status(conn)); |
442 | c_sleep(500); | 445 | c_sleep(500); |
443 | do_TCP_connection(conn, NULL); | 446 | do_TCP_connection(conn, nullptr); |
444 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONFIRMED, "Wrong status. Expected: %u, is: %u", TCP_CLIENT_CONFIRMED, | 447 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONFIRMED, "Wrong status. Expected: %u, is: %u", TCP_CLIENT_CONFIRMED, |
445 | tcp_con_status(conn)); | 448 | tcp_con_status(conn)); |
446 | do_TCP_server(tcp_s); | 449 | do_TCP_server(tcp_s); |
@@ -452,20 +455,21 @@ START_TEST(test_client) | |||
452 | uint8_t f2_secret_key[CRYPTO_SECRET_KEY_SIZE]; | 455 | uint8_t f2_secret_key[CRYPTO_SECRET_KEY_SIZE]; |
453 | crypto_new_keypair(f2_public_key, f2_secret_key); | 456 | crypto_new_keypair(f2_public_key, f2_secret_key); |
454 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); | 457 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); |
455 | TCP_Client_Connection *conn2 = new_TCP_connection(ip_port_tcp_s, self_public_key, f2_public_key, f2_secret_key, 0); | 458 | TCP_Client_Connection *conn2 = new_TCP_connection( |
459 | ip_port_tcp_s, self_public_key, f2_public_key, f2_secret_key, nullptr); | ||
456 | routing_response_handler(conn, response_callback, (char *)conn + 2); | 460 | routing_response_handler(conn, response_callback, (char *)conn + 2); |
457 | routing_status_handler(conn, status_callback, (void *)2); | 461 | routing_status_handler(conn, status_callback, (void *)2); |
458 | routing_data_handler(conn, data_callback, (void *)3); | 462 | routing_data_handler(conn, data_callback, (void *)3); |
459 | oob_data_handler(conn, oob_data_callback, (void *)4); | 463 | oob_data_handler(conn, oob_data_callback, (void *)4); |
460 | oob_data_callback_good = response_callback_good = status_callback_good = data_callback_good = 0; | 464 | oob_data_callback_good = response_callback_good = status_callback_good = data_callback_good = 0; |
461 | c_sleep(50); | 465 | c_sleep(50); |
462 | do_TCP_connection(conn, NULL); | 466 | do_TCP_connection(conn, nullptr); |
463 | do_TCP_connection(conn2, NULL); | 467 | do_TCP_connection(conn2, nullptr); |
464 | c_sleep(50); | 468 | c_sleep(50); |
465 | do_TCP_server(tcp_s); | 469 | do_TCP_server(tcp_s); |
466 | c_sleep(50); | 470 | c_sleep(50); |
467 | do_TCP_connection(conn, NULL); | 471 | do_TCP_connection(conn, nullptr); |
468 | do_TCP_connection(conn2, NULL); | 472 | do_TCP_connection(conn2, nullptr); |
469 | c_sleep(50); | 473 | c_sleep(50); |
470 | uint8_t data[5] = {1, 2, 3, 4, 5}; | 474 | uint8_t data[5] = {1, 2, 3, 4, 5}; |
471 | memcpy(oob_pubkey, f2_public_key, CRYPTO_PUBLIC_KEY_SIZE); | 475 | memcpy(oob_pubkey, f2_public_key, CRYPTO_PUBLIC_KEY_SIZE); |
@@ -475,8 +479,8 @@ START_TEST(test_client) | |||
475 | c_sleep(50); | 479 | c_sleep(50); |
476 | do_TCP_server(tcp_s); | 480 | do_TCP_server(tcp_s); |
477 | c_sleep(50); | 481 | c_sleep(50); |
478 | do_TCP_connection(conn, NULL); | 482 | do_TCP_connection(conn, nullptr); |
479 | do_TCP_connection(conn2, NULL); | 483 | do_TCP_connection(conn2, nullptr); |
480 | ck_assert_msg(oob_data_callback_good == 1, "oob callback not called"); | 484 | ck_assert_msg(oob_data_callback_good == 1, "oob callback not called"); |
481 | ck_assert_msg(response_callback_good == 1, "response callback not called"); | 485 | ck_assert_msg(response_callback_good == 1, "response callback not called"); |
482 | ck_assert_msg(public_key_cmp(response_callback_public_key, f2_public_key) == 0, "wrong public key"); | 486 | ck_assert_msg(public_key_cmp(response_callback_public_key, f2_public_key) == 0, "wrong public key"); |
@@ -489,16 +493,16 @@ START_TEST(test_client) | |||
489 | c_sleep(50); | 493 | c_sleep(50); |
490 | do_TCP_server(tcp_s); | 494 | do_TCP_server(tcp_s); |
491 | c_sleep(50); | 495 | c_sleep(50); |
492 | do_TCP_connection(conn, NULL); | 496 | do_TCP_connection(conn, nullptr); |
493 | do_TCP_connection(conn2, NULL); | 497 | do_TCP_connection(conn2, nullptr); |
494 | ck_assert_msg(data_callback_good == 1, "data callback not called"); | 498 | ck_assert_msg(data_callback_good == 1, "data callback not called"); |
495 | status_callback_good = 0; | 499 | status_callback_good = 0; |
496 | send_disconnect_request(conn2, 0); | 500 | send_disconnect_request(conn2, 0); |
497 | c_sleep(50); | 501 | c_sleep(50); |
498 | do_TCP_server(tcp_s); | 502 | do_TCP_server(tcp_s); |
499 | c_sleep(50); | 503 | c_sleep(50); |
500 | do_TCP_connection(conn, NULL); | 504 | do_TCP_connection(conn, nullptr); |
501 | do_TCP_connection(conn2, NULL); | 505 | do_TCP_connection(conn2, nullptr); |
502 | ck_assert_msg(status_callback_good == 1, "status callback not called"); | 506 | ck_assert_msg(status_callback_good == 1, "status callback not called"); |
503 | ck_assert_msg(status_callback_status == 1, "wrong status"); | 507 | ck_assert_msg(status_callback_status == 1, "wrong status"); |
504 | kill_TCP_server(tcp_s); | 508 | kill_TCP_server(tcp_s); |
@@ -521,17 +525,17 @@ START_TEST(test_client_invalid) | |||
521 | 525 | ||
522 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); | 526 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); |
523 | ip_port_tcp_s.ip = get_loopback(); | 527 | ip_port_tcp_s.ip = get_loopback(); |
524 | TCP_Client_Connection *conn = new_TCP_connection(ip_port_tcp_s, self_public_key, f_public_key, f_secret_key, 0); | 528 | TCP_Client_Connection *conn = new_TCP_connection(ip_port_tcp_s, self_public_key, f_public_key, f_secret_key, nullptr); |
525 | c_sleep(50); | 529 | c_sleep(50); |
526 | do_TCP_connection(conn, NULL); | 530 | do_TCP_connection(conn, nullptr); |
527 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONNECTING, "Wrong status. Expected: %u, is: %u", | 531 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONNECTING, "Wrong status. Expected: %u, is: %u", |
528 | TCP_CLIENT_CONNECTING, tcp_con_status(conn)); | 532 | TCP_CLIENT_CONNECTING, tcp_con_status(conn)); |
529 | c_sleep(5000); | 533 | c_sleep(5000); |
530 | do_TCP_connection(conn, NULL); | 534 | do_TCP_connection(conn, nullptr); |
531 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONNECTING, "Wrong status. Expected: %u, is: %u", | 535 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_CONNECTING, "Wrong status. Expected: %u, is: %u", |
532 | TCP_CLIENT_CONNECTING, tcp_con_status(conn)); | 536 | TCP_CLIENT_CONNECTING, tcp_con_status(conn)); |
533 | c_sleep(6000); | 537 | c_sleep(6000); |
534 | do_TCP_connection(conn, NULL); | 538 | do_TCP_connection(conn, nullptr); |
535 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_DISCONNECTED, "Wrong status. Expected: %u, is: %u", | 539 | ck_assert_msg(tcp_con_status(conn) == TCP_CLIENT_DISCONNECTED, "Wrong status. Expected: %u, is: %u", |
536 | TCP_CLIENT_DISCONNECTED, tcp_con_status(conn)); | 540 | TCP_CLIENT_DISCONNECTED, tcp_con_status(conn)); |
537 | 541 | ||
@@ -572,7 +576,7 @@ START_TEST(test_tcp_connection) | |||
572 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; | 576 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; |
573 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; | 577 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; |
574 | crypto_new_keypair(self_public_key, self_secret_key); | 578 | crypto_new_keypair(self_public_key, self_secret_key); |
575 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, NULL); | 579 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, nullptr); |
576 | ck_assert_msg(public_key_cmp(tcp_server_public_key(tcp_s), self_public_key) == 0, "Wrong public key"); | 580 | ck_assert_msg(public_key_cmp(tcp_server_public_key(tcp_s), self_public_key) == 0, "Wrong public key"); |
577 | 581 | ||
578 | TCP_Proxy_Info proxy_info; | 582 | TCP_Proxy_Info proxy_info; |
@@ -607,18 +611,18 @@ START_TEST(test_tcp_connection) | |||
607 | c_sleep(50); | 611 | c_sleep(50); |
608 | do_TCP_server(tcp_s); | 612 | do_TCP_server(tcp_s); |
609 | c_sleep(50); | 613 | c_sleep(50); |
610 | do_tcp_connections(tc_1, NULL); | 614 | do_tcp_connections(tc_1, nullptr); |
611 | do_tcp_connections(tc_2, NULL); | 615 | do_tcp_connections(tc_2, nullptr); |
612 | c_sleep(50); | 616 | c_sleep(50); |
613 | do_TCP_server(tcp_s); | 617 | do_TCP_server(tcp_s); |
614 | c_sleep(50); | 618 | c_sleep(50); |
615 | do_tcp_connections(tc_1, NULL); | 619 | do_tcp_connections(tc_1, nullptr); |
616 | do_tcp_connections(tc_2, NULL); | 620 | do_tcp_connections(tc_2, nullptr); |
617 | c_sleep(50); | 621 | c_sleep(50); |
618 | do_TCP_server(tcp_s); | 622 | do_TCP_server(tcp_s); |
619 | c_sleep(50); | 623 | c_sleep(50); |
620 | do_tcp_connections(tc_1, NULL); | 624 | do_tcp_connections(tc_1, nullptr); |
621 | do_tcp_connections(tc_2, NULL); | 625 | do_tcp_connections(tc_2, nullptr); |
622 | 626 | ||
623 | int ret = send_packet_tcp_connection(tc_1, 0, (const uint8_t *)"Gentoo", 6); | 627 | int ret = send_packet_tcp_connection(tc_1, 0, (const uint8_t *)"Gentoo", 6); |
624 | ck_assert_msg(ret == 0, "could not send packet."); | 628 | ck_assert_msg(ret == 0, "could not send packet."); |
@@ -628,8 +632,8 @@ START_TEST(test_tcp_connection) | |||
628 | do_TCP_server(tcp_s); | 632 | do_TCP_server(tcp_s); |
629 | c_sleep(50); | 633 | c_sleep(50); |
630 | 634 | ||
631 | do_tcp_connections(tc_1, NULL); | 635 | do_tcp_connections(tc_1, nullptr); |
632 | do_tcp_connections(tc_2, NULL); | 636 | do_tcp_connections(tc_2, nullptr); |
633 | 637 | ||
634 | ck_assert_msg(tcp_data_callback_called, "could not recv packet."); | 638 | ck_assert_msg(tcp_data_callback_called, "could not recv packet."); |
635 | ck_assert_msg(tcp_connection_to_online_tcp_relays(tc_1, 0) == 1, "Wrong number of connected relays"); | 639 | ck_assert_msg(tcp_connection_to_online_tcp_relays(tc_1, 0) == 1, "Wrong number of connected relays"); |
@@ -638,8 +642,8 @@ START_TEST(test_tcp_connection) | |||
638 | c_sleep(50); | 642 | c_sleep(50); |
639 | do_TCP_server(tcp_s); | 643 | do_TCP_server(tcp_s); |
640 | c_sleep(50); | 644 | c_sleep(50); |
641 | do_tcp_connections(tc_1, NULL); | 645 | do_tcp_connections(tc_1, nullptr); |
642 | do_tcp_connections(tc_2, NULL); | 646 | do_tcp_connections(tc_2, nullptr); |
643 | 647 | ||
644 | ck_assert_msg(send_packet_tcp_connection(tc_1, 0, (const uint8_t *)"Gentoo", 6) == -1, "could send packet."); | 648 | ck_assert_msg(send_packet_tcp_connection(tc_1, 0, (const uint8_t *)"Gentoo", 6) == -1, "could send packet."); |
645 | ck_assert_msg(kill_tcp_connection_to(tc_2, 0) == 0, "could not kill connection to\n"); | 649 | ck_assert_msg(kill_tcp_connection_to(tc_2, 0) == 0, "could not kill connection to\n"); |
@@ -680,7 +684,7 @@ START_TEST(test_tcp_connection2) | |||
680 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; | 684 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; |
681 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; | 685 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; |
682 | crypto_new_keypair(self_public_key, self_secret_key); | 686 | crypto_new_keypair(self_public_key, self_secret_key); |
683 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, NULL); | 687 | TCP_Server *tcp_s = new_TCP_server(USE_IPV6, NUM_PORTS, ports, self_secret_key, nullptr); |
684 | ck_assert_msg(public_key_cmp(tcp_server_public_key(tcp_s), self_public_key) == 0, "Wrong public key"); | 688 | ck_assert_msg(public_key_cmp(tcp_server_public_key(tcp_s), self_public_key) == 0, "Wrong public key"); |
685 | 689 | ||
686 | TCP_Proxy_Info proxy_info; | 690 | TCP_Proxy_Info proxy_info; |
@@ -709,18 +713,18 @@ START_TEST(test_tcp_connection2) | |||
709 | c_sleep(50); | 713 | c_sleep(50); |
710 | do_TCP_server(tcp_s); | 714 | do_TCP_server(tcp_s); |
711 | c_sleep(50); | 715 | c_sleep(50); |
712 | do_tcp_connections(tc_1, NULL); | 716 | do_tcp_connections(tc_1, nullptr); |
713 | do_tcp_connections(tc_2, NULL); | 717 | do_tcp_connections(tc_2, nullptr); |
714 | c_sleep(50); | 718 | c_sleep(50); |
715 | do_TCP_server(tcp_s); | 719 | do_TCP_server(tcp_s); |
716 | c_sleep(50); | 720 | c_sleep(50); |
717 | do_tcp_connections(tc_1, NULL); | 721 | do_tcp_connections(tc_1, nullptr); |
718 | do_tcp_connections(tc_2, NULL); | 722 | do_tcp_connections(tc_2, nullptr); |
719 | c_sleep(50); | 723 | c_sleep(50); |
720 | do_TCP_server(tcp_s); | 724 | do_TCP_server(tcp_s); |
721 | c_sleep(50); | 725 | c_sleep(50); |
722 | do_tcp_connections(tc_1, NULL); | 726 | do_tcp_connections(tc_1, nullptr); |
723 | do_tcp_connections(tc_2, NULL); | 727 | do_tcp_connections(tc_2, nullptr); |
724 | 728 | ||
725 | int ret = send_packet_tcp_connection(tc_1, 0, (const uint8_t *)"Gentoo", 6); | 729 | int ret = send_packet_tcp_connection(tc_1, 0, (const uint8_t *)"Gentoo", 6); |
726 | ck_assert_msg(ret == 0, "could not send packet."); | 730 | ck_assert_msg(ret == 0, "could not send packet."); |
@@ -731,8 +735,8 @@ START_TEST(test_tcp_connection2) | |||
731 | do_TCP_server(tcp_s); | 735 | do_TCP_server(tcp_s); |
732 | c_sleep(50); | 736 | c_sleep(50); |
733 | 737 | ||
734 | do_tcp_connections(tc_1, NULL); | 738 | do_tcp_connections(tc_1, nullptr); |
735 | do_tcp_connections(tc_2, NULL); | 739 | do_tcp_connections(tc_2, nullptr); |
736 | 740 | ||
737 | ck_assert_msg(tcp_oobdata_callback_called, "could not recv packet."); | 741 | ck_assert_msg(tcp_oobdata_callback_called, "could not recv packet."); |
738 | 742 | ||
@@ -740,8 +744,8 @@ START_TEST(test_tcp_connection2) | |||
740 | do_TCP_server(tcp_s); | 744 | do_TCP_server(tcp_s); |
741 | c_sleep(50); | 745 | c_sleep(50); |
742 | 746 | ||
743 | do_tcp_connections(tc_1, NULL); | 747 | do_tcp_connections(tc_1, nullptr); |
744 | do_tcp_connections(tc_2, NULL); | 748 | do_tcp_connections(tc_2, nullptr); |
745 | 749 | ||
746 | ck_assert_msg(tcp_data_callback_called, "could not recv packet."); | 750 | ck_assert_msg(tcp_data_callback_called, "could not recv packet."); |
747 | ck_assert_msg(kill_tcp_connection_to(tc_1, 0) == 0, "could not kill connection to\n"); | 751 | ck_assert_msg(kill_tcp_connection_to(tc_1, 0) == 0, "could not kill connection to\n"); |
@@ -767,7 +771,7 @@ static Suite *TCP_suite(void) | |||
767 | 771 | ||
768 | int main(int argc, char *argv[]) | 772 | int main(int argc, char *argv[]) |
769 | { | 773 | { |
770 | srand((unsigned int) time(NULL)); | 774 | srand((unsigned int) time(nullptr)); |
771 | 775 | ||
772 | Suite *TCP = TCP_suite(); | 776 | Suite *TCP = TCP_suite(); |
773 | SRunner *test_runner = srunner_create(TCP); | 777 | SRunner *test_runner = srunner_create(TCP); |