libe3 0.2.5
C++ library for E3AP RAN vendor integration
Loading...
Searching...
No Matches
c_api.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#include "libe3/c_api.h"
7
8#include "libe3/e3_agent.hpp"
10#include "libe3/types.hpp"
11#include "libe3/error_codes.h"
12#include "libe3/logger.hpp"
13#include "libe3/latrec.h"
14
15#include <string>
16#include <vector>
17#include <memory>
18#include <cstring>
19
20using namespace libe3;
21
22namespace {
23constexpr const char* LOG_TAG = "CApi";
24}
25
27 std::unique_ptr<E3Agent> agent;
28};
29
31 // store copied values
32 std::string name_s;
33 uint32_t version_s;
35 std::vector<uint32_t> telemetry_ids_s;
36 std::vector<uint32_t> control_ids_s;
37 std::vector<uint8_t> ran_function_data_s; // store ran_function_data
38
39 // callbacks
46 void* sm_context = nullptr;
47
48 // mark if ownership was transferred to an agent
50
52 if (desc.name) name_s = desc.name;
53 version_s = desc.version;
55 if (desc.telemetry_ids && desc.telemetry_ids_len) {
57 }
58 if (desc.control_ids && desc.control_ids_len) {
59 control_ids_s.assign(desc.control_ids, desc.control_ids + desc.control_ids_len);
60 }
61 // Copy ran_function_data if provided
64 }
65 sm_init = desc.sm_init;
67 sm_start = desc.sm_start;
68 sm_stop = desc.sm_stop;
72 }
73
74 // ServiceModel virtuals
75 std::string name() const override { return name_s; }
76 uint32_t version() const override { return version_s; }
77 uint32_t ran_function_id() const override { return ran_function_id_s; }
78 std::vector<uint32_t> telemetry_ids() const override { return telemetry_ids_s; }
79 std::vector<uint32_t> control_ids() const override { return control_ids_s; }
80 std::vector<uint8_t> ran_function_data() const override { return ran_function_data_s; }
81 ErrorCode init() override {
82 if (sm_init) return static_cast<ErrorCode>(sm_init(sm_context));
83 return ErrorCode::SUCCESS;
84 }
85 void destroy() override {
87 }
88 ErrorCode start() override {
89 if (sm_start) return static_cast<ErrorCode>(sm_start(sm_context));
90 return ErrorCode::SUCCESS;
91 }
92 void stop() override {
94 }
95 bool is_running() const override {
96 if (sm_is_running) return sm_is_running(sm_context) != 0;
97 return false;
98 }
99
101 uint32_t request_message_id,
102 const DAppControlAction& action
103 ) override {
104 if (!sm_process_control) {
105 return ErrorCode::NOT_FOUND;
106 }
107 return static_cast<ErrorCode>(sm_process_control(
108 this,
110 request_message_id,
111 action.dapp_identifier,
113 action.control_identifier,
114 action.action_data.empty() ? nullptr : action.action_data.data(),
115 action.action_data.size(),
116 action.sequence_id
117 ));
118 }
119
121 return emit_outbound(std::move(pdu));
122 }
123};
124
125extern "C" {
126
128 if (!desc) return nullptr;
129 try {
130 return new e3_service_model_handle_s(*desc);
131 } catch (...) {
132 return nullptr;
133 }
134}
135
137 if (!sm) return;
138 // If ownership was transferred to an agent, we must not delete here.
139 if (sm->transferred_to_agent) return;
140 delete sm;
141}
142
145 uint32_t dapp_id,
146 uint32_t ran_function_id,
147 const uint8_t* data,
148 size_t data_len
149) {
150 if (!sm) return static_cast<int>(ErrorCode::INVALID_PARAM);
151
153 // Keys the outbound leg from this boundary, so the payload copy and the Pdu
154 // construction below fall inside it. aux carries the producer's own trace
155 // seq, which joins its stages to this leg.
157 latrec_tstamp(pdu.enqueue_seq, LATREC_EMIT_ENTER, latrec_ctx(), ran_function_id);
158
160 msg.dapp_identifier = dapp_id;
161 msg.ran_function_identifier = ran_function_id;
162 if (data && data_len) {
163 msg.protocol_data.assign(data, data + data_len);
164 }
165 pdu.choice = std::move(msg);
166
167 return static_cast<int>(sm->emit_pdu(std::move(pdu)));
168}
169
172 uint32_t request_id,
173 int response_code
174) {
175 if (!sm) return static_cast<int>(ErrorCode::INVALID_PARAM);
176
178 MessageAck ack;
179 ack.request_id = request_id;
180 ack.response_code = (response_code == 0) ? ResponseCode::POSITIVE : ResponseCode::NEGATIVE;
181 pdu.choice = ack;
182
183 return static_cast<int>(sm->emit_pdu(std::move(pdu)));
184}
185
189
191 try {
192 E3Config cfg;
193 if (config) {
194 if (config->ran_identifier) cfg.ran_identifier = config->ran_identifier;
195 if (config->link_layer >= 0 && config->link_layer <= 1)
196 cfg.link_layer = static_cast<E3LinkLayer>(config->link_layer);
197 if (config->transport_layer >= 0 && config->transport_layer <= 2)
198 cfg.transport_layer = static_cast<E3TransportLayer>(config->transport_layer);
199 if (config->setup_port != 0) cfg.setup_port = config->setup_port;
200 if (config->subscriber_port != 0) cfg.subscriber_port = config->subscriber_port;
201 if (config->publisher_port != 0) cfg.publisher_port = config->publisher_port;
202 if (config->setup_endpoint) cfg.setup_endpoint = config->setup_endpoint;
205 if (config->encoding >= 0 && config->encoding <= 2)
206 cfg.encoding = static_cast<EncodingFormat>(config->encoding);
207 if (config->io_threads != 0) cfg.io_threads = config->io_threads;
208 if (config->log_level >= 0) cfg.log_level = config->log_level;
209 if (config->log_path) cfg.log_path = config->log_path;
210 // Gated by the flag, not a sentinel: core 0 is a real target.
211 if (config->pin_io_threads)
213 }
215 h->agent = std::make_unique<E3Agent>(std::move(cfg));
216 return h;
217 } catch (...) {
218 return nullptr;
219 }
220}
221
223 if (!agent) return;
224 delete agent;
225}
226
228 if (!agent || !agent->agent) return static_cast<int>(ErrorCode::STATE_ERROR);
229 return static_cast<int>(agent->agent->init());
230}
231
233 if (!agent || !agent->agent) return static_cast<int>(ErrorCode::STATE_ERROR);
234 return static_cast<int>(agent->agent->start());
235}
236
238 if (!agent || !agent->agent) return;
239 agent->agent->stop();
240}
241
243 if (!agent || !agent->agent || !sm) return static_cast<int>(ErrorCode::INVALID_PARAM);
244
245 // Screen the E3AP ranFunctionData constraint here, before the ownership
246 // transfer below. register_sm() takes the unique_ptr by value, so a
247 // rejection on the far side destroys the object while the caller still
248 // holds the handle; rejecting first is what lets the caller keep it and
249 // call e3_service_model_destroy() as this function documents.
250 const size_t rfd_len = sm->ran_function_data_s.size();
251 if (rfd_len == 0 || rfd_len > MAX_PROTOCOL_DATA_SIZE) {
252 E3_LOG_ERROR(LOG_TAG) << "SM '" << sm->name_s << "' advertises " << rfd_len
253 << " bytes of ran_function_data; E3AP requires 1.."
255 return static_cast<int>(ErrorCode::INVALID_PARAM);
256 }
257
258 // Transfer ownership into the agent
259 try {
260 sm->transferred_to_agent = true;
261 std::unique_ptr<ServiceModel> uptr(sm);
262 return static_cast<int>(agent->agent->register_sm(std::move(uptr)));
263 } catch (...) {
264 return static_cast<int>(ErrorCode::INTERNAL_ERROR);
265 }
266}
267
269 if (!agent || !agent->agent) return static_cast<int>(AgentState::ERROR);
270 return static_cast<int>(agent->agent->state());
271 }
272
274 if (!agent || !agent->agent) return 0;
275 return agent->agent->is_running() ? 1 : 0;
276 }
277
279 e3_agent_handle_t* agent,
280 e3_dapp_report_cb handler
281) {
282 if (!agent || !agent->agent) return static_cast<int>(ErrorCode::INVALID_PARAM);
283
284 if (!handler) {
285 agent->agent->set_dapp_report_handler(DAppReportHandler{});
286 return static_cast<int>(ErrorCode::SUCCESS);
287 }
288
289 agent->agent->set_dapp_report_handler(
290 [handler](const DAppReport& report) {
291 const uint8_t* report_data =
292 report.report_data.empty() ? nullptr : report.report_data.data();
293 handler(
294 report.dapp_identifier,
296 report_data,
297 report.report_data.size(),
298 report.sequence_id
299 );
300 }
301 );
302
303 return static_cast<int>(ErrorCode::SUCCESS);
304 }
305
306 static uint32_t* copy_vector_u32_to_c(const std::vector<uint32_t>& v, size_t* out_len) {
307 if (out_len) *out_len = v.size();
308 if (v.empty()) return nullptr;
309 uint32_t* arr = (uint32_t*)malloc(sizeof(uint32_t) * v.size());
310 if (!arr) return nullptr;
311 memcpy(arr, v.data(), sizeof(uint32_t) * v.size());
312 return arr;
313 }
314
315 uint32_t* e3_agent_get_available_ran_functions(e3_agent_handle_t* agent, size_t* out_len) {
316 if (!agent || !agent->agent) { if (out_len) *out_len = 0; return nullptr; }
317 auto v = agent->agent->get_available_ran_functions();
318 return copy_vector_u32_to_c(v, out_len);
319 }
320
321 uint32_t* e3_agent_get_registered_dapps(e3_agent_handle_t* agent, size_t* out_len) {
322 if (!agent || !agent->agent) { if (out_len) *out_len = 0; return nullptr; }
323 auto v = agent->agent->get_registered_dapps();
324 return copy_vector_u32_to_c(v, out_len);
325 }
326
327 uint32_t* e3_agent_get_dapp_subscriptions(e3_agent_handle_t* agent, uint32_t dapp_id, size_t* out_len) {
328 if (!agent || !agent->agent) { if (out_len) *out_len = 0; return nullptr; }
329 auto v = agent->agent->get_dapp_subscriptions(dapp_id);
330 return copy_vector_u32_to_c(v, out_len);
331 }
332
333 uint32_t* e3_agent_get_ran_function_subscribers(e3_agent_handle_t* agent, uint32_t ran_function_id, size_t* out_len) {
334 if (!agent || !agent->agent) { if (out_len) *out_len = 0; return nullptr; }
335 auto v = agent->agent->get_ran_function_subscribers(ran_function_id);
336 return copy_vector_u32_to_c(v, out_len);
337 }
338
339 uint32_t* e3_agent_get_active_ran_functions(e3_agent_handle_t* agent, size_t* out_len) {
340 if (!agent || !agent->agent) { if (out_len) *out_len = 0; return nullptr; }
341 auto v = agent->agent->get_active_ran_functions();
342 return copy_vector_u32_to_c(v, out_len);
343 }
344
346 e3_agent_handle_t* agent,
347 uint32_t dapp_id,
348 uint32_t ran_function_id
349 ) {
350 if (!agent || !agent->agent) return 0;
351 return agent->agent->get_subscription_periodicity(dapp_id, ran_function_id);
352 }
353
355 e3_agent_handle_t* agent,
356 uint32_t dapp_id,
357 uint32_t ran_function_id,
358 size_t* out_len
359 ) {
360 if (!agent || !agent->agent) { if (out_len) *out_len = 0; return nullptr; }
361 auto v = agent->agent->get_subscription_telemetry_ids(dapp_id, ran_function_id);
362 return copy_vector_u32_to_c(v, out_len);
363 }
364
366 e3_agent_handle_t* agent,
367 uint32_t dapp_id,
368 uint32_t ran_function_id,
369 size_t* out_len
370 ) {
371 if (!agent || !agent->agent) { if (out_len) *out_len = 0; return nullptr; }
372 auto v = agent->agent->get_subscription_control_ids(dapp_id, ran_function_id);
373 return copy_vector_u32_to_c(v, out_len);
374 }
375
376 void e3_agent_free_uint32_array(uint32_t* arr) {
377 free(arr);
378 }
379
381 e3_agent_handle_t* agent,
382 uint32_t dapp_id,
383 uint32_t ran_function_id,
384 const uint8_t* data,
385 size_t data_len
386 ) {
387 if (!agent || !agent->agent) return static_cast<int>(ErrorCode::INVALID_PARAM);
388 std::vector<uint8_t> buf;
389 if (data && data_len) buf.assign(data, data + data_len);
390 return static_cast<int>(agent->agent->send_indication(dapp_id, ran_function_id, buf));
391 }
392
394 e3_agent_handle_t* agent,
395 uint32_t dapp_id,
396 uint32_t ran_function_id,
397 const uint8_t* control_data,
398 size_t control_data_len,
399 uint32_t sequence_id
400 ) {
401 if (!agent || !agent->agent) return static_cast<int>(ErrorCode::INVALID_PARAM);
402 std::vector<uint8_t> buf;
403 if (control_data && control_data_len) buf.assign(control_data, control_data + control_data_len);
404 return static_cast<int>(
405 agent->agent->send_xapp_control(dapp_id, ran_function_id, buf, sequence_id));
406 }
407
409 e3_agent_handle_t* agent,
410 uint32_t request_id,
411 int response_code
412 ) {
413 if (!agent || !agent->agent) return static_cast<int>(ErrorCode::INVALID_PARAM);
414 ResponseCode rc = (response_code == 0) ? ResponseCode::POSITIVE : ResponseCode::NEGATIVE;
415 return static_cast<int>(agent->agent->send_message_ack(request_id, rc));
416 }
417
419 if (!agent || !agent->agent) return 0;
420 return agent->agent->dapp_count();
421 }
422
424 if (!agent || !agent->agent) return 0;
425 return agent->agent->subscription_count();
426 }
427
429 switch (code) {
430#define X(name, val) case val: return #name;
432#undef X
433 default: return "UNKNOWN_ERROR_CODE";
434 }
435}
436
438 e3_agent_handle_t* agent,
440) {
441 if (!agent || !agent->agent) return static_cast<int>(ErrorCode::INVALID_PARAM);
442
443 if (!handler) {
444 agent->agent->set_dapp_status_changed_handler(DAppStatusChangedHandler{});
445 return static_cast<int>(ErrorCode::SUCCESS);
446 }
447
448 agent->agent->set_dapp_status_changed_handler(
449 [handler]() { handler(); }
450 );
451
452 return static_cast<int>(ErrorCode::SUCCESS);
453}
454
455} // extern "C"
void e3_agent_free_uint32_array(uint32_t *arr)
Free an array previously returned by the e3_agent_get_* helpers.
Definition c_api.cpp:376
e3_error_t e3_agent_register_sm(e3_agent_handle_t *agent, e3_service_model_handle_t *sm)
Register a ServiceModel implementation with the agent.
Definition c_api.cpp:242
e3_service_model_handle_t * e3_service_model_create_from_c(const e3_c_service_model_desc_t *desc)
Create a ServiceModel implementation backed by C callbacks.
Definition c_api.cpp:127
uint32_t e3_agent_get_subscription_periodicity(e3_agent_handle_t *agent, uint32_t dapp_id, uint32_t ran_function_id)
Get the reporting periodicity a dApp requested for a RAN function.
Definition c_api.cpp:345
uint32_t * e3_agent_get_ran_function_subscribers(e3_agent_handle_t *agent, uint32_t ran_function_id, size_t *out_len)
Return a newly-allocated array of dApp IDs subscribed to a RAN function.
Definition c_api.cpp:333
void e3_agent_destroy(e3_agent_handle_t *agent)
Destroy an E3Agent handle.
Definition c_api.cpp:222
void e3_agent_stop(e3_agent_handle_t *agent)
Stop the agent and release runtime resources.
Definition c_api.cpp:237
size_t e3_agent_subscription_count(e3_agent_handle_t *agent)
Total number of active subscriptions tracked by the agent.
Definition c_api.cpp:423
e3_error_t e3_agent_set_dapp_report_handler(e3_agent_handle_t *agent, e3_dapp_report_cb handler)
Set callback for incoming dApp reports (dApp -> RAN).
Definition c_api.cpp:278
const char * e3_error_to_string(e3_error_t code)
Convert a numeric error code to a human-readable name.
Definition c_api.cpp:428
e3_agent_handle_t * e3_agent_create_default()
Create/destroy an E3Agent handle.
Definition c_api.cpp:186
e3_error_t e3_agent_send_message_ack(e3_agent_handle_t *agent, uint32_t request_id, int response_code)
Send a message acknowledgment (e.g. ack a control/request from dApp).
Definition c_api.cpp:408
int e3_agent_is_running(e3_agent_handle_t *agent)
Query whether the agent is currently running.
Definition c_api.cpp:273
uint32_t * e3_agent_get_registered_dapps(e3_agent_handle_t *agent, size_t *out_len)
Return a newly-allocated array of registered dApp IDs.
Definition c_api.cpp:321
e3_error_t e3_service_model_emit_message_ack(e3_service_model_handle_t *sm, uint32_t request_id, int response_code)
Emit a message acknowledgment from a ServiceModel.
Definition c_api.cpp:170
int e3_agent_get_state(e3_agent_handle_t *agent)
Get the agent state as an integer matching libe3::AgentState.
Definition c_api.cpp:268
e3_error_t e3_agent_start(e3_agent_handle_t *agent)
Start the agent processing threads and accept dApp connections.
Definition c_api.cpp:232
void e3_service_model_destroy(e3_service_model_handle_t *sm)
Destroy a C-backed ServiceModel handle.
Definition c_api.cpp:136
e3_agent_handle_t * e3_agent_create_with_config(const e3_config_t *config)
Create a new E3Agent with the given configuration.
Definition c_api.cpp:190
e3_error_t e3_agent_send_indication(e3_agent_handle_t *agent, uint32_t dapp_id, uint32_t ran_function_id, const uint8_t *data, size_t data_len)
Send an indication message to a specific dApp.
Definition c_api.cpp:380
e3_error_t e3_agent_init(e3_agent_handle_t *agent)
Initialize the agent.
Definition c_api.cpp:227
uint32_t * e3_agent_get_active_ran_functions(e3_agent_handle_t *agent, size_t *out_len)
Return a newly-allocated array of RAN function IDs that currently have at least one subscriber (RAN r...
Definition c_api.cpp:339
uint32_t * e3_agent_get_dapp_subscriptions(e3_agent_handle_t *agent, uint32_t dapp_id, size_t *out_len)
Return a newly-allocated array of RAN function IDs subscribed by a dApp.
Definition c_api.cpp:327
uint32_t * e3_agent_get_subscription_control_ids(e3_agent_handle_t *agent, uint32_t dapp_id, uint32_t ran_function_id, size_t *out_len)
Get the control IDs a dApp requested for a RAN function.
Definition c_api.cpp:365
e3_error_t e3_service_model_emit_indication(e3_service_model_handle_t *sm, uint32_t dapp_id, uint32_t ran_function_id, const uint8_t *data, size_t data_len)
Emit an indication message from a ServiceModel to the outbound queue.
Definition c_api.cpp:143
size_t e3_agent_dapp_count(e3_agent_handle_t *agent)
Number of registered dApps known to the agent.
Definition c_api.cpp:418
uint32_t * e3_agent_get_subscription_telemetry_ids(e3_agent_handle_t *agent, uint32_t dapp_id, uint32_t ran_function_id, size_t *out_len)
Get the telemetry IDs a dApp requested for a RAN function.
Definition c_api.cpp:354
uint32_t * e3_agent_get_available_ran_functions(e3_agent_handle_t *agent, size_t *out_len)
Return a newly-allocated array of available RAN function IDs.
Definition c_api.cpp:315
e3_error_t e3_agent_send_xapp_control(e3_agent_handle_t *agent, uint32_t dapp_id, uint32_t ran_function_id, const uint8_t *control_data, size_t control_data_len, uint32_t sequence_id)
Send an xApp control action to a specific dApp (e.g. from E2/SM).
Definition c_api.cpp:393
static uint32_t * copy_vector_u32_to_c(const std::vector< uint32_t > &v, size_t *out_len)
Definition c_api.cpp:306
e3_error_t e3_agent_set_dapp_status_changed_handler(e3_agent_handle_t *agent, e3_dapp_status_changed_cb handler)
Set callback for dApp status changes.
Definition c_api.cpp:437
void(* e3_dapp_status_changed_cb)(void)
Definition c_api.h:56
struct e3_agent_handle_s e3_agent_handle_t
Definition c_api.h:21
void(* e3_dapp_report_cb)(uint32_t dapp_id, uint32_t ran_function_id, const uint8_t *report_data, size_t report_data_len, uint32_t sequence_id)
Definition c_api.h:46
e3_error_t(* e3_sm_process_control_cb)(e3_service_model_handle_t *sm_handle, void *sm_context, uint32_t request_message_id, uint32_t dapp_id, uint32_t ran_function_id, uint32_t control_id, const uint8_t *data, size_t data_len, uint32_t sequence_id)
Definition c_api.h:31
void(* e3_sm_destroy_cb)(void *sm_context)
Definition c_api.h:27
e3_error_t(* e3_sm_start_cb)(void *sm_context)
Definition c_api.h:28
void(* e3_sm_stop_cb)(void *sm_context)
Definition c_api.h:29
int(* e3_sm_is_running_cb)(void *sm_context)
Definition c_api.h:30
struct e3_service_model_handle_s e3_service_model_handle_t
Definition c_api.h:22
e3_error_t(* e3_sm_init_cb)(void *sm_context)
Definition c_api.h:26
ServiceModel()=default
ErrorCode emit_outbound(Pdu &&pdu)
Emit an outbound PDU produced by the SM.
E3Agent - Main façade class for RAN vendors.
libe3 error codes - shared C/C++ definitions
int e3_error_t
C error type alias.
#define LIBE3_ERROR_CODE_LIST
X-macro list of all libe3 error codes.
Definition error_codes.h:67
Lock-free per-thread latency stamp recorder (header-only, C99).
static void latrec_tstamp(uint64_t seq, uint8_t stage, uint64_t aux, uint64_t aux2)
Definition latrec.h:685
static uint64_t latrec_seq_next(void)
Definition latrec.h:684
@ LATREC_EMIT_ENTER
Definition latrec.h:174
static uint64_t latrec_ctx(void)
Definition latrec.h:697
Logging facility for libe3.
#define E3_LOG_ERROR(component)
Definition logger.hpp:225
ErrorCode
Error codes returned by libe3 operations Use shared error-code list (see libe3/error_codes....
Definition types.hpp:141
E3TransportLayer
Transport layer types (matches Python E3TransportLayer).
Definition types.hpp:83
@ ERROR
Error state.
Definition types.hpp:134
std::function< void()> DAppStatusChangedHandler
Definition e3_agent.hpp:33
ResponseCode
E3AP response codes.
Definition types.hpp:101
@ NEGATIVE
Request rejected.
Definition types.hpp:103
@ POSITIVE
Request accepted.
Definition types.hpp:102
std::function< void(const DAppReport &)> DAppReportHandler
Definition e3_agent.hpp:30
constexpr size_t MAX_PROTOCOL_DATA_SIZE
Definition types.hpp:160
E3LinkLayer
Link layer types (matches Python E3LinkLayer).
Definition types.hpp:60
EncodingFormat
E3AP encoding formats supported by the library.
Definition types.hpp:51
Service Model Interface - Extension point for RAN vendors.
std::unique_ptr< E3Agent > agent
Definition c_api.cpp:27
Descriptor describing a ServiceModel implemented in C.
Definition c_api.h:82
const uint32_t * control_ids
Definition c_api.h:90
e3_sm_stop_cb sm_stop
Definition c_api.h:104
const uint8_t * ran_function_data
Definition c_api.h:97
const uint32_t * telemetry_ids
Definition c_api.h:87
const char * name
Definition c_api.h:83
e3_sm_start_cb sm_start
Definition c_api.h:103
e3_sm_init_cb sm_init
Definition c_api.h:101
e3_sm_is_running_cb sm_is_running
Definition c_api.h:105
size_t ran_function_data_len
Definition c_api.h:98
e3_sm_process_control_cb sm_process_control
Definition c_api.h:106
uint32_t ran_function_id
Definition c_api.h:85
e3_sm_destroy_cb sm_destroy
Definition c_api.h:102
Configuration for creating an E3Agent from C.
Definition c_api.h:168
int encoding
Definition c_api.h:178
int log_level
Definition c_api.h:180
uint16_t subscriber_port
Definition c_api.h:173
int pin_io_threads
Definition c_api.h:183
const char * setup_endpoint
Definition c_api.h:175
int link_layer
Definition c_api.h:170
const char * log_path
Definition c_api.h:181
size_t io_threads
Definition c_api.h:179
uint16_t setup_port
Definition c_api.h:172
uint16_t publisher_port
Definition c_api.h:174
int io_thread_affinity
Definition c_api.h:184
const char * ran_identifier
Definition c_api.h:169
const char * subscriber_endpoint
Definition c_api.h:176
int transport_layer
Definition c_api.h:171
const char * publisher_endpoint
Definition c_api.h:177
e3_sm_stop_cb sm_stop
Definition c_api.cpp:43
ErrorCode start() override
Start the SM processing.
Definition c_api.cpp:88
void stop() override
Stop the SM processing.
Definition c_api.cpp:92
void destroy() override
Destroy the SM and release resources.
Definition c_api.cpp:85
e3_sm_process_control_cb sm_process_control
Definition c_api.cpp:45
e3_sm_init_cb sm_init
Definition c_api.cpp:40
ErrorCode handle_control_action(uint32_t request_message_id, const DAppControlAction &action) override
Process a control action from a dApp.
Definition c_api.cpp:100
std::vector< uint32_t > control_ids_s
Definition c_api.cpp:36
ErrorCode init() override
Initialize the SM.
Definition c_api.cpp:81
bool is_running() const override
Check if SM is currently running.
Definition c_api.cpp:95
std::vector< uint32_t > telemetry_ids() const override
Get telemetry IDs supported by this SM.
Definition c_api.cpp:78
e3_sm_start_cb sm_start
Definition c_api.cpp:42
std::string name() const override
Get SM name.
Definition c_api.cpp:75
std::vector< uint32_t > control_ids() const override
Get control IDs supported by this SM.
Definition c_api.cpp:79
uint32_t ran_function_id() const override
Get RAN function ID for this SM.
Definition c_api.cpp:77
std::vector< uint32_t > telemetry_ids_s
Definition c_api.cpp:35
uint32_t version() const override
Get SM version.
Definition c_api.cpp:76
std::vector< uint8_t > ran_function_data_s
Definition c_api.cpp:37
e3_sm_is_running_cb sm_is_running
Definition c_api.cpp:44
std::vector< uint8_t > ran_function_data() const override
RAN-function-specific opaque data (required, 1..32768 bytes).
Definition c_api.cpp:80
e3_sm_destroy_cb sm_destroy
Definition c_api.cpp:41
ErrorCode emit_pdu(Pdu &&pdu)
Definition c_api.cpp:120
e3_service_model_handle_s(const e3_c_service_model_desc_t &desc)
Definition c_api.cpp:51
E3AP dApp Control Action structure.
Definition types.hpp:272
uint32_t ran_function_identifier
Definition types.hpp:274
std::vector< uint8_t > action_data
Definition types.hpp:276
uint32_t control_identifier
Control identifier.
Definition types.hpp:275
E3AP dApp Report structure.
Definition types.hpp:293
uint32_t dapp_identifier
Definition types.hpp:294
uint32_t sequence_id
Definition types.hpp:299
std::vector< uint8_t > report_data
Definition types.hpp:296
uint32_t ran_function_identifier
Definition types.hpp:295
Configuration for E3Agent.
Definition types.hpp:390
std::string log_path
Path of the shared log file. Empty (default) => auto-generated.
Definition types.hpp:485
std::string subscriber_endpoint
Endpoint URI for inbound channel.
Definition types.hpp:423
int log_level
Logging verbosity: 0=none, 1=error, 2=warn, 3=info, 4=debug, 5=trace.
Definition types.hpp:473
uint16_t setup_port
Port used for E3AP setup channel.
Definition types.hpp:417
int io_thread_affinity
CPU core to pin the subscriber and publisher I/O threads to.
Definition types.hpp:458
EncodingFormat encoding
PDU encoding format (ASN.1 PER or JSON).
Definition types.hpp:428
E3LinkLayer link_layer
Link-layer transport (ZMQ or POSIX).
Definition types.hpp:412
std::string publisher_endpoint
Endpoint URI for outbound channel.
Definition types.hpp:424
uint16_t subscriber_port
Port used for inbound control/subscription channel.
Definition types.hpp:418
std::string ran_identifier
Unique identifier for this RAN function (e.g. "DU-1").
Definition types.hpp:395
E3TransportLayer transport_layer
Transport-layer protocol (SCTP, TCP, IPC).
Definition types.hpp:414
size_t io_threads
Number of I/O threads (used by ZMQ context).
Definition types.hpp:445
std::string setup_endpoint
Endpoint URI for setup channel.
Definition types.hpp:422
uint16_t publisher_port
Port used for outbound indication/publication channel.
Definition types.hpp:419
E3AP Indication Message structure.
Definition types.hpp:263
uint32_t ran_function_identifier
RAN function identifier.
Definition types.hpp:265
std::vector< uint8_t > protocol_data
Definition types.hpp:266
E3AP Message Acknowledgment structure.
Definition types.hpp:285
ResponseCode response_code
Response code (positive/negative).
Definition types.hpp:287
uint32_t request_id
ID of the request being acknowledged.
Definition types.hpp:286
Generic E3AP PDU structure.
Definition types.hpp:345
uint64_t enqueue_seq
Set by queue_outbound; keys the [latrec] L-stage records.
Definition types.hpp:349
PduChoice choice
Definition types.hpp:347
E3AP Protocol Types - Vendor-neutral type definitions.