Go to the documentation of this file.
11 #ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_UDPRECEIVER_HPP_
12 #define RTCTK_REUSABLECOMPONENT_TELREPUB_UDPRECEIVER_HPP_
20 #include <boost/asio/io_context.hpp>
21 #include <boost/asio/ip/udp.hpp>
22 #include <log4cplus/logger.h>
25 #include <numapp/numapolicies.hpp>
64 boost::asio::ip::udp::endpoint
const& endpoint,
66 numapp::NumaPolicies
const& receive_thread_policies);
89 enum class State { Idle, Run, Exit };
97 void HandleReceive(boost::system::error_code
const& error, std::size_t length);
100 boost::asio::io_service m_io_context;
102 boost::asio::ip::udp::socket m_socket;
106 boost::asio::ip::udp::endpoint m_sender;
107 std::array<std::byte, DATAGRAM_SIZE> m_recv_buffer;
108 std::thread m_rcv_thr;
111 std::atomic<State> m_requested_state;
117 std::vector<std::pair<mudpi::uint16_t, std::unique_ptr<MudpiProcessor>>> m_processors;
121 log4cplus::Logger m_logger;
125 #endif // RTCTK_REUSABLECOMPONENT_TELREPUB_UDPRECEIVER_HPP_
UdpReceiver(uint16_t idx, MudpiProcessors const &processors, boost::asio::ip::udp::endpoint const &endpoint, componentFramework::ComponentMetricsIf &metrics, numapp::NumaPolicies const &receive_thread_policies)
Creates UDP receiver.
Definition: udpReceiver.cpp:23
Header file for ComponentMetricsIf.
Definition: ddsPubThread.hpp:26
constexpr int DATAGRAM_SIZE
maximal UDP datagram size
Definition: udpReceiver.hpp:32
void Statistics()
Dumps receiver statistics.
Definition: udpReceiver.cpp:129
unsigned short uint16_t
Definition: mudpi.h:15
std::map< mudpi::uint16_t, PubThreadBase<> & > MudpiProcessors
Container of {topic-id, processor}.
Definition: udpReceiver.hpp:48
Component metrics interface.
Definition: componentMetricsIf.hpp:177
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:43
~UdpReceiver() noexcept
Definition: udpReceiver.cpp:60
void Disable()
Disables processing UDP data from socket.
Definition: udpReceiver.cpp:124
void Enable()
Enables processing UDP data from socket.
Definition: udpReceiver.cpp:119