unilink  0.4.3
A simple C++ library for unified async communication
unilink::transport::UdpChannel::Impl Struct Reference

Public Member Functions

 Impl (const config::UdpConfig &config)
 
 Impl (const config::UdpConfig &config, net::io_context &external_ioc)
 
void init ()
 
 ~Impl ()
 
void open_socket (std::shared_ptr< UdpChannel > self)
 
void start_receive (std::shared_ptr< UdpChannel > self)
 
void handle_receive (std::shared_ptr< UdpChannel > self, const boost::system::error_code &ec, std::size_t bytes)
 
void do_write (std::shared_ptr< UdpChannel > self)
 
void close_socket ()
 
void notify_state ()
 
void report_backpressure (size_t queued_bytes)
 
bool enqueue_buffer (std::variant< memory::PooledBuffer, std::vector< uint8_t >, std::shared_ptr< const std::vector< uint8_t >>> &&buffer, size_t size)
 
void set_remote_from_config ()
 
void transition_to (LinkState target, const boost::system::error_code &ec={})
 
void perform_stop_cleanup ()
 
void join_ioc_thread (bool allow_detach)
 

Public Attributes

std::unique_ptr< net::io_context > owned_ioc_
 
net::io_context * ioc_
 
bool owns_ioc_ {true}
 
net::strand< net::io_context::executor_type > strand_
 
std::unique_ptr< net::executor_work_guard< net::io_context::executor_type > > work_guard_
 
std::thread ioc_thread_
 
udp::socket socket_
 
udp::endpoint local_endpoint_
 
udp::endpoint recv_endpoint_
 
std::optional< udp::endpoint > remote_endpoint_
 
std::array< uint8_t, common::constants::DEFAULT_READ_BUFFER_SIZE > rx_ {}
 
std::deque< std::variant< memory::PooledBuffer, std::vector< uint8_t >, std::shared_ptr< const std::vector< uint8_t > > > > tx_
 
bool writing_ {false}
 
size_t queue_bytes_ {0}
 
config::UdpConfig cfg_
 
size_t bp_high_
 
size_t bp_low_
 
size_t bp_limit_
 
bool backpressure_active_ {false}
 
std::atomic< bool > stop_requested_ {false}
 
std::atomic< bool > stopping_ {false}
 
std::atomic< bool > opened_ {false}
 
std::atomic< bool > connected_ {false}
 
bool started_ {false}
 
ThreadSafeLinkState state_ {LinkState::Idle}
 
std::atomic< bool > terminal_state_notified_ {false}
 
OnBytes on_bytes_
 
OnState on_state_
 
OnBackpressure on_bp_
 

Detailed Description

Definition at line 47 of file udp.cc.

Constructor & Destructor Documentation

◆ Impl() [1/2]

unilink::transport::UdpChannel::Impl::Impl ( const config::UdpConfig config)
inlineexplicit

Definition at line 82 of file udp.cc.

◆ Impl() [2/2]

unilink::transport::UdpChannel::Impl::Impl ( const config::UdpConfig config,
net::io_context &  external_ioc 
)
inline

Definition at line 93 of file udp.cc.

◆ ~Impl()

unilink::transport::UdpChannel::Impl::~Impl ( )
inline

Definition at line 116 of file udp.cc.

Member Function Documentation

◆ close_socket()

void unilink::transport::UdpChannel::Impl::close_socket ( )
inline

Definition at line 323 of file udp.cc.

◆ do_write()

void unilink::transport::UdpChannel::Impl::do_write ( std::shared_ptr< UdpChannel self)
inline

Definition at line 233 of file udp.cc.

◆ enqueue_buffer()

bool unilink::transport::UdpChannel::Impl::enqueue_buffer ( std::variant< memory::PooledBuffer, std::vector< uint8_t >, std::shared_ptr< const std::vector< uint8_t >>> &&  buffer,
size_t  size 
)
inline

Definition at line 364 of file udp.cc.

◆ handle_receive()

void unilink::transport::UdpChannel::Impl::handle_receive ( std::shared_ptr< UdpChannel self,
const boost::system::error_code &  ec,
std::size_t  bytes 
)
inline

Definition at line 184 of file udp.cc.

◆ init()

void unilink::transport::UdpChannel::Impl::init ( )
inline

Definition at line 103 of file udp.cc.

◆ join_ioc_thread()

void unilink::transport::UdpChannel::Impl::join_ioc_thread ( bool  allow_detach)
inline

Definition at line 446 of file udp.cc.

◆ notify_state()

void unilink::transport::UdpChannel::Impl::notify_state ( )
inline

Definition at line 329 of file udp.cc.

◆ open_socket()

void unilink::transport::UdpChannel::Impl::open_socket ( std::shared_ptr< UdpChannel self)
inline

Definition at line 135 of file udp.cc.

◆ perform_stop_cleanup()

void unilink::transport::UdpChannel::Impl::perform_stop_cleanup ( )
inline

Definition at line 416 of file udp.cc.

◆ report_backpressure()

void unilink::transport::UdpChannel::Impl::report_backpressure ( size_t  queued_bytes)
inline

Definition at line 340 of file udp.cc.

◆ set_remote_from_config()

void unilink::transport::UdpChannel::Impl::set_remote_from_config ( )
inline

Definition at line 383 of file udp.cc.

◆ start_receive()

void unilink::transport::UdpChannel::Impl::start_receive ( std::shared_ptr< UdpChannel self)
inline

Definition at line 171 of file udp.cc.

◆ transition_to()

void unilink::transport::UdpChannel::Impl::transition_to ( LinkState  target,
const boost::system::error_code &  ec = {} 
)
inline

Definition at line 393 of file udp.cc.

Member Data Documentation

◆ backpressure_active_

bool unilink::transport::UdpChannel::Impl::backpressure_active_ {false}

Definition at line 68 of file udp.cc.

◆ bp_high_

size_t unilink::transport::UdpChannel::Impl::bp_high_

Definition at line 65 of file udp.cc.

◆ bp_limit_

size_t unilink::transport::UdpChannel::Impl::bp_limit_

Definition at line 67 of file udp.cc.

◆ bp_low_

size_t unilink::transport::UdpChannel::Impl::bp_low_

Definition at line 66 of file udp.cc.

◆ cfg_

config::UdpConfig unilink::transport::UdpChannel::Impl::cfg_

Definition at line 64 of file udp.cc.

◆ connected_

std::atomic<bool> unilink::transport::UdpChannel::Impl::connected_ {false}

Definition at line 73 of file udp.cc.

◆ ioc_

net::io_context* unilink::transport::UdpChannel::Impl::ioc_

Definition at line 49 of file udp.cc.

◆ ioc_thread_

std::thread unilink::transport::UdpChannel::Impl::ioc_thread_

Definition at line 53 of file udp.cc.

◆ local_endpoint_

udp::endpoint unilink::transport::UdpChannel::Impl::local_endpoint_

Definition at line 56 of file udp.cc.

◆ on_bp_

OnBackpressure unilink::transport::UdpChannel::Impl::on_bp_

Definition at line 80 of file udp.cc.

◆ on_bytes_

OnBytes unilink::transport::UdpChannel::Impl::on_bytes_

Definition at line 78 of file udp.cc.

◆ on_state_

OnState unilink::transport::UdpChannel::Impl::on_state_

Definition at line 79 of file udp.cc.

◆ opened_

std::atomic<bool> unilink::transport::UdpChannel::Impl::opened_ {false}

Definition at line 72 of file udp.cc.

◆ owned_ioc_

std::unique_ptr<net::io_context> unilink::transport::UdpChannel::Impl::owned_ioc_

Definition at line 48 of file udp.cc.

◆ owns_ioc_

bool unilink::transport::UdpChannel::Impl::owns_ioc_ {true}

Definition at line 50 of file udp.cc.

◆ queue_bytes_

size_t unilink::transport::UdpChannel::Impl::queue_bytes_ {0}

Definition at line 63 of file udp.cc.

◆ recv_endpoint_

udp::endpoint unilink::transport::UdpChannel::Impl::recv_endpoint_

Definition at line 57 of file udp.cc.

◆ remote_endpoint_

std::optional<udp::endpoint> unilink::transport::UdpChannel::Impl::remote_endpoint_

Definition at line 58 of file udp.cc.

◆ rx_

std::array<uint8_t, common::constants::DEFAULT_READ_BUFFER_SIZE> unilink::transport::UdpChannel::Impl::rx_ {}

Definition at line 60 of file udp.cc.

◆ socket_

udp::socket unilink::transport::UdpChannel::Impl::socket_

Definition at line 55 of file udp.cc.

◆ started_

bool unilink::transport::UdpChannel::Impl::started_ {false}

Definition at line 74 of file udp.cc.

◆ state_

ThreadSafeLinkState unilink::transport::UdpChannel::Impl::state_ {LinkState::Idle}

Definition at line 75 of file udp.cc.

◆ stop_requested_

std::atomic<bool> unilink::transport::UdpChannel::Impl::stop_requested_ {false}

Definition at line 70 of file udp.cc.

◆ stopping_

std::atomic<bool> unilink::transport::UdpChannel::Impl::stopping_ {false}

Definition at line 71 of file udp.cc.

◆ strand_

net::strand<net::io_context::executor_type> unilink::transport::UdpChannel::Impl::strand_

Definition at line 51 of file udp.cc.

◆ terminal_state_notified_

std::atomic<bool> unilink::transport::UdpChannel::Impl::terminal_state_notified_ {false}

Definition at line 76 of file udp.cc.

◆ tx_

std::deque<std::variant<memory::PooledBuffer, std::vector<uint8_t>, std::shared_ptr<const std::vector<uint8_t> > > > unilink::transport::UdpChannel::Impl::tx_

Definition at line 61 of file udp.cc.

◆ work_guard_

std::unique_ptr<net::executor_work_guard<net::io_context::executor_type> > unilink::transport::UdpChannel::Impl::work_guard_

Definition at line 52 of file udp.cc.

◆ writing_

bool unilink::transport::UdpChannel::Impl::writing_ {false}

Definition at line 62 of file udp.cc.


The documentation for this struct was generated from the following file: