libe3 0.2.5
C++ library for E3AP RAN vendor integration
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1/**
2 * @file types.hpp
3 * @brief E3AP Protocol Types - Vendor-neutral type definitions
4 *
5 * This header defines all E3AP protocol types and structures used throughout
6 * the libe3 library. These types are designed to be RAN-agnostic and can be
7 * used by any RAN vendor integrating with the E3AP protocol.
8 *
9 * SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
10 * SPDX-License-Identifier: Apache-2.0
11 */
12
13#ifndef LIBE3_TYPES_HPP
14#define LIBE3_TYPES_HPP
15
16#include <cstdint>
17#include <cstddef>
18#include <string>
19#include <vector>
20#include <variant>
21#include <optional>
22#include <chrono>
23#include <memory>
24
25#include "libe3/error_codes.h"
26
27namespace libe3 {
28
29/**
30 * @brief Current realtime clock reading, in nanoseconds since the Unix epoch.
31 *
32 * This is the clock behind every producer-side timestamp libE3 puts on the
33 * wire, chosen so the value stays comparable across hosts (bounded by whatever
34 * NTP or PTP discipline is in place) rather than being meaningful only within
35 * one process.
36 *
37 * @warning This is @c CLOCK_REALTIME, not a monotonic clock. It can step
38 * backwards or jump when the system clock is adjusted, and it must
39 * never be subtracted from a monotonic reading to derive a duration.
40 */
41inline uint64_t now_realtime_ns() noexcept {
42 return static_cast<uint64_t>(
43 std::chrono::duration_cast<std::chrono::nanoseconds>(
44 std::chrono::system_clock::now().time_since_epoch()
45 ).count());
46}
47
48/**
49 * @brief E3AP encoding formats supported by the library
50 */
51enum class EncodingFormat : uint8_t {
52 ASN1 = 0, ///< ASN.1 PER encoding (standard O-RAN format)
53 JSON = 1, ///< JSON encoding (for development/debugging)
54 PROTOBUF = 2 ///< Protocol Buffers encoding
55};
56
57/**
58 * @brief Link layer types (matches Python E3LinkLayer)
59 */
60enum class E3LinkLayer : uint8_t {
61 ZMQ = 0, ///< ZeroMQ-based transport
62 POSIX = 1 ///< POSIX socket-based transport
63};
64
65/**
66 * @brief Role this E3 endpoint plays in the protocol.
67 *
68 * RAN is the existing behaviour: the agent binds the setup/inbound/outbound
69 * sockets and answers dApp requests. DAPP is the symmetric client side: the
70 * agent connects to those endpoints and drives setup/subscribe/release.
71 *
72 * Default is RAN so that any caller compiled against earlier libe3 headers
73 * keeps today's behaviour.
74 */
75enum class E3Role : uint8_t {
76 RAN = 0, ///< RAN function (binds sockets; today's only behaviour)
77 DAPP = 1 ///< dApp (connects to a RAN agent)
78};
79
80/**
81 * @brief Transport layer types (matches Python E3TransportLayer)
82 */
83enum class E3TransportLayer : uint8_t {
84 SCTP = 0, ///< SCTP (O-RAN standard)
85 TCP = 1, ///< TCP
86 IPC = 2 ///< Unix Domain Sockets / IPC
87};
88
89/**
90 * @brief E3AP action types for Setup and Subscription requests
91 */
92enum class ActionType : uint8_t {
93 INSERT = 0, ///< Insert/create new entry
94 UPDATE = 1, ///< Update existing entry
95 DELETE = 2 ///< Delete existing entry
96};
97
98/**
99 * @brief E3AP response codes
100 */
101enum class ResponseCode : uint8_t {
102 POSITIVE = 0, ///< Request accepted
103 NEGATIVE = 1 ///< Request rejected
104};
105
106/**
107 * @brief E3AP PDU types
108 */
122
123/**
124 * @brief Agent state machine states
125 */
126enum class AgentState : uint8_t {
127 UNINITIALIZED = 0, ///< Agent not yet initialized
128 INITIALIZED = 1, ///< Agent initialized but not connected
129 CONNECTING = 2, ///< Connection in progress
130 CONNECTED = 3, ///< Connected and ready for operations
131 RUNNING = 4, ///< Main processing loop active
132 STOPPING = 5, ///< Shutdown in progress
133 STOPPED = 6, ///< Agent fully stopped
134 ERROR = 7 ///< Error state
135};
136
137/**
138 * @brief Error codes returned by libe3 operations
139 * Use shared error-code list (see libe3/error_codes.h)
140 */
141enum class ErrorCode : int {
142#define X(name, val) name = val,
144#undef X
145};
146
147/**
148 * @brief Convert ErrorCode to string name (C++ wrapper)
149 */
150inline const char* ErrorCodeToString(ErrorCode code) {
151 switch (static_cast<int>(code)) {
152#define X(name, val) case val: return #name;
154#undef X
155 default: return "UNKNOWN_ERROR_CODE";
156 }
157}
158
159// Maximum sizes for E3AP data fields (aligned with original C implementation)
160constexpr size_t MAX_PROTOCOL_DATA_SIZE = 32768;
161constexpr size_t MAX_ACTION_DATA_SIZE = 32768;
162constexpr size_t MAX_DAPP_REPORT_DATA_SIZE = 32768;
163constexpr size_t MAX_XAPP_CTRL_DATA_SIZE = 32768;
164constexpr size_t MAX_RAN_FUNCTIONS = 255;
165constexpr size_t DEFAULT_BUFFER_SIZE = 60000;
166
167// Protocol version
168constexpr uint32_t LIBE3_PROTOCOL_VERSION = 1;
169
170/**
171 * @brief Encoded message wrapper
172 *
173 * Unified wrapper for encoded data regardless of format used.
174 */
176 std::vector<uint8_t> buffer; ///< Encoded data buffer
177 EncodingFormat format; ///< Format used for encoding
178
179 EncodedMessage() = default;
180 EncodedMessage(std::vector<uint8_t> buf, EncodingFormat fmt)
181 : buffer(std::move(buf)), format(fmt) {}
182
183 size_t size() const noexcept { return buffer.size(); }
184 bool empty() const noexcept { return buffer.empty(); }
185 const uint8_t* data() const noexcept { return buffer.data(); }
186 uint8_t* data() noexcept { return buffer.data(); }
187};
188
189/**
190 * @brief RAN Function definition (SM identification)
191 */
193 uint32_t ran_function_id{0}; ///< Unique identifier for this RAN function
194 std::string sm_name; ///< Human-readable Service Model name
195 std::string sm_version; ///< Service Model version string (e.g. "1.0.0")
196};
197
198/**
199 * @brief E3AP Setup Request structure
200 */
202 std::string e3ap_protocol_version; ///< E3AP protocol version (e.g., "0.0.0")
203 std::string dapp_name; ///< Name of the dApp
204 std::string dapp_version; ///< Version of the dApp (e.g., "0.0.0")
205 std::string vendor; ///< Vendor name (max 30 chars)
206};
207
208/**
209 * @brief RAN Function Definition for Setup Response
210 */
213 std::vector<uint32_t> telemetry_identifier_list; ///< List of telemetry identifiers
214 std::vector<uint32_t> control_identifier_list; ///< List of control identifiers
215 std::vector<uint8_t> ran_function_data;
216};
217
218/**
219 * @brief E3AP Setup Response structure
220 */
222 uint32_t request_id{0}; ///< ID of the corresponding SetupRequest
223 ResponseCode response_code{ResponseCode::NEGATIVE}; ///< Response code (positive/negative)
224 std::optional<std::string> e3ap_protocol_version; ///< E3AP protocol version (optional)
225 std::optional<uint32_t> dapp_identifier; ///< Assigned dApp identifier (optional)
226 std::string ran_identifier; ///< RAN identifier (mandatory)
227 std::vector<RanFunctionDef> ran_function_list; ///< List of available RAN functions (optional)
228};
229
230/**
231 * @brief E3AP Subscription Request structure
232 */
234 uint32_t dapp_identifier{0}; ///< dApp identifier
235 uint32_t ran_function_identifier{0}; ///< RAN function to subscribe to
236 std::vector<uint32_t> telemetry_identifier_list; ///< List of telemetry identifiers
237 std::vector<uint32_t> control_identifier_list; ///< List of control identifiers
238 std::optional<uint32_t> subscription_time; ///< How long to keep the subscription (0-3600 sec)
239 std::optional<uint32_t> periodicity; ///< Periodicity of data delivery (0-10000 microseconds)
240};
241
242/**
243 * @brief E3AP Subscription Delete structure
244 */
246 uint32_t dapp_identifier{0}; ///< dApp identifier
247 uint32_t subscription_id{0}; ///< Subscription ID to delete
248};
249
250/**
251 * @brief E3AP Subscription Response structure
252 */
254 uint32_t request_id{0}; ///< ID of the corresponding SubscriptionRequest
255 uint32_t dapp_identifier{0}; ///< dApp identifier
256 ResponseCode response_code{ResponseCode::NEGATIVE}; ///< Response code (positive/negative)
257 std::optional<uint32_t> subscription_id; ///< Subscription ID (optional)
258};
259
260/**
261 * @brief E3AP Indication Message structure
262 */
264 uint32_t dapp_identifier{0};
265 uint32_t ran_function_identifier{0}; ///< RAN function identifier
266 std::vector<uint8_t> protocol_data;
267};
268
269/**
270 * @brief E3AP dApp Control Action structure
271 */
273 uint32_t dapp_identifier{0};
275 uint32_t control_identifier{0}; ///< Control identifier
276 std::vector<uint8_t> action_data;
277 /// Correlation id of the xApp procedure this control re-issues; 0 when the
278 /// dApp decided on its own. Optional on the wire, absent when 0.
279 uint32_t sequence_id{0};
280};
281
282/**
283 * @brief E3AP Message Acknowledgment structure
284 */
286 uint32_t request_id{0}; ///< ID of the request being acknowledged
287 ResponseCode response_code{ResponseCode::NEGATIVE}; ///< Response code (positive/negative)
288};
289
290/**
291 * @brief E3AP dApp Report structure
292 */
294 uint32_t dapp_identifier{0};
296 std::vector<uint8_t> report_data;
297 /// Correlation id assigned by the dApp; the head of the loop's chain.
298 /// Mandatory on the wire.
299 uint32_t sequence_id{0};
300 uint64_t recv_seq{0}; ///< Set by the inbound loop; keys the [latrec] L-stage records
301};
302
303/**
304 * @brief E3AP xApp Control Action structure
305 */
307 uint32_t dapp_identifier{0};
309 std::vector<uint8_t> xapp_control_data;
310 /// Correlation id copied by the RAN bridge from the E2SM-DAPP control
311 /// header's sequence-id. Mandatory on the wire.
312 uint32_t sequence_id{0};
313 // Set by the inbound loop from the wrapping E3-PDU's id field; not
314 // serialized, so it carries no ASN.1/JSON/Protobuf grammar of its own.
315 uint32_t message_id{0};
316};
317
318/**
319 * @brief E3AP Release Message structure
320 */
322 uint32_t dapp_identifier{0}; ///< dApp identifier
323};
324
325/**
326 * @brief Generic E3AP PDU using std::variant for type-safe union
327 */
328using PduChoice = std::variant<
340>;
341
342/**
343 * @brief Generic E3AP PDU structure
344 */
345struct Pdu {
348 uint32_t message_id{0}; ///< Unique message identifier
349 uint64_t enqueue_seq{0}; ///< Set by queue_outbound; keys the [latrec] L-stage records
350
351 /**
352 * @brief Producer timestamp, in nanoseconds since the Unix epoch.
353 *
354 * Stamped from the realtime clock (see @ref now_realtime_ns) when the PDU
355 * is constructed, so a caller gets one for free. Zero means "no producer
356 * reference": every encoding transmits it as an absent field and decodes
357 * an absent field back to zero, so the clock read is opt-out and a PDU
358 * without a timestamp is a normal message rather than a malformed one.
359 *
360 * @warning Realtime, not monotonic. Never subtract it from a monotonic
361 * reading.
362 */
363 uint64_t timestamp{0};
364
366
367 explicit Pdu(PduType t) : type(t), timestamp(now_realtime_ns()) {}
368
369 template<typename T>
370 Pdu(PduType t, T&& data)
371 : type(t), choice(std::forward<T>(data)), timestamp(now_realtime_ns()) {}
372
373 /**
374 * @brief Get PDU data with type checking
375 */
376 template<typename T>
377 T* get_if() noexcept {
378 return std::get_if<T>(&choice);
379 }
380
381 template<typename T>
382 const T* get_if() const noexcept {
383 return std::get_if<T>(&choice);
384 }
385};
386
387/**
388 * @brief Configuration for E3Agent
389 */
390struct E3Config {
391 // Role: RAN (today's default — binds sockets) or DAPP (connects).
393
394 // RAN identification (used when role==RAN to advertise this RAN's id)
395 std::string ran_identifier; ///< Unique identifier for this RAN function (e.g. "DU-1")
396
397 // dApp identification (used when role==DAPP to send in SetupRequest)
398 std::string dapp_name{"libe3-dapp"}; ///< dApp name advertised in SetupRequest
399 std::string dapp_version{"0.0.0"}; ///< dApp version advertised in SetupRequest
400 std::string vendor; ///< Vendor name for SetupRequest (optional)
401
402 std::string e3ap_version{"1.0.0"}; ///< E3AP protocol version advertised during setup
403
404 // Transport configuration
405#if defined(LIBE3_HAS_ZMQ) && !LIBE3_HAS_ZMQ
406 // A build without ZeroMQ has no ZMQ connector to create, so defaulting to
407 // it would make every default-constructed config fail to initialise. The
408 // POSIX connector accepts the same ZMQ-style endpoint URIs (it strips the
409 // scheme), so the endpoint defaults below need no counterpart.
410 E3LinkLayer link_layer{E3LinkLayer::POSIX}; ///< Link-layer transport (ZMQ or POSIX)
411#else
412 E3LinkLayer link_layer{E3LinkLayer::ZMQ}; ///< Link-layer transport (ZMQ or POSIX)
413#endif
414 E3TransportLayer transport_layer{E3TransportLayer::IPC}; ///< Transport-layer protocol (SCTP, TCP, IPC)
415
416 // Ports
417 uint16_t setup_port{9990}; ///< Port used for E3AP setup channel
418 uint16_t subscriber_port{9999}; ///< Port used for inbound control/subscription channel
419 uint16_t publisher_port{9991}; ///< Port used for outbound indication/publication channel
420
421 // Endpoints
422 std::string setup_endpoint{"ipc:///tmp/dapps/setup"}; ///< Endpoint URI for setup channel
423 std::string subscriber_endpoint{"ipc:///tmp/dapps/dapp_socket"}; ///< Endpoint URI for inbound channel
424 std::string publisher_endpoint{"ipc:///tmp/dapps/e3_socket"}; ///< Endpoint URI for outbound channel
425
426 // Encoding format
427#if defined(LIBE3_ENABLE_ASN1)
428 EncodingFormat encoding{EncodingFormat::ASN1}; ///< PDU encoding format (ASN.1 PER or JSON)
429#elif defined(LIBE3_ENABLE_JSON)
430 EncodingFormat encoding{EncodingFormat::JSON}; ///< PDU encoding format (ASN.1 PER or JSON)
431#else // Fallback
432 EncodingFormat encoding{EncodingFormat::ASN1}; ///< PDU encoding format (ASN.1 PER or JSON)
433#endif
434
435 // Timeouts (milliseconds)
436 uint32_t connect_timeout_ms{5000}; ///< Connection establishment timeout in milliseconds
437 uint32_t recv_timeout_ms{1000}; ///< Receive operation timeout in milliseconds
438 uint32_t send_timeout_ms{1000}; ///< Send operation timeout in milliseconds
439
440 // Buffer sizes
441 size_t receive_buffer_size{DEFAULT_BUFFER_SIZE}; ///< Size of the receive buffer in bytes
442 size_t send_buffer_size{DEFAULT_BUFFER_SIZE}; ///< Size of the send buffer in bytes
443
444 // Threading
445 size_t io_threads{2}; ///< Number of I/O threads (used by ZMQ context)
446
447 /**
448 * @brief CPU core to pin the subscriber and publisher I/O threads to.
449 *
450 * When set to a non-negative value the subscriber_loop and publisher_loop
451 * threads will be pinned to this logical CPU core via
452 * pthread_setaffinity_np (Linux only; ignored on other platforms).
453 * This eliminates cache-migration overhead and reduces scheduling jitter
454 * in sub-millisecond control loops.
455 *
456 * -1 (default) disables core pinning.
457 */
459
460 /**
461 * @brief Nice value applied to the subscriber and publisher I/O threads.
462 *
463 * Range -20 (highest priority) to 19 (lowest priority), 0 = system
464 * default. A negative value reduces OS scheduling latency at the cost of
465 * slightly less CPU time for other processes. Requires appropriate
466 * privileges for negative values (CAP_SYS_NICE on Linux).
467 *
468 * Applied via setpriority(PRIO_PROCESS, tid, value) on Linux.
469 */
471
472 // Logging level (0=none, 1=error, 2=warn, 3=info, 4=debug, 5=trace)
473 int log_level{3}; ///< Logging verbosity: 0=none, 1=error, 2=warn, 3=info, 4=debug, 5=trace
474
475 /**
476 * @brief Path of the shared log file. Empty (default) => auto-generated.
477 *
478 * When left empty the library derives a per-process path of the form
479 * `/tmp/e3_<role>[_<sanitized-id>]_<euid>.log` (see E3Interface ctor).
480 * The trailing effective-uid keeps the file owned by whoever opens it,
481 * which avoids `fs.protected_regular` blocking an O_CREAT re-open of a
482 * /tmp file owned by a different user (e.g. a root gNB vs. a prior
483 * non-sudo run). Set this explicitly to override the location entirely.
484 */
485 std::string log_path;
486};
487
488/**
489 * @brief Timestamp type using steady_clock for monotonic time
490 */
491using Timestamp = std::chrono::time_point<std::chrono::steady_clock>;
492
493/**
494 * @brief dApp registration entry
495 */
496struct DAppEntry {
497 uint32_t dapp_identifier{0}; ///< Assigned dApp identifier (1–100)
498 Timestamp registered_time; ///< Monotonic timestamp of when the dApp registered
499};
500
501/**
502 * @brief Subscription entry representing dApp-RAN function association
503 */
505 uint32_t dapp_identifier{0}; ///< Identifier of the subscribed dApp
506 uint32_t ran_function_id{0}; ///< RAN function the dApp is subscribed to
507 Timestamp created_time; ///< Monotonic timestamp of when the subscription was created
508};
509
510// Utility functions for type conversions
511
512/**
513 * @brief Convert PduType to string representation
514 */
515inline const char* pdu_type_to_string(PduType type) noexcept {
516 switch (type) {
517 case PduType::SETUP_REQUEST: return "SetupRequest";
518 case PduType::SETUP_RESPONSE: return "SetupResponse";
519 case PduType::SUBSCRIPTION_REQUEST: return "SubscriptionRequest";
520 case PduType::SUBSCRIPTION_DELETE: return "SubscriptionDelete";
521 case PduType::SUBSCRIPTION_RESPONSE: return "SubscriptionResponse";
522 case PduType::INDICATION_MESSAGE: return "IndicationMessage";
523 case PduType::DAPP_CONTROL_ACTION: return "DAppControlAction";
524 case PduType::DAPP_REPORT: return "DAppReport";
525 case PduType::XAPP_CONTROL_ACTION: return "XAppControlAction";
526 case PduType::RELEASE_MESSAGE: return "ReleaseMessage";
527 case PduType::MESSAGE_ACK: return "MessageAck";
528 default: return "unknown";
529 }
530}
531
532/**
533 * @brief Convert ActionType to string representation
534 */
535inline const char* action_type_to_string(ActionType type) noexcept {
536 switch (type) {
537 case ActionType::INSERT: return "insert";
538 case ActionType::UPDATE: return "update";
539 case ActionType::DELETE: return "delete";
540 default: return "unknown";
541 }
542}
543
544/**
545 * @brief Convert ResponseCode to string representation
546 */
547inline const char* response_code_to_string(ResponseCode code) noexcept {
548 switch (code) {
549 case ResponseCode::POSITIVE: return "positive";
550 case ResponseCode::NEGATIVE: return "negative";
551 default: return "unknown";
552 }
553}
554
555/**
556 * @brief Convert ErrorCode to string representation
557 */
558inline const char* error_code_to_string(ErrorCode code) noexcept {
559 switch (code) {
560 case ErrorCode::SUCCESS: return "Success";
561 case ErrorCode::INVALID_PARAM: return "Invalid parameter";
562 case ErrorCode::NOT_INITIALIZED: return "Not initialized";
563 case ErrorCode::ALREADY_INITIALIZED: return "Already initialized";
564 case ErrorCode::NOT_CONNECTED: return "Not connected";
565 case ErrorCode::CONNECTION_FAILED: return "Connection failed";
566 case ErrorCode::TIMEOUT: return "Timeout";
567 case ErrorCode::ENCODE_FAILED: return "Encode failed";
568 case ErrorCode::DECODE_FAILED: return "Decode failed";
569 case ErrorCode::SM_NOT_FOUND: return "Service Model not found";
570 case ErrorCode::SM_ALREADY_REGISTERED: return "Service Model already registered";
571 case ErrorCode::BUFFER_TOO_SMALL: return "Buffer too small";
572 case ErrorCode::INTERNAL_ERROR: return "Internal error";
573 case ErrorCode::SUBSCRIPTION_EXISTS: return "Subscription already exists";
574 case ErrorCode::SUBSCRIPTION_NOT_FOUND: return "Subscription not found";
575 case ErrorCode::DAPP_NOT_REGISTERED: return "dApp not registered";
576 case ErrorCode::TRANSPORT_ERROR: return "Transport error";
577 case ErrorCode::STATE_ERROR: return "State error";
578 case ErrorCode::SM_START_FAILED: return "Service Model start failed";
579 case ErrorCode::NOT_FOUND: return "Not found";
580 case ErrorCode::CANCELLED: return "Operation cancelled";
581 default: return "Unknown error";
582 }
583}
584
585/**
586 * @brief Convert AgentState to string representation
587 */
588inline const char* agent_state_to_string(AgentState state) noexcept {
589 switch (state) {
590 case AgentState::UNINITIALIZED: return "Uninitialized";
591 case AgentState::INITIALIZED: return "Initialized";
592 case AgentState::CONNECTING: return "Connecting";
593 case AgentState::CONNECTED: return "Connected";
594 case AgentState::RUNNING: return "Running";
595 case AgentState::STOPPING: return "Stopping";
596 case AgentState::STOPPED: return "Stopped";
597 case AgentState::ERROR: return "Error";
598 default: return "Unknown";
599 }
600}
601
602/**
603 * @brief Convert E3Role to string representation
604 */
605inline const char* role_to_string(E3Role role) noexcept {
606 switch (role) {
607 case E3Role::RAN: return "ran";
608 case E3Role::DAPP: return "dapp";
609 default: return "unknown";
610 }
611}
612
613/**
614 * @brief Convert E3LinkLayer to string representation
615 */
616inline const char* link_layer_to_string(E3LinkLayer layer) noexcept {
617 switch (layer) {
618 case E3LinkLayer::ZMQ: return "zmq";
619 case E3LinkLayer::POSIX: return "posix";
620 default: return "unknown";
621 }
622}
623
624/**
625 * @brief Convert E3TransportLayer to string representation
626 */
627inline const char* transport_layer_to_string(E3TransportLayer layer) noexcept {
628 switch (layer) {
629 case E3TransportLayer::SCTP: return "sctp";
630 case E3TransportLayer::TCP: return "tcp";
631 case E3TransportLayer::IPC: return "ipc";
632 default: return "unknown";
633 }
634}
635
636} // namespace libe3
637
638#endif // LIBE3_TYPES_HPP
libe3 error codes - shared C/C++ definitions
#define LIBE3_ERROR_CODE_LIST
X-macro list of all libe3 error codes.
Definition error_codes.h:67
constexpr size_t MAX_XAPP_CTRL_DATA_SIZE
Definition types.hpp:163
ErrorCode
Error codes returned by libe3 operations Use shared error-code list (see libe3/error_codes....
Definition types.hpp:141
std::variant< SetupRequest, SetupResponse, SubscriptionRequest, SubscriptionDelete, SubscriptionResponse, IndicationMessage, DAppControlAction, DAppReport, XAppControlAction, ReleaseMessage, MessageAck > PduChoice
Generic E3AP PDU using std::variant for type-safe union.
Definition types.hpp:328
const char * ErrorCodeToString(ErrorCode code)
Convert ErrorCode to string name (C++ wrapper).
Definition types.hpp:150
constexpr size_t MAX_DAPP_REPORT_DATA_SIZE
Definition types.hpp:162
E3TransportLayer
Transport layer types (matches Python E3TransportLayer).
Definition types.hpp:83
@ SCTP
SCTP (O-RAN standard).
Definition types.hpp:84
@ IPC
Unix Domain Sockets / IPC.
Definition types.hpp:86
AgentState
Agent state machine states.
Definition types.hpp:126
@ STOPPED
Agent fully stopped.
Definition types.hpp:133
@ RUNNING
Main processing loop active.
Definition types.hpp:131
@ CONNECTING
Connection in progress.
Definition types.hpp:129
@ CONNECTED
Connected and ready for operations.
Definition types.hpp:130
@ ERROR
Error state.
Definition types.hpp:134
@ UNINITIALIZED
Agent not yet initialized.
Definition types.hpp:127
@ INITIALIZED
Agent initialized but not connected.
Definition types.hpp:128
@ STOPPING
Shutdown in progress.
Definition types.hpp:132
uint64_t now_realtime_ns() noexcept
Current realtime clock reading, in nanoseconds since the Unix epoch.
Definition types.hpp:41
E3Role
Role this E3 endpoint plays in the protocol.
Definition types.hpp:75
@ RAN
RAN function (binds sockets; today's only behaviour).
Definition types.hpp:76
@ DAPP
dApp (connects to a RAN agent)
Definition types.hpp:77
ResponseCode
E3AP response codes.
Definition types.hpp:101
@ NEGATIVE
Request rejected.
Definition types.hpp:103
@ POSITIVE
Request accepted.
Definition types.hpp:102
constexpr size_t MAX_PROTOCOL_DATA_SIZE
Definition types.hpp:160
const char * pdu_type_to_string(PduType type) noexcept
Convert PduType to string representation.
Definition types.hpp:515
PduType
E3AP PDU types.
Definition types.hpp:109
@ SUBSCRIPTION_DELETE
Definition types.hpp:113
@ SUBSCRIPTION_RESPONSE
Definition types.hpp:114
@ SUBSCRIPTION_REQUEST
Definition types.hpp:112
@ XAPP_CONTROL_ACTION
Definition types.hpp:118
@ DAPP_CONTROL_ACTION
Definition types.hpp:116
E3LinkLayer
Link layer types (matches Python E3LinkLayer).
Definition types.hpp:60
@ POSIX
POSIX socket-based transport.
Definition types.hpp:62
@ ZMQ
ZeroMQ-based transport.
Definition types.hpp:61
std::chrono::time_point< std::chrono::steady_clock > Timestamp
Timestamp type using steady_clock for monotonic time.
Definition types.hpp:491
const char * action_type_to_string(ActionType type) noexcept
Convert ActionType to string representation.
Definition types.hpp:535
const char * agent_state_to_string(AgentState state) noexcept
Convert AgentState to string representation.
Definition types.hpp:588
EncodingFormat
E3AP encoding formats supported by the library.
Definition types.hpp:51
@ JSON
JSON encoding (for development/debugging).
Definition types.hpp:53
@ ASN1
ASN.1 PER encoding (standard O-RAN format).
Definition types.hpp:52
@ PROTOBUF
Protocol Buffers encoding.
Definition types.hpp:54
const char * role_to_string(E3Role role) noexcept
Convert E3Role to string representation.
Definition types.hpp:605
constexpr size_t DEFAULT_BUFFER_SIZE
Definition types.hpp:165
const char * response_code_to_string(ResponseCode code) noexcept
Convert ResponseCode to string representation.
Definition types.hpp:547
const char * transport_layer_to_string(E3TransportLayer layer) noexcept
Convert E3TransportLayer to string representation.
Definition types.hpp:627
const char * link_layer_to_string(E3LinkLayer layer) noexcept
Convert E3LinkLayer to string representation.
Definition types.hpp:616
constexpr size_t MAX_RAN_FUNCTIONS
Definition types.hpp:164
ActionType
E3AP action types for Setup and Subscription requests.
Definition types.hpp:92
@ UPDATE
Update existing entry.
Definition types.hpp:94
@ DELETE
Delete existing entry.
Definition types.hpp:95
@ INSERT
Insert/create new entry.
Definition types.hpp:93
constexpr uint32_t LIBE3_PROTOCOL_VERSION
Definition types.hpp:168
constexpr size_t MAX_ACTION_DATA_SIZE
Definition types.hpp:161
const char * error_code_to_string(ErrorCode code) noexcept
Convert ErrorCode to string representation.
Definition types.hpp:558
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
dApp registration entry
Definition types.hpp:496
Timestamp registered_time
Monotonic timestamp of when the dApp registered.
Definition types.hpp:498
uint32_t dapp_identifier
Assigned dApp identifier (1–100).
Definition types.hpp:497
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
uint64_t recv_seq
Set by the inbound loop; keys the [latrec] L-stage records.
Definition types.hpp:300
Configuration for E3Agent.
Definition types.hpp:390
std::string dapp_version
dApp version advertised in SetupRequest
Definition types.hpp:399
std::string e3ap_version
E3AP protocol version advertised during setup.
Definition types.hpp:402
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
uint32_t send_timeout_ms
Send operation timeout in milliseconds.
Definition types.hpp:438
int io_thread_affinity
CPU core to pin the subscriber and publisher I/O threads to.
Definition types.hpp:458
int io_thread_niceness
Nice value applied to the subscriber and publisher I/O threads.
Definition types.hpp:470
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
uint32_t connect_timeout_ms
Connection establishment timeout in milliseconds.
Definition types.hpp:436
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 dapp_name
dApp name advertised in SetupRequest
Definition types.hpp:398
uint32_t recv_timeout_ms
Receive operation timeout in milliseconds.
Definition types.hpp:437
std::string ran_identifier
Unique identifier for this RAN function (e.g. "DU-1").
Definition types.hpp:395
size_t send_buffer_size
Size of the send buffer in bytes.
Definition types.hpp:442
E3TransportLayer transport_layer
Transport-layer protocol (SCTP, TCP, IPC).
Definition types.hpp:414
size_t receive_buffer_size
Size of the receive buffer in bytes.
Definition types.hpp:441
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
std::string vendor
Vendor name for SetupRequest (optional).
Definition types.hpp:400
std::vector< uint8_t > buffer
Encoded data buffer.
Definition types.hpp:176
bool empty() const noexcept
Definition types.hpp:184
const uint8_t * data() const noexcept
Definition types.hpp:185
EncodedMessage(std::vector< uint8_t > buf, EncodingFormat fmt)
Definition types.hpp:180
EncodingFormat format
Format used for encoding.
Definition types.hpp:177
size_t size() const noexcept
Definition types.hpp:183
uint8_t * data() noexcept
Definition types.hpp:186
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
uint64_t enqueue_seq
Set by queue_outbound; keys the [latrec] L-stage records.
Definition types.hpp:349
PduType type
Definition types.hpp:346
T * get_if() noexcept
Get PDU data with type checking.
Definition types.hpp:377
Pdu(PduType t, T &&data)
Definition types.hpp:370
PduChoice choice
Definition types.hpp:347
uint64_t timestamp
Producer timestamp, in nanoseconds since the Unix epoch.
Definition types.hpp:363
Pdu(PduType t)
Definition types.hpp:367
uint32_t message_id
Unique message identifier.
Definition types.hpp:348
const T * get_if() const noexcept
Definition types.hpp:382
RAN Function Definition for Setup Response.
Definition types.hpp:211
uint32_t ran_function_identifier
Definition types.hpp:212
std::vector< uint32_t > telemetry_identifier_list
List of telemetry identifiers.
Definition types.hpp:213
std::vector< uint32_t > control_identifier_list
List of control identifiers.
Definition types.hpp:214
std::vector< uint8_t > ran_function_data
Definition types.hpp:215
RAN Function definition (SM identification).
Definition types.hpp:192
uint32_t ran_function_id
Unique identifier for this RAN function.
Definition types.hpp:193
std::string sm_version
Service Model version string (e.g. "1.0.0").
Definition types.hpp:195
std::string sm_name
Human-readable Service Model name.
Definition types.hpp:194
E3AP Release Message structure.
Definition types.hpp:321
uint32_t dapp_identifier
dApp identifier
Definition types.hpp:322
E3AP Setup Request structure.
Definition types.hpp:201
std::string vendor
Vendor name (max 30 chars).
Definition types.hpp:205
std::string dapp_version
Version of the dApp (e.g., "0.0.0").
Definition types.hpp:204
std::string e3ap_protocol_version
E3AP protocol version (e.g., "0.0.0").
Definition types.hpp:202
std::string dapp_name
Name of the dApp.
Definition types.hpp:203
E3AP Setup Response structure.
Definition types.hpp:221
std::string ran_identifier
RAN identifier (mandatory).
Definition types.hpp:226
uint32_t request_id
ID of the corresponding SetupRequest.
Definition types.hpp:222
std::optional< uint32_t > dapp_identifier
Assigned dApp identifier (optional).
Definition types.hpp:225
std::vector< RanFunctionDef > ran_function_list
List of available RAN functions (optional).
Definition types.hpp:227
ResponseCode response_code
Response code (positive/negative).
Definition types.hpp:223
std::optional< std::string > e3ap_protocol_version
E3AP protocol version (optional).
Definition types.hpp:224
E3AP Subscription Delete structure.
Definition types.hpp:245
uint32_t dapp_identifier
dApp identifier
Definition types.hpp:246
uint32_t subscription_id
Subscription ID to delete.
Definition types.hpp:247
Subscription entry representing dApp-RAN function association.
Definition types.hpp:504
Timestamp created_time
Monotonic timestamp of when the subscription was created.
Definition types.hpp:507
uint32_t dapp_identifier
Identifier of the subscribed dApp.
Definition types.hpp:505
uint32_t ran_function_id
RAN function the dApp is subscribed to.
Definition types.hpp:506
E3AP Subscription Request structure.
Definition types.hpp:233
std::optional< uint32_t > periodicity
Periodicity of data delivery (0-10000 microseconds).
Definition types.hpp:239
std::optional< uint32_t > subscription_time
How long to keep the subscription (0-3600 sec).
Definition types.hpp:238
uint32_t ran_function_identifier
RAN function to subscribe to.
Definition types.hpp:235
std::vector< uint32_t > control_identifier_list
List of control identifiers.
Definition types.hpp:237
std::vector< uint32_t > telemetry_identifier_list
List of telemetry identifiers.
Definition types.hpp:236
uint32_t dapp_identifier
dApp identifier
Definition types.hpp:234
E3AP Subscription Response structure.
Definition types.hpp:253
std::optional< uint32_t > subscription_id
Subscription ID (optional).
Definition types.hpp:257
uint32_t request_id
ID of the corresponding SubscriptionRequest.
Definition types.hpp:254
uint32_t dapp_identifier
dApp identifier
Definition types.hpp:255
ResponseCode response_code
Response code (positive/negative).
Definition types.hpp:256
E3AP xApp Control Action structure.
Definition types.hpp:306
std::vector< uint8_t > xapp_control_data
Definition types.hpp:309
uint32_t ran_function_identifier
Definition types.hpp:308