12#ifndef LIBE3_E3_CONNECTOR_HPP
13#define LIBE3_E3_CONNECTOR_HPP
118 virtual int receive(std::vector<uint8_t>& buffer) = 0;
167 return ErrorCode::INVALID_PARAM;
175 return ErrorCode::INVALID_PARAM;
183 return static_cast<int>(ErrorCode::INVALID_PARAM);
192 return ErrorCode::INVALID_PARAM;
201 return ErrorCode::INVALID_PARAM;
335 const std::string& setup_endpoint,
336 const std::string& inbound_endpoint,
337 const std::string& outbound_endpoint,
339 uint16_t inbound_port,
340 uint16_t outbound_port,
341 size_t io_threads = 2,
343 const PosixOptions& posix = PosixOptions{}
virtual ErrorCode setup_inbound_connection()=0
Set up the inbound connection (SUB channel).
virtual ~E3Connector()=default
virtual int recv_setup_request(std::vector< uint8_t > &buffer)=0
Receive a setup request.
void set_role(E3Role role) noexcept
Set role (RAN or DAPP). Affects bind vs connect direction and cleanup behaviour. Must be set before a...
E3Role role_
Role of this peer.
std::string inbound_endpoint_
Endpoint of the inbound channel.
std::string outbound_endpoint_
Endpoint of the outbound channel.
virtual bool is_connected() const noexcept=0
Check if connector is connected.
std::string setup_endpoint_
Endpoint of the setup channel.
const std::string & inbound_endpoint() const noexcept
Get inbound endpoint.
E3Connector & operator=(E3Connector &&)=default
Move assignment.
virtual ErrorCode setup_outbound_connection()=0
Set up the outbound connection (PUB channel).
const std::string & setup_endpoint() const noexcept
Get setup endpoint.
virtual ErrorCode send_to(uint64_t peer_token, const std::vector< uint8_t > &data, PduClass kind)
Send data to one peer, or to all of them (RAN role).
virtual void shutdown()
Interrupt blocking operations for shutdown.
virtual uint64_t last_peer_token() const
Which peer supplied the bytes the last receive() returned (RAN role).
virtual uint64_t last_setup_peer_token() const
Which peer sent the setup request the last recv_setup_request() returned (RAN role).
virtual void dispose()=0
Clean up and release all resources.
virtual E3LinkLayer link_layer() const noexcept=0
Get the link layer type.
virtual ErrorCode send_response(const std::vector< uint8_t > &data)=0
Send a setup response.
virtual int receive(std::vector< uint8_t > &buffer)=0
Receive data from the inbound channel.
virtual E3TransportLayer transport_layer() const noexcept=0
Get the transport layer type.
const std::string & outbound_endpoint() const noexcept
Get outbound endpoint.
E3Connector(E3Connector &&)=default
Move constructor.
virtual ErrorCode setup_initial_connection_client()
Connect the setup channel (dApp role: REQ connect).
virtual std::vector< uint64_t > take_closed_peers()
Peers whose connection has closed since the last call (RAN role).
E3Connector & operator=(const E3Connector &)=delete
virtual int recv_setup_response_client(std::vector< uint8_t > &)
Receive a SetupResponse on the setup channel (dApp role).
E3Connector(const E3Connector &)=delete
virtual ErrorCode send(const std::vector< uint8_t > &data)=0
Send data on the outbound channel.
virtual ErrorCode setup_initial_connection()=0
Set up the initial connection (setup channel).
virtual ErrorCode setup_outbound_connection_client()
Connect the outbound channel (dApp role: PUB connect to the RAN's subscriber endpoint).
E3Role role() const noexcept
Get current role.
virtual ErrorCode setup_inbound_connection_client()
Connect the inbound channel (dApp role: SUB connect to the RAN's publisher endpoint).
virtual ErrorCode send_setup_request_client(const std::vector< uint8_t > &)
Send a SetupRequest on the setup channel (dApp role).
std::unique_ptr< E3Connector > create_connector(E3LinkLayer link_layer, 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, size_t io_threads=2, E3Role role=E3Role::RAN, const PosixOptions &posix=PosixOptions{})
Factory function to create appropriate connector.
ErrorCode
Error codes returned by libe3 operations Use shared error-code list (see libe3/error_codes....
E3TransportLayer
Transport layer types (matches Python E3TransportLayer).
E3Role
Role this E3 endpoint plays in the protocol.
@ RAN
RAN function (binds sockets; today's only behaviour).
E3LinkLayer
Link layer types (matches Python E3LinkLayer).
PduClass
What a PDU is for, so that a link that has streams can pick one.
@ PROCEDURE
A request, a response, a control, a release: anything but an indication.
@ INDICATION
An indication message.
Socket and admission options of the POSIX link.
bool sctp_delayed_sack
SCTP delayed SACK; false turns it off, on both peers, as OCUDU does.
size_t maximum_associations
RAN role: most peers connected at once; 0 is unlimited.
size_t socket_buffer_bytes
SO_SNDBUF and SO_RCVBUF of SCTP sockets, set before the association exists; 0 keeps the kernel's.
std::vector< std::string > allowed_peers
RAN role: literal addresses a peer may connect from (TCP and SCTP); empty accepts any.
E3AP Protocol Types - Vendor-neutral type definitions.