Chops Net IP
|
Declarations and implementations for shared test code dealing with test message building and message handler function object classes. More...
#include <string_view>
#include <cstddef>
#include <cstdint>
#include <vector>
#include <utility>
#include <atomic>
#include <ostream>
#include <chrono>
#include <thread>
#include <future>
#include <ranges>
#include <cassert>
#include <limits>
#include "asio/buffer.hpp"
#include "asio/ip/udp.hpp"
#include "asio/ip/address.hpp"
#include "utility/byte_array.hpp"
#include "serialize/extract_append.hpp"
#include "buffer/shared_buffer.hpp"
#include "net_ip/basic_io_output.hpp"
#include "net_ip/queue_stats.hpp"
Go to the source code of this file.
Classes | |
struct | chops::test::msg_hdlr< IOT > |
struct | chops::test::fixed_size_msg_hdlr< IOT > |
class | chops::test::poll_output_queue_cond |
Typedefs | |
using | chops::test::vec_buf = std::vector<chops::const_shared_buffer> |
using | chops::test::test_counter = std::atomic_size_t |
using | chops::test::test_prom = std::promise<std::size_t> |
Variables | |
constexpr std::size_t | chops::test::fixed_size_buf_size = 33u |
Declarations and implementations for shared test code dealing with test message building and message handler function object classes.
There are a couple of message handling designs shared between the unit tests. One is a variable length message, encoded three ways - with a binary length header, a LF delimited text, and a CR / LF delimited text. The other other is a fixed-size message.
The general Chops Net IP test strategy for the variable length messages is to have message senders and message receivers, with a flag specifying whether the receiver is to loop back the messages. For TCP it is independent of whether the sender or receiver is an acceptor or connector, although most tests have the connector being a sender. In the test routines, coordination is typically needed to know when a connection has been made or sender / receiver is ready so that message flow can start. At the higher layers, the Chops Net IP library facilities provide connection state change function object callbacks.
When the message flow is finished, an empty body message is sent to the receiver (and looped back if the reply flag is set), which signals an "end of message flow" condition. The looped back empty message may not arrive back to the sender since connections or handlers are in the process of being taken down.
The fixed-size messages use a simpler messsage flow design, with no "end of message" indication. This requires a higher layer to bring down the connections and finish processing.
Copyright (c) 2017-2025 by Cliff Green
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)