|
libe3 0.6.1
C++ library for E3AP RAN vendor integration
|
dApp-role E3AP session with a batched, lock-free inbound ring. More...
#include <e3_dapp_session.hpp>
Classes | |
| struct | Impl |
| What a DAppSession holds: the agent, the event queue and the setup snapshot. More... | |
Public Member Functions | |
| DAppSession (libe3::E3Config config, std::size_t queue_capacity=8192) | |
| Construct the session and register all inbound handlers. | |
| ~DAppSession () | |
| Stops the agent and drops the queue. | |
| DAppSession (const DAppSession &)=delete | |
| DAppSession & | operator= (const DAppSession &)=delete |
| int | start () |
| Start the agent, re-arming the inbound ring so a stop()->start() cycle works again. | |
| int | wait_for_setup (int timeout_ms) |
| Block until the setup handshake completes. | |
| int | release () |
| Send a ReleaseMessage (session keeps running until stop). | |
| void | stop () |
| Stop the agent and shut down the ring so a blocked poll_events returns an empty batch (i.e. empty-after-stop means "done"). Restartable via start. | |
| long | dapp_id () const |
| dApp id assigned at setup. | |
| std::string | ran_identifier () const |
| RAN identifier from the SetupResponse. | |
| int | setup_response_code () const |
| SetupResponse code. | |
| std::size_t | setup_ran_function_count () const |
| Number of RAN functions advertised in the SetupResponse. | |
| uint32_t | setup_ran_function_id (std::size_t i) const |
| RAN function id of an advertised entry. | |
| std::vector< uint32_t > | setup_ran_function_telemetry (std::size_t i) const |
| Telemetry ids of an advertised entry. | |
| std::vector< uint32_t > | setup_ran_function_control (std::size_t i) const |
| Control ids of an advertised entry. | |
| std::vector< uint8_t > | setup_ran_function_data (std::size_t i) const |
| Opaque ranFunctionData bytes of an advertised entry. | |
| int64_t | subscribe (uint32_t ran_function_id, std::vector< uint32_t > telemetry_ids, std::vector< uint32_t > control_ids, int sub_time_ms, int periodicity) |
| Subscribe to a RAN function (after a positive setup). | |
| int | unsubscribe (uint32_t ran_function_id) |
| Delete a previously created subscription. | |
| int64_t | send_control (uint32_t ran_function_id, uint32_t control_id, std::vector< uint8_t > action_data, uint32_t sequence_id=0, bool request_ack=false) |
| Send a dApp control action to the RAN. | |
| int64_t | send_report (uint32_t ran_function_id, std::vector< uint8_t > report_data, uint32_t sequence_id) |
| Send a dApp report to the RAN. | |
| int | send_message_ack (uint32_t request_id, int response_code) |
| Acknowledge a request. DEPRECATED TO BE REMOVED: answer an xApp control with send_control_response. | |
| int | send_control_response (uint32_t request_id, uint32_t ran_function_id, uint32_t control_id, int response_code, int cause, std::string detail, std::vector< uint8_t > outcome) |
| Answer an xApp control that has request_ack (E3_EVENT_XAPP_CONTROL). | |
| std::vector< E3Event > | poll_events (std::size_t max_batch, int timeout_ms) |
Drain up to max_batch inbound events, waiting up to timeout_ms for the first. | |
| unsigned long long | dropped_events () const |
| Total inbound events dropped due to ring overflow (backpressure). | |
dApp-role E3AP session with a batched, lock-free inbound ring.
Thread model: two producers push into the ring — the setup-response handler (libe3 setup thread) and the other handlers (libe3 inbound thread), which run concurrently at startup; the Python drainer thread is the single consumer via poll_events. The ring is MPMC, so this is safe (do not "optimize" it to SPSC). All outbound verbs are thread-safe (delegated to libe3::E3Agent).
Definition at line 122 of file e3_dapp_session.hpp.
|
explicit |
Construct the session and register all inbound handlers.
| config | Agent config; role is forced to E3Role::DAPP. |
| queue_capacity | Inbound ring capacity (rounded up to a power of two). Sized for high-throughput headroom; overflow increments the drop counter (dropped_events) rather than blocking libe3. |
Definition at line 83 of file e3_dapp_session.cpp.
| libe3::py::DAppSession::~DAppSession | ( | ) |
Stops the agent and drops the queue.
Definition at line 181 of file e3_dapp_session.cpp.
|
delete |
| long libe3::py::DAppSession::dapp_id | ( | ) | const |
dApp id assigned at setup.
Definition at line 210 of file e3_dapp_session.cpp.
| unsigned long long libe3::py::DAppSession::dropped_events | ( | ) | const |
Total inbound events dropped due to ring overflow (backpressure).
Definition at line 354 of file e3_dapp_session.cpp.
|
delete |
| std::vector< E3Event > libe3::py::DAppSession::poll_events | ( | std::size_t | max_batch, |
| int | timeout_ms ) |
Drain up to max_batch inbound events, waiting up to timeout_ms for the first.
Blocks on the ring for the first event (latency ≈ ring wakeup), then sweeps up any further already-queued events without blocking. timeout_ms <= 0 polls non-blocking (does not busy-wait). Returns an empty vector on a quiet tick or after stop. The SWIG wrapper releases the GIL for the whole call so libe3's threads run freely while Python waits.
| max_batch | most events to return |
| timeout_ms | longest wait for the first event, in milliseconds |
Definition at line 323 of file e3_dapp_session.cpp.
| std::string libe3::py::DAppSession::ran_identifier | ( | ) | const |
RAN identifier from the SetupResponse.
Definition at line 215 of file e3_dapp_session.cpp.
| int libe3::py::DAppSession::release | ( | ) |
Send a ReleaseMessage (session keeps running until stop).
Definition at line 201 of file e3_dapp_session.cpp.
| int64_t libe3::py::DAppSession::send_control | ( | uint32_t | ran_function_id, |
| uint32_t | control_id, | ||
| std::vector< uint8_t > | action_data, | ||
| uint32_t | sequence_id = 0, | ||
| 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; 0 when the dApp decided on its own. |
| request_ack | true to ask the RAN for a control response (an E3_EVENT_CONTROL_RESPONSE event) once it has dealt with the control. The RAN answers a control it refuses itself either way. |
Definition at line 277 of file e3_dapp_session.cpp.
| int libe3::py::DAppSession::send_control_response | ( | uint32_t | request_id, |
| uint32_t | ran_function_id, | ||
| uint32_t | control_id, | ||
| int | response_code, | ||
| int | cause, | ||
| std::string | detail, | ||
| std::vector< uint8_t > | outcome ) |
Answer an xApp control that has request_ack (E3_EVENT_XAPP_CONTROL).
| request_id | the event's request_id |
| ran_function_id | the event's ran_function_id |
| control_id | the control the dApp applied, from the list the RAN advertised for the function |
| response_code | 0=applied (positive), 1=not applied (negative) |
| cause | why not, a libe3 Cause value 0 to 14, or -1 for none |
| detail | text for the cause, up to 512 bytes, empty for none |
| outcome | what the dApp reports about the control, up to 32768 bytes, empty for none |
Definition at line 310 of file e3_dapp_session.cpp.
| int libe3::py::DAppSession::send_message_ack | ( | uint32_t | request_id, |
| int | response_code ) |
Acknowledge a request. DEPRECATED TO BE REMOVED: answer an xApp control with send_control_response.
| request_id | request being acknowledged. |
| response_code | 0=positive,1=negative. |
Definition at line 305 of file e3_dapp_session.cpp.
| int64_t libe3::py::DAppSession::send_report | ( | uint32_t | ran_function_id, |
| std::vector< uint8_t > | report_data, | ||
| uint32_t | sequence_id ) |
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 this dApp assigns to the detection; mandatory on the wire, 1..4294967295 (0 is refused with INVALID_PARAM). |
Definition at line 293 of file e3_dapp_session.cpp.
| std::vector< uint32_t > libe3::py::DAppSession::setup_ran_function_control | ( | std::size_t | i | ) | const |
Control ids of an advertised entry.
| i | index of the entry. |
Definition at line 243 of file e3_dapp_session.cpp.
| std::size_t libe3::py::DAppSession::setup_ran_function_count | ( | ) | const |
Number of RAN functions advertised in the SetupResponse.
Definition at line 226 of file e3_dapp_session.cpp.
| std::vector< uint8_t > libe3::py::DAppSession::setup_ran_function_data | ( | std::size_t | i | ) | const |
Opaque ranFunctionData bytes of an advertised entry.
| i | index of the entry. |
Definition at line 249 of file e3_dapp_session.cpp.
| uint32_t libe3::py::DAppSession::setup_ran_function_id | ( | std::size_t | i | ) | const |
RAN function id of an advertised entry.
| i | index of the entry. |
Definition at line 231 of file e3_dapp_session.cpp.
| std::vector< uint32_t > libe3::py::DAppSession::setup_ran_function_telemetry | ( | std::size_t | i | ) | const |
Telemetry ids of an advertised entry.
| i | index of the entry. |
Definition at line 237 of file e3_dapp_session.cpp.
| int libe3::py::DAppSession::setup_response_code | ( | ) | const |
SetupResponse code.
Definition at line 220 of file e3_dapp_session.cpp.
| int libe3::py::DAppSession::start | ( | ) |
Start the agent, re-arming the inbound ring so a stop()->start() cycle works again.
Definition at line 188 of file e3_dapp_session.cpp.
| void libe3::py::DAppSession::stop | ( | ) |
Stop the agent and shut down the ring so a blocked poll_events returns an empty batch (i.e. empty-after-stop means "done"). Restartable via start.
Definition at line 205 of file e3_dapp_session.cpp.
| int64_t libe3::py::DAppSession::subscribe | ( | uint32_t | ran_function_id, |
| std::vector< uint32_t > | telemetry_ids, | ||
| std::vector< uint32_t > | control_ids, | ||
| int | sub_time_ms, | ||
| int | periodicity ) |
Subscribe to a RAN function (after a positive setup).
| ran_function_id | RAN function to subscribe to |
| telemetry_ids | telemetry identifiers requested |
| control_ids | control identifiers requested |
| sub_time_ms | subscription time in seconds (the name is historical), or -1 for unset. 0 is no limit. The RAN ends the subscription when it runs out. |
| periodicity | microseconds between indications, 0 = every event, or -1 for unset. Over ASN.1 the range is 0 to 60000000. An OCUDU RAN reads the same number as milliseconds. |
Definition at line 255 of file e3_dapp_session.cpp.
| int libe3::py::DAppSession::unsubscribe | ( | uint32_t | ran_function_id | ) |
Delete a previously created subscription.
| ran_function_id | RAN function it was for. |
Definition at line 273 of file e3_dapp_session.cpp.
| int libe3::py::DAppSession::wait_for_setup | ( | int | timeout_ms | ) |
Block until the setup handshake completes.
| timeout_ms | longest wait, in milliseconds. |
Definition at line 196 of file e3_dapp_session.cpp.