libe3 0.6.1
C++ library for E3AP RAN vendor integration
Loading...
Searching...
No Matches
libe3::ZmqE3Connector Class Reference

ZeroMQ-based E3 connector. More...

#include <zmq_connector.hpp>

Inheritance diagram for libe3::ZmqE3Connector:
libe3::E3Connector

Public Member Functions

 ZmqE3Connector (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)
 ~ZmqE3Connector () override
ErrorCode setup_initial_connection () override
 Set up the initial connection (setup channel).
int recv_setup_request (std::vector< uint8_t > &buffer) override
 Receive a setup request.
ErrorCode send_response (const std::vector< uint8_t > &data) override
 Send a setup response.
ErrorCode setup_inbound_connection () override
 Set up the inbound connection (SUB channel).
int receive (std::vector< uint8_t > &buffer) override
 Receive data from the inbound channel.
ErrorCode setup_outbound_connection () override
 Set up the outbound connection (PUB 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).
ErrorCode send_setup_request_client (const std::vector< uint8_t > &data) override
 Send a SetupRequest on the setup channel (dApp role).
int recv_setup_response_client (std::vector< uint8_t > &buffer) override
 Receive a SetupResponse on the setup channel (dApp role).
ErrorCode setup_inbound_connection_client () override
 Connect the inbound channel (dApp role: SUB connect to the RAN's publisher endpoint).
ErrorCode setup_outbound_connection_client () override
 Connect the outbound channel (dApp role: PUB connect to the RAN's subscriber endpoint).
void dispose () override
 Clean up and release all resources.
void shutdown () override
 Interrupt blocking operations for shutdown.
E3LinkLayer link_layer () const noexcept override
 Get the link layer type.
E3TransportLayer transport_layer () const noexcept override
 Get the transport layer type.
bool is_connected () const noexcept override
 Check if connector is connected.
Public Member Functions inherited from libe3::E3Connector
virtual ~E3Connector ()=default
 E3Connector (const E3Connector &)=delete
E3Connector & operator= (const E3Connector &)=delete
 E3Connector (E3Connector &&)=default
 Move constructor.
E3Connector & operator= (E3Connector &&)=default
 Move assignment.
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 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 std::vector< uint64_t > take_closed_peers ()
 Peers whose connection has closed since the last call (RAN role).
void set_role (E3Role role) noexcept
 Set role (RAN or DAPP). Affects bind vs connect direction and cleanup behaviour. Must be set before any setup_* call. Default RAN.
E3Role role () const noexcept
 Get current role.
const std::string & setup_endpoint () const noexcept
 Get setup endpoint.
const std::string & inbound_endpoint () const noexcept
 Get inbound endpoint.
const std::string & outbound_endpoint () const noexcept
 Get outbound endpoint.

Additional Inherited Members

Protected Member Functions inherited from libe3::E3Connector
 E3Connector ()=default
Protected Attributes inherited from libe3::E3Connector
std::string setup_endpoint_
 Endpoint of the setup channel.
std::string inbound_endpoint_
 Endpoint of the inbound channel.
std::string outbound_endpoint_
 Endpoint of the outbound channel.
E3Role role_ {E3Role::RAN}
 Role of this peer.

Detailed Description

ZeroMQ-based E3 connector.

Provides transport using ZeroMQ sockets. Supports TCP and IPC transports. Ported from the original C implementation's zeromq_* functions.

Definition at line 24 of file zmq_connector.hpp.

Constructor & Destructor Documentation

◆ ZmqE3Connector()

libe3::ZmqE3Connector::ZmqE3Connector ( 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 )

Definition at line 45 of file zmq_connector.cpp.

◆ ~ZmqE3Connector()

libe3::ZmqE3Connector::~ZmqE3Connector ( )
override

Definition at line 81 of file zmq_connector.cpp.

Member Function Documentation

◆ dispose()

void libe3::ZmqE3Connector::dispose ( )
overridevirtual

Clean up and release all resources.

Implements libe3::E3Connector.

Definition at line 509 of file zmq_connector.cpp.

◆ is_connected()

bool libe3::ZmqE3Connector::is_connected ( ) const
inlineoverridevirtualnoexcept

Check if connector is connected.

Returns
true once the connector has set up its connections

Implements libe3::E3Connector.

Definition at line 65 of file zmq_connector.hpp.

◆ link_layer()

E3LinkLayer libe3::ZmqE3Connector::link_layer ( ) const
inlineoverridevirtualnoexcept

Get the link layer type.

Returns
The link layer this connector runs on

Implements libe3::E3Connector.

Definition at line 57 of file zmq_connector.hpp.

◆ receive()

int libe3::ZmqE3Connector::receive ( std::vector< uint8_t > & buffer)
overridevirtual

Receive data from the inbound channel.

Parameters
bufferBuffer to store received data
Returns
Number of bytes received; 0 on timeout (nothing yet); ErrorCode::NOT_CONNECTED once the peer has closed (dApp role); any other negative ErrorCode on a transport error

Implements libe3::E3Connector.

Definition at line 232 of file zmq_connector.cpp.

◆ recv_setup_request()

int libe3::ZmqE3Connector::recv_setup_request ( std::vector< uint8_t > & buffer)
overridevirtual

Receive a setup request.

Blocks until a setup request is received on the setup channel.

Parameters
bufferBuffer to store received data
Returns
Number of bytes received, or negative error code

Implements libe3::E3Connector.

Definition at line 158 of file zmq_connector.cpp.

◆ recv_setup_response_client()

int libe3::ZmqE3Connector::recv_setup_response_client ( std::vector< uint8_t > & )
overridevirtual

Receive a SetupResponse on the setup channel (dApp role).

Returns
Number of bytes received, 0 on timeout, a negative ErrorCode on error

Reimplemented from libe3::E3Connector.

Definition at line 390 of file zmq_connector.cpp.

◆ send()

ErrorCode libe3::ZmqE3Connector::send ( const std::vector< uint8_t > & data)
overridevirtual

Send data on the outbound channel.

Parameters
dataData to send
Returns
ErrorCode::SUCCESS on success, error code otherwise

Implements libe3::E3Connector.

Definition at line 286 of file zmq_connector.cpp.

◆ send_response()

ErrorCode libe3::ZmqE3Connector::send_response ( const std::vector< uint8_t > & data)
overridevirtual

Send a setup response.

Parameters
dataResponse data to send
Returns
ErrorCode::SUCCESS on success, error code otherwise

Implements libe3::E3Connector.

Definition at line 180 of file zmq_connector.cpp.

◆ send_setup_request_client()

ErrorCode libe3::ZmqE3Connector::send_setup_request_client ( const std::vector< uint8_t > & )
overridevirtual

Send a SetupRequest on the setup channel (dApp role).

Returns
ErrorCode::SUCCESS on success, an error code otherwise

Reimplemented from libe3::E3Connector.

Definition at line 376 of file zmq_connector.cpp.

◆ setup_inbound_connection()

ErrorCode libe3::ZmqE3Connector::setup_inbound_connection ( )
overridevirtual

Set up the inbound connection (SUB channel).

This establishes the channel for receiving control actions from dApps.

Returns
ErrorCode::SUCCESS on success, error code otherwise

Implements libe3::E3Connector.

Definition at line 196 of file zmq_connector.cpp.

◆ setup_inbound_connection_client()

ErrorCode libe3::ZmqE3Connector::setup_inbound_connection_client ( )
overridevirtual

Connect the inbound channel (dApp role: SUB connect to the RAN's publisher endpoint).

Returns
ErrorCode::SUCCESS on success, an error code otherwise

Reimplemented from libe3::E3Connector.

Definition at line 445 of file zmq_connector.cpp.

◆ setup_initial_connection()

ErrorCode libe3::ZmqE3Connector::setup_initial_connection ( )
overridevirtual

Set up the initial connection (setup channel).

This establishes the REQ/REP channel used for E3 Setup procedures.

Returns
ErrorCode::SUCCESS on success, error code otherwise

Implements libe3::E3Connector.

Definition at line 85 of file zmq_connector.cpp.

◆ setup_initial_connection_client()

ErrorCode libe3::ZmqE3Connector::setup_initial_connection_client ( )
overridevirtual

Connect the setup channel (dApp role: REQ connect).

Returns
ErrorCode::SUCCESS on success, ErrorCode::INVALID_PARAM if the connector has no dApp role

Reimplemented from libe3::E3Connector.

Definition at line 329 of file zmq_connector.cpp.

◆ setup_outbound_connection()

ErrorCode libe3::ZmqE3Connector::setup_outbound_connection ( )
overridevirtual

Set up the outbound connection (PUB channel).

This establishes the channel for sending indications to dApps.

Returns
ErrorCode::SUCCESS on success, error code otherwise

Implements libe3::E3Connector.

Definition at line 260 of file zmq_connector.cpp.

◆ setup_outbound_connection_client()

ErrorCode libe3::ZmqE3Connector::setup_outbound_connection_client ( )
overridevirtual

Connect the outbound channel (dApp role: PUB connect to the RAN's subscriber endpoint).

Returns
ErrorCode::SUCCESS on success, an error code otherwise

Reimplemented from libe3::E3Connector.

Definition at line 480 of file zmq_connector.cpp.

◆ shutdown()

void libe3::ZmqE3Connector::shutdown ( )
overridevirtual

Interrupt blocking operations for shutdown.

Called before joining threads to unblock any blocking socket operations. Default implementation does nothing (for connectors that use timeouts).

Reimplemented from libe3::E3Connector.

Definition at line 571 of file zmq_connector.cpp.

◆ transport_layer()

E3TransportLayer libe3::ZmqE3Connector::transport_layer ( ) const
inlineoverridevirtualnoexcept

Get the transport layer type.

Returns
The transport layer this connector runs on

Implements libe3::E3Connector.

Definition at line 61 of file zmq_connector.hpp.


The documentation for this class was generated from the following files: