|
libe3 0.6.1
C++ library for E3AP RAN vendor integration
|
E3Agent - Main façade for RAN vendor integration. More...
#include <e3_agent.hpp>
Classes | |
| struct | Impl |
| E3Agent implementation details. More... | |
Public Member Functions | |
| E3Agent (E3Config config=E3Config{}) | |
| Construct an E3Agent with configuration. | |
| ~E3Agent () | |
| Destructor - ensures clean shutdown. | |
| E3Agent (const E3Agent &)=delete | |
| E3Agent & | operator= (const E3Agent &)=delete |
| E3Agent (E3Agent &&) noexcept | |
| Move constructor. | |
| E3Agent & | operator= (E3Agent &&) noexcept |
| Move assignment. | |
| ErrorCode | init () |
| Initialize the agent. | |
| ErrorCode | start () |
| Start the agent. | |
| void | stop () |
| Stop the agent. | |
| AgentState | state () const noexcept |
| Get current agent state. | |
| bool | is_running () const noexcept |
| Check if agent is running. | |
| ErrorCode | register_sm (std::unique_ptr< ServiceModel > sm) |
| Register a Service Model. | |
| std::vector< uint32_t > | get_available_ran_functions () const |
| Get available RAN function IDs. | |
| void | set_dapp_report_handler (DAppReportHandler handler) |
| Set callback for incoming dApp reports (dApp → RAN). Call before start(). When a dApp sends a DApp report, this callback is invoked. | |
| void | set_dapp_status_changed_handler (DAppStatusChangedHandler handler) |
| Set callback for dApp status changes. Called when a dApp connects, disconnects, subscribes, or unsubscribes. Call before start(). | |
| ErrorCode | send_indication (uint32_t dapp_id, uint32_t ran_function_id, const std::vector< uint8_t > &data) |
| Send an indication message to a specific dApp. | |
| ErrorCode | send_xapp_control (uint32_t dapp_id, uint32_t ran_function_id, const std::vector< uint8_t > &control_data, uint32_t sequence_id, uint32_t *out_message_id=nullptr, bool request_ack=false) |
| Send an xApp control action to a specific dApp coming from the E2SM-DAPP. | |
| ErrorCode | send_message_ack (uint32_t request_id, ResponseCode response_code) |
| Send a message acknowledgment. | |
| void | set_setup_response_handler (SetupResponseHandler handler) |
| void | set_subscription_response_handler (SubscriptionResponseHandler handler) |
| void | set_indication_handler (IndicationHandler handler) |
| void | set_xapp_control_handler (XAppControlHandler handler) |
| void | set_message_ack_handler (MessageAckHandler handler) |
| void | set_control_response_handler (ControlResponseHandler handler) |
| void | set_disconnect_handler (DisconnectHandler handler) |
| std::optional< uint32_t > | dapp_id () const noexcept |
| dApp identifier assigned by the RAN in SetupResponse. | |
| std::vector< uint32_t > | subscribed_ran_functions () const |
| std::vector< uint32_t > | active_subscription_ids () const |
| ErrorCode | wait_for_setup (std::chrono::milliseconds timeout) |
| Block until the dApp setup handshake completes. | |
| ErrorCode | subscribe (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) |
| Subscribe to a RAN function. Must be called after a positive setup. | |
| ErrorCode | unsubscribe (uint32_t ran_function_id) |
| ErrorCode | send_control (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) |
| Send a dApp control action to the RAN. | |
| ErrorCode | send_control_response (uint32_t request_id, uint32_t ran_function_id, uint32_t control_id, const ControlResult &result) |
| Answer an xApp control that asked for an answer (XAppControlAction::request_ack). | |
| ErrorCode | send_report (uint32_t ran_function_id, std::vector< uint8_t > report_data, uint32_t sequence_id, uint32_t *out_message_id=nullptr) |
| Send a dApp report to the RAN. | |
| ErrorCode | release () |
| std::vector< uint32_t > | get_registered_dapps () const |
| Get list of registered dApp IDs. | |
| std::vector< uint32_t > | get_dapp_subscriptions (uint32_t dapp_id) const |
| Get subscriptions for a dApp. | |
| std::vector< uint32_t > | get_ran_function_subscribers (uint32_t ran_function_id) const |
| Get subscribers for a RAN function. | |
| std::vector< uint32_t > | get_active_ran_functions () const |
| Get the RAN functions that currently have at least one subscriber. | |
| uint32_t | get_subscription_periodicity (uint32_t dapp_id, uint32_t ran_function_id) const |
| Get the reporting periodicity a dApp requested for a RAN function. | |
| std::vector< uint32_t > | get_subscription_telemetry_ids (uint32_t dapp_id, uint32_t ran_function_id) const |
| Get the telemetry IDs a dApp requested for a RAN function. | |
| std::vector< uint32_t > | get_subscription_control_ids (uint32_t dapp_id, uint32_t ran_function_id) const |
| Get the control IDs a dApp requested for a RAN function. | |
| const E3Config & | config () const noexcept |
| Get current configuration. | |
| size_t | dapp_count () const |
| Get number of registered dApps. | |
| size_t | subscription_count () const |
| Get total number of active subscriptions. | |
| E3Agent (E3Config config) | |
| Build the agent. | |
| ~E3Agent () | |
| ErrorCode | init () |
| Prepare the agent. | |
| ErrorCode | start () |
| Start the agent. | |
| void | stop () |
| Stop the agent and join its threads. | |
| AgentState | state () const noexcept |
| bool | is_running () const noexcept |
| ErrorCode | send_indication (uint32_t dapp_id, uint32_t ran_function_id, const std::vector< uint8_t > &data) |
| ErrorCode | send_message_ack (uint32_t request_id, ResponseCode response_code) |
| ErrorCode | unsubscribe (uint32_t ran_function_id) |
| ErrorCode | send_control (uint32_t ran_function_id, uint32_t control_id, std::vector< uint8_t > action_data, uint32_t sequence_id=0) |
| ErrorCode | send_report (uint32_t ran_function_id, std::vector< uint8_t > report_data, uint32_t sequence_id) |
| ErrorCode | release () |
| Release this dApp (dApp role). | |
| std::vector< uint32_t > | subscribed_ran_functions () const |
| std::vector< uint32_t > | active_subscription_ids () const |
| const E3Config & | config () const noexcept |
| size_t | dapp_count () const |
| size_t | subscription_count () const |
E3Agent - Main façade for RAN vendor integration.
This class is the primary entry point for integrating E3AP functionality into a RAN function (DU, CU-CP, CU-UP). It provides:
Usage Example:
Thread Safety: All public methods are thread-safe. The agent manages its own internal threads for protocol handling.
Definition at line 94 of file e3_agent.hpp.
Construct an E3Agent with configuration.
| config | Agent configuration |
Definition at line 47 of file e3_agent.cpp.
| libe3::E3Agent::~E3Agent | ( | ) |
Destructor - ensures clean shutdown.
Definition at line 53 of file e3_agent.cpp.
|
delete |
|
defaultnoexcept |
Move constructor.
| libe3::E3Agent::E3Agent | ( | E3Config | config | ) |
Build the agent.
| config | Role, links, encoding and limits, as for libe3::E3Agent |
| libe3::E3Agent::~E3Agent | ( | ) |
| std::vector< uint32_t > libe3::E3Agent::active_subscription_ids | ( | ) | const |
Subscription IDs this dApp currently holds.
Definition at line 434 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::active_subscription_ids | ( | ) | const |
|
noexcept |
Get current configuration.
Definition at line 341 of file e3_agent.cpp.
|
noexcept |
| size_t libe3::E3Agent::dapp_count | ( | ) | const |
Get number of registered dApps.
Definition at line 349 of file e3_agent.cpp.
| size_t libe3::E3Agent::dapp_count | ( | ) | const |
|
noexcept |
dApp identifier assigned by the RAN in SetupResponse.
Definition at line 424 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::get_active_ran_functions | ( | ) | const |
Get the RAN functions that currently have at least one subscriber.
RAN role only. Unlike get_available_ran_functions() (which lists every registered Service Model), this returns only the RAN functions a dApp is actively subscribed to.
Definition at line 303 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::get_available_ran_functions | ( | ) | const |
Get available RAN function IDs.
Returns the RAN function IDs from all registered Service Models.
Definition at line 184 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::get_dapp_subscriptions | ( | uint32_t | dapp_id | ) | const |
Get subscriptions for a dApp.
| dapp_id | dApp identifier |
Definition at line 289 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::get_ran_function_subscribers | ( | uint32_t | ran_function_id | ) | const |
Get subscribers for a RAN function.
| ran_function_id | RAN function identifier |
Definition at line 296 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::get_registered_dapps | ( | ) | const |
| std::vector< uint32_t > libe3::E3Agent::get_subscription_control_ids | ( | uint32_t | dapp_id, |
| uint32_t | ran_function_id ) const |
Get the control IDs a dApp requested for a RAN function.
| dapp_id | The dApp |
| ran_function_id | The RAN function |
Definition at line 328 of file e3_agent.cpp.
| uint32_t libe3::E3Agent::get_subscription_periodicity | ( | uint32_t | dapp_id, |
| uint32_t | ran_function_id ) const |
Get the reporting periodicity a dApp requested for a RAN function.
| dapp_id | The dApp |
| ran_function_id | The RAN function |
Definition at line 310 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::get_subscription_telemetry_ids | ( | uint32_t | dapp_id, |
| uint32_t | ran_function_id ) const |
Get the telemetry IDs a dApp requested for a RAN function.
| dapp_id | The dApp |
| ran_function_id | The RAN function |
Definition at line 319 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::init | ( | ) |
Initialize the agent.
Initializes internal components but does not start processing. Must be called before start().
Definition at line 65 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::init | ( | ) |
Prepare the agent.
|
noexcept |
Check if agent is running.
Definition at line 156 of file e3_agent.cpp.
|
noexcept |
Move assignment.
| ErrorCode libe3::E3Agent::register_sm | ( | std::unique_ptr< ServiceModel > | sm | ) |
Register a Service Model.
Service Models must be registered before start() is called. Each SM handles one or more RAN function IDs.
| sm | Service Model to register (ownership transferred) |
Definition at line 164 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::release | ( | ) |
Send a ReleaseMessage. The dApp stays running until stop() is called.
Definition at line 495 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::release | ( | ) |
Release this dApp (dApp role).
| ErrorCode libe3::E3Agent::send_control | ( | uint32_t | ran_function_id, |
| uint32_t | control_id, | ||
| std::vector< uint8_t > | action_data, | ||
| uint32_t | sequence_id = 0 ) |
Send a dApp control (dApp role).
| ran_function_id | RAN function the control is for |
| control_id | control identifier granted by the RAN |
| action_data | opaque Service Model payload |
| sequence_id | correlation id of the xApp procedure this control re-issues, or 0 |
| ErrorCode libe3::E3Agent::send_control | ( | 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 ) |
Send a dApp control action to the RAN.
| ran_function_id | RAN function the control is for |
| control_id | control identifier granted by the RAN |
| action_data | opaque E3SM control payload |
| sequence_id | correlation id of the xApp procedure this control re-issues; leave 0 for a control the dApp decided on its own. |
| out_message_id | when non-null, receives the assigned E3-MessageID on success: the request_id of the ControlResponse that answers it. |
| request_ack | true to ask the RAN for a ControlResponse when the control has been dealt with. Without it the RAN answers only a control that it refuses itself (no setup, unknown function or control, no subscription). |
Definition at line 464 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::send_control_response | ( | uint32_t | request_id, |
| uint32_t | ran_function_id, | ||
| uint32_t | control_id, | ||
| const ControlResult & | result ) |
Answer an xApp control that asked for an answer (XAppControlAction::request_ack).
| request_id | XAppControlAction::message_id of the control being answered |
| ran_function_id | RAN function of the control |
| control_id | control the dApp applied, from the list the RAN advertised for the function |
| result | Whether the dApp applied the control, why not, and what it reports about it |
Definition at line 476 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::send_indication | ( | uint32_t | dapp_id, |
| uint32_t | ran_function_id, | ||
| const std::vector< uint8_t > & | data ) |
Send an indication message to a specific dApp.
| dapp_id | Target dApp identifier |
| ran_function_id | RAN function identifier |
| data | E3SM-encoded indication data |
Definition at line 209 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::send_indication | ( | uint32_t | dapp_id, |
| uint32_t | ran_function_id, | ||
| const std::vector< uint8_t > & | data ) |
Send an indication to one dApp (RAN role).
| dapp_id | dApp the indication is for |
| ran_function_id | RAN function it comes from |
| data | opaque Service Model payload |
| ErrorCode libe3::E3Agent::send_message_ack | ( | uint32_t | request_id, |
| ResponseCode | response_code ) |
Send a message acknowledgment.
DEPRECATED TO BE REMOVED. The answer to a control is a ControlResponse, which a Service Model sends with ServiceModel::respond_to_control(). A libe3 RAN does not read a MessageAck from a dApp.
| request_id | ID of the request being acknowledged |
| response_code | ResponseCode::POSITIVE (0) or NEGATIVE (1) |
Definition at line 269 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::send_message_ack | ( | uint32_t | request_id, |
| ResponseCode | response_code ) |
Send a message acknowledgment. DEPRECATED TO BE REMOVED.
| request_id | request being acknowledged |
| response_code | POSITIVE or NEGATIVE |
| ErrorCode libe3::E3Agent::send_report | ( | uint32_t | ran_function_id, |
| std::vector< uint8_t > | report_data, | ||
| uint32_t | sequence_id ) |
Send a dApp report (dApp role).
| ran_function_id | RAN function the report is for |
| report_data | opaque Service Model payload |
| sequence_id | correlation id the dApp assigns to the detection, not 0 |
| ErrorCode libe3::E3Agent::send_report | ( | uint32_t | ran_function_id, |
| std::vector< uint8_t > | report_data, | ||
| uint32_t | sequence_id, | ||
| uint32_t * | out_message_id = nullptr ) |
Send a dApp report to the RAN.
| ran_function_id | RAN function the report is for |
| report_data | opaque E3SM report payload |
| sequence_id | correlation id the dApp assigns to this detection. It is the head of the loop's chain and is mandatory on the wire. |
| out_message_id | when non-null, receives the assigned E3-MessageID on success, so the caller can correlate a later ack/response back to this send. |
Definition at line 485 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::send_xapp_control | ( | uint32_t | dapp_id, |
| uint32_t | ran_function_id, | ||
| const std::vector< uint8_t > & | control_data, | ||
| uint32_t | sequence_id, | ||
| uint32_t * | out_message_id = nullptr, | ||
| bool | request_ack = false ) |
Send an xApp control action to a specific dApp coming from the E2SM-DAPP.
| dapp_id | Target dApp identifier |
| ran_function_id | RAN function identifier |
| control_data | E3SM-encoded control payload |
| sequence_id | Correlation id from the E2SM-DAPP control header, so the dApp can carry it back on the control it re-issues. |
| out_message_id | When non-null, receives the E3-MessageID of the control on success: the request_id of the ControlResponse that answers it. |
| request_ack | True to ask the dApp for a ControlResponse; it reaches the handler of set_control_response_handler(). |
Definition at line 238 of file e3_agent.cpp.
| void libe3::E3Agent::set_control_response_handler | ( | ControlResponseHandler | handler | ) |
Set callback for incoming ControlResponse, in either role. On a dApp it is the RAN's answer to a control that asked for one, or the RAN's refusal of any control; on a RAN it is a dApp's answer to an xApp control that asked for one.
| handler | Called with each response |
Definition at line 410 of file e3_agent.cpp.
| void libe3::E3Agent::set_dapp_report_handler | ( | DAppReportHandler | handler | ) |
Set callback for incoming dApp reports (dApp → RAN). Call before start(). When a dApp sends a DApp report, this callback is invoked.
| handler | Called with each dApp report |
Definition at line 191 of file e3_agent.cpp.
| void libe3::E3Agent::set_dapp_status_changed_handler | ( | DAppStatusChangedHandler | handler | ) |
Set callback for dApp status changes. Called when a dApp connects, disconnects, subscribes, or unsubscribes. Call before start().
| handler | Called after each change |
Definition at line 198 of file e3_agent.cpp.
| void libe3::E3Agent::set_disconnect_handler | ( | DisconnectHandler | handler | ) |
Set callback for the end of the dApp's session with the RAN: a release for this dApp, or a closed or failed connection. Fires once, after dapp_id() has been cleared. Unless E3Config::reconnect_interval_ms is 0 the dApp then registers again by itself, with a new dapp_id() and no subscriptions: subscribe again from the setup response handler. It does not after release() or stop().
| handler | Called once per ended session, with the reason |
Definition at line 417 of file e3_agent.cpp.
| void libe3::E3Agent::set_indication_handler | ( | IndicationHandler | handler | ) |
Set callback for incoming IndicationMessage (RAN → dApp).
| handler | Called with each indication |
Definition at line 389 of file e3_agent.cpp.
| void libe3::E3Agent::set_message_ack_handler | ( | MessageAckHandler | handler | ) |
Set callback for incoming MessageAck (RAN → dApp). DEPRECATED TO BE REMOVED: libe3 does not send one; another RAN may.
| handler | Called with each acknowledgement |
Definition at line 403 of file e3_agent.cpp.
| void libe3::E3Agent::set_setup_response_handler | ( | SetupResponseHandler | handler | ) |
Set callback for incoming SetupResponse (RAN → dApp).
| handler | Called on every setup, so also when the dApp registers again |
Definition at line 375 of file e3_agent.cpp.
| void libe3::E3Agent::set_subscription_response_handler | ( | SubscriptionResponseHandler | handler | ) |
Set callback for incoming SubscriptionResponse (RAN → dApp).
| handler | Called with each response |
Definition at line 382 of file e3_agent.cpp.
| void libe3::E3Agent::set_xapp_control_handler | ( | XAppControlHandler | handler | ) |
Set callback for incoming XAppControlAction (xApp → dApp via RAN).
| handler | Called with each control action |
Definition at line 396 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::start | ( | ) |
Start the agent.
Starts the internal processing threads and begins accepting dApp connections. If not already initialized, calls init() first.
Definition at line 117 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::start | ( | ) |
Start the agent.
|
noexcept |
Get current agent state.
Definition at line 149 of file e3_agent.cpp.
|
noexcept |
| void libe3::E3Agent::stop | ( | ) |
Stop the agent.
Stops all processing threads and closes connections. The agent can be restarted with start().
Definition at line 139 of file e3_agent.cpp.
| void libe3::E3Agent::stop | ( | ) |
Stop the agent and join its threads.
| ErrorCode libe3::E3Agent::subscribe | ( | 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 ) |
Subscribe to a RAN function. Must be called after a positive setup.
| ran_function_id | RAN function to subscribe to |
| telemetry_ids | telemetry identifiers requested |
| control_ids | control identifiers requested |
| sub_time | seconds to keep the subscription. Over ASN.1 the range is 0 to 86400. |
| periodicity | microseconds between indications, 0 = every event. Over ASN.1 the range is 0 to 60000000. An OCUDU RAN reads the same number as milliseconds, so pass it what it expects. |
| out_request_id | when non-null, receives the assigned E3-MessageID on success, so the caller can correlate the SubscriptionResponse (which echoes request_id) back to this subscribe call. |
Definition at line 445 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::subscribed_ran_functions | ( | ) | const |
RAN functions this dApp is currently subscribed to.
Definition at line 429 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::subscribed_ran_functions | ( | ) | const |
| size_t libe3::E3Agent::subscription_count | ( | ) | const |
Get total number of active subscriptions.
Definition at line 361 of file e3_agent.cpp.
| size_t libe3::E3Agent::subscription_count | ( | ) | const |
| ErrorCode libe3::E3Agent::unsubscribe | ( | uint32_t | ran_function_id | ) |
Send a SubscriptionDelete for a previously subscribed RAN function.
| ran_function_id | RAN function to unsubscribe from |
Definition at line 458 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::unsubscribe | ( | uint32_t | ran_function_id | ) |
Delete a subscription (dApp role).
| ran_function_id | RAN function it was for |
| ErrorCode libe3::E3Agent::wait_for_setup | ( | std::chrono::milliseconds | timeout | ) |
Block until the dApp setup handshake completes.
| timeout | How long to wait at most |
Definition at line 439 of file e3_agent.cpp.