Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Functions
toolbox::net::detail Namespace Reference

Functions

template<std::endian Native = std::endian::native>
constexpr std::uint16_t get_length (const char *buf, std::endian net_byte_order) noexcept
 
template<std::endian Native = std::endian::native>
void put_length (char *buf, std::uint16_t len, std::endian net_byte_order) noexcept
 

Function Documentation

◆ get_length()

template<std::endian Native = std::endian::native>
constexpr std::uint16_t toolbox::net::detail::get_length ( const char buf,
std::endian  net_byte_order 
)
constexprnoexcept

Reads a binary-encoded 2 byte integer from the input buffer. N.B. the Native template parameter is provided for testability.

Template Parameters
NativeEndianness of native/target platform.
Parameters
bufThe input buffer, which must be at least 2 bytes in length.
net_byte_orderEndianness used for network byte order decoding.
Returns
the decoded 2 byte integer.

Definition at line 36 of file Frame.hpp.

◆ put_length()

template<std::endian Native = std::endian::native>
void toolbox::net::detail::put_length ( char buf,
std::uint16_t  len,
std::endian  net_byte_order 
)
inlinenoexcept

Writes a binary-encoded 2 byte integer to the output buffer. N.B. the Native template parameter is provided for testability.

Template Parameters
NativeEndianness of native/target platform.
Parameters
bufThe output buffer, which must be at least 2 bytes in length.
lenThe length to be encoded.
net_byte_orderEndianness used for network byte order decoding.

Definition at line 52 of file Frame.hpp.