libe3 0.6.1
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 *
41 * @return Nanoseconds since the Unix epoch, UTC
42 */
43inline uint64_t now_realtime_ns() noexcept {
44 return static_cast<uint64_t>(
45 std::chrono::duration_cast<std::chrono::nanoseconds>(
46 std::chrono::system_clock::now().time_since_epoch()
47 ).count());
48}
49
50/**
51 * @brief E3AP encoding formats supported by the library
52 */
53enum class EncodingFormat : uint8_t {
54 ASN1 = 0, ///< ASN.1 PER encoding (standard O-RAN format)
55 JSON = 1, ///< JSON encoding (for development/debugging)
56 PROTOBUF = 2 ///< Protocol Buffers encoding
57};
58
59/**
60 * @brief Link layer types (matches Python E3LinkLayer)
61 */
62enum class E3LinkLayer : uint8_t {
63 ZMQ = 0, ///< ZeroMQ-based transport
64 POSIX = 1 ///< POSIX socket-based transport
65};
66
67/**
68 * @brief Role this E3 endpoint plays in the protocol.
69 *
70 * RAN is the existing behaviour: the agent binds the setup/inbound/outbound
71 * sockets and answers dApp requests. DAPP is the symmetric client side: the
72 * agent connects to those endpoints and drives setup/subscribe/release.
73 *
74 * Default is RAN so that any caller compiled against earlier libe3 headers
75 * keeps today's behaviour.
76 */
77enum class E3Role : uint8_t {
78 RAN = 0, ///< RAN function (binds sockets; today's only behaviour)
79 DAPP = 1 ///< dApp (connects to a RAN agent)
80};
81
82/**
83 * @brief Transport layer types (matches Python E3TransportLayer)
84 */
85enum class E3TransportLayer : uint8_t {
86 SCTP = 0, ///< SCTP (O-RAN standard)
87 TCP = 1, ///< TCP
88 IPC = 2 ///< Unix Domain Sockets / IPC
89};
90
91/**
92 * @brief E3AP action types for Setup and Subscription requests
93 */
94enum class ActionType : uint8_t {
95 INSERT = 0, ///< Insert/create new entry
96 UPDATE = 1, ///< Update existing entry
97 DELETE = 2 ///< Delete existing entry
98};
99
100/**
101 * @brief E3AP response codes
102 */
103enum class ResponseCode : uint8_t {
104 POSITIVE = 0, ///< Request accepted
105 NEGATIVE = 1 ///< Request rejected
106};
107
108/**
109 * @brief Why a RAN refused a request (E3-Cause)
110 *
111 * Carried with a negative setup response, subscription response or message
112 * acknowledgment, next to a free-text `detail`. The names and values are the
113 * ones OCUDU's E3AP grammar uses; Aerial has no code and sends only text.
114 */
115enum class Cause : uint8_t {
116 UNSPECIFIED = 0, ///< No more specific cause applies
117 PROTOCOL_ERROR = 1, ///< The message was malformed or out of sequence
118 SETUP_REQUIRED = 2, ///< The dApp has not completed setup
119 SETUP_ALREADY_COMPLETE = 3, ///< A second setup on one association
120 UNSUPPORTED_PROTOCOL_VERSION = 4, ///< The E3AP version of the dApp is not served
121 UNSUPPORTED_RAN_FUNCTION = 5, ///< The RAN function is not served
122 UNSUPPORTED_IDENTIFIER = 6, ///< A telemetry or control identifier is not advertised by the RAN function
123 INVALID_REQUEST = 7, ///< The request is well formed but its content is not acceptable
124 NOT_FOUND = 8, ///< The subscription or procedure the request names does not exist
125 DUPLICATE = 9, ///< The request repeats one that is already active
126 RESOURCE_EXHAUSTED = 10, ///< The RAN has no room for the request
127 AUTHORIZATION_REJECTED = 11, ///< The dApp is not allowed to do this
128 PAYLOAD_TOO_LARGE = 12, ///< The payload is over the bound the RAN accepts
129 TRANSPORT_OVERRUN = 13, ///< The transport could not keep up
130 SHUTTING_DOWN = 14 ///< The RAN is stopping
131};
132
133/**
134 * @brief Why a dApp's session with the RAN ended (see DisconnectHandler)
135 */
136enum class DisconnectReason : uint8_t {
137 RELEASED_BY_RAN = 0, ///< The RAN sent a ReleaseMessage for this dApp
138 CONNECTION_LOST = 1 ///< The peer closed the connection or the link failed
139};
140
141/**
142 * @brief E3AP PDU types
143 */
144enum class PduType : uint8_t {
155 MESSAGE_ACK = 10, ///< DEPRECATED TO BE REMOVED: libe3 no longer sends it, see CONTROL_RESPONSE
157};
158
159/**
160 * @brief Agent state machine states
161 */
162enum class AgentState : uint8_t {
163 UNINITIALIZED = 0, ///< Agent not yet initialized
164 INITIALIZED = 1, ///< Agent initialized but not connected
165 CONNECTING = 2, ///< Connection in progress
166 CONNECTED = 3, ///< Connected and ready for operations
167 RUNNING = 4, ///< Main processing loop active
168 STOPPING = 5, ///< Shutdown in progress
169 STOPPED = 6, ///< Agent fully stopped
170 ERROR = 7 ///< Error state
171};
172
173/**
174 * @brief Error codes returned by libe3 operations
175 * Use shared error-code list (see libe3/error_codes.h)
176 */
177enum class ErrorCode : int {
178/// Expands one entry of the shared error-code list to an enumerator.
179#define X(name, val) name = val,
181#undef X
182};
183
184/**
185 * @brief Convert ErrorCode to string name (C++ wrapper)
186 * @param code Error code to name
187 * @return The enumerator's name, or "UNKNOWN_ERROR_CODE" for a value outside the list
188 */
189inline const char* ErrorCodeToString(ErrorCode code) {
190 switch (static_cast<int>(code)) {
191/// Expands one entry of the shared error-code list to a case label that returns its name.
192#define X(name, val) case val: return #name;
194#undef X
195 default: return "UNKNOWN_ERROR_CODE";
196 }
197}
198
199// Maximum sizes for E3AP data fields (aligned with original C implementation)
200constexpr size_t MAX_PROTOCOL_DATA_SIZE = 32768; ///< Largest `protocolData` of an indication, in bytes
201constexpr size_t MAX_ACTION_DATA_SIZE = 32768; ///< Largest `actionData` of a dApp control action, in bytes
202constexpr size_t MAX_DAPP_REPORT_DATA_SIZE = 32768; ///< Largest `reportData` of a dApp report, in bytes
203constexpr size_t MAX_XAPP_CTRL_DATA_SIZE = 32768; ///< Largest `xAppControlData` of an xApp control action, in bytes
204constexpr size_t MAX_PENDING_CONTROLS = 1024; ///< Most dApp controls a RAN holds an answer for at once
205constexpr size_t MAX_CONTROL_OUTCOME_SIZE = 32768; ///< Largest `controlOutcome` of a control response, in bytes
206constexpr size_t MAX_RAN_FUNCTIONS = 64; ///< ranFunctionList SIZE (0..64)
207constexpr size_t MAX_IDENTIFIER_LIST_SIZE = 256; ///< telemetry and control lists SIZE (0..256)
208constexpr size_t DEFAULT_BUFFER_SIZE = 60000; ///< Default encode and receive buffer size, in bytes
209constexpr size_t MAX_DETAIL_SIZE = 512; ///< Largest `detail` text of a negative response, in bytes (E3-Text)
210
211// Protocol version
212constexpr uint32_t LIBE3_PROTOCOL_VERSION = 1; ///< Protocol version this library speaks
213
214/**
215 * @brief Encoded message wrapper
216 *
217 * Unified wrapper for encoded data regardless of format used.
218 */
220 std::vector<uint8_t> buffer; ///< Encoded data buffer
221 EncodingFormat format; ///< Format used for encoding
222
223 /// Empty message with no format set.
224 EncodedMessage() = default;
225 /// Wrap an already encoded buffer.
226 /// @param buf Encoded bytes, moved in
227 /// @param fmt Format the bytes are in
228 EncodedMessage(std::vector<uint8_t> buf, EncodingFormat fmt)
229 : buffer(std::move(buf)), format(fmt) {}
230
231 /// @return Number of encoded bytes
232 size_t size() const noexcept { return buffer.size(); }
233 /// @return True when there are no encoded bytes
234 bool empty() const noexcept { return buffer.empty(); }
235 /// @return Read-only pointer to the first encoded byte
236 const uint8_t* data() const noexcept { return buffer.data(); }
237 /// @return Pointer to the first encoded byte
238 uint8_t* data() noexcept { return buffer.data(); }
239};
240
241/**
242 * @brief RAN Function definition (SM identification)
243 */
245 uint32_t ran_function_id{0}; ///< Unique identifier for this RAN function
246 std::string sm_name; ///< Human-readable Service Model name
247 std::string sm_version; ///< Service Model version string (e.g. "1.0.0")
248};
249
250/**
251 * @brief E3AP Setup Request structure
252 */
254 std::string e3ap_protocol_version; ///< E3AP protocol version (e.g., "0.0.0"); 1..32 bytes over ASN.1
255 std::string dapp_name; ///< Name of the dApp; 1..64 bytes over ASN.1
256 std::string dapp_version; ///< Version of the dApp (e.g., "0.0.0"); 1..32 bytes over ASN.1
257 std::string vendor; ///< Vendor name; 1..64 bytes over ASN.1
258};
259
260/**
261 * @brief RAN Function Definition for Setup Response
262 */
264 uint32_t ran_function_identifier{0}; ///< RAN function identifier
265 std::vector<uint32_t> telemetry_identifier_list; ///< List of telemetry identifiers
266 std::vector<uint32_t> control_identifier_list; ///< List of control identifiers
267 std::vector<uint8_t> ran_function_data; ///< Opaque description of the function, 1..262144 bytes over ASN.1
268};
269
270/**
271 * @brief E3AP Setup Response structure
272 */
274 uint32_t request_id{0}; ///< ID of the corresponding SetupRequest
275 ResponseCode response_code{ResponseCode::NEGATIVE}; ///< Response code (positive/negative)
276 std::optional<std::string> e3ap_protocol_version; ///< E3AP protocol version (optional)
277 std::optional<uint32_t> dapp_identifier; ///< Assigned dApp identifier (optional)
278 std::string ran_identifier; ///< RAN identifier (mandatory); 1..64 bytes over ASN.1
279 std::vector<RanFunctionDef> ran_function_list; ///< List of available RAN functions (optional)
280 std::optional<Cause> cause; ///< Why the setup was refused (negative only)
281 std::optional<std::string> detail; ///< UTF-8 text for the cause, up to MAX_DETAIL_SIZE bytes
282};
283
284/**
285 * @brief E3AP Subscription Request structure
286 */
288 uint32_t dapp_identifier{0}; ///< dApp identifier
289 uint32_t ran_function_identifier{0}; ///< RAN function to subscribe to
290 std::vector<uint32_t> telemetry_identifier_list; ///< List of telemetry identifiers
291 std::vector<uint32_t> control_identifier_list; ///< List of control identifiers
292 std::optional<uint32_t> subscription_time; ///< How long to keep the subscription (0-86400 sec)
293 std::optional<uint32_t> periodicity; ///< Microseconds between indications, 0 = every event (ASN.1: 0 to 60000000)
294};
295
296/**
297 * @brief E3AP Subscription Delete structure
298 */
300 uint32_t dapp_identifier{0}; ///< dApp identifier
301 uint32_t subscription_id{0}; ///< Subscription ID to delete
302};
303
304/**
305 * @brief E3AP Subscription Response structure
306 */
308 uint32_t request_id{0}; ///< ID of the corresponding SubscriptionRequest
309 uint32_t dapp_identifier{0}; ///< dApp identifier
310 ResponseCode response_code{ResponseCode::NEGATIVE}; ///< Response code (positive/negative)
311 std::optional<uint32_t> subscription_id; ///< Subscription ID (optional)
312 std::optional<std::vector<uint32_t>> telemetry_identifier_list; ///< Granted telemetry ids (absent = not reported, empty = none granted)
313 std::optional<std::vector<uint32_t>> control_identifier_list; ///< Granted control ids (absent = not reported, empty = none granted)
314 std::optional<uint32_t> ran_function_identifier; ///< RAN function the grant is for
315 std::optional<uint32_t> periodicity; ///< Least microseconds the RAN keeps between two indications (absent = not reported)
316 std::optional<Cause> cause; ///< Why the subscription was refused (negative only)
317 std::optional<std::string> detail; ///< UTF-8 text for the cause, up to MAX_DETAIL_SIZE bytes
318};
319
320/**
321 * @brief E3AP Indication Message structure
322 */
324 uint32_t dapp_identifier{0}; ///< dApp the indication is for
325 uint32_t ran_function_identifier{0}; ///< RAN function identifier
326 std::vector<uint8_t> protocol_data; ///< Opaque payload of the service model
327};
328
329/**
330 * @brief E3AP dApp Control Action structure
331 */
333 uint32_t dapp_identifier{0}; ///< dApp that sends the control
334 uint32_t ran_function_identifier{0}; ///< RAN function the control is for
335 uint32_t control_identifier{0}; ///< Control identifier
336 std::vector<uint8_t> action_data; ///< Opaque payload of the service model
337 /// Correlation id of the xApp procedure this control re-issues; 0 when the
338 /// dApp decided on its own. Optional on the wire, absent when 0.
339 uint32_t sequence_id{0};
340 /// True when the dApp wants a ControlResponse for this control. Written on
341 /// the wire only when true, so false and absent are the same.
342 bool request_ack{false};
343};
344
345/**
346 * @brief E3AP Message Acknowledgment structure
347 *
348 * DEPRECATED TO BE REMOVED. libe3 no longer sends it: the answer to a control is
349 * ControlResponse. It is still decoded, so a dApp reads the one that another RAN sends.
350 */
352 uint32_t request_id{0}; ///< ID of the request being acknowledged
353 ResponseCode response_code{ResponseCode::NEGATIVE}; ///< Response code (positive/negative)
354 std::optional<Cause> cause; ///< Why the request was refused (negative only)
355 std::optional<std::string> detail; ///< UTF-8 text for the cause, up to MAX_DETAIL_SIZE bytes
356};
357
358/**
359 * @brief E3AP Control Response structure
360 *
361 * The answer to a dApp control or an xApp control that asked for one
362 * (`request_ack`). The RAN sends it for a dApp control, the dApp for an xApp
363 * control. It also carries the refusals the RAN makes before a Service Model
364 * sees a control, whether the control asked for an answer or not.
365 */
367 uint32_t request_id{0}; ///< Message id of the control this answers
368 uint32_t dapp_identifier{0}; ///< dApp the control belongs to
369 uint32_t ran_function_identifier{0}; ///< RAN function of the control
370 uint32_t control_identifier{0}; ///< Control the answer is about
371 ResponseCode response_code{ResponseCode::NEGATIVE}; ///< Response code (positive/negative)
372 std::optional<Cause> cause; ///< Why the control was refused (negative only)
373 std::optional<std::string> detail; ///< UTF-8 text for the cause, up to MAX_DETAIL_SIZE bytes
374 /// What the Service Model reports about applying the control: opaque
375 /// service-model content, 1..MAX_CONTROL_OUTCOME_SIZE bytes, absent when it has none.
376 std::optional<std::vector<uint8_t>> control_outcome;
377};
378
379/**
380 * @brief What a Service Model answers to a control (see ServiceModel::respond_to_control)
381 */
383 ResponseCode response_code{ResponseCode::POSITIVE}; ///< Whether the control was applied
384 std::optional<Cause> cause; ///< Why not (negative only)
385 std::optional<std::string> detail; ///< UTF-8 text for the cause, up to MAX_DETAIL_SIZE bytes
386 std::vector<uint8_t> outcome; ///< Opaque service-model content; empty for none
387};
388
389/**
390 * @brief E3AP dApp Report structure
391 */
393 uint32_t dapp_identifier{0}; ///< dApp that sends the report
394 uint32_t ran_function_identifier{0}; ///< RAN function the report is for
395 std::vector<uint8_t> report_data; ///< Opaque payload of the service model
396 /// Correlation id assigned by the dApp; the head of the loop's chain.
397 /// Mandatory on the wire.
398 uint32_t sequence_id{0};
399 uint64_t recv_seq{0}; ///< Set by the inbound loop; keys the [latrec] L-stage records
400};
401
402/**
403 * @brief E3AP xApp Control Action structure
404 */
406 uint32_t dapp_identifier{0}; ///< dApp the control is for
407 uint32_t ran_function_identifier{0}; ///< RAN function the control is for
408 std::vector<uint8_t> xapp_control_data; ///< Opaque payload of the service model
409 /// Correlation id copied by the RAN bridge from the E2SM-DAPP control
410 /// header's sequence-id. Mandatory on the wire.
411 uint32_t sequence_id{0};
412 /// Set by the inbound loop from the wrapping E3-PDU's id field; not
413 /// serialized, so it carries no ASN.1/JSON/Protobuf grammar of its own.
414 uint32_t message_id{0};
415 /// True when the RAN wants a ControlResponse from the dApp for this control.
416 /// Written on the wire only when true.
417 bool request_ack{false};
418};
419
420/**
421 * @brief E3AP Release Message structure
422 */
424 uint32_t dapp_identifier{0}; ///< dApp identifier
425};
426
427/**
428 * @brief Generic E3AP PDU using std::variant for type-safe union
429 */
430using PduChoice = std::variant<
443>;
444
445/**
446 * @brief Generic E3AP PDU structure
447 */
448struct Pdu {
449 PduType type{PduType::SETUP_REQUEST}; ///< Which alternative of `choice` is set
450 PduChoice choice; ///< The message itself
451 uint32_t message_id{0}; ///< Unique message identifier
452 uint64_t enqueue_seq{0}; ///< Set by queue_outbound; keys the [latrec] L-stage records
453
454 /**
455 * @brief Producer timestamp, in nanoseconds since the Unix epoch.
456 *
457 * Stamped from the realtime clock (see @ref now_realtime_ns) when the PDU
458 * is constructed, so a caller gets one for free. Zero means "no producer
459 * reference": every encoding transmits it as an absent field and decodes
460 * an absent field back to zero, so the clock read is opt-out and a PDU
461 * without a timestamp is a normal message rather than a malformed one.
462 *
463 * @warning Realtime, not monotonic. Never subtract it from a monotonic
464 * reading.
465 */
466 uint64_t timestamp{0};
467
468 /// SetupRequest-typed PDU with a default-constructed message and a fresh timestamp.
470
471 /// PDU of type `t` with a default-constructed message and a fresh timestamp.
472 /// @param t PDU type
473 explicit Pdu(PduType t) : type(t), timestamp(now_realtime_ns()) {}
474
475 /// PDU of type `t` that holds `data`, with a fresh timestamp.
476 /// @param t PDU type; it must match the type of `data`
477 /// @param data The message
478 template<typename T>
479 Pdu(PduType t, T&& data)
480 : type(t), choice(std::forward<T>(data)), timestamp(now_realtime_ns()) {}
481
482 /**
483 * @brief Get PDU data with type checking
484 * @tparam T Message type to look for
485 * @return The message, or nullptr when the PDU holds another type
486 */
487 template<typename T>
488 T* get_if() noexcept {
489 return std::get_if<T>(&choice);
490 }
491
492 /**
493 * @brief Get PDU data with type checking
494 * @tparam T Message type to look for
495 * @return The message, or nullptr when the PDU holds another type
496 */
497 template<typename T>
498 const T* get_if() const noexcept {
499 return std::get_if<T>(&choice);
500 }
501};
502
503/**
504 * @brief Configuration for E3Agent
505 */
506struct E3Config {
507 /// Role: RAN (today's default — binds sockets) or DAPP (connects).
509
510 // RAN identification (used when role==RAN to advertise this RAN's id)
511 std::string ran_identifier; ///< Unique identifier for this RAN function (e.g. "DU-1")
512
513 // dApp identification (used when role==DAPP to send in SetupRequest)
514 std::string dapp_name{"libe3-dapp"}; ///< dApp name advertised in SetupRequest
515 std::string dapp_version{"0.0.0"}; ///< dApp version advertised in SetupRequest
516 std::string vendor; ///< Vendor name for SetupRequest (optional)
517
518 std::string e3ap_version{"1.0.0"}; ///< E3AP protocol version advertised during setup
519
520 // Transport configuration
521#if defined(LIBE3_HAS_ZMQ) && !LIBE3_HAS_ZMQ
522 // A build without ZeroMQ has no ZMQ connector to create, so defaulting to
523 // it would make every default-constructed config fail to initialise. The
524 // POSIX connector accepts the same ZMQ-style endpoint URIs (it strips the
525 // scheme), so the endpoint defaults below need no counterpart.
526 E3LinkLayer link_layer{E3LinkLayer::POSIX}; ///< Link-layer transport (ZMQ or POSIX)
527#else
528 E3LinkLayer link_layer{E3LinkLayer::ZMQ}; ///< Link-layer transport (ZMQ or POSIX)
529#endif
530 E3TransportLayer transport_layer{E3TransportLayer::IPC}; ///< Transport-layer protocol (SCTP, TCP, IPC)
531
532 // Ports. The POSIX link serves everything on setup_port and ignores the other two;
533 // the ZeroMQ link uses all three.
534 uint16_t setup_port{9990}; ///< Port of the setup channel; the one port of the POSIX link
535 uint16_t subscriber_port{9999}; ///< Port of the inbound control/subscription channel (ZeroMQ)
536 uint16_t publisher_port{9991}; ///< Port of the outbound indication/publication channel (ZeroMQ)
537
538 // Endpoints. The POSIX link serves everything on setup_endpoint and ignores the other two.
539 // Its IPC path is /tmp/dapps/e3 unless setup_endpoint is set to something else; for TCP and
540 // SCTP, "tcp://host:port" or "sctp://host:port" (a host in brackets for IPv6) names the host
541 // and, if given, the port, and anything else means every address to listen on and
542 // 127.0.0.1 to connect to.
543 std::string setup_endpoint{"ipc:///tmp/dapps/setup"}; ///< Endpoint URI of the setup channel; the one endpoint of the POSIX link
544 std::string subscriber_endpoint{"ipc:///tmp/dapps/dapp_socket"}; ///< Endpoint URI of the inbound channel (ZeroMQ)
545 std::string publisher_endpoint{"ipc:///tmp/dapps/e3_socket"}; ///< Endpoint URI of the outbound channel (ZeroMQ)
546
547 /**
548 * @brief SO_SNDBUF and SO_RCVBUF of the SCTP sockets of the POSIX link, in bytes.
549 *
550 * Set on both peers before the association exists. With the Linux defaults an
551 * SCTP message of megabytes waits seconds for the send buffer and the delayed
552 * SACK; the library caps a PDU well below that today, so the setting shows only
553 * once it grows. 0 keeps the kernel's size. Ignored by TCP, IPC and ZeroMQ.
554 */
555 size_t socket_buffer_bytes{2 * 1024 * 1024};
556
557 /**
558 * @brief Whether SCTP may delay the SACK of a message (POSIX link).
559 *
560 * false, the default, turns delayed SACK off, which is what OCUDU does on both
561 * peers. Ignored by TCP, IPC and ZeroMQ.
562 */
563 bool sctp_delayed_sack{false};
564
565 /**
566 * @brief Literal addresses a dApp may connect from (POSIX link, RAN role, TCP and SCTP).
567 *
568 * A connection from any other address is closed at once. Empty accepts every
569 * address, which is the default. An IPv4 address is written in dotted form
570 * whether the RAN listens on IPv4 or on both families.
571 */
572 std::vector<std::string> allowed_peers;
573
574 /**
575 * @brief Most dApps connected at once (POSIX link, RAN role).
576 *
577 * A connection beyond it is closed at once. 0 is unlimited, the default.
578 */
580
581 // Encoding format
582#if defined(LIBE3_ENABLE_ASN1)
583 EncodingFormat encoding{EncodingFormat::ASN1}; ///< PDU encoding format (ASN.1 PER or JSON)
584#elif defined(LIBE3_ENABLE_JSON)
585 EncodingFormat encoding{EncodingFormat::JSON}; ///< PDU encoding format (ASN.1 PER or JSON)
586#else // Fallback
587 EncodingFormat encoding{EncodingFormat::ASN1}; ///< PDU encoding format (ASN.1 PER or JSON)
588#endif
589
590 // Timeouts (milliseconds)
591 uint32_t connect_timeout_ms{5000}; ///< Connection establishment timeout in milliseconds
592 uint32_t recv_timeout_ms{1000}; ///< Receive operation timeout in milliseconds
593 uint32_t send_timeout_ms{1000}; ///< Send operation timeout in milliseconds
594
595 /**
596 * @brief Seconds a RAN waits for a message from a dApp before it removes the dApp.
597 *
598 * RAN role only. A dApp that sends nothing for this long is told with a
599 * ReleaseMessage, then its registration and subscriptions are dropped and
600 * a RAN function it was the last subscriber of is stopped. Only what the
601 * dApp sends counts, never what the RAN sends to it. A dApp that registered
602 * and never spoke counts from its registration. 0 never removes a dApp for
603 * being quiet. The default is Aerial's 1800 s.
604 */
605 uint32_t dapp_idle_timeout_s{1800};
606
607 /**
608 * @brief Milliseconds a dApp waits before it registers with the RAN again (dApp role).
609 *
610 * When the RAN releases the dApp or the connection to it is lost, or setup
611 * did not complete, a dApp that was started with start() stops and starts
612 * itself again after this long, and again every this long until the RAN
613 * answers. The new session has a new dApp id and none of the subscriptions
614 * of the old one: the application subscribes again, and learns that the
615 * dApp is back from the setup response handler. A dApp that called
616 * release(), or stop(), is not restarted. 0 turns it off, so a dApp stays
617 * down until the program calls stop() and start(). The default is
618 * Aerial's one second.
619 */
620 uint32_t reconnect_interval_ms{1000};
621
622 // Buffer sizes
623 size_t receive_buffer_size{DEFAULT_BUFFER_SIZE}; ///< Size of the receive buffer in bytes
624 size_t send_buffer_size{DEFAULT_BUFFER_SIZE}; ///< Size of the send buffer in bytes
625
626 // Threading
627 size_t io_threads{2}; ///< Number of I/O threads (used by ZMQ context)
628
629 /**
630 * @brief CPU core to pin the subscriber and publisher I/O threads to.
631 *
632 * When set to a non-negative value the subscriber_loop and publisher_loop
633 * threads will be pinned to this logical CPU core via
634 * pthread_setaffinity_np (Linux only; ignored on other platforms).
635 * This eliminates cache-migration overhead and reduces scheduling jitter
636 * in sub-millisecond control loops.
637 *
638 * -1 (default) disables core pinning.
639 */
641
642 /**
643 * @brief Nice value applied to the subscriber and publisher I/O threads.
644 *
645 * Range -20 (highest priority) to 19 (lowest priority), 0 = system
646 * default. A negative value reduces OS scheduling latency at the cost of
647 * slightly less CPU time for other processes. Requires appropriate
648 * privileges for negative values (CAP_SYS_NICE on Linux).
649 *
650 * Applied via setpriority(PRIO_PROCESS, tid, value) on Linux.
651 */
653
654 // Logging level (0=none, 1=error, 2=warn, 3=info, 4=debug, 5=trace)
655 int log_level{3}; ///< Logging verbosity: 0=none, 1=error, 2=warn, 3=info, 4=debug, 5=trace
656
657 /**
658 * @brief Path of the shared log file. Empty (default) => auto-generated.
659 *
660 * When left empty the library derives a per-process path of the form
661 * `/tmp/e3_<role>[_<sanitized-id>]_<euid>.log` (see E3Interface ctor).
662 * The trailing effective-uid keeps the file owned by whoever opens it,
663 * which avoids `fs.protected_regular` blocking an O_CREAT re-open of a
664 * /tmp file owned by a different user (e.g. a root gNB vs. a prior
665 * non-sudo run). Set this explicitly to override the location entirely.
666 */
667 std::string log_path;
668};
669
670/**
671 * @brief Timestamp type using steady_clock for monotonic time
672 */
673using Timestamp = std::chrono::time_point<std::chrono::steady_clock>;
674
675/**
676 * @brief dApp registration entry
677 */
678struct DAppEntry {
679 uint32_t dapp_identifier{0}; ///< Assigned dApp identifier (1–100)
680 Timestamp registered_time; ///< Monotonic timestamp of when the dApp registered
681 Timestamp last_seen; ///< Monotonic timestamp of the last message from the dApp, or of its registration
682 uint64_t generation{0}; ///< Counts registrations: an id handed out again gets a higher one
683};
684
685/**
686 * @brief Subscription entry representing dApp-RAN function association
687 */
689 uint32_t dapp_identifier{0}; ///< Identifier of the subscribed dApp
690 uint32_t ran_function_id{0}; ///< RAN function the dApp is subscribed to
691 Timestamp created_time; ///< Monotonic timestamp of when the subscription was created
692};
693
694// Utility functions for type conversions
695
696/**
697 * @brief Convert PduType to string representation
698 * @param type PDU type
699 * @return A static name, "unknown" for a value outside the enumeration
700 */
701inline const char* pdu_type_to_string(PduType type) noexcept {
702 switch (type) {
703 case PduType::SETUP_REQUEST: return "SetupRequest";
704 case PduType::SETUP_RESPONSE: return "SetupResponse";
705 case PduType::SUBSCRIPTION_REQUEST: return "SubscriptionRequest";
706 case PduType::SUBSCRIPTION_DELETE: return "SubscriptionDelete";
707 case PduType::SUBSCRIPTION_RESPONSE: return "SubscriptionResponse";
708 case PduType::INDICATION_MESSAGE: return "IndicationMessage";
709 case PduType::DAPP_CONTROL_ACTION: return "DAppControlAction";
710 case PduType::DAPP_REPORT: return "DAppReport";
711 case PduType::XAPP_CONTROL_ACTION: return "XAppControlAction";
712 case PduType::RELEASE_MESSAGE: return "ReleaseMessage";
713 case PduType::MESSAGE_ACK: return "MessageAck";
714 case PduType::CONTROL_RESPONSE: return "ControlResponse";
715 default: return "unknown";
716 }
717}
718
719/**
720 * @brief Convert ActionType to string representation
721 * @param type Action type
722 * @return A static name, "unknown" for a value outside the enumeration
723 */
724inline const char* action_type_to_string(ActionType type) noexcept {
725 switch (type) {
726 case ActionType::INSERT: return "insert";
727 case ActionType::UPDATE: return "update";
728 case ActionType::DELETE: return "delete";
729 default: return "unknown";
730 }
731}
732
733/**
734 * @brief Convert ResponseCode to string representation
735 * @param code Response code
736 * @return "positive" or "negative", "unknown" for a value outside the enumeration
737 */
738inline const char* response_code_to_string(ResponseCode code) noexcept {
739 switch (code) {
740 case ResponseCode::POSITIVE: return "positive";
741 case ResponseCode::NEGATIVE: return "negative";
742 default: return "unknown";
743 }
744}
745
746/**
747 * @brief Convert Cause to the name E3AP gives it in JSON and in logs
748 * @param cause Cause to name
749 * @return The camelCase name, for example "unsupportedIdentifier"; "unspecified" for a value outside the enumeration
750 */
751inline const char* cause_to_string(Cause cause) noexcept {
752 switch (cause) {
753 case Cause::UNSPECIFIED: return "unspecified";
754 case Cause::PROTOCOL_ERROR: return "protocolError";
755 case Cause::SETUP_REQUIRED: return "setupRequired";
756 case Cause::SETUP_ALREADY_COMPLETE: return "setupAlreadyComplete";
757 case Cause::UNSUPPORTED_PROTOCOL_VERSION: return "unsupportedProtocolVersion";
758 case Cause::UNSUPPORTED_RAN_FUNCTION: return "unsupportedRanFunction";
759 case Cause::UNSUPPORTED_IDENTIFIER: return "unsupportedIdentifier";
760 case Cause::INVALID_REQUEST: return "invalidRequest";
761 case Cause::NOT_FOUND: return "notFound";
762 case Cause::DUPLICATE: return "duplicate";
763 case Cause::RESOURCE_EXHAUSTED: return "resourceExhausted";
764 case Cause::AUTHORIZATION_REJECTED: return "authorizationRejected";
765 case Cause::PAYLOAD_TOO_LARGE: return "payloadTooLarge";
766 case Cause::TRANSPORT_OVERRUN: return "transportOverrun";
767 case Cause::SHUTTING_DOWN: return "shuttingDown";
768 default: return "unspecified";
769 }
770}
771
772/**
773 * @brief Read a Cause from its E3AP name
774 * @param name camelCase name, for example "unsupportedIdentifier"
775 * @return The cause; Cause::UNSPECIFIED for a name this version does not know, so a
776 * peer that adds a cause is still read as a refusal
777 */
778inline Cause cause_from_string(const std::string& name) noexcept {
779 for (uint8_t v = 0; v <= static_cast<uint8_t>(Cause::SHUTTING_DOWN); ++v) {
780 if (name == cause_to_string(static_cast<Cause>(v))) return static_cast<Cause>(v);
781 }
782 return Cause::UNSPECIFIED;
783}
784
785/**
786 * @brief Read a Cause from its wire value
787 * @param value Enumeration value as APER or Protocol Buffers carries it
788 * @return The cause; Cause::UNSPECIFIED for a value this version does not know
789 */
790inline Cause cause_from_value(long value) noexcept {
791 return (value >= 0 && value <= static_cast<long>(Cause::SHUTTING_DOWN))
792 ? static_cast<Cause>(value) : Cause::UNSPECIFIED;
793}
794
795/**
796 * @brief Convert ErrorCode to string representation
797 * @param code Error code
798 * @return A short description, "Unknown error" for a value outside the enumeration
799 */
800inline const char* error_code_to_string(ErrorCode code) noexcept {
801 switch (code) {
802 case ErrorCode::SUCCESS: return "Success";
803 case ErrorCode::INVALID_PARAM: return "Invalid parameter";
804 case ErrorCode::NOT_INITIALIZED: return "Not initialized";
805 case ErrorCode::ALREADY_INITIALIZED: return "Already initialized";
806 case ErrorCode::NOT_CONNECTED: return "Not connected";
807 case ErrorCode::CONNECTION_FAILED: return "Connection failed";
808 case ErrorCode::TIMEOUT: return "Timeout";
809 case ErrorCode::ENCODE_FAILED: return "Encode failed";
810 case ErrorCode::DECODE_FAILED: return "Decode failed";
811 case ErrorCode::SM_NOT_FOUND: return "Service Model not found";
812 case ErrorCode::SM_ALREADY_REGISTERED: return "Service Model already registered";
813 case ErrorCode::BUFFER_TOO_SMALL: return "Buffer too small";
814 case ErrorCode::INTERNAL_ERROR: return "Internal error";
815 case ErrorCode::SUBSCRIPTION_EXISTS: return "Subscription already exists";
816 case ErrorCode::SUBSCRIPTION_NOT_FOUND: return "Subscription not found";
817 case ErrorCode::DAPP_NOT_REGISTERED: return "dApp not registered";
818 case ErrorCode::TRANSPORT_ERROR: return "Transport error";
819 case ErrorCode::STATE_ERROR: return "State error";
820 case ErrorCode::SM_START_FAILED: return "Service Model start failed";
821 case ErrorCode::NOT_FOUND: return "Not found";
822 case ErrorCode::CANCELLED: return "Operation cancelled";
823 default: return "Unknown error";
824 }
825}
826
827/**
828 * @brief Convert AgentState to string representation
829 * @param state Agent state
830 * @return A static name, "Unknown" for a value outside the enumeration
831 */
832inline const char* agent_state_to_string(AgentState state) noexcept {
833 switch (state) {
834 case AgentState::UNINITIALIZED: return "Uninitialized";
835 case AgentState::INITIALIZED: return "Initialized";
836 case AgentState::CONNECTING: return "Connecting";
837 case AgentState::CONNECTED: return "Connected";
838 case AgentState::RUNNING: return "Running";
839 case AgentState::STOPPING: return "Stopping";
840 case AgentState::STOPPED: return "Stopped";
841 case AgentState::ERROR: return "Error";
842 default: return "Unknown";
843 }
844}
845
846/**
847 * @brief Convert E3Role to string representation
848 * @param role Role
849 * @return "ran" or "dapp", "unknown" for a value outside the enumeration
850 */
851inline const char* role_to_string(E3Role role) noexcept {
852 switch (role) {
853 case E3Role::RAN: return "ran";
854 case E3Role::DAPP: return "dapp";
855 default: return "unknown";
856 }
857}
858
859/**
860 * @brief Convert E3LinkLayer to string representation
861 * @param layer Link layer
862 * @return "zmq" or "posix", "unknown" for a value outside the enumeration
863 */
864inline const char* link_layer_to_string(E3LinkLayer layer) noexcept {
865 switch (layer) {
866 case E3LinkLayer::ZMQ: return "zmq";
867 case E3LinkLayer::POSIX: return "posix";
868 default: return "unknown";
869 }
870}
871
872/**
873 * @brief Convert E3TransportLayer to string representation
874 * @param layer Transport layer
875 * @return "sctp", "tcp" or "ipc", "unknown" for a value outside the enumeration
876 */
877inline const char* transport_layer_to_string(E3TransportLayer layer) noexcept {
878 switch (layer) {
879 case E3TransportLayer::SCTP: return "sctp";
880 case E3TransportLayer::TCP: return "tcp";
881 case E3TransportLayer::IPC: return "ipc";
882 default: return "unknown";
883 }
884}
885
886} // namespace libe3
887
888#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
Largest xAppControlData of an xApp control action, in bytes.
Definition types.hpp:203
ErrorCode
Error codes returned by libe3 operations Use shared error-code list (see libe3/error_codes....
Definition types.hpp:177
const char * ErrorCodeToString(ErrorCode code)
Convert ErrorCode to string name (C++ wrapper).
Definition types.hpp:189
constexpr size_t MAX_DAPP_REPORT_DATA_SIZE
Largest reportData of a dApp report, in bytes.
Definition types.hpp:202
E3TransportLayer
Transport layer types (matches Python E3TransportLayer).
Definition types.hpp:85
@ SCTP
SCTP (O-RAN standard).
Definition types.hpp:86
@ IPC
Unix Domain Sockets / IPC.
Definition types.hpp:88
std::variant< SetupRequest, SetupResponse, SubscriptionRequest, SubscriptionDelete, SubscriptionResponse, IndicationMessage, DAppControlAction, DAppReport, XAppControlAction, ReleaseMessage, MessageAck, ControlResponse > PduChoice
Generic E3AP PDU using std::variant for type-safe union.
Definition types.hpp:430
const char * cause_to_string(Cause cause) noexcept
Convert Cause to the name E3AP gives it in JSON and in logs.
Definition types.hpp:751
constexpr size_t MAX_PENDING_CONTROLS
Most dApp controls a RAN holds an answer for at once.
Definition types.hpp:204
AgentState
Agent state machine states.
Definition types.hpp:162
@ STOPPED
Agent fully stopped.
Definition types.hpp:169
@ RUNNING
Main processing loop active.
Definition types.hpp:167
@ CONNECTING
Connection in progress.
Definition types.hpp:165
@ CONNECTED
Connected and ready for operations.
Definition types.hpp:166
@ ERROR
Error state.
Definition types.hpp:170
@ UNINITIALIZED
Agent not yet initialized.
Definition types.hpp:163
@ INITIALIZED
Agent initialized but not connected.
Definition types.hpp:164
@ STOPPING
Shutdown in progress.
Definition types.hpp:168
uint64_t now_realtime_ns() noexcept
Current realtime clock reading, in nanoseconds since the Unix epoch.
Definition types.hpp:43
E3Role
Role this E3 endpoint plays in the protocol.
Definition types.hpp:77
@ 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
@ NEGATIVE
Request rejected.
Definition types.hpp:105
@ POSITIVE
Request accepted.
Definition types.hpp:104
constexpr size_t MAX_PROTOCOL_DATA_SIZE
Largest protocolData of an indication, in bytes.
Definition types.hpp:200
const char * pdu_type_to_string(PduType type) noexcept
Convert PduType to string representation.
Definition types.hpp:701
PduType
E3AP PDU types.
Definition types.hpp:144
@ SUBSCRIPTION_DELETE
Definition types.hpp:148
@ SUBSCRIPTION_RESPONSE
Definition types.hpp:149
@ SUBSCRIPTION_REQUEST
Definition types.hpp:147
@ XAPP_CONTROL_ACTION
Definition types.hpp:153
@ DAPP_CONTROL_ACTION
Definition types.hpp:151
@ MESSAGE_ACK
DEPRECATED TO BE REMOVED: libe3 no longer sends it, see CONTROL_RESPONSE.
Definition types.hpp:155
E3LinkLayer
Link layer types (matches Python E3LinkLayer).
Definition types.hpp:62
@ POSIX
POSIX socket-based transport.
Definition types.hpp:64
@ ZMQ
ZeroMQ-based transport.
Definition types.hpp:63
std::chrono::time_point< std::chrono::steady_clock > Timestamp
Timestamp type using steady_clock for monotonic time.
Definition types.hpp:673
const char * action_type_to_string(ActionType type) noexcept
Convert ActionType to string representation.
Definition types.hpp:724
const char * agent_state_to_string(AgentState state) noexcept
Convert AgentState to string representation.
Definition types.hpp:832
EncodingFormat
E3AP encoding formats supported by the library.
Definition types.hpp:53
@ JSON
JSON encoding (for development/debugging).
Definition types.hpp:55
@ ASN1
ASN.1 PER encoding (standard O-RAN format).
Definition types.hpp:54
@ PROTOBUF
Protocol Buffers encoding.
Definition types.hpp:56
const char * role_to_string(E3Role role) noexcept
Convert E3Role to string representation.
Definition types.hpp:851
constexpr size_t DEFAULT_BUFFER_SIZE
Default encode and receive buffer size, in bytes.
Definition types.hpp:208
const char * response_code_to_string(ResponseCode code) noexcept
Convert ResponseCode to string representation.
Definition types.hpp:738
const char * transport_layer_to_string(E3TransportLayer layer) noexcept
Convert E3TransportLayer to string representation.
Definition types.hpp:877
const char * link_layer_to_string(E3LinkLayer layer) noexcept
Convert E3LinkLayer to string representation.
Definition types.hpp:864
constexpr size_t MAX_RAN_FUNCTIONS
ranFunctionList SIZE (0..64)
Definition types.hpp:206
Cause
Why a RAN refused a request (E3-Cause).
Definition types.hpp:115
@ SETUP_REQUIRED
The dApp has not completed setup.
Definition types.hpp:118
@ UNSPECIFIED
No more specific cause applies.
Definition types.hpp:116
@ PROTOCOL_ERROR
The message was malformed or out of sequence.
Definition types.hpp:117
@ SETUP_ALREADY_COMPLETE
A second setup on one association.
Definition types.hpp:119
@ RESOURCE_EXHAUSTED
The RAN has no room for the request.
Definition types.hpp:126
@ DUPLICATE
The request repeats one that is already active.
Definition types.hpp:125
@ SHUTTING_DOWN
The RAN is stopping.
Definition types.hpp:130
@ NOT_FOUND
The subscription or procedure the request names does not exist.
Definition types.hpp:124
@ AUTHORIZATION_REJECTED
The dApp is not allowed to do this.
Definition types.hpp:127
@ INVALID_REQUEST
The request is well formed but its content is not acceptable.
Definition types.hpp:123
@ UNSUPPORTED_RAN_FUNCTION
The RAN function is not served.
Definition types.hpp:121
@ PAYLOAD_TOO_LARGE
The payload is over the bound the RAN accepts.
Definition types.hpp:128
@ UNSUPPORTED_PROTOCOL_VERSION
The E3AP version of the dApp is not served.
Definition types.hpp:120
@ UNSUPPORTED_IDENTIFIER
A telemetry or control identifier is not advertised by the RAN function.
Definition types.hpp:122
@ TRANSPORT_OVERRUN
The transport could not keep up.
Definition types.hpp:129
Cause cause_from_value(long value) noexcept
Read a Cause from its wire value.
Definition types.hpp:790
constexpr size_t MAX_DETAIL_SIZE
Largest detail text of a negative response, in bytes (E3-Text).
Definition types.hpp:209
ActionType
E3AP action types for Setup and Subscription requests.
Definition types.hpp:94
@ UPDATE
Update existing entry.
Definition types.hpp:96
@ DELETE
Delete existing entry.
Definition types.hpp:97
@ INSERT
Insert/create new entry.
Definition types.hpp:95
DisconnectReason
Why a dApp's session with the RAN ended (see DisconnectHandler).
Definition types.hpp:136
@ CONNECTION_LOST
The peer closed the connection or the link failed.
Definition types.hpp:138
@ RELEASED_BY_RAN
The RAN sent a ReleaseMessage for this dApp.
Definition types.hpp:137
constexpr uint32_t LIBE3_PROTOCOL_VERSION
Protocol version this library speaks.
Definition types.hpp:212
constexpr size_t MAX_ACTION_DATA_SIZE
Largest actionData of a dApp control action, in bytes.
Definition types.hpp:201
constexpr size_t MAX_CONTROL_OUTCOME_SIZE
Largest controlOutcome of a control response, in bytes.
Definition types.hpp:205
Cause cause_from_string(const std::string &name) noexcept
Read a Cause from its E3AP name.
Definition types.hpp:778
const char * error_code_to_string(ErrorCode code) noexcept
Convert ErrorCode to string representation.
Definition types.hpp:800
constexpr size_t MAX_IDENTIFIER_LIST_SIZE
telemetry and control lists SIZE (0..256)
Definition types.hpp:207
E3AP Control Response structure.
Definition types.hpp:366
uint32_t request_id
Message id of the control this answers.
Definition types.hpp:367
uint32_t control_identifier
Control the answer is about.
Definition types.hpp:370
std::optional< Cause > cause
Why the control was refused (negative only).
Definition types.hpp:372
ResponseCode response_code
Response code (positive/negative).
Definition types.hpp:371
uint32_t ran_function_identifier
RAN function of the control.
Definition types.hpp:369
uint32_t dapp_identifier
dApp the control belongs to
Definition types.hpp:368
std::optional< std::string > detail
Definition types.hpp:373
std::optional< std::vector< uint8_t > > control_outcome
Definition types.hpp:376
What a Service Model answers to a control (see ServiceModel::respond_to_control).
Definition types.hpp:382
ResponseCode response_code
Whether the control was applied.
Definition types.hpp:383
std::optional< std::string > detail
UTF-8 text for the cause, up to MAX_DETAIL_SIZE bytes.
Definition types.hpp:385
std::optional< Cause > cause
Why not (negative only).
Definition types.hpp:384
std::vector< uint8_t > outcome
Opaque service-model content; empty for none.
Definition types.hpp:386
E3AP dApp Control Action structure.
Definition types.hpp:332
uint32_t ran_function_identifier
RAN function the control is for.
Definition types.hpp:334
std::vector< uint8_t > action_data
Definition types.hpp:336
uint32_t dapp_identifier
dApp that sends the control
Definition types.hpp:333
uint32_t control_identifier
Control identifier.
Definition types.hpp:335
dApp registration entry
Definition types.hpp:678
uint64_t generation
Counts registrations: an id handed out again gets a higher one.
Definition types.hpp:682
Timestamp last_seen
Monotonic timestamp of the last message from the dApp, or of its registration.
Definition types.hpp:681
Timestamp registered_time
Monotonic timestamp of when the dApp registered.
Definition types.hpp:680
uint32_t dapp_identifier
Assigned dApp identifier (1–100).
Definition types.hpp:679
E3AP dApp Report structure.
Definition types.hpp:392
uint32_t dapp_identifier
dApp that sends the report
Definition types.hpp:393
uint32_t sequence_id
Definition types.hpp:398
std::vector< uint8_t > report_data
Definition types.hpp:395
uint32_t ran_function_identifier
RAN function the report is for.
Definition types.hpp:394
uint64_t recv_seq
Set by the inbound loop; keys the [latrec] L-stage records.
Definition types.hpp:399
Configuration for E3Agent.
Definition types.hpp:506
std::vector< std::string > allowed_peers
Literal addresses a dApp may connect from (POSIX link, RAN role, TCP and SCTP).
Definition types.hpp:572
uint32_t reconnect_interval_ms
Milliseconds a dApp waits before it registers with the RAN again (dApp role).
Definition types.hpp:620
std::string dapp_version
dApp version advertised in SetupRequest
Definition types.hpp:515
size_t maximum_associations
Most dApps connected at once (POSIX link, RAN role).
Definition types.hpp:579
std::string e3ap_version
E3AP protocol version advertised during setup.
Definition types.hpp:518
std::string log_path
Path of the shared log file. Empty (default) => auto-generated.
Definition types.hpp:667
std::string subscriber_endpoint
Endpoint URI of the inbound channel (ZeroMQ).
Definition types.hpp:544
E3Role role
Role: RAN (today's default — binds sockets) or DAPP (connects).
Definition types.hpp:508
int log_level
Logging verbosity: 0=none, 1=error, 2=warn, 3=info, 4=debug, 5=trace.
Definition types.hpp:655
size_t socket_buffer_bytes
SO_SNDBUF and SO_RCVBUF of the SCTP sockets of the POSIX link, in bytes.
Definition types.hpp:555
uint16_t setup_port
Port of the setup channel; the one port of the POSIX link.
Definition types.hpp:534
uint32_t send_timeout_ms
Send operation timeout in milliseconds.
Definition types.hpp:593
int io_thread_affinity
CPU core to pin the subscriber and publisher I/O threads to.
Definition types.hpp:640
int io_thread_niceness
Nice value applied to the subscriber and publisher I/O threads.
Definition types.hpp:652
EncodingFormat encoding
PDU encoding format (ASN.1 PER or JSON).
Definition types.hpp:583
E3LinkLayer link_layer
Link-layer transport (ZMQ or POSIX).
Definition types.hpp:528
uint32_t connect_timeout_ms
Connection establishment timeout in milliseconds.
Definition types.hpp:591
std::string publisher_endpoint
Endpoint URI of the outbound channel (ZeroMQ).
Definition types.hpp:545
uint16_t subscriber_port
Port of the inbound control/subscription channel (ZeroMQ).
Definition types.hpp:535
uint32_t dapp_idle_timeout_s
Seconds a RAN waits for a message from a dApp before it removes the dApp.
Definition types.hpp:605
std::string dapp_name
dApp name advertised in SetupRequest
Definition types.hpp:514
uint32_t recv_timeout_ms
Receive operation timeout in milliseconds.
Definition types.hpp:592
std::string ran_identifier
Unique identifier for this RAN function (e.g. "DU-1").
Definition types.hpp:511
size_t send_buffer_size
Size of the send buffer in bytes.
Definition types.hpp:624
E3TransportLayer transport_layer
Transport-layer protocol (SCTP, TCP, IPC).
Definition types.hpp:530
size_t receive_buffer_size
Size of the receive buffer in bytes.
Definition types.hpp:623
size_t io_threads
Number of I/O threads (used by ZMQ context).
Definition types.hpp:627
bool sctp_delayed_sack
Whether SCTP may delay the SACK of a message (POSIX link).
Definition types.hpp:563
std::string setup_endpoint
Endpoint URI of the setup channel; the one endpoint of the POSIX link.
Definition types.hpp:543
uint16_t publisher_port
Port of the outbound indication/publication channel (ZeroMQ).
Definition types.hpp:536
std::string vendor
Vendor name for SetupRequest (optional).
Definition types.hpp:516
std::vector< uint8_t > buffer
Encoded data buffer.
Definition types.hpp:220
bool empty() const noexcept
Definition types.hpp:234
const uint8_t * data() const noexcept
Definition types.hpp:236
EncodedMessage()=default
Empty message with no format set.
EncodedMessage(std::vector< uint8_t > buf, EncodingFormat fmt)
Definition types.hpp:228
EncodingFormat format
Format used for encoding.
Definition types.hpp:221
size_t size() const noexcept
Definition types.hpp:232
uint8_t * data() noexcept
Definition types.hpp:238
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
std::optional< Cause > cause
Why the request was refused (negative only).
Definition types.hpp:354
ResponseCode response_code
Response code (positive/negative).
Definition types.hpp:353
std::optional< std::string > detail
UTF-8 text for the cause, up to MAX_DETAIL_SIZE bytes.
Definition types.hpp:355
uint32_t request_id
ID of the request being acknowledged.
Definition types.hpp:352
uint64_t enqueue_seq
Set by queue_outbound; keys the [latrec] L-stage records.
Definition types.hpp:452
PduType type
Which alternative of choice is set.
Definition types.hpp:449
T * get_if() noexcept
Get PDU data with type checking.
Definition types.hpp:488
Pdu(PduType t, T &&data)
Definition types.hpp:479
PduChoice choice
The message itself.
Definition types.hpp:450
uint64_t timestamp
Producer timestamp, in nanoseconds since the Unix epoch.
Definition types.hpp:466
Pdu()
SetupRequest-typed PDU with a default-constructed message and a fresh timestamp.
Definition types.hpp:469
Pdu(PduType t)
Definition types.hpp:473
uint32_t message_id
Unique message identifier.
Definition types.hpp:451
const T * get_if() const noexcept
Get PDU data with type checking.
Definition types.hpp:498
RAN Function Definition for Setup Response.
Definition types.hpp:263
uint32_t ran_function_identifier
RAN function identifier.
Definition types.hpp:264
std::vector< uint32_t > telemetry_identifier_list
List of telemetry identifiers.
Definition types.hpp:265
std::vector< uint32_t > control_identifier_list
List of control identifiers.
Definition types.hpp:266
std::vector< uint8_t > ran_function_data
Opaque description of the function, 1..262144 bytes over ASN.1.
Definition types.hpp:267
RAN Function definition (SM identification).
Definition types.hpp:244
uint32_t ran_function_id
Unique identifier for this RAN function.
Definition types.hpp:245
std::string sm_version
Service Model version string (e.g. "1.0.0").
Definition types.hpp:247
std::string sm_name
Human-readable Service Model name.
Definition types.hpp:246
E3AP Release Message structure.
Definition types.hpp:423
uint32_t dapp_identifier
dApp identifier
Definition types.hpp:424
E3AP Setup Request structure.
Definition types.hpp:253
std::string vendor
Vendor name; 1..64 bytes over ASN.1.
Definition types.hpp:257
std::string dapp_version
Version of the dApp (e.g., "0.0.0"); 1..32 bytes over ASN.1.
Definition types.hpp:256
std::string e3ap_protocol_version
E3AP protocol version (e.g., "0.0.0"); 1..32 bytes over ASN.1.
Definition types.hpp:254
std::string dapp_name
Name of the dApp; 1..64 bytes over ASN.1.
Definition types.hpp:255
E3AP Setup Response structure.
Definition types.hpp:273
std::string ran_identifier
RAN identifier (mandatory); 1..64 bytes over ASN.1.
Definition types.hpp:278
uint32_t request_id
ID of the corresponding SetupRequest.
Definition types.hpp:274
std::optional< uint32_t > dapp_identifier
Assigned dApp identifier (optional).
Definition types.hpp:277
std::vector< RanFunctionDef > ran_function_list
List of available RAN functions (optional).
Definition types.hpp:279
std::optional< Cause > cause
Why the setup was refused (negative only).
Definition types.hpp:280
ResponseCode response_code
Response code (positive/negative).
Definition types.hpp:275
std::optional< std::string > detail
UTF-8 text for the cause, up to MAX_DETAIL_SIZE bytes.
Definition types.hpp:281
std::optional< std::string > e3ap_protocol_version
E3AP protocol version (optional).
Definition types.hpp:276
E3AP Subscription Delete structure.
Definition types.hpp:299
uint32_t dapp_identifier
dApp identifier
Definition types.hpp:300
uint32_t subscription_id
Subscription ID to delete.
Definition types.hpp:301
Subscription entry representing dApp-RAN function association.
Definition types.hpp:688
Timestamp created_time
Monotonic timestamp of when the subscription was created.
Definition types.hpp:691
uint32_t dapp_identifier
Identifier of the subscribed dApp.
Definition types.hpp:689
uint32_t ran_function_id
RAN function the dApp is subscribed to.
Definition types.hpp:690
E3AP Subscription Request structure.
Definition types.hpp:287
std::optional< uint32_t > periodicity
Microseconds between indications, 0 = every event (ASN.1: 0 to 60000000).
Definition types.hpp:293
std::optional< uint32_t > subscription_time
How long to keep the subscription (0-86400 sec).
Definition types.hpp:292
uint32_t ran_function_identifier
RAN function to subscribe to.
Definition types.hpp:289
std::vector< uint32_t > control_identifier_list
List of control identifiers.
Definition types.hpp:291
std::vector< uint32_t > telemetry_identifier_list
List of telemetry identifiers.
Definition types.hpp:290
uint32_t dapp_identifier
dApp identifier
Definition types.hpp:288
E3AP Subscription Response structure.
Definition types.hpp:307
std::optional< Cause > cause
Why the subscription was refused (negative only).
Definition types.hpp:316
std::optional< uint32_t > subscription_id
Subscription ID (optional).
Definition types.hpp:311
std::optional< std::vector< uint32_t > > telemetry_identifier_list
Granted telemetry ids (absent = not reported, empty = none granted).
Definition types.hpp:312
std::optional< uint32_t > ran_function_identifier
RAN function the grant is for.
Definition types.hpp:314
uint32_t request_id
ID of the corresponding SubscriptionRequest.
Definition types.hpp:308
std::optional< std::string > detail
UTF-8 text for the cause, up to MAX_DETAIL_SIZE bytes.
Definition types.hpp:317
uint32_t dapp_identifier
dApp identifier
Definition types.hpp:309
std::optional< uint32_t > periodicity
Least microseconds the RAN keeps between two indications (absent = not reported).
Definition types.hpp:315
std::optional< std::vector< uint32_t > > control_identifier_list
Granted control ids (absent = not reported, empty = none granted).
Definition types.hpp:313
ResponseCode response_code
Response code (positive/negative).
Definition types.hpp:310
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