mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-02 23:04:12 +02:00
Move Udp headers to correct location
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#ifndef UDPRECEIVER_H
|
||||
#define UDPRECEIVER_H
|
||||
|
||||
#include "config.hpp"
|
||||
#include <sys/socket.h>
|
||||
#include "RingBuffer.hpp"
|
||||
|
||||
class UdpReceiver {
|
||||
|
||||
int socket_fd_;
|
||||
|
||||
public:
|
||||
UdpReceiver();
|
||||
virtual ~UdpReceiver();
|
||||
|
||||
bool receive(void* buffer, size_t buffer_n_bytes);
|
||||
int receive_many(mmsghdr* msgs, const size_t n_msgs);
|
||||
|
||||
void bind(
|
||||
const uint16_t port,
|
||||
const size_t usec_timeout=config::udp_usec_timeout);
|
||||
void close();
|
||||
};
|
||||
|
||||
|
||||
#endif //LIB_CPP_H5_WRITER_UDPRECEIVER_H
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef UDPRECVMODULE_HPP
|
||||
#define UDPRECVMODULE_HPP
|
||||
|
||||
#include "RingBuffer.hpp"
|
||||
#include <thread>
|
||||
|
||||
class UdpRecvModule {
|
||||
|
||||
RingBuffer<UdpFrameMetadata>& ring_buffer_;
|
||||
|
||||
std::atomic_bool is_receiving_;
|
||||
std::thread receiving_thread_;
|
||||
|
||||
protected:
|
||||
void receive_thread(
|
||||
const uint16_t udp_port,
|
||||
const size_t frame_size);
|
||||
|
||||
public:
|
||||
UdpRecvModule(RingBuffer<UdpFrameMetadata>& ring_buffer);
|
||||
|
||||
virtual ~UdpRecvModule();
|
||||
|
||||
void start_recv(
|
||||
const uint16_t udp_port,
|
||||
const size_t frame_n_bytes);
|
||||
void stop_recv();
|
||||
bool is_receiving();
|
||||
};
|
||||
|
||||
|
||||
#endif // UDPRECVMODULE_HPP
|
||||
Reference in New Issue
Block a user