libe3 0.6.1
C++ library for E3AP RAN vendor integration
Loading...
Searching...
No Matches
e3_agent.cpp
Go to the documentation of this file.
1/**
2 * @file e3_agent.cpp
3 * @brief E3Agent façade implementation
4 *
5 * SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9#include "libe3/e3_agent.hpp"
11#include "libe3/latrec.h"
12#include "libe3/logger.hpp"
13#include "libe3/version.hpp"
14
15namespace libe3 {
16
17namespace {
18constexpr const char* LOG_TAG = "E3Agent";
19}
20
21/**
22 * @brief E3Agent implementation details
23 */
25 E3Config config; ///< The configuration the agent was created with
26 std::unique_ptr<E3Interface> interface; ///< The protocol engine
27 DAppReportHandler dapp_report_handler; ///< Called with each dApp report (RAN role)
28 DAppStatusChangedHandler dapp_status_changed_handler; ///< Called when a dApp's status changes (RAN role)
29
30 // dApp-side handlers stored before init() so they can be forwarded
31 // to E3Interface after construction.
32 SetupResponseHandler setup_response_handler; ///< Called with each setup response
33 SubscriptionResponseHandler subscription_response_handler; ///< Called with each subscription response
34 IndicationHandler indication_handler; ///< Called with each indication
35 XAppControlHandler xapp_control_handler; ///< Called with each xApp control action
36 MessageAckHandler message_ack_handler; ///< Called with each message ack (DEPRECATED TO BE REMOVED)
37 ControlResponseHandler control_response_handler; ///< Called with each control response
38 DisconnectHandler disconnect_handler; ///< Called when the session with the RAN ends
39
40 /**
41 * @brief Keep the configuration
42 * @param cfg The configuration the agent was created with
43 */
44 explicit Impl(E3Config cfg) : config(std::move(cfg)) {}
45};
46
48 : impl_(std::make_unique<Impl>(std::move(config)))
49{
50 E3_LOG_INFO(LOG_TAG) << "E3Agent created (version " << LIBE3_VERSION_STRING << ")";
51}
52
54 stop();
55 E3_LOG_INFO(LOG_TAG) << "E3Agent destroyed";
56}
57
58E3Agent::E3Agent(E3Agent&&) noexcept = default;
59E3Agent& E3Agent::operator=(E3Agent&&) noexcept = default;
60
61// =========================================================================
62// Lifecycle Management
63// =========================================================================
64
66 if (impl_->interface) {
67 E3_LOG_WARN(LOG_TAG) << "Agent already initialized";
68 return ErrorCode::ALREADY_INITIALIZED;
69 }
70
71 E3_LOG_INFO(LOG_TAG) << "Initializing E3Agent";
72
73 impl_->interface = std::make_unique<E3Interface>(impl_->config);
74
75 ErrorCode result = impl_->interface->init();
76 if (result != ErrorCode::SUCCESS) {
77 impl_->interface.reset();
78 E3_LOG_ERROR(LOG_TAG) << "Failed to initialize interface: "
79 << error_code_to_string(result);
80 return result;
81 }
82
83 if (impl_->dapp_report_handler) {
84 impl_->interface->set_dapp_report_handler(impl_->dapp_report_handler);
85 }
86
87 if (impl_->dapp_status_changed_handler) {
88 impl_->interface->set_dapp_status_changed_handler(impl_->dapp_status_changed_handler);
89 }
90
91 if (impl_->setup_response_handler) {
92 impl_->interface->set_setup_response_handler(impl_->setup_response_handler);
93 }
94 if (impl_->subscription_response_handler) {
95 impl_->interface->set_subscription_response_handler(impl_->subscription_response_handler);
96 }
97 if (impl_->indication_handler) {
98 impl_->interface->set_indication_handler(impl_->indication_handler);
99 }
100 if (impl_->xapp_control_handler) {
101 impl_->interface->set_xapp_control_handler(impl_->xapp_control_handler);
102 }
103 if (impl_->message_ack_handler) {
104 impl_->interface->set_message_ack_handler(impl_->message_ack_handler);
105 }
106 if (impl_->control_response_handler) {
107 impl_->interface->set_control_response_handler(impl_->control_response_handler);
108 }
109 if (impl_->disconnect_handler) {
110 impl_->interface->set_disconnect_handler(impl_->disconnect_handler);
111 }
112
113 E3_LOG_INFO(LOG_TAG) << "E3Agent initialized successfully";
114 return ErrorCode::SUCCESS;
115}
116
118 // Initialize if not already done
119 if (!impl_->interface) {
120 ErrorCode init_result = init();
121 if (init_result != ErrorCode::SUCCESS) {
122 return init_result;
123 }
124 }
125
126 E3_LOG_INFO(LOG_TAG) << "Starting E3Agent";
127
128 ErrorCode result = impl_->interface->start();
129 if (result != ErrorCode::SUCCESS) {
130 E3_LOG_ERROR(LOG_TAG) << "Failed to start interface: "
131 << error_code_to_string(result);
132 return result;
133 }
134
135 E3_LOG_INFO(LOG_TAG) << "E3Agent started successfully";
136 return ErrorCode::SUCCESS;
137}
138
140 if (!impl_ || !impl_->interface) {
141 return;
142 }
143
144 E3_LOG_INFO(LOG_TAG) << "Stopping E3Agent";
145 impl_->interface->stop();
146 E3_LOG_INFO(LOG_TAG) << "E3Agent stopped";
147}
148
149AgentState E3Agent::state() const noexcept {
150 if (!impl_ || !impl_->interface) {
152 }
153 return impl_->interface->state();
154}
155
156bool E3Agent::is_running() const noexcept {
157 return impl_ && impl_->interface && impl_->interface->is_running();
158}
159
160// =========================================================================
161// Service Model Registration
162// =========================================================================
163
164ErrorCode E3Agent::register_sm(std::unique_ptr<ServiceModel> sm) {
165 if (!sm) {
166 return ErrorCode::INVALID_PARAM;
167 }
168 if (impl_->config.role != E3Role::RAN) {
169 E3_LOG_ERROR(LOG_TAG) << "register_sm() is only valid on RAN role";
170 return ErrorCode::STATE_ERROR;
171 }
172
173 // Initialize interface if needed
174 if (!impl_->interface) {
175 ErrorCode init_result = init();
176 if (init_result != ErrorCode::SUCCESS) {
177 return init_result;
178 }
179 }
180
181 return impl_->interface->register_sm(std::move(sm));
182}
183
184std::vector<uint32_t> E3Agent::get_available_ran_functions() const {
185 if (!impl_->interface) {
186 return {};
187 }
188 return impl_->interface->get_available_ran_functions();
189}
190
192 impl_->dapp_report_handler = std::move(handler);
193 if (impl_->interface && impl_->dapp_report_handler) {
194 impl_->interface->set_dapp_report_handler(impl_->dapp_report_handler);
195 }
196}
197
199 impl_->dapp_status_changed_handler = std::move(handler);
200 if (impl_->interface && impl_->dapp_status_changed_handler) {
201 impl_->interface->set_dapp_status_changed_handler(impl_->dapp_status_changed_handler);
202 }
203}
204
205// =========================================================================
206// Manual Operations
207// =========================================================================
208
210 uint32_t dapp_id,
211 uint32_t ran_function_id,
212 const std::vector<uint8_t>& data
213) {
214 if (impl_->config.role != E3Role::RAN) {
215 return ErrorCode::STATE_ERROR;
216 }
217 if (!impl_->interface || !impl_->interface->is_running()) {
218 return ErrorCode::NOT_INITIALIZED;
219 }
220
222 // As in e3_service_model_emit_indication: the outbound leg starts at this
223 // boundary whichever API the producer used.
225 latrec_tstamp(pdu.enqueue_seq, LATREC_EMIT_ENTER, latrec_ctx(), ran_function_id);
226
227 uint32_t mid = impl_->interface->generate_message_id();
228 pdu.message_id = mid;
231 msg.ran_function_identifier = ran_function_id;
232 msg.protocol_data = data;
233 pdu.choice = msg;
234
235 return impl_->interface->queue_outbound(std::move(pdu));
236}
237
239 uint32_t dapp_id,
240 uint32_t ran_function_id,
241 const std::vector<uint8_t>& control_data,
242 uint32_t sequence_id,
243 uint32_t* out_message_id,
244 bool request_ack
245) {
246 if (impl_->config.role != E3Role::RAN) {
247 return ErrorCode::STATE_ERROR;
248 }
249 if (!impl_->interface || !impl_->interface->is_running()) {
250 return ErrorCode::NOT_INITIALIZED;
251 }
253 pdu.message_id = impl_->interface->generate_message_id();
254 XAppControlAction action;
255 action.dapp_identifier = dapp_id;
256 action.ran_function_identifier = ran_function_id;
257 action.xapp_control_data = control_data;
258 action.sequence_id = sequence_id;
259 action.request_ack = request_ack;
260 pdu.choice = action;
261 const uint32_t message_id = pdu.message_id;
262 ErrorCode rc = impl_->interface->queue_outbound(std::move(pdu));
263 if (rc == ErrorCode::SUCCESS && out_message_id) {
264 *out_message_id = message_id;
265 }
266 return rc;
267}
268
269ErrorCode E3Agent::send_message_ack(uint32_t request_id, ResponseCode response_code) { // DEPRECATED TO BE REMOVED
270 if (!impl_->interface || !impl_->interface->is_running()) {
271 return ErrorCode::NOT_INITIALIZED;
272 }
274 pdu.message_id = impl_->interface->generate_message_id();
275 MessageAck ack;
276 ack.request_id = request_id;
277 ack.response_code = response_code;
278 pdu.choice = ack;
279 return impl_->interface->queue_outbound(std::move(pdu));
280}
281
282std::vector<uint32_t> E3Agent::get_registered_dapps() const {
283 if (!impl_->interface || impl_->config.role != E3Role::RAN) {
284 return {};
285 }
286 return impl_->interface->subscription_manager().get_registered_dapps();
287}
288
289std::vector<uint32_t> E3Agent::get_dapp_subscriptions(uint32_t dapp_id) const {
290 if (!impl_->interface || impl_->config.role != E3Role::RAN) {
291 return {};
292 }
293 return impl_->interface->subscription_manager().get_dapp_subscriptions(dapp_id);
294}
295
296std::vector<uint32_t> E3Agent::get_ran_function_subscribers(uint32_t ran_function_id) const {
297 if (!impl_->interface || impl_->config.role != E3Role::RAN) {
298 return {};
299 }
300 return impl_->interface->subscription_manager().get_subscribed_dapps(ran_function_id);
301}
302
303std::vector<uint32_t> E3Agent::get_active_ran_functions() const {
304 if (!impl_->interface || impl_->config.role != E3Role::RAN) {
305 return {};
306 }
307 return impl_->interface->subscription_manager().get_active_ran_functions();
308}
309
310uint32_t E3Agent::get_subscription_periodicity(uint32_t dapp_id, uint32_t ran_function_id) const {
311 if (!impl_->interface) {
312 return 0;
313 }
314 const auto details = impl_->interface->subscription_manager()
315 .get_subscription_details(dapp_id, ran_function_id);
316 return details ? details->periodicity_us : 0;
317}
318
319std::vector<uint32_t> E3Agent::get_subscription_telemetry_ids(uint32_t dapp_id, uint32_t ran_function_id) const {
320 if (!impl_->interface) {
321 return {};
322 }
323 const auto details = impl_->interface->subscription_manager()
324 .get_subscription_details(dapp_id, ran_function_id);
325 return details ? details->telemetry_ids : std::vector<uint32_t>{};
326}
327
328std::vector<uint32_t> E3Agent::get_subscription_control_ids(uint32_t dapp_id, uint32_t ran_function_id) const {
329 if (!impl_->interface) {
330 return {};
331 }
332 const auto details = impl_->interface->subscription_manager()
333 .get_subscription_details(dapp_id, ran_function_id);
334 return details ? details->control_ids : std::vector<uint32_t>{};
335}
336
337// =========================================================================
338// Configuration
339// =========================================================================
340
341const E3Config& E3Agent::config() const noexcept {
342 return impl_->config;
343}
344
345// =========================================================================
346// Statistics
347// =========================================================================
348
349size_t E3Agent::dapp_count() const {
350 if (!impl_->interface) {
351 return 0;
352 }
353 if (impl_->config.role == E3Role::RAN) {
354 return impl_->interface->subscription_manager().dapp_count();
355 }
356 // On the dApp role, "dapp_count" is 0/1 depending on whether we have a
357 // dApp identifier assigned.
358 return impl_->interface->dapp_id().has_value() ? 1u : 0u;
359}
360
362 if (!impl_->interface) {
363 return 0;
364 }
365 if (impl_->config.role == E3Role::RAN) {
366 return impl_->interface->subscription_manager().subscription_count();
367 }
368 return impl_->interface->active_subscription_ids().size();
369}
370
371// =========================================================================
372// dApp-role API
373// =========================================================================
374
376 impl_->setup_response_handler = std::move(handler);
377 if (impl_->interface && impl_->setup_response_handler) {
378 impl_->interface->set_setup_response_handler(impl_->setup_response_handler);
379 }
380}
381
383 impl_->subscription_response_handler = std::move(handler);
384 if (impl_->interface && impl_->subscription_response_handler) {
385 impl_->interface->set_subscription_response_handler(impl_->subscription_response_handler);
386 }
387}
388
390 impl_->indication_handler = std::move(handler);
391 if (impl_->interface && impl_->indication_handler) {
392 impl_->interface->set_indication_handler(impl_->indication_handler);
393 }
394}
395
397 impl_->xapp_control_handler = std::move(handler);
398 if (impl_->interface && impl_->xapp_control_handler) {
399 impl_->interface->set_xapp_control_handler(impl_->xapp_control_handler);
400 }
401}
402
403void E3Agent::set_message_ack_handler(MessageAckHandler handler) { // DEPRECATED TO BE REMOVED
404 impl_->message_ack_handler = std::move(handler);
405 if (impl_->interface && impl_->message_ack_handler) {
406 impl_->interface->set_message_ack_handler(impl_->message_ack_handler);
407 }
408}
409
411 impl_->control_response_handler = std::move(handler);
412 if (impl_->interface && impl_->control_response_handler) {
413 impl_->interface->set_control_response_handler(impl_->control_response_handler);
414 }
415}
416
418 impl_->disconnect_handler = std::move(handler);
419 if (impl_->interface && impl_->disconnect_handler) {
420 impl_->interface->set_disconnect_handler(impl_->disconnect_handler);
421 }
422}
423
424std::optional<uint32_t> E3Agent::dapp_id() const noexcept {
425 if (!impl_->interface || impl_->config.role != E3Role::DAPP) return std::nullopt;
426 return impl_->interface->dapp_id();
427}
428
429std::vector<uint32_t> E3Agent::subscribed_ran_functions() const {
430 if (!impl_->interface || impl_->config.role != E3Role::DAPP) return {};
431 return impl_->interface->subscribed_ran_functions();
432}
433
434std::vector<uint32_t> E3Agent::active_subscription_ids() const {
435 if (!impl_->interface || impl_->config.role != E3Role::DAPP) return {};
436 return impl_->interface->active_subscription_ids();
437}
438
439ErrorCode E3Agent::wait_for_setup(std::chrono::milliseconds timeout) {
440 if (impl_->config.role != E3Role::DAPP) return ErrorCode::INVALID_PARAM;
441 if (!impl_->interface) return ErrorCode::NOT_INITIALIZED;
442 return impl_->interface->wait_for_setup(timeout);
443}
444
445ErrorCode E3Agent::subscribe(uint32_t ran_function_id,
446 std::vector<uint32_t> telemetry_ids,
447 std::vector<uint32_t> control_ids,
448 std::optional<uint32_t> sub_time,
449 std::optional<uint32_t> periodicity,
450 uint32_t* out_request_id) {
451 if (impl_->config.role != E3Role::DAPP) return ErrorCode::STATE_ERROR;
452 if (!impl_->interface || !impl_->interface->is_running()) return ErrorCode::NOT_INITIALIZED;
453 return impl_->interface->queue_subscription_request(
454 ran_function_id, std::move(telemetry_ids), std::move(control_ids), sub_time, periodicity,
455 out_request_id);
456}
457
458ErrorCode E3Agent::unsubscribe(uint32_t ran_function_id) {
459 if (impl_->config.role != E3Role::DAPP) return ErrorCode::STATE_ERROR;
460 if (!impl_->interface || !impl_->interface->is_running()) return ErrorCode::NOT_INITIALIZED;
461 return impl_->interface->queue_subscription_delete(ran_function_id);
462}
463
464ErrorCode E3Agent::send_control(uint32_t ran_function_id,
465 uint32_t control_id,
466 std::vector<uint8_t> action_data,
467 uint32_t sequence_id,
468 uint32_t* out_message_id,
469 bool request_ack) {
470 if (impl_->config.role != E3Role::DAPP) return ErrorCode::STATE_ERROR;
471 if (!impl_->interface || !impl_->interface->is_running()) return ErrorCode::NOT_INITIALIZED;
472 return impl_->interface->queue_dapp_control_action(
473 ran_function_id, control_id, std::move(action_data), sequence_id, out_message_id, request_ack);
474}
475
477 uint32_t ran_function_id,
478 uint32_t control_id,
479 const ControlResult& result) {
480 if (impl_->config.role != E3Role::DAPP) return ErrorCode::STATE_ERROR;
481 if (!impl_->interface || !impl_->interface->is_running()) return ErrorCode::NOT_INITIALIZED;
482 return impl_->interface->queue_control_response(request_id, ran_function_id, control_id, result);
483}
484
485ErrorCode E3Agent::send_report(uint32_t ran_function_id,
486 std::vector<uint8_t> report_data,
487 uint32_t sequence_id,
488 uint32_t* out_message_id) {
489 if (impl_->config.role != E3Role::DAPP) return ErrorCode::STATE_ERROR;
490 if (!impl_->interface || !impl_->interface->is_running()) return ErrorCode::NOT_INITIALIZED;
491 return impl_->interface->queue_dapp_report(
492 ran_function_id, std::move(report_data), sequence_id, out_message_id);
493}
494
496 if (impl_->config.role != E3Role::DAPP) return ErrorCode::STATE_ERROR;
497 if (!impl_->interface || !impl_->interface->is_running()) return ErrorCode::NOT_INITIALIZED;
498 return impl_->interface->queue_release_message();
499}
500
501} // namespace libe3
E3Agent - Main façade for RAN vendor integration.
Definition e3_agent.hpp:94
std::vector< uint32_t > get_registered_dapps() const
Get list of registered dApp IDs.
Definition e3_agent.cpp:282
void set_disconnect_handler(DisconnectHandler handler)
Definition e3_agent.cpp:417
void stop()
Stop the agent.
Definition e3_agent.cpp:139
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.
Definition e3_agent.cpp:445
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.
Definition e3_agent.cpp:319
void set_xapp_control_handler(XAppControlHandler handler)
Definition e3_agent.cpp:396
void set_setup_response_handler(SetupResponseHandler handler)
Definition e3_agent.cpp:375
ErrorCode wait_for_setup(std::chrono::milliseconds timeout)
Block until the dApp setup handshake completes.
Definition e3_agent.cpp:439
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
void set_dapp_status_changed_handler(DAppStatusChangedHandler handler)
Set callback for dApp status changes. Called when a dApp connects, disconnects, subscribes,...
Definition e3_agent.cpp:198
std::optional< uint32_t > dapp_id() const noexcept
dApp identifier assigned by the RAN in SetupResponse.
Definition e3_agent.cpp:424
std::vector< uint32_t > get_available_ran_functions() const
Get available RAN function IDs.
Definition e3_agent.cpp:184
std::vector< uint32_t > get_dapp_subscriptions(uint32_t dapp_id) const
Get subscriptions for a dApp.
Definition e3_agent.cpp:289
E3Agent(E3Config config=E3Config{})
Construct an E3Agent with configuration.
Definition e3_agent.cpp:47
ErrorCode release()
Definition e3_agent.cpp:495
std::vector< uint32_t > active_subscription_ids() const
Definition e3_agent.cpp:434
std::vector< uint32_t > get_ran_function_subscribers(uint32_t ran_function_id) const
Get subscribers for a RAN function.
Definition e3_agent.cpp:296
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.
Definition e3_agent.cpp:310
ErrorCode register_sm(std::unique_ptr< ServiceModel > sm)
Register a Service Model.
Definition e3_agent.cpp:164
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
void set_subscription_response_handler(SubscriptionResponseHandler handler)
Definition e3_agent.cpp:382
ErrorCode send_xapp_control(uint32_t dapp_id, uint32_t ran_function_id, const std::vector< uint8_t > &control_data, uint32_t sequence_id, uint32_t *out_message_id=nullptr, bool request_ack=false)
Send an xApp control action to a specific dApp coming from the E2SM-DAPP.
Definition e3_agent.cpp:238
~E3Agent()
Destructor - ensures clean shutdown.
Definition e3_agent.cpp:53
const E3Config & config() const noexcept
Get current configuration.
Definition e3_agent.cpp:341
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.
Definition e3_agent.cpp:328
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
std::vector< uint32_t > get_active_ran_functions() const
Get the RAN functions that currently have at least one subscriber.
Definition e3_agent.cpp:303
ErrorCode send_control_response(uint32_t request_id, uint32_t ran_function_id, uint32_t control_id, const ControlResult &result)
Answer an xApp control that asked for an answer (XAppControlAction::request_ack).
Definition e3_agent.cpp:476
void set_indication_handler(IndicationHandler handler)
Definition e3_agent.cpp:389
AgentState state() const noexcept
Get current agent state.
Definition e3_agent.cpp:149
void set_dapp_report_handler(DAppReportHandler handler)
Set callback for incoming dApp reports (dApp → RAN). Call before start(). When a dApp sends a DApp re...
Definition e3_agent.cpp:191
ErrorCode init()
Initialize the agent.
Definition e3_agent.cpp:65
void set_message_ack_handler(MessageAckHandler handler)
Definition e3_agent.cpp:403
size_t subscription_count() const
Get total number of active subscriptions.
Definition e3_agent.cpp:361
ErrorCode start()
Start the agent.
Definition e3_agent.cpp:117
void set_control_response_handler(ControlResponseHandler handler)
Definition e3_agent.cpp:410
ErrorCode send_message_ack(uint32_t request_id, ResponseCode response_code)
Send a message acknowledgment.
Definition e3_agent.cpp:269
E3Agent - Main façade class for RAN vendors.
E3Interface - Internal protocol coordination layer.
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:720
static uint64_t latrec_ctx(void)
Definition latrec.h:751
@ LATREC_EMIT_ENTER
Definition latrec.h:199
uint64_t latrec_seq_next(void)
Definition latrec.c:164
Logging facility for libe3.
#define E3_LOG_INFO(component)
Definition logger.hpp:227
#define E3_LOG_ERROR(component)
Definition logger.hpp:225
std::function< void(const SubscriptionResponse &)> SubscriptionResponseHandler
Definition e3_agent.hpp:39
ErrorCode
Error codes returned by libe3 operations Use shared error-code list (see libe3/error_codes....
Definition types.hpp:177
std::function< void(const XAppControlAction &)> XAppControlHandler
Definition e3_agent.hpp:43
AgentState
Agent state machine states.
Definition types.hpp:162
@ UNINITIALIZED
Agent not yet initialized.
Definition types.hpp:163
std::function< void()> DAppStatusChangedHandler
Definition e3_agent.hpp:33
@ RAN
RAN function (binds sockets; today's only behaviour).
Definition types.hpp:78
@ DAPP
dApp (connects to a RAN agent)
Definition types.hpp:79
ResponseCode
E3AP response codes.
Definition types.hpp:103
std::function< void(const DAppReport &)> DAppReportHandler
Definition e3_agent.hpp:30
@ XAPP_CONTROL_ACTION
Definition types.hpp:153
@ MESSAGE_ACK
DEPRECATED TO BE REMOVED: libe3 no longer sends it, see CONTROL_RESPONSE.
Definition types.hpp:155
std::function< void(const SetupResponse &)> SetupResponseHandler
Definition e3_agent.hpp:37
std::function< void(const ControlResponse &)> ControlResponseHandler
Called for a ControlResponse: on a dApp, the RAN's answer to its control; on a RAN,...
Definition e3_agent.hpp:47
std::function< void(const MessageAck &)> MessageAckHandler
Called for a MessageAck. DEPRECATED TO BE REMOVED: libe3 does not send one, it reads one from another...
Definition e3_agent.hpp:45
std::function< void(DisconnectReason)> DisconnectHandler
Definition e3_agent.hpp:49
const char * error_code_to_string(ErrorCode code) noexcept
Convert ErrorCode to string representation.
Definition types.hpp:800
std::function< void(const IndicationMessage &)> IndicationHandler
Definition e3_agent.hpp:41
What a Service Model answers to a control (see ServiceModel::respond_to_control).
Definition types.hpp:382
E3Agent implementation details.
Definition e3_agent.cpp:24
XAppControlHandler xapp_control_handler
Called with each xApp control action.
Definition e3_agent.cpp:35
Impl(E3Config cfg)
Keep the configuration.
Definition e3_agent.cpp:44
MessageAckHandler message_ack_handler
Called with each message ack (DEPRECATED TO BE REMOVED).
Definition e3_agent.cpp:36
IndicationHandler indication_handler
Called with each indication.
Definition e3_agent.cpp:34
SubscriptionResponseHandler subscription_response_handler
Called with each subscription response.
Definition e3_agent.cpp:33
SetupResponseHandler setup_response_handler
Called with each setup response.
Definition e3_agent.cpp:32
DAppReportHandler dapp_report_handler
Called with each dApp report (RAN role).
Definition e3_agent.cpp:27
E3Config config
The configuration the agent was created with.
Definition e3_agent.cpp:25
DisconnectHandler disconnect_handler
Called when the session with the RAN ends.
Definition e3_agent.cpp:38
DAppStatusChangedHandler dapp_status_changed_handler
Called when a dApp's status changes (RAN role).
Definition e3_agent.cpp:28
std::unique_ptr< E3Interface > interface
The protocol engine.
Definition e3_agent.cpp:26
ControlResponseHandler control_response_handler
Called with each control response.
Definition e3_agent.cpp:37
Configuration for E3Agent.
Definition types.hpp:506
E3AP Indication Message structure.
Definition types.hpp:323
uint32_t ran_function_identifier
RAN function identifier.
Definition types.hpp:325
std::vector< uint8_t > protocol_data
Opaque payload of the service model.
Definition types.hpp:326
uint32_t dapp_identifier
dApp the indication is for
Definition types.hpp:324
E3AP Message Acknowledgment structure.
Definition types.hpp:351
ResponseCode response_code
Response code (positive/negative).
Definition types.hpp:353
uint32_t request_id
ID of the request being acknowledged.
Definition types.hpp:352
Generic E3AP PDU structure.
Definition types.hpp:448
uint64_t enqueue_seq
Set by queue_outbound; keys the [latrec] L-stage records.
Definition types.hpp:452
PduChoice choice
The message itself.
Definition types.hpp:450
uint32_t message_id
Unique message identifier.
Definition types.hpp:451
E3AP xApp Control Action structure.
Definition types.hpp:405
std::vector< uint8_t > xapp_control_data
Definition types.hpp:408
uint32_t dapp_identifier
dApp the control is for
Definition types.hpp:406
uint32_t ran_function_identifier
RAN function the control is for.
Definition types.hpp:407