|
libe3 0.6.1
C++ library for E3AP RAN vendor integration
|
Abstract Service Model interface. More...
#include <sm_interface.hpp>
Public Member Functions | |
| virtual | ~ServiceModel ()=default |
| virtual std::string | name () const =0 |
| Get SM name. | |
| virtual uint32_t | version () const =0 |
| Get SM version. | |
| virtual uint32_t | ran_function_id () const =0 |
| Get RAN function ID for this SM. | |
| virtual std::vector< uint32_t > | telemetry_ids () const =0 |
| Get telemetry IDs supported by this SM. | |
| virtual std::vector< uint32_t > | control_ids () const =0 |
| Get control IDs supported by this SM. | |
| virtual std::vector< uint8_t > | ran_function_data () const |
| RAN-function-specific opaque data (required, 1..32768 bytes). | |
| virtual std::optional< uint32_t > | granted_periodicity (uint32_t requested_us) const |
| The least time between two indications that this SM keeps for a subscription. | |
| virtual ErrorCode | init ()=0 |
| Initialize the SM. | |
| virtual void | destroy ()=0 |
| Destroy the SM and release resources. | |
| virtual ErrorCode | start ()=0 |
| Start the SM processing. | |
| virtual void | stop ()=0 |
| Stop the SM processing. | |
| virtual bool | is_running () const =0 |
| Check if SM is currently running. | |
| virtual ErrorCode | handle_control_action (uint32_t request_message_id, const DAppControlAction &action)=0 |
| Process a control action from a dApp. | |
Protected Member Functions | |
| ServiceModel ()=default | |
| ErrorCode | respond_to_control (uint32_t dapp_id, uint32_t request_message_id, const ControlResult &result) |
| Answer a dApp control. | |
| ErrorCode | emit_outbound (Pdu &&pdu) |
| Emit an outbound PDU produced by the SM. | |
| std::vector< uint32_t > | get_subscribers () const |
| Get currently subscribed dApps for this SM's RAN function. | |
| void | set_outbound_emitter (std::function< ErrorCode(Pdu &&)> emitter) |
| Set the outbound PDU emitter callback (used by E3Interface). | |
| void | set_control_responder (std::function< ErrorCode(uint32_t, uint32_t, const ControlResult &)> responder) |
| Set the control responder callback (used by E3Interface). | |
| void | set_subscribers_provider (std::function< std::vector< uint32_t >()> provider) |
| Set subscriber provider callback (used by E3Interface). | |
Static Protected Member Functions | |
| static Pdu | make_message_ack_pdu (uint32_t request_message_id, ResponseCode response_code) |
| Build a MessageAck PDU for a control/request message. | |
| static Pdu | make_indication_pdu (uint32_t dapp_id, uint32_t ran_function_id, std::vector< uint8_t > protocol_data) |
| Build an IndicationMessage PDU. | |
Friends | |
| class | E3Interface |
Abstract Service Model interface.
This is the extension point for RAN vendors to implement their Service Models. The E3 agent treats E3SM as opaque - all SM-specific encoding/decoding happens in the implementations of this interface.
RAN vendors should:
Definition at line 42 of file sm_interface.hpp.
|
virtualdefault |
|
protecteddefault |
|
pure virtual |
Get control IDs supported by this SM.
Implemented in e3_service_model_handle_s.
|
pure virtual |
Destroy the SM and release resources.
Called when the SM is being unregistered.
Implemented in e3_service_model_handle_s.
Emit an outbound PDU produced by the SM.
| pdu | The PDU to send |
Definition at line 247 of file sm_interface.hpp.
|
inlineprotected |
Get currently subscribed dApps for this SM's RAN function.
Definition at line 258 of file sm_interface.hpp.
|
inlinevirtual |
The least time between two indications that this SM keeps for a subscription.
Sent to the dApp as the granted periodicity of its SubscriptionResponse. Override it only when the SM itself keeps its indications at least that far apart. The base implementation reports nothing, so the response then carries no periodicity ("not reported").
| requested_us | Periodicity the dApp asked for, in microseconds. 0 when it asked for none or for one indication per event. |
Reimplemented in e3_service_model_handle_s.
Definition at line 110 of file sm_interface.hpp.
|
pure virtual |
Process a control action from a dApp.
Called by the E3 interface when a DAppControlAction is received for this service model. Implementations answer it with respond_to_control() and can emit outbound PDUs (e.g. IndicationMessage) via emit_outbound().
| request_message_id | Message identifier of the DAppControlAction |
| action | The control action |
Implemented in e3_service_model_handle_s.
|
pure virtual |
Initialize the SM.
Called when the SM is first registered.
Implemented in e3_service_model_handle_s.
|
pure virtual |
Check if SM is currently running.
Implemented in e3_service_model_handle_s.
|
inlinestaticprotected |
Build an IndicationMessage PDU.
This helper only builds the PDU. Implementations can emit it with emit_outbound() when appropriate.
| dapp_id | dApp the indication is for |
| ran_function_id | RAN function the indication comes from |
| protocol_data | Opaque payload of the SM |
Definition at line 228 of file sm_interface.hpp.
|
inlinestaticprotected |
Build a MessageAck PDU for a control/request message.
DEPRECATED TO BE REMOVED. A Service Model answers a control with respond_to_control(). This helper only builds the PDU.
| request_message_id | Message identifier of the message acknowledged |
| response_code | Result to report |
Definition at line 178 of file sm_interface.hpp.
|
pure virtual |
|
inlinevirtual |
RAN-function-specific opaque data (required, 1..32768 bytes).
Returns the byte vector advertised for this RAN function in the SetupResponse (ranFunctionList->ranFunctionData). E3AP declares the field mandatory and non-empty – OCTET STRING (SIZE (1..262144)), limited to 32768 bytes – so every SM must override this: even the most minimal SM carries at least its own name. An SM with nothing to advertise is not advertisable at all, since ranFunctionList itself is optional but its entries are not.
Registration fails with ErrorCode::INVALID_PARAM if the returned vector is empty or longer than MAX_PROTOCOL_DATA_SIZE. The base implementation returns an empty vector so that failure is a loud diagnostic rather than a compile error in every existing SM; it is not a usable default.
Reimplemented in e3_service_model_handle_s.
Definition at line 95 of file sm_interface.hpp.
|
pure virtual |
Get RAN function ID for this SM.
Implemented in e3_service_model_handle_s.
|
inlineprotected |
Answer a dApp control.
Call it once per control, from any thread, when the outcome is known: from handle_control_action() or later, as an SM that applies the control asynchronously does. It sends a ControlResponse only when the dApp asked for one (request_ack), so an SM can call it for every control. The RAN function and the control identifier are filled in from the control. An SM that never answers sends nothing: the library does not invent an answer for a control that may still be applied.
| dapp_id | dApp that sent the control (DAppControlAction::dapp_identifier) |
| request_message_id | Message identifier of the control, as passed to handle_control_action() |
| result | Whether the control was applied, why not, and what the SM reports about it |
Definition at line 207 of file sm_interface.hpp.
|
inlineprotected |
Set the control responder callback (used by E3Interface).
| responder | Callback that answers a dApp control |
Definition at line 277 of file sm_interface.hpp.
|
inlineprotected |
Set the outbound PDU emitter callback (used by E3Interface).
| emitter | Callback that queues a PDU |
Definition at line 269 of file sm_interface.hpp.
|
inlineprotected |
Set subscriber provider callback (used by E3Interface).
| provider | Callback that lists the subscribed dApps |
Definition at line 285 of file sm_interface.hpp.
|
pure virtual |
Start the SM processing.
Called when the first dApp subscribes to this SM's RAN function.
Implemented in e3_service_model_handle_s.
|
pure virtual |
Stop the SM processing.
Called when the last dApp unsubscribes from this SM's RAN function.
Implemented in e3_service_model_handle_s.
|
pure virtual |
Get telemetry IDs supported by this SM.
Implemented in e3_service_model_handle_s.
|
pure virtual |
|
friend |
Definition at line 294 of file sm_interface.hpp.