Diag-Client-Lib
Public Types | Public Member Functions | Private Attributes | List of all members
boost_support::socket::udp::UdpMessage Class Referencefinal

Immutable class to store received udp message. More...

#include <udp_message.h>

Public Types

using BufferType = std::vector< uint8_t >
 Type alias for underlying buffer. More...
 
using IpAddressType = std::string_view
 Type alias of IP address type. More...
 

Public Member Functions

 UdpMessage (IpAddressType host_ip_address, std::uint16_t host_port_number)
 Default constructor of UdpMessage. More...
 
 UdpMessage (IpAddressType host_ip_address, std::uint16_t host_port_number, BufferType payload)
 Constructs an instance of UdpMessage. More...
 
 UdpMessage (UdpMessage &&other) noexcept=default
 
UdpMessageoperator= (UdpMessage &&other) noexcept=default
 
 UdpMessage (const UdpMessage &other)=delete
 
UdpMessageoperator= (const UdpMessage &other)=delete
 
virtual ~UdpMessage ()=default
 Destructs an instance of UdpMessage. More...
 
IpAddressType GetHostIpAddress () const
 Get the host ip address. More...
 
std::uint16_t GetHostPortNumber () const
 Get the host port number. More...
 
core_type::Span< std::uint8_t > GetRxBuffer ()
 Get the view to the rx buffer. More...
 
BufferTypeGetTxBuffer ()
 Get the reference to tx buffer. More...
 
BufferType const & GetTxBuffer () const
 Get the reference to tx buffer. More...
 

Private Attributes

BufferType rx_buffer_
 The reception buffer. More...
 
BufferType tx_buffer_
 The transmission buffer. More...
 
IpAddressType host_ip_address_
 Store remote ip address. More...
 
std::uint16_t host_port_number_
 Store remote port number. More...
 

Detailed Description

Immutable class to store received udp message.

Definition at line 31 of file udp_message.h.

Member Typedef Documentation

◆ BufferType

Type alias for underlying buffer.

Definition at line 36 of file udp_message.h.

◆ IpAddressType

Type alias of IP address type.

Definition at line 41 of file udp_message.h.

Constructor & Destructor Documentation

◆ UdpMessage() [1/4]

boost_support::socket::udp::UdpMessage::UdpMessage ( IpAddressType  host_ip_address,
std::uint16_t  host_port_number 
)
inline

Default constructor of UdpMessage.

Definition at line 47 of file udp_message.h.

48  : rx_buffer_{},
49  tx_buffer_{},
50  host_ip_address_{host_ip_address},
51  host_port_number_{host_port_number} {}
BufferType tx_buffer_
The transmission buffer.
Definition: udp_message.h:118
BufferType rx_buffer_
The reception buffer.
Definition: udp_message.h:113
std::uint16_t host_port_number_
Store remote port number.
Definition: udp_message.h:128
IpAddressType host_ip_address_
Store remote ip address.
Definition: udp_message.h:123

◆ UdpMessage() [2/4]

boost_support::socket::udp::UdpMessage::UdpMessage ( IpAddressType  host_ip_address,
std::uint16_t  host_port_number,
BufferType  payload 
)
inline

Constructs an instance of UdpMessage.

Parameters
[in]host_ip_addressThe host ip address
[in]host_port_numberThe host port number
[in]payloadThe received data payload

Definition at line 62 of file udp_message.h.

63  : rx_buffer_{std::move(payload)},
64  tx_buffer_{},
65  host_ip_address_{host_ip_address},
66  host_port_number_{host_port_number} {}

◆ UdpMessage() [3/4]

boost_support::socket::udp::UdpMessage::UdpMessage ( UdpMessage &&  other)
defaultnoexcept

◆ UdpMessage() [4/4]

boost_support::socket::udp::UdpMessage::UdpMessage ( const UdpMessage other)
delete

◆ ~UdpMessage()

virtual boost_support::socket::udp::UdpMessage::~UdpMessage ( )
virtualdefault

Destructs an instance of UdpMessage.

Member Function Documentation

◆ GetHostIpAddress()

IpAddressType boost_support::socket::udp::UdpMessage::GetHostIpAddress ( ) const
inline

Get the host ip address.

Returns
The IP address

Definition at line 83 of file udp_message.h.

83 { return host_ip_address_; }

References host_ip_address_.

◆ GetHostPortNumber()

std::uint16_t boost_support::socket::udp::UdpMessage::GetHostPortNumber ( ) const
inline

Get the host port number.

Returns
The port number

Definition at line 89 of file udp_message.h.

89 { return host_port_number_; }

References host_port_number_.

◆ GetRxBuffer()

core_type::Span<std::uint8_t> boost_support::socket::udp::UdpMessage::GetRxBuffer ( )
inline

Get the view to the rx buffer.

Returns
The rx buffer

Definition at line 95 of file udp_message.h.

References rx_buffer_.

◆ GetTxBuffer() [1/2]

BufferType& boost_support::socket::udp::UdpMessage::GetTxBuffer ( )
inline

Get the reference to tx buffer.

Returns
The reference to buffer

Definition at line 101 of file udp_message.h.

101 { return tx_buffer_; }

References tx_buffer_.

◆ GetTxBuffer() [2/2]

BufferType const& boost_support::socket::udp::UdpMessage::GetTxBuffer ( ) const
inline

Get the reference to tx buffer.

Returns
The reference to buffer

Definition at line 107 of file udp_message.h.

107 { return tx_buffer_; }

References tx_buffer_.

◆ operator=() [1/2]

UdpMessage& boost_support::socket::udp::UdpMessage::operator= ( const UdpMessage other)
delete

◆ operator=() [2/2]

UdpMessage& boost_support::socket::udp::UdpMessage::operator= ( UdpMessage &&  other)
defaultnoexcept

Member Data Documentation

◆ host_ip_address_

IpAddressType boost_support::socket::udp::UdpMessage::host_ip_address_
private

Store remote ip address.

Definition at line 123 of file udp_message.h.

Referenced by GetHostIpAddress().

◆ host_port_number_

std::uint16_t boost_support::socket::udp::UdpMessage::host_port_number_
private

Store remote port number.

Definition at line 128 of file udp_message.h.

Referenced by GetHostPortNumber().

◆ rx_buffer_

BufferType boost_support::socket::udp::UdpMessage::rx_buffer_
private

The reception buffer.

Definition at line 113 of file udp_message.h.

Referenced by GetRxBuffer().

◆ tx_buffer_

BufferType boost_support::socket::udp::UdpMessage::tx_buffer_
private

The transmission buffer.

Definition at line 118 of file udp_message.h.

Referenced by GetTxBuffer().


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