libe3 0.6.1
C++ library for E3AP RAN vendor integration
Loading...
Searching...
No Matches
e2sm_dapp.cpp
Go to the documentation of this file.
1/**
2 * @file e2sm_dapp.cpp
3 * @brief E2SM-DAPP APER codec: the C++ structs of e2sm_dapp.hpp <-> asn1c <-> bytes.
4 *
5 * Encoding builds an asn1c struct from the C++ one, checks every constraint of
6 * the grammar by hand first (asn1c does not reject an out-of-range value
7 * cleanly, it can fault inside the encoder or silently use an extension
8 * encoding), runs asn_check_constraints as a second net, and encodes APER
9 * aligned into a growing std::vector. Decoding runs aper_decode, requires
10 * RC_OK, and converts back, applying the same constraints. The asn1c struct is
11 * freed on every path.
12 *
13 * SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
14 * SPDX-License-Identifier: Apache-2.0
15 */
16
17#include "libe3/e2sm_dapp.hpp"
18
19#include <cstdlib>
20#include <cstring>
21#include <utility>
22
23#include "DAppE3Subscription-Item.h"
24#include "DAppE3Subscription-List.h"
25#include "E2SM-DAPP-ActionDefinition-Format1.h"
26#include "E2SM-DAPP-ActionDefinition.h"
27#include "E2SM-DAPP-ControlHeader-Format1.h"
28#include "E2SM-DAPP-ControlHeader.h"
29#include "E2SM-DAPP-ControlMessage-Format1.h"
30#include "E2SM-DAPP-ControlMessage.h"
31#include "E2SM-DAPP-ControlOutcome-Format1.h"
32#include "E2SM-DAPP-ControlOutcome.h"
33#include "E2SM-DAPP-EventTrigger-Format1.h"
34#include "E2SM-DAPP-EventTrigger.h"
35#include "E2SM-DAPP-IndicationHeader-Format1.h"
36#include "E2SM-DAPP-IndicationHeader-Format2.h"
37#include "E2SM-DAPP-IndicationHeader.h"
38#include "E2SM-DAPP-IndicationMessage-Format1.h"
39#include "E2SM-DAPP-IndicationMessage-Format2.h"
40#include "E2SM-DAPP-IndicationMessage.h"
41#include "E2SM-DAPP-RANFunctionDefinition.h"
42#include "RANFunctionDefinition-Control-Item.h"
43#include "RANFunctionDefinition-Control.h"
44#include "RANFunctionDefinition-EventTrigger.h"
45#include "RANFunctionDefinition-Report-Item.h"
46#include "RANFunctionDefinition-Report.h"
47#include "RANfunction-Name.h"
48#include "aper_decoder.h"
49#include "asn_application.h"
50#include "constraints.h"
51
52namespace libe3 {
53namespace e2sm_dapp {
54
55// ---------------------------------------------------------------------------
56// operator== of the types whose definition is not in the header. An OPTIONAL
57// field that is absent has no value, so its payload is compared only when the
58// *_present flag is set; `ext` is never compared.
59// ---------------------------------------------------------------------------
60
69
78
88
99
108
117
124
132
133namespace {
134
135// ---------------------------------------------------------------------------
136// Grammar limits.
137// ---------------------------------------------------------------------------
138
139constexpr uint64_t k_uint32_max = 0xFFFFFFFFULL;
140constexpr size_t k_max_payload = static_cast<size_t>(max_e2sm_dapp_ind_msg_size); // == ctrl size
141constexpr size_t k_max_subs = static_cast<size_t>(maxnoof_dapps);
142constexpr size_t k_max_rf_per_sub = static_cast<size_t>(maxnoof_subscribed_e3_ran_functions);
143constexpr size_t k_max_report_sty = static_cast<size_t>(maxnoof_dapp_report_styles);
144constexpr size_t k_max_ctrl_sty = static_cast<size_t>(maxnoof_dapp_control_styles);
145constexpr size_t k_name_max = 150;
146constexpr size_t k_oid_max = 1000;
147
148static_assert(max_e2sm_dapp_ind_msg_size == max_e2sm_dapp_ctrl_msg_size, "one payload bound is used for both");
149
150// ---------------------------------------------------------------------------
151// Value checks shared by encode (reject) and decode (reject).
152// ---------------------------------------------------------------------------
153
154/// INTEGER (0..4294967295): ids, node-nb-id, node-cu-du-id, subscribed function ids.
155bool in_u32(uint64_t v)
156{
157 return v <= k_uint32_max;
158}
159
160/// Unconstrained INTEGER, held by asn1c in a `long`.
161bool fits_long(int64_t v)
162{
163 return static_cast<int64_t>(static_cast<long>(v)) == v;
164}
165
166/// The PrintableString alphabet: letters, digits, space and ' ( ) + , - . / : = ?
167bool is_printable_char(unsigned char c)
168{
169 if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) {
170 return true;
171 }
172 switch (c) {
173 case ' ':
174 case '\'':
175 case '(':
176 case ')':
177 case '+':
178 case ',':
179 case '-':
180 case '.':
181 case '/':
182 case ':':
183 case '=':
184 case '?':
185 return true;
186 default:
187 return false;
188 }
189}
190
191bool valid_printable(const char* s, size_t n, size_t lo, size_t hi)
192{
193 if (n < lo || n > hi) {
194 return false;
195 }
196 for (size_t i = 0; i < n; ++i) {
197 if (!is_printable_char(static_cast<unsigned char>(s[i]))) {
198 return false;
199 }
200 }
201 return true;
202}
203
204// ---------------------------------------------------------------------------
205// asn1c struct ownership.
206// ---------------------------------------------------------------------------
207
208template <class T>
209T* zalloc()
210{
211 return static_cast<T*>(std::calloc(1, sizeof(T)));
212}
213
214/// Owns an asn1c struct and frees it, children included, on every exit path.
215template <class T>
216class Owned
217{
218public:
219 explicit Owned(const asn_TYPE_descriptor_t& td) : td_(td) {}
220 ~Owned() { reset(nullptr); }
221 Owned(const Owned&) = delete;
222 Owned& operator=(const Owned&) = delete;
223
224 /// Allocate the zeroed struct. False when memory is exhausted.
225 bool alloc()
226 {
227 reset(zalloc<T>());
228 return p_ != nullptr;
229 }
230 /// Take over a struct that asn1c allocated (decode, also when it failed half way).
231 void adopt(T* p) { reset(p); }
232
233 T* get() const { return p_; }
234 T* operator->() const { return p_; }
235
236private:
237 void reset(T* p)
238 {
239 if (p_ != nullptr) {
240 td_.op->free_struct(&td_, p_, ASFM_FREE_EVERYTHING);
241 }
242 p_ = p;
243 }
244
245 const asn_TYPE_descriptor_t& td_;
246 T* p_ = nullptr;
247};
248
249/// OCTET STRING <- bytes. Never hands asn1c a null pointer, which would mean "clear".
250bool set_octets(OCTET_STRING_t& dst, const uint8_t* data, size_t n)
251{
252 if (n > static_cast<size_t>(INT32_MAX)) {
253 return false;
254 }
255 static const char k_empty[1] = {0};
256 const char* p = (n == 0) ? k_empty : reinterpret_cast<const char*>(data);
257 return OCTET_STRING_fromBuf(&dst, p, static_cast<int>(n)) == 0;
258}
259
260bool set_printable(PrintableString_t& dst, const std::string& s, size_t lo, size_t hi)
261{
262 if (!valid_printable(s.data(), s.size(), lo, hi)) {
263 return false;
264 }
265 return set_octets(dst, reinterpret_cast<const uint8_t*>(s.data()), s.size());
266}
267
268/// OPTIONAL INTEGER held in a `long` (timestamp, sequence-id, instance).
269bool set_opt_long(long*& dst, bool present, int64_t v)
270{
271 if (!present) {
272 return true;
273 }
274 if (!fits_long(v)) {
275 return false;
276 }
277 dst = zalloc<long>();
278 if (dst == nullptr) {
279 return false;
280 }
281 *dst = static_cast<long>(v);
282 return true;
283}
284
285bool set_u32(unsigned long& dst, uint64_t v)
286{
287 if (!in_u32(v)) {
288 return false;
289 }
290 dst = static_cast<unsigned long>(v);
291 return true;
292}
293
294bool set_long(long& dst, int64_t v)
295{
296 if (!fits_long(v)) {
297 return false;
298 }
299 dst = static_cast<long>(v);
300 return true;
301}
302
303// ---------------------------------------------------------------------------
304// C++ -> asn1c builders. Each returns false for a value outside the grammar or
305// for exhausted memory; the caller's Owned frees whatever was already attached.
306// ---------------------------------------------------------------------------
307
308bool build_subs(const dapp_e3_subscription_list_l& src, DAppE3Subscription_List_t& dst)
309{
310 if (src.size() > k_max_subs) {
311 return false;
312 }
313 for (const auto& s : src) {
314 if (s.subscribed_e3_ran_functions.size() < 1 || s.subscribed_e3_ran_functions.size() > k_max_rf_per_sub) {
315 return false;
316 }
317 auto* item = zalloc<DAppE3Subscription_Item_t>();
318 if (item == nullptr) {
319 return false;
320 }
321 if (asn_sequence_add(&dst, item) != 0) {
322 std::free(item);
323 return false;
324 }
325 if (!set_u32(item->dapp_id, s.dapp_id)) {
326 return false;
327 }
328 for (uint64_t rf : s.subscribed_e3_ran_functions) {
329 auto* v = zalloc<SubscribedE3RANFunction_ID_t>();
330 if (v == nullptr) {
331 return false;
332 }
333 if (asn_sequence_add(&item->subscribed_e3_ran_functions, v) != 0) {
334 std::free(v);
335 return false;
336 }
337 if (!set_u32(*v, rf)) {
338 return false;
339 }
340 }
341 }
342 return true;
343}
344
345/// An OPTIONAL DAppE3Subscription-List behind a pointer.
346bool build_opt_subs(bool present, const dapp_e3_subscription_list_l& src, DAppE3Subscription_List_t*& dst)
347{
348 if (!present) {
349 return true;
350 }
351 dst = zalloc<DAppE3Subscription_List_t>();
352 return dst != nullptr && build_subs(src, *dst);
353}
354
355bool build(const ran_function_name_s& s, RANfunction_Name_t& d)
356{
357 return set_printable(d.ranFunction_ShortName, s.ran_function_short_name.to_string(), 1, k_name_max) &&
358 set_printable(d.ranFunction_E2SM_OID, s.ran_function_e2sm_o_id.to_string(), 1, k_oid_max) &&
359 set_printable(d.ranFunction_Description, s.ran_function_description.to_string(), 1, k_name_max) &&
360 set_opt_long(d.ranFunction_Instance, s.ran_function_instance_present, s.ran_function_instance);
361}
362
363bool build(const ran_function_definition_report_item_s& s, RANFunctionDefinition_Report_Item_t& d)
364{
365 return set_long(d.ric_ReportStyle_Type, s.ric_report_style_type) &&
366 set_printable(d.ric_ReportStyle_Name, s.ric_report_style_name.to_string(), 1, k_name_max) &&
367 set_long(d.ric_IndicationHeaderFormat_Type, s.ric_ind_hdr_format_type) &&
368 set_long(d.ric_IndicationMessageFormat_Type, s.ric_ind_msg_format_type) &&
369 build_opt_subs(s.dapp_e3_subscriptions_present, s.dapp_e3_subscriptions, d.dappE3Subscriptions);
370}
371
372bool build(const ran_function_definition_ctrl_item_s& s, RANFunctionDefinition_Control_Item_t& d)
373{
374 return set_long(d.ric_ControlStyle_Type, s.ric_ctrl_style_type) &&
375 set_printable(d.ric_ControlStyle_Name, s.ric_ctrl_style_name.to_string(), 1, k_name_max) &&
376 set_long(d.ric_ControlHeaderFormat_Type, s.ric_ctrl_hdr_format_type) &&
377 set_long(d.ric_ControlMessageFormat_Type, s.ric_ctrl_msg_format_type) &&
378 set_long(d.ric_ControlOutcomeFormat_Type, s.ric_ctrl_outcome_format_type) &&
379 build_opt_subs(s.dapp_e3_subscriptions_present, s.dapp_e3_subscriptions, d.dappE3Subscriptions);
380}
381
382bool build(const ran_function_definition_report_s& s, RANFunctionDefinition_Report_t& d)
383{
384 if (s.ric_report_style_list.size() < 1 || s.ric_report_style_list.size() > k_max_report_sty) {
385 return false;
386 }
387 for (const auto& it : s.ric_report_style_list) {
388 auto* item = zalloc<RANFunctionDefinition_Report_Item_t>();
389 if (item == nullptr) {
390 return false;
391 }
392 if (asn_sequence_add(&d.ric_ReportStyle_List, item) != 0) {
393 std::free(item);
394 return false;
395 }
396 if (!build(it, *item)) {
397 return false;
398 }
399 }
400 return true;
401}
402
403bool build(const ran_function_definition_ctrl_s& s, RANFunctionDefinition_Control_t& d)
404{
405 if (s.ric_ctrl_style_list.size() < 1 || s.ric_ctrl_style_list.size() > k_max_ctrl_sty) {
406 return false;
407 }
408 for (const auto& it : s.ric_ctrl_style_list) {
409 auto* item = zalloc<RANFunctionDefinition_Control_Item_t>();
410 if (item == nullptr) {
411 return false;
412 }
413 if (asn_sequence_add(&d.ric_ControlStyle_List, item) != 0) {
414 std::free(item);
415 return false;
416 }
417 if (!build(it, *item)) {
418 return false;
419 }
420 }
421 return true;
422}
423
424bool build(const e2sm_dapp_ran_function_definition_s& s, E2SM_DAPP_RANFunctionDefinition_t& d)
425{
426 d.ranFunction_Name = zalloc<RANfunction_Name_t>();
427 if (d.ranFunction_Name == nullptr || !build(s.ran_function_name, *d.ranFunction_Name)) {
428 return false;
429 }
430 if (s.ran_function_definition_event_trigger_present) {
431 d.ranFunctionDefinition_EventTrigger = zalloc<RANFunctionDefinition_EventTrigger_t>();
432 if (d.ranFunctionDefinition_EventTrigger == nullptr) {
433 return false;
434 }
435 }
436 if (s.ran_function_definition_report_present) {
437 d.ranFunctionDefinition_Report = zalloc<RANFunctionDefinition_Report_t>();
438 if (d.ranFunctionDefinition_Report == nullptr ||
439 !build(s.ran_function_definition_report, *d.ranFunctionDefinition_Report)) {
440 return false;
441 }
442 }
443 if (s.ran_function_definition_ctrl_present) {
444 d.ranFunctionDefinition_Control = zalloc<RANFunctionDefinition_Control_t>();
445 if (d.ranFunctionDefinition_Control == nullptr ||
446 !build(s.ran_function_definition_ctrl, *d.ranFunctionDefinition_Control)) {
447 return false;
448 }
449 }
450 return true;
451}
452
453bool build(const e2sm_dapp_ind_hdr_format1_s& s, E2SM_DAPP_IndicationHeader_Format1_t& d)
454{
455 if (!set_u32(d.ran_function_id, s.ran_function_id) || !set_u32(d.dapp_id, s.dapp_id) ||
456 !set_u32(d.node_nb_id, s.node_nb_id)) {
457 return false;
458 }
459 d.node_type = static_cast<long>(s.node_type);
460 if (!set_octets(d.node_plmn_id, s.node_plmn_id.data(), s.node_plmn_id.size())) {
461 return false;
462 }
463 if (s.node_cu_du_id_present) {
464 d.node_cu_du_id = zalloc<unsigned long>();
465 if (d.node_cu_du_id == nullptr || !set_u32(*d.node_cu_du_id, s.node_cu_du_id)) {
466 return false;
467 }
468 }
469 return set_opt_long(d.timestamp, s.timestamp_present, s.timestamp) &&
470 set_opt_long(d.sequence_id, s.sequence_id_present, s.sequence_id);
471}
472
473bool build(const e2sm_dapp_ind_hdr_format2_s& s, E2SM_DAPP_IndicationHeader_Format2_t& d)
474{
475 if (!set_u32(d.node_nb_id, s.node_nb_id)) {
476 return false;
477 }
478 d.node_type = static_cast<long>(s.node_type);
479 if (!set_octets(d.node_plmn_id, s.node_plmn_id.data(), s.node_plmn_id.size())) {
480 return false;
481 }
482 if (s.node_cu_du_id_present) {
483 d.node_cu_du_id = zalloc<unsigned long>();
484 if (d.node_cu_du_id == nullptr || !set_u32(*d.node_cu_du_id, s.node_cu_du_id)) {
485 return false;
486 }
487 }
488 return set_opt_long(d.timestamp, s.timestamp_present, s.timestamp) &&
489 set_opt_long(d.sequence_id, s.sequence_id_present, s.sequence_id);
490}
491
492/// data-size INTEGER (0..32768) and data OCTET STRING (SIZE(1..32768)), as in both message formats.
493bool build_data(uint16_t data_size, const std::vector<uint8_t>& data, long& dst_size, OCTET_STRING_t& dst_data)
494{
495 if (data_size > k_max_payload || data.empty() || data.size() > k_max_payload) {
496 return false;
497 }
498 dst_size = static_cast<long>(data_size);
499 return set_octets(dst_data, data.data(), data.size());
500}
501
502bool build(const e2sm_dapp_ctrl_hdr_format1_s& s, E2SM_DAPP_ControlHeader_Format1_t& d)
503{
504 return set_u32(d.ran_function_id, s.ran_function_id) && set_u32(d.dapp_id, s.dapp_id) &&
505 set_opt_long(d.timestamp, s.timestamp_present, s.timestamp) &&
506 set_opt_long(d.sequence_id, s.sequence_id_present, s.sequence_id);
507}
508
509bool build(const e2sm_dapp_ctrl_outcome_format1_s& s, E2SM_DAPP_ControlOutcome_Format1_t& d)
510{
511 if (!set_opt_long(d.timestamp, s.timestamp_present, s.timestamp) ||
512 !set_opt_long(d.sequence_id, s.sequence_id_present, s.sequence_id)) {
513 return false;
514 }
515 if (s.e3_ctrl_outcome_present) {
516 d.e3_control_outcome = zalloc<OCTET_STRING_t>();
517 if (d.e3_control_outcome == nullptr ||
518 !set_octets(*d.e3_control_outcome, s.e3_ctrl_outcome.data(), s.e3_ctrl_outcome.size())) {
519 return false;
520 }
521 }
522 return true;
523}
524
525// ---------------------------------------------------------------------------
526// Encoding to a growing buffer.
527// ---------------------------------------------------------------------------
528
529struct Sink {
530 std::vector<uint8_t>* out;
531 bool failed;
532};
533
534/// asn1c output callback. It never returns an error (asn_encode would treat that
535/// as a malformed struct): an allocation failure is recorded and checked after.
536int sink_cb(const void* data, size_t size, void* key)
537{
538 auto* sink = static_cast<Sink*>(key);
539 if (sink->failed) {
540 return 0;
541 }
542 try {
543 const auto* p = static_cast<const uint8_t*>(data);
544 sink->out->insert(sink->out->end(), p, p + size);
545 } catch (...) {
546 sink->failed = true;
547 }
548 return 0;
549}
550
551asn_code encode_pdu(const asn_TYPE_descriptor_t& td, const void* sptr, std::vector<uint8_t>& out)
552{
553 char errbuf[256];
554 size_t errlen = sizeof(errbuf);
555 if (asn_check_constraints(&td, sptr, errbuf, &errlen) != 0) {
557 }
558
559 Sink sink{&out, false};
560 asn_enc_rval_t er = asn_encode(nullptr, ATS_ALIGNED_BASIC_PER, &td, sptr, sink_cb, &sink);
561 if (er.encoded < 0 || sink.failed || out.size() != static_cast<size_t>(er.encoded) || out.empty()) {
562 out.clear();
564 }
565 return ASN_SUCCESS;
566}
567
568/// The shared body of every pack(): `fill` builds the asn1c struct, which is then encoded and freed.
569template <class T, class Fill>
570asn_code pack_pdu(const asn_TYPE_descriptor_t& td, std::vector<uint8_t>& out, Fill fill)
571{
572 out.clear();
573 try {
574 Owned<T> pdu(td);
575 if (!pdu.alloc() || !fill(*pdu.get())) {
577 }
578 return encode_pdu(td, pdu.get(), out);
579 } catch (...) {
580 out.clear();
582 }
583}
584
585// ---------------------------------------------------------------------------
586// asn1c -> C++ converters. Anything outside the grammar's root constraints is
587// rejected, so that a struct that unpack() returns can be pack()ed again.
588// ---------------------------------------------------------------------------
589
590bool get_u32(unsigned long v, uint64_t& dst)
591{
592 if (static_cast<uint64_t>(v) > k_uint32_max) {
593 return false;
594 }
595 dst = static_cast<uint64_t>(v);
596 return true;
597}
598
599bool get_printable(const PrintableString_t& s, size_t lo, size_t hi, std::string& dst)
600{
601 if (s.buf == nullptr && s.size != 0) {
602 return false;
603 }
604 const char* p = reinterpret_cast<const char*>(s.buf);
605 if (!valid_printable(p, s.size, lo, hi)) {
606 return false;
607 }
608 dst.assign(p, s.size);
609 return true;
610}
611
612bool get_subs(const DAppE3Subscription_List_t& src, dapp_e3_subscription_list_l& dst)
613{
614 if (src.list.count < 0 || static_cast<size_t>(src.list.count) > k_max_subs) {
615 return false;
616 }
617 dst.clear();
618 dst.resize(static_cast<size_t>(src.list.count));
619 for (int i = 0; i < src.list.count; ++i) {
620 const DAppE3Subscription_Item_t* item = src.list.array[i];
621 if (item == nullptr) {
622 return false;
623 }
624 auto& d = dst[static_cast<size_t>(i)];
625 const int count = item->subscribed_e3_ran_functions.list.count;
626 if (!get_u32(item->dapp_id, d.dapp_id) || count < 1 || static_cast<size_t>(count) > k_max_rf_per_sub) {
627 return false;
628 }
629 d.subscribed_e3_ran_functions.resize(static_cast<size_t>(count));
630 for (int j = 0; j < count; ++j) {
631 const SubscribedE3RANFunction_ID_t* rf = item->subscribed_e3_ran_functions.list.array[j];
632 if (rf == nullptr || !get_u32(*rf, d.subscribed_e3_ran_functions[static_cast<size_t>(j)])) {
633 return false;
634 }
635 }
636 }
637 return true;
638}
639
640bool get_opt_subs(const DAppE3Subscription_List_t* src, bool& present, dapp_e3_subscription_list_l& dst)
641{
642 present = (src != nullptr);
643 return !present || get_subs(*src, dst);
644}
645
646bool get_node_type(long v, uint8_t& dst)
647{
648 if (v < 0 || v > 255) {
649 return false;
650 }
651 dst = static_cast<uint8_t>(v);
652 return true;
653}
654
655bool get_plmn(const OCTET_STRING_t& s, fixed_octstring<3, true>& dst)
656{
657 if (s.size != 3 || s.buf == nullptr) {
658 return false;
659 }
660 std::memcpy(dst.data(), s.buf, 3);
661 return true;
662}
663
664bool get_opt_u32(const unsigned long* src, bool& present, uint64_t& dst)
665{
666 present = (src != nullptr);
667 return !present || get_u32(*src, dst);
668}
669
670void get_opt_long(const long* src, bool& present, int64_t& dst)
671{
672 present = (src != nullptr);
673 if (present) {
674 dst = static_cast<int64_t>(*src);
675 }
676}
677
678bool get_data(long data_size, const OCTET_STRING_t& data, uint16_t& dst_size, std::vector<uint8_t>& dst_data)
679{
680 if (data_size < 0 || static_cast<unsigned long>(data_size) > k_max_payload || data.buf == nullptr ||
681 data.size < 1 || data.size > k_max_payload) {
682 return false;
683 }
684 dst_size = static_cast<uint16_t>(data_size);
685 dst_data.assign(data.buf, data.buf + data.size);
686 return true;
687}
688
689bool from_asn(const RANfunction_Name_t& s, ran_function_name_s& d)
690{
691 std::string a, b, c;
692 if (!get_printable(s.ranFunction_ShortName, 1, k_name_max, a) ||
693 !get_printable(s.ranFunction_E2SM_OID, 1, k_oid_max, b) ||
694 !get_printable(s.ranFunction_Description, 1, k_name_max, c)) {
695 return false;
696 }
697 d.ran_function_short_name.from_string(a);
698 d.ran_function_e2sm_o_id.from_string(b);
699 d.ran_function_description.from_string(c);
700 get_opt_long(s.ranFunction_Instance, d.ran_function_instance_present, d.ran_function_instance);
701 return true;
702}
703
704bool from_asn(const RANFunctionDefinition_Report_Item_t& s, ran_function_definition_report_item_s& d)
705{
706 std::string name;
707 if (!get_printable(s.ric_ReportStyle_Name, 1, k_name_max, name)) {
708 return false;
709 }
710 d.ric_report_style_type = s.ric_ReportStyle_Type;
711 d.ric_report_style_name.from_string(name);
712 d.ric_ind_hdr_format_type = s.ric_IndicationHeaderFormat_Type;
713 d.ric_ind_msg_format_type = s.ric_IndicationMessageFormat_Type;
714 return get_opt_subs(s.dappE3Subscriptions, d.dapp_e3_subscriptions_present, d.dapp_e3_subscriptions);
715}
716
717bool from_asn(const RANFunctionDefinition_Control_Item_t& s, ran_function_definition_ctrl_item_s& d)
718{
719 std::string name;
720 if (!get_printable(s.ric_ControlStyle_Name, 1, k_name_max, name)) {
721 return false;
722 }
723 d.ric_ctrl_style_type = s.ric_ControlStyle_Type;
724 d.ric_ctrl_style_name.from_string(name);
725 d.ric_ctrl_hdr_format_type = s.ric_ControlHeaderFormat_Type;
726 d.ric_ctrl_msg_format_type = s.ric_ControlMessageFormat_Type;
727 d.ric_ctrl_outcome_format_type = s.ric_ControlOutcomeFormat_Type;
728 return get_opt_subs(s.dappE3Subscriptions, d.dapp_e3_subscriptions_present, d.dapp_e3_subscriptions);
729}
730
731bool from_asn(const E2SM_DAPP_RANFunctionDefinition_t& s, e2sm_dapp_ran_function_definition_s& d)
732{
733 if (s.ranFunction_Name == nullptr || !from_asn(*s.ranFunction_Name, d.ran_function_name)) {
734 return false;
735 }
736 d.ran_function_definition_event_trigger_present = (s.ranFunctionDefinition_EventTrigger != nullptr);
737
738 d.ran_function_definition_report_present = (s.ranFunctionDefinition_Report != nullptr);
739 if (d.ran_function_definition_report_present) {
740 const auto& l = s.ranFunctionDefinition_Report->ric_ReportStyle_List.list;
741 if (l.count < 1 || static_cast<size_t>(l.count) > k_max_report_sty) {
742 return false;
743 }
744 d.ran_function_definition_report.ric_report_style_list.resize(static_cast<size_t>(l.count));
745 for (int i = 0; i < l.count; ++i) {
746 if (l.array[i] == nullptr ||
747 !from_asn(*l.array[i], d.ran_function_definition_report.ric_report_style_list[static_cast<size_t>(i)])) {
748 return false;
749 }
750 }
751 }
752
753 d.ran_function_definition_ctrl_present = (s.ranFunctionDefinition_Control != nullptr);
754 if (d.ran_function_definition_ctrl_present) {
755 const auto& l = s.ranFunctionDefinition_Control->ric_ControlStyle_List.list;
756 if (l.count < 1 || static_cast<size_t>(l.count) > k_max_ctrl_sty) {
757 return false;
758 }
759 d.ran_function_definition_ctrl.ric_ctrl_style_list.resize(static_cast<size_t>(l.count));
760 for (int i = 0; i < l.count; ++i) {
761 if (l.array[i] == nullptr ||
762 !from_asn(*l.array[i], d.ran_function_definition_ctrl.ric_ctrl_style_list[static_cast<size_t>(i)])) {
763 return false;
764 }
765 }
766 }
767 return true;
768}
769
770bool from_asn(const E2SM_DAPP_IndicationHeader_Format1_t& s, e2sm_dapp_ind_hdr_format1_s& d)
771{
772 if (!get_u32(s.ran_function_id, d.ran_function_id) || !get_u32(s.dapp_id, d.dapp_id) ||
773 !get_node_type(s.node_type, d.node_type) || !get_plmn(s.node_plmn_id, d.node_plmn_id) ||
774 !get_u32(s.node_nb_id, d.node_nb_id) ||
775 !get_opt_u32(s.node_cu_du_id, d.node_cu_du_id_present, d.node_cu_du_id)) {
776 return false;
777 }
778 get_opt_long(s.timestamp, d.timestamp_present, d.timestamp);
779 get_opt_long(s.sequence_id, d.sequence_id_present, d.sequence_id);
780 return true;
781}
782
783bool from_asn(const E2SM_DAPP_IndicationHeader_Format2_t& s, e2sm_dapp_ind_hdr_format2_s& d)
784{
785 if (!get_node_type(s.node_type, d.node_type) || !get_plmn(s.node_plmn_id, d.node_plmn_id) ||
786 !get_u32(s.node_nb_id, d.node_nb_id) ||
787 !get_opt_u32(s.node_cu_du_id, d.node_cu_du_id_present, d.node_cu_du_id)) {
788 return false;
789 }
790 get_opt_long(s.timestamp, d.timestamp_present, d.timestamp);
791 get_opt_long(s.sequence_id, d.sequence_id_present, d.sequence_id);
792 return true;
793}
794
795bool from_asn(const E2SM_DAPP_ControlHeader_Format1_t& s, e2sm_dapp_ctrl_hdr_format1_s& d)
796{
797 if (!get_u32(s.ran_function_id, d.ran_function_id) || !get_u32(s.dapp_id, d.dapp_id)) {
798 return false;
799 }
800 get_opt_long(s.timestamp, d.timestamp_present, d.timestamp);
801 get_opt_long(s.sequence_id, d.sequence_id_present, d.sequence_id);
802 return true;
803}
804
805bool from_asn(const E2SM_DAPP_ControlOutcome_Format1_t& s, e2sm_dapp_ctrl_outcome_format1_s& d)
806{
807 get_opt_long(s.timestamp, d.timestamp_present, d.timestamp);
808 get_opt_long(s.sequence_id, d.sequence_id_present, d.sequence_id);
809 d.e3_ctrl_outcome_present = (s.e3_control_outcome != nullptr);
810 if (d.e3_ctrl_outcome_present) {
811 if (s.e3_control_outcome->buf == nullptr && s.e3_control_outcome->size != 0) {
812 return false;
813 }
814 d.e3_ctrl_outcome.from_bytes(s.e3_control_outcome->buf, s.e3_control_outcome->size);
815 }
816 return true;
817}
818
819/// The shared body of every unpack(): decode, convert into a temporary, move it in on success only.
820template <class T, class Cpp, class Convert>
821asn_code unpack_pdu(const asn_TYPE_descriptor_t& td, const uint8_t* data, size_t len, Cpp& self, Convert convert)
822{
823 if (data == nullptr || len == 0) {
825 }
826 try {
827 Owned<T> pdu(td);
828 void* p = nullptr;
829 auto rv = aper_decode(nullptr, &td, &p, data, len, 0, 0);
830 // asn1c leaves a half-built struct behind on failure: always take it over to free it.
831 pdu.adopt(static_cast<T*>(p));
832 if (rv.code != RC_OK || pdu.get() == nullptr) {
834 }
835 Cpp tmp;
836 if (!convert(*pdu.get(), tmp)) {
838 }
839 self = std::move(tmp);
840 return ASN_SUCCESS;
841 } catch (...) {
843 }
844}
845
846} // namespace
847
848// ---------------------------------------------------------------------------
849// Event trigger
850// ---------------------------------------------------------------------------
851
852asn_code e2sm_dapp_event_trigger_s::pack(std::vector<uint8_t>& out) const
853{
854 return pack_pdu<E2SM_DAPP_EventTrigger_t>(asn_DEF_E2SM_DAPP_EventTrigger, out, [](E2SM_DAPP_EventTrigger_t& d) {
855 d.ric_eventTrigger_formats.present = E2SM_DAPP_EventTrigger__ric_eventTrigger_formats_PR_eventTrigger_Format1;
856 d.ric_eventTrigger_formats.choice.eventTrigger_Format1 = zalloc<E2SM_DAPP_EventTrigger_Format1_t>();
857 return d.ric_eventTrigger_formats.choice.eventTrigger_Format1 != nullptr;
858 });
859}
860
861asn_code e2sm_dapp_event_trigger_s::unpack(const uint8_t* data, size_t len)
862{
863 return unpack_pdu<E2SM_DAPP_EventTrigger_t>(
864 asn_DEF_E2SM_DAPP_EventTrigger, data, len, *this, [](const E2SM_DAPP_EventTrigger_t& s, e2sm_dapp_event_trigger_s&) {
865 return s.ric_eventTrigger_formats.present ==
866 E2SM_DAPP_EventTrigger__ric_eventTrigger_formats_PR_eventTrigger_Format1;
867 });
868}
869
870// ---------------------------------------------------------------------------
871// Action definition
872// ---------------------------------------------------------------------------
873
874asn_code e2sm_dapp_action_definition_s::pack(std::vector<uint8_t>& out) const
875{
876 return pack_pdu<E2SM_DAPP_ActionDefinition_t>(
877 asn_DEF_E2SM_DAPP_ActionDefinition, out, [this](E2SM_DAPP_ActionDefinition_t& d) {
878 if (!set_long(d.ric_Style_Type, ric_style_type)) {
879 return false;
880 }
881 d.actionDefinition_formats.present =
882 E2SM_DAPP_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format1;
883 d.actionDefinition_formats.choice.actionDefinition_Format1 =
884 zalloc<E2SM_DAPP_ActionDefinition_Format1_t>();
885 return d.actionDefinition_formats.choice.actionDefinition_Format1 != nullptr;
886 });
887}
888
889asn_code e2sm_dapp_action_definition_s::unpack(const uint8_t* data, size_t len)
890{
891 return unpack_pdu<E2SM_DAPP_ActionDefinition_t>(
892 asn_DEF_E2SM_DAPP_ActionDefinition,
893 data,
894 len,
895 *this,
896 [](const E2SM_DAPP_ActionDefinition_t& s, e2sm_dapp_action_definition_s& d) {
897 if (s.actionDefinition_formats.present !=
898 E2SM_DAPP_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format1) {
899 return false;
900 }
901 d.ric_style_type = static_cast<int64_t>(s.ric_Style_Type);
902 return true;
903 });
904}
905
906// ---------------------------------------------------------------------------
907// Indication header
908// ---------------------------------------------------------------------------
909
910asn_code e2sm_dapp_ind_hdr_s::pack(std::vector<uint8_t>& out) const
911{
912 return pack_pdu<E2SM_DAPP_IndicationHeader_t>(
913 asn_DEF_E2SM_DAPP_IndicationHeader, out, [this](E2SM_DAPP_IndicationHeader_t& d) {
914 using types = ric_ind_hdr_formats_c_::types;
915 switch (ric_ind_hdr_formats.type().value) {
916 case types::ind_hdr_format1: {
917 auto* f = zalloc<E2SM_DAPP_IndicationHeader_Format1_t>();
918 d.ric_indicationHeader_formats.present =
919 E2SM_DAPP_IndicationHeader__ric_indicationHeader_formats_PR_indicationHeader_Format1;
920 d.ric_indicationHeader_formats.choice.indicationHeader_Format1 = f;
921 return f != nullptr && build(ric_ind_hdr_formats.ind_hdr_format1(), *f);
922 }
923 case types::ind_hdr_format2: {
924 auto* f = zalloc<E2SM_DAPP_IndicationHeader_Format2_t>();
925 d.ric_indicationHeader_formats.present =
926 E2SM_DAPP_IndicationHeader__ric_indicationHeader_formats_PR_indicationHeader_Format2;
927 d.ric_indicationHeader_formats.choice.indicationHeader_Format2 = f;
928 return f != nullptr && build(ric_ind_hdr_formats.ind_hdr_format2(), *f);
929 }
930 default:
931 return false;
932 }
933 });
934}
935
936asn_code e2sm_dapp_ind_hdr_s::unpack(const uint8_t* data, size_t len)
937{
938 return unpack_pdu<E2SM_DAPP_IndicationHeader_t>(
939 asn_DEF_E2SM_DAPP_IndicationHeader,
940 data,
941 len,
942 *this,
943 [](const E2SM_DAPP_IndicationHeader_t& s, e2sm_dapp_ind_hdr_s& d) {
944 switch (s.ric_indicationHeader_formats.present) {
945 case E2SM_DAPP_IndicationHeader__ric_indicationHeader_formats_PR_indicationHeader_Format1:
946 return s.ric_indicationHeader_formats.choice.indicationHeader_Format1 != nullptr &&
947 from_asn(*s.ric_indicationHeader_formats.choice.indicationHeader_Format1,
949 case E2SM_DAPP_IndicationHeader__ric_indicationHeader_formats_PR_indicationHeader_Format2:
950 return s.ric_indicationHeader_formats.choice.indicationHeader_Format2 != nullptr &&
951 from_asn(*s.ric_indicationHeader_formats.choice.indicationHeader_Format2,
953 default:
954 return false;
955 }
956 });
957}
958
959// ---------------------------------------------------------------------------
960// Indication message
961// ---------------------------------------------------------------------------
962
963asn_code e2sm_dapp_ind_msg_s::pack(std::vector<uint8_t>& out) const
964{
965 return pack_pdu<E2SM_DAPP_IndicationMessage_t>(
966 asn_DEF_E2SM_DAPP_IndicationMessage, out, [this](E2SM_DAPP_IndicationMessage_t& d) {
967 using types = ric_ind_msg_formats_c_::types;
968 switch (ric_ind_msg_formats.type().value) {
969 case types::ind_msg_format1: {
970 auto* f = zalloc<E2SM_DAPP_IndicationMessage_Format1_t>();
971 d.ric_indicationMessage_formats.present =
972 E2SM_DAPP_IndicationMessage__ric_indicationMessage_formats_PR_indicationMessage_Format1;
973 d.ric_indicationMessage_formats.choice.indicationMessage_Format1 = f;
974 const auto& s = ric_ind_msg_formats.ind_msg_format1();
975 return f != nullptr && build_data(s.data_size, s.data, f->data_size, f->data);
976 }
977 case types::ind_msg_format2: {
978 auto* f = zalloc<E2SM_DAPP_IndicationMessage_Format2_t>();
979 d.ric_indicationMessage_formats.present =
980 E2SM_DAPP_IndicationMessage__ric_indicationMessage_formats_PR_indicationMessage_Format2;
981 d.ric_indicationMessage_formats.choice.indicationMessage_Format2 = f;
982 if (f == nullptr) {
983 return false;
984 }
985 f->dappE3Subscriptions = zalloc<DAppE3Subscription_List_t>();
986 return f->dappE3Subscriptions != nullptr &&
987 build_subs(ric_ind_msg_formats.ind_msg_format2().dapp_e3_subscriptions,
988 *f->dappE3Subscriptions);
989 }
990 default:
991 return false;
992 }
993 });
994}
995
996asn_code e2sm_dapp_ind_msg_s::unpack(const uint8_t* data, size_t len)
997{
998 return unpack_pdu<E2SM_DAPP_IndicationMessage_t>(
999 asn_DEF_E2SM_DAPP_IndicationMessage,
1000 data,
1001 len,
1002 *this,
1003 [](const E2SM_DAPP_IndicationMessage_t& s, e2sm_dapp_ind_msg_s& d) {
1004 switch (s.ric_indicationMessage_formats.present) {
1005 case E2SM_DAPP_IndicationMessage__ric_indicationMessage_formats_PR_indicationMessage_Format1: {
1006 const auto* f = s.ric_indicationMessage_formats.choice.indicationMessage_Format1;
1008 return f != nullptr && get_data(f->data_size, f->data, c.data_size, c.data);
1009 }
1010 case E2SM_DAPP_IndicationMessage__ric_indicationMessage_formats_PR_indicationMessage_Format2: {
1011 const auto* f = s.ric_indicationMessage_formats.choice.indicationMessage_Format2;
1013 return f != nullptr && f->dappE3Subscriptions != nullptr &&
1014 get_subs(*f->dappE3Subscriptions, c.dapp_e3_subscriptions);
1015 }
1016 default:
1017 return false;
1018 }
1019 });
1020}
1021
1022// ---------------------------------------------------------------------------
1023// Control header
1024// ---------------------------------------------------------------------------
1025
1026asn_code e2sm_dapp_ctrl_hdr_s::pack(std::vector<uint8_t>& out) const
1027{
1028 return pack_pdu<E2SM_DAPP_ControlHeader_t>(
1029 asn_DEF_E2SM_DAPP_ControlHeader, out, [this](E2SM_DAPP_ControlHeader_t& d) {
1030 auto* f = zalloc<E2SM_DAPP_ControlHeader_Format1_t>();
1031 d.ric_controlHeader_formats.present =
1032 E2SM_DAPP_ControlHeader__ric_controlHeader_formats_PR_controlHeader_Format1;
1033 d.ric_controlHeader_formats.choice.controlHeader_Format1 = f;
1034 return f != nullptr && build(ric_ctrl_hdr_formats.ctrl_hdr_format1(), *f);
1035 });
1036}
1037
1038asn_code e2sm_dapp_ctrl_hdr_s::unpack(const uint8_t* data, size_t len)
1039{
1040 return unpack_pdu<E2SM_DAPP_ControlHeader_t>(
1041 asn_DEF_E2SM_DAPP_ControlHeader,
1042 data,
1043 len,
1044 *this,
1045 [](const E2SM_DAPP_ControlHeader_t& s, e2sm_dapp_ctrl_hdr_s& d) {
1046 return s.ric_controlHeader_formats.present ==
1047 E2SM_DAPP_ControlHeader__ric_controlHeader_formats_PR_controlHeader_Format1 &&
1048 s.ric_controlHeader_formats.choice.controlHeader_Format1 != nullptr &&
1049 from_asn(*s.ric_controlHeader_formats.choice.controlHeader_Format1,
1051 });
1052}
1053
1054// ---------------------------------------------------------------------------
1055// Control message
1056// ---------------------------------------------------------------------------
1057
1058asn_code e2sm_dapp_ctrl_msg_s::pack(std::vector<uint8_t>& out) const
1059{
1060 return pack_pdu<E2SM_DAPP_ControlMessage_t>(
1061 asn_DEF_E2SM_DAPP_ControlMessage, out, [this](E2SM_DAPP_ControlMessage_t& d) {
1062 auto* f = zalloc<E2SM_DAPP_ControlMessage_Format1_t>();
1063 d.ric_controlMessage_formats.present =
1064 E2SM_DAPP_ControlMessage__ric_controlMessage_formats_PR_controlMessage_Format1;
1065 d.ric_controlMessage_formats.choice.controlMessage_Format1 = f;
1066 const auto& s = ric_ctrl_msg_formats.ctrl_msg_format1();
1067 return f != nullptr && build_data(s.data_size, s.data, f->data_size, f->data);
1068 });
1069}
1070
1071asn_code e2sm_dapp_ctrl_msg_s::unpack(const uint8_t* data, size_t len)
1072{
1073 return unpack_pdu<E2SM_DAPP_ControlMessage_t>(
1074 asn_DEF_E2SM_DAPP_ControlMessage,
1075 data,
1076 len,
1077 *this,
1078 [](const E2SM_DAPP_ControlMessage_t& s, e2sm_dapp_ctrl_msg_s& d) {
1079 if (s.ric_controlMessage_formats.present !=
1080 E2SM_DAPP_ControlMessage__ric_controlMessage_formats_PR_controlMessage_Format1) {
1081 return false;
1082 }
1083 const auto* f = s.ric_controlMessage_formats.choice.controlMessage_Format1;
1085 return f != nullptr && get_data(f->data_size, f->data, c.data_size, c.data);
1086 });
1087}
1088
1089// ---------------------------------------------------------------------------
1090// Control outcome
1091// ---------------------------------------------------------------------------
1092
1093asn_code e2sm_dapp_ctrl_outcome_s::pack(std::vector<uint8_t>& out) const
1094{
1095 return pack_pdu<E2SM_DAPP_ControlOutcome_t>(
1096 asn_DEF_E2SM_DAPP_ControlOutcome, out, [this](E2SM_DAPP_ControlOutcome_t& d) {
1097 auto* f = zalloc<E2SM_DAPP_ControlOutcome_Format1_t>();
1098 d.ric_controlOutcome_formats.present =
1099 E2SM_DAPP_ControlOutcome__ric_controlOutcome_formats_PR_controlOutcome_Format1;
1100 d.ric_controlOutcome_formats.choice.controlOutcome_Format1 = f;
1101 return f != nullptr && build(ric_ctrl_outcome_formats.ctrl_outcome_format1(), *f);
1102 });
1103}
1104
1105asn_code e2sm_dapp_ctrl_outcome_s::unpack(const uint8_t* data, size_t len)
1106{
1107 return unpack_pdu<E2SM_DAPP_ControlOutcome_t>(
1108 asn_DEF_E2SM_DAPP_ControlOutcome,
1109 data,
1110 len,
1111 *this,
1112 [](const E2SM_DAPP_ControlOutcome_t& s, e2sm_dapp_ctrl_outcome_s& d) {
1113 return s.ric_controlOutcome_formats.present ==
1114 E2SM_DAPP_ControlOutcome__ric_controlOutcome_formats_PR_controlOutcome_Format1 &&
1115 s.ric_controlOutcome_formats.choice.controlOutcome_Format1 != nullptr &&
1116 from_asn(*s.ric_controlOutcome_formats.choice.controlOutcome_Format1,
1118 });
1119}
1120
1121// ---------------------------------------------------------------------------
1122// RAN function definition
1123// ---------------------------------------------------------------------------
1124
1126{
1127 return pack_pdu<E2SM_DAPP_RANFunctionDefinition_t>(
1128 asn_DEF_E2SM_DAPP_RANFunctionDefinition,
1129 out,
1130 [this](E2SM_DAPP_RANFunctionDefinition_t& d) { return build(*this, d); });
1131}
1132
1134{
1135 return unpack_pdu<E2SM_DAPP_RANFunctionDefinition_t>(
1136 asn_DEF_E2SM_DAPP_RANFunctionDefinition,
1137 data,
1138 len,
1139 *this,
1140 [](const E2SM_DAPP_RANFunctionDefinition_t& s, e2sm_dapp_ran_function_definition_s& d) {
1141 return from_asn(s, d);
1142 });
1143}
1144
1145} // namespace e2sm_dapp
1146} // namespace libe3
OCTET STRING (SIZE(N)).
E2SM-DAPP information elements and their APER codec (C++ API).
@ ASN_ERROR_ENCODE_FAIL
a value is outside its ASN.1 constraint, or the buffer cannot be built
Definition e2sm_dapp.hpp:49
@ ASN_ERROR_DECODE_FAIL
the bytes are not a valid APER encoding of the type
Definition e2sm_dapp.hpp:50
constexpr int64_t max_e2sm_dapp_ctrl_msg_size
Largest control message data, in octets.
constexpr int64_t maxnoof_dapp_control_styles
Most control styles in a RAN function definition.
constexpr int64_t max_e2sm_dapp_ind_msg_size
Largest indication message data, in octets.
constexpr int64_t maxnoof_dapps
Most dApps in a dApp E3 subscription list.
constexpr int64_t maxnoof_subscribed_e3_ran_functions
Most E3 RAN functions one dApp can subscribe to.
constexpr int64_t maxnoof_dapp_report_styles
Most report styles in a RAN function definition.
dyn_array< dapp_e3_subscription_item_s > dapp_e3_subscription_list_l
The dApp E3 subscription map, 0 to 256 items (ASN.1 DAppE3Subscription-List ::= SEQUENCE (SIZE (0....
Action definition of a subscription, which selects the report style (ASN.1 E2SM-DAPP-ActionDefinition...
int64_t ric_style_type
Report style the subscription selects (1 or 2); it selects the indication formats.
asn_code unpack(const uint8_t *data, size_t len)
asn_code pack(std::vector< uint8_t > &out) const
Control header format 1: where a control goes (ASN.1 E2SM-DAPP-ControlHeader-Format1 ::= SEQUENCE).
bool timestamp_present
true when timestamp is present
bool operator==(const e2sm_dapp_ctrl_hdr_format1_s &o) const
bool sequence_id_present
true when sequence_id is present
int64_t sequence_id
Id of the procedure, echoed from the indication header; absent or 0 means the RAN cannot defer the ac...
uint64_t ran_function_id
E3 RAN function id the control is for.
uint64_t dapp_id
The dApp that is the target of the control.
int64_t timestamp
When the xApp built the control, in nanoseconds on the realtime clock of its host.
Control header (ASN.1 E2SM-DAPP-ControlHeader ::= SEQUENCE (top-level)).
asn_code pack(std::vector< uint8_t > &out) const
asn_code unpack(const uint8_t *data, size_t len)
ric_ctrl_hdr_formats_c_ ric_ctrl_hdr_formats
Format of the element, a CHOICE with one alternative per format.
Control message (ASN.1 E2SM-DAPP-ControlMessage ::= SEQUENCE (top-level)).
ric_ctrl_msg_formats_c_ ric_ctrl_msg_formats
Format of the element, a CHOICE with one alternative per format.
asn_code pack(std::vector< uint8_t > &out) const
asn_code unpack(const uint8_t *data, size_t len)
Control outcome format 1: the answer to a control (ASN.1 E2SM-DAPP-ControlOutcome-Format1 ::= SEQUENC...
bool e3_ctrl_outcome_present
true when e3_ctrl_outcome is present
int64_t timestamp
When the RAN built the outcome, in nanoseconds on its realtime clock.
bool sequence_id_present
true when sequence_id is present
bool operator==(const e2sm_dapp_ctrl_outcome_format1_s &o) const
int64_t sequence_id
Procedure this outcome answers, copied from the control header.
bool timestamp_present
true when timestamp is present
unbounded_octstring< true > e3_ctrl_outcome
Account of the service model on applying the control; E2SM-DAPP does not interpret it.
Control outcome (ASN.1 E2SM-DAPP-ControlOutcome ::= SEQUENCE (top-level)).
asn_code pack(std::vector< uint8_t > &out) const
asn_code unpack(const uint8_t *data, size_t len)
ric_ctrl_outcome_formats_c_ ric_ctrl_outcome_formats
Format of the element, a CHOICE with one alternative per format.
Event trigger definition of a subscription (ASN.1 E2SM-DAPP-EventTrigger ::= SEQUENCE (top-level)).
asn_code unpack(const uint8_t *data, size_t len)
asn_code pack(std::vector< uint8_t > &out) const
Indication header format 1: the header of a dApp report (ASN.1 E2SM-DAPP-IndicationHeader-Format1 ::=...
bool node_cu_du_id_present
true when node_cu_du_id is present
uint8_t node_type
Type of the reporting node (0 to 255).
uint64_t ran_function_id
E3 RAN function id of the report, not the E2 RAN function id.
fixed_octstring< 3, true > node_plmn_id
PLMN id of the node, 3 octets.
uint64_t dapp_id
The dApp that sent the report.
int64_t sequence_id
Correlation id of the dApp for this report, copied from the E3 report.
bool sequence_id_present
true when sequence_id is present
int64_t timestamp
When the RAN built the indication, in nanoseconds on its realtime clock.
bool timestamp_present
true when timestamp is present
uint64_t node_cu_du_id
CU or DU id inside the node.
bool operator==(const e2sm_dapp_ind_hdr_format1_s &o) const
Indication header format 2: the header of a subscription map (ASN.1 E2SM-DAPP-IndicationHeader-Format...
uint64_t node_cu_du_id
CU or DU id inside the node.
bool timestamp_present
true when timestamp is present
int64_t timestamp
When the RAN built the indication, in nanoseconds on its realtime clock.
fixed_octstring< 3, true > node_plmn_id
PLMN id of the node, 3 octets.
bool sequence_id_present
true when sequence_id is present
bool node_cu_du_id_present
true when node_cu_du_id is present
bool operator==(const e2sm_dapp_ind_hdr_format2_s &o) const
uint8_t node_type
Type of the reporting node (0 to 255).
int64_t sequence_id
Correlation id; a subscription map has no procedure, so a RAN leaves it absent.
enumerated< types_opts, true > types
The selected alternative as an enumerated value.
Indication header (ASN.1 E2SM-DAPP-IndicationHeader ::= SEQUENCE (top-level)).
asn_code pack(std::vector< uint8_t > &out) const
asn_code unpack(const uint8_t *data, size_t len)
ric_ind_hdr_formats_c_ ric_ind_hdr_formats
Format of the element, a CHOICE with one alternative per format.
enumerated< types_opts, true > types
The selected alternative as an enumerated value.
Indication message (ASN.1 E2SM-DAPP-IndicationMessage ::= SEQUENCE (top-level)).
asn_code pack(std::vector< uint8_t > &out) const
asn_code unpack(const uint8_t *data, size_t len)
ric_ind_msg_formats_c_ ric_ind_msg_formats
Format of the element, a CHOICE with one alternative per format.
RAN function definition, announced in E2 Setup and RIC Service Update (ASN.1 E2SM-DAPP-RANFunctionDef...
bool operator==(const e2sm_dapp_ran_function_definition_s &o) const
Definition e2sm_dapp.cpp:89
bool ran_function_definition_report_present
true when ran_function_definition_report is present
ran_function_definition_ctrl_s ran_function_definition_ctrl
Control section.
bool ran_function_definition_ctrl_present
true when ran_function_definition_ctrl is present
asn_code unpack(const uint8_t *data, size_t len)
ran_function_name_s ran_function_name
Name of the RAN function.
bool ran_function_definition_event_trigger_present
true when ran_function_definition_event_trigger is present
asn_code pack(std::vector< uint8_t > &out) const
ran_function_definition_report_s ran_function_definition_report
Report section.
One control style of the RAN function definition (ASN.1 RANFunctionDefinition-Control-Item ::= SEQUEN...
bool dapp_e3_subscriptions_present
true when dapp_e3_subscriptions is present
bool operator==(const ran_function_definition_ctrl_item_s &o) const
Definition e2sm_dapp.cpp:79
int64_t ric_ctrl_outcome_format_type
Control outcome format the style uses.
int64_t ric_ctrl_style_type
Control style number (1).
dapp_e3_subscription_list_l dapp_e3_subscriptions
dApp E3 subscription map (0 to 256 items)
printable_string< 1, 150, true, true > ric_ctrl_style_name
Control style name, 1 to 150 characters.
int64_t ric_ctrl_hdr_format_type
Control header format the style uses.
int64_t ric_ctrl_msg_format_type
Control message format the style uses.
Control section of the RAN function definition (ASN.1 RANFunctionDefinition-Control ::= SEQUENCE).
One report style of the RAN function definition (ASN.1 RANFunctionDefinition-Report-Item ::= SEQUENCE...
int64_t ric_report_style_type
Report style number (1 or 2).
int64_t ric_ind_hdr_format_type
Indication header format the style produces.
dapp_e3_subscription_list_l dapp_e3_subscriptions
dApp E3 subscription map (0 to 256 items)
bool operator==(const ran_function_definition_report_item_s &o) const
Definition e2sm_dapp.cpp:70
int64_t ric_ind_msg_format_type
Indication message format the style produces.
bool dapp_e3_subscriptions_present
true when dapp_e3_subscriptions is present
printable_string< 1, 150, true, true > ric_report_style_name
Report style name, 1 to 150 characters.
Report section of the RAN function definition (ASN.1 RANFunctionDefinition-Report ::= SEQUENCE).
Name, OID and description of the RAN function (ASN.1 RANfunction-Name ::= SEQUENCE).
printable_string< 1, 150, true, true > ran_function_description
Description, 1 to 150 characters.
printable_string< 1, 150, true, true > ran_function_short_name
Short name (E2SM-DAPP), 1 to 150 characters.
int64_t ran_function_instance
Instance number; not used, a sender shall not set it.
bool operator==(const ran_function_name_s &o) const
Definition e2sm_dapp.cpp:61
printable_string< 1, 1000, true, true > ran_function_e2sm_o_id
Service model OID, 1 to 1000 characters.
bool ran_function_instance_present
true when ran_function_instance is present