9#ifndef LIBE3_POSIX_CONNECTOR_HPP
10#define LIBE3_POSIX_CONNECTOR_HPP
41 uint16_t inbound_port,
42 uint16_t outbound_port
51 int receive(std::vector<uint8_t>& buffer)
override;
70 return transport_layer_;
80 int setup_socket_{-1};
81 int setup_connection_socket_{-1};
82 int inbound_socket_{-1};
83 int inbound_connection_socket_{-1};
84 int outbound_socket_{-1};
85 int outbound_connection_socket_{-1};
95 std::vector<int> inbound_peer_sockets_;
96 std::vector<int> outbound_peer_sockets_;
101 size_t inbound_rr_{0};
103 uint16_t setup_port_;
104 uint16_t inbound_port_;
105 uint16_t outbound_port_;
107 bool connected_{
false};
108 std::atomic<bool> shutdown_requested_{
false};
110 static constexpr int CHUNK_SIZE = 8192;
111 static constexpr int UNUSED_SOCKET = -2;
113 int send_in_chunks(
int sockfd,
const uint8_t* buffer,
size_t buffer_size);
114 int recv_with_size(
int sockfd, std::vector<uint8_t>& buffer);
const std::string & inbound_endpoint() const noexcept
Get inbound endpoint.
const std::string & setup_endpoint() const noexcept
Get setup endpoint.
const std::string & outbound_endpoint() const noexcept
Get outbound endpoint.
E3Connector(const E3Connector &)=delete
E3LinkLayer link_layer() const noexcept override
Get the link layer type.
ErrorCode send_setup_request_client(const std::vector< uint8_t > &data) override
Send a SetupRequest on the setup channel (dApp role).
~PosixE3Connector() override
int recv_setup_request(std::vector< uint8_t > &buffer) override
Receive a setup request.
void dispose() override
Clean up and release all resources.
int receive(std::vector< uint8_t > &buffer) override
Receive data from the inbound channel.
ErrorCode send(const std::vector< uint8_t > &data) override
Send data on the outbound channel.
ErrorCode setup_initial_connection_client() override
Connect the setup channel (dApp role: REQ connect).
E3TransportLayer transport_layer() const noexcept override
Get the transport layer type.
int recv_setup_response_client(std::vector< uint8_t > &buffer) override
Receive a SetupResponse on the setup channel (dApp role).
PosixE3Connector(E3TransportLayer transport_layer, const std::string &setup_endpoint, const std::string &inbound_endpoint, const std::string &outbound_endpoint, uint16_t setup_port, uint16_t inbound_port, uint16_t outbound_port)
ErrorCode send_response(const std::vector< uint8_t > &data) override
Send a setup response.
void shutdown() override
Interrupt blocking operations for shutdown.
ErrorCode setup_outbound_connection_client() override
Connect the outbound channel (dApp role: PUB connect to the RAN's subscriber endpoint).
ErrorCode setup_inbound_connection_client() override
Connect the inbound channel (dApp role: SUB connect to the RAN's publisher endpoint).
ErrorCode setup_initial_connection() override
Set up the initial connection (setup channel).
ErrorCode setup_inbound_connection() override
Set up the inbound connection (SUB channel).
ErrorCode setup_outbound_connection() override
Set up the outbound connection (PUB channel).
bool is_connected() const noexcept override
Check if connector is connected.
Abstract E3 Connector interface for transport layer.
ErrorCode
Error codes returned by libe3 operations Use shared error-code list (see libe3/error_codes....
E3TransportLayer
Transport layer types (matches Python E3TransportLayer).
E3LinkLayer
Link layer types (matches Python E3LinkLayer).
@ POSIX
POSIX socket-based transport.