|
unbound 0.1
|
Tests the tcp_reuse functionality. More...
#include "config.h"#include "testcode/unitmain.h"#include "util/log.h"#include "util/net_help.h"#include "util/random.h"#include "services/outside_network.h"Macros | |
| #define | MAX_TCP_WAITING_NODES 5 |
Functions | |
| static void | tcpid_addmore (struct reuse_tcp *reuse, struct outside_network *outnet, unsigned int addnum) |
| add number of new IDs to the reuse tree, randomly chosen | |
| static void | tcpid_fillup (struct reuse_tcp *reuse, struct outside_network *outnet) |
| fill up the reuse ID tree and test assertions | |
| static void | tcpid_test (void) |
| test TCP ID selection | |
| static void | check_tree_and_list (struct outside_network *outnet, int present) |
| check that the tree has present number of nodes and the LRU is linked properly. | |
| static int | create_pending_tcp (struct outside_network *outnet) |
| creates pending_tcp. | |
| static void | empty_tree (struct outside_network *outnet) |
| empty the tcp_reuse tree and LRU list | |
| static void | check_removal (struct outside_network *outnet, int position, int total) |
| check removal of the LRU element on the given position of total elements | |
| static void | check_snip (struct outside_network *outnet, int total) |
| check snipping off the last element of the LRU with total elements | |
| static void | tcp_reuse_tree_list_test (void) |
| test tcp_reuse tree and LRU list functions | |
| static void | check_waiting_tcp_list (struct outside_network *outnet, struct waiting_tcp *first, struct waiting_tcp *last, size_t total) |
| static void | waiting_tcp_list_clear (struct outside_network *outnet) |
| clear the tcp waiting list | |
| static void | check_waiting_tcp_removal (int is_pop, struct outside_network *outnet, struct waiting_tcp *store, size_t position, size_t total) |
| check removal of the waiting_tcp element on the given position of total elements | |
| static void | waiting_tcp_list_test (void) |
| static void | check_reuse_write_wait (struct reuse_tcp *reuse, struct waiting_tcp *first, struct waiting_tcp *last, size_t total) |
| static void | reuse_write_wait_clear (struct reuse_tcp *reuse) |
| clear the tcp waiting list | |
| static void | check_reuse_write_wait_removal (int is_pop, struct reuse_tcp *reuse, struct waiting_tcp *store, size_t position, size_t total) |
| check removal of the reuse_write_wait element on the given position of total elements | |
| static void | reuse_write_wait_test (void) |
| static void | shared_port_test_ifs (void) |
| static int | pif_list_contains (struct shared_ports_if *shpif, int item) |
| See if a port is on the shared_ports ports list. | |
| static int | pif_list_contains_items (struct shared_ports_if *shpif, int item1, int item2, int item3, int item4) |
| See if a number of ports are on the shared_ports list. | |
| static void | shared_port_test_port (void) |
| void | tcpreuse_test (void) |
| unit test for tcp_reuse functions | |
Tests the tcp_reuse functionality.
|
static |
add number of new IDs to the reuse tree, randomly chosen
References waiting_tcp::id, waiting_tcp::next_waiting, waiting_tcp::outnet, reuse_tcp::pending, reuse_tcp_by_id_find(), reuse_tcp_select_id(), reuse_tree_by_id_insert(), tcpid_addmore(), and unit_assert.
Referenced by tcpid_addmore(), and tcpid_fillup().
|
static |
fill up the reuse ID tree and test assertions
References waiting_tcp::outnet, rbtree_init(), reuse_del_readwait(), reuse_id_cmp(), tcpid_addmore(), tcpid_fillup(), and reuse_tcp::tree_by_id.
Referenced by tcpid_fillup(), and tcpid_test().
|
static |
test TCP ID selection
References reuse_tcp::pending, rbtree_init(), pending_tcp::reuse, reuse_id_cmp(), outside_network::rnd, tcpid_fillup(), tcpid_test(), reuse_tcp::tree_by_id, ub_initstate(), ub_randfree(), and unit_show_func().
Referenced by tcpid_test(), and tcpreuse_test().
|
static |
check that the tree has present number of nodes and the LRU is linked properly.
References check_tree_and_list(), rbtree_type::count, reuse_tcp::item_on_lru_list, reuse_tcp::lru_next, reuse_tcp::outnet, outside_network::tcp_reuse, outside_network::tcp_reuse_first, and unit_assert.
Referenced by check_removal(), check_snip(), check_tree_and_list(), empty_tree(), and tcp_reuse_tree_list_test().
|
static |
creates pending_tcp.
Copy of outside_network.c:create_pending_tcp without the comm_point creation
References create_pending_tcp(), pending_tcp::next_free, outside_network::num_tcp, reuse_tcp::outnet, outside_network::tcp_conns, and outside_network::tcp_free.
|
static |
empty the tcp_reuse tree and LRU list
References check_tree_and_list(), rbtree_type::count, empty_tree(), reuse_tcp::outnet, reuse_tcp_remove_tree_list(), outside_network::tcp_reuse, and outside_network::tcp_reuse_first.
Referenced by check_removal(), check_snip(), and empty_tree().
|
static |
check removal of the LRU element on the given position of total elements
References check_removal(), check_tree_and_list(), empty_tree(), reuse_tcp::lru_next, reuse_tcp::outnet, reuse_tcp_insert(), reuse_tcp_remove_tree_list(), outside_network::tcp_conns, and outside_network::tcp_reuse_first.
Referenced by check_removal(), and tcp_reuse_tree_list_test().
|
static |
check snipping off the last element of the LRU with total elements
References check_snip(), check_tree_and_list(), rbtree_type::count, empty_tree(), reuse_tcp::outnet, reuse_tcp_insert(), reuse_tcp_lru_snip(), reuse_tcp_remove_tree_list(), outside_network::tcp_conns, outside_network::tcp_reuse, outside_network::tcp_reuse_first, and unit_assert.
Referenced by check_snip(), and tcp_reuse_tree_list_test().
|
static |
test tcp_reuse tree and LRU list functions
References check_removal(), check_snip(), check_tree_and_list(), rbtree_type::count, create_pending_tcp(), fatal_exit(), reuse_tcp::lru_next, outside_network::num_tcp, reuse_tcp::outnet, rbtree_init(), reuse_cmp(), reuse_tcp_insert(), reuse_tcp_lru_touch(), outside_network::tcp_conns, outside_network::tcp_reuse, outside_network::tcp_reuse_first, outside_network::tcp_reuse_max, tcp_reuse_tree_list_test(), and unit_show_func().
Referenced by tcp_reuse_tree_list_test(), and tcpreuse_test().
|
static |
clear the tcp waiting list
References waiting_tcp::next_waiting, waiting_tcp::on_tcp_waiting_list, waiting_tcp::outnet, outside_network::tcp_wait_first, outside_network::tcp_wait_last, unit_assert, and waiting_tcp_list_clear().
Referenced by check_waiting_tcp_removal(), and waiting_tcp_list_clear().
|
static |
check removal of the waiting_tcp element on the given position of total elements
References check_waiting_tcp_removal(), waiting_tcp::next_waiting, waiting_tcp::on_tcp_waiting_list, waiting_tcp::outnet, outnet_waiting_tcp_list_add(), outnet_waiting_tcp_list_pop(), outnet_waiting_tcp_list_remove(), outside_network::tcp_wait_first, unit_assert, and waiting_tcp_list_clear().
Referenced by check_waiting_tcp_removal().
|
static |
clear the tcp waiting list
References reuse_write_wait_clear(), unit_assert, reuse_tcp::write_wait_first, waiting_tcp::write_wait_prev, and waiting_tcp::write_wait_queued.
Referenced by check_reuse_write_wait_removal(), and reuse_write_wait_clear().
|
static |
check removal of the reuse_write_wait element on the given position of total elements
References check_reuse_write_wait_removal(), reuse_write_wait_clear(), reuse_write_wait_pop(), reuse_write_wait_push_back(), reuse_write_wait_remove(), unit_assert, reuse_tcp::write_wait_first, waiting_tcp::write_wait_prev, and waiting_tcp::write_wait_queued.
Referenced by check_reuse_write_wait_removal().
|
static |
See if a port is on the shared_ports ports list.
References shared_ports_if::avail_ports, shared_ports_if::avail_total, shared_ports_if::inuse, pif_list_contains(), and unit_assert.
Referenced by pif_list_contains(), and pif_list_contains_items().
|
static |
See if a number of ports are on the shared_ports list.
References pif_list_contains(), and pif_list_contains_items().
Referenced by pif_list_contains_items().
| void tcpreuse_test | ( | void | ) |
unit test for tcp_reuse functions
References tcp_reuse_tree_list_test(), tcpid_test(), tcpreuse_test(), and unit_show_feature().
Referenced by main(), and tcpreuse_test().