RICPLT-2910
libe2ap library updated and moved to 3rdparty directory
e2ap_wrapper library to be used from go:
- message wrappers (used now only in tests)
- function wrappers that manipulates message
Go wrappers for messages
Initial unittest implementation.
Change-Id: Ie77cc2ae90b83b12e5c738e6f570fe4661961da6
Signed-off-by: Juha Hyttinen <juha.hyttinen@nokia.com>
diff --git a/e2ap/libe2ap_wrapper/E2AP_if.c b/e2ap/libe2ap_wrapper/E2AP_if.c
new file mode 100644
index 0000000..9f115a0
--- /dev/null
+++ b/e2ap/libe2ap_wrapper/E2AP_if.c
@@ -0,0 +1,2079 @@
+/*
+==================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property.
+ Copyright (c) 2019 Nokia
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "E2AP-PDU.h"
+#include "ProtocolIE-Field.h"
+#include "RICsubsequentAction.h"
+#include "E2SM-gNB-X2-eventTriggerDefinition.h"
+#include "E2SM-gNB-X2-indicationHeader.h"
+#include "E2SM-gNB-X2-indicationMessage.h"
+#include "asn_constant.h"
+#include "E2AP_if.h"
+
+#ifdef DEBUG
+ static const bool debug = true;
+#else
+ static const bool debug = false;
+#endif
+
+
+const int64_t cMaxNrOfErrors = 256;
+
+const uint64_t cMaxSizeOfOctetString = 1024;
+
+const size_t cMacroENBIDP_20Bits = 20;
+const size_t cHomeENBID_28Bits = 28;
+const size_t cShortMacroENBID_18Bits = 18;
+const size_t clongMacroENBIDP_21Bits = 21;
+
+const int cRICCauseRadioNetwork = 1; // this is content of type RICCause_t
+const int cRICCauseTransport = 2; // this is content of type RICCause_t
+const int cRICCauseProtocol = 3; // this is content of type RICCause_t
+const int cRICCauseMisc = 4; // this is content of type RICCause_t
+const int cRICCauseRic = 5; // this is content of type RICCause_t
+
+//////////////////////////////////////////////////////////////////////
+// Message definitons
+
+// Below constant values are same as in E2AP, E2SM and X2AP specs
+const uint64_t cE2InitiatingMessage = 1;
+const uint64_t cE2SuccessfulOutcome = 2;
+const uint64_t cE2UnsuccessfulOutcome = 3;
+
+// E2AP messages
+// Initiating message
+const uint64_t cRICSubscriptionRequest = 1;
+const uint64_t cRICSubscriptionDeleteRequest = 2;
+const uint64_t cRICIndication = 11;
+
+// Successful outcome
+const uint64_t cRICSubscriptionResponse = 1;
+const uint64_t cRICsubscriptionDeleteResponse = 2;
+
+// Unsuccessful outcome
+const uint64_t cRICSubscriptionFailure = 1;
+const uint64_t cRICsubscriptionDeleteFailure = 2;
+
+typedef union {
+ uint32_t nodeID;
+ uint8_t octets[4];
+} IdOctects_t;
+
+//////////////////////////////////////////////////////////////////////
+const char* getE2ErrorString(uint64_t errorCode) {
+
+ return E2ErrorStrings[errorCode];
+}
+
+/////////////////////////////////////////////////////////////////////
+bool E2encode(E2AP_PDU_t* pE2AP_PDU, size_t* dataBufferSize, byte* dataBuffer, char* pLogBuffer) {
+
+ // Debug print
+ if (debug)
+ asn_fprint(stdout, &asn_DEF_E2AP_PDU, pE2AP_PDU);
+
+ asn_enc_rval_t rval;
+ rval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, pE2AP_PDU, dataBuffer, *dataBufferSize);
+ if (rval.encoded == -1) {
+ sprintf(pLogBuffer,"\nSerialization of %s failed.\n", asn_DEF_E2AP_PDU.name);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return false;
+ }
+ else if (rval.encoded > *dataBufferSize) {
+ sprintf(pLogBuffer,"\nBuffer of size %zu is too small for %s, need %zu\n",*dataBufferSize, asn_DEF_E2AP_PDU.name, rval.encoded);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return false;
+ }
+ else {
+ if (debug)
+ sprintf(pLogBuffer,"\nSuccessfully encoded %s. Buffer size %zu, encoded size %zu\n\n",asn_DEF_E2AP_PDU.name, *dataBufferSize, rval.encoded);
+
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ *dataBufferSize = rval.encoded;
+ return true;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t packRICSubscriptionRequest(size_t* pdataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionRequest_t* pRICSubscriptionRequest) {
+
+ E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t));
+ if(pE2AP_PDU)
+ {
+ pE2AP_PDU->present = E2AP_PDU_PR_initiatingMessage;
+ pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_ricSubscription;
+ pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore;
+ pE2AP_PDU->choice.initiatingMessage.value.present = RICInitiatingMessage__value_PR_RICsubscriptionRequest;
+
+ // RICrequestID
+ RICsubscriptionRequest_IEs_t* pRICsubscriptionRequest_IEs = calloc(1, sizeof(RICsubscriptionRequest_IEs_t));
+ if (pRICsubscriptionRequest_IEs) {
+ pRICsubscriptionRequest_IEs->id = ProtocolIE_ID_id_RICrequestID;
+ pRICsubscriptionRequest_IEs->criticality = Criticality_reject;
+ pRICsubscriptionRequest_IEs->value.present = RICsubscriptionRequest_IEs__value_PR_RICrequestID;
+ pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionRequest->ricRequestID.ricRequestorID;
+ pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricRequestSequenceNumber = pRICSubscriptionRequest->ricRequestID.ricRequestSequenceNumber;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list, pRICsubscriptionRequest_IEs);
+ }
+ else
+ return e2err_RICSubscriptionRequestAllocRICrequestIDFail;
+
+ // RANfunctionID
+ pRICsubscriptionRequest_IEs = calloc(1, sizeof(RICsubscriptionRequest_IEs_t));
+ if (pRICsubscriptionRequest_IEs) {
+ pRICsubscriptionRequest_IEs->id = ProtocolIE_ID_id_RANfunctionID;
+ pRICsubscriptionRequest_IEs->criticality = Criticality_reject;
+ pRICsubscriptionRequest_IEs->value.present = RICsubscriptionRequest_IEs__value_PR_RANfunctionID;
+ pRICsubscriptionRequest_IEs->value.choice.RANfunctionID = pRICSubscriptionRequest->ranFunctionID;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list, pRICsubscriptionRequest_IEs);
+ }
+ else
+ return e2err_RICSubscriptionRequestAllocRANfunctionIDFail;
+
+ // RICsubscription
+ pRICsubscriptionRequest_IEs = calloc(1, sizeof(RICsubscriptionRequest_IEs_t));
+ if (pRICsubscriptionRequest_IEs) {
+ pRICsubscriptionRequest_IEs->id = ProtocolIE_ID_id_RICsubscription;
+ pRICsubscriptionRequest_IEs->criticality = Criticality_reject;
+ pRICsubscriptionRequest_IEs->value.present = RICsubscriptionRequest_IEs__value_PR_RICsubscription;
+
+ // RICeventTriggerDefinition
+ uint64_t returnCode;
+ if ((returnCode = packRICEventTriggerDefinition(pLogBuffer, &pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition) != e2err_OK))
+ return returnCode;
+
+ pRICsubscriptionRequest_IEs->value.choice.RICsubscription.ricEventTriggerDefinition.buf =
+ calloc(1, pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.octetString.contentLength);
+ if (pRICsubscriptionRequest_IEs->value.choice.RICsubscription.ricEventTriggerDefinition.buf) {
+ pRICsubscriptionRequest_IEs->value.choice.RICsubscription.ricEventTriggerDefinition.size =
+ pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.octetString.contentLength;
+ memcpy(pRICsubscriptionRequest_IEs->value.choice.RICsubscription.ricEventTriggerDefinition.buf,
+ pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.octetString.data,
+ pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.octetString.contentLength);
+ }
+ else
+ return e2err_RICSubscriptionRequestAllocRICeventTriggerDefinitionBufFail;
+
+ // RICactions-ToBeSetup-List
+ uint64_t index = 0;
+ while (index < pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.contentLength && index < maxofRICactionID) {
+
+ RICaction_ToBeSetup_ItemIEs_t* pRICaction_ToBeSetup_ItemIEs = calloc(1, sizeof(RICaction_ToBeSetup_ItemIEs_t));
+ if (pRICaction_ToBeSetup_ItemIEs) {
+ pRICaction_ToBeSetup_ItemIEs->id = ProtocolIE_ID_id_RICaction_ToBeSetup_Item;
+ pRICaction_ToBeSetup_ItemIEs->criticality = Criticality_reject;
+ pRICaction_ToBeSetup_ItemIEs->value.present = RICaction_ToBeSetup_ItemIEs__value_PR_RICaction_ToBeSetup_Item;
+ // RICActionID
+ pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionID =
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID;
+ // RICActionType
+ pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionType =
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType;
+ }
+ else
+ return e2err_RICSubscriptionRequestAllocRICaction_ToBeSetup_ItemIEsFail;
+
+ // RICactionDefinition, OPTIONAL
+ // This is not used in RIC
+
+ // RICsubsequentAction, OPTIONAL
+ RICsubsequentAction_t* pRICsubsequentAction = calloc(1, sizeof(RICsubsequentAction_t));
+ if (pRICsubsequentAction) {
+ pRICsubsequentAction->ricSubsequentActionType =
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType;
+ pRICsubsequentAction->ricTimeToWait =
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait;
+ pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction = pRICsubsequentAction;
+ }
+ else
+ return e2err_RICSubscriptionRequestAllocRICsubsequentActionFail;
+
+ ASN_SEQUENCE_ADD(&pRICsubscriptionRequest_IEs->value.choice.RICsubscription.ricAction_ToBeSetup_List.list, pRICaction_ToBeSetup_ItemIEs);
+ index++;
+ }
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list, pRICsubscriptionRequest_IEs);
+ }
+ else
+ return e2err_RICSubscriptionRequestAllocRICsubscriptionRequest_IEsFail;
+
+ if (E2encode(pE2AP_PDU, pdataBufferSize, pDataBuffer, pLogBuffer))
+ return e2err_OK;
+ else
+ return e2err_RICSubscriptionRequestEncodeFail;
+ }
+ return e2err_RICSubscriptionRequestAllocE2AP_PDUFail;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t packRICEventTriggerDefinition(char* pLogBuffer, RICEventTriggerDefinition_t* pRICEventTriggerDefinition) {
+
+ E2SM_gNB_X2_eventTriggerDefinition_t* pE2SM_gNB_X2_eventTriggerDefinition = calloc(1, sizeof(E2SM_gNB_X2_eventTriggerDefinition_t));
+ if(pE2SM_gNB_X2_eventTriggerDefinition)
+ {
+ // RICeventTriggerDefinition
+ // InterfaceID
+ if ((pRICEventTriggerDefinition->interfaceID.globalENBIDPresent == true && pRICEventTriggerDefinition->interfaceID.globalGNBIDPresent == true) ||
+ (pRICEventTriggerDefinition->interfaceID.globalENBIDPresent == false && pRICEventTriggerDefinition->interfaceID.globalGNBIDPresent == false))
+ return e2err_RICEventTriggerDefinitionIEValueFail_1;
+
+ // GlobalENB-ID or GlobalGNB-ID
+ if (pRICEventTriggerDefinition->interfaceID.globalENBIDPresent)
+ {
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.present = Interface_ID_PR_global_eNB_ID;
+
+ // GlobalENB-ID
+ // PLMN-Identity
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.pLMN_Identity.size =
+ pRICEventTriggerDefinition->interfaceID.globalENBID.pLMNIdentity.contentLength;
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf = calloc(1,3);
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf) {
+ memcpy(pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf,
+ pRICEventTriggerDefinition->interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal,
+ pRICEventTriggerDefinition->interfaceID.globalENBID.pLMNIdentity.contentLength);
+ }
+ else
+ return e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDpLMN_IdentityBufFail;
+
+ // Add ENB-ID
+ if (pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.bits == cMacroENBIDP_20Bits){
+ // BIT STRING (SIZE (20)
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_macro_eNB_ID;
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf = calloc(1,3);
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf) {
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.size = 3; // bytes
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.bits_unused = 4; // trailing unused bits
+ memcpy(pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf,
+ (void*)&pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.nodeID,3);
+ }
+ else
+ return e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDmacro_eNB_IDBufFail;
+ }
+ else if (pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.bits == cHomeENBID_28Bits) {
+ // BIT STRING (SIZE (28)
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_home_eNB_ID;
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf = calloc(1,4);
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf) {
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.size = 4; // bytes
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.bits_unused = 4; // trailing unused bits
+ memcpy(pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf,
+ (void*)&pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.nodeID,4);
+ }
+ else
+ return e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDhome_eNB_IDBufFail;
+ }
+ else if (pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.bits == cShortMacroENBID_18Bits) {
+ // BIT STRING (SIZE(18)
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_short_Macro_eNB_ID;
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf = calloc(1,3);
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf) {
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.size = 3;
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.bits_unused = 6; // trailing unused bits
+ memcpy(pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf,
+ (void*)&pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.nodeID,3);
+ }
+ else
+ return e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDshort_Macro_eNB_IDBufFail;
+ }
+ else if (pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.bits == clongMacroENBIDP_21Bits) {
+ // BIT STRING (SIZE(21)
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_long_Macro_eNB_ID;
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf = calloc(1,3);
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf) {
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.size = 3; // bytes
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.bits_unused = 3; // trailing unused bits
+ memcpy(pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf,
+ (void*)&pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.nodeID,3);
+ }
+ else
+ return e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDlong_Macro_eNB_IDBufFail;
+ }
+ else
+ return e2err_RICEventTriggerDefinitionIEValueFail_2;
+
+ }
+ else if (pRICEventTriggerDefinition->interfaceID.globalGNBIDPresent) {
+ // GlobalGNB-ID
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.present = Interface_ID_PR_global_gNB_ID;
+
+ // PLMN-Identity
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.pLMN_Identity.size =
+ pRICEventTriggerDefinition->interfaceID.globalGNBID.pLMNIdentity.contentLength;
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.pLMN_Identity.buf =
+ calloc(1,pRICEventTriggerDefinition->interfaceID.globalGNBID.pLMNIdentity.contentLength);
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.pLMN_Identity.buf) {
+ memcpy(pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.pLMN_Identity.buf,
+ (void*)&pRICEventTriggerDefinition->interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal,
+ pRICEventTriggerDefinition->interfaceID.globalGNBID.pLMNIdentity.contentLength);
+ }
+ else
+ return e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_gNB_IDpLMN_IdentityBufFail;
+
+ // GNB-ID, BIT STRING (SIZE (22..32)
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.size = 4; //32bits
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf = calloc(1, 4);
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf) {
+ memcpy(pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf,
+ (void*)&pRICEventTriggerDefinition->interfaceID.globalGNBID,4); //32bits
+ }
+ else
+ return e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_gNB_IDgNB_IDBufFail;
+ }
+ else
+ return e2err_RICEventTriggerDefinitionIEValueFail_3;
+
+ // InterfaceDirection
+ pE2SM_gNB_X2_eventTriggerDefinition->interfaceDirection = pRICEventTriggerDefinition->interfaceDirection;
+
+ // InterfaceMessageType
+ // ProcedureCode
+ pE2SM_gNB_X2_eventTriggerDefinition->interfaceMessageType.procedureCode = pRICEventTriggerDefinition->interfaceMessageType.procedureCode;
+
+ // TypeOfMessage
+ if(pRICEventTriggerDefinition->interfaceMessageType.typeOfMessage == cE2InitiatingMessage)
+ pE2SM_gNB_X2_eventTriggerDefinition->interfaceMessageType.typeOfMessage = TypeOfMessage_initiating_message;
+ else if(pRICEventTriggerDefinition->interfaceMessageType.typeOfMessage == cE2SuccessfulOutcome)
+ pE2SM_gNB_X2_eventTriggerDefinition->interfaceMessageType.typeOfMessage = TypeOfMessage_successful_outcome;
+ else if(pRICEventTriggerDefinition->interfaceMessageType.typeOfMessage == cE2UnsuccessfulOutcome)
+ pE2SM_gNB_X2_eventTriggerDefinition->interfaceMessageType.typeOfMessage = TypeOfMessage_unsuccessful_outcome;
+ else
+ return e2err_RICEventTriggerDefinitionIEValueFail_4;
+
+ // InterfaceProtocolIE-List, OPTIONAL
+
+ // Debug print
+ if (debug)
+ asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, pE2SM_gNB_X2_eventTriggerDefinition);
+
+ // Encode
+ size_t bufferSize = sizeof(pRICEventTriggerDefinition->octetString.data);
+ asn_enc_rval_t rval;
+ rval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, pE2SM_gNB_X2_eventTriggerDefinition,
+ pRICEventTriggerDefinition->octetString.data, bufferSize);
+ if(rval.encoded == -1)
+ {
+ sprintf(pLogBuffer,"\nSerialization of %s failed.\n", asn_DEF_E2SM_gNB_X2_eventTriggerDefinition.name);
+ return e2err_RICEventTriggerDefinitionPackFail_1;
+ }
+ else if(rval.encoded > bufferSize)
+ {
+ sprintf(pLogBuffer,"\nBuffer of size %zu is too small for %s, need %zu\n",bufferSize, asn_DEF_E2SM_gNB_X2_eventTriggerDefinition.name, rval.encoded);
+ return e2err_RICEventTriggerDefinitionPackFail_2;
+ }
+ else
+ if (debug)
+ sprintf(pLogBuffer,"\nSuccessfully encoded %s. Buffer size %zu, encoded size %zu\n\n",asn_DEF_E2SM_gNB_X2_eventTriggerDefinition.name, bufferSize, rval.encoded);
+
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, pE2SM_gNB_X2_eventTriggerDefinition);
+
+ pRICEventTriggerDefinition->octetString.contentLength = rval.encoded;
+ return e2err_OK;
+ }
+ return e2err_RICEventTriggerDefinitionAllocE2SM_gNB_X2_eventTriggerDefinitionFail;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t packRICSubscriptionResponse(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionResponse_t* pRICSubscriptionResponse) {
+
+ E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t));
+ if(pE2AP_PDU)
+ {
+ pE2AP_PDU->present = E2AP_PDU_PR_successfulOutcome;
+ pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_ricSubscription;
+ pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore;
+ pE2AP_PDU->choice.initiatingMessage.value.present = RICSuccessfulOutcome__value_PR_RICsubscriptionResponse;
+
+ // RICrequestID
+ RICsubscriptionResponse_IEs_t* pRICsubscriptionResponse_IEs = calloc(1, sizeof(RICsubscriptionResponse_IEs_t));
+ if (pRICsubscriptionResponse_IEs) {
+ pRICsubscriptionResponse_IEs->id = ProtocolIE_ID_id_RICrequestID;
+ pRICsubscriptionResponse_IEs->criticality = Criticality_reject;
+ pRICsubscriptionResponse_IEs->value.present = RICsubscriptionResponse_IEs__value_PR_RICrequestID;
+ pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionResponse->ricRequestID.ricRequestorID;
+ pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricRequestSequenceNumber = pRICSubscriptionResponse->ricRequestID.ricRequestSequenceNumber;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list, pRICsubscriptionResponse_IEs);
+ }
+ else
+ return e2err_RICSubscriptionResponseAllocRICrequestIDFail;
+
+ // RANfunctionID
+ pRICsubscriptionResponse_IEs = calloc(1, sizeof(RICsubscriptionResponse_IEs_t));
+ if (pRICsubscriptionResponse_IEs) {
+ pRICsubscriptionResponse_IEs->id = ProtocolIE_ID_id_RANfunctionID;
+ pRICsubscriptionResponse_IEs->criticality = Criticality_reject;
+ pRICsubscriptionResponse_IEs->value.present = RICsubscriptionResponse_IEs__value_PR_RANfunctionID;
+ pRICsubscriptionResponse_IEs->value.choice.RANfunctionID = pRICSubscriptionResponse->ranFunctionID;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list, pRICsubscriptionResponse_IEs);
+ }
+ else
+ return e2err_RICSubscriptionResponseAllocRANfunctionIDFail;
+
+ // RICaction-Admitted list
+ pRICsubscriptionResponse_IEs = calloc(1, sizeof(RICsubscriptionResponse_IEs_t));
+ if (pRICsubscriptionResponse_IEs) {
+ pRICsubscriptionResponse_IEs->id = ProtocolIE_ID_id_RICactions_Admitted;
+ pRICsubscriptionResponse_IEs->criticality = Criticality_reject;
+ pRICsubscriptionResponse_IEs->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_Admitted_List;
+
+ uint64_t index = 0;
+ while (index < pRICSubscriptionResponse->ricActionAdmittedList.contentLength && index < maxofRICactionID) {
+
+ RICaction_Admitted_ItemIEs_t* pRICaction_Admitted_ItemIEs = calloc(1, sizeof (RICaction_Admitted_ItemIEs_t));
+ if (pRICaction_Admitted_ItemIEs)
+ {
+ pRICaction_Admitted_ItemIEs->id = ProtocolIE_ID_id_RICaction_Admitted_Item;
+ pRICaction_Admitted_ItemIEs->criticality = Criticality_reject;
+ pRICaction_Admitted_ItemIEs->value.present = RICaction_Admitted_ItemIEs__value_PR_RICaction_Admitted_Item;
+
+ // RICActionID
+ pRICaction_Admitted_ItemIEs->value.choice.RICaction_Admitted_Item.ricActionID = pRICSubscriptionResponse->ricActionAdmittedList.ricActionID[index];
+ ASN_SEQUENCE_ADD(&pRICsubscriptionResponse_IEs->value.choice.RICaction_Admitted_List.list, pRICaction_Admitted_ItemIEs);
+ }
+ else
+ return e2err_RICSubscriptionResponseAllocRICaction_Admitted_ItemIEsFail;
+ index++;
+ }
+ }
+ else
+ return e2err_RICSubscriptionResponseAllocRICActionAdmittedListFail;
+
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list, pRICsubscriptionResponse_IEs);
+
+ // RICaction-NotAdmitted list
+ if (pRICSubscriptionResponse->ricActionNotAdmittedListPresent) {
+ pRICsubscriptionResponse_IEs = calloc(1, sizeof(RICsubscriptionResponse_IEs_t));
+ if (pRICsubscriptionResponse_IEs) {
+ pRICsubscriptionResponse_IEs->id = ProtocolIE_ID_id_RICactions_NotAdmitted;
+ pRICsubscriptionResponse_IEs->criticality = Criticality_reject;
+ pRICsubscriptionResponse_IEs->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_NotAdmitted_List;
+
+ uint64_t index = 0;
+ while (index < pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength && index < maxofRICactionID) {
+
+ RICaction_NotAdmitted_ItemIEs_t* pRICaction_NotAdmitted_ItemIEs = calloc(1, sizeof (RICaction_NotAdmitted_ItemIEs_t));
+ if (pRICaction_NotAdmitted_ItemIEs)
+ {
+ pRICaction_NotAdmitted_ItemIEs->id = ProtocolIE_ID_id_RICaction_NotAdmitted_Item;
+ pRICaction_NotAdmitted_ItemIEs->criticality = Criticality_reject;
+ pRICaction_NotAdmitted_ItemIEs->value.present = RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;
+
+ // RICActionID
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricActionID =
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID;
+
+ // RICCause
+ if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_radioNetwork) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_radioNetwork;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork =
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ else if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_transport) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_transport;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport =
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ else if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_protocol) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_protocol;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol =
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ else if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_misc) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_misc;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc =
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ else if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_ric) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_ric;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric =
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ ASN_SEQUENCE_ADD(&pRICsubscriptionResponse_IEs->value.choice.RICaction_NotAdmitted_List.list, pRICaction_NotAdmitted_ItemIEs);
+ }
+ else
+ return e2err_RICSubscriptionResponseAllocRICaction_NotAdmitted_ItemIEsFail;
+ index++;
+ }
+ }
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list, pRICsubscriptionResponse_IEs);
+ }
+ else
+ return e2err_RICSubscriptionResponseAllocRICActionNotAdmittedListFail;
+
+ if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer))
+ return e2err_OK;
+ else
+ return e2err_RICSubscriptionResponseEncodeFail;
+ }
+ return e2err_RICSubscriptionResponseAllocE2AP_PDUFail;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t packRICSubscriptionFailure(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionFailure_t* pRICSubscriptionFailure) {
+
+ E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t));
+ if(pE2AP_PDU)
+ {
+ pE2AP_PDU->present = E2AP_PDU_PR_unsuccessfulOutcome;
+ pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode = ProcedureCode_id_ricSubscription;
+ pE2AP_PDU->choice.unsuccessfulOutcome.criticality = Criticality_ignore;
+ pE2AP_PDU->choice.unsuccessfulOutcome.value.present = RICUnsuccessfulOutcome__value_PR_RICsubscriptionFailure;
+
+ // RICrequestID
+ RICsubscriptionFailure_IEs_t* pRICsubscriptionFailure_IEs = calloc(1, sizeof(RICsubscriptionFailure_IEs_t));
+ if (pRICsubscriptionFailure_IEs) {
+ pRICsubscriptionFailure_IEs->id = ProtocolIE_ID_id_RICrequestID;
+ pRICsubscriptionFailure_IEs->criticality = Criticality_reject;
+ pRICsubscriptionFailure_IEs->value.present = RICsubscriptionFailure_IEs__value_PR_RICrequestID;
+ pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionFailure->ricRequestID.ricRequestorID;
+ pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricRequestSequenceNumber = pRICSubscriptionFailure->ricRequestID.ricRequestSequenceNumber;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list, pRICsubscriptionFailure_IEs);
+ }
+ else
+ return e2err_RICSubscriptionFailureAllocRICrequestIDFail;
+
+ // RANfunctionID
+ pRICsubscriptionFailure_IEs = calloc(1, sizeof(RICsubscriptionFailure_IEs_t));
+ if (pRICsubscriptionFailure_IEs) {
+ pRICsubscriptionFailure_IEs->id = ProtocolIE_ID_id_RANfunctionID;
+ pRICsubscriptionFailure_IEs->criticality = Criticality_reject;
+ pRICsubscriptionFailure_IEs->value.present = RICsubscriptionFailure_IEs__value_PR_RANfunctionID;
+ pRICsubscriptionFailure_IEs->value.choice.RANfunctionID = pRICSubscriptionFailure->ranFunctionID;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list, pRICsubscriptionFailure_IEs);
+ }
+ else
+ return e2err_RICSubscriptionFailureAllocRANfunctionIDFail;
+
+ // RICaction-NotAdmitted list
+ pRICsubscriptionFailure_IEs = calloc(1, sizeof(RICsubscriptionFailure_IEs_t));
+ if (pRICsubscriptionFailure_IEs) {
+ pRICsubscriptionFailure_IEs->id = ProtocolIE_ID_id_RICactions_NotAdmitted;
+ pRICsubscriptionFailure_IEs->criticality = Criticality_reject;
+ pRICsubscriptionFailure_IEs->value.present = RICsubscriptionFailure_IEs__value_PR_RICaction_NotAdmitted_List;
+
+ uint64_t index = 0;
+ while (index < pRICSubscriptionFailure->ricActionNotAdmittedList.contentLength && index < maxofRICactionID) {
+
+ RICaction_NotAdmitted_ItemIEs_t* pRICaction_NotAdmitted_ItemIEs = calloc(1, sizeof (RICaction_NotAdmitted_ItemIEs_t));
+ if (pRICaction_NotAdmitted_ItemIEs)
+ {
+ pRICaction_NotAdmitted_ItemIEs->id = ProtocolIE_ID_id_RICaction_NotAdmitted_Item;
+ pRICaction_NotAdmitted_ItemIEs->criticality = Criticality_reject;
+ pRICaction_NotAdmitted_ItemIEs->value.present = RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;
+
+ // RICActionID
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricActionID =
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID;
+
+ // RICCause
+ if (pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_radioNetwork) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_radioNetwork;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork =
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ else if (pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_transport) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_transport;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport =
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ else if (pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_protocol) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_protocol;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol =
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ else if (pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_misc) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_misc;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc =
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ else if (pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content == RICcause_PR_ric) {
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present = RICcause_PR_ric;
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric =
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause;
+ }
+ ASN_SEQUENCE_ADD(&pRICsubscriptionFailure_IEs->value.choice.RICaction_NotAdmitted_List.list, pRICaction_NotAdmitted_ItemIEs);
+ }
+ else
+ return e2err_RICSubscriptionFailureAllocRICaction_NotAdmitted_ItemIEsFail;
+ index++;
+ }
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list, pRICsubscriptionFailure_IEs);
+ }
+ else
+ return e2err_RICSubscriptionFailureAllocRICActionAdmittedListFail;
+
+ // CriticalityDiagnostics, OPTIONAL. Not used in RIC
+
+ if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer))
+ return e2err_OK;
+ else
+ return e2err_RICSubscriptionFailureEncodeFail;
+ }
+ else
+ return e2err_RICSubscriptionFailureAllocE2AP_PDUFail;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t packRICIndication(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICIndication_t* pRICIndication) {
+
+ E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t));
+ if(pE2AP_PDU)
+ {
+ pE2AP_PDU->present = E2AP_PDU_PR_initiatingMessage;
+ pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_ricIndication;
+ pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore;
+ pE2AP_PDU->choice.initiatingMessage.value.present = RICInitiatingMessage__value_PR_RICindication;
+
+ // RICrequestID
+ RICindication_IEs_t* pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t));
+ if (pRICindication_IEs) {
+ pRICindication_IEs->id = ProtocolIE_ID_id_RICrequestID;
+ pRICindication_IEs->criticality = Criticality_reject;
+ pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICrequestID;
+ pRICindication_IEs->value.choice.RICrequestID.ricRequestorID = pRICIndication->ricRequestID.ricRequestorID;
+ pRICindication_IEs->value.choice.RICrequestID.ricRequestSequenceNumber = pRICIndication->ricRequestID.ricRequestSequenceNumber;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs);
+ }
+ else
+ return e2err_RICIndicationRICrequestIDFail;
+
+ // RANfunctionID
+ pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t));
+ if (pRICindication_IEs) {
+ pRICindication_IEs->id = ProtocolIE_ID_id_RANfunctionID;
+ pRICindication_IEs->criticality = Criticality_reject;
+ pRICindication_IEs->value.present = RICindication_IEs__value_PR_RANfunctionID;
+ pRICindication_IEs->value.choice.RANfunctionID = pRICIndication->ranFunctionID;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs);
+ }
+ else
+ return e2err_RICIndicationAllocRANfunctionIDFail;
+
+ // RICactionID
+ pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t));
+ if (pRICindication_IEs) {
+ pRICindication_IEs->id = ProtocolIE_ID_id_RICactionID;
+ pRICindication_IEs->criticality = Criticality_reject;
+ pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICactionID;
+ pRICindication_IEs->value.choice.RICactionID = pRICIndication->ricActionID;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs);
+ }
+ else
+ return e2err_RICIndicationAllocRICactionIDFail;
+
+ // RICindicationSN
+ pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t));
+ if (pRICindication_IEs) {
+ pRICindication_IEs->id = ProtocolIE_ID_id_RICindicationSN;
+ pRICindication_IEs->criticality = Criticality_reject;
+ pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICindicationSN;
+ pRICindication_IEs->value.choice.RICindicationSN = pRICIndication->ricIndicationSN;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs);
+ }
+ else
+ return e2err_RICIndicationAllocRICindicationSNFail;
+
+ // RICindicationType
+ pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t));
+ if (pRICindication_IEs) {
+ pRICindication_IEs->id = ProtocolIE_ID_id_RICindicationType;
+ pRICindication_IEs->criticality = Criticality_reject;
+ pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICindicationType;
+ pRICindication_IEs->value.choice.RICindicationType = pRICIndication->ricIndicationType;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs);
+ }
+ else
+ return e2err_RICIndicationAllocRICindicationTypeFail;
+
+ // RICindicationHeader
+ uint64_t returnCode;
+ uint64_t logBufferSize = 512;
+ char logBuffer[logBufferSize];
+ if ((returnCode = packRICIndicationHeader(logBuffer, &pRICIndication->ricIndicationHeader)) != e2err_OK) {
+ return returnCode;
+ }
+
+ pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t));
+ if (pRICindication_IEs) {
+ pRICindication_IEs->id = ProtocolIE_ID_id_RICindicationHeader;
+ pRICindication_IEs->criticality = Criticality_reject;
+ pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICindicationHeader;
+ pRICindication_IEs->value.choice.RICindicationHeader.buf = calloc(1,pRICIndication->ricIndicationHeader.octetString.contentLength);
+ if (pRICindication_IEs->value.choice.RICindicationHeader.buf) {
+ pRICindication_IEs->value.choice.RICindicationHeader.size = pRICIndication->ricIndicationHeader.octetString.contentLength;
+ memcpy(pRICindication_IEs->value.choice.RICindicationHeader.buf,pRICIndication->ricIndicationHeader.octetString.data,
+ pRICIndication->ricIndicationHeader.octetString.contentLength);
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs);
+ }
+ else
+ return e2err_RICIndicationAllocRRICindicationHeaderBufFail;
+ }
+ else
+ return e2err_RICIndicationAllocRICindicationHeaderFail;
+
+ // RICindicationMessage
+ if ((returnCode = packRICIndicationMessage(logBuffer, &pRICIndication->ricIndicationMessage)) != e2err_OK) {
+ return returnCode;
+ }
+
+ pRICindication_IEs = calloc(1, sizeof(RICindication_IEs_t));
+ if (pRICindication_IEs) {
+ pRICindication_IEs->id = ProtocolIE_ID_id_RICindicationMessage;
+ pRICindication_IEs->criticality = Criticality_reject;
+ pRICindication_IEs->value.present = RICindication_IEs__value_PR_RICindicationMessage;
+ pRICindication_IEs->value.choice.RICindicationMessage.buf = calloc(1,pRICIndication->ricIndicationMessage.octetString.contentLength);
+ if (pRICindication_IEs->value.choice.RICindicationMessage.buf) {
+ pRICindication_IEs->value.choice.RICindicationMessage.size = pRICIndication->ricIndicationMessage.octetString.contentLength;
+ memcpy(pRICindication_IEs->value.choice.RICindicationHeader.buf,pRICIndication->ricIndicationMessage.octetString.data,
+ pRICIndication->ricIndicationMessage.octetString.contentLength);
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list, pRICindication_IEs);
+ }
+ else
+ return e2err_RICIndicationAllocRICindicationMessageBufFail;
+ }
+ else
+ return e2err_RICIndicationAllocRICindicationMessageFail;
+
+ // RICcallProcessID, OPTIONAL. Not used in RIC.
+
+ if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer))
+ return e2err_OK;
+ else
+ return e2err_RICIndicationEncodeFail;
+ }
+ else
+ return e2err_RICIndicationAllocE2AP_PDUFail;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t packRICIndicationHeader(char* pLogBuffer, RICIndicationHeader_t* pRICIndicationHeader) {
+
+ E2SM_gNB_X2_indicationHeader_t* pE2SM_gNB_X2_indicationHeader = calloc(1, sizeof(E2SM_gNB_X2_indicationHeader_t));
+ if(pE2SM_gNB_X2_indicationHeader)
+ {
+ // InterfaceID
+ if ((pRICIndicationHeader->interfaceID.globalENBIDPresent == true && pRICIndicationHeader->interfaceID.globalGNBIDPresent == true) ||
+ (pRICIndicationHeader->interfaceID.globalENBIDPresent == false && pRICIndicationHeader->interfaceID.globalGNBIDPresent == false))
+ return e2err_RICindicationHeaderIEValueFail_1;
+
+ // GlobalENB-ID or GlobalGNB-ID
+ if (pRICIndicationHeader->interfaceID.globalENBIDPresent)
+ {
+ pE2SM_gNB_X2_indicationHeader->interface_ID.present = Interface_ID_PR_global_eNB_ID;
+
+ // GlobalENB-ID
+ // PLMN-Identity
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.size =
+ pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.contentLength;
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf = calloc(1,3);
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf) {
+ memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf,
+ pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal,
+ pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.contentLength);
+ }
+ else
+ return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDpLMN_IdentityBufFail;
+
+ // Add ENB-ID
+ if (pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits == cMacroENBIDP_20Bits){
+ // BIT STRING (SIZE (20)
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_macro_eNB_ID;
+
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf = calloc(1,3);
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf) {
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.size = 3; // bytes
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.bits_unused = 4; // trailing unused bits
+ memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf,
+ (void*)&pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID,3);
+ }
+ else
+ return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDmacro_eNB_IDBufFail;
+ }
+ else if (pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits == cHomeENBID_28Bits) {
+ // BIT STRING (SIZE (28)
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_home_eNB_ID;
+
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf = calloc(1,4);
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf) {
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.size = 4; // bytes
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.bits_unused = 4; // trailing unused bits
+ memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf,
+ (void*)&pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID,4);
+ }
+ else
+ return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDhome_eNB_IDBufFail;
+ }
+ else if (pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits == cShortMacroENBID_18Bits) {
+ // BIT STRING (SIZE(18)
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_short_Macro_eNB_ID;
+
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf = calloc(1,3);
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf) {
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.size = 3;
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.bits_unused = 6; // trailing unused bits
+ memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf,
+ (void*)&pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID,3);
+ }
+ else
+ return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDshort_Macro_eNB_IDBufFail;
+ }
+ else if (pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits == clongMacroENBIDP_21Bits) {
+ // BIT STRING (SIZE(21)
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present = ENB_ID_PR_long_Macro_eNB_ID;
+
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf = calloc(1,3);
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf) {
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.size = 3; // bytes
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.bits_unused = 3; // trailing unused bits
+ memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf,
+ (void*)&pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID,3);
+ }
+ else
+ return e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDlong_Macro_eNB_IDBufFail;
+ }
+ else
+ return e2err_RICindicationHeaderIEValueFail_2;
+
+ }
+ else if (pRICIndicationHeader->interfaceID.globalGNBIDPresent) {
+ // GlobalGNB-ID
+ pE2SM_gNB_X2_indicationHeader->interface_ID.present = Interface_ID_PR_global_gNB_ID;
+
+ // PLMN-Identity
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.pLMN_Identity.size =
+ pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength;
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.pLMN_Identity.buf =
+ calloc(1,pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength);
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.pLMN_Identity.buf) {
+ memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.pLMN_Identity.buf,
+ (void*)&pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal,
+ pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength);
+ }
+ else
+ return e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDpLMN_IdentityBufFail;
+
+ // GNB-ID, BIT STRING (SIZE (22..32)
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.size = 4; //32bits
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf = calloc(1,4);
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf) {
+ memcpy(pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf,
+ (void*)&pRICIndicationHeader->interfaceID.globalGNBID,4); //32bits
+ }
+ else
+ return e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDgNB_IDgNB_IDBufFail;
+ }
+ else
+ return e2err_RICindicationHeaderIEValueFail_3;
+
+ // InterfaceDirection
+ pE2SM_gNB_X2_indicationHeader->interfaceDirection = pRICIndicationHeader->interfaceDirection;
+
+ // TimeStamp OPTIONAL. Not used in RIC.
+
+ // Debug print
+ if (debug)
+ asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader);
+
+ // Encode
+ size_t bufferSize = sizeof(pRICIndicationHeader->octetString.data);
+ asn_enc_rval_t rval;
+ rval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader,
+ pRICIndicationHeader->octetString.data, bufferSize);
+ if(rval.encoded == -1)
+ {
+ sprintf(pLogBuffer,"\nSerialization of %s failed.\n", asn_DEF_E2SM_gNB_X2_indicationHeader.name);
+ return e2err_RICindicationHeaderPackFail_1;
+ }
+ else if(rval.encoded > bufferSize)
+ {
+ sprintf(pLogBuffer,"\nBuffer of size %zu is too small for %s, need %zu\n",bufferSize, asn_DEF_E2SM_gNB_X2_indicationHeader.name, rval.encoded);
+ return e2err_RICindicationHeaderPackFail_2;
+ }
+ else
+ if (debug)
+ sprintf(pLogBuffer,"\nSuccessfully encoded %s. Buffer size %zu, encoded size %zu\n\n",asn_DEF_E2SM_gNB_X2_indicationHeader.name, bufferSize, rval.encoded);
+
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader);
+
+ pRICIndicationHeader->octetString.contentLength = rval.encoded;
+ return e2err_OK;
+ }
+ else
+ return e2err_RICIndicationHeaderAllocE2AP_PDUFail;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t packRICIndicationMessage(char* pLogBuffer, RICIndicationMessage_t* pRICIndicationMessage) {
+
+ E2SM_gNB_X2_indicationMessage_t* pE2SM_gNB_X2_indicationMessage = calloc(1, sizeof(E2SM_gNB_X2_indicationMessage_t));
+ if(pE2SM_gNB_X2_indicationMessage)
+ {
+ pE2SM_gNB_X2_indicationMessage->interfaceMessage.buf = calloc(1, pRICIndicationMessage->interfaceMessage.contentLength);
+ if(pE2SM_gNB_X2_indicationMessage->interfaceMessage.buf)
+ {
+ pE2SM_gNB_X2_indicationMessage->interfaceMessage.size = pRICIndicationMessage->interfaceMessage.contentLength;
+ memcpy(pE2SM_gNB_X2_indicationMessage->interfaceMessage.buf,pRICIndicationMessage->interfaceMessage.data,pRICIndicationMessage->interfaceMessage.contentLength);
+ }
+ else
+ return e2err_RICIndicationMessageAllocinterfaceMessageFail;
+
+ // Debug print
+ if (debug)
+ asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage);
+
+ // Encode
+ size_t bufferSize = sizeof(pRICIndicationMessage->octetString.data);
+ asn_enc_rval_t rval;
+ rval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage,
+ pRICIndicationMessage->octetString.data, bufferSize);
+ if(rval.encoded == -1)
+ {
+ sprintf(pLogBuffer,"\nSerialization of %s failed.\n", asn_DEF_E2SM_gNB_X2_indicationMessage.name);
+ return e2err_RICindicationMessagePackFail_1;
+ }
+ else if(rval.encoded > bufferSize)
+ {
+ sprintf(pLogBuffer,"\nBuffer of size %zu is too small for %s, need %zu\n",bufferSize, asn_DEF_E2SM_gNB_X2_indicationMessage.name, rval.encoded);
+ return e2err_RICindicationMessagePackFail_2;
+ }
+ else
+ if (debug)
+ sprintf(pLogBuffer,"\nSuccessfully encoded %s. Buffer size %zu, encoded size %zu\n\n",asn_DEF_E2SM_gNB_X2_indicationMessage.name, bufferSize, rval.encoded);
+
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage);
+
+ pRICIndicationMessage->octetString.contentLength = rval.encoded;
+ return e2err_OK;
+ }
+ else
+ return e2err_E2SM_gNB_X2_indicationMessageAllocE2AP_PDUFail;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t packRICSubscriptionDeleteRequest(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionDeleteRequest_t* pRICSubscriptionDeleteRequest) {
+
+ E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t));
+ if(pE2AP_PDU)
+ {
+ pE2AP_PDU->present = E2AP_PDU_PR_initiatingMessage;
+ pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_ricSubscriptionDelete;
+ pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore;
+ pE2AP_PDU->choice.initiatingMessage.value.present = RICInitiatingMessage__value_PR_RICsubscriptionDeleteRequest;
+
+ // RICrequestID
+ RICsubscriptionDeleteRequest_IEs_t* pRICsubscriptionDeleteRequest_IEs = calloc(1, sizeof(RICsubscriptionDeleteRequest_IEs_t));
+ if (pRICsubscriptionDeleteRequest_IEs) {
+ pRICsubscriptionDeleteRequest_IEs->id = ProtocolIE_ID_id_RICrequestID;
+ pRICsubscriptionDeleteRequest_IEs->criticality = Criticality_reject;
+ pRICsubscriptionDeleteRequest_IEs->value.present = RICsubscriptionDeleteRequest_IEs__value_PR_RICrequestID;
+ pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionDeleteRequest->ricRequestID.ricRequestorID;
+ pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricRequestSequenceNumber = pRICSubscriptionDeleteRequest->ricRequestID.ricRequestSequenceNumber;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest.protocolIEs.list, pRICsubscriptionDeleteRequest_IEs);
+ }
+ else
+ return e2err_RICSubscriptionDeleteRequestAllocRICrequestIDFail;
+
+ // RANfunctionID
+ pRICsubscriptionDeleteRequest_IEs = calloc(1, sizeof(RICsubscriptionDeleteRequest_IEs_t));
+ if (pRICsubscriptionDeleteRequest_IEs) {
+ pRICsubscriptionDeleteRequest_IEs->id = ProtocolIE_ID_id_RANfunctionID;
+ pRICsubscriptionDeleteRequest_IEs->criticality = Criticality_reject;
+ pRICsubscriptionDeleteRequest_IEs->value.present = RICsubscriptionDeleteRequest_IEs__value_PR_RANfunctionID;
+ pRICsubscriptionDeleteRequest_IEs->value.choice.RANfunctionID = pRICSubscriptionDeleteRequest->ranFunctionID;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest.protocolIEs.list, pRICsubscriptionDeleteRequest_IEs);
+ }
+ else
+ return e2err_RICSubscriptionDeleteRequestAllocRANfunctionIDFail;
+
+ if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer))
+ return e2err_OK;
+ else
+ return e2err_RICSubscriptionDeleteRequestEncodeFail;
+ }
+ else
+ return e2err_RICSubscriptionDeleteRequestAllocE2AP_PDUFail;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t packRICSubscriptionDeleteResponse(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionDeleteResponse_t* pRICSubscriptionDeleteResponse) {
+
+ E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t));
+ if(pE2AP_PDU)
+ {
+ pE2AP_PDU->present = E2AP_PDU_PR_successfulOutcome;
+ pE2AP_PDU->choice.successfulOutcome.procedureCode = ProcedureCode_id_ricSubscriptionDelete;
+ pE2AP_PDU->choice.successfulOutcome.criticality = Criticality_ignore;
+ pE2AP_PDU->choice.successfulOutcome.value.present = RICSuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse;
+
+ // RICrequestID
+ RICsubscriptionDeleteResponse_IEs_t* pRICsubscriptionDeleteResponse_IEs = calloc(1, sizeof(RICsubscriptionDeleteResponse_IEs_t));
+ if (pRICsubscriptionDeleteResponse_IEs) {
+ pRICsubscriptionDeleteResponse_IEs->id = ProtocolIE_ID_id_RICrequestID;
+ pRICsubscriptionDeleteResponse_IEs->criticality = Criticality_reject;
+ pRICsubscriptionDeleteResponse_IEs->value.present = RICsubscriptionDeleteResponse_IEs__value_PR_RICrequestID;
+ pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionDeleteResponse->ricRequestID.ricRequestorID;
+ pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricRequestSequenceNumber = pRICSubscriptionDeleteResponse->ricRequestID.ricRequestSequenceNumber;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse.protocolIEs.list, pRICsubscriptionDeleteResponse_IEs);
+ }
+ else
+ return e2err_RICSubscriptionDeleteResponseAllocRICrequestIDFail;
+
+ // RANfunctionID
+ pRICsubscriptionDeleteResponse_IEs = calloc(1, sizeof(RICsubscriptionDeleteResponse_IEs_t));
+ if (pRICsubscriptionDeleteResponse_IEs) {
+ pRICsubscriptionDeleteResponse_IEs->id = ProtocolIE_ID_id_RANfunctionID;
+ pRICsubscriptionDeleteResponse_IEs->criticality = Criticality_reject;
+ pRICsubscriptionDeleteResponse_IEs->value.present = RICsubscriptionDeleteResponse_IEs__value_PR_RANfunctionID;
+ pRICsubscriptionDeleteResponse_IEs->value.choice.RANfunctionID = pRICSubscriptionDeleteResponse->ranFunctionID;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse.protocolIEs.list, pRICsubscriptionDeleteResponse_IEs);
+ }
+ else
+ return e2err_RICSubscriptionDeleteResponseAllocRANfunctionIDFail;
+
+ if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer))
+ return e2err_OK;
+ else
+ return e2err_RICSubscriptionDeleteResponseEncodeFail;
+ }
+ else
+ return e2err_RICSubscriptionDeleteResponseAllocE2AP_PDUFail;
+}
+
+uint64_t packRICSubscriptionDeleteFailure(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionDeleteFailure_t* pRICSubscriptionDeleteFailure) {
+
+ E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t));
+ if(pE2AP_PDU)
+ {
+ pE2AP_PDU->present = E2AP_PDU_PR_unsuccessfulOutcome;
+ pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode = ProcedureCode_id_ricSubscriptionDelete;
+ pE2AP_PDU->choice.unsuccessfulOutcome.criticality = Criticality_ignore;
+ pE2AP_PDU->choice.unsuccessfulOutcome.value.present = RICUnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure;
+
+ // RICrequestID
+ RICsubscriptionDeleteFailure_IEs_t* pRICsubscriptionDeleteFailure_IEs = calloc(1, sizeof(RICsubscriptionDeleteFailure_IEs_t));
+ if (pRICsubscriptionDeleteFailure_IEs) {
+ pRICsubscriptionDeleteFailure_IEs->id = ProtocolIE_ID_id_RICrequestID;
+ pRICsubscriptionDeleteFailure_IEs->criticality = Criticality_reject;
+ pRICsubscriptionDeleteFailure_IEs->value.present = RICsubscriptionDeleteFailure_IEs__value_PR_RICrequestID;
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionDeleteFailure->ricRequestID.ricRequestorID;
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricRequestSequenceNumber = pRICSubscriptionDeleteFailure->ricRequestID.ricRequestSequenceNumber;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list, pRICsubscriptionDeleteFailure_IEs);
+ }
+ else
+ return e2err_RICSubscriptionDeleteFailureAllocRICrequestIDFail;
+
+ // RANfunctionID
+ pRICsubscriptionDeleteFailure_IEs = calloc(1, sizeof(RICsubscriptionDeleteFailure_IEs_t));
+ if (pRICsubscriptionDeleteFailure_IEs) {
+ pRICsubscriptionDeleteFailure_IEs->id = ProtocolIE_ID_id_RANfunctionID;
+ pRICsubscriptionDeleteFailure_IEs->criticality = Criticality_reject;
+ pRICsubscriptionDeleteFailure_IEs->value.present = RICsubscriptionDeleteFailure_IEs__value_PR_RANfunctionID;
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RANfunctionID = pRICSubscriptionDeleteFailure->ranFunctionID;
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list, pRICsubscriptionDeleteFailure_IEs);
+ }
+ else
+ return e2err_RICSubscriptionDeleteFailureAllocRANfunctionIDFail;
+
+ // RICcause
+ pRICsubscriptionDeleteFailure_IEs = calloc(1, sizeof(RICsubscriptionDeleteFailure_IEs_t));
+ if (pRICsubscriptionDeleteFailure_IEs) {
+ pRICsubscriptionDeleteFailure_IEs->id = ProtocolIE_ID_id_RICcause;
+ pRICsubscriptionDeleteFailure_IEs->criticality = Criticality_reject;
+ pRICsubscriptionDeleteFailure_IEs->value.present = RICsubscriptionDeleteFailure_IEs__value_PR_RICcause;
+ if (pRICSubscriptionDeleteFailure->ricCause.content == RICcause_PR_radioNetwork) {
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present = RICcause_PR_radioNetwork;
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.radioNetwork =
+ pRICSubscriptionDeleteFailure->ricCause.cause;
+ }
+ else if (pRICSubscriptionDeleteFailure->ricCause.content == RICcause_PR_transport) {
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present = RICcause_PR_transport;
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.transport =
+ pRICSubscriptionDeleteFailure->ricCause.cause;
+ }
+ else if (pRICSubscriptionDeleteFailure->ricCause.content == RICcause_PR_protocol) {
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present = RICcause_PR_protocol;
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.protocol =
+ pRICSubscriptionDeleteFailure->ricCause.cause;
+ }
+ else if (pRICSubscriptionDeleteFailure->ricCause.content == RICcause_PR_misc) {
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present = RICcause_PR_misc;
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.misc =
+ pRICSubscriptionDeleteFailure->ricCause.cause;
+ }
+ else if (pRICSubscriptionDeleteFailure->ricCause.content == RICcause_PR_ric) {
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present = RICcause_PR_ric;
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.ric =
+ pRICSubscriptionDeleteFailure->ricCause.cause;
+ }
+ ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list, pRICsubscriptionDeleteFailure_IEs);
+ }
+ else
+ return e2err_RICSubscriptionDeleteFailureAllocRICcauseFail;
+
+ // CriticalityDiagnostics, OPTIONAL
+
+ if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer))
+ return e2err_OK;
+ else
+ return e2err_RICSubscriptionDeleteFailureEncodeFail;
+ }
+ else
+ return e2err_RICSubscriptionDeleteFailureAllocE2AP_PDUFail;
+}
+
+//////////////////////////////////////////////////////////////////////
+e2ap_pdu_ptr_t* unpackE2AP_pdu(const size_t dataBufferSize, const byte* dataBuffer, char* pLogBuffer, E2MessageInfo_t* pMessageInfo) {
+
+ E2AP_PDU_t* pE2AP_PDU = 0;
+ asn_dec_rval_t rval;
+ rval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, (void **)&pE2AP_PDU, dataBuffer, dataBufferSize);
+ switch (rval.code) {
+ case RC_OK:
+ // Debug print
+ if (debug) {
+ sprintf(pLogBuffer,"\nSuccessfully decoded E2AP-PDU\n\n");
+ asn_fprint(stdout, &asn_DEF_E2AP_PDU, pE2AP_PDU);
+ }
+
+ if (pE2AP_PDU->present == E2AP_PDU_PR_initiatingMessage) {
+ if (pE2AP_PDU->choice.initiatingMessage.procedureCode == ProcedureCode_id_ricSubscription) {
+ if (pE2AP_PDU->choice.initiatingMessage.value.present == RICInitiatingMessage__value_PR_RICsubscriptionRequest) {
+ pMessageInfo->messageType = cE2InitiatingMessage;
+ pMessageInfo->messageId = cRICSubscriptionRequest;
+ return (e2ap_pdu_ptr_t*)pE2AP_PDU;
+ }
+ else {
+ sprintf(pLogBuffer,"\nError. Not supported initiatingMessage MessageId = %u\n\n",pE2AP_PDU->choice.initiatingMessage.value.present);
+ return 0;
+ }
+ }
+ else if (pE2AP_PDU->choice.initiatingMessage.procedureCode == ProcedureCode_id_ricIndication) {
+ if (pE2AP_PDU->choice.initiatingMessage.value.present == RICInitiatingMessage__value_PR_RICindication) {
+ pMessageInfo->messageType = cE2InitiatingMessage;
+ pMessageInfo->messageId = cRICIndication;
+ return (e2ap_pdu_ptr_t*)pE2AP_PDU;
+ }
+ else {
+ sprintf(pLogBuffer,"\nError. Not supported initiatingMessage MessageId = %u\n\n",pE2AP_PDU->choice.initiatingMessage.value.present);
+ return 0;
+ }
+ }
+ else if (pE2AP_PDU->choice.initiatingMessage.procedureCode == ProcedureCode_id_ricSubscriptionDelete) {
+ if (pE2AP_PDU->choice.initiatingMessage.value.present == RICInitiatingMessage__value_PR_RICsubscriptionDeleteRequest) {
+ pMessageInfo->messageType = cE2InitiatingMessage;
+ pMessageInfo->messageId = cRICSubscriptionDeleteRequest;
+ return (e2ap_pdu_ptr_t*)pE2AP_PDU;
+ }
+ else {
+ sprintf(pLogBuffer,"\nError. Not supported initiatingMessage MessageId = %u\n\n",pE2AP_PDU->choice.initiatingMessage.value.present);
+ return 0;
+ }
+ }
+ else {
+ sprintf(pLogBuffer,"\nError. Procedure not supported. ProcedureCode = %li\n\n",pE2AP_PDU->choice.initiatingMessage.procedureCode);
+ return 0;
+ }
+ }
+ else if (pE2AP_PDU->present == E2AP_PDU_PR_successfulOutcome) {
+ if (pE2AP_PDU->choice.successfulOutcome.procedureCode == ProcedureCode_id_ricSubscription) {
+ if (pE2AP_PDU->choice.successfulOutcome.value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionResponse) {
+ pMessageInfo->messageType = cE2SuccessfulOutcome;
+ pMessageInfo->messageId = cRICSubscriptionResponse;
+ return (e2ap_pdu_ptr_t*)pE2AP_PDU;
+ }
+ else {
+ sprintf(pLogBuffer,"\nError. Not supported successfulOutcome MessageId = %u\n\n",pE2AP_PDU->choice.successfulOutcome.value.present);
+ return 0;
+ }
+ }
+ else if (pE2AP_PDU->choice.successfulOutcome.procedureCode == ProcedureCode_id_ricSubscriptionDelete) {
+ if (pE2AP_PDU->choice.successfulOutcome.value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse) {
+ pMessageInfo->messageType = cE2SuccessfulOutcome;
+ pMessageInfo->messageId = cRICsubscriptionDeleteResponse;
+ return (e2ap_pdu_ptr_t*)pE2AP_PDU;
+ }
+ else {
+ sprintf(pLogBuffer,"\nError. Not supported successfulOutcome MessageId = %u\n\n",pE2AP_PDU->choice.successfulOutcome.value.present);
+ return 0;
+ }
+ }
+ else {
+ sprintf(pLogBuffer,"\nError. Procedure not supported. ProcedureCode = %li\n\n",pE2AP_PDU->choice.successfulOutcome.procedureCode);
+ return 0;
+ }
+ }
+ else if (pE2AP_PDU->present == E2AP_PDU_PR_unsuccessfulOutcome) {
+ if (pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode == ProcedureCode_id_ricSubscription) {
+ if (pE2AP_PDU->choice.unsuccessfulOutcome.value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionFailure) {
+ pMessageInfo->messageType = cE2UnsuccessfulOutcome;
+ pMessageInfo->messageId = cRICSubscriptionFailure;
+ return (e2ap_pdu_ptr_t*)pE2AP_PDU;
+ }
+ else {
+ sprintf(pLogBuffer,"\nError. Not supported unsuccessfulOutcome MessageId = %u\n\n",pE2AP_PDU->choice.unsuccessfulOutcome.value.present);
+ return 0;
+ }
+ }
+ else if (pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode == ProcedureCode_id_ricSubscriptionDelete) {
+ if (pE2AP_PDU->choice.unsuccessfulOutcome.value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure) {
+ pMessageInfo->messageType = cE2UnsuccessfulOutcome;
+ pMessageInfo->messageId = cRICsubscriptionDeleteFailure;
+ return (e2ap_pdu_ptr_t*)pE2AP_PDU;
+ }
+ else {
+ sprintf(pLogBuffer,"\nError. Not supported unsuccessfulOutcome MessageId = %u\n\n",pE2AP_PDU->choice.unsuccessfulOutcome.value.present);
+ return 0;
+ }
+ }
+ }
+ else
+ sprintf(pLogBuffer,"\nDecode failed. Invalid message type %u\n",pE2AP_PDU->present);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return 0;
+ case RC_WMORE:
+ sprintf(pLogBuffer,"\nDecode failed. More data needed. Buffer size %zu, %s, consumed %zu\n",dataBufferSize, asn_DEF_E2AP_PDU.name, rval.consumed);
+ return 0;
+ case RC_FAIL:
+ sprintf(pLogBuffer,"\nDecode failed. Buffer size %zu, %s, consumed %zu\n",dataBufferSize, asn_DEF_E2AP_PDU.name, rval.consumed);
+ return 0;
+ default:
+ return 0;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICSubscriptionRequestData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionRequest_t* pRICSubscriptionRequest) {
+
+ E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer;
+ RICsubscriptionRequest_IEs_t* pRICsubscriptionRequest_IEs;
+ // RICrequestID
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list.count > 0) {
+ pRICsubscriptionRequest_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list.array[0];
+ pRICSubscriptionRequest->ricRequestID.ricRequestorID = pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricRequestorID;
+ pRICSubscriptionRequest->ricRequestID.ricRequestSequenceNumber = pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricRequestSequenceNumber;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionRequestRICrequestIDMissing;
+ }
+
+ // RANfunctionID
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list.count > 1) {
+ pRICsubscriptionRequest_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list.array[1];
+ pRICSubscriptionRequest->ranFunctionID = pRICsubscriptionRequest_IEs->value.choice.RANfunctionID;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionRequestRANfunctionIDMissing;
+ }
+
+ // RICsubscription
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list.count > 2) {
+ pRICsubscriptionRequest_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list.array[2];
+
+ // Unpack EventTriggerDefinition
+ RICeventTriggerDefinition_t* pRICeventTriggerDefinition =
+ (RICeventTriggerDefinition_t*)&pRICsubscriptionRequest_IEs->value.choice.RICsubscription.ricEventTriggerDefinition;
+ pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.octetString.contentLength = pRICeventTriggerDefinition->size;
+ memcpy(pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.octetString.data, pRICeventTriggerDefinition->buf, pRICeventTriggerDefinition->size); //octetstring
+
+ uint64_t returnCode;
+ if ((returnCode = getRICEventTriggerDefinitionData(&pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition) != e2err_OK)) {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return returnCode;
+ }
+
+ // RICactions-ToBeSetup-List
+ RICaction_ToBeSetup_ItemIEs_t* pRICaction_ToBeSetup_ItemIEs;
+ uint64_t index = 0;
+ while (index < pRICsubscriptionRequest_IEs->value.choice.RICsubscription.ricAction_ToBeSetup_List.list.count)
+ {
+ pRICaction_ToBeSetup_ItemIEs = (RICaction_ToBeSetup_ItemIEs_t*)pRICsubscriptionRequest_IEs->value.choice.RICsubscription.ricAction_ToBeSetup_List.list.array[index];
+
+ // RICActionID
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID =
+ pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionID;
+
+ // RICActionType
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType =
+ pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionType;
+
+ // RICactionDefinition, OPTIONAL
+ if (pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition)
+ {
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent = false;
+ // not used in RIC
+ }
+ else
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent = false;
+
+ // RICsubsequentAction, OPTIONAL
+ RICsubsequentAction_t* pRICsubsequentAction;
+ if (pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction)
+ {
+ pRICsubsequentAction = pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction;
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent = true;
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType =
+ pRICsubsequentAction->ricSubsequentActionType;
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait =
+ pRICsubsequentAction->ricTimeToWait;
+ }
+ else
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent = false;
+ index++;
+ }
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.contentLength = index;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionRequestICsubscriptionMissing;
+ }
+
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICEventTriggerDefinitionData(RICEventTriggerDefinition_t* pRICEventTriggerDefinition) {
+
+ E2SM_gNB_X2_eventTriggerDefinition_t* pE2SM_gNB_X2_eventTriggerDefinition = 0;
+ asn_dec_rval_t rval;
+ rval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, (void **)&pE2SM_gNB_X2_eventTriggerDefinition,
+ pRICEventTriggerDefinition->octetString.data, pRICEventTriggerDefinition->octetString.contentLength);
+ switch(rval.code) {
+ case RC_OK:
+ // Debug print
+ if (debug) {
+ printf("\nSuccessfully decoded E2SM_gNB_X2_eventTriggerDefinition\n\n");
+ asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, pE2SM_gNB_X2_eventTriggerDefinition);
+ }
+
+ // InterfaceID, GlobalENB-ID or GlobalGNB-ID
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.present == Interface_ID_PR_global_eNB_ID) {
+
+ // GlobalENB-ID
+ pRICEventTriggerDefinition->interfaceID.globalENBIDPresent = true;
+
+ // PLMN-Identity
+ pRICEventTriggerDefinition->interfaceID.globalENBID.pLMNIdentity.contentLength =
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.pLMN_Identity.size;
+ memcpy(pRICEventTriggerDefinition->interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal,
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf,
+ pRICEventTriggerDefinition->interfaceID.globalENBID.pLMNIdentity.contentLength);
+
+ // ENB-ID
+ IdOctects_t eNBOctects;
+ memset(eNBOctects.octets, 0, sizeof(eNBOctects));
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_macro_eNB_ID) {
+ // BIT STRING (SIZE (20)
+ pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.bits = cMacroENBIDP_20Bits;
+ memcpy(eNBOctects.octets,pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf,
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.size);
+ pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ }
+ else if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_home_eNB_ID) {
+ // BIT STRING (SIZE (28)
+ pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.bits = cHomeENBID_28Bits;
+ memcpy(eNBOctects.octets,pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf,
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.size);
+ pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ }
+ else if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_short_Macro_eNB_ID) {
+ // BIT STRING (SIZE(18)
+ pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.bits = cShortMacroENBID_18Bits;
+ memcpy(eNBOctects.octets,pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf,
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.size);
+ pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ }
+ else if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_long_Macro_eNB_ID) {
+ // BIT STRING (SIZE(21)
+ pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.bits = clongMacroENBIDP_21Bits;
+ memcpy(eNBOctects.octets,pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf,
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.size);
+ pRICEventTriggerDefinition->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ }
+ else {
+ pRICEventTriggerDefinition->interfaceID.globalENBIDPresent = false;
+ pRICEventTriggerDefinition->interfaceID.globalGNBIDPresent = false;
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, pE2SM_gNB_X2_eventTriggerDefinition);
+ return e2err_RICEventTriggerDefinitionIEValueFail_5;
+ }
+ }
+ else if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.present == Interface_ID_PR_global_gNB_ID) {
+ // GlobalGNB-ID
+ pRICEventTriggerDefinition->interfaceID.globalGNBIDPresent = true;
+
+ // PLMN-Identity
+ pRICEventTriggerDefinition->interfaceID.globalGNBID.pLMNIdentity.contentLength =
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.pLMN_Identity.size;
+ memcpy(pRICEventTriggerDefinition->interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal,
+ pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf,
+ pRICEventTriggerDefinition->interfaceID.globalGNBID.pLMNIdentity.contentLength);
+
+ // GNB-ID
+ IdOctects_t gNBOctects;
+ memset(gNBOctects.octets, 0, sizeof(gNBOctects));
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.gNB_ID.present == GNB_ID_PR_gNB_ID) {
+ pRICEventTriggerDefinition->interfaceID.globalGNBID.nodeID.bits = pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.size;
+ memcpy(gNBOctects.octets, pE2SM_gNB_X2_eventTriggerDefinition->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf,
+ pRICEventTriggerDefinition->interfaceID.globalGNBID.nodeID.bits);
+ pRICEventTriggerDefinition->interfaceID.globalGNBID.nodeID.nodeID = gNBOctects.nodeID;
+ }
+ else {
+ pRICEventTriggerDefinition->interfaceID.globalENBIDPresent = false;
+ pRICEventTriggerDefinition->interfaceID.globalGNBIDPresent = false;
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, pE2SM_gNB_X2_eventTriggerDefinition);
+ return e2err_RICEventTriggerDefinitionIEValueFail_6;
+ }
+ }
+ else {
+ pRICEventTriggerDefinition->interfaceID.globalENBIDPresent = false;
+ pRICEventTriggerDefinition->interfaceID.globalGNBIDPresent = false;
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, pE2SM_gNB_X2_eventTriggerDefinition);
+ return e2err_RICEventTriggerDefinitionIEValueFail_7;
+ }
+
+ // InterfaceDirection
+ pRICEventTriggerDefinition->interfaceDirection = pE2SM_gNB_X2_eventTriggerDefinition->interfaceDirection;
+
+ // InterfaceMessageType
+ pRICEventTriggerDefinition->interfaceMessageType.procedureCode = pE2SM_gNB_X2_eventTriggerDefinition->interfaceMessageType.procedureCode;
+
+ if (pE2SM_gNB_X2_eventTriggerDefinition->interfaceMessageType.typeOfMessage == TypeOfMessage_initiating_message)
+ pRICEventTriggerDefinition->interfaceMessageType.typeOfMessage = cE2InitiatingMessage;
+ else if (pE2SM_gNB_X2_eventTriggerDefinition->interfaceMessageType.typeOfMessage == TypeOfMessage_successful_outcome)
+ pRICEventTriggerDefinition->interfaceMessageType.typeOfMessage = cE2SuccessfulOutcome;
+ else if (pE2SM_gNB_X2_eventTriggerDefinition->interfaceMessageType.typeOfMessage == TypeOfMessage_unsuccessful_outcome)
+ pRICEventTriggerDefinition->interfaceMessageType.typeOfMessage = cE2UnsuccessfulOutcome;
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, pE2SM_gNB_X2_eventTriggerDefinition);
+ return e2err_RICEventTriggerDefinitionIEValueFail_8;
+ }
+
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_eventTriggerDefinition, pE2SM_gNB_X2_eventTriggerDefinition);
+ return e2err_OK;
+ case RC_WMORE:
+ if (debug)
+ printf("\nDecode failed. More data needed. Buffer size %zu, %s, consumed %zu\n",pRICEventTriggerDefinition->octetString.contentLength,
+ asn_DEF_E2SM_gNB_X2_eventTriggerDefinition.name, rval.consumed);
+
+ return e2err_RICEventTriggerDefinitionDecodeWMOREFail;
+ case RC_FAIL:
+ if (debug)
+ printf("\nDecode failed. Buffer size %zu, %s, consumed %zu\n",pRICEventTriggerDefinition->octetString.contentLength,
+ asn_DEF_E2SM_gNB_X2_eventTriggerDefinition.name, rval.consumed);
+
+ return e2err_RICEventTriggerDefinitionDecodeFAIL;
+ default:
+ return e2err_RICEventTriggerDefinitionDecodeDefaultFail;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICSubscriptionResponseData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionResponse_t* pRICSubscriptionResponse) {
+
+ E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer;
+
+ // RICrequestID
+ RICsubscriptionResponse_IEs_t* pRICsubscriptionResponse_IEs;
+ if (pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list.count > 0) {
+ pRICsubscriptionResponse_IEs = pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list.array[0];
+ pRICSubscriptionResponse->ricRequestID.ricRequestorID = pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricRequestorID;
+ pRICSubscriptionResponse->ricRequestID.ricRequestSequenceNumber = pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricRequestSequenceNumber;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionResponseRICrequestIDMissing;
+ }
+
+ // RANfunctionID
+ if (pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list.count > 1) {
+ pRICsubscriptionResponse_IEs = pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list.array[1];
+ pRICSubscriptionResponse->ranFunctionID = pRICsubscriptionResponse_IEs->value.choice.RANfunctionID;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionResponseRANfunctionIDMissing;
+ }
+
+ // RICaction-Admitted-List
+ if (pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list.count > 2) {
+ pRICsubscriptionResponse_IEs = pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list.array[2];
+ pRICSubscriptionResponse->ricActionAdmittedList.contentLength = 0;
+ uint64_t index = 0;
+ while ((index < maxofRICactionID) && (index < pRICsubscriptionResponse_IEs->value.choice.RICaction_Admitted_List.list.count)) {
+ RICaction_Admitted_ItemIEs_t* pRICaction_Admitted_ItemIEs =
+ (RICaction_Admitted_ItemIEs_t*)pRICsubscriptionResponse_IEs->value.choice.RICaction_Admitted_List.list.array[index];
+
+ // RICActionID
+ pRICSubscriptionResponse->ricActionAdmittedList.ricActionID[index] =
+ pRICaction_Admitted_ItemIEs->value.choice.RICaction_Admitted_Item.ricActionID;
+ index++;
+ }
+ pRICSubscriptionResponse->ricActionAdmittedList.contentLength = index;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionResponseRICaction_Admitted_ListMissing;
+ }
+
+ // RICaction-NotAdmitted-List, OPTIONAL
+ if (pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list.count > 3) {
+ pRICsubscriptionResponse_IEs = pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list.array[3];
+ if (pRICsubscriptionResponse_IEs->value.present == RICsubscriptionResponse_IEs__value_PR_RICaction_NotAdmitted_List) {
+ pRICSubscriptionResponse->ricActionNotAdmittedListPresent = true;
+ pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength = 0;
+ uint64_t index = 0;
+ while ((index < maxofRICactionID) && (index < pRICsubscriptionResponse_IEs->value.choice.RICaction_NotAdmitted_List.list.count)) {
+ RICaction_NotAdmitted_ItemIEs_t* pRICaction_NotAdmitted_ItemIEs =
+ (RICaction_NotAdmitted_ItemIEs_t*)pRICsubscriptionResponse_IEs->value.choice.RICaction_NotAdmitted_List.list.array[index];
+
+ // RICActionID
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricActionID;
+
+ // RICcause
+ if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_radioNetwork) {
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_radioNetwork;
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork;
+ }
+ else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_transport) {
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_transport;
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport;
+ }
+ else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_protocol) {
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_protocol;
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol;
+ }
+ else if(pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_misc) {
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_misc;
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc;
+ }
+ else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_ric) {
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_ric;
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric;
+ }
+ index++;
+ }
+ pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength = index;
+ }
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionResponseRICaction_NotAdmitted_ListMissing;
+ }
+
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICSubscriptionFailureData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionFailure_t* pRICSubscriptionFailure) {
+
+ E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer;
+
+ // RICrequestID
+ RICsubscriptionFailure_IEs_t* pRICsubscriptionFailure_IEs;
+ if (pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list.count > 0) {
+ pRICsubscriptionFailure_IEs = pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list.array[0];
+ pRICSubscriptionFailure->ricRequestID.ricRequestorID = pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricRequestorID;
+ pRICSubscriptionFailure->ricRequestID.ricRequestSequenceNumber = pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricRequestSequenceNumber;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionFailureRICrequestIDMissing;
+ }
+
+ // RANfunctionID
+ if (pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list.count > 1) {
+ pRICsubscriptionFailure_IEs = pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list.array[1];
+ pRICSubscriptionFailure->ranFunctionID = pRICsubscriptionFailure_IEs->value.choice.RANfunctionID;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionFailureRANfunctionIDMissing;
+ }
+
+ // RICaction-NotAdmitted-List
+ if (pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list.count > 2) {
+ pRICsubscriptionFailure_IEs = pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list.array[2];
+ uint64_t index = 0;
+ while ((index < maxofRICactionID) && (index < pRICsubscriptionFailure_IEs->value.choice.RICaction_NotAdmitted_List.list.count)) {
+ RICaction_NotAdmitted_ItemIEs_t* pRICaction_NotAdmitted_ItemIEs =
+ (RICaction_NotAdmitted_ItemIEs_t*)pRICsubscriptionFailure_IEs->value.choice.RICaction_NotAdmitted_List.list.array[index];
+
+ // RICActionID
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricActionID;
+
+ // RICcause
+ if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_radioNetwork) {
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_radioNetwork;
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork;
+ }
+ else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_transport) {
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_transport;
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport;
+ }
+ else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_protocol) {
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_protocol;
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol;
+ }
+ else if(pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_misc) {
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_misc;
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc;
+ }
+ else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.present == RICcause_PR_ric) {
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = RICcause_PR_ric;
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause =
+ pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric;
+ }
+ index++;
+ }
+ pRICSubscriptionFailure->ricActionNotAdmittedList.contentLength = index;
+
+ // CriticalityDiagnostics. OPTIONAL
+
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionFailureRICaction_NotAdmitted_ListMissing;
+ }
+
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICIndicationData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICIndication_t* pRICIndication) {
+
+ E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer;
+
+ // RICrequestID
+ RICindication_IEs_t* pRICindication_IEs;
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 0) {
+ pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[0];
+ pRICIndication->ricRequestID.ricRequestorID = pRICindication_IEs->value.choice.RICrequestID.ricRequestorID;
+ pRICIndication->ricRequestID.ricRequestSequenceNumber = pRICindication_IEs->value.choice.RICrequestID.ricRequestSequenceNumber;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICindicationRICrequestIDMissing;
+ }
+
+ // RANfunctionID
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 1) {
+ pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[1];
+ pRICIndication->ranFunctionID = pRICindication_IEs->value.choice.RANfunctionID;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICindicationRANfunctionIDMissing;
+ }
+
+ // RICactionID
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 2) {
+ pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[2];
+ pRICIndication->ricActionID = pRICindication_IEs->value.choice.RICactionID;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICindicationRICactionIDMissing;
+ }
+
+ // RICindicationSN
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 3) {
+ pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[3];
+ pRICIndication->ricIndicationSN = pRICindication_IEs->value.choice.RICindicationSN;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICindicationRICindicationSNMissing;
+ }
+
+ // RICindicationType
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 4) {
+ pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[4];
+ pRICIndication->ricIndicationType = pRICindication_IEs->value.choice.RICindicationType;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICindicationRICindicationTypeMissing;
+ }
+
+ // RICindicationHeader
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 5) {
+ pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[5];
+
+ pRICIndication->ricIndicationHeader.octetString.contentLength = pRICindication_IEs->value.choice.RICindicationHeader.size;
+ if (pRICIndication->ricIndicationHeader.octetString.contentLength < cMaxSizeOfOctetString) {
+ memcpy(pRICIndication->ricIndicationHeader.octetString.data, pRICindication_IEs->value.choice.RICindicationHeader.buf,
+ pRICIndication->ricIndicationHeader.octetString.contentLength);
+
+ uint64_t returnCode;
+ if ((returnCode = getRICIndicationHeaderData(&pRICIndication->ricIndicationHeader) != e2err_OK)) {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return returnCode;
+ }
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICIndicationHeaderContentLengthFail;
+ }
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICindicationRICindicationHeaderMissing;
+ }
+
+ // RICindicationMessage
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.count > 6) {
+ pRICindication_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICindication.protocolIEs.list.array[6];
+
+ pRICIndication->ricIndicationMessage.octetString.contentLength = pRICindication_IEs->value.choice.RICindicationMessage.size;
+ if (pRICIndication->ricIndicationMessage.octetString.contentLength < cMaxSizeOfOctetString) {
+ memcpy(pRICIndication->ricIndicationMessage.octetString.data, pRICindication_IEs->value.choice.RICindicationMessage.buf,
+ pRICIndication->ricIndicationMessage.octetString.contentLength);
+
+ uint64_t returnCode;
+ if ((returnCode = getRICIndicationMessageData(&pRICIndication->ricIndicationMessage) != e2err_OK)) {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return returnCode;
+ }
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICIndicationMessageContentLengthFail;
+ }
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICindicationRICindicationMessageMissing;
+ }
+
+ // RICcallProcessID, OPTIONAL. Not used in RIC.
+
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICIndicationHeaderData(RICIndicationHeader_t* pRICIndicationHeader) {
+
+ E2SM_gNB_X2_indicationHeader_t* pE2SM_gNB_X2_indicationHeader = 0;
+ asn_dec_rval_t rval;
+ rval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_indicationHeader, (void **)&pE2SM_gNB_X2_indicationHeader,
+ pRICIndicationHeader->octetString.data, pRICIndicationHeader->octetString.contentLength);
+ switch(rval.code) {
+ case RC_OK:
+ // Debug print
+ if (debug) {
+ printf("\nSuccessfully decoded E2SM_gNB_X2_indicationHeader\n\n");
+ asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader);
+ }
+
+ // InterfaceID, GlobalENB-ID or GlobalGNB-ID
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.present == Interface_ID_PR_global_eNB_ID) {
+
+ // GlobalENB-ID
+ pRICIndicationHeader->interfaceID.globalENBIDPresent = true;
+
+ // PLMN-Identity
+ pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.contentLength =
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.size;
+ memcpy(pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal,
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf,
+ pRICIndicationHeader->interfaceID.globalENBID.pLMNIdentity.contentLength);
+
+ // ENB-ID
+ IdOctects_t eNBOctects;
+ memset(eNBOctects.octets, 0, sizeof(eNBOctects));
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_macro_eNB_ID) {
+ // BIT STRING (SIZE (20)
+ pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits = cMacroENBIDP_20Bits;
+ memcpy(eNBOctects.octets,pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.buf,
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.macro_eNB_ID.size);
+ pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ }
+ else if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_home_eNB_ID) {
+ // BIT STRING (SIZE (28)
+ pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits = cHomeENBID_28Bits;
+ memcpy(eNBOctects.octets,pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.buf,
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.home_eNB_ID.size);
+ pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ }
+ else if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_short_Macro_eNB_ID) {
+ // BIT STRING (SIZE(18)
+ pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits = cShortMacroENBID_18Bits;
+ memcpy(eNBOctects.octets,pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.buf,
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.short_Macro_eNB_ID.size);
+ pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ }
+ else if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.present == ENB_ID_PR_long_Macro_eNB_ID) {
+ // BIT STRING (SIZE(21)
+ pRICIndicationHeader->interfaceID.globalENBID.nodeID.bits = clongMacroENBIDP_21Bits;
+ memcpy(eNBOctects.octets,pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.buf,
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.eNB_ID.choice.long_Macro_eNB_ID.size);
+ pRICIndicationHeader->interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ }
+ else {
+ pRICIndicationHeader->interfaceID.globalENBIDPresent = false;
+ pRICIndicationHeader->interfaceID.globalGNBIDPresent = false;
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader);
+ return e2err_RICEventTriggerDefinitionIEValueFail_9;
+ }
+ }
+ else if (pE2SM_gNB_X2_indicationHeader->interface_ID.present == Interface_ID_PR_global_gNB_ID) {
+ // GlobalGNB-ID
+ pRICIndicationHeader->interfaceID.globalGNBIDPresent = true;
+
+ // PLMN-Identity
+ pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength =
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.size;
+ memcpy(pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal,
+ pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_eNB_ID.pLMN_Identity.buf,
+ pRICIndicationHeader->interfaceID.globalGNBID.pLMNIdentity.contentLength);
+
+ // GNB-ID
+ IdOctects_t gNBOctects;
+ memset(gNBOctects.octets, 0, sizeof(gNBOctects));
+ if (pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.present == GNB_ID_PR_gNB_ID) {
+ pRICIndicationHeader->interfaceID.globalGNBID.nodeID.bits = pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.size;
+ memcpy(gNBOctects.octets, pE2SM_gNB_X2_indicationHeader->interface_ID.choice.global_gNB_ID.gNB_ID.choice.gNB_ID.buf,
+ pRICIndicationHeader->interfaceID.globalGNBID.nodeID.bits);
+ pRICIndicationHeader->interfaceID.globalGNBID.nodeID.nodeID = gNBOctects.nodeID;
+ }
+ else {
+ pRICIndicationHeader->interfaceID.globalENBIDPresent = false;
+ pRICIndicationHeader->interfaceID.globalGNBIDPresent = false;
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader);
+ return e2err_RICEventTriggerDefinitionIEValueFail_10;
+ }
+ }
+ else {
+ pRICIndicationHeader->interfaceID.globalENBIDPresent = false;
+ pRICIndicationHeader->interfaceID.globalGNBIDPresent = false;
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader);
+ return e2err_RICEventTriggerDefinitionIEValueFail_11;
+ }
+
+ // InterfaceDirection
+ pRICIndicationHeader->interfaceDirection = pE2SM_gNB_X2_indicationHeader->interfaceDirection;
+
+ // TimeStamp OPTIONAL. Not used in RIC.
+
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationHeader, pE2SM_gNB_X2_indicationHeader);
+ return e2err_OK;
+ case RC_WMORE:
+ if (debug)
+ printf("\nDecode failed. More data needed. Buffer size %zu, %s, consumed %zu\n",pRICIndicationHeader->octetString.contentLength,
+ asn_DEF_E2SM_gNB_X2_indicationHeader.name, rval.consumed);
+ return e2err_RICIndicationHeaderDecodeWMOREFail;
+ case RC_FAIL:
+ if (debug)
+ printf("\nDecode failed. Buffer size %zu, %s, consumed %zu\n",pRICIndicationHeader->octetString.contentLength,
+ asn_DEF_E2SM_gNB_X2_indicationHeader.name, rval.consumed);
+
+ return e2err_RICIndicationHeaderDecodeFAIL;
+ default:
+ return e2err_RICIndicationHeaderDecodeDefaultFail;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICIndicationMessageData(RICIndicationMessage_t* pRICIndicationMessage) {
+
+ E2SM_gNB_X2_indicationMessage_t* pE2SM_gNB_X2_indicationMessage = 0;
+ asn_dec_rval_t rval;
+ rval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_X2_indicationMessage, (void **)&pE2SM_gNB_X2_indicationMessage,
+ pRICIndicationMessage->octetString.data, pRICIndicationMessage->octetString.contentLength);
+ switch(rval.code) {
+ case RC_OK:
+ // Debug print
+ if (debug) {
+ printf("\nSuccessfully decoded E2SM_gNB_X2_indicationMessage\n\n");
+ asn_fprint(stdout, &asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage);
+ }
+
+ // InterfaceMessage
+ pRICIndicationMessage->interfaceMessage.contentLength = pE2SM_gNB_X2_indicationMessage->interfaceMessage.size;
+ if(pRICIndicationMessage->octetString.contentLength < cMaxSizeOfOctetString) {
+ memcpy(pRICIndicationMessage->interfaceMessage.data,pE2SM_gNB_X2_indicationMessage->interfaceMessage.buf,
+ pRICIndicationMessage->interfaceMessage.contentLength);
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage);
+ return e2err_OK;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2SM_gNB_X2_indicationMessage, pE2SM_gNB_X2_indicationMessage);
+ return e2err_RICIndicationMessageIEContentLengthFail;
+ }
+ case RC_WMORE:
+ if (debug)
+ printf("\nDecode failed. More data needed. Buffer size %zu, %s, consumed %zu\n",pRICIndicationMessage->octetString.contentLength,
+ asn_DEF_E2SM_gNB_X2_indicationMessage.name, rval.consumed);
+
+ return e2err_RICIndicationMessageDecodeWMOREFail;
+ case RC_FAIL:
+ if (debug)
+ printf("\nDecode failed. Buffer size %zu, %s, consumed %zu\n",pRICIndicationMessage->octetString.contentLength,
+ asn_DEF_E2SM_gNB_X2_indicationMessage.name, rval.consumed);
+
+ return e2err_RICIndicationMessageDecodeFAIL;
+ default:
+ return e2err_RICIndicationMessageDecodeDefaultFail;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICSubscriptionDeleteRequestData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionDeleteRequest_t* pRICSubscriptionDeleteRequest) {
+
+ E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer;
+
+ // RICrequestID
+ RICsubscriptionDeleteRequest_IEs_t* pRICsubscriptionDeleteRequest_IEs;
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest.protocolIEs.list.count > 0) {
+ pRICsubscriptionDeleteRequest_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest.protocolIEs.list.array[0];
+ pRICSubscriptionDeleteRequest->ricRequestID.ricRequestorID = pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricRequestorID;
+ pRICSubscriptionDeleteRequest->ricRequestID.ricRequestSequenceNumber = pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricRequestSequenceNumber;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionDeleteRequestRICrequestIDMissing;
+ }
+
+ // RANfunctionID
+ if (pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest.protocolIEs.list.count > 1) {
+ pRICsubscriptionDeleteRequest_IEs = pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest.protocolIEs.list.array[1];
+ pRICSubscriptionDeleteRequest->ranFunctionID = pRICsubscriptionDeleteRequest_IEs->value.choice.RANfunctionID;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionDeleteRequestRANfunctionIDMissing;
+ }
+
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICSubscriptionDeleteResponseData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionDeleteResponse_t* pRICSubscriptionDeleteResponse) {
+
+ E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer;
+
+ // RICrequestID
+ RICsubscriptionDeleteResponse_IEs_t* pRICsubscriptionDeleteResponse_IEs;
+ if (pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse.protocolIEs.list.count > 0) {
+ pRICsubscriptionDeleteResponse_IEs = pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse.protocolIEs.list.array[0];
+ pRICSubscriptionDeleteResponse->ricRequestID.ricRequestorID = pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricRequestorID;
+ pRICSubscriptionDeleteResponse->ricRequestID.ricRequestSequenceNumber = pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricRequestSequenceNumber;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionDeleteResponseRICrequestIDMissing;
+ }
+
+ // RANfunctionID
+ if (pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse.protocolIEs.list.count > 1) {
+ pRICsubscriptionDeleteResponse_IEs = pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse.protocolIEs.list.array[1];
+ pRICSubscriptionDeleteResponse->ranFunctionID = pRICsubscriptionDeleteResponse_IEs->value.choice.RANfunctionID;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionDeleteResponseRANfunctionIDMissing;
+ }
+
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_OK;
+}
+
+//////////////////////////////////////////////////////////////////////
+uint64_t getRICSubscriptionDeleteFailureData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionDeleteFailure_t* pRICSubscriptionDeleteFailure) {
+
+ E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer;
+
+ // RICrequestID
+ RICsubscriptionDeleteFailure_IEs_t* pRICsubscriptionDeleteFailure_IEs;
+ if (pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list.count > 0) {
+ pRICsubscriptionDeleteFailure_IEs = pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list.array[0];
+ pRICSubscriptionDeleteFailure->ricRequestID.ricRequestorID = pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricRequestorID;
+ pRICSubscriptionDeleteFailure->ricRequestID.ricRequestSequenceNumber = pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricRequestSequenceNumber;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionDeleteFailureRICrequestIDMissing;
+ }
+
+ // RANfunctionID
+ if (pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list.count > 1) {
+ pRICsubscriptionDeleteFailure_IEs = pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list.array[1];
+ pRICSubscriptionDeleteFailure->ranFunctionID = pRICsubscriptionDeleteFailure_IEs->value.choice.RANfunctionID;
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionDeleteFailureRANfunctionIDMissing;
+ }
+
+ // RICcause
+ if (pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list.count > 2) {
+ pRICsubscriptionDeleteFailure_IEs = pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list.array[2];
+ if (pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present == RICcause_PR_radioNetwork) {
+ pRICSubscriptionDeleteFailure->ricCause.content = RICcause_PR_radioNetwork;
+ pRICSubscriptionDeleteFailure->ricCause.cause =
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.radioNetwork;
+ }
+ else if (pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present == RICcause_PR_transport) {
+ pRICSubscriptionDeleteFailure->ricCause.content = RICcause_PR_transport;
+ pRICSubscriptionDeleteFailure->ricCause.cause =
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.transport;
+ }
+ else if (pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present == RICcause_PR_protocol) {
+ pRICSubscriptionDeleteFailure->ricCause.content = RICcause_PR_protocol;
+ pRICSubscriptionDeleteFailure->ricCause.cause =
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.protocol;
+ }
+ else if(pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present == RICcause_PR_misc) {
+ pRICSubscriptionDeleteFailure->ricCause.content = RICcause_PR_misc;
+ pRICSubscriptionDeleteFailure->ricCause.cause =
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.misc;
+ }
+ else if (pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.present == RICcause_PR_ric) {
+ pRICSubscriptionDeleteFailure->ricCause.content = RICcause_PR_ric;
+ pRICSubscriptionDeleteFailure->ricCause.cause =
+ pRICsubscriptionDeleteFailure_IEs->value.choice.RICcause.choice.ric;
+ }
+ }
+ else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_RICsubscriptionDeleteFailureRICcauseMissing;
+ }
+ // CriticalityDiagnostics, OPTIONAL
+
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
+ return e2err_OK;
+}
diff --git a/e2ap/libe2ap_wrapper/E2AP_if.h b/e2ap/libe2ap_wrapper/E2AP_if.h
new file mode 100644
index 0000000..d70d2b6
--- /dev/null
+++ b/e2ap/libe2ap_wrapper/E2AP_if.h
@@ -0,0 +1,709 @@
+/*
+==================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property.
+ Copyright (c) 2019 Nokia
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+
+#ifndef E2AP_IF_H
+#define E2AP_IF_H
+
+#ifndef ASN_DISABLE_OER_SUPPORT
+#define ASN_DISABLE_OER_SUPPORT
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef unsigned char byte;
+
+extern const int64_t cMaxNrOfErrors;
+
+extern const uint64_t cMaxSizeOfOctetString;
+
+typedef struct { // Octet string in ASN.1 does not have maximum length!
+ size_t contentLength;
+ uint8_t data[1024]; // table size is const cMaxSizeOfOctetString
+} OctetString_t;
+
+typedef struct {
+ uint8_t unusedbits; // trailing unused bits 0 - 7
+ size_t byteLength; // length in bytes
+ uint8_t data[1024];
+} Bitstring_t;
+
+typedef struct {
+ uint32_t ricRequestorID;
+ uint32_t ricRequestSequenceNumber;
+} RICRequestID_t;
+
+typedef uint16_t RANFunctionID_t;
+
+typedef uint64_t RICActionID_t;
+
+enum RICActionType_t {
+ RICActionType_report
+ ,RICActionType_insert
+ ,RICActionType_policy
+};
+
+typedef uint64_t StyleID_t;
+
+typedef uint32_t ParameterID_t;
+
+typedef struct {
+ uint32_t dummy; // This data type has no content. This dymmy is added here to solve problem with Golang. Golang do not like empty types.
+} ParameterValue_t;
+
+typedef struct {
+ ParameterID_t parameterID;
+ ParameterValue_t ParameterValue;
+} SequenceOfActionParameters_t;
+
+typedef struct {
+ StyleID_t styleID;
+ SequenceOfActionParameters_t sequenceOfActionParameters;
+} RICActionDefinition_t;
+
+enum RICSubsequentActionType_t {
+ RICSubsequentActionType_Continue,
+ RICSubsequentActionType_wait
+};
+
+enum RICTimeToWait_t {
+ RICTimeToWait_zero,
+ RICTimeToWait_w1ms,
+ RICTimeToWait_w2ms,
+ RICTimeToWait_w5ms,
+ RICTimeToWait_w10ms,
+ RICTimeToWait_w20ms,
+ RICTimeToWait_w30ms,
+ RICTimeToWait_w40ms,
+ RICTimeToWait_w50ms,
+ RICTimeToWait_w100ms,
+ RICTimeToWait_w200ms,
+ RICTimeToWait_w500ms,
+ RICTimeToWait_w1s,
+ RICTimeToWait_w2s,
+ RICTimeToWait_w5s,
+ RICTimeToWait_w10s,
+ RICTimeToWait_w20s,
+ RICTimeToWait_w60s
+};
+
+typedef struct {
+ uint64_t ricSubsequentActionType; // this is type of enum RICSubsequentActionType_t
+ uint64_t ricTimeToWait; // this is type of enum RICTimeToWait_t
+} RICSubsequentAction_t;
+
+typedef struct {
+ RICActionID_t ricActionID;
+ uint64_t ricActionType; // this is type of enum RICActionType_t
+ bool ricActionDefinitionPresent;
+ RICActionDefinition_t ricActionDefinition;
+ bool ricSubsequentActionPresent;
+ RICSubsequentAction_t ricSubsequentAction;
+} RICActionToBeSetupItem_t;
+
+static const uint64_t cMaxofRICactionID = 16;
+
+typedef struct {
+ uint8_t contentLength;
+ RICActionToBeSetupItem_t ricActionToBeSetupItem[16]; // table size is const cMaxofRICactionID
+} RICActionToBeSetupList_t;
+
+typedef struct {
+ uint8_t contentLength;
+ uint8_t pLMNIdentityVal[3];
+} PLMNIdentity_t;
+
+// size of eNB-id
+extern const size_t cMacroENBIDP_20Bits;
+extern const size_t cHomeENBID_28Bits;
+extern const size_t cShortMacroENBID_18Bits;
+extern const size_t clongMacroENBIDP_21Bits;
+
+typedef struct { // gNB-ID (SIZE 22..32 bits) or eNB-ID (SIZE 18, 20,21 or 28 bits)
+ uint8_t bits;
+ uint32_t nodeID;
+} NodeID_t;
+
+typedef struct {
+ PLMNIdentity_t pLMNIdentity;
+ NodeID_t nodeID;
+} GlobalNodeID_t;
+
+typedef struct { // CHOICE. Only either value can be present
+ bool globalENBIDPresent;
+ GlobalNodeID_t globalENBID;
+ bool globalGNBIDPresent;
+ GlobalNodeID_t globalGNBID;
+} InterfaceID_t;
+
+enum InterfaceDirection__t {
+ InterfaceDirection__incoming,
+ InterfaceDirection__outgoing
+};
+
+typedef uint8_t ProcedureCode__t;
+
+typedef struct {
+ ProcedureCode__t procedureCode;
+ uint8_t typeOfMessage; // This is X2AP-PDU, CHOICE of InitiatingMessage or SuccessfulOutcome or UnsuccessfulOutcome
+} RICInterfaceMessageType_t;
+
+typedef uint32_t InterfaceProtocolIEID_t;
+
+enum ProtocolIEtestCondition_t {
+ ProtocolIEtestCondition_equal,
+ ProtocolIEtestCondition_greaterthan,
+ ProtocolIEtestCondition_lessthan,
+ ProtocolIEtestCondition_contains,
+ ProtocolIEtestCondition_present
+};
+
+typedef struct { // CHOICE. Only one value can be present
+ bool valueIntPresent;
+ int64_t integer; //INTEGER;
+ bool valueEnumPresent;
+ int64_t valueEnum; // INTEGER
+ bool valueBoolPresent;
+ bool valueBool; // BOOLEAN
+ bool valueBitSPresent;
+ Bitstring_t octetstring; // OCTET STRING,
+ bool octetstringPresent;
+ OctetString_t octetString; // OCTET STRING,
+} InterfaceProtocolIEValue_t;
+
+typedef struct {
+ InterfaceProtocolIEID_t interfaceProtocolIEID;
+ //ProtocolIEtestCondition_t protocolIEtestCondition; Golang do not like this line. We do not need this right now.
+ InterfaceProtocolIEValue_t interfaceProtocolIEValue;
+} SequenceOfProtocolIE_t;
+
+static const uint64_t cMaxofProtocolIE = 16;
+
+typedef struct {
+ SequenceOfProtocolIE_t sequenceOfProtocolIE[16]; // table size is const cMaxofProtocolIE
+} SequenceOfProtocolIEList_t;
+
+typedef struct {
+ OctetString_t octetString; // E2AP spec format, the other elements for E2SM-X2 format
+ InterfaceID_t interfaceID;
+ uint8_t interfaceDirection; // this is type of enum InterfaceDirection_t
+ RICInterfaceMessageType_t interfaceMessageType ;
+ bool sequenceOfProtocolIEListPresent;
+ SequenceOfProtocolIEList_t SequenceOfProtocolIEList;
+} RICEventTriggerDefinition_t;
+
+typedef struct {
+ RICEventTriggerDefinition_t ricEventTriggerDefinition;
+ RICActionToBeSetupList_t ricActionToBeSetupItemIEs;
+} RICSubscription_t;
+
+typedef struct {
+ uint8_t contentLength;
+ RICActionID_t ricActionID[16]; // table size is const cMaxofRICactionID
+} RICActionAdmittedList_t;
+
+enum CauseRIC_t {
+ CauseRIC__function_id_Invalid,
+ CauseRIC__action_not_supported,
+ CauseRIC__excessive_actions,
+ CauseRIC__duplicate_action,
+ CauseRIC__duplicate_event,
+ CauseRIC__function_resource_limit,
+ CauseRIC__request_id_unknown,
+ CauseRIC__inconsistent_action_subsequent_action_sequence,
+ CauseRIC__control_message_invalid,
+ CauseRIC__call_process_id_invalid,
+ CauseRIC__function_not_required,
+ CauseRIC__excessive_functions,
+ CauseRIC__ric_resource_limit
+};
+
+extern const int cRICCauseRadioNetwork; // this is content of type RICCause_t
+extern const int cRICCauseTransport; // this is content of type RICCause_t
+extern const int cRICCauseProtocol; // this is content of type RICCause_t
+extern const int cRICCauseMisc; // this is content of type RICCause_t
+extern const int cRICCauseRic; // this is content of type RICCause_t
+
+typedef struct {
+ uint8_t content; // See above constants
+ uint8_t cause; // this is type of enum CauseRIC_t
+} RICCause_t;
+
+typedef struct {
+ RICActionID_t ricActionID;
+ RICCause_t ricCause;
+} RICActionNotAdmittedItem_t;
+
+typedef struct {
+ uint8_t contentLength;
+ RICActionNotAdmittedItem_t RICActionNotAdmittedItem[16]; // table size is const cMaxofRICactionID
+} RICActionNotAdmittedList_t;
+
+enum Criticality_t {
+ Criticality__reject,
+ Criticality__ignore,
+ Criticality__notify
+};
+
+typedef uint32_t ProtocolIE_ID__t;
+
+enum TriggeringMessage__t {
+ TriggeringMessage__initiating_message,
+ TriggeringMessage__successful_outcome,
+ TriggeringMessage__unsuccessful_outcome
+};
+
+enum TypeOfError_t {
+ TypeOfError_not_understood,
+ TypeOfError_missing
+};
+
+typedef struct {
+ uint8_t iECriticality; // this is type of enum Criticality_t
+ ProtocolIE_ID__t iE_ID;
+ uint8_t typeOfError; // this is type of enum TypeOfError_t
+ //iE-Extensions // This has no content in E2AP ASN.1 specification
+} CriticalityDiagnosticsIEListItem_t;
+
+typedef struct {
+ bool procedureCodePresent;
+ ProcedureCode__t procedureCode;
+ bool triggeringMessagePresent;
+ uint8_t triggeringMessage; // this is type of enum TriggeringMessage_t
+ bool procedureCriticalityPresent;
+ uint8_t procedureCriticality; // this is type of enum Criticality_t
+ bool iEsCriticalityDiagnosticsPresent;
+ uint16_t criticalityDiagnosticsIELength;
+ CriticalityDiagnosticsIEListItem_t criticalityDiagnosticsIEListItem[256]; // table size is const cMaxNrOfErrors
+ //iE-Extensions // This has no content in E2AP ASN.1 specification
+
+} CriticalityDiagnostics__t;
+
+typedef int32_t RICIndicationSN_t;
+
+enum RICIndicationType_t {
+ RICIndicationType_RICIndicationTypeReport,
+ RICIndicationType_RICIndicationTypeInsert
+};
+
+typedef struct {
+ OctetString_t octetString; // E2AP spec format, the other elements for E2SM-X2 format
+ InterfaceID_t interfaceID;
+ uint8_t interfaceDirection;
+} RICIndicationHeader_t;
+
+typedef struct {
+ OctetString_t octetString; // E2AP spec format, the other elements for E2SM-X2 format
+ OctetString_t interfaceMessage;
+} RICIndicationMessage_t;
+
+typedef struct {
+ OctetString_t octetString; // E2AP spec format, the other elements for E2SM-X2 format
+ uint64_t ricCallProcessIDVal;
+} RICCallProcessID_t;
+
+//////////////////////////////////////////////////////////////////////
+// E2 Error codes
+enum e2err {
+ e2err_OK,
+ e2err_RICSubscriptionRequestAllocRICrequestIDFail,
+ e2err_RICSubscriptionRequestAllocRANfunctionIDFail,
+ e2err_RICSubscriptionRequestAllocRICeventTriggerDefinitionBufFail,
+ e2err_RICSubscriptionRequestAllocRICaction_ToBeSetup_ItemIEsFail,
+ e2err_RICSubscriptionRequestAllocRICsubsequentActionFail,
+ e2err_RICSubscriptionRequestAllocRICsubscriptionRequest_IEsFail,
+ e2err_RICSubscriptionRequestEncodeFail,
+ e2err_RICSubscriptionRequestAllocE2AP_PDUFail,
+ e2err_RICEventTriggerDefinitionIEValueFail_1,
+ e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDpLMN_IdentityBufFail,
+ e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDmacro_eNB_IDBufFail,
+ e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDhome_eNB_IDBufFail,
+ e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDshort_Macro_eNB_IDBufFail,
+ e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDlong_Macro_eNB_IDBufFail,
+ e2err_RICEventTriggerDefinitionIEValueFail_2,
+ e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_gNB_IDpLMN_IdentityBufFail,
+ e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_gNB_IDgNB_IDBufFail,
+ e2err_RICEventTriggerDefinitionIEValueFail_3,
+ e2err_RICEventTriggerDefinitionIEValueFail_4,
+ e2err_RICEventTriggerDefinitionPackFail_1,
+ e2err_RICEventTriggerDefinitionPackFail_2,
+ e2err_RICEventTriggerDefinitionAllocE2SM_gNB_X2_eventTriggerDefinitionFail,
+ e2err_RICSubscriptionResponseAllocRICrequestIDFail,
+ e2err_RICSubscriptionResponseAllocRANfunctionIDFail,
+ e2err_RICSubscriptionResponseAllocRICaction_Admitted_ItemIEsFail,
+ e2err_RICSubscriptionResponseAllocRICActionAdmittedListFail,
+ e2err_RICSubscriptionResponseAllocRICaction_NotAdmitted_ItemIEsFail,
+ e2err_RICSubscriptionResponseAllocRICActionNotAdmittedListFail,
+ e2err_RICSubscriptionResponseEncodeFail,
+ e2err_RICSubscriptionResponseAllocE2AP_PDUFail,
+ e2err_RICSubscriptionFailureAllocRICrequestIDFail,
+ e2err_RICSubscriptionFailureAllocRANfunctionIDFail,
+ e2err_RICSubscriptionFailureAllocRICaction_NotAdmitted_ItemIEsFail,
+ e2err_RICSubscriptionFailureAllocRICActionAdmittedListFail,
+ e2err_RICSubscriptionFailureEncodeFail,
+ e2err_RICSubscriptionFailureAllocE2AP_PDUFail,
+ e2err_RICIndicationRICrequestIDFail,
+ e2err_RICIndicationAllocRANfunctionIDFail,
+ e2err_RICIndicationAllocRICactionIDFail,
+ e2err_RICIndicationAllocRICindicationSNFail,
+ e2err_RICIndicationAllocRICindicationTypeFail,
+ e2err_RICIndicationAllocRRICindicationHeaderBufFail,
+ e2err_RICIndicationAllocRICindicationHeaderFail,
+ e2err_RICIndicationAllocRICindicationMessageBufFail,
+ e2err_RICIndicationAllocRICindicationMessageFail,
+ e2err_RICIndicationEncodeFail,
+ e2err_RICIndicationAllocE2AP_PDUFail,
+ e2err_RICindicationHeaderIEValueFail_1,
+ e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDpLMN_IdentityBufFail,
+ e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDmacro_eNB_IDBufFail,
+ e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDhome_eNB_IDBufFail,
+ e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDshort_Macro_eNB_IDBufFail,
+ e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDlong_Macro_eNB_IDBufFail,
+ e2err_RICindicationHeaderIEValueFail_2,
+ e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDpLMN_IdentityBufFail,
+ e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDgNB_IDgNB_IDBufFail,
+ e2err_RICindicationHeaderIEValueFail_3,
+ e2err_RICindicationHeaderPackFail_1,
+ e2err_RICindicationHeaderPackFail_2,
+ e2err_RICIndicationHeaderAllocE2AP_PDUFail,
+ e2err_RICIndicationMessageAllocinterfaceMessageFail,
+ e2err_RICindicationMessagePackFail_1,
+ e2err_RICindicationMessagePackFail_2,
+ e2err_E2SM_gNB_X2_indicationMessageAllocE2AP_PDUFail,
+ e2err_RICSubscriptionDeleteRequestAllocRICrequestIDFail,
+ e2err_RICSubscriptionDeleteRequestAllocRANfunctionIDFail,
+ e2err_RICSubscriptionDeleteRequestEncodeFail,
+ e2err_RICSubscriptionDeleteRequestAllocE2AP_PDUFail,
+ e2err_RICSubscriptionDeleteResponseAllocRICrequestIDFail,
+ e2err_RICSubscriptionDeleteResponseAllocRANfunctionIDFail,
+ e2err_RICSubscriptionDeleteResponseEncodeFail,
+ e2err_RICSubscriptionDeleteResponseAllocE2AP_PDUFail,
+ e2err_RICSubscriptionDeleteFailureAllocRICrequestIDFail,
+ e2err_RICSubscriptionDeleteFailureAllocRANfunctionIDFail,
+ e2err_RICSubscriptionDeleteFailureAllocRICcauseFail,
+ e2err_RICSubscriptionDeleteFailureEncodeFail,
+ e2err_RICSubscriptionDeleteFailureAllocE2AP_PDUFail,
+ e2err_RICsubscriptionRequestRICrequestIDMissing,
+ e2err_RICsubscriptionRequestRANfunctionIDMissing,
+ e2err_RICsubscriptionRequestICsubscriptionMissing,
+ e2err_RICEventTriggerDefinitionIEValueFail_5,
+ e2err_RICEventTriggerDefinitionIEValueFail_6,
+ e2err_RICEventTriggerDefinitionIEValueFail_7,
+ e2err_RICEventTriggerDefinitionIEValueFail_8,
+ e2err_RICEventTriggerDefinitionDecodeWMOREFail,
+ e2err_RICEventTriggerDefinitionDecodeFAIL,
+ e2err_RICEventTriggerDefinitionDecodeDefaultFail,
+ e2err_RICsubscriptionResponseRICrequestIDMissing,
+ e2err_RICsubscriptionResponseRANfunctionIDMissing,
+ e2err_RICsubscriptionResponseRICaction_Admitted_ListMissing,
+ e2err_RICsubscriptionResponseRICaction_NotAdmitted_ListMissing,
+ e2err_RICsubscriptionFailureRICrequestIDMissing,
+ e2err_RICsubscriptionFailureRANfunctionIDMissing,
+ e2err_RICsubscriptionFailureRICaction_NotAdmitted_ListMissing,
+ e2err_RICindicationRICrequestIDMissing,
+ e2err_RICindicationRANfunctionIDMissing,
+ e2err_RICindicationRICactionIDMissing,
+ e2err_RICindicationRICindicationSNMissing,
+ e2err_RICindicationRICindicationTypeMissing,
+ e2err_RICIndicationHeaderContentLengthFail,
+ e2err_RICindicationRICindicationHeaderMissing,
+ e2err_RICIndicationMessageContentLengthFail,
+ e2err_RICindicationRICindicationMessageMissing,
+ e2err_RICEventTriggerDefinitionIEValueFail_9,
+ e2err_RICEventTriggerDefinitionIEValueFail_10,
+ e2err_RICEventTriggerDefinitionIEValueFail_11,
+ e2err_RICIndicationHeaderDecodeWMOREFail,
+ e2err_RICIndicationHeaderDecodeFAIL,
+ e2err_RICIndicationHeaderDecodeDefaultFail,
+ e2err_RICIndicationMessageIEContentLengthFail,
+ e2err_RICIndicationMessageDecodeWMOREFail,
+ e2err_RICIndicationMessageDecodeFAIL,
+ e2err_RICIndicationMessageDecodeDefaultFail,
+ e2err_RICsubscriptionDeleteRequestRICrequestIDMissing,
+ e2err_RICsubscriptionDeleteRequestRANfunctionIDMissing,
+ e2err_RICsubscriptionDeleteResponseRICrequestIDMissing,
+ e2err_RICsubscriptionDeleteResponseRANfunctionIDMissing,
+ e2err_RICsubscriptionDeleteFailureRICrequestIDMissing,
+ e2err_RICsubscriptionDeleteFailureRANfunctionIDMissing,
+ e2err_RICsubscriptionDeleteFailureRICcauseMissing
+};
+
+
+static const char* const E2ErrorStrings[] = {
+ "e2err_OK",
+ "e2err_RICSubscriptionRequestAllocRICrequestIDFail",
+ "e2err_RICSubscriptionRequestAllocRANfunctionIDFail",
+ "e2err_RICSubscriptionRequestAllocRICeventTriggerDefinitionBufFail",
+ "e2err_RICSubscriptionRequestAllocRICaction_ToBeSetup_ItemIEsFail",
+ "e2err_RICSubscriptionRequestAllocRICsubsequentActionFail",
+ "e2err_RICSubscriptionRequestAllocRICsubscriptionRequest_IEsFail",
+ "e2err_RICSubscriptionRequestEncodeFail",
+ "e2err_RICSubscriptionRequestAllocE2AP_PDUFail",
+ "e2err_RICEventTriggerDefinitionIEValueFail_1",
+ "e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDpLMN_IdentityBufFail",
+ "e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDmacro_eNB_IDBufFail",
+ "e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDhome_eNB_IDBufFail",
+ "e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDshort_Macro_eNB_IDBufFail",
+ "e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_eNB_IDeNB_IDlong_Macro_eNB_IDBufFail",
+ "e2err_RICEventTriggerDefinitionIEValueFail_2",
+ "e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_gNB_IDpLMN_IdentityBufFail",
+ "e2err_RICIndicationAllocRICEventTriggerDefinitionglobal_gNB_IDgNB_IDBufFail",
+ "e2err_RICEventTriggerDefinitionIEValueFail_3",
+ "e2err_RICEventTriggerDefinitionIEValueFail_4",
+ "e2err_RICEventTriggerDefinitionPackFail_1",
+ "e2err_RICEventTriggerDefinitionPackFail_2",
+ "e2err_RICEventTriggerDefinitionAllocE2SM_gNB_X2_eventTriggerDefinitionFail",
+ "e2err_RICSubscriptionResponseAllocRICrequestIDFail",
+ "e2err_RICSubscriptionResponseAllocRANfunctionIDFail",
+ "e2err_RICSubscriptionResponseAllocRICaction_Admitted_ItemIEsFail",
+ "e2err_RICSubscriptionResponseAllocRICActionAdmittedListFail",
+ "e2err_RICSubscriptionResponseAllocRICaction_NotAdmitted_ItemIEsFail",
+ "e2err_RICSubscriptionResponseAllocRICActionNotAdmittedListFail",
+ "e2err_RICSubscriptionResponseEncodeFail",
+ "e2err_RICSubscriptionResponseAllocE2AP_PDUFail",
+ "e2err_RICSubscriptionFailureAllocRICrequestIDFail",
+ "e2err_RICSubscriptionFailureAllocRANfunctionIDFail",
+ "e2err_RICSubscriptionFailureAllocRICaction_NotAdmitted_ItemIEsFail",
+ "e2err_RICSubscriptionFailureAllocRICActionAdmittedListFail",
+ "e2err_RICSubscriptionFailureEncodeFail",
+ "e2err_RICSubscriptionFailureAllocE2AP_PDUFail",
+ "e2err_RICIndicationRICrequestIDFail",
+ "e2err_RICIndicationAllocRANfunctionIDFail",
+ "e2err_RICIndicationAllocRICactionIDFail",
+ "e2err_RICIndicationAllocRICindicationSNFail",
+ "e2err_RICIndicationAllocRICindicationTypeFail",
+ "e2err_RICIndicationAllocRRICindicationHeaderBufFail",
+ "e2err_RICIndicationAllocRICindicationHeaderFail",
+ "e2err_RICIndicationAllocRICindicationMessageBufFail",
+ "e2err_RICIndicationAllocRICindicationMessageFail",
+ "e2err_RICIndicationEncodeFail",
+ "e2err_RICIndicationAllocE2AP_PDUFail",
+ "e2err_RICindicationHeaderIEValueFail_1",
+ "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDpLMN_IdentityBufFail",
+ "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDmacro_eNB_IDBufFail",
+ "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDhome_eNB_IDBufFail",
+ "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDshort_Macro_eNB_IDBufFail",
+ "e2err_RICIndicationAllocRICIndicationHeaderglobal_eNB_IDeNB_IDlong_Macro_eNB_IDBufFail",
+ "e2err_RICindicationHeaderIEValueFail_2",
+ "e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDpLMN_IdentityBufFail",
+ "e2err_RICIndicationAllocRICIndicationHeaderglobal_gNB_IDgNB_IDgNB_IDBufFail",
+ "e2err_RICindicationHeaderIEValueFail_3",
+ "e2err_RICindicationHeaderPackFail_1",
+ "e2err_RICindicationHeaderPackFail_2",
+ "e2err_RICIndicationHeaderAllocE2AP_PDUFail",
+ "e2err_RICIndicationMessageAllocinterfaceMessageFail",
+ "e2err_RICindicationMessagePackFail_1",
+ "e2err_RICindicationMessagePackFail_2",
+ "e2err_E2SM_gNB_X2_indicationMessageAllocE2AP_PDUFail",
+ "e2err_RICSubscriptionDeleteRequestAllocRICrequestIDFail",
+ "e2err_RICSubscriptionDeleteRequestAllocRANfunctionIDFail",
+ "e2err_RICSubscriptionDeleteRequestEncodeFail",
+ "e2err_RICSubscriptionDeleteRequestAllocE2AP_PDUFail",
+ "e2err_RICSubscriptionDeleteResponseAllocRICrequestIDFail",
+ "e2err_RICSubscriptionDeleteResponseAllocRANfunctionIDFail",
+ "e2err_RICSubscriptionDeleteResponseEncodeFail",
+ "e2err_RICSubscriptionDeleteResponseAllocE2AP_PDUFail",
+ "e2err_RICSubscriptionDeleteFailureAllocRICrequestIDFail",
+ "e2err_RICSubscriptionDeleteFailureAllocRANfunctionIDFail",
+ "e2err_RICSubscriptionDeleteFailureAllocRICcauseFail",
+ "e2err_RICSubscriptionDeleteFailureEncodeFail",
+ "e2err_RICSubscriptionDeleteFailureAllocE2AP_PDUFail",
+ "e2err_RICsubscriptionRequestRICrequestIDMissing",
+ "e2err_RICsubscriptionRequestRANfunctionIDMissing",
+ "e2err_RICsubscriptionRequestICsubscriptionMissing",
+ "e2err_RICEventTriggerDefinitionIEValueFail_5",
+ "e2err_RICEventTriggerDefinitionIEValueFail_6",
+ "e2err_RICEventTriggerDefinitionIEValueFail_7",
+ "e2err_RICEventTriggerDefinitionIEValueFail_8",
+ "e2err_RICEventTriggerDefinitionDecodeWMOREFail",
+ "e2err_RICEventTriggerDefinitionDecodeFAIL",
+ "e2err_RICEventTriggerDefinitionDecodeDefaultFail",
+ "e2err_RICsubscriptionResponseRICrequestIDMissing",
+ "e2err_RICsubscriptionResponseRANfunctionIDMissing",
+ "e2err_RICsubscriptionResponseRICaction_Admitted_ListMissing",
+ "e2err_RICsubscriptionResponseRICaction_NotAdmitted_ListMissing",
+ "e2err_RICsubscriptionFailureRICrequestIDMissing",
+ "e2err_RICsubscriptionFailureRANfunctionIDMissing",
+ "e2err_RICsubscriptionFailureRICaction_NotAdmitted_ListMissing",
+ "e2err_RICindicationRICrequestIDMissing",
+ "e2err_RICindicationRANfunctionIDMissing",
+ "e2err_RICindicationRICactionIDMissing",
+ "e2err_RICindicationRICindicationSNMissing",
+ "e2err_RICindicationRICindicationTypeMissing",
+ "e2err_RICIndicationHeaderContentLengthFail",
+ "e2err_RICindicationRICindicationHeaderMissing",
+ "e2err_RICIndicationMessageContentLengthFail",
+ "e2err_RICindicationRICindicationMessageMissing",
+ "e2err_RICEventTriggerDefinitionIEValueFail_9",
+ "e2err_RICEventTriggerDefinitionIEValueFail_10",
+ "e2err_RICEventTriggerDefinitionIEValueFail_11",
+ "e2err_RICIndicationHeaderDecodeWMOREFail",
+ "e2err_RICIndicationHeaderDecodeFAIL",
+ "e2err_RICIndicationHeaderDecodeDefaultFail",
+ "e2err_RICIndicationMessageIEContentLengthFail",
+ "e2err_RICIndicationMessageDecodeWMOREFail",
+ "e2err_RICIndicationMessageDecodeFAIL",
+ "e2err_RICIndicationMessageDecodeDefaultFail",
+ "e2err_RICsubscriptionDeleteRequestRICrequestIDMissing",
+ "e2err_RICsubscriptionDeleteRequestRANfunctionIDMissing",
+ "e2err_RICsubscriptionDeleteResponseRICrequestIDMissing",
+ "e2err_RICsubscriptionDeleteResponseRANfunctionIDMissing",
+ "e2err_RICsubscriptionDeleteFailureRICrequestIDMissing",
+ "e2err_RICsubscriptionDeleteFailureRANfunctionIDMissing",
+ "e2err_RICsubscriptionDeleteFailureRICcauseMissing"
+};
+
+typedef struct {
+ uint64_t messageType; // Initiating message or Successful outcome or Unsuccessful outcome
+ uint64_t messageId;
+} E2MessageInfo_t;
+
+//////////////////////////////////////////////////////////////////////
+// Message definitons
+
+// Below constant values are same as in E2AP, E2SM and X2AP specs
+extern const uint64_t cE2InitiatingMessage;
+extern const uint64_t cE2SuccessfulOutcome;
+extern const uint64_t cE2UnsuccessfulOutcome;
+
+// E2AP messages. Below message id constant values are the same as in ASN.1 specification
+
+// Initiating message
+extern const uint64_t cRICSubscriptionRequest;
+extern const uint64_t cRICSubscriptionDeleteRequest;
+extern const uint64_t cRICIndication;
+
+// Successful outcome
+extern const uint64_t cRICSubscriptionResponse;
+extern const uint64_t cRICsubscriptionDeleteResponse;
+
+// Unsuccessful outcome
+extern const uint64_t cRICSubscriptionFailure;
+extern const uint64_t cRICsubscriptionDeleteFailure;
+
+typedef struct {
+ RICRequestID_t ricRequestID;
+ RANFunctionID_t ranFunctionID;
+ RICSubscription_t ricSubscription;
+} RICSubscriptionRequest_t;
+
+typedef struct {
+ RICRequestID_t ricRequestID;
+ RANFunctionID_t ranFunctionID;
+ RICActionAdmittedList_t ricActionAdmittedList;
+ bool ricActionNotAdmittedListPresent;
+ RICActionNotAdmittedList_t ricActionNotAdmittedList;
+} RICSubscriptionResponse_t;
+
+
+typedef struct {
+ RICRequestID_t ricRequestID;
+ RANFunctionID_t ranFunctionID;
+ RICActionNotAdmittedList_t ricActionNotAdmittedList;
+ bool criticalityDiagnosticsPresent;
+ CriticalityDiagnostics__t criticalityDiagnostics;
+} RICSubscriptionFailure_t;
+
+typedef struct {
+ RICRequestID_t ricRequestID;
+ RANFunctionID_t ranFunctionID;
+ RICActionID_t ricActionID;
+ RICIndicationSN_t ricIndicationSN;
+ uint64_t ricIndicationType; // this is type of enum RICIndicationType_t
+ RICIndicationHeader_t ricIndicationHeader;
+ RICIndicationMessage_t ricIndicationMessage;
+ RICCallProcessID_t ricCallProcessID; // Not usein RIC currently
+} RICIndication_t;
+
+typedef struct {
+ RICRequestID_t ricRequestID;
+ RANFunctionID_t ranFunctionID;
+} RICSubscriptionDeleteRequest_t;
+
+typedef struct {
+ RICRequestID_t ricRequestID;
+ RANFunctionID_t ranFunctionID;
+} RICSubscriptionDeleteResponse_t;
+
+typedef struct {
+ RICRequestID_t ricRequestID;
+ RANFunctionID_t ranFunctionID;
+ RICCause_t ricCause;
+ bool criticalityDiagnosticsPresent;
+ CriticalityDiagnostics__t criticalityDiagnostics; // Not usein RIC currently
+} RICSubscriptionDeleteFailure_t;
+
+//////////////////////////////////////////////////////////////////////
+// Function declarations
+
+const char* getE2ErrorString(uint64_t);
+
+typedef void* e2ap_pdu_ptr_t;
+
+uint64_t packRICSubscriptionRequest(size_t*, byte*, char*,RICSubscriptionRequest_t*);
+uint64_t packRICEventTriggerDefinition(char*,RICEventTriggerDefinition_t*);
+uint64_t packRICSubscriptionResponse(size_t*, byte*, char*,RICSubscriptionResponse_t*);
+uint64_t packRICSubscriptionFailure(size_t*, byte*, char*,RICSubscriptionFailure_t*);
+uint64_t packRICIndication(size_t*, byte*, char*,RICIndication_t*);
+uint64_t packRICIndicationHeader(char*,RICIndicationHeader_t*);
+uint64_t packRICIndicationMessage(char*,RICIndicationMessage_t*);
+uint64_t packRICSubscriptionDeleteRequest(size_t*, byte*, char*,RICSubscriptionDeleteRequest_t*);
+uint64_t packRICSubscriptionDeleteResponse(size_t*, byte*, char*,RICSubscriptionDeleteResponse_t*);
+uint64_t packRICSubscriptionDeleteFailure(size_t*, byte*, char*,RICSubscriptionDeleteFailure_t*);
+
+e2ap_pdu_ptr_t* unpackE2AP_pdu(const size_t, const byte*, char*, E2MessageInfo_t*);
+uint64_t getRICSubscriptionRequestData(e2ap_pdu_ptr_t*, RICSubscriptionRequest_t*);
+uint64_t getRICEventTriggerDefinitionData(RICEventTriggerDefinition_t*);
+uint64_t getRICSubscriptionResponseData(e2ap_pdu_ptr_t*, RICSubscriptionResponse_t*);
+uint64_t getRICSubscriptionFailureData(e2ap_pdu_ptr_t*, RICSubscriptionFailure_t*);
+uint64_t getRICIndicationData(e2ap_pdu_ptr_t*, RICIndication_t*);
+uint64_t getRICIndicationHeaderData(RICIndicationHeader_t*);
+uint64_t getRICIndicationMessageData(RICIndicationMessage_t*);
+uint64_t getRICSubscriptionDeleteRequestData(e2ap_pdu_ptr_t*, RICSubscriptionDeleteRequest_t*);
+uint64_t getRICSubscriptionDeleteResponseData(e2ap_pdu_ptr_t*, RICSubscriptionDeleteResponse_t*);
+uint64_t getRICSubscriptionDeleteFailureData(e2ap_pdu_ptr_t*, RICSubscriptionDeleteFailure_t*);
+
+
+#if DEBUG
+bool TestRICSubscriptionRequest();
+bool TestRICSubscriptionResponse();
+bool TestRICSubscriptionFailure();
+bool TestRICIndication();
+bool TestRICSubscriptionDeleteRequest();
+bool TestRICSubscriptionDeleteResponse();
+bool TestRICSubscriptionDeleteFailure();
+
+void printRICSubscriptionRequest(const RICSubscriptionRequest_t*);
+void printRICSubscriptionResponse(const RICSubscriptionResponse_t*);
+void printRICSubscriptionFailure(const RICSubscriptionFailure_t*);
+void printRICIndication(const RICIndication_t*);
+void printRICSubscriptionDeleteRequest(const RICSubscriptionDeleteRequest_t*);
+void printRICSubscriptionDeleteResponse(const RICSubscriptionDeleteResponse_t*);
+void printRICSubscriptionDeleteFailure(const RICSubscriptionDeleteFailure_t*);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/e2ap/libe2ap_wrapper/E2AP_tests.c b/e2ap/libe2ap_wrapper/E2AP_tests.c
new file mode 100644
index 0000000..5ae0933
--- /dev/null
+++ b/e2ap/libe2ap_wrapper/E2AP_tests.c
@@ -0,0 +1,654 @@
+/*
+==================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property.
+ Copyright (c) 2019 Nokia
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+
+#if DEBUG
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "E2AP_if.h"
+
+const size_t cDataBufferSize = 2048;
+
+typedef union {
+ uint32_t nodeID;
+ uint8_t octets[4];
+} IdOctects_t;
+
+//////////////////////////////////////////////////////////////////////
+bool TestRICSubscriptionRequest() {
+ RICSubscriptionRequest_t ricSubscriptionRequest;
+ ricSubscriptionRequest.ricRequestID.ricRequestorID = 1;
+ ricSubscriptionRequest.ricRequestID.ricRequestSequenceNumber = 22;
+ ricSubscriptionRequest.ranFunctionID = 33;
+
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.octetString.contentLength = 0;
+
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent = true;
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent = false;
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.contentLength = 3;
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] = 1;
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] = 2;
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] = 3;
+
+// ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.eNBID.bits = cMacroENBIDP_20Bits;
+// ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.eNBID.bits = cHomeENBID_28Bits;
+// ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.eNBID.bits = cShortMacroENBID_18Bits;
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.bits = clongMacroENBIDP_21Bits;
+
+ IdOctects_t eNBOctects;
+ memset(eNBOctects.octets, 0, sizeof(eNBOctects));
+ eNBOctects.octets[0] = 11;
+ eNBOctects.octets[1] = 22;
+ eNBOctects.octets[2] = 31;
+ eNBOctects.octets[3] = 1;
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ printf("eNBOctects.nodeID = %u\n\n",eNBOctects.nodeID);
+
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceDirection = InterfaceDirection__incoming;
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.procedureCode = 35; // id-rRCTransfer
+ ricSubscriptionRequest.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.typeOfMessage = cE2InitiatingMessage;
+
+ ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.contentLength = 1;
+ uint64_t index = 0;
+ while (index < ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.contentLength) {
+ ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID = 255; //index;
+ ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType = RICActionType_insert;
+
+ // ricActionDefinition, OPTIONAL. Not used in RIC
+ ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent = false; //true;
+ ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.styleID = 255;
+ ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID = 222;
+
+ // ricSubsequentActionPresent, OPTIONAL
+ ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent = true;
+ ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType = RICSubsequentActionType_Continue;
+ ricSubscriptionRequest.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait = RICTimeToWait_w100ms;
+ index++;
+ }
+
+ printRICSubscriptionRequest(&ricSubscriptionRequest);
+
+ uint64_t logBufferSize = 1024;
+ char logBuffer[logBufferSize];
+ uint64_t dataBufferSize = cDataBufferSize;
+ byte dataBuffer[dataBufferSize];
+ if (packRICSubscriptionRequest(&dataBufferSize, dataBuffer, logBuffer, &ricSubscriptionRequest) == e2err_OK)
+ {
+ memset(&ricSubscriptionRequest,0, sizeof ricSubscriptionRequest);
+ uint64_t returnCode;
+ E2MessageInfo_t messageInfo;
+ e2ap_pdu_ptr_t* pE2AP_PDU = unpackE2AP_pdu(dataBufferSize, dataBuffer, logBuffer, &messageInfo);
+ if (pE2AP_PDU != 0) {
+ if (messageInfo.messageType == cE2InitiatingMessage) {
+ if (messageInfo.messageId == cRICSubscriptionRequest) {
+ if ((returnCode = getRICSubscriptionRequestData(pE2AP_PDU, &ricSubscriptionRequest)) == e2err_OK) {
+ printRICSubscriptionRequest(&ricSubscriptionRequest);
+ return true;
+ }
+ else
+ printf("Error in getRICSubscriptionRequestData. ReturnCode = %s",getE2ErrorString(returnCode));
+ }
+ else
+ printf("Not RICSubscriptionRequest\n");
+ }
+ else
+ printf("Not InitiatingMessage\n");
+ }
+ else
+ printf("%s",logBuffer);
+ }
+ else
+ printf("%s",logBuffer);
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool TestRICSubscriptionResponse() {
+ // Test RICSubscribeResponse
+ RICSubscriptionResponse_t ricSubscriptionResponse;
+ ricSubscriptionResponse.ricRequestID.ricRequestorID = 1;
+ ricSubscriptionResponse.ricRequestID.ricRequestSequenceNumber = 22;
+ ricSubscriptionResponse.ranFunctionID = 33;
+ ricSubscriptionResponse.ricActionAdmittedList.contentLength = 16;
+ uint64_t index = 0;
+ while (index < ricSubscriptionResponse.ricActionAdmittedList.contentLength) {
+ ricSubscriptionResponse.ricActionAdmittedList.ricActionID[index] = index;
+ index++;
+ }
+ ricSubscriptionResponse.ricActionNotAdmittedListPresent = true;
+ ricSubscriptionResponse.ricActionNotAdmittedList.contentLength = 16;
+ index = 0;
+ while (index < ricSubscriptionResponse.ricActionNotAdmittedList.contentLength) {
+ ricSubscriptionResponse.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID = index;
+ ricSubscriptionResponse.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = cRICCauseRadioNetwork;
+ ricSubscriptionResponse.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause = index;
+ index++;
+ }
+
+ printRICSubscriptionResponse(&ricSubscriptionResponse);
+
+ uint64_t logBufferSize = 1024;
+ char logBuffer[logBufferSize];
+ uint64_t dataBufferSize = cDataBufferSize;
+ byte dataBuffer[dataBufferSize];
+ if (packRICSubscriptionResponse(&dataBufferSize, dataBuffer, logBuffer, &ricSubscriptionResponse) == e2err_OK)
+ {
+ memset(&ricSubscriptionResponse,0, sizeof ricSubscriptionResponse);
+ uint64_t returnCode;
+ E2MessageInfo_t messageInfo;
+ e2ap_pdu_ptr_t* pE2AP_PDU = unpackE2AP_pdu(dataBufferSize, dataBuffer, logBuffer, &messageInfo);
+ if (pE2AP_PDU != 0) {
+ if (messageInfo.messageType == cE2SuccessfulOutcome) {
+ if (messageInfo.messageId == cRICSubscriptionResponse) {
+ if ((returnCode = getRICSubscriptionResponseData(pE2AP_PDU, &ricSubscriptionResponse)) == e2err_OK) {
+ printRICSubscriptionResponse(&ricSubscriptionResponse);
+ return true;
+ }
+ else
+ printf("Error in getRICSubscriptionResponseData. ReturnCode = %s",getE2ErrorString(returnCode));
+ }
+ else
+ printf("Not RICSubscriptionResponse\n");
+ }
+ else
+ printf("Not SuccessfulOutcome\n");
+ }
+ else
+ printf("%s",logBuffer);
+ }
+ else
+ printf("%s",logBuffer);
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool TestRICSubscriptionFailure() {
+ // Test RICSubscribeFailure
+ RICSubscriptionFailure_t ricSubscriptionFailure;
+ ricSubscriptionFailure.ricRequestID.ricRequestorID = 1;
+ ricSubscriptionFailure.ricRequestID.ricRequestSequenceNumber = 22;
+ ricSubscriptionFailure.ranFunctionID = 33;
+ ricSubscriptionFailure.ricActionNotAdmittedList.contentLength = 16;
+ uint64_t index = 0;
+ while (index < ricSubscriptionFailure.ricActionNotAdmittedList.contentLength) {
+ ricSubscriptionFailure.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID = index;
+ ricSubscriptionFailure.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = cRICCauseRadioNetwork;
+ ricSubscriptionFailure.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause = index;
+ index++;
+ }
+ // CriticalityDiagnostics, OPTIONAL. Not used in RIC
+ ricSubscriptionFailure.criticalityDiagnosticsPresent = false;
+ ricSubscriptionFailure.criticalityDiagnostics.procedureCodePresent = true;
+ ricSubscriptionFailure.criticalityDiagnostics.procedureCode = 1;
+ ricSubscriptionFailure.criticalityDiagnostics.triggeringMessagePresent = true;
+ ricSubscriptionFailure.criticalityDiagnostics.triggeringMessage = TriggeringMessage__initiating_message;
+ ricSubscriptionFailure.criticalityDiagnostics.procedureCriticalityPresent = true;
+ ricSubscriptionFailure.criticalityDiagnostics.procedureCriticality = Criticality__reject;
+
+ ricSubscriptionFailure.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent = false;
+ ricSubscriptionFailure.criticalityDiagnostics.criticalityDiagnosticsIELength = 256;
+ uint16_t index2 = 0;
+ while (index2 < ricSubscriptionFailure.criticalityDiagnostics.criticalityDiagnosticsIELength) {
+ ricSubscriptionFailure.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality = Criticality__reject;
+ ricSubscriptionFailure.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID = index2;
+ ricSubscriptionFailure.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError = TypeOfError_missing;
+ index2++;
+ }
+
+ printRICSubscriptionFailure(&ricSubscriptionFailure);
+
+ uint64_t logBufferSize = 1024;
+ char logBuffer[logBufferSize];
+ uint64_t dataBufferSize = cDataBufferSize;
+ byte dataBuffer[dataBufferSize];
+ if (packRICSubscriptionFailure(&dataBufferSize, dataBuffer, logBuffer, &ricSubscriptionFailure) == e2err_OK)
+ {
+ memset(&ricSubscriptionFailure,0, sizeof ricSubscriptionFailure);
+ uint64_t returnCode;
+ E2MessageInfo_t messageInfo;
+ e2ap_pdu_ptr_t* pE2AP_PDU = unpackE2AP_pdu(dataBufferSize, dataBuffer, logBuffer, &messageInfo);
+ if (pE2AP_PDU != 0) {
+ if (messageInfo.messageType == cE2UnsuccessfulOutcome) {
+ if (messageInfo.messageId == cRICSubscriptionFailure) {
+ if ((returnCode = getRICSubscriptionFailureData(pE2AP_PDU, &ricSubscriptionFailure)) == e2err_OK) {
+ printRICSubscriptionFailure(&ricSubscriptionFailure);
+ return true;
+ }
+ else
+ printf("Error in getRICSubscriptionFailureData. ReturnCode = %s",getE2ErrorString(returnCode));
+ }
+ else
+ printf("Not RICSubscriptionFailure\n");
+ }
+ else
+ printf("Not UnuccessfulOutcome\n");
+ }
+ else
+ printf("%s",logBuffer);
+ }
+ else
+ printf("%s",logBuffer);
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool TestRICIndication() {
+ // Test RICIndication
+ RICIndication_t ricIndication;
+
+ ricIndication.ricRequestID.ricRequestorID = 1;
+ ricIndication.ricRequestID.ricRequestSequenceNumber = 22;
+ ricIndication.ranFunctionID = 33;
+ ricIndication.ricActionID = 44;
+ ricIndication.ricIndicationSN = 55;
+ ricIndication.ricIndicationType = RICIndicationType_RICIndicationTypeReport;
+
+ ricIndication.ricIndicationHeader.interfaceID.globalGNBIDPresent = false;
+ ricIndication.ricIndicationHeader.interfaceID.globalENBIDPresent = true;
+ ricIndication.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.contentLength = 3;
+
+ ricIndication.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] = 1;
+ ricIndication.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] = 2;
+ ricIndication.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] = 3;
+
+// ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = cMacroENBIDP_20Bits;
+// ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = cHomeENBID_28Bits;
+// ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = cShortMacroENBID_18Bits;
+ ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = clongMacroENBIDP_21Bits;
+
+ IdOctects_t eNBOctects;
+ memset(eNBOctects.octets, 0, sizeof(eNBOctects));
+ eNBOctects.octets[0] = 11;
+ eNBOctects.octets[1] = 22;
+ eNBOctects.octets[2] = 31;
+ eNBOctects.octets[3] = 1;
+ ricIndication.ricIndicationHeader.interfaceID.globalENBID.nodeID.nodeID = eNBOctects.nodeID;
+ printf("eNBOctects.nodeID = %u",eNBOctects.nodeID);
+
+ ricIndication.ricIndicationHeader.interfaceDirection = InterfaceDirection__incoming;
+
+ char data[] = "Hello world";
+ ricIndication.ricIndicationMessage.interfaceMessage.contentLength = sizeof(data);
+ memcpy(ricIndication.ricIndicationMessage.interfaceMessage.data,data,sizeof(data));
+
+ printRICIndication(&ricIndication);
+
+ uint64_t logBufferSize = 1024;
+ char logBuffer[logBufferSize];
+ uint64_t dataBufferSize = cDataBufferSize;
+ byte dataBuffer[dataBufferSize];
+ if (packRICIndication(&dataBufferSize, dataBuffer, logBuffer, &ricIndication) == e2err_OK)
+ {
+ memset(&ricIndication,0, sizeof ricIndication);
+ uint64_t returnCode;
+ E2MessageInfo_t messageInfo;
+ e2ap_pdu_ptr_t* pE2AP_PDU = unpackE2AP_pdu(dataBufferSize, dataBuffer, logBuffer, &messageInfo);
+ if (pE2AP_PDU != 0) {
+ if (messageInfo.messageType == cE2InitiatingMessage) {
+ if (messageInfo.messageId == cRICIndication) {
+ // RICindication
+ if ((returnCode = getRICIndicationData(pE2AP_PDU, &ricIndication)) == e2err_OK) {
+ printRICIndication(&ricIndication);
+ return true;
+ }
+ else
+ printf("Error in getRICIndicationData. ReturnCode = %s",getE2ErrorString(returnCode));
+ }
+ else
+ printf("Not RICIndication\n");
+ }
+ else
+ printf("Not InitiatingMessage\n");
+ }
+ else
+ printf("%s",logBuffer);
+ }
+ else
+ printf("%s",logBuffer);
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool TestRICSubscriptionDeleteRequest() {
+
+ RICSubscriptionDeleteRequest_t ricSubscriptionDeleteRequest;
+ ricSubscriptionDeleteRequest.ricRequestID.ricRequestorID = 1;
+ ricSubscriptionDeleteRequest.ricRequestID.ricRequestSequenceNumber = 22;
+ ricSubscriptionDeleteRequest.ranFunctionID = 33;
+
+ printRICSubscriptionDeleteRequest(&ricSubscriptionDeleteRequest);
+
+ uint64_t logBufferSize = 1024;
+ char logBuffer[logBufferSize];
+ uint64_t dataBufferSize = cDataBufferSize;
+ byte dataBuffer[cDataBufferSize];
+ if ((packRICSubscriptionDeleteRequest(&dataBufferSize, dataBuffer, logBuffer, &ricSubscriptionDeleteRequest)) == e2err_OK)
+ {
+ memset(&ricSubscriptionDeleteRequest,0, sizeof ricSubscriptionDeleteRequest);
+ uint64_t returnCode;
+ E2MessageInfo_t messageInfo;
+ e2ap_pdu_ptr_t* pE2AP_PDU = unpackE2AP_pdu(dataBufferSize, dataBuffer, logBuffer, &messageInfo);
+ if (pE2AP_PDU != 0) {
+ if (messageInfo.messageType == cE2InitiatingMessage) {
+ if (messageInfo.messageId == cRICSubscriptionDeleteRequest) {
+ if ((returnCode = getRICSubscriptionDeleteRequestData(pE2AP_PDU, &ricSubscriptionDeleteRequest)) == e2err_OK) {
+ printRICSubscriptionDeleteRequest(&ricSubscriptionDeleteRequest);
+ return true;
+ }
+ else
+ printf("Error in getRICSubscriptionDeleteRequestData. ReturnCode = %s",getE2ErrorString(returnCode));
+ }
+ else
+ printf("Not RICSubscriptionDeleteRequest\n");
+ }
+ else
+ printf("Not InitiatingMessage\n");
+ }
+ else
+ printf("%s",logBuffer);
+ }
+ else
+ printf("%s",logBuffer);
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool TestRICSubscriptionDeleteResponse() {
+
+ RICSubscriptionDeleteResponse_t ricSubscriptionDeleteResponse;
+ ricSubscriptionDeleteResponse.ricRequestID.ricRequestorID = 1;
+ ricSubscriptionDeleteResponse.ricRequestID.ricRequestSequenceNumber = 22;
+ ricSubscriptionDeleteResponse.ranFunctionID = 33;
+
+ printRICSubscriptionDeleteResponse(&ricSubscriptionDeleteResponse);
+
+ uint64_t logBufferSize = 1024;
+ char logBuffer[logBufferSize];
+ uint64_t dataBufferSize = cDataBufferSize;
+ byte dataBuffer[dataBufferSize];
+ if ((packRICSubscriptionDeleteResponse(&dataBufferSize, dataBuffer, logBuffer, &ricSubscriptionDeleteResponse)) == e2err_OK)
+ {
+ memset(&ricSubscriptionDeleteResponse,0, sizeof ricSubscriptionDeleteResponse);
+ uint64_t returnCode;
+ E2MessageInfo_t messageInfo;
+ e2ap_pdu_ptr_t* pE2AP_PDU = unpackE2AP_pdu(dataBufferSize, dataBuffer, logBuffer, &messageInfo);
+ if (pE2AP_PDU != 0) {
+ if (messageInfo.messageType == cE2SuccessfulOutcome) {
+ if (messageInfo.messageId == cRICsubscriptionDeleteResponse) {
+ if ((returnCode = getRICSubscriptionDeleteResponseData(pE2AP_PDU, &ricSubscriptionDeleteResponse)) == e2err_OK) {
+ printRICSubscriptionDeleteResponse(&ricSubscriptionDeleteResponse);
+ return true;
+ }
+ else
+ printf("Error in getRICSubscriptionDeleteResponseData. ReturnCode = %s",getE2ErrorString(returnCode));
+ }
+ else
+ printf("Not RICSubscriptionDeleteResponse\n");
+ }
+ else
+ printf("Not SuccessfulOutcome\n");
+ }
+ else
+ printf("%s",logBuffer);
+ }
+ else
+ printf("%s",logBuffer);
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////
+bool TestRICSubscriptionDeleteFailure() {
+
+ RICSubscriptionDeleteFailure_t ricSubscriptionDeleteFailure;
+ ricSubscriptionDeleteFailure.ricRequestID.ricRequestorID = 1;
+ ricSubscriptionDeleteFailure.ricRequestID.ricRequestSequenceNumber = 22;
+ ricSubscriptionDeleteFailure.ranFunctionID = 33;
+ ricSubscriptionDeleteFailure.ricCause.content = cRICCauseRadioNetwork;
+ ricSubscriptionDeleteFailure.ricCause.cause = 3;
+
+ printRICSubscriptionDeleteFailure(&ricSubscriptionDeleteFailure);
+
+ uint64_t logBufferSize = 1024;
+ char logBuffer[logBufferSize];
+ uint64_t dataBufferSize = cDataBufferSize;
+ byte dataBuffer[dataBufferSize];
+ if ((packRICSubscriptionDeleteFailure(&dataBufferSize, dataBuffer, logBuffer, &ricSubscriptionDeleteFailure)) == e2err_OK)
+ {
+ memset(&ricSubscriptionDeleteFailure,0, sizeof ricSubscriptionDeleteFailure);
+ uint64_t returnCode;
+ E2MessageInfo_t messageInfo;
+ e2ap_pdu_ptr_t* pE2AP_PDU = unpackE2AP_pdu(dataBufferSize, dataBuffer, logBuffer, &messageInfo);
+ if (pE2AP_PDU != 0) {
+ if (messageInfo.messageType == cE2UnsuccessfulOutcome) {
+ if (messageInfo.messageId == cRICsubscriptionDeleteFailure) {
+ if ((returnCode = getRICSubscriptionDeleteFailureData(pE2AP_PDU, &ricSubscriptionDeleteFailure)) == e2err_OK) {
+ printRICSubscriptionDeleteFailure(&ricSubscriptionDeleteFailure);
+ return true;
+ }
+ else
+ printf("Error in getRICSubscriptionDeleteFailureData. ReturnCode = %s",getE2ErrorString(returnCode));
+ }
+ else
+ printf("Not RICSubscriptionDeleteFailure\n");
+ }
+ else
+ printf("Not UnuccessfulOutcome\n");
+ }
+ else
+ printf("%s",logBuffer);
+ }
+ else
+ printf("%s",logBuffer);
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////
+void printDataBuffer(const size_t byteCount, const uint8_t* pData) {
+
+ uint64_t index = 0;
+ while (index < byteCount) {
+ if (index % 50 == 0) {
+ printf("\n");
+ }
+ printf("%u ",pData[index]);
+ index++;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+void printRICSubscriptionRequest(const RICSubscriptionRequest_t* pRICSubscriptionRequest) {
+ printf("pRICSubscriptionRequest->ricRequestID.ricRequestorID = %u\n", pRICSubscriptionRequest->ricRequestID.ricRequestorID);
+ printf("pRICSubscriptionRequest->ricRequestID.ricRequestSequenceNumber = %u\n", pRICSubscriptionRequest->ricRequestID.ricRequestSequenceNumber);
+ printf("pRICSubscriptionRequest->ranFunctionID = %u\n",pRICSubscriptionRequest->ranFunctionID);
+
+ printf("pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeIDbits = %u\n",
+ (unsigned)pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.bits);
+ printf("pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.nodeID = %u\n",
+ (unsigned)pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.nodeID);
+ printf("pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceDirection = %u\n",
+ (unsigned)pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceDirection);
+ printf("pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceMessageType.procedureCode = %u\n",
+ (unsigned)pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceMessageType.procedureCode);
+ printf("pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceMessageType.typeOfMessage = %u\n",
+ (unsigned)pRICSubscriptionRequest->ricSubscription.ricEventTriggerDefinition.interfaceMessageType.typeOfMessage);
+ printf("pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.contentLength = %u\n",
+ (unsigned)pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.contentLength);
+
+ uint64_t index = 0;
+ while (index < pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.contentLength) {
+ printf("pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID = %li\n",
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID);
+ printf("pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType = %li\n",
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType);
+ printf("pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent = %i\n",
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent);
+ if(pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent)
+ {
+ printf("pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.styleID = %li\n",
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.styleID);
+ printf("pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID = %i\n",
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID);
+ }
+ printf("pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent = %i\n",
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent);
+ if(pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent)
+ {
+ printf("pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType = %li\n",
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType);
+ printf("pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait = %li\n",
+ pRICSubscriptionRequest->ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait);
+ }
+ printf("\n\n");
+ index++;
+ }
+ printf("\n\n");
+}
+
+//////////////////////////////////////////////////////////////////////
+void printRICSubscriptionResponse(const RICSubscriptionResponse_t* pRICSubscriptionResponse) {
+
+ printf("pRICSubscriptionResponse->ricRequestID.ricRequestorID = %u\n",pRICSubscriptionResponse->ricRequestID.ricRequestorID);
+ printf("pRICSubscriptionResponse->ricRequestID.ricRequestSequenceNumber = %u\n", pRICSubscriptionResponse->ricRequestID.ricRequestSequenceNumber);
+ printf("pRICSubscriptionResponse->ranFunctionID = %u\n",pRICSubscriptionResponse->ranFunctionID);
+ printf("pRICSubscriptionResponse->ricActionAdmittedList.contentLength = %u\n",(unsigned)pRICSubscriptionResponse->ricActionAdmittedList.contentLength);
+ uint64_t index = 0;
+ while (index < pRICSubscriptionResponse->ricActionAdmittedList.contentLength) {
+ printf("pRICSubscriptionResponse->ricActionAdmittedList.ricActionID[index] = %lu\n",pRICSubscriptionResponse->ricActionAdmittedList.ricActionID[index]);
+ index++;
+ }
+ printf("pRICSubscriptionResponse->ricActionNotAdmittedListPresent = %u\n",pRICSubscriptionResponse->ricActionNotAdmittedListPresent);
+ printf("pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength = %u\n",(unsigned)pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength);
+ index = 0;
+ while (index < pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength) {
+ printf("pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID = %lu\n",
+ pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID);
+ printf("pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = %u\n",
+ (unsigned)pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content);
+ printf("pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause = %u\n",
+ (unsigned)pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause);
+ index++;
+ }
+ printf("\n");
+}
+
+//////////////////////////////////////////////////////////////////////
+void printRICSubscriptionFailure(const RICSubscriptionFailure_t* pRICSubscriptionFailure) {
+
+ printf("pRICSubscriptionFailure->ricRequestID.ricRequestorID = %u\n",pRICSubscriptionFailure->ricRequestID.ricRequestorID);
+ printf("pRICSubscriptionFailure->ricRequestID.ricRequestSequenceNumber = %u\n",pRICSubscriptionFailure->ricRequestID.ricRequestSequenceNumber);
+ printf("pRICSubscriptionFailure->ranFunctionID = %i\n",pRICSubscriptionFailure->ranFunctionID);
+ printf("pRICSubscriptionFailure->ricActionNotAdmittedList.contentLength = %u\n",(unsigned)pRICSubscriptionFailure->ricActionNotAdmittedList.contentLength);
+ uint64_t index = 0;
+ while (index < pRICSubscriptionFailure->ricActionNotAdmittedList.contentLength) {
+ printf("pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID = %lu\n",
+ pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID);
+ printf("pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content = %u\n",
+ (unsigned)pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content);
+ printf("pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause = %u\n",
+ (unsigned)pRICSubscriptionFailure->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause);
+ index++;
+ }
+ if (pRICSubscriptionFailure->criticalityDiagnosticsPresent) {
+ printf("pRICSubscriptionFailure->criticalityDiagnosticsPresent = %u\n",pRICSubscriptionFailure->criticalityDiagnosticsPresent);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.procedureCodePresent = %u\n",pRICSubscriptionFailure->criticalityDiagnostics.procedureCodePresent);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.procedureCode = %u\n",(unsigned)pRICSubscriptionFailure->criticalityDiagnostics.procedureCode);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.triggeringMessagePresent = %u\n",pRICSubscriptionFailure->criticalityDiagnostics.triggeringMessagePresent);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.triggeringMessage = %u\n",(unsigned)pRICSubscriptionFailure->criticalityDiagnostics.triggeringMessage);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.procedureCriticalityPresent = %u\n",pRICSubscriptionFailure->criticalityDiagnostics.procedureCriticalityPresent);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.procedureCriticality = %u\n",(unsigned)pRICSubscriptionFailure->criticalityDiagnostics.procedureCriticality);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.iEsCriticalityDiagnosticsPresent = %u\n",pRICSubscriptionFailure->criticalityDiagnostics.iEsCriticalityDiagnosticsPresent);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.criticalityDiagnosticsIELength = %u\n",pRICSubscriptionFailure->criticalityDiagnostics.criticalityDiagnosticsIELength);
+ index = 0;
+ while (index < pRICSubscriptionFailure->criticalityDiagnostics.criticalityDiagnosticsIELength) {
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.criticalityDiagnosticsIEListItem[index].iECriticality = %u\n",
+ (unsigned)pRICSubscriptionFailure->criticalityDiagnostics.criticalityDiagnosticsIEListItem[index].iECriticality);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.criticalityDiagnosticsIEListItem[index].iE_ID = %u\n",
+ pRICSubscriptionFailure->criticalityDiagnostics.criticalityDiagnosticsIEListItem[index].iE_ID);
+ printf("pRICSubscriptionFailure->criticalityDiagnostics.criticalityDiagnosticsIEListItem[index].typeOfError = %u\n",
+ (unsigned)pRICSubscriptionFailure->criticalityDiagnostics.criticalityDiagnosticsIEListItem[index].typeOfError);
+ index++;
+ }
+ }
+ printf("\n");
+}
+
+//////////////////////////////////////////////////////////////////////
+void printRICIndication(const RICIndication_t* pRICIndication) {
+
+ printf("pRICIndication->ricRequestID.ricRequestorID = %u\n",pRICIndication->ricRequestID.ricRequestorID);
+ printf("pRICIndication->ricRequestID.ricRequestSequenceNumber = %u\n",pRICIndication->ricRequestID.ricRequestSequenceNumber);
+ printf("pRICIndication->ranFunctionID = %u\n",pRICIndication->ranFunctionID);
+ printf("pRICIndication->ricActionID = %lu\n",pRICIndication->ricActionID);
+ printf("pRICIndication->ricIndicationSN = %u\n",pRICIndication->ricIndicationSN);
+ printf("pRICIndication->ricIndicationType = %u\n",(unsigned)pRICIndication->ricIndicationType);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBIDPresent = %u\n",pRICIndication->ricIndicationHeader.interfaceID.globalENBIDPresent);
+ if (pRICIndication->ricIndicationHeader.interfaceID.globalENBIDPresent) {
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.contentLength = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.contentLength);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0]);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1]);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2]);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.nodeID.bits = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.nodeID.bits);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalENBID.nodeID.nodeID = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalENBID.nodeID.nodeID);
+ }
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBIDPresent = %u\n",pRICIndication->ricIndicationHeader.interfaceID.globalGNBIDPresent);
+ if(pRICIndication->ricIndicationHeader.interfaceID.globalGNBIDPresent){
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.contentLength = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.contentLength);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0]);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1]);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2] = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2]);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.nodeID.bits = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.nodeID.bits);
+ printf("pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.nodeID.nodeID = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceID.globalGNBID.nodeID.nodeID);
+ }
+ printf("pRICIndication->ricIndicationHeader.interfaceDirection = %u\n",(unsigned)pRICIndication->ricIndicationHeader.interfaceDirection);
+ printf("pRICIndication->ricIndicationMessage.interfaceMessage.contentLength = %u\n",(unsigned)pRICIndication->ricIndicationMessage.interfaceMessage.contentLength);
+
+ printf("pRICIndication->ricIndicationMessage.interfaceMessage.data = ");
+ printDataBuffer(pRICIndication->ricIndicationMessage.interfaceMessage.contentLength,pRICIndication->ricIndicationMessage.interfaceMessage.data);
+ printf("\n");
+}
+
+void printRICSubscriptionDeleteRequest(const RICSubscriptionDeleteRequest_t* pRICSubscriptionDeleteRequest) {
+
+ printf("\npRICSubscriptionDeleteRequest->ricRequestID.ricRequestorID = %u\n",pRICSubscriptionDeleteRequest->ricRequestID.ricRequestorID);
+ printf("pRICSubscriptionDeleteRequest->ricRequestID.ricRequestSequenceNumber = %u\n",pRICSubscriptionDeleteRequest->ricRequestID.ricRequestSequenceNumber);
+ printf("pRICSubscriptionDeleteRequest->ranFunctionID = %i\n",pRICSubscriptionDeleteRequest->ranFunctionID);
+ printf("\n");
+}
+
+void printRICSubscriptionDeleteResponse(const RICSubscriptionDeleteResponse_t* pRICSubscriptionDeleteResponse) {
+
+ printf("\npRICSubscriptionDeleteResponse->ricRequestID.ricRequestorID = %u\n",pRICSubscriptionDeleteResponse->ricRequestID.ricRequestorID);
+ printf("pRICSubscriptionDeleteResponse->ricRequestID.ricRequestSequenceNumber = %u\n",pRICSubscriptionDeleteResponse->ricRequestID.ricRequestSequenceNumber);
+ printf("pRICSubscriptionDeleteResponse->ranFunctionID = %i\n",pRICSubscriptionDeleteResponse->ranFunctionID);
+ printf("\n");
+}
+
+void printRICSubscriptionDeleteFailure(const RICSubscriptionDeleteFailure_t* pRICSubscriptionDeleteFailure) {
+
+ printf("\npRICSubscriptionDeleteFailure->ricRequestID.ricRequestorID = %u\n",pRICSubscriptionDeleteFailure->ricRequestID.ricRequestorID);
+ printf("pRICSubscriptionDeleteFailure->ricRequestID.ricRequestSequenceNumber = %u\n",pRICSubscriptionDeleteFailure->ricRequestID.ricRequestSequenceNumber);
+ printf("pRICSubscriptionDeleteFailure->ranFunctionID = %i\n",pRICSubscriptionDeleteFailure->ranFunctionID);
+ printf("pRICSubscriptionDeleteFailure->ricCause.content = %i\n",pRICSubscriptionDeleteFailure->ricCause.content);
+ printf("pRICSubscriptionDeleteFailure->ricCause.cause = %i\n",pRICSubscriptionDeleteFailure->ricCause.cause);
+ printf("\n");
+}
+
+#endif
diff --git a/e2ap/libe2ap_wrapper/c_types.h b/e2ap/libe2ap_wrapper/c_types.h
new file mode 100644
index 0000000..d9a2baf
--- /dev/null
+++ b/e2ap/libe2ap_wrapper/c_types.h
@@ -0,0 +1,30 @@
+/*
+==================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property.
+ Copyright (c) 2019 Nokia
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+#ifndef c_types_h
+#define c_types_h
+
+// Theses are required for Golang compilation
+#ifndef __cplusplus
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#endif
+
+#endif
+
diff --git a/e2ap/libe2ap_wrapper/wrapper.c b/e2ap/libe2ap_wrapper/wrapper.c
new file mode 100644
index 0000000..bd34275
--- /dev/null
+++ b/e2ap/libe2ap_wrapper/wrapper.c
@@ -0,0 +1,415 @@
+/*
+==================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property.
+ Copyright (c) 2019 Nokia
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+
+#include <errno.h>
+#include "wrapper.h"
+
+size_t encode_E2AP_PDU(E2AP_PDU_t* pdu, void* buffer, size_t buf_size)
+{
+ asn_enc_rval_t encode_result;
+ encode_result = aper_encode_to_buffer(&asn_DEF_E2AP_PDU, NULL, pdu, buffer, buf_size);
+ if (encode_result.encoded == -1) {
+ return -1;
+ }
+ return encode_result.encoded;
+}
+
+E2AP_PDU_t* decode_E2AP_PDU(const void* buffer, size_t buf_size)
+{
+ asn_dec_rval_t decode_result;
+ E2AP_PDU_t *pdu = 0;
+ decode_result = aper_decode_complete(NULL, &asn_DEF_E2AP_PDU, (void **)&pdu, buffer, buf_size);
+ if (decode_result.code == RC_OK) {
+ return pdu;
+ } else {
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return 0;
+ }
+}
+
+long e2ap_get_ric_subscription_request_sequence_number(void *buffer, size_t buf_size)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_initiatingMessage)
+ {
+ RICInitiatingMessage_t* initiatingMessage = &pdu->choice.initiatingMessage;
+ if ( initiatingMessage->procedureCode == ProcedureCode_id_ricSubscription
+ && initiatingMessage->value.present == RICInitiatingMessage__value_PR_RICsubscriptionRequest)
+ {
+ RICsubscriptionRequest_t *ric_subscription_request = &(initiatingMessage->value.choice.RICsubscriptionRequest);
+ for (int i = 0; i < ric_subscription_request->protocolIEs.list.count; ++i)
+ {
+ if (ric_subscription_request->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ long sequence_number = ric_subscription_request->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber;
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return sequence_number;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+ssize_t e2ap_set_ric_subscription_request_sequence_number(void *buffer, size_t buf_size, long sequence_number)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_initiatingMessage)
+ {
+ RICInitiatingMessage_t* initiatingMessage = &pdu->choice.initiatingMessage;
+ if ( initiatingMessage->procedureCode == ProcedureCode_id_ricSubscription
+ && initiatingMessage->value.present == RICInitiatingMessage__value_PR_RICsubscriptionRequest)
+ {
+ RICsubscriptionRequest_t *ricSubscriptionRequest = &initiatingMessage->value.choice.RICsubscriptionRequest;
+ for (int i = 0; i < ricSubscriptionRequest->protocolIEs.list.count; ++i)
+ {
+ if (ricSubscriptionRequest->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ ricSubscriptionRequest->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number;
+ size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return encode_size;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ return -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+/* RICsubscriptionResponse */
+long e2ap_get_ric_subscription_response_sequence_number(void *buffer, size_t buf_size)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_successfulOutcome)
+ {
+ RICSuccessfulOutcome_t* successfulOutcome = &pdu->choice.successfulOutcome;
+ if ( successfulOutcome->procedureCode == ProcedureCode_id_ricSubscription
+ && successfulOutcome->value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionResponse)
+ {
+ RICsubscriptionResponse_t *ricSubscriptionResponse = &successfulOutcome->value.choice.RICsubscriptionResponse;
+ for (int i = 0; i < ricSubscriptionResponse->protocolIEs.list.count; ++i)
+ {
+ if (ricSubscriptionResponse->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ long sequence_number = ricSubscriptionResponse->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber;
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return sequence_number;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+ssize_t e2ap_set_ric_subscription_response_sequence_number(void *buffer, size_t buf_size, long sequence_number)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_successfulOutcome)
+ {
+ RICSuccessfulOutcome_t* successfulOutcome = &pdu->choice.successfulOutcome;
+ if ( successfulOutcome->procedureCode == ProcedureCode_id_ricSubscription
+ && successfulOutcome->value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionResponse)
+ {
+ RICsubscriptionResponse_t *ricSubscriptionResponse = &successfulOutcome->value.choice.RICsubscriptionResponse;
+ for (int i = 0; i < ricSubscriptionResponse->protocolIEs.list.count; ++i)
+ {
+ if (ricSubscriptionResponse->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ ricSubscriptionResponse->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number;
+ size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return encode_size;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+/* RICsubscriptionDeleteRequest */
+long e2ap_get_ric_subscription_delete_request_sequence_number(void *buffer, size_t buf_size)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_initiatingMessage)
+ {
+ RICInitiatingMessage_t* initiatingMessage = &pdu->choice.initiatingMessage;
+ if ( initiatingMessage->procedureCode == ProcedureCode_id_ricSubscriptionDelete
+ && initiatingMessage->value.present == RICInitiatingMessage__value_PR_RICsubscriptionDeleteRequest )
+ {
+ RICsubscriptionDeleteRequest_t *subscriptionDeleteRequest = &initiatingMessage->value.choice.RICsubscriptionDeleteRequest;
+ for (int i = 0; i < subscriptionDeleteRequest->protocolIEs.list.count; ++i)
+ {
+ if (subscriptionDeleteRequest->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ long sequence_number = subscriptionDeleteRequest->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber;
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return sequence_number;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+ssize_t e2ap_set_ric_subscription_delete_request_sequence_number(void *buffer, size_t buf_size, long sequence_number)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_initiatingMessage)
+ {
+ RICInitiatingMessage_t* initiatingMessage = &pdu->choice.initiatingMessage;
+ if ( initiatingMessage->procedureCode == ProcedureCode_id_ricSubscriptionDelete
+ && initiatingMessage->value.present == RICInitiatingMessage__value_PR_RICsubscriptionDeleteRequest )
+ {
+ RICsubscriptionDeleteRequest_t* subscriptionDeleteRequest = &initiatingMessage->value.choice.RICsubscriptionDeleteRequest;
+ for (int i = 0; i < subscriptionDeleteRequest->protocolIEs.list.count; ++i)
+ {
+ if (subscriptionDeleteRequest->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ subscriptionDeleteRequest->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number;
+ size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return encode_size;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+/* RICsubscriptionDeleteResponse */
+long e2ap_get_ric_subscription_delete_response_sequence_number(void *buffer, size_t buf_size)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_successfulOutcome)
+ {
+ RICSuccessfulOutcome_t* successfulOutcome = &pdu->choice.successfulOutcome;
+ if ( successfulOutcome->procedureCode == ProcedureCode_id_ricSubscriptionDelete
+ && successfulOutcome->value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse )
+ {
+ RICsubscriptionDeleteResponse_t* subscriptionDeleteResponse = &successfulOutcome->value.choice.RICsubscriptionDeleteResponse;
+ for (int i = 0; i < subscriptionDeleteResponse->protocolIEs.list.count; ++i)
+ {
+ if (subscriptionDeleteResponse->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ long sequence_number = subscriptionDeleteResponse->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber;
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return sequence_number;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+ssize_t e2ap_set_ric_subscription_delete_response_sequence_number(void *buffer, size_t buf_size, long sequence_number)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_successfulOutcome)
+ {
+ RICSuccessfulOutcome_t* successfulOutcome = &pdu->choice.successfulOutcome;
+ if ( successfulOutcome->procedureCode == ProcedureCode_id_ricSubscriptionDelete
+ && successfulOutcome->value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse )
+ {
+ RICsubscriptionDeleteResponse_t* subscriptionDeleteResponse = &successfulOutcome->value.choice.RICsubscriptionDeleteResponse;
+ for (int i = 0; i < subscriptionDeleteResponse->protocolIEs.list.count; ++i)
+ {
+ if (subscriptionDeleteResponse->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ subscriptionDeleteResponse->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number;
+ size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return encode_size;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+// This function is not used currently. Can be deleted if not needed
+ssize_t e2ap_set_ric_subscription_failure_sequence_number(void *buffer, size_t buf_size, long sequence_number)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_unsuccessfulOutcome)
+ {
+ RICUnsuccessfulOutcome_t* unsuccessfulOutcome = &pdu->choice.unsuccessfulOutcome;
+ if (unsuccessfulOutcome->procedureCode == ProcedureCode_id_ricSubscription
+ && unsuccessfulOutcome->value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionFailure)
+ {
+ RICsubscriptionFailure_t* subscriptionFailure = &unsuccessfulOutcome->value.choice.RICsubscriptionFailure;
+ for (int i = 0; i < subscriptionFailure->protocolIEs.list.count; ++i)
+ {
+ if (subscriptionFailure->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ subscriptionFailure->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number;
+ size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return encode_size;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+long e2ap_get_ric_subscription_failure_sequence_number(void *buffer, size_t buf_size)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_unsuccessfulOutcome)
+ {
+ RICUnsuccessfulOutcome_t* unsuccessfulOutcome = &pdu->choice.unsuccessfulOutcome;
+ if (unsuccessfulOutcome->procedureCode == ProcedureCode_id_ricSubscription
+ && unsuccessfulOutcome->value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionFailure)
+ {
+ RICsubscriptionFailure_t* subscriptionFailure = &unsuccessfulOutcome->value.choice.RICsubscriptionFailure;;
+ for (int i = 0; i < subscriptionFailure->protocolIEs.list.count; ++i)
+ {
+ if (subscriptionFailure->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ long sequence_number = subscriptionFailure->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber;
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return sequence_number;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+// This function is not used currently. Can be deleted if not needed
+ssize_t e2ap_set_ric_subscription_delete_failure_sequence_number(void *buffer, size_t buf_size, long sequence_number)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_unsuccessfulOutcome)
+ {
+ RICUnsuccessfulOutcome_t* unsuccessfulOutcome = &pdu->choice.unsuccessfulOutcome;
+ if (unsuccessfulOutcome->procedureCode == ProcedureCode_id_ricSubscriptionDelete
+ && unsuccessfulOutcome->value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure)
+ {
+ RICsubscriptionDeleteFailure_t* subscriptionDeleteFailure = &unsuccessfulOutcome->value.choice.RICsubscriptionDeleteFailure;
+ for (int i = 0; i < subscriptionDeleteFailure->protocolIEs.list.count; ++i)
+ {
+ if (subscriptionDeleteFailure->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ subscriptionDeleteFailure->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number;
+ size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return encode_size;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
+
+long e2ap_get_ric_subscription_delete_failure_sequence_number(void *buffer, size_t buf_size)
+{
+ int errorCode = -1;
+ E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size);
+ if (pdu != NULL && pdu->present == E2AP_PDU_PR_unsuccessfulOutcome)
+ {
+ RICUnsuccessfulOutcome_t* unsuccessfulOutcome = &pdu->choice.unsuccessfulOutcome;
+ if (unsuccessfulOutcome->procedureCode == ProcedureCode_id_ricSubscriptionDelete
+ && unsuccessfulOutcome->value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure)
+ {
+ RICsubscriptionDeleteFailure_t* subscriptionDeleteFailure = &unsuccessfulOutcome->value.choice.RICsubscriptionDeleteFailure;;
+ for (int i = 0; i < subscriptionDeleteFailure->protocolIEs.list.count; ++i)
+ {
+ if (subscriptionDeleteFailure->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID)
+ {
+ long sequence_number = subscriptionDeleteFailure->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber;
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return sequence_number;
+ }
+ else
+ errorCode = -3;
+ }
+ }
+ else
+ errorCode = -2;
+ }
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+ return errorCode;
+}
diff --git a/e2ap/libe2ap_wrapper/wrapper.h b/e2ap/libe2ap_wrapper/wrapper.h
new file mode 100644
index 0000000..ee6c9bc
--- /dev/null
+++ b/e2ap/libe2ap_wrapper/wrapper.h
@@ -0,0 +1,68 @@
+/*
+==================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property.
+ Copyright (c) 2019 Nokia
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+
+#ifndef _WRAPPER_H_
+#define _WRAPPER_H_
+
+#ifndef ASN_DISABLE_OER_SUPPORT
+#define ASN_DISABLE_OER_SUPPORT
+#endif
+
+#include "RICsubscriptionRequest.h"
+#include "RICsubscriptionResponse.h"
+#include "RICsubscriptionDeleteRequest.h"
+#include "RICsubscriptionDeleteResponse.h"
+#include "RICsubscriptionFailure.h"
+#include "RICsubscriptionDeleteFailure.h"
+#include "E2AP-PDU.h"
+#include "RICInitiatingMessage.h"
+#include "RICSuccessfulOutcome.h"
+#include "RICUnsuccessfulOutcome.h"
+#include "ProtocolIE-Container.h"
+#include "ProtocolIE-Field.h"
+
+size_t encode_E2AP_PDU(E2AP_PDU_t* pdu, void* buffer, size_t buf_size);
+E2AP_PDU_t* decode_E2AP_PDU(const void* buffer, size_t buf_size);
+
+long e2ap_get_ric_subscription_request_sequence_number(void *buffer, size_t buf_size);
+ssize_t e2ap_set_ric_subscription_request_sequence_number(void *buffer, size_t buf_size, long sequence_number);
+RICsubscription_t* e2ap_get_ric_subscription_request_ric_subscription(void *buffer, size_t buffer_size);
+
+/* RICsubscriptionResponse */
+long e2ap_get_ric_subscription_response_sequence_number(void *buffer, size_t buf_size);
+ssize_t e2ap_set_ric_subscription_response_sequence_number(void *buffer, size_t buf_size, long sequence_number);
+
+/* RICsubscriptionDeleteRequest */
+long e2ap_get_ric_subscription_delete_request_sequence_number(void *buffer, size_t buf_size);
+ssize_t e2ap_set_ric_subscription_delete_request_sequence_number(void *buffer, size_t buf_size, long sequence_number);
+
+/* RICsubscriptionDeleteResponse */
+long e2ap_get_ric_subscription_delete_response_sequence_number(void *buffer, size_t buf_size);
+ssize_t e2ap_set_ric_subscription_delete_response_sequence_number(void *buffer, size_t buf_size, long sequence_number);
+
+/* RICsubscriptionFailure */
+long e2ap_get_ric_subscription_failure_sequence_number(void *buffer, size_t buf_size);
+ssize_t e2ap_set_ric_subscription_failure_sequence_number(void *buffer, size_t buf_size, long sequence_number);
+
+/* RICsubscriptionFailure */
+long e2ap_get_ric_subscription_delete_failure_sequence_number(void *buffer, size_t buf_size);
+ssize_t e2ap_set_ric_subscription_delete_failure_sequence_number(void *buffer, size_t buf_size, long sequence_number);
+
+
+#endif /* _WRAPPER_H_ */