|
libe3 0.6.1
C++ library for E3AP RAN vendor integration
|
E3Interface - Internal protocol coordination. More...
#include <e3_interface.hpp>
Public Member Functions | |
| E3Interface (const E3Config &config) | |
| Construct with configuration. | |
| ~E3Interface () | |
| Destructor - ensures clean shutdown. | |
| E3Interface (const E3Interface &)=delete | |
| E3Interface & | operator= (const E3Interface &)=delete |
| E3Interface (E3Interface &&)=delete | |
| E3Interface & | operator= (E3Interface &&)=delete |
| ErrorCode | init () |
| Initialize the interface. | |
| ErrorCode | start () |
| Start the interface processing loops. | |
| void | stop () |
| Stop the interface. | |
| AgentState | state () const noexcept |
| Get current state. | |
| bool | is_running () const noexcept |
| Check if interface is running. | |
| SubscriptionManager & | subscription_manager () noexcept |
| Get the subscription manager. | |
| LockFreeQueue< Pdu > & | response_queue () noexcept |
| Get the response queue for outbound messages. | |
| ErrorCode | queue_outbound (Pdu pdu) |
| Queue a PDU for outbound transmission. | |
| std::vector< uint32_t > | get_available_ran_functions () const |
| Get available RAN functions. | |
| ErrorCode | register_sm (std::unique_ptr< ServiceModel > sm) |
| Register a Service Model. | |
| void | set_dapp_report_handler (DAppReportHandler handler) |
| Set the callback for a dApp report that reaches the RAN. | |
| void | set_dapp_status_changed_handler (DAppStatusChangedHandler handler) |
| Set the callback for a dApp that connects, subscribes, unsubscribes or leaves. | |
| void | set_setup_response_handler (SetupResponseHandler handler) |
| Set the callback for a SetupResponse. | |
| void | set_subscription_response_handler (SubscriptionResponseHandler handler) |
| Set the callback for a SubscriptionResponse. | |
| void | set_indication_handler (IndicationHandler handler) |
| Set the callback for an IndicationMessage. | |
| void | set_xapp_control_handler (XAppControlHandler handler) |
| Set the callback for an XAppControlAction. | |
| void | set_message_ack_handler (MessageAckHandler handler) |
| Set the callback for a MessageAck. DEPRECATED TO BE REMOVED. | |
| void | set_control_response_handler (ControlResponseHandler handler) |
| Set the callback for a ControlResponse (either role). | |
| void | set_disconnect_handler (DisconnectHandler handler) |
| std::optional< uint32_t > | dapp_id () const noexcept |
| std::vector< uint32_t > | active_subscription_ids () const |
| std::vector< uint32_t > | subscribed_ran_functions () const |
| std::vector< RanFunctionDef > | remote_ran_functions () const |
| ErrorCode | queue_subscription_request (uint32_t ran_function_id, std::vector< uint32_t > telemetry_ids, std::vector< uint32_t > control_ids, std::optional< uint32_t > sub_time=std::nullopt, std::optional< uint32_t > periodicity=std::nullopt, uint32_t *out_request_id=nullptr) |
| Queue a SubscriptionRequest for the outbound loop to send. | |
| ErrorCode | queue_subscription_delete (uint32_t ran_function_id) |
| ErrorCode | queue_dapp_control_action (uint32_t ran_function_id, uint32_t control_id, std::vector< uint8_t > action_data, uint32_t sequence_id=0, uint32_t *out_message_id=nullptr, bool request_ack=false) |
| ErrorCode | queue_control_response (uint32_t request_id, uint32_t ran_function_id, uint32_t control_id, const ControlResult &result) |
| ErrorCode | respond_to_control (uint32_t dapp_id, uint32_t request_id, const ControlResult &result) |
| ErrorCode | queue_dapp_report (uint32_t ran_function_id, std::vector< uint8_t > report_data, uint32_t sequence_id, uint32_t *out_message_id=nullptr) |
| ErrorCode | queue_release_message () |
| ErrorCode | wait_for_setup (std::chrono::milliseconds timeout) |
| void | notify_dapp_status_changed () |
| Tell the status handler that a dApp connected, subscribed, unsubscribed or left. | |
| uint32_t | generate_message_id () |
| Generate the next message ID, monotonic within 1..4294967295. | |
| uint32_t | sanitize_request_message_id (uint32_t request_id) |
| Return a request id that can be echoed into a response. | |
E3Interface - Internal protocol coordination.
This class is the internal coordination layer that:
This class is NOT directly exposed to library users. Users interact with the E3Agent facade which owns an E3Interface instance.
Definition at line 70 of file e3_interface.hpp.
|
explicit |
Construct with configuration.
| config | Role, transport, encoding and tuning for this interface |
Definition at line 212 of file e3_interface.cpp.
| libe3::E3Interface::~E3Interface | ( | ) |
Destructor - ensures clean shutdown.
Definition at line 233 of file e3_interface.cpp.
|
delete |
|
delete |
| std::vector< uint32_t > libe3::E3Interface::active_subscription_ids | ( | ) | const |
Definition at line 2052 of file e3_interface.cpp.
|
noexcept |
Definition at line 2046 of file e3_interface.cpp.
| uint32_t libe3::E3Interface::generate_message_id | ( | ) |
Generate the next message ID, monotonic within 1..4294967295.
Wraps a lock-free counter into the ASN.1 E3-MessageID range, skipping 0. Monotonic (not random) so an id is unique, letting a caller correlate a response by the id it was assigned.
Definition at line 181 of file e3_interface.cpp.
| std::vector< uint32_t > libe3::E3Interface::get_available_ran_functions | ( | ) | const |
Get available RAN functions.
Definition at line 531 of file e3_interface.cpp.
| ErrorCode libe3::E3Interface::init | ( | ) |
Initialize the interface.
Creates connector, encoder, and initializes internal state.
Definition at line 238 of file e3_interface.cpp.
|
inlinenoexcept |
Check if interface is running.
Definition at line 124 of file e3_interface.hpp.
| void libe3::E3Interface::notify_dapp_status_changed | ( | ) |
Tell the status handler that a dApp connected, subscribed, unsubscribed or left.
Definition at line 570 of file e3_interface.cpp.
|
delete |
|
delete |
| ErrorCode libe3::E3Interface::queue_control_response | ( | uint32_t | request_id, |
| uint32_t | ran_function_id, | ||
| uint32_t | control_id, | ||
| const ControlResult & | result ) |
Queue a ControlResponse that answers an xApp control (dApp role).
| request_id | message id of the xApp control this answers |
| ran_function_id | RAN function of the control |
| control_id | control the answer is about |
| result | code, reason and outcome to send |
Definition at line 2165 of file e3_interface.cpp.
| ErrorCode libe3::E3Interface::queue_dapp_control_action | ( | uint32_t | ran_function_id, |
| uint32_t | control_id, | ||
| std::vector< uint8_t > | action_data, | ||
| uint32_t | sequence_id = 0, | ||
| uint32_t * | out_message_id = nullptr, | ||
| bool | request_ack = false ) |
Queue a dApp control action for the outbound loop to send.
| ran_function_id | RAN function the control is for |
| control_id | control identifier granted by the RAN |
| action_data | opaque payload of the Service Model |
| sequence_id | correlation id of the xApp procedure this control re-issues; 0 for none |
| out_message_id | when non-null, receives the assigned E3-MessageID on success, so the caller can correlate a later response back to this send |
| request_ack | true to ask the RAN for a ControlResponse |
Definition at line 2130 of file e3_interface.cpp.
| ErrorCode libe3::E3Interface::queue_dapp_report | ( | uint32_t | ran_function_id, |
| std::vector< uint8_t > | report_data, | ||
| uint32_t | sequence_id, | ||
| uint32_t * | out_message_id = nullptr ) |
Queue a dApp report for the outbound loop to send.
| ran_function_id | RAN function the report is for |
| report_data | opaque payload of the Service Model |
| sequence_id | correlation id the dApp assigns to this detection; mandatory, not 0 |
| out_message_id | when non-null, receives the assigned E3-MessageID on success |
Definition at line 2193 of file e3_interface.cpp.
Queue a PDU for outbound transmission.
| pdu | PDU to send; it is moved into the queue |
Definition at line 502 of file e3_interface.cpp.
| ErrorCode libe3::E3Interface::queue_release_message | ( | ) |
Queue a ReleaseMessage that ends this dApp's session.
Definition at line 2226 of file e3_interface.cpp.
| ErrorCode libe3::E3Interface::queue_subscription_delete | ( | uint32_t | ran_function_id | ) |
Queue a SubscriptionDelete for the outbound loop to send.
| ran_function_id | RAN function whose subscription ends |
Definition at line 2106 of file e3_interface.cpp.
| ErrorCode libe3::E3Interface::queue_subscription_request | ( | uint32_t | ran_function_id, |
| std::vector< uint32_t > | telemetry_ids, | ||
| std::vector< uint32_t > | control_ids, | ||
| std::optional< uint32_t > | sub_time = std::nullopt, | ||
| std::optional< uint32_t > | periodicity = std::nullopt, | ||
| uint32_t * | out_request_id = nullptr ) |
Queue a SubscriptionRequest for the outbound loop to send.
| ran_function_id | RAN function to subscribe to |
| telemetry_ids | telemetry identifiers requested |
| control_ids | control identifiers requested |
| sub_time | how long to keep the subscription, in seconds; unset leaves it to the RAN |
| periodicity | microseconds between indications, 0 = every event |
| out_request_id | when non-null, receives the assigned E3-MessageID on success, so the caller can correlate the eventual SubscriptionResponse (which echoes request_id) back to this request. |
Definition at line 2068 of file e3_interface.cpp.
| ErrorCode libe3::E3Interface::register_sm | ( | std::unique_ptr< ServiceModel > | sm | ) |
Register a Service Model.
| sm | Service Model to register; ownership moves to the registry |
Definition at line 535 of file e3_interface.cpp.
| std::vector< RanFunctionDef > libe3::E3Interface::remote_ran_functions | ( | ) | const |
Definition at line 2062 of file e3_interface.cpp.
| ErrorCode libe3::E3Interface::respond_to_control | ( | uint32_t | dapp_id, |
| uint32_t | request_id, | ||
| const ControlResult & | result ) |
Answer a dApp control the RAN holds an answer for (RAN role, called by Service Models).
| dapp_id | dApp whose control is answered |
| request_id | message id of the dApp control |
| result | code, reason and outcome to send |
Definition at line 1388 of file e3_interface.cpp.
|
inlinenoexcept |
Get the response queue for outbound messages.
Definition at line 140 of file e3_interface.hpp.
| uint32_t libe3::E3Interface::sanitize_request_message_id | ( | uint32_t | request_id | ) |
Return a request id that can be echoed into a response.
The decoders do not enforce integer range constraints, so a peer-supplied message id of 0, outside E3-MessageID's 1..4294967295, can reach the handlers; echoing it into a response would fail the encode. Every non-zero id passes through unchanged, 0 is replaced with a fresh generated id.
| request_id | Message id a peer sent |
Definition at line 203 of file e3_interface.cpp.
|
inline |
Set the callback for a ControlResponse (either role).
| handler | Callback to call |
Definition at line 200 of file e3_interface.hpp.
|
inline |
Set the callback for a dApp report that reaches the RAN.
| handler | Callback to call |
Definition at line 169 of file e3_interface.hpp.
|
inline |
Set the callback for a dApp that connects, subscribes, unsubscribes or leaves.
| handler | Callback to call |
Definition at line 174 of file e3_interface.hpp.
|
inline |
Called once when the dApp's session with the RAN ends (see E3Agent::set_disconnect_handler).
| handler | Callback to call |
Definition at line 205 of file e3_interface.hpp.
|
inline |
Set the callback for an IndicationMessage.
| handler | Callback to call |
Definition at line 188 of file e3_interface.hpp.
|
inline |
Set the callback for a MessageAck. DEPRECATED TO BE REMOVED.
| handler | Callback to call |
Definition at line 196 of file e3_interface.hpp.
|
inline |
Set the callback for a SetupResponse.
| handler | Callback to call |
Definition at line 180 of file e3_interface.hpp.
|
inline |
Set the callback for a SubscriptionResponse.
| handler | Callback to call |
Definition at line 184 of file e3_interface.hpp.
|
inline |
Set the callback for an XAppControlAction.
| handler | Callback to call |
Definition at line 192 of file e3_interface.hpp.
| ErrorCode libe3::E3Interface::start | ( | ) |
Start the interface processing loops.
Spawns the setup, inbound, and outbound threads, plus the report worker on the RAN role.
Definition at line 318 of file e3_interface.cpp.
|
inlinenoexcept |
Get current state.
Definition at line 118 of file e3_interface.hpp.
| void libe3::E3Interface::stop | ( | ) |
Stop the interface.
Signals all threads to stop and waits for them to finish. It also ends the dApp's reconnecting, so the dApp stays down. Not to be called from the disconnect handler, which runs on a thread stop() joins.
Definition at line 407 of file e3_interface.cpp.
| std::vector< uint32_t > libe3::E3Interface::subscribed_ran_functions | ( | ) | const |
Definition at line 2057 of file e3_interface.cpp.
|
inlinenoexcept |
Get the subscription manager.
Definition at line 132 of file e3_interface.hpp.
| ErrorCode libe3::E3Interface::wait_for_setup | ( | std::chrono::milliseconds | timeout | ) |
Block until the setup handshake completes (or times out / fails). Only meaningful on dApp role.
| timeout | How long to wait |
Definition at line 2242 of file e3_interface.cpp.