srs-control 0.2.2
Loading...
Searching...
No Matches
DataSocket.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "srs/Application.hpp"
11#include <asio/awaitable.hpp>
12#include <cstddef>
13#include <gsl/gsl-lite.hpp>
14#include <memory>
15#include <span>
16
17namespace srs::connection
18{
23 {
24 public:
26
30 void cancel();
32
33 private:
37 gsl::not_null<io_context_type*> io_context_;
38 gsl::not_null<workflow::AnalysisHandle*> workflow_handler_;
40
41 void register_send_action_imp(asio::awaitable<void> action, const std::shared_ptr<ConnectionType>& connection);
42 auto get_response_msg_buffer() -> std::span<char> { return read_msg_buffer_.get_all_data(); }
43 void response_handler(const UDPEndpoint& endpoint, std::size_t read_size);
44 static auto is_finished() -> bool { return false; };
45 static void print_error() {};
46
47 DataSocket(int port_number,
48 io_context_type& io_context,
49 std::size_t buffer_size,
51 };
52} // namespace srs::connection
std::pair< moodycamel::ProducerToken, moodycamel::ConsumerToken > Token
A queue token type used for enqueue and dequeue action. The token type consists of one producer token...
Class for buffer for storing large data.
BufferQueue::Token token_
DataSocket(int port_number, io_context_type &io_context, std::size_t buffer_size, workflow::AnalysisHandle &workflow)
gsl::not_null< io_context_type * > io_context_
void register_send_action_imp(asio::awaitable< void > action, const std::shared_ptr< ConnectionType > &connection)
void response_handler(const UDPEndpoint &endpoint, std::size_t read_size)
gsl::not_null< workflow::AnalysisHandle * > workflow_handler_
auto get_response_msg_buffer() -> std::span< char >
void cancel()
Cancel reading the data from the UDP socket.
static auto is_finished() -> bool
constexpr auto LARGE_READ_MSG_BUFFER_SIZE
size of the data array for reading a UDP package
asio::ip::basic_endpoint< asio::ip::udp > UDPEndpoint
asio::thread_pool io_context_type