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

Abstract base class for E3AP transport connectors. More...

#include <e3_connector.hpp>

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

Public Member Functions

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 setup_initial_connection ()=0
 Set up the initial connection (setup channel).
virtual int recv_setup_request (std::vector< uint8_t > &buffer)=0
 Receive a setup request.
virtual ErrorCode send_response (const std::vector< uint8_t > &data)=0
 Send a setup response.
virtual ErrorCode setup_inbound_connection ()=0
 Set up the inbound connection (SUB channel).
virtual int receive (std::vector< uint8_t > &buffer)=0
 Receive data from the inbound channel.
virtual ErrorCode setup_outbound_connection ()=0
 Set up the outbound connection (PUB channel).
virtual ErrorCode send (const std::vector< uint8_t > &data)=0
 Send data on the outbound channel.
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 ErrorCode setup_initial_connection_client ()
 Connect the setup channel (dApp role: REQ connect).
virtual ErrorCode send_setup_request_client (const std::vector< uint8_t > &)
 Send a SetupRequest on the setup channel (dApp role).
virtual int recv_setup_response_client (std::vector< uint8_t > &)
 Receive a SetupResponse on the setup channel (dApp role).
virtual ErrorCode setup_inbound_connection_client ()
 Connect the inbound channel (dApp role: SUB connect to the RAN's publisher endpoint).
virtual ErrorCode setup_outbound_connection_client ()
 Connect the outbound channel (dApp role: PUB connect to the RAN's subscriber endpoint).
virtual void dispose ()=0
 Clean up and release all resources.
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 std::vector< uint64_t > take_closed_peers ()
 Peers whose connection has closed since the last call (RAN role).
virtual E3LinkLayer link_layer () const noexcept=0
 Get the link layer type.
virtual E3TransportLayer transport_layer () const noexcept=0
 Get the transport layer type.
virtual bool is_connected () const noexcept=0
 Check if connector is connected.
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.

Protected Member Functions

 E3Connector ()=default

Protected Attributes

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

Abstract base class for E3AP transport connectors.

This class defines the transport-agnostic interface that all connectors must implement. The design mirrors the original C implementation's function pointer approach, but uses virtual methods for type safety.

Derived classes:

  • PosixE3Connector: POSIX socket-based transport (TCP, SCTP, IPC); one endpoint per dApp carries the setup, inbound and outbound traffic
  • ZmqE3Connector: ZeroMQ-based transport

Definition at line 64 of file e3_connector.hpp.

Constructor & Destructor Documentation

◆ ~E3Connector()

virtual libe3::E3Connector::~E3Connector ( )
virtualdefault

◆ E3Connector() [1/3]

libe3::E3Connector::E3Connector ( const E3Connector & )
delete

◆ E3Connector() [2/3]

libe3::E3Connector::E3Connector ( E3Connector && )
default

Move constructor.

◆ E3Connector() [3/3]

libe3::E3Connector::E3Connector ( )
protecteddefault

Member Function Documentation

◆ dispose()

virtual void libe3::E3Connector::dispose ( )
pure virtual

Clean up and release all resources.

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ inbound_endpoint()

const std::string & libe3::E3Connector::inbound_endpoint ( ) const
inlinenoexcept

Get inbound endpoint.

Returns
The endpoint of the inbound channel

Definition at line 294 of file e3_connector.hpp.

◆ is_connected()

virtual bool libe3::E3Connector::is_connected ( ) const
pure virtualnoexcept

Check if connector is connected.

Returns
true once the connector has set up its connections

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ last_peer_token()

virtual uint64_t libe3::E3Connector::last_peer_token ( ) const
inlinevirtual

Which peer supplied the bytes the last receive() returned (RAN role).

Call it on the thread that calls receive(), right after a receive() that returned bytes. A token names one accepted connection and is never reused by the same connector, so a closed peer's token cannot name a later one.

Returns
The peer's token, or 0 for a connector that cannot tell its peers apart (the default, and ZeroMQ)

Reimplemented in libe3::PosixE3Connector.

Definition at line 227 of file e3_connector.hpp.

◆ last_setup_peer_token()

virtual uint64_t libe3::E3Connector::last_setup_peer_token ( ) const
inlinevirtual

Which peer sent the setup request the last recv_setup_request() returned (RAN role).

Call it on the thread that calls recv_setup_request(), right after a call that returned bytes. The token is the one last_peer_token() gives for the same peer's later bytes, so a RAN can tie a dApp to its connection at setup.

Returns
The peer's token, or 0 for a connector that cannot tell its peers apart (the default, and ZeroMQ)

Reimplemented in libe3::PosixE3Connector.

Definition at line 239 of file e3_connector.hpp.

◆ link_layer()

virtual E3LinkLayer libe3::E3Connector::link_layer ( ) const
pure virtualnoexcept

Get the link layer type.

Returns
The link layer this connector runs on

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ operator=() [1/2]

E3Connector & libe3::E3Connector::operator= ( const E3Connector & )
delete

◆ operator=() [2/2]

E3Connector & libe3::E3Connector::operator= ( E3Connector && )
default

Move assignment.

Returns
This connector

◆ outbound_endpoint()

const std::string & libe3::E3Connector::outbound_endpoint ( ) const
inlinenoexcept

Get outbound endpoint.

Returns
The endpoint of the outbound channel

Definition at line 300 of file e3_connector.hpp.

◆ receive()

virtual int libe3::E3Connector::receive ( std::vector< uint8_t > & buffer)
pure virtual

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

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ recv_setup_request()

virtual int libe3::E3Connector::recv_setup_request ( std::vector< uint8_t > & buffer)
pure virtual

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

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ recv_setup_response_client()

virtual int libe3::E3Connector::recv_setup_response_client ( std::vector< uint8_t > & )
inlinevirtual

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

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

Reimplemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

Definition at line 182 of file e3_connector.hpp.

◆ role()

E3Role libe3::E3Connector::role ( ) const
inlinenoexcept

Get current role.

Returns
The role of this peer

Definition at line 282 of file e3_connector.hpp.

◆ send()

virtual ErrorCode libe3::E3Connector::send ( const std::vector< uint8_t > & data)
pure virtual

Send data on the outbound channel.

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

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ send_response()

virtual ErrorCode libe3::E3Connector::send_response ( const std::vector< uint8_t > & data)
pure virtual

Send a setup response.

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

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ send_setup_request_client()

virtual ErrorCode libe3::E3Connector::send_setup_request_client ( const std::vector< uint8_t > & )
inlinevirtual

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

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

Reimplemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

Definition at line 174 of file e3_connector.hpp.

◆ send_to()

virtual ErrorCode libe3::E3Connector::send_to ( uint64_t peer_token,
const std::vector< uint8_t > & data,
PduClass kind )
inlinevirtual

Send data to one peer, or to all of them (RAN role).

The default broadcasts with send(), which is what a connector that cannot tell its peers apart does.

Parameters
peer_tokenThe peer named by last_peer_token() or last_setup_peer_token(); 0 sends to every peer
dataData to send
kindWhat the PDU is for
Returns
ErrorCode::SUCCESS on success, an error code otherwise

Reimplemented in libe3::PosixE3Connector.

Definition at line 146 of file e3_connector.hpp.

◆ set_role()

void libe3::E3Connector::set_role ( E3Role role)
inlinenoexcept

Set role (RAN or DAPP). Affects bind vs connect direction and cleanup behaviour. Must be set before any setup_* call. Default RAN.

Parameters
roleThe role of this peer

Definition at line 276 of file e3_connector.hpp.

◆ setup_endpoint()

const std::string & libe3::E3Connector::setup_endpoint ( ) const
inlinenoexcept

Get setup endpoint.

Returns
The endpoint of the setup channel

Definition at line 288 of file e3_connector.hpp.

◆ setup_inbound_connection()

virtual ErrorCode libe3::E3Connector::setup_inbound_connection ( )
pure virtual

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

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ setup_inbound_connection_client()

virtual ErrorCode libe3::E3Connector::setup_inbound_connection_client ( )
inlinevirtual

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

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

Reimplemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

Definition at line 191 of file e3_connector.hpp.

◆ setup_initial_connection()

virtual ErrorCode libe3::E3Connector::setup_initial_connection ( )
pure virtual

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

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ setup_initial_connection_client()

virtual ErrorCode libe3::E3Connector::setup_initial_connection_client ( )
inlinevirtual

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

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

Reimplemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

Definition at line 166 of file e3_connector.hpp.

◆ setup_outbound_connection()

virtual ErrorCode libe3::E3Connector::setup_outbound_connection ( )
pure virtual

Set up the outbound connection (PUB channel).

This establishes the channel for sending indications to dApps.

Returns
ErrorCode::SUCCESS on success, error code otherwise

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

◆ setup_outbound_connection_client()

virtual ErrorCode libe3::E3Connector::setup_outbound_connection_client ( )
inlinevirtual

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

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

Reimplemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

Definition at line 200 of file e3_connector.hpp.

◆ shutdown()

virtual void libe3::E3Connector::shutdown ( )
inlinevirtual

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 in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

Definition at line 215 of file e3_connector.hpp.

◆ take_closed_peers()

virtual std::vector< uint64_t > libe3::E3Connector::take_closed_peers ( )
inlinevirtual

Peers whose connection has closed since the last call (RAN role).

Call it on the thread that calls receive(). Each token is returned once, and only after the bytes that peer sent before closing were delivered. The default returns nothing: a connector that cannot tell its peers apart cannot tell that one left.

Returns
The tokens of the peers that closed, oldest first

Reimplemented in libe3::PosixE3Connector.

Definition at line 251 of file e3_connector.hpp.

◆ transport_layer()

virtual E3TransportLayer libe3::E3Connector::transport_layer ( ) const
pure virtualnoexcept

Get the transport layer type.

Returns
The transport layer this connector runs on

Implemented in libe3::PosixE3Connector, and libe3::ZmqE3Connector.

Member Data Documentation

◆ inbound_endpoint_

std::string libe3::E3Connector::inbound_endpoint_
protected

Endpoint of the inbound channel.

Definition at line 306 of file e3_connector.hpp.

◆ outbound_endpoint_

std::string libe3::E3Connector::outbound_endpoint_
protected

Endpoint of the outbound channel.

Definition at line 307 of file e3_connector.hpp.

◆ role_

E3Role libe3::E3Connector::role_ {E3Role::RAN}
protected

Role of this peer.

Definition at line 308 of file e3_connector.hpp.

◆ setup_endpoint_

std::string libe3::E3Connector::setup_endpoint_
protected

Endpoint of the setup channel.

Definition at line 305 of file e3_connector.hpp.


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