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_ */
