36 #include <boost/asio.hpp> 40 namespace boost_sys = boost::system;
41 namespace boost_asio = boost::asio;
42 namespace boost_placeholders = boost::asio::placeholders;
43 namespace boost_mcast = boost::asio::ip::multicast;
72 DEFAULT_RESERVED_SIZE = 512 * 1024
78 MAX_UNSENT_ASYNC_MSG_COUNT = 1000
115 UDP_DATAGRAM_MAX_SIZE = 65507
125 DEFAULT_UDP_BUF_SIZE = 8192
160 RESPONSE_ADDRESS_LEN = 16
165 MAGIC_STRING_LEN = 16
187 #pragma pack(push, 1) 197 char magicString[MAGIC_STRING_LEN]{};
199 char responseAddress[RESPONSE_ADDRESS_LEN]{};
201 uint16_t responsePort{0};
203 int32_t messageId{0};
207 uint32_t totalLength{
sizeof(*this)};
217 #ifdef USE_EXPLICIT_MOVE_ 260 #ifdef USE_EXPLICIT_MOVE_ 264 *
this = std::move(message);
269 std::swap(header, message.header);
270 body.swap(message.body);
296 #endif // ASIODEFINES std::function< void(default_received_message_ptr_t)> default_message_dispatcher_t
Typedef to default message dispatcher function object.
Definition: AsioDefines.h:286
char_buffer_t body
Message body as a char buffer as all data received form socket is fundamentally an array pf chars...
Definition: AsioDefines.h:251
Multicast only to same host.
eUdpOption
The udp options enumeration.
Definition: AsioDefines.h:98
boost::asio::ip::tcp::acceptor boost_tcp_acceptor_t
Boost tcp acceptor convenience typedef.
Definition: AsioDefines.h:50
Multicasts are unrestricted.
std::function< size_t(const char_buffer_t &)> check_bytes_left_to_read_t
Typedef to bytes left to reading checking utility function object.
Definition: AsioDefines.h:288
Portable binary archive, requires Cereal serialization.
Raw data, only for POD objects.
boost::asio::ip::udp boost_udp_t
Boost udp convenience typedef.
Definition: AsioDefines.h:52
XML archive, requires Cereal serialization.
std::function< void(const char_buffer_t &)> message_received_handler_t
Typedef to message received handler function object.
Definition: AsioDefines.h:290
Binary archive, requires Cereal serialization.
Multicast only to same subnet.
JSON archive, requires Cereal serialization.
eMessageHeaderLen
Constant defining message header magic string length in bytes.
Definition: AsioDefines.h:233
The core_lib namespace.
Definition: AsioDefines.h:59
eSendOption
Enumeration to control nagle algorithm.
Definition: AsioDefines.h:82
boost_asio::ip::tcp boost_tcp_t
Boost tcp convenience typedef.
Definition: AsioDefines.h:48
std::shared_ptr< default_received_message_t > default_received_message_ptr_t
Typedef to default version of received message shared pointer.
Definition: AsioDefines.h:284
Header header_t
Typedef for header template type.
Definition: AsioDefines.h:246
eDefReservedSize
Default internal receive buffer's initial reserved size in bytes.
Definition: AsioDefines.h:70
eMulticastTTL
The multicast TTL enumeration.
Definition: AsioDefines.h:129
eRespAddressLen
Constant defining response IP address length in bytes.
Definition: AsioDefines.h:158
Multicast only to same region.
nagleOn - Send when possible.
std::pair< std::string, uint16_t > connection_t
Typedef describing a network connection as (address, port).
Definition: AsioDefines.h:152
boost::asio::ip::address_v4 boost_address_v4_t
Boost IPV4 address convenience typedef.
Definition: AsioDefines.h:56
eMagicStringLen
Constant defining message header magic string length in bytes.
Definition: AsioDefines.h:163
Multicast only to same continent.
boost_asio::io_context boost_iocontext_t
Boost IO context convenience typedef.
Definition: AsioDefines.h:46
eDefaultUdpSize
UDP default buffer size.
Definition: AsioDefines.h:123
header_t header
Message header.
Definition: AsioDefines.h:248
File containing declaration of DLL import/export control defines.
eUdpDatagramMaxSize
UDP datagram maximum size for user data.
Definition: AsioDefines.h:113
Multicast only to same site.
eArchiveType
Message serialization archive type enumeration.
Definition: AsioDefines.h:171
const char DEFAULT_MAGIC_STRING[]
Constant defining default magc string as "_BEGIN_MESSAGE_".
Definition: AsioDefines.cpp:38
nagleOff - Send immediately.
TCP connection class.
Definition: TcpConnection.h:52
std::vector< char > char_buffer_t
Typedef to generic char buffer based on s std::vector<char>.
Definition: AsioDefines.h:239
boost::asio::ip::address boost_address_t
Boost general IP address convenience typedef.
Definition: AsioDefines.h:54
eDefUnsentAsyncCount
Maximum number of unsent async messages allowed on TCP socket IO Service queue.
Definition: AsioDefines.h:76
Template class to act as a generic wrapper around a received message for a given header type...
Definition: AsioDefines.h:243
const connection_t NULL_CONNECTION
Constant defining a null network connection as ("0.0.0.0", 0).
std::shared_ptr< tcp::TcpConnection > tcp_conn_ptr_t
Typedef describing shared_ptr to a TcpConnection object.
Definition: AsioDefines.h:156