|
libe3 0.2.5
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 | |
| E3Agent & | operator= (E3Agent &&) noexcept |
| 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) |
| 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 (e.g. ack a control/request from dApp). | |
| 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) |
| 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) |
| Send a dApp control action to the RAN. | |
| 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) | |
| ~E3Agent () | |
| ErrorCode | init () |
| ErrorCode | start () |
| void | stop () |
| 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 () |
| 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 85 of file e3_agent.hpp.
Construct an E3Agent with configuration.
| config | Agent configuration |
Definition at line 41 of file e3_agent.cpp.
| libe3::E3Agent::~E3Agent | ( | ) |
Destructor - ensures clean shutdown.
Definition at line 47 of file e3_agent.cpp.
|
delete |
|
defaultnoexcept |
| libe3::E3Agent::E3Agent | ( | E3Config | config | ) |
| libe3::E3Agent::~E3Agent | ( | ) |
| std::vector< uint32_t > libe3::E3Agent::active_subscription_ids | ( | ) | const |
Subscription IDs this dApp currently holds.
Definition at line 400 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::active_subscription_ids | ( | ) | const |
|
noexcept |
Get current configuration.
Definition at line 321 of file e3_agent.cpp.
|
noexcept |
| size_t libe3::E3Agent::dapp_count | ( | ) | const |
Get number of registered dApps.
Definition at line 329 of file e3_agent.cpp.
| size_t libe3::E3Agent::dapp_count | ( | ) | const |
|
noexcept |
dApp identifier assigned by the RAN in SetupResponse.
Definition at line 390 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 283 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 172 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 269 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 276 of file e3_agent.cpp.
| std::vector< uint32_t > libe3::E3Agent::get_registered_dapps | ( | ) | const |
Get list of registered dApp IDs.
Definition at line 262 of file e3_agent.cpp.
| 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.
Definition at line 308 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.
Definition at line 290 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.
Definition at line 299 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 59 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::init | ( | ) |
|
noexcept |
Check if agent is running.
Definition at line 144 of file e3_agent.cpp.
|
noexcept |
| 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 152 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::release | ( | ) |
Send a ReleaseMessage. The dApp stays running until stop() is called.
Definition at line 451 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::release | ( | ) |
| 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 ) |
| 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 ) |
Send a dApp control action to the RAN.
| 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, so the caller can correlate a later ack/response back to this send. |
Definition at line 430 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 197 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 ) |
| ErrorCode libe3::E3Agent::send_message_ack | ( | uint32_t | request_id, |
| ResponseCode | response_code ) |
Send a message acknowledgment (e.g. ack a control/request from dApp).
| request_id | ID of the request being acknowledged |
| response_code | ResponseCode::POSITIVE (0) or NEGATIVE (1) |
Definition at line 249 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::send_message_ack | ( | uint32_t | request_id, |
| ResponseCode | response_code ) |
| ErrorCode libe3::E3Agent::send_report | ( | uint32_t | ran_function_id, |
| std::vector< uint8_t > | report_data, | ||
| uint32_t | sequence_id ) |
| 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.
| 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 441 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 ) |
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. |
Definition at line 226 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.
Definition at line 179 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().
Definition at line 186 of file e3_agent.cpp.
| void libe3::E3Agent::set_indication_handler | ( | IndicationHandler | handler | ) |
Set callback for incoming IndicationMessage (RAN → dApp).
Definition at line 369 of file e3_agent.cpp.
| void libe3::E3Agent::set_message_ack_handler | ( | MessageAckHandler | handler | ) |
Set callback for incoming MessageAck (RAN → dApp).
Definition at line 383 of file e3_agent.cpp.
| void libe3::E3Agent::set_setup_response_handler | ( | SetupResponseHandler | handler | ) |
Set callback for incoming SetupResponse (RAN → dApp).
Definition at line 355 of file e3_agent.cpp.
| void libe3::E3Agent::set_subscription_response_handler | ( | SubscriptionResponseHandler | handler | ) |
Set callback for incoming SubscriptionResponse (RAN → dApp).
Definition at line 362 of file e3_agent.cpp.
| void libe3::E3Agent::set_xapp_control_handler | ( | XAppControlHandler | handler | ) |
Set callback for incoming XAppControlAction (xApp → dApp via RAN).
Definition at line 376 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 105 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::start | ( | ) |
|
noexcept |
Get current agent state.
Definition at line 137 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 127 of file e3_agent.cpp.
| void libe3::E3Agent::stop | ( | ) |
| 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.
| 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 411 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 395 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 341 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.
Definition at line 424 of file e3_agent.cpp.
| ErrorCode libe3::E3Agent::unsubscribe | ( | uint32_t | ran_function_id | ) |
| ErrorCode libe3::E3Agent::wait_for_setup | ( | std::chrono::milliseconds | timeout | ) |
Block until the dApp setup handshake completes.
Definition at line 405 of file e3_agent.cpp.