libe3 0.6.1
C++ library for E3AP RAN vendor integration
Loading...
Searching...
No Matches
libe3_swig.hpp
Go to the documentation of this file.
1/* SWIG-friendly re-declarations of the libe3 public API.
2 *
3 * SWIG 4.1 has trouble parsing some modern C++ constructs in the real
4 * headers (e.g. brace-initialised default arguments, std::function
5 * typedefs, std::variant). This file mirrors the slice of the API we
6 * want to expose to Python with SWIG-compatible declarations only.
7 *
8 * The actual implementations live in libe3 — this header exists purely
9 * so SWIG can parse simple declarations without needing C++-aware
10 * type recovery.
11 *
12 * SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
13 * SPDX-License-Identifier: Apache-2.0
14 */
15
16#ifndef LIBE3_SWIG_HPP
17#define LIBE3_SWIG_HPP
18
19#include <cstdint>
20#include <string>
21#include <vector>
22#include <chrono>
23#include <memory>
24
25#include "libe3/types.hpp"
26
27namespace libe3 {
28
29// Forward-declared; real class lives in e3_agent.hpp. SWIG sees only
30// these signatures.
31class E3Agent {
32public:
33 /// Build the agent. @param config Role, links, encoding and limits, as for libe3::E3Agent
36
37 /// Prepare the agent. @return ErrorCode::SUCCESS on success
39 /// Start the agent. @return ErrorCode::SUCCESS on success
41 /// Stop the agent and join its threads.
42 void stop();
43 /// @return The state of the agent
44 AgentState state() const noexcept;
45 /// @return True while the agent runs
46 bool is_running() const noexcept;
47
48 // Manual RAN-side operations (kept narrow — SM registration is not
49 // wrapped; the Python consumer keeps its own SM encoders).
50 /// Send an indication to one dApp (RAN role).
51 /// @param dapp_id dApp the indication is for
52 /// @param ran_function_id RAN function it comes from
53 /// @param data opaque Service Model payload
54 /// @return ErrorCode::SUCCESS once queued
56 uint32_t ran_function_id,
57 const std::vector<uint8_t>& data);
58
59 /// Send a message acknowledgment. DEPRECATED TO BE REMOVED.
60 /// @param request_id request being acknowledged
61 /// @param response_code POSITIVE or NEGATIVE
62 /// @return ErrorCode::SUCCESS once queued
63 ErrorCode send_message_ack(uint32_t request_id, ResponseCode response_code);
64
65 // dApp-side verbs.
66 /// Delete a subscription (dApp role). @param ran_function_id RAN function it was for
67 /// @return ErrorCode::SUCCESS once queued
68 ErrorCode unsubscribe(uint32_t ran_function_id);
69 // sequence_id correlates a message with the procedure it belongs to:
70 // mandatory on a report, which starts one, and left 0 on a control the dApp
71 // decided on its own. out_message_id and request_ack are not mirrored -- an
72 // out-pointer is not worth wrapping, and DAppSession carries both.
73 /// Send a dApp control (dApp role).
74 /// @param ran_function_id RAN function the control is for
75 /// @param control_id control identifier granted by the RAN
76 /// @param action_data opaque Service Model payload
77 /// @param sequence_id correlation id of the xApp procedure this control re-issues, or 0
78 /// @return ErrorCode::SUCCESS once queued
79 ErrorCode send_control(uint32_t ran_function_id,
80 uint32_t control_id,
81 std::vector<uint8_t> action_data,
82 uint32_t sequence_id = 0);
83 /// Send a dApp report (dApp role).
84 /// @param ran_function_id RAN function the report is for
85 /// @param report_data opaque Service Model payload
86 /// @param sequence_id correlation id the dApp assigns to the detection, not 0
87 /// @return ErrorCode::SUCCESS once queued
88 ErrorCode send_report(uint32_t ran_function_id,
89 std::vector<uint8_t> report_data,
90 uint32_t sequence_id);
91 /// Release this dApp (dApp role). @return ErrorCode::SUCCESS once queued
93 /// @return The RAN functions this dApp holds a subscription to
94 std::vector<uint32_t> subscribed_ran_functions() const;
95 /// @return The subscription identifiers the RAN granted and that have not ended
96 std::vector<uint32_t> active_subscription_ids() const;
97
98 /// @return The configuration the agent was built with
99 const E3Config& config() const noexcept;
100 /// @return The dApps registered with this RAN
101 size_t dapp_count() const;
102 /// @return The subscriptions this RAN holds
103 size_t subscription_count() const;
104};
105
106} // namespace libe3
107
108#endif // LIBE3_SWIG_HPP
E3Agent - Main façade for RAN vendor integration.
Definition e3_agent.hpp:94
void stop()
Stop the agent and join its threads.
bool is_running() const noexcept
Check if agent is running.
Definition e3_agent.cpp:156
std::vector< uint32_t > subscribed_ran_functions() const
Definition e3_agent.cpp:429
std::optional< uint32_t > dapp_id() const noexcept
dApp identifier assigned by the RAN in SetupResponse.
Definition e3_agent.cpp:424
ErrorCode release()
Definition e3_agent.cpp:495
std::vector< uint32_t > active_subscription_ids() const
Definition e3_agent.cpp:434
ErrorCode unsubscribe(uint32_t ran_function_id)
Definition e3_agent.cpp:458
size_t dapp_count() const
Get number of registered dApps.
Definition e3_agent.cpp:349
const E3Config & config() const noexcept
Get current configuration.
Definition e3_agent.cpp:341
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.
Definition e3_agent.cpp:485
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.
Definition e3_agent.cpp:464
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.
Definition e3_agent.cpp:209
AgentState state() const noexcept
ErrorCode init()
Prepare the agent.
E3Agent(E3Config config)
Build the agent.
size_t subscription_count() const
Get total number of active subscriptions.
Definition e3_agent.cpp:361
ErrorCode start()
Start the agent.
ErrorCode send_message_ack(uint32_t request_id, ResponseCode response_code)
Send a message acknowledgment.
Definition e3_agent.cpp:269
ErrorCode
Error codes returned by libe3 operations Use shared error-code list (see libe3/error_codes....
Definition types.hpp:177
AgentState
Agent state machine states.
Definition types.hpp:162
ResponseCode
E3AP response codes.
Definition types.hpp:103
Configuration for E3Agent.
Definition types.hpp:506
E3AP Protocol Types - Vendor-neutral type definitions.