libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
Read a message from the source socket, process it according to the supplied rules and write the resultant message(s) to the destination socket. More...
#include <msg_processor.hpp>
Public Types | |
using | proc_rules_t = ProcessingRules |
The processing rules for the particular server instance. More... | |
using | msg_details_t = typename proc_rules_t::src_msg_details_t |
using | msg_buffer_t = typename msg_details_t::msg_buffer_t |
The buffer into which the incoming messages are received. More... | |
Public Member Functions | |
msg_processor (proc_rules_t const &proc_rules) | |
template<class SktT , class LatencyTimestamps > | |
std::enable_if< std::is_class< typename LatencyTimestamps::period >::value, bool >::type | read_and_process_a_msg (SktT &src_skt, SktT &dest_skt, LatencyTimestamps &ts) noexcept(false) |
Read a message from the source socket, process it and write the resultant message(s) to the destination socket. More... | |
template<class SktT , class ClientCxn , class LatencyTimestamps > | |
std::enable_if< std::is_class< typename LatencyTimestamps::period >::value, bool >::type | read_and_process_a_msg (SktT &src_skt, ClientCxn &dest_cxn, LatencyTimestamps &ts) noexcept(false) |
Read a message from the source socket, process it and write the resultant message(s) to the destination socket, if it is valid, otherwise write back to the src_skt. More... | |
std::string | to_string () const noexcept(false) |
Read a message from the source socket, process it according to the supplied rules and write the resultant message(s) to the destination socket.
Definition at line 26 of file msg_processor.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::msg_processor< ProcessingRules >::msg_buffer_t = typename msg_details_t::msg_buffer_t |
The buffer into which the incoming messages are received.
This should be per-thread, on the stack of the thread, suitably aligned, possibly to 64-bits. For maximum performance it should be a reference to the internal buffer of the network stack or even the hardware buffer in the card (assuming suitable kernel modules). It is not recommended to use GCC <=v4.9.* due to sub-optimal code-generation in std::memcpy() (see the performance graphs of libjmmcg::stack_string.
Definition at line 40 of file msg_processor.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::msg_processor< ProcessingRules >::msg_details_t = typename proc_rules_t::src_msg_details_t |
Definition at line 33 of file msg_processor.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::msg_processor< ProcessingRules >::proc_rules_t = ProcessingRules |
The processing rules for the particular server instance.
These rules specify how an input message should be transformed to one, or more, response messages,
Definition at line 32 of file msg_processor.hpp.
|
inlineexplicit |
Definition at line 22 of file msg_processor_impl.hpp.
|
inlinenoexcept |
Read a message from the source socket, process it and write the resultant message(s) to the destination socket, if it is valid, otherwise write back to the src_skt.
Note that this call will block until sufficient data has been read from the source socket to comprise a complete source message.
Throws: an exception if there has been a socket error (the source socket being cleanly closed is not an error).
src_skt | The socket that is source of the messages. |
dest_skt | The socket that is destination of the messages, may be the same as src_skt. |
Definition at line 49 of file msg_processor_impl.hpp.
|
inlinenoexcept |
Read a message from the source socket, process it and write the resultant message(s) to the destination socket.
Note that this call will block until sufficient data has been read from the source socket to comprise a complete source message.
Throws: an exception if there has been a socket error (the source socket being cleanly closed is not an error).
src_skt | The socket that is source of the messages. |
dest_skt | The socket that is destination of the messages, may be the same as src_skt. |
Definition at line 36 of file msg_processor_impl.hpp.
|
inlinenoexcept |
Definition at line 60 of file msg_processor_impl.hpp.