Go to the documentation of this file.
11 #ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_UDPRECEIVER_HPP_
12 #define RTCTK_REUSABLECOMPONENT_TELREPUB_UDPRECEIVER_HPP_
18 #include <boost/asio/io_context.hpp>
19 #include <boost/asio/ip/udp.hpp>
20 #include <log4cplus/logger.h>
23 #include <numapp/numapolicies.hpp>
61 boost::asio::ip::udp::endpoint
const& endpoint,
62 numapp::NumaPolicies
const& receive_thread_policies);
85 enum class State { Idle, Run, Exit };
93 void HandleReceive(boost::system::error_code
const&
error, std::size_t length);
96 boost::asio::io_service m_io_context;
98 boost::asio::ip::udp::socket m_socket;
102 boost::asio::ip::udp::endpoint m_sender;
103 std::array<std::byte, DATAGRAM_SIZE> m_recv_buffer;
104 std::thread m_rcv_thr;
107 std::atomic<State> m_requested_state;
113 std::vector<std::pair<mudpi::uint16_t, MudpiProcessor>> m_processors;
115 log4cplus::Logger m_logger;
119 #endif // RTCTK_REUSABLECOMPONENT_TELREPUB_UDPRECEIVER_HPP_
Definition: ddsPubThread.hpp:27
constexpr int DATAGRAM_SIZE
maximal UDP datagram size
Definition: udpReceiver.hpp:30
void Statistics()
Dumps receiver statistics.
Definition: udpReceiver.cpp:121
unsigned short uint16_t
Definition: mudpi.h:15
std::map< mudpi::uint16_t, PubThreadBase<> & > MudpiProcessors
Container of {topic-id, processor}.
Definition: udpReceiver.hpp:46
MUDPI processor: check and aggregate MUDPI payload to a single topic and put to the queue for publish...
Receiving UDP data asynchronously and forwards received packets to provided packet processors.
Definition: udpReceiver.hpp:41
~UdpReceiver() noexcept
Definition: udpReceiver.cpp:52
UdpReceiver(uint16_t idx, MudpiProcessors const &processors, boost::asio::ip::udp::endpoint const &endpoint, numapp::NumaPolicies const &receive_thread_policies)
Creates UDP receiver.
Definition: udpReceiver.cpp:23
void Disable()
Disables processing UDP data from socket.
Definition: udpReceiver.cpp:116
void error(const char *msg)
Definition: main.cpp:38
void Enable()
Enables processing UDP data from socket.
Definition: udpReceiver.cpp:111