unbound: testcode/unittcpreuse.c File Reference

unbound 0.1

Macros | Functions
unittcpreuse.c File Reference

Tests the tcp_reuse functionality. More...

`#include "config.h"`
`#include "testcode/unitmain.h"`
`#include "util/log.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)
void | tcpreuse_test (void)
| unit test for tcp_reuse functions

## Detailed Description

Tests the tcp_reuse functionality.

## Function Documentation

## ◆ create_pending_tcp()

static int create_pending_tcp | ( | struct outside_network * | outnet | ) |
| static

creates pending_tcp.

Copy of outside_network.c:create_pending_tcp without the comm_point creation

References pending_tcp::next_free, outside_network::num_tcp, reuse_tcp::outnet, outside_network::tcp_conns, and outside_network::tcp_free.

Referenced by tcp_reuse_tree_list_test().