2 * Copyright 2019 AT&T Intellectual Property
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 // Created by adi ENZEL on 12/10/19.
22 #ifndef E2_E2BUILDER_H
23 #define E2_E2BUILDER_H
29 #include <sys/types.h>
32 #include <3rdparty/oranE2SM/E2SM-gNB-NRT-RANfunction-Definition.h>
33 #include <3rdparty/oranE2SM/RIC-InsertStyle-List.h>
34 #include <3rdparty/oranE2SM/RANparameterDef-Item.h>
35 #include <3rdparty/oranE2/GlobalE2node-en-gNB-ID.h>
36 #include <3rdparty/oranE2/RICsubsequentAction.h>
39 //#include <mdclog/mdclog.h>
42 #include "oranE2/E2AP-PDU.h"
43 #include "oranE2/InitiatingMessage.h"
44 #include "oranE2/SuccessfulOutcome.h"
45 #include "oranE2/UnsuccessfulOutcome.h"
47 #include "oranE2/ProtocolIE-Field.h"
48 #include "oranE2/ENB-ID.h"
49 #include "oranE2/GlobalENB-ID.h"
50 #include "oranE2/GlobalE2node-gNB-ID.h"
51 #include "oranE2/constr_TYPE.h"
52 #include "oranE2/asn_constant.h"
56 #define printEntry(type, function); fprintf(stdout, "start Test %s , %s", type, function);
59 static void checkAndPrint(asn_TYPE_descriptor_t *typeDescriptor, void *data, char *dataType, const char *function) {
60 char errbuf[128]; /* Buffer for error message */
61 size_t errlen = sizeof(errbuf); /* Size of the buffer */
62 if (asn_check_constraints(typeDescriptor, data, errbuf, &errlen) != 0) {
63 fprintf(stderr, "%s Constraint validation failed: %s", dataType, errbuf);
65 fprintf(stdout, "%s successes function %s", dataType, function);
68 void createPLMN_IDByMCCandMNC(PLMN_Identity_t *plmnId, int mcc, int mnc) {
70 //printEntry("PLMN_Identity_t", __func__)
72 ASN_STRUCT_RESET(asn_DEF_PLMN_Identity, plmnId);
74 plmnId->buf = (uint8_t *) calloc(1, 3);
75 volatile auto mcc1 = (unsigned int) (mcc / 100);
76 volatile auto mcc2 = (unsigned int) (mcc / 10 % 10);
77 volatile auto mcc3 = (unsigned int) (mcc % 10);
78 plmnId->buf[0] = mcc2 << 4 | mcc1;
80 volatile auto mnc1 = (unsigned int)0;
81 volatile auto mnc2 = (unsigned int)0;
82 volatile auto mnc3 = (unsigned int)0;
85 mnc1 = (unsigned int) (mnc / 100);
86 mnc2 = (unsigned int) (mnc / 10 % 10);
87 mnc3 = (unsigned int) (mnc % 10);
89 mnc1 = (unsigned int) (mnc / 10);
90 mnc2 = (unsigned int) (mnc % 10);
93 plmnId->buf[1] = mcc3 << 4 | mnc3 ;
94 plmnId->buf[2] = mnc2 << 4 | mnc1 ;
96 //checkAndPrint(&asn_DEF_PLMN_Identity, plmnId, (char *) "PLMN_Identity_t", __func__);
101 PLMN_Identity_t *createPLMN_ID(const unsigned char *data) {
102 printEntry("PLMN_Identity_t", __func__)
103 auto *plmnId = (PLMN_Identity_t *) calloc(1, sizeof(PLMN_Identity_t));
104 ASN_STRUCT_RESET(asn_DEF_PLMN_Identity, plmnId);
106 plmnId->buf = (uint8_t *) calloc(1, 3);
107 memcpy(plmnId->buf, data, 3);
109 checkAndPrint(&asn_DEF_PLMN_Identity, plmnId, (char *) "PLMN_Identity_t", __func__);
114 BIT_STRING_t *createBIT_STRING(int size, int unusedBits, uint8_t *data) {
115 printEntry("BIT_STRING_t", __func__)
116 auto *bitString = (BIT_STRING_t *) calloc(1, sizeof(BIT_STRING_t));
117 ASN_STRUCT_RESET(asn_DEF_BIT_STRING, bitString);
118 bitString->size = size;
119 bitString->bits_unused = unusedBits;
120 bitString->buf = (uint8_t *) calloc(1, size);
122 data[bitString->size - 1] = ((unsigned) (data[bitString->size - 1] >>
123 (unsigned) bitString->bits_unused)
124 << (unsigned) bitString->bits_unused);
125 memcpy(bitString->buf, data, size);
127 checkAndPrint(&asn_DEF_BIT_STRING, bitString, (char *) "BIT_STRING_t", __func__);
133 OCTET_STRING_t *createOCTET_STRING(const unsigned char *data, int size) {
134 printEntry("OCTET_STRING_t", __func__)
135 auto *octs = (PLMN_Identity_t *) calloc(1, sizeof(PLMN_Identity_t));
136 ASN_STRUCT_RESET(asn_DEF_OCTET_STRING, octs);
138 octs->buf = (uint8_t *) calloc(1, size);
139 memcpy(octs->buf, data, size);
141 checkAndPrint(&asn_DEF_OCTET_STRING, octs, (char *) "OCTET_STRING_t", __func__);
146 ENB_ID_t *createENB_ID(ENB_ID_PR enbType, unsigned char *data) {
147 printEntry("ENB_ID_t", __func__)
148 auto *enb = (ENB_ID_t *) calloc(1, sizeof(ENB_ID_t));
149 ASN_STRUCT_RESET(asn_DEF_ENB_ID, enb);
151 enb->present = enbType;
154 case ENB_ID_PR_macro_eNB_ID: { // 20 bit 3 bytes
155 enb->choice.macro_eNB_ID.size = 3;
156 enb->choice.macro_eNB_ID.bits_unused = 4;
158 enb->present = ENB_ID_PR_macro_eNB_ID;
160 enb->choice.macro_eNB_ID.buf = (uint8_t *) calloc(1, enb->choice.macro_eNB_ID.size);
161 data[enb->choice.macro_eNB_ID.size - 1] = ((unsigned) (data[enb->choice.macro_eNB_ID.size - 1] >>
162 (unsigned) enb->choice.macro_eNB_ID.bits_unused)
163 << (unsigned) enb->choice.macro_eNB_ID.bits_unused);
164 memcpy(enb->choice.macro_eNB_ID.buf, data, enb->choice.macro_eNB_ID.size);
168 case ENB_ID_PR_home_eNB_ID: { // 28 bit 4 bytes
169 enb->choice.home_eNB_ID.size = 4;
170 enb->choice.home_eNB_ID.bits_unused = 4;
171 enb->present = ENB_ID_PR_home_eNB_ID;
173 enb->choice.home_eNB_ID.buf = (uint8_t *) calloc(1, enb->choice.home_eNB_ID.size);
174 data[enb->choice.home_eNB_ID.size - 1] = ((unsigned) (data[enb->choice.home_eNB_ID.size - 1] >>
175 (unsigned) enb->choice.home_eNB_ID.bits_unused)
176 << (unsigned) enb->choice.home_eNB_ID.bits_unused);
177 memcpy(enb->choice.home_eNB_ID.buf, data, enb->choice.home_eNB_ID.size);
180 case ENB_ID_PR_short_Macro_eNB_ID: { // 18 bit - 3 bytes
181 enb->choice.short_Macro_eNB_ID.size = 3;
182 enb->choice.short_Macro_eNB_ID.bits_unused = 6;
183 enb->present = ENB_ID_PR_short_Macro_eNB_ID;
185 enb->choice.short_Macro_eNB_ID.buf = (uint8_t *) calloc(1, enb->choice.short_Macro_eNB_ID.size);
186 data[enb->choice.short_Macro_eNB_ID.size - 1] = (
187 (unsigned) (data[enb->choice.short_Macro_eNB_ID.size - 1] >>
188 (unsigned) enb->choice.short_Macro_eNB_ID.bits_unused)
189 << (unsigned) enb->choice.short_Macro_eNB_ID.bits_unused);
190 memcpy(enb->choice.short_Macro_eNB_ID.buf, data, enb->choice.short_Macro_eNB_ID.size);
193 case ENB_ID_PR_long_Macro_eNB_ID: { // 21
194 enb->choice.long_Macro_eNB_ID.size = 3;
195 enb->choice.long_Macro_eNB_ID.bits_unused = 3;
196 enb->present = ENB_ID_PR_long_Macro_eNB_ID;
198 enb->choice.long_Macro_eNB_ID.buf = (uint8_t *) calloc(1, enb->choice.long_Macro_eNB_ID.size);
199 data[enb->choice.long_Macro_eNB_ID.size - 1] =
200 ((unsigned) (data[enb->choice.long_Macro_eNB_ID.size - 1] >> (unsigned) enb->choice.long_Macro_eNB_ID.bits_unused)
201 << (unsigned) enb->choice.long_Macro_eNB_ID.bits_unused);
202 memcpy(enb->choice.long_Macro_eNB_ID.buf, data, enb->choice.long_Macro_eNB_ID.size);
210 checkAndPrint(&asn_DEF_ENB_ID, enb, (char *) "ENB_ID_t", __func__);
214 GlobalENB_ID_t *createGlobalENB_ID(PLMN_Identity_t *plmnIdentity, ENB_ID_t *enbId) {
215 printEntry("GlobalENB_ID_t", __func__)
216 auto *genbId = (GlobalENB_ID_t *) calloc(1, sizeof(GlobalENB_ID_t));
217 ASN_STRUCT_RESET(asn_DEF_GlobalENB_ID, genbId);
218 memcpy(&genbId->pLMN_Identity, plmnIdentity, sizeof(PLMN_Identity_t));
219 memcpy(&genbId->eNB_ID, enbId, sizeof(ENB_ID_t));
221 checkAndPrint(&asn_DEF_GlobalENB_ID, genbId, (char *) "GlobalENB_ID_t", __func__);
226 //static void buildInitiatingMessagePDU(E2AP_PDU_t &pdu, InitiatingMessage_t *initMsg) {
227 // pdu.present = E2AP_PDU_PR_initiatingMessage;
228 // pdu.choice.initiatingMessage = initMsg;
232 static void buildInitMsg(InitiatingMessage_t &initMsg,
233 InitiatingMessage__value_PR present,
234 ProcedureCode_t procedureCode,
235 Criticality_t criticality,
237 initMsg.value.present = present;
238 initMsg.procedureCode = procedureCode;
239 initMsg.criticality = criticality;
242 case InitiatingMessage__value_PR_RICsubscriptionRequest: {
243 memcpy(&initMsg.value.choice.RICsubscriptionRequest, value, sizeof(*value));
246 case InitiatingMessage__value_PR_RICsubscriptionDeleteRequest: {
247 memcpy(&initMsg.value.choice.RICsubscriptionDeleteRequest, value, sizeof(*value));
250 case InitiatingMessage__value_PR_RICserviceUpdate: {
251 memcpy(&initMsg.value.choice.RICserviceUpdate, value, sizeof(*value));
254 case InitiatingMessage__value_PR_RICcontrolRequest: {
255 memcpy(&initMsg.value.choice.RICcontrolRequest, value, sizeof(*value));
258 case InitiatingMessage__value_PR_RICindication: {
259 memcpy(&initMsg.value.choice.RICindication, value, sizeof(*value));
262 case InitiatingMessage__value_PR_RICserviceQuery: {
263 memcpy(&initMsg.value.choice.RICserviceQuery, value, sizeof(*value));
266 case InitiatingMessage__value_PR_NOTHING:
273 //static void buildSuccsesfulMessagePDU(E2AP_PDU_t &pdu, SuccessfulOutcome_t *succMsg) {
274 // pdu.present = E2AP_PDU_PR_successfulOutcome;
275 // pdu.choice.successfulOutcome = succMsg;
279 static void buildSuccMsg(SuccessfulOutcome_t &succMsg,
280 SuccessfulOutcome__value_PR present,
281 ProcedureCode_t procedureCode,
282 Criticality_t criticality,
284 succMsg.value.present = present;
285 succMsg.procedureCode = procedureCode;
286 succMsg.criticality = criticality;
289 case SuccessfulOutcome__value_PR_RICsubscriptionResponse: {
290 memcpy(&succMsg.value.choice.RICsubscriptionResponse, value, sizeof(*value));
293 case SuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse: {
294 memcpy(&succMsg.value.choice.RICsubscriptionDeleteResponse, value, sizeof(*value));
297 case SuccessfulOutcome__value_PR_RICserviceUpdateAcknowledge: {
298 memcpy(&succMsg.value.choice.RICserviceUpdateAcknowledge, value, sizeof(*value));
301 case SuccessfulOutcome__value_PR_RICcontrolAcknowledge: {
302 memcpy(&succMsg.value.choice.RICcontrolAcknowledge, value, sizeof(*value));
305 case SuccessfulOutcome__value_PR_ResetResponse: {
306 memcpy(&succMsg.value.choice.ResetResponse, value, sizeof(*value));
309 case SuccessfulOutcome__value_PR_NOTHING:
316 //static void buildUnSucssesfullMessagePDU(E2AP_PDU_t &pdu, UnsuccessfulOutcome_t *unSuccMsg) {
317 // pdu.present = E2AP_PDU_PR_unsuccessfulOutcome;
318 // pdu.choice.unsuccessfulOutcome = unSuccMsg;
322 static void buildUnSuccMsg(UnsuccessfulOutcome_t &unSuccMsg,
323 UnsuccessfulOutcome__value_PR present,
324 ProcedureCode_t procedureCode,
325 Criticality_t criticality,
327 unSuccMsg.value.present = present;
328 unSuccMsg.procedureCode = procedureCode;
329 unSuccMsg.criticality = criticality;
332 case UnsuccessfulOutcome__value_PR_RICsubscriptionFailure: {
333 memcpy(&unSuccMsg.value.choice.RICsubscriptionFailure, value, sizeof(*value));
336 case UnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure: {
337 memcpy(&unSuccMsg.value.choice.RICsubscriptionDeleteFailure, value, sizeof(*value));
340 case UnsuccessfulOutcome__value_PR_RICserviceUpdateFailure: {
341 memcpy(&unSuccMsg.value.choice.RICserviceUpdateFailure, value, sizeof(*value));
344 case UnsuccessfulOutcome__value_PR_RICcontrolFailure: {
345 memcpy(&unSuccMsg.value.choice.RICcontrolFailure, value, sizeof(*value));
349 case UnsuccessfulOutcome__value_PR_NOTHING:
356 //static void createPLMN_ID(PLMN_Identity_t &plmnId, const unsigned char *data) {
357 // //printEntry("PLMN_Identity_t", __func__)
358 // //PLMN_Identity_t *plmnId = calloc(1, sizeof(PLMN_Identity_t));
359 // ASN_STRUCT_RESET(asn_DEF_PLMN_Identity, &plmnId);
360 // plmnId.size = 3;// uint64_t st = 0;
361 //// uint32_t aux1 = 0;
362 //// st = rdtscp(aux1);
364 // plmnId.buf = (uint8_t *) calloc(1, 3);
365 // memcpy(plmnId.buf, data, 3);
367 // checkAndPrint(&asn_DEF_PLMN_Identity, &plmnId, (char *) "PLMN_Identity_t", __func__);
371 static void createENB_ID(ENB_ID_t &enb, ENB_ID_PR enbType, unsigned char *data) {
372 //printEntry("ENB_ID_t", __func__)
373 ASN_STRUCT_RESET(asn_DEF_ENB_ID, &enb);
374 enb.present = enbType;
376 case ENB_ID_PR_macro_eNB_ID: { // 20 bit 3 bytes
377 enb.choice.macro_eNB_ID.size = 3;
378 enb.choice.macro_eNB_ID.bits_unused = 4;
380 enb.present = ENB_ID_PR_macro_eNB_ID;
382 enb.choice.macro_eNB_ID.buf = (uint8_t *) calloc(1, enb.choice.macro_eNB_ID.size);
383 data[enb.choice.macro_eNB_ID.size - 1] = ((unsigned) (data[enb.choice.macro_eNB_ID.size - 1]
384 >> (unsigned) enb.choice.macro_eNB_ID.bits_unused)
385 << (unsigned) enb.choice.macro_eNB_ID.bits_unused);
386 memcpy(enb.choice.macro_eNB_ID.buf, data, enb.choice.macro_eNB_ID.size);
390 case ENB_ID_PR_home_eNB_ID: { // 28 bit 4 bytes
391 enb.choice.home_eNB_ID.size = 4;
392 enb.choice.home_eNB_ID.bits_unused = 4;
393 enb.present = ENB_ID_PR_home_eNB_ID;
395 enb.choice.home_eNB_ID.buf = (uint8_t *) calloc(1, enb.choice.home_eNB_ID.size);
396 data[enb.choice.home_eNB_ID.size - 1] = ((unsigned) (data[enb.choice.home_eNB_ID.size - 1]
397 >> (unsigned) enb.choice.home_eNB_ID.bits_unused)
398 << (unsigned) enb.choice.home_eNB_ID.bits_unused);
399 memcpy(enb.choice.home_eNB_ID.buf, data, enb.choice.home_eNB_ID.size);
402 case ENB_ID_PR_short_Macro_eNB_ID: { // 18 bit - 3 bytes
403 enb.choice.short_Macro_eNB_ID.size = 3;
404 enb.choice.short_Macro_eNB_ID.bits_unused = 6;
405 enb.present = ENB_ID_PR_short_Macro_eNB_ID;
407 enb.choice.short_Macro_eNB_ID.buf = (uint8_t *) calloc(1, enb.choice.short_Macro_eNB_ID.size);
408 data[enb.choice.short_Macro_eNB_ID.size - 1] = ((unsigned) (data[enb.choice.short_Macro_eNB_ID.size - 1]
409 >> (unsigned) enb.choice.short_Macro_eNB_ID.bits_unused)
410 << (unsigned) enb.choice.short_Macro_eNB_ID.bits_unused);
411 memcpy(enb.choice.short_Macro_eNB_ID.buf, data, enb.choice.short_Macro_eNB_ID.size);
414 case ENB_ID_PR_long_Macro_eNB_ID: { // 21
415 enb.choice.long_Macro_eNB_ID.size = 3;
416 enb.choice.long_Macro_eNB_ID.bits_unused = 3;
417 enb.present = ENB_ID_PR_long_Macro_eNB_ID;
419 enb.choice.long_Macro_eNB_ID.buf = (uint8_t *) calloc(1, enb.choice.long_Macro_eNB_ID.size);
420 data[enb.choice.long_Macro_eNB_ID.size - 1] = ((unsigned) (data[enb.choice.long_Macro_eNB_ID.size - 1]
421 >> (unsigned) enb.choice.long_Macro_eNB_ID.bits_unused)
422 << (unsigned) enb.choice.long_Macro_eNB_ID.bits_unused);
423 memcpy(enb.choice.long_Macro_eNB_ID.buf, data, enb.choice.long_Macro_eNB_ID.size);
430 checkAndPrint(&asn_DEF_ENB_ID, &enb, (char *) "ENB_ID_t", __func__);
434 static void buildGlobalENB_ID(GlobalENB_ID_t *gnbId,
435 const unsigned char *gnbData,
437 unsigned char *enbData) {
438 auto *plmnID = createPLMN_ID(gnbData);
439 memcpy(&gnbId->pLMN_Identity, plmnID, sizeof(PLMN_Identity_t));
440 createENB_ID(gnbId->eNB_ID, enbType, enbData);
441 checkAndPrint(&asn_DEF_GlobalENB_ID, gnbId, (char *) "GlobalENB_ID_t", __func__);
445 void buildSetupRequest(E2AP_PDU_t *pdu, int mcc, int mnc) {
446 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
448 pdu->choice.initiatingMessage = (InitiatingMessage_t *)calloc(1, sizeof(InitiatingMessage_t));
449 auto *initiatingMessage = pdu->choice.initiatingMessage;
450 ASN_STRUCT_RESET(asn_DEF_InitiatingMessage, initiatingMessage);
451 initiatingMessage->procedureCode = ProcedureCode_id_E2setup;
452 initiatingMessage->criticality = Criticality_reject;
453 initiatingMessage->value.present = InitiatingMessage__value_PR_E2setupRequest;
455 auto *e2SetupRequestIEs = (E2setupRequestIEs_t *)calloc(1, sizeof(E2setupRequestIEs_t));
456 ASN_STRUCT_RESET(asn_DEF_E2setupRequestIEs, e2SetupRequestIEs);
458 e2SetupRequestIEs->value.choice.GlobalE2node_ID.present = GlobalE2node_ID_PR_gNB;
459 e2SetupRequestIEs->value.choice.GlobalE2node_ID.choice.gNB = (GlobalE2node_gNB_ID_t *)calloc(1, sizeof(GlobalE2node_gNB_ID_t));
460 auto *globalE2NodeGNbId = e2SetupRequestIEs->value.choice.GlobalE2node_ID.choice.gNB;
461 ASN_STRUCT_RESET(asn_DEF_GlobalE2node_gNB_ID, globalE2NodeGNbId);
463 createPLMN_IDByMCCandMNC(&globalE2NodeGNbId->global_gNB_ID.plmn_id, mcc, mnc);
464 globalE2NodeGNbId->global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
465 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size = 4;
466 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf =
467 (uint8_t *) calloc(1, globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size); //22..32 bits
468 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.bits_unused = 0;
469 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf[0] = 0xB5;
470 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf[1] = 0xC6;
471 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf[2] = 0x77;
472 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf[3] = 0x88;
474 e2SetupRequestIEs->criticality = Criticality_reject;
475 e2SetupRequestIEs->id = ProtocolIE_ID_id_GlobalE2node_ID;
476 e2SetupRequestIEs->value.present = E2setupRequestIEs__value_PR_GlobalE2node_ID;
479 auto *e2SetupRequest = &initiatingMessage->value.choice.E2setupRequest;
481 ASN_STRUCT_RESET(asn_DEF_E2setupRequest, e2SetupRequest);
482 ASN_SEQUENCE_ADD(&e2SetupRequest->protocolIEs.list, e2SetupRequestIEs);
484 pdu->present = E2AP_PDU_PR_initiatingMessage;
487 void buildSetupRequesteenGNB(E2AP_PDU_t *pdu, int mcc, int mnc) {
488 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
490 pdu->choice.initiatingMessage = (InitiatingMessage_t *)calloc(1, sizeof(InitiatingMessage_t));
491 auto *initiatingMessage = pdu->choice.initiatingMessage;
492 ASN_STRUCT_RESET(asn_DEF_InitiatingMessage, initiatingMessage);
493 initiatingMessage->procedureCode = ProcedureCode_id_E2setup;
494 initiatingMessage->criticality = Criticality_reject;
495 initiatingMessage->value.present = InitiatingMessage__value_PR_E2setupRequest;
497 auto *e2SetupRequestIEs = (E2setupRequestIEs_t *)calloc(1, sizeof(E2setupRequestIEs_t));
498 ASN_STRUCT_RESET(asn_DEF_E2setupRequestIEs, e2SetupRequestIEs);
500 e2SetupRequestIEs->value.choice.GlobalE2node_ID.present = GlobalE2node_ID_PR_en_gNB;
501 e2SetupRequestIEs->value.choice.GlobalE2node_ID.choice.en_gNB = (GlobalE2node_en_gNB_ID_t *)calloc(1, sizeof(GlobalE2node_en_gNB_ID_t));
502 auto *globalE2NodeEN_GNb = e2SetupRequestIEs->value.choice.GlobalE2node_ID.choice.en_gNB;
503 ASN_STRUCT_RESET(asn_DEF_GlobalE2node_en_gNB_ID, globalE2NodeEN_GNb);
505 globalE2NodeEN_GNb->global_en_gNB_ID.gNB_ID.present = ENGNB_ID_PR_gNB_ID;
506 createPLMN_IDByMCCandMNC(&globalE2NodeEN_GNb->global_en_gNB_ID.pLMN_Identity, mcc, mnc);
507 globalE2NodeEN_GNb->global_en_gNB_ID.gNB_ID.choice.gNB_ID.size = 4;
508 globalE2NodeEN_GNb->global_en_gNB_ID.gNB_ID.choice.gNB_ID.buf =
509 (uint8_t *) calloc(1, globalE2NodeEN_GNb->global_en_gNB_ID.gNB_ID.choice.gNB_ID.size); //22..32 bits
510 globalE2NodeEN_GNb->global_en_gNB_ID.gNB_ID.choice.gNB_ID.buf[0] = 0xC5;
511 globalE2NodeEN_GNb->global_en_gNB_ID.gNB_ID.choice.gNB_ID.buf[1] = 0xC6;
512 globalE2NodeEN_GNb->global_en_gNB_ID.gNB_ID.choice.gNB_ID.buf[2] = 0xC7;
513 globalE2NodeEN_GNb->global_en_gNB_ID.gNB_ID.choice.gNB_ID.buf[3] = 0xF8;
514 globalE2NodeEN_GNb->global_en_gNB_ID.gNB_ID.choice.gNB_ID.bits_unused = 0;
515 e2SetupRequestIEs->criticality = Criticality_reject;
516 e2SetupRequestIEs->id = ProtocolIE_ID_id_GlobalE2node_ID;
517 e2SetupRequestIEs->value.present = E2setupRequestIEs__value_PR_GlobalE2node_ID;
520 auto *e2SetupRequest = &initiatingMessage->value.choice.E2setupRequest;
522 ASN_STRUCT_RESET(asn_DEF_E2setupRequest, e2SetupRequest);
523 ASN_SEQUENCE_ADD(&e2SetupRequest->protocolIEs.list, e2SetupRequestIEs);
525 pdu->present = E2AP_PDU_PR_initiatingMessage;
530 void buildSetupRequestWithFunc(E2AP_PDU_t *pdu, int mcc, int mnc) {
531 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
533 pdu->choice.initiatingMessage = (InitiatingMessage_t *)calloc(1, sizeof(InitiatingMessage_t));
534 auto *initiatingMessage = pdu->choice.initiatingMessage;
535 ASN_STRUCT_RESET(asn_DEF_InitiatingMessage, initiatingMessage);
536 initiatingMessage->procedureCode = ProcedureCode_id_E2setup;
537 initiatingMessage->criticality = Criticality_reject;
538 initiatingMessage->value.present = InitiatingMessage__value_PR_E2setupRequest;
540 auto *e2SetupRequestIEs = (E2setupRequestIEs_t *)calloc(1, sizeof(E2setupRequestIEs_t));
541 ASN_STRUCT_RESET(asn_DEF_E2setupRequestIEs, e2SetupRequestIEs);
543 e2SetupRequestIEs->value.choice.GlobalE2node_ID.choice.gNB = (GlobalE2node_gNB_ID_t *)calloc(1, sizeof(GlobalE2node_gNB_ID_t));
544 auto *globalE2NodeGNbId = e2SetupRequestIEs->value.choice.GlobalE2node_ID.choice.gNB;
545 ASN_STRUCT_RESET(asn_DEF_GlobalE2node_gNB_ID, globalE2NodeGNbId);
547 createPLMN_IDByMCCandMNC(&globalE2NodeGNbId->global_gNB_ID.plmn_id, mcc, mnc);
548 globalE2NodeGNbId->global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
549 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size = 4;
550 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf =
551 (uint8_t *) calloc(1, globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size); //22..32 bits
552 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.bits_unused = 0;
553 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf[0] = 0xB5;
554 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf[1] = 0xC6;
555 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf[2] = 0x77;
556 globalE2NodeGNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf[3] = 0x88;
558 e2SetupRequestIEs->criticality = Criticality_reject;
559 e2SetupRequestIEs->id = ProtocolIE_ID_id_GlobalE2node_ID;
560 e2SetupRequestIEs->value.present = E2setupRequestIEs__value_PR_GlobalE2node_ID;
561 e2SetupRequestIEs->value.choice.GlobalE2node_ID.present = GlobalE2node_ID_PR_gNB;
564 auto *e2SetupRequest = &initiatingMessage->value.choice.E2setupRequest;
566 ASN_STRUCT_RESET(asn_DEF_E2setupRequest, e2SetupRequest);
567 ASN_SEQUENCE_ADD(&e2SetupRequest->protocolIEs.list, e2SetupRequestIEs);
569 auto *ranFlistIEs = (E2setupRequestIEs_t *)calloc(1, sizeof(E2setupRequestIEs_t));
570 ASN_STRUCT_RESET(asn_DEF_E2setupRequestIEs, ranFlistIEs);
571 ranFlistIEs->criticality = Criticality_reject;
572 ranFlistIEs->id = ProtocolIE_ID_id_RANfunctionsAdded;
573 ranFlistIEs->value.present = E2setupRequestIEs__value_PR_RANfunctions_List;
577 E2SM_gNB_NRT_RANfunction_Definition_t ranFunDef;
578 uint8_t funcDes[] = "asdfghjklpoiuytrewq\0";
579 ranFunDef.ranFunction_Name.ranFunction_Description.buf = (uint8_t *)calloc(1, strlen((char *)funcDes));
580 ranFunDef.ranFunction_Name.ranFunction_Description.size = strlen((char *)funcDes);
581 memcpy(ranFunDef.ranFunction_Name.ranFunction_Description.buf, funcDes, strlen((char *)funcDes));
583 uint8_t funcOID[] = "ABCDEFGHIJ1234567890\0";
584 ranFunDef.ranFunction_Name.ranFunction_E2SM_OID.buf = (uint8_t *)calloc(1, strlen((char *)funcOID));
585 ranFunDef.ranFunction_Name.ranFunction_E2SM_OID.size = strlen((char *)funcOID);
586 memcpy(ranFunDef.ranFunction_Name.ranFunction_E2SM_OID.buf, funcOID, strlen((char *)funcOID));
588 uint8_t shortName[] = "Nothing to declare\0";
589 ranFunDef.ranFunction_Name.ranFunction_ShortName.buf = (uint8_t *)calloc(1, strlen((char *)shortName));
590 ranFunDef.ranFunction_Name.ranFunction_ShortName.size = strlen((char *)shortName);
591 memcpy(ranFunDef.ranFunction_Name.ranFunction_ShortName.buf, shortName, strlen((char *)shortName));
594 RIC_InsertStyle_List_t insertStyleList;
595 insertStyleList.ric_CallProcessIDFormat_Type = 28l;
596 insertStyleList.ric_IndicationHeaderFormat_Type = 29;
597 insertStyleList.ric_IndicationMessageFormat_Type = 30;
598 insertStyleList.ric_InsertActionFormat_Type = 31l;
600 uint8_t styleName[] = "What a style\0";
602 insertStyleList.ric_InsertStyle_Name.buf = (uint8_t *)calloc(1, strlen((char *)styleName));
603 insertStyleList.ric_InsertStyle_Name.size = strlen((char *)styleName);
604 memcpy(insertStyleList.ric_InsertStyle_Name.buf, styleName, strlen((char *)styleName));
607 insertStyleList.ric_InsertStyle_Type = 23;
609 RANparameterDef_Item_t raNparameterDefItem;
610 raNparameterDefItem.ranParameter_ID = 8;
611 raNparameterDefItem.ranParameter_Type = 12;
613 uint8_t ItemName[] = "What a style\0";
614 raNparameterDefItem.ranParameter_Name.buf = (uint8_t *)calloc(1, strlen((char *)ItemName));
615 raNparameterDefItem.ranParameter_Name.size = strlen((char *)ItemName);
616 memcpy(raNparameterDefItem.ranParameter_Name.buf, ItemName, strlen((char *)ItemName));
618 ASN_SEQUENCE_ADD(&insertStyleList.ric_InsertRanParameterDef_List.list, &raNparameterDefItem);
620 ASN_SEQUENCE_ADD(&ranFunDef.ric_InsertStyle_List->list, &insertStyleList);
621 //ranFunDef.ric_InsertStyle_List.
623 auto *itemIes = (RANfunction_ItemIEs_t *)calloc(1, sizeof(RANfunction_ItemIEs_t));
624 ASN_STRUCT_RESET(asn_DEF_RANfunction_ItemIEs, itemIes);
626 uint8_t buffer[8192];
627 size_t buffer_size = 8192;
628 auto *ranDef = &itemIes->value.choice.RANfunction_Item.ranFunctionDefinition;
630 auto er = asn_encode_to_buffer(nullptr, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_NRT_RANfunction_Definition, &ranFunDef, buffer, buffer_size);
631 if (er.encoded == -1) {
632 cerr << "encoding of " << asn_DEF_E2SM_gNB_NRT_RANfunction_Definition.name << " failed, " << strerror(errno) << endl;
634 } else if (er.encoded > (ssize_t) buffer_size) {
635 cerr << "Buffer of size " << buffer_size << " is to small for " << asn_DEF_E2SM_gNB_NRT_RANfunction_Definition.name << endl;
638 ranDef->buf = (uint8_t *)calloc(1, er.encoded);
639 ranDef->size = er.encoded;
640 memcpy(ranDef->buf, buffer, ranDef->size);
643 itemIes->id = ProtocolIE_ID_id_RANfunction_Item;
644 itemIes->criticality = Criticality_reject;
645 itemIes->value.present = RANfunction_ItemIEs__value_PR_RANfunction_Item;
646 itemIes->value.choice.RANfunction_Item.ranFunctionID = 1;
647 // auto *ranDef = &itemIes->value.choice.RANfunction_Item.ranFunctionDefinition;
649 // ranDef->buf = (uint8_t *)calloc(1, ranDef->size);
650 // memcpy(ranDef->buf, buf, ranDef->size);
652 ASN_SEQUENCE_ADD(&ranFlistIEs->value.choice.RANfunctions_List.list, itemIes);
654 auto *itemIes1 = (RANfunction_ItemIEs_t *)calloc(1, sizeof(RANfunction_ItemIEs_t));
655 ASN_STRUCT_RESET(asn_DEF_RANfunction_ItemIEs, itemIes1);
656 itemIes1->id = ProtocolIE_ID_id_RANfunction_Item;
657 itemIes1->criticality = Criticality_reject;
658 itemIes1->value.present = RANfunction_ItemIEs__value_PR_RANfunction_Item;
659 itemIes1->value.choice.RANfunction_Item.ranFunctionID = 7;
660 ranDef = &itemIes1->value.choice.RANfunction_Item.ranFunctionDefinition;
662 ranDef->buf = (uint8_t *)calloc(1, er.encoded);
663 ranDef->size = er.encoded;
664 memcpy(ranDef->buf, buffer, ranDef->size);
666 ASN_SEQUENCE_ADD(&ranFlistIEs->value.choice.RANfunctions_List.list, itemIes1);
669 ASN_SEQUENCE_ADD(&e2SetupRequest->protocolIEs.list, ranFlistIEs);
671 pdu->present = E2AP_PDU_PR_initiatingMessage;
675 void buildSubsReq(E2AP_PDU_t *pdu) {
676 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
678 pdu->choice.initiatingMessage = (InitiatingMessage_t *)calloc(1, sizeof(InitiatingMessage_t));
679 pdu->present = E2AP_PDU_PR_initiatingMessage;
681 auto *initMsg = pdu->choice.initiatingMessage;
682 ASN_STRUCT_RESET(asn_DEF_InitiatingMessage, initMsg);
683 initMsg->procedureCode = ProcedureCode_id_RICsubscription;
684 initMsg->criticality = Criticality_reject;
685 initMsg->value.present = InitiatingMessage__value_PR_RICsubscriptionRequest;
687 auto *subReq = &(initMsg->value.choice.RICsubscriptionRequest);
688 ASN_STRUCT_RESET(asn_DEF_RICsubscriptionRequest, subReq);
691 auto *e = (RICsubscriptionRequest_IEs_t *)calloc(1, sizeof(RICsubscriptionRequest_IEs_t));
692 ASN_STRUCT_RESET(asn_DEF_RICsubscriptionRequest_IEs, e);
693 e->id = ProtocolIE_ID_id_RICrequestID;
694 e->value.present = RICsubscriptionRequest_IEs__value_PR_RICrequestID;
695 e->value.choice.RICrequestID.ricRequestorID = 88;
696 e->value.choice.RICrequestID.ricInstanceID = 5;
697 ASN_SEQUENCE_ADD(&subReq->protocolIEs.list, e);
700 auto *e = (RICsubscriptionRequest_IEs_t *)calloc(1, sizeof(RICsubscriptionRequest_IEs_t));
701 ASN_STRUCT_RESET(asn_DEF_RICsubscriptionRequest_IEs, e);
702 e->id = ProtocolIE_ID_id_RANfunctionID;
703 e->criticality = Criticality_reject;
704 e->value.present = RICsubscriptionRequest_IEs__value_PR_RANfunctionID;
705 e->value.choice.RANfunctionID = 8;
706 ASN_SEQUENCE_ADD(&subReq->protocolIEs.list, e);
709 auto *e = (RICsubscriptionRequest_IEs_t *)calloc(1, sizeof(RICsubscriptionRequest_IEs_t));
710 ASN_STRUCT_RESET(asn_DEF_RICsubscriptionRequest_IEs, e);
711 e->id = ProtocolIE_ID_id_RICsubscriptionDetails;
712 e->criticality = Criticality_reject;
713 e->value.present = RICsubscriptionRequest_IEs__value_PR_RICsubscriptionDetails;
715 uint8_t buf[10] = {1,2,3,4,5,6,7,8,9,0} ;
716 e->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.size = 10;
717 e->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.buf = (uint8_t *)calloc(1, 10);
718 memcpy(e->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.buf,
720 e->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.size);
722 auto ie = (RICaction_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(RICaction_ToBeSetup_ItemIEs_t));
723 ASN_STRUCT_RESET(asn_DEF_RICaction_ToBeSetup_ItemIEs, ie);
724 ie->id = ProtocolIE_ID_id_RICaction_ToBeSetup_Item;
725 ie->criticality = Criticality_ignore;
726 ie->value.present = RICaction_ToBeSetup_ItemIEs__value_PR_RICaction_ToBeSetup_Item;
727 ie->value.choice.RICaction_ToBeSetup_Item.ricActionID = 22;
728 ie->value.choice.RICaction_ToBeSetup_Item.ricActionType = RICactionType_report;
730 auto *ad = (RICactionDefinition_t *)calloc(1, sizeof(RICactionDefinition_t));
731 ASN_STRUCT_RESET(asn_DEF_RICactionDefinition, ad);
733 uint8_t buf[10] = {1,2,3,4,5,6,7,8,9,0} ;
734 ad->buf = (uint8_t *)calloc(1, ad->size);
735 memcpy(ad->buf, buf, ad->size);
736 ie->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition = ad;
738 auto *sa = (RICsubsequentAction_t *) calloc(1, sizeof(RICsubsequentAction_t));
739 ASN_STRUCT_RESET(asn_DEF_RICsubsequentAction, sa);
741 sa->ricTimeToWait = RICtimeToWait_w500ms;
742 sa->ricSubsequentActionType = RICsubsequentActionType_continue;
744 ie->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction = sa;
745 ASN_SEQUENCE_ADD(&e->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.list, ie);
749 auto ie = (RICaction_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(RICaction_ToBeSetup_ItemIEs_t));
750 ASN_STRUCT_RESET(asn_DEF_RICaction_ToBeSetup_ItemIEs, ie);
751 ie->id = ProtocolIE_ID_id_RICaction_ToBeSetup_Item;
752 ie->criticality = Criticality_ignore;
753 ie->value.present = RICaction_ToBeSetup_ItemIEs__value_PR_RICaction_ToBeSetup_Item;
754 ie->value.choice.RICaction_ToBeSetup_Item.ricActionID = 47;
755 ie->value.choice.RICaction_ToBeSetup_Item.ricActionType = RICactionType_policy;
757 auto *ad = (RICactionDefinition_t *)calloc(1, sizeof(RICactionDefinition_t));
758 ASN_STRUCT_RESET(asn_DEF_RICactionDefinition, ad);
760 uint8_t buf[10] = {1,2,3,4,5,6,7,8,9,0} ;
761 ad->buf = (uint8_t *)calloc(1, ad->size);
762 memcpy(ad->buf, buf, ad->size);
763 ie->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition = ad;
765 auto *sa = (RICsubsequentAction_t *) calloc(1, sizeof(RICsubsequentAction_t));
766 ASN_STRUCT_RESET(asn_DEF_RICsubsequentAction, sa);
768 sa->ricTimeToWait = RICtimeToWait_w5s;
769 sa->ricSubsequentActionType = RICsubsequentActionType_wait;
771 ie->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction = sa;
772 ASN_SEQUENCE_ADD(&e->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.list, ie);
775 ASN_SEQUENCE_ADD(&subReq->protocolIEs.list, e);
780 void buildSetupSuccsessfulResponse(E2AP_PDU_t *pdu, int mcc, int mnc, uint8_t *data) {
781 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
783 pdu->choice.successfulOutcome = (SuccessfulOutcome_t *)calloc(1, sizeof(SuccessfulOutcome_t));
784 SuccessfulOutcome_t *successfulOutcome = pdu->choice.successfulOutcome;
785 ASN_STRUCT_RESET(asn_DEF_E2setupResponse, &successfulOutcome->value.choice.E2setupResponse);
786 successfulOutcome->procedureCode = ProcedureCode_id_E2setup;
787 successfulOutcome->criticality = Criticality_reject;
788 successfulOutcome->value.present = SuccessfulOutcome__value_PR_E2setupResponse;
791 auto *globalRicidIE = (E2setupResponseIEs_t *)calloc(1, sizeof(E2setupResponseIEs_t));
792 ASN_STRUCT_RESET(asn_DEF_E2setupResponseIEs, globalRicidIE);
794 globalRicidIE->criticality = Criticality_reject;
795 globalRicidIE->id = ProtocolIE_ID_id_GlobalRIC_ID;
796 globalRicidIE->value.present = E2setupResponseIEs__value_PR_GlobalRIC_ID;
797 createPLMN_IDByMCCandMNC(&globalRicidIE->value.choice.GlobalRIC_ID.pLMN_Identity, mcc, mnc);
799 globalRicidIE->value.choice.GlobalRIC_ID.ric_ID = {nullptr, 3, 4};
800 globalRicidIE->value.choice.GlobalRIC_ID.ric_ID.buf = (uint8_t *)calloc(1, globalRicidIE->value.choice.GlobalRIC_ID.ric_ID.size);
801 memcpy(globalRicidIE->value.choice.GlobalRIC_ID.ric_ID.buf, data, globalRicidIE->value.choice.GlobalRIC_ID.ric_ID.size);
802 globalRicidIE->value.choice.GlobalRIC_ID.ric_ID.buf[2] &= (unsigned)0xF0;
805 ASN_STRUCT_RESET(asn_DEF_E2setupResponse, &successfulOutcome->value.choice.E2setupResponse);
806 ASN_SEQUENCE_ADD(&successfulOutcome->value.choice.E2setupResponse.protocolIEs.list, globalRicidIE);
808 auto *ranFunctionAdd = (E2setupResponseIEs_t *)calloc(1, sizeof(E2setupResponseIEs_t));
809 ASN_STRUCT_RESET(asn_DEF_E2setupResponseIEs, ranFunctionAdd);
810 ranFunctionAdd->criticality = Criticality_reject;
811 ranFunctionAdd->id = ProtocolIE_ID_id_RANfunctionsAccepted;
812 ranFunctionAdd->value.present = E2setupResponseIEs__value_PR_RANfunctionsID_List;
814 auto *ranFuncIdItemIEs = (RANfunctionID_ItemIEs_t *)calloc(1, sizeof(RANfunctionID_ItemIEs_t));
816 ranFuncIdItemIEs->criticality = Criticality_ignore;
817 ranFuncIdItemIEs->id = ProtocolIE_ID_id_RANfunctionID_Item;
818 ranFuncIdItemIEs->value.present = RANfunctionID_ItemIEs__value_PR_RANfunctionID_Item;
819 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionID = 10;
820 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionRevision = 1;
822 ASN_SEQUENCE_ADD(&ranFunctionAdd->value.choice.RANfunctionsID_List.list, ranFuncIdItemIEs);
823 ASN_SEQUENCE_ADD(&successfulOutcome->value.choice.E2setupResponse.protocolIEs.list, ranFunctionAdd);
829 pdu->present = E2AP_PDU_PR_successfulOutcome;
833 void buildSetupUnSuccsessfulResponse(E2AP_PDU_t *pdu) {
834 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
836 pdu->choice.unsuccessfulOutcome = (UnsuccessfulOutcome_t *)calloc(1, sizeof(UnsuccessfulOutcome_t));
837 UnsuccessfulOutcome_t *uns = pdu->choice.unsuccessfulOutcome;
838 uns->procedureCode = ProcedureCode_id_E2setup;
839 uns->criticality = Criticality_reject;
840 uns->value.present = UnsuccessfulOutcome__value_PR_E2setupFailure;
842 ASN_STRUCT_RESET(asn_DEF_E2setupFailure, &uns->value.choice.E2setupFailure);
846 auto *e2SetupFIE = (E2setupFailureIEs_t *) calloc(1, sizeof(E2setupFailureIEs_t));
847 ASN_STRUCT_RESET(asn_DEF_E2setupFailureIEs, e2SetupFIE);
849 e2SetupFIE->criticality = Criticality_ignore;
850 e2SetupFIE->id = ProtocolIE_ID_id_Cause;
851 e2SetupFIE->value.present = E2setupFailureIEs__value_PR_Cause;
852 e2SetupFIE->value.choice.Cause.present = Cause_PR_transport;
853 e2SetupFIE->value.choice.Cause.choice.transport = CauseTransport_transport_resource_unavailable;
856 ASN_SEQUENCE_ADD(&uns->value.choice.E2setupFailure.protocolIEs.list, e2SetupFIE);
860 auto *e2SetupFIE = (E2setupFailureIEs_t *) calloc(1, sizeof(E2setupFailureIEs_t));
861 ASN_STRUCT_RESET(asn_DEF_E2setupFailureIEs, e2SetupFIE);
863 e2SetupFIE->criticality = Criticality_ignore;
864 e2SetupFIE->id = ProtocolIE_ID_id_TimeToWait;
865 e2SetupFIE->value.present = E2setupFailureIEs__value_PR_TimeToWait;
866 e2SetupFIE->value.choice.TimeToWait = TimeToWait_v60s;
868 ASN_SEQUENCE_ADD(&uns->value.choice.E2setupFailure.protocolIEs.list, e2SetupFIE);
871 auto *e2SetupFIE = (E2setupFailureIEs_t *) calloc(1, sizeof(E2setupFailureIEs_t));
872 ASN_STRUCT_RESET(asn_DEF_E2setupFailureIEs, e2SetupFIE);
874 e2SetupFIE->criticality = Criticality_ignore;
875 e2SetupFIE->id = ProtocolIE_ID_id_CriticalityDiagnostics;
876 e2SetupFIE->value.present = E2setupFailureIEs__value_PR_CriticalityDiagnostics;
877 e2SetupFIE->value.choice.CriticalityDiagnostics.procedureCode = (ProcedureCode_t *)calloc(1,sizeof(ProcedureCode_t));
878 *e2SetupFIE->value.choice.CriticalityDiagnostics.procedureCode = ProcedureCode_id_E2setup;
879 e2SetupFIE->value.choice.CriticalityDiagnostics.triggeringMessage = (TriggeringMessage_t *)calloc(1,sizeof(TriggeringMessage_t));
880 *e2SetupFIE->value.choice.CriticalityDiagnostics.triggeringMessage = TriggeringMessage_initiating_message;
881 e2SetupFIE->value.choice.CriticalityDiagnostics.procedureCriticality = (Criticality_t *)calloc(1, sizeof(Criticality_t));
882 *e2SetupFIE->value.choice.CriticalityDiagnostics.procedureCriticality = Criticality_reject;
883 ASN_SEQUENCE_ADD(&uns->value.choice.E2setupFailure.protocolIEs.list, e2SetupFIE);
886 pdu->present = E2AP_PDU_PR_unsuccessfulOutcome;
889 void buildResetReq(E2AP_PDU_t *pdu) {
890 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
892 pdu->choice.initiatingMessage = (InitiatingMessage_t *)calloc(1, sizeof(InitiatingMessage_t));
893 pdu->present = E2AP_PDU_PR_initiatingMessage;
895 auto *initMsg = pdu->choice.initiatingMessage;
896 ASN_STRUCT_RESET(asn_DEF_InitiatingMessage, initMsg);
897 initMsg->procedureCode = ProcedureCode_id_Reset;
898 initMsg->criticality = Criticality_reject;
899 initMsg->value.present = InitiatingMessage__value_PR_ResetRequest;
902 auto *resetReq = &(initMsg->value.choice.ResetRequest);
903 ASN_STRUCT_RESET(asn_DEF_ResetRequest, resetReq);
906 auto *e = (ResetRequestIEs_t *)calloc(1, sizeof(ResetRequestIEs_t));
907 ASN_STRUCT_RESET(asn_DEF_ResetRequestIEs, e);
908 e->id = ProtocolIE_ID_id_Cause;
909 e->criticality = Criticality_ignore;
910 e->value.present = ResetRequestIEs__value_PR_Cause;
911 e->value.choice.Cause.present = Cause_PR_ricRequest;
912 e->value.choice.Cause.choice.ricRequest = 1;
913 ASN_SEQUENCE_ADD(&resetReq->protocolIEs.list, e);
918 void buildResetResponse(E2AP_PDU_t *pdu) {
919 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
921 pdu->choice.successfulOutcome = (SuccessfulOutcome_t *)calloc(1, sizeof(SuccessfulOutcome_t));
922 pdu->present = E2AP_PDU_PR_successfulOutcome;
924 auto *succ = pdu->choice.successfulOutcome;
925 ASN_STRUCT_RESET(asn_DEF_InitiatingMessage, succ);
926 succ->procedureCode = ProcedureCode_id_Reset;
927 succ->criticality = Criticality_reject;
928 succ->value.present = SuccessfulOutcome__value_PR_ResetResponse;
931 auto *resetRespo = &(succ->value.choice.ResetResponse);
932 ASN_STRUCT_RESET(asn_DEF_ResetResponse, resetRespo);
935 auto *e = (ResetResponseIEs_t *)calloc(1, sizeof(ResetResponseIEs_t));
936 ASN_STRUCT_RESET(asn_DEF_ResetResponseIEs, e);
937 e->id = ProtocolIE_ID_id_CriticalityDiagnostics;
938 e->criticality = Criticality_ignore;
939 e->value.present = ResetResponseIEs__value_PR_CriticalityDiagnostics;
941 e->value.choice.CriticalityDiagnostics.procedureCode = (ProcedureCode_t *)calloc(1,sizeof(ProcedureCode_t));
942 *e->value.choice.CriticalityDiagnostics.procedureCode = ProcedureCode_id_Reset;
943 e->value.choice.CriticalityDiagnostics.triggeringMessage = (TriggeringMessage_t *)calloc(1,sizeof(TriggeringMessage_t));
944 *e->value.choice.CriticalityDiagnostics.triggeringMessage = TriggeringMessage_initiating_message;
945 e->value.choice.CriticalityDiagnostics.procedureCriticality = (Criticality_t *)calloc(1, sizeof(Criticality_t));
946 *e->value.choice.CriticalityDiagnostics.procedureCriticality = Criticality_reject;
947 ASN_SEQUENCE_ADD(&resetRespo->protocolIEs.list, e);
952 void buildServiceQuery(E2AP_PDU_t *pdu) {
953 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
955 pdu->choice.initiatingMessage = (InitiatingMessage_t *)calloc(1, sizeof(InitiatingMessage_t));
956 pdu->present = E2AP_PDU_PR_initiatingMessage;
958 auto *initMsg = pdu->choice.initiatingMessage;
959 ASN_STRUCT_RESET(asn_DEF_InitiatingMessage, initMsg);
960 initMsg->procedureCode = ProcedureCode_id_RICserviceQuery;
961 initMsg->criticality = Criticality_ignore;
962 initMsg->value.present = InitiatingMessage__value_PR_RICserviceQuery;
965 auto *serviceQuery = &(initMsg->value.choice.RICserviceQuery);
966 ASN_STRUCT_RESET(asn_DEF_ResetRequest, serviceQuery);
969 auto *e = (RICserviceQuery_IEs_t *)calloc(1, sizeof(RICserviceQuery_IEs_t));
970 ASN_STRUCT_RESET(asn_DEF_RICserviceQuery_IEs, e);
971 e->id = ProtocolIE_ID_id_RANfunctionsAccepted;
972 e->criticality = Criticality_reject;
973 e->value.present = RICserviceQuery_IEs__value_PR_RANfunctionsID_List;
975 auto *ranFuncIdItemIEs = (RANfunctionID_ItemIEs_t *)calloc(1, sizeof(RANfunctionID_ItemIEs_t));
977 ranFuncIdItemIEs->criticality = Criticality_ignore;
978 ranFuncIdItemIEs->id = ProtocolIE_ID_id_RANfunctionID_Item;
979 ranFuncIdItemIEs->value.present = RANfunctionID_ItemIEs__value_PR_RANfunctionID_Item;
980 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionID = 10;
981 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionRevision = 1;
982 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsID_List.list, ranFuncIdItemIEs);
985 auto *ranFuncIdItemIEs = (RANfunctionID_ItemIEs_t *)calloc(1, sizeof(RANfunctionID_ItemIEs_t));
987 ranFuncIdItemIEs->criticality = Criticality_ignore;
988 ranFuncIdItemIEs->id = ProtocolIE_ID_id_RANfunctionID_Item;
989 ranFuncIdItemIEs->value.present = RANfunctionID_ItemIEs__value_PR_RANfunctionID_Item;
990 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionID = 11;
991 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionRevision = 2;
992 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsID_List.list, ranFuncIdItemIEs);
995 auto *ranFuncIdItemIEs = (RANfunctionID_ItemIEs_t *)calloc(1, sizeof(RANfunctionID_ItemIEs_t));
997 ranFuncIdItemIEs->criticality = Criticality_ignore;
998 ranFuncIdItemIEs->id = ProtocolIE_ID_id_RANfunctionID_Item;
999 ranFuncIdItemIEs->value.present = RANfunctionID_ItemIEs__value_PR_RANfunctionID_Item;
1000 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionID = 28;
1001 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionRevision = 13;
1002 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsID_List.list, ranFuncIdItemIEs);
1005 auto *ranFuncIdItemIEs = (RANfunctionID_ItemIEs_t *)calloc(1, sizeof(RANfunctionID_ItemIEs_t));
1007 ranFuncIdItemIEs->criticality = Criticality_ignore;
1008 ranFuncIdItemIEs->id = ProtocolIE_ID_id_RANfunctionID_Item;
1009 ranFuncIdItemIEs->value.present = RANfunctionID_ItemIEs__value_PR_RANfunctionID_Item;
1010 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionID = 1;
1011 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionRevision = 4;
1012 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsID_List.list, ranFuncIdItemIEs);
1014 ASN_SEQUENCE_ADD(&serviceQuery->protocolIEs.list, e);
1018 void buildServiceUpdateResponce(E2AP_PDU_t *pdu) {
1019 ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, pdu);
1021 pdu->choice.successfulOutcome = (SuccessfulOutcome_t *)calloc(1, sizeof(SuccessfulOutcome_t));
1022 pdu->present = E2AP_PDU_PR_successfulOutcome;
1024 auto *succ = pdu->choice.successfulOutcome;
1025 ASN_STRUCT_RESET(asn_DEF_SuccessfulOutcome, succ);
1026 succ->procedureCode = ProcedureCode_id_RICserviceQuery;
1027 succ->criticality = Criticality_reject;
1028 succ->value.present = SuccessfulOutcome__value_PR_RICserviceUpdateAcknowledge;
1031 auto *serviceUpdAck = &(succ->value.choice.RICserviceUpdateAcknowledge);
1032 ASN_STRUCT_RESET(asn_DEF_RICserviceUpdateAcknowledge, serviceUpdAck);
1035 auto *e = (RICserviceUpdateAcknowledge_IEs_t *)calloc(1, sizeof(RICserviceUpdateAcknowledge_IEs_t));
1036 ASN_STRUCT_RESET(asn_DEF_RICserviceUpdateAcknowledge_IEs, e);
1037 e->id = ProtocolIE_ID_id_RANfunctionsAccepted;
1038 e->criticality = Criticality_reject;
1039 e->value.present = RICserviceUpdateAcknowledge_IEs__value_PR_RANfunctionsID_List;
1041 auto *ranFuncIdItemIEs = (RANfunctionID_ItemIEs_t *)calloc(1, sizeof(RANfunctionID_ItemIEs_t));
1043 ranFuncIdItemIEs->criticality = Criticality_reject;
1044 ranFuncIdItemIEs->id = ProtocolIE_ID_id_RANfunctionID_Item;
1045 ranFuncIdItemIEs->value.present = RANfunctionID_ItemIEs__value_PR_RANfunctionID_Item;
1046 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionID = 10;
1047 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionRevision = 1;
1048 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsID_List.list, ranFuncIdItemIEs);
1051 auto *ranFuncIdItemIEs = (RANfunctionID_ItemIEs_t *)calloc(1, sizeof(RANfunctionID_ItemIEs_t));
1053 ranFuncIdItemIEs->criticality = Criticality_reject;
1054 ranFuncIdItemIEs->id = ProtocolIE_ID_id_RANfunctionID_Item;
1055 ranFuncIdItemIEs->value.present = RANfunctionID_ItemIEs__value_PR_RANfunctionID_Item;
1056 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionID = 11;
1057 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionRevision = 2;
1058 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsID_List.list, ranFuncIdItemIEs);
1061 auto *ranFuncIdItemIEs = (RANfunctionID_ItemIEs_t *)calloc(1, sizeof(RANfunctionID_ItemIEs_t));
1063 ranFuncIdItemIEs->criticality = Criticality_reject;
1064 ranFuncIdItemIEs->id = ProtocolIE_ID_id_RANfunctionID_Item;
1065 ranFuncIdItemIEs->value.present = RANfunctionID_ItemIEs__value_PR_RANfunctionID_Item;
1066 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionID = 28;
1067 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionRevision = 13;
1068 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsID_List.list, ranFuncIdItemIEs);
1071 auto *ranFuncIdItemIEs = (RANfunctionID_ItemIEs_t *)calloc(1, sizeof(RANfunctionID_ItemIEs_t));
1073 ranFuncIdItemIEs->criticality = Criticality_reject;
1074 ranFuncIdItemIEs->id = ProtocolIE_ID_id_RANfunctionID_Item;
1075 ranFuncIdItemIEs->value.present = RANfunctionID_ItemIEs__value_PR_RANfunctionID_Item;
1076 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionID = 1;
1077 ranFuncIdItemIEs->value.choice.RANfunctionID_Item.ranFunctionRevision = 4;
1078 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsID_List.list, ranFuncIdItemIEs);
1080 ASN_SEQUENCE_ADD(&serviceUpdAck->protocolIEs.list, e);
1085 auto *e = (RICserviceUpdateAcknowledge_IEs_t *)calloc(1, sizeof(RICserviceUpdateAcknowledge_IEs_t));
1086 ASN_STRUCT_RESET(asn_DEF_RICserviceUpdateAcknowledge_IEs, e);
1087 e->id = ProtocolIE_ID_id_RANfunctionsRejected;
1088 e->criticality = Criticality_reject;
1089 e->value.present = RICserviceUpdateAcknowledge_IEs__value_PR_RANfunctionsIDcause_List;
1092 auto *ranFuncIdcause = (RANfunctionIDcause_ItemIEs_t *) calloc(1, sizeof(RANfunctionIDcause_ItemIEs_t));
1093 ASN_STRUCT_RESET(asn_DEF_RANfunctionIDcause_Item, ranFuncIdcause);
1095 ranFuncIdcause->criticality = Criticality_ignore;
1096 ranFuncIdcause->id = ProtocolIE_ID_id_RANfunctionIEcause_Item;
1097 ranFuncIdcause->value.present = RANfunctionIDcause_ItemIEs__value_PR_RANfunctionIDcause_Item;
1098 ranFuncIdcause->value.choice.RANfunctionIDcause_Item.ranFunctionID = 1;
1100 ranFuncIdcause->value.choice.RANfunctionIDcause_Item.cause.present = Cause_PR_ricService;
1101 ranFuncIdcause->value.choice.RANfunctionIDcause_Item.cause.choice.ricService = 1;
1102 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsIDcause_List.list, ranFuncIdcause);
1107 auto *ranFuncIdcause = (RANfunctionIDcause_ItemIEs_t *) calloc(1, sizeof(RANfunctionIDcause_ItemIEs_t));
1108 ASN_STRUCT_RESET(asn_DEF_RANfunctionIDcause_Item, ranFuncIdcause);
1110 ranFuncIdcause->criticality = Criticality_ignore;
1111 ranFuncIdcause->id = ProtocolIE_ID_id_RANfunctionIEcause_Item;
1112 ranFuncIdcause->value.present = RANfunctionIDcause_ItemIEs__value_PR_RANfunctionIDcause_Item;
1113 ranFuncIdcause->value.choice.RANfunctionIDcause_Item.ranFunctionID = 2;
1115 ranFuncIdcause->value.choice.RANfunctionIDcause_Item.cause.present = Cause_PR_ricService;
1116 ranFuncIdcause->value.choice.RANfunctionIDcause_Item.cause.choice.ricService = 2;
1117 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsIDcause_List.list, ranFuncIdcause);
1121 auto *ranFuncIdcause = (RANfunctionIDcause_ItemIEs_t *) calloc(1, sizeof(RANfunctionIDcause_ItemIEs_t));
1122 ASN_STRUCT_RESET(asn_DEF_RANfunctionIDcause_Item, ranFuncIdcause);
1124 ranFuncIdcause->criticality = Criticality_ignore;
1125 ranFuncIdcause->id = ProtocolIE_ID_id_RANfunctionIEcause_Item;
1126 ranFuncIdcause->value.present = RANfunctionIDcause_ItemIEs__value_PR_RANfunctionIDcause_Item;
1127 ranFuncIdcause->value.choice.RANfunctionIDcause_Item.ranFunctionID = 3;
1129 ranFuncIdcause->value.choice.RANfunctionIDcause_Item.cause.present = Cause_PR_ricService;
1130 ranFuncIdcause->value.choice.RANfunctionIDcause_Item.cause.choice.ricService = 2;
1131 ASN_SEQUENCE_ADD(&e->value.choice.RANfunctionsIDcause_List.list, ranFuncIdcause);
1134 ASN_SEQUENCE_ADD(&serviceUpdAck->protocolIEs.list, e);
1139 #endif //E2_E2BUILDER_H