Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | */ |
| 19 | |
| 20 | #include <stdio.h> |
| 21 | #include <stdlib.h> |
| 22 | |
| 23 | #include "E2AP-PDU.h" |
| 24 | #include "ProtocolIE-Field.h" |
| 25 | #include "RICsubsequentAction.h" |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 26 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 27 | #include "asn_constant.h" |
| 28 | #include "E2AP_if.h" |
| 29 | |
Anssi Mannila | e1af87f | 2021-11-10 13:10:54 +0200 | [diff] [blame] | 30 | static bool debugPrints = false; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 31 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 32 | const int64_t cMaxNrOfErrors = 256; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 33 | const uint64_t cMaxSizeOfOctetString = 1024; |
| 34 | |
| 35 | const size_t cMacroENBIDP_20Bits = 20; |
| 36 | const size_t cHomeENBID_28Bits = 28; |
| 37 | const size_t cShortMacroENBID_18Bits = 18; |
| 38 | const size_t clongMacroENBIDP_21Bits = 21; |
| 39 | |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 40 | const int cCauseRICRequest = 1; |
| 41 | const int cCauseRICService = 2; |
| 42 | const int cCauseTransport = 3; |
| 43 | const int cCauseProtocol = 4; |
| 44 | const int cCauseMisc = 5; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 45 | |
| 46 | ////////////////////////////////////////////////////////////////////// |
| 47 | // Message definitons |
| 48 | |
| 49 | // Below constant values are same as in E2AP, E2SM and X2AP specs |
| 50 | const uint64_t cE2InitiatingMessage = 1; |
| 51 | const uint64_t cE2SuccessfulOutcome = 2; |
| 52 | const uint64_t cE2UnsuccessfulOutcome = 3; |
| 53 | |
| 54 | // E2AP messages |
| 55 | // Initiating message |
| 56 | const uint64_t cRICSubscriptionRequest = 1; |
| 57 | const uint64_t cRICSubscriptionDeleteRequest = 2; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 58 | |
| 59 | // Successful outcome |
| 60 | const uint64_t cRICSubscriptionResponse = 1; |
| 61 | const uint64_t cRICsubscriptionDeleteResponse = 2; |
| 62 | |
| 63 | // Unsuccessful outcome |
| 64 | const uint64_t cRICSubscriptionFailure = 1; |
| 65 | const uint64_t cRICsubscriptionDeleteFailure = 2; |
| 66 | |
| 67 | typedef union { |
| 68 | uint32_t nodeID; |
| 69 | uint8_t octets[4]; |
| 70 | } IdOctects_t; |
| 71 | |
| 72 | ////////////////////////////////////////////////////////////////////// |
Anssi Mannila | e1af87f | 2021-11-10 13:10:54 +0200 | [diff] [blame] | 73 | void allowASN1DebugPrints(bool allowASN1DebugPrints) { |
| 74 | debugPrints = allowASN1DebugPrints; |
| 75 | } |
| 76 | |
| 77 | ////////////////////////////////////////////////////////////////////// |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 78 | const char* getE2ErrorString(uint64_t errorCode) { |
| 79 | |
| 80 | return E2ErrorStrings[errorCode]; |
| 81 | } |
| 82 | |
| 83 | ///////////////////////////////////////////////////////////////////// |
| 84 | bool E2encode(E2AP_PDU_t* pE2AP_PDU, size_t* dataBufferSize, byte* dataBuffer, char* pLogBuffer) { |
| 85 | |
Anssi Mannila | e1af87f | 2021-11-10 13:10:54 +0200 | [diff] [blame] | 86 | if (debugPrints) |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 87 | asn_fprint(stdout, &asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 88 | |
| 89 | asn_enc_rval_t rval; |
| 90 | rval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, pE2AP_PDU, dataBuffer, *dataBufferSize); |
| 91 | if (rval.encoded == -1) { |
Anssi Mannila | f729b4d | 2020-04-13 21:02:11 +0300 | [diff] [blame] | 92 | sprintf(pLogBuffer,"Serialization of %s failed", asn_DEF_E2AP_PDU.name); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 93 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 94 | return false; |
| 95 | } |
| 96 | else if (rval.encoded > *dataBufferSize) { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 97 | sprintf(pLogBuffer,"Buffer of size %zu is too small for %s, need %zu",*dataBufferSize, asn_DEF_E2AP_PDU.name, rval.encoded); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 98 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 99 | return false; |
| 100 | } |
| 101 | else { |
Anssi Mannila | e1af87f | 2021-11-10 13:10:54 +0200 | [diff] [blame] | 102 | if (debugPrints) |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 103 | sprintf(pLogBuffer,"Successfully encoded %s. Buffer size %zu, encoded size %zu",asn_DEF_E2AP_PDU.name, *dataBufferSize, rval.encoded); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 104 | |
| 105 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 106 | *dataBufferSize = rval.encoded; |
| 107 | return true; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | ////////////////////////////////////////////////////////////////////// |
| 112 | uint64_t packRICSubscriptionRequest(size_t* pdataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionRequest_t* pRICSubscriptionRequest) { |
| 113 | |
| 114 | E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t)); |
| 115 | if(pE2AP_PDU) |
| 116 | { |
| 117 | pE2AP_PDU->present = E2AP_PDU_PR_initiatingMessage; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 118 | pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_RICsubscription; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 119 | pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 120 | pE2AP_PDU->choice.initiatingMessage.value.present = InitiatingMessage__value_PR_RICsubscriptionRequest; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 121 | |
| 122 | // RICrequestID |
| 123 | RICsubscriptionRequest_IEs_t* pRICsubscriptionRequest_IEs = calloc(1, sizeof(RICsubscriptionRequest_IEs_t)); |
| 124 | if (pRICsubscriptionRequest_IEs) { |
| 125 | pRICsubscriptionRequest_IEs->id = ProtocolIE_ID_id_RICrequestID; |
| 126 | pRICsubscriptionRequest_IEs->criticality = Criticality_reject; |
| 127 | pRICsubscriptionRequest_IEs->value.present = RICsubscriptionRequest_IEs__value_PR_RICrequestID; |
| 128 | pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionRequest->ricRequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 129 | pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionRequest->ricRequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 130 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list, pRICsubscriptionRequest_IEs); |
| 131 | } |
| 132 | else |
| 133 | return e2err_RICSubscriptionRequestAllocRICrequestIDFail; |
| 134 | |
| 135 | // RANfunctionID |
| 136 | pRICsubscriptionRequest_IEs = calloc(1, sizeof(RICsubscriptionRequest_IEs_t)); |
| 137 | if (pRICsubscriptionRequest_IEs) { |
| 138 | pRICsubscriptionRequest_IEs->id = ProtocolIE_ID_id_RANfunctionID; |
| 139 | pRICsubscriptionRequest_IEs->criticality = Criticality_reject; |
| 140 | pRICsubscriptionRequest_IEs->value.present = RICsubscriptionRequest_IEs__value_PR_RANfunctionID; |
| 141 | pRICsubscriptionRequest_IEs->value.choice.RANfunctionID = pRICSubscriptionRequest->ranFunctionID; |
| 142 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list, pRICsubscriptionRequest_IEs); |
| 143 | } |
| 144 | else |
| 145 | return e2err_RICSubscriptionRequestAllocRANfunctionIDFail; |
| 146 | |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 147 | // RICsubscriptionDetails |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 148 | pRICsubscriptionRequest_IEs = calloc(1, sizeof(RICsubscriptionRequest_IEs_t)); |
| 149 | if (pRICsubscriptionRequest_IEs) { |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 150 | pRICsubscriptionRequest_IEs->id = ProtocolIE_ID_id_RICsubscriptionDetails; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 151 | pRICsubscriptionRequest_IEs->criticality = Criticality_reject; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 152 | pRICsubscriptionRequest_IEs->value.present = RICsubscriptionRequest_IEs__value_PR_RICsubscriptionDetails; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 153 | |
| 154 | // RICeventTriggerDefinition |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 155 | pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.buf = |
| 156 | calloc(1, pRICSubscriptionRequest->ricSubscriptionDetails.ricEventTriggerDefinition.octetString.contentLength); |
| 157 | if (pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.buf) { |
| 158 | pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.size = |
| 159 | pRICSubscriptionRequest->ricSubscriptionDetails.ricEventTriggerDefinition.octetString.contentLength; |
| 160 | memcpy(pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.buf, |
| 161 | pRICSubscriptionRequest->ricSubscriptionDetails.ricEventTriggerDefinition.octetString.data, |
| 162 | pRICSubscriptionRequest->ricSubscriptionDetails.ricEventTriggerDefinition.octetString.contentLength); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 163 | } |
| 164 | else |
| 165 | return e2err_RICSubscriptionRequestAllocRICeventTriggerDefinitionBufFail; |
| 166 | |
| 167 | // RICactions-ToBeSetup-List |
| 168 | uint64_t index = 0; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 169 | while (index < pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength && index < maxofRICactionID) { |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 170 | RICaction_ToBeSetup_ItemIEs_t* pRICaction_ToBeSetup_ItemIEs = calloc(1, sizeof(RICaction_ToBeSetup_ItemIEs_t)); |
| 171 | if (pRICaction_ToBeSetup_ItemIEs) { |
| 172 | pRICaction_ToBeSetup_ItemIEs->id = ProtocolIE_ID_id_RICaction_ToBeSetup_Item; |
Anssi Mannila | 7eb6904 | 2020-04-27 12:34:36 +0300 | [diff] [blame] | 173 | pRICaction_ToBeSetup_ItemIEs->criticality = Criticality_ignore; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 174 | pRICaction_ToBeSetup_ItemIEs->value.present = RICaction_ToBeSetup_ItemIEs__value_PR_RICaction_ToBeSetup_Item; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 175 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 176 | // RICActionID |
| 177 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionID = |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 178 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID; |
| 179 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 180 | // RICActionType |
| 181 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionType = |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 182 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType; |
| 183 | |
| 184 | // RICactionDefinition, OPTIONAL |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 185 | if (pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent) { |
| 186 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition = calloc(1, sizeof (RICactionDefinition_t)); |
| 187 | if (pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition) { |
| 188 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition->buf = |
| 189 | calloc(1, pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionChoice.octetString.contentLength); |
| 190 | if (pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition->buf) { |
| 191 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition->size = |
| 192 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionChoice.octetString.contentLength; |
| 193 | memcpy(pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition->buf, |
| 194 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionChoice.octetString.data, |
| 195 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionChoice.octetString.contentLength); |
| 196 | } |
| 197 | else |
| 198 | return e2err_RICSubscriptionRequestAllocRICactionDefinitionBufFail; |
| 199 | } |
| 200 | else |
| 201 | return e2err_RICSubscriptionRequestAllocRICactionDefinitionFail; |
| 202 | } |
| 203 | |
| 204 | // RICsubsequentAction, OPTIONAL |
| 205 | if (pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent) { |
| 206 | RICsubsequentAction_t* pRICsubsequentAction = calloc(1, sizeof(RICsubsequentAction_t)); |
| 207 | if (pRICsubsequentAction) { |
| 208 | pRICsubsequentAction->ricSubsequentActionType = |
| 209 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType; |
| 210 | pRICsubsequentAction->ricTimeToWait = |
| 211 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait; |
| 212 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction = pRICsubsequentAction; |
| 213 | } |
| 214 | else |
| 215 | return e2err_RICSubscriptionRequestAllocRICsubsequentActionFail; |
| 216 | } |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 217 | } |
| 218 | else |
| 219 | return e2err_RICSubscriptionRequestAllocRICaction_ToBeSetup_ItemIEsFail; |
| 220 | |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 221 | ASN_SEQUENCE_ADD(&pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.list, pRICaction_ToBeSetup_ItemIEs); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 222 | index++; |
| 223 | } |
| 224 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest.protocolIEs.list, pRICsubscriptionRequest_IEs); |
| 225 | } |
| 226 | else |
| 227 | return e2err_RICSubscriptionRequestAllocRICsubscriptionRequest_IEsFail; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 228 | if (E2encode(pE2AP_PDU, pdataBufferSize, pDataBuffer, pLogBuffer)) |
| 229 | return e2err_OK; |
| 230 | else |
| 231 | return e2err_RICSubscriptionRequestEncodeFail; |
| 232 | } |
| 233 | return e2err_RICSubscriptionRequestAllocE2AP_PDUFail; |
| 234 | } |
| 235 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 236 | |
| 237 | ////////////////////////////////////////////////////////////////////// |
| 238 | uint64_t packRICSubscriptionResponse(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionResponse_t* pRICSubscriptionResponse) { |
| 239 | |
| 240 | E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t)); |
| 241 | if(pE2AP_PDU) |
| 242 | { |
| 243 | pE2AP_PDU->present = E2AP_PDU_PR_successfulOutcome; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 244 | pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_RICsubscription; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 245 | pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 246 | pE2AP_PDU->choice.initiatingMessage.value.present = SuccessfulOutcome__value_PR_RICsubscriptionResponse; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 247 | |
| 248 | // RICrequestID |
| 249 | RICsubscriptionResponse_IEs_t* pRICsubscriptionResponse_IEs = calloc(1, sizeof(RICsubscriptionResponse_IEs_t)); |
| 250 | if (pRICsubscriptionResponse_IEs) { |
| 251 | pRICsubscriptionResponse_IEs->id = ProtocolIE_ID_id_RICrequestID; |
| 252 | pRICsubscriptionResponse_IEs->criticality = Criticality_reject; |
| 253 | pRICsubscriptionResponse_IEs->value.present = RICsubscriptionResponse_IEs__value_PR_RICrequestID; |
| 254 | pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionResponse->ricRequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 255 | pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionResponse->ricRequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 256 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list, pRICsubscriptionResponse_IEs); |
| 257 | } |
| 258 | else |
| 259 | return e2err_RICSubscriptionResponseAllocRICrequestIDFail; |
| 260 | |
| 261 | // RANfunctionID |
| 262 | pRICsubscriptionResponse_IEs = calloc(1, sizeof(RICsubscriptionResponse_IEs_t)); |
| 263 | if (pRICsubscriptionResponse_IEs) { |
| 264 | pRICsubscriptionResponse_IEs->id = ProtocolIE_ID_id_RANfunctionID; |
| 265 | pRICsubscriptionResponse_IEs->criticality = Criticality_reject; |
| 266 | pRICsubscriptionResponse_IEs->value.present = RICsubscriptionResponse_IEs__value_PR_RANfunctionID; |
| 267 | pRICsubscriptionResponse_IEs->value.choice.RANfunctionID = pRICSubscriptionResponse->ranFunctionID; |
| 268 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list, pRICsubscriptionResponse_IEs); |
| 269 | } |
| 270 | else |
| 271 | return e2err_RICSubscriptionResponseAllocRANfunctionIDFail; |
| 272 | |
| 273 | // RICaction-Admitted list |
| 274 | pRICsubscriptionResponse_IEs = calloc(1, sizeof(RICsubscriptionResponse_IEs_t)); |
| 275 | if (pRICsubscriptionResponse_IEs) { |
| 276 | pRICsubscriptionResponse_IEs->id = ProtocolIE_ID_id_RICactions_Admitted; |
| 277 | pRICsubscriptionResponse_IEs->criticality = Criticality_reject; |
| 278 | pRICsubscriptionResponse_IEs->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_Admitted_List; |
| 279 | |
| 280 | uint64_t index = 0; |
| 281 | while (index < pRICSubscriptionResponse->ricActionAdmittedList.contentLength && index < maxofRICactionID) { |
| 282 | |
| 283 | RICaction_Admitted_ItemIEs_t* pRICaction_Admitted_ItemIEs = calloc(1, sizeof (RICaction_Admitted_ItemIEs_t)); |
| 284 | if (pRICaction_Admitted_ItemIEs) |
| 285 | { |
| 286 | pRICaction_Admitted_ItemIEs->id = ProtocolIE_ID_id_RICaction_Admitted_Item; |
| 287 | pRICaction_Admitted_ItemIEs->criticality = Criticality_reject; |
| 288 | pRICaction_Admitted_ItemIEs->value.present = RICaction_Admitted_ItemIEs__value_PR_RICaction_Admitted_Item; |
| 289 | |
| 290 | // RICActionID |
| 291 | pRICaction_Admitted_ItemIEs->value.choice.RICaction_Admitted_Item.ricActionID = pRICSubscriptionResponse->ricActionAdmittedList.ricActionID[index]; |
| 292 | ASN_SEQUENCE_ADD(&pRICsubscriptionResponse_IEs->value.choice.RICaction_Admitted_List.list, pRICaction_Admitted_ItemIEs); |
| 293 | } |
| 294 | else |
| 295 | return e2err_RICSubscriptionResponseAllocRICaction_Admitted_ItemIEsFail; |
| 296 | index++; |
| 297 | } |
| 298 | } |
| 299 | else |
| 300 | return e2err_RICSubscriptionResponseAllocRICActionAdmittedListFail; |
| 301 | |
| 302 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list, pRICsubscriptionResponse_IEs); |
| 303 | |
Anssi Mannila | a93ec3c | 2020-01-21 10:10:32 +0200 | [diff] [blame] | 304 | // RICaction-NotAdmitted list, OPTIONAL |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 305 | if (pRICSubscriptionResponse->ricActionNotAdmittedListPresent) { |
| 306 | pRICsubscriptionResponse_IEs = calloc(1, sizeof(RICsubscriptionResponse_IEs_t)); |
| 307 | if (pRICsubscriptionResponse_IEs) { |
| 308 | pRICsubscriptionResponse_IEs->id = ProtocolIE_ID_id_RICactions_NotAdmitted; |
| 309 | pRICsubscriptionResponse_IEs->criticality = Criticality_reject; |
| 310 | pRICsubscriptionResponse_IEs->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_NotAdmitted_List; |
| 311 | |
| 312 | uint64_t index = 0; |
| 313 | while (index < pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength && index < maxofRICactionID) { |
| 314 | |
| 315 | RICaction_NotAdmitted_ItemIEs_t* pRICaction_NotAdmitted_ItemIEs = calloc(1, sizeof (RICaction_NotAdmitted_ItemIEs_t)); |
| 316 | if (pRICaction_NotAdmitted_ItemIEs) |
| 317 | { |
| 318 | pRICaction_NotAdmitted_ItemIEs->id = ProtocolIE_ID_id_RICaction_NotAdmitted_Item; |
| 319 | pRICaction_NotAdmitted_ItemIEs->criticality = Criticality_reject; |
| 320 | pRICaction_NotAdmitted_ItemIEs->value.present = RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item; |
| 321 | |
| 322 | // RICActionID |
| 323 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricActionID = |
| 324 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID; |
| 325 | |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 326 | // Cause |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 327 | if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content == Cause_PR_ricRequest) { |
| 328 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present = Cause_PR_ricRequest; |
| 329 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.ricRequest = |
| 330 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 331 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 332 | else if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content == Cause_PR_ricService) { |
| 333 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present = Cause_PR_ricService; |
| 334 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.ricService = |
| 335 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 336 | } |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 337 | else if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content == Cause_PR_e2Node) { |
| 338 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present = Cause_PR_e2Node; |
| 339 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.e2Node = |
| 340 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal; |
| 341 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 342 | else if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content == Cause_PR_transport) { |
| 343 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present = Cause_PR_transport; |
| 344 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.transport = |
| 345 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 346 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 347 | else if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content == Cause_PR_protocol) { |
| 348 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present = Cause_PR_protocol; |
| 349 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.protocol = |
| 350 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 351 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 352 | else if (pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content == Cause_PR_misc) { |
| 353 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present = Cause_PR_misc; |
| 354 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.misc = |
| 355 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 356 | } |
| 357 | ASN_SEQUENCE_ADD(&pRICsubscriptionResponse_IEs->value.choice.RICaction_NotAdmitted_List.list, pRICaction_NotAdmitted_ItemIEs); |
| 358 | } |
| 359 | else |
| 360 | return e2err_RICSubscriptionResponseAllocRICaction_NotAdmitted_ItemIEsFail; |
| 361 | index++; |
| 362 | } |
| 363 | } |
| 364 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse.protocolIEs.list, pRICsubscriptionResponse_IEs); |
| 365 | } |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 366 | |
| 367 | if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer)) |
| 368 | return e2err_OK; |
| 369 | else |
| 370 | return e2err_RICSubscriptionResponseEncodeFail; |
| 371 | } |
| 372 | return e2err_RICSubscriptionResponseAllocE2AP_PDUFail; |
| 373 | } |
| 374 | |
| 375 | ////////////////////////////////////////////////////////////////////// |
| 376 | uint64_t packRICSubscriptionFailure(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionFailure_t* pRICSubscriptionFailure) { |
| 377 | |
| 378 | E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t)); |
| 379 | if(pE2AP_PDU) |
| 380 | { |
| 381 | pE2AP_PDU->present = E2AP_PDU_PR_unsuccessfulOutcome; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 382 | pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode = ProcedureCode_id_RICsubscription; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 383 | pE2AP_PDU->choice.unsuccessfulOutcome.criticality = Criticality_ignore; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 384 | pE2AP_PDU->choice.unsuccessfulOutcome.value.present = UnsuccessfulOutcome__value_PR_RICsubscriptionFailure; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 385 | |
| 386 | // RICrequestID |
| 387 | RICsubscriptionFailure_IEs_t* pRICsubscriptionFailure_IEs = calloc(1, sizeof(RICsubscriptionFailure_IEs_t)); |
| 388 | if (pRICsubscriptionFailure_IEs) { |
| 389 | pRICsubscriptionFailure_IEs->id = ProtocolIE_ID_id_RICrequestID; |
| 390 | pRICsubscriptionFailure_IEs->criticality = Criticality_reject; |
| 391 | pRICsubscriptionFailure_IEs->value.present = RICsubscriptionFailure_IEs__value_PR_RICrequestID; |
| 392 | pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionFailure->ricRequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 393 | pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionFailure->ricRequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 394 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list, pRICsubscriptionFailure_IEs); |
| 395 | } |
| 396 | else |
| 397 | return e2err_RICSubscriptionFailureAllocRICrequestIDFail; |
| 398 | |
| 399 | // RANfunctionID |
| 400 | pRICsubscriptionFailure_IEs = calloc(1, sizeof(RICsubscriptionFailure_IEs_t)); |
| 401 | if (pRICsubscriptionFailure_IEs) { |
| 402 | pRICsubscriptionFailure_IEs->id = ProtocolIE_ID_id_RANfunctionID; |
| 403 | pRICsubscriptionFailure_IEs->criticality = Criticality_reject; |
| 404 | pRICsubscriptionFailure_IEs->value.present = RICsubscriptionFailure_IEs__value_PR_RANfunctionID; |
| 405 | pRICsubscriptionFailure_IEs->value.choice.RANfunctionID = pRICSubscriptionFailure->ranFunctionID; |
| 406 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list, pRICsubscriptionFailure_IEs); |
| 407 | } |
| 408 | else |
| 409 | return e2err_RICSubscriptionFailureAllocRANfunctionIDFail; |
| 410 | |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 411 | // Cause |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 412 | pRICsubscriptionFailure_IEs = calloc(1, sizeof(RICsubscriptionFailure_IEs_t)); |
| 413 | if (pRICsubscriptionFailure_IEs) { |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 414 | pRICsubscriptionFailure_IEs->id = ProtocolIE_ID_id_Cause; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 415 | pRICsubscriptionFailure_IEs->criticality = Criticality_reject; |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 416 | pRICsubscriptionFailure_IEs->value.present = RICsubscriptionFailure_IEs__value_PR_Cause; |
| 417 | if (pRICSubscriptionFailure->cause.content == Cause_PR_ricRequest) { |
| 418 | pRICsubscriptionFailure_IEs->value.choice.Cause.present = Cause_PR_ricRequest; |
| 419 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.ricRequest = |
| 420 | pRICSubscriptionFailure->cause.causeVal; |
| 421 | } |
| 422 | else if (pRICSubscriptionFailure->cause.content == Cause_PR_ricService) { |
| 423 | pRICsubscriptionFailure_IEs->value.choice.Cause.present = Cause_PR_ricService; |
| 424 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.ricService = |
| 425 | pRICSubscriptionFailure->cause.causeVal; |
| 426 | } |
| 427 | else if (pRICSubscriptionFailure->cause.content == Cause_PR_e2Node) { |
| 428 | pRICsubscriptionFailure_IEs->value.choice.Cause.present = Cause_PR_e2Node; |
| 429 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.e2Node = |
| 430 | pRICSubscriptionFailure->cause.causeVal; |
| 431 | } |
| 432 | else if (pRICSubscriptionFailure->cause.content == Cause_PR_transport) { |
| 433 | pRICsubscriptionFailure_IEs->value.choice.Cause.present = Cause_PR_transport; |
| 434 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.transport = |
| 435 | pRICSubscriptionFailure->cause.causeVal; |
| 436 | } |
| 437 | else if (pRICSubscriptionFailure->cause.content == Cause_PR_protocol) { |
| 438 | pRICsubscriptionFailure_IEs->value.choice.Cause.present = Cause_PR_protocol; |
| 439 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.protocol = |
| 440 | pRICSubscriptionFailure->cause.causeVal; |
| 441 | } |
| 442 | else if (pRICSubscriptionFailure->cause.content == Cause_PR_misc) { |
| 443 | pRICsubscriptionFailure_IEs->value.choice.Cause.present = Cause_PR_misc; |
| 444 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.misc = |
| 445 | pRICSubscriptionFailure->cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 446 | } |
| 447 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list, pRICsubscriptionFailure_IEs); |
| 448 | } |
| 449 | else |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 450 | return e2err_RICSubscriptionFailureAllocCauseFail; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 451 | |
| 452 | // CriticalityDiagnostics, OPTIONAL. Not used in RIC |
| 453 | |
| 454 | if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer)) |
| 455 | return e2err_OK; |
| 456 | else |
| 457 | return e2err_RICSubscriptionFailureEncodeFail; |
| 458 | } |
| 459 | else |
| 460 | return e2err_RICSubscriptionFailureAllocE2AP_PDUFail; |
| 461 | } |
| 462 | |
| 463 | ////////////////////////////////////////////////////////////////////// |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 464 | uint64_t packRICSubscriptionDeleteRequest(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionDeleteRequest_t* pRICSubscriptionDeleteRequest) { |
| 465 | |
| 466 | E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t)); |
| 467 | if(pE2AP_PDU) |
| 468 | { |
| 469 | pE2AP_PDU->present = E2AP_PDU_PR_initiatingMessage; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 470 | pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_RICsubscriptionDelete; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 471 | pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 472 | pE2AP_PDU->choice.initiatingMessage.value.present = InitiatingMessage__value_PR_RICsubscriptionDeleteRequest; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 473 | |
| 474 | // RICrequestID |
| 475 | RICsubscriptionDeleteRequest_IEs_t* pRICsubscriptionDeleteRequest_IEs = calloc(1, sizeof(RICsubscriptionDeleteRequest_IEs_t)); |
| 476 | if (pRICsubscriptionDeleteRequest_IEs) { |
| 477 | pRICsubscriptionDeleteRequest_IEs->id = ProtocolIE_ID_id_RICrequestID; |
| 478 | pRICsubscriptionDeleteRequest_IEs->criticality = Criticality_reject; |
| 479 | pRICsubscriptionDeleteRequest_IEs->value.present = RICsubscriptionDeleteRequest_IEs__value_PR_RICrequestID; |
| 480 | pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionDeleteRequest->ricRequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 481 | pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionDeleteRequest->ricRequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 482 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest.protocolIEs.list, pRICsubscriptionDeleteRequest_IEs); |
| 483 | } |
| 484 | else |
| 485 | return e2err_RICSubscriptionDeleteRequestAllocRICrequestIDFail; |
| 486 | |
| 487 | // RANfunctionID |
| 488 | pRICsubscriptionDeleteRequest_IEs = calloc(1, sizeof(RICsubscriptionDeleteRequest_IEs_t)); |
| 489 | if (pRICsubscriptionDeleteRequest_IEs) { |
| 490 | pRICsubscriptionDeleteRequest_IEs->id = ProtocolIE_ID_id_RANfunctionID; |
| 491 | pRICsubscriptionDeleteRequest_IEs->criticality = Criticality_reject; |
| 492 | pRICsubscriptionDeleteRequest_IEs->value.present = RICsubscriptionDeleteRequest_IEs__value_PR_RANfunctionID; |
| 493 | pRICsubscriptionDeleteRequest_IEs->value.choice.RANfunctionID = pRICSubscriptionDeleteRequest->ranFunctionID; |
| 494 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest.protocolIEs.list, pRICsubscriptionDeleteRequest_IEs); |
| 495 | } |
| 496 | else |
| 497 | return e2err_RICSubscriptionDeleteRequestAllocRANfunctionIDFail; |
| 498 | |
| 499 | if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer)) |
| 500 | return e2err_OK; |
| 501 | else |
| 502 | return e2err_RICSubscriptionDeleteRequestEncodeFail; |
| 503 | } |
| 504 | else |
| 505 | return e2err_RICSubscriptionDeleteRequestAllocE2AP_PDUFail; |
| 506 | } |
| 507 | |
| 508 | ////////////////////////////////////////////////////////////////////// |
| 509 | uint64_t packRICSubscriptionDeleteResponse(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionDeleteResponse_t* pRICSubscriptionDeleteResponse) { |
| 510 | |
| 511 | E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t)); |
| 512 | if(pE2AP_PDU) |
| 513 | { |
| 514 | pE2AP_PDU->present = E2AP_PDU_PR_successfulOutcome; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 515 | pE2AP_PDU->choice.successfulOutcome.procedureCode = ProcedureCode_id_RICsubscriptionDelete; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 516 | pE2AP_PDU->choice.successfulOutcome.criticality = Criticality_ignore; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 517 | pE2AP_PDU->choice.successfulOutcome.value.present = SuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 518 | |
| 519 | // RICrequestID |
| 520 | RICsubscriptionDeleteResponse_IEs_t* pRICsubscriptionDeleteResponse_IEs = calloc(1, sizeof(RICsubscriptionDeleteResponse_IEs_t)); |
| 521 | if (pRICsubscriptionDeleteResponse_IEs) { |
| 522 | pRICsubscriptionDeleteResponse_IEs->id = ProtocolIE_ID_id_RICrequestID; |
| 523 | pRICsubscriptionDeleteResponse_IEs->criticality = Criticality_reject; |
| 524 | pRICsubscriptionDeleteResponse_IEs->value.present = RICsubscriptionDeleteResponse_IEs__value_PR_RICrequestID; |
| 525 | pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionDeleteResponse->ricRequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 526 | pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionDeleteResponse->ricRequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 527 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse.protocolIEs.list, pRICsubscriptionDeleteResponse_IEs); |
| 528 | } |
| 529 | else |
| 530 | return e2err_RICSubscriptionDeleteResponseAllocRICrequestIDFail; |
| 531 | |
| 532 | // RANfunctionID |
| 533 | pRICsubscriptionDeleteResponse_IEs = calloc(1, sizeof(RICsubscriptionDeleteResponse_IEs_t)); |
| 534 | if (pRICsubscriptionDeleteResponse_IEs) { |
| 535 | pRICsubscriptionDeleteResponse_IEs->id = ProtocolIE_ID_id_RANfunctionID; |
| 536 | pRICsubscriptionDeleteResponse_IEs->criticality = Criticality_reject; |
| 537 | pRICsubscriptionDeleteResponse_IEs->value.present = RICsubscriptionDeleteResponse_IEs__value_PR_RANfunctionID; |
| 538 | pRICsubscriptionDeleteResponse_IEs->value.choice.RANfunctionID = pRICSubscriptionDeleteResponse->ranFunctionID; |
| 539 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse.protocolIEs.list, pRICsubscriptionDeleteResponse_IEs); |
| 540 | } |
| 541 | else |
| 542 | return e2err_RICSubscriptionDeleteResponseAllocRANfunctionIDFail; |
| 543 | |
| 544 | if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer)) |
| 545 | return e2err_OK; |
| 546 | else |
| 547 | return e2err_RICSubscriptionDeleteResponseEncodeFail; |
| 548 | } |
| 549 | else |
| 550 | return e2err_RICSubscriptionDeleteResponseAllocE2AP_PDUFail; |
| 551 | } |
| 552 | |
| 553 | uint64_t packRICSubscriptionDeleteFailure(size_t* pDataBufferSize, byte* pDataBuffer, char* pLogBuffer, RICSubscriptionDeleteFailure_t* pRICSubscriptionDeleteFailure) { |
| 554 | |
| 555 | E2AP_PDU_t* pE2AP_PDU = calloc(1, sizeof(E2AP_PDU_t)); |
| 556 | if(pE2AP_PDU) |
| 557 | { |
| 558 | pE2AP_PDU->present = E2AP_PDU_PR_unsuccessfulOutcome; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 559 | pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode = ProcedureCode_id_RICsubscriptionDelete; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 560 | pE2AP_PDU->choice.unsuccessfulOutcome.criticality = Criticality_ignore; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 561 | pE2AP_PDU->choice.unsuccessfulOutcome.value.present = UnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 562 | |
| 563 | // RICrequestID |
| 564 | RICsubscriptionDeleteFailure_IEs_t* pRICsubscriptionDeleteFailure_IEs = calloc(1, sizeof(RICsubscriptionDeleteFailure_IEs_t)); |
| 565 | if (pRICsubscriptionDeleteFailure_IEs) { |
| 566 | pRICsubscriptionDeleteFailure_IEs->id = ProtocolIE_ID_id_RICrequestID; |
| 567 | pRICsubscriptionDeleteFailure_IEs->criticality = Criticality_reject; |
| 568 | pRICsubscriptionDeleteFailure_IEs->value.present = RICsubscriptionDeleteFailure_IEs__value_PR_RICrequestID; |
| 569 | pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricRequestorID = pRICSubscriptionDeleteFailure->ricRequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 570 | pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionDeleteFailure->ricRequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 571 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list, pRICsubscriptionDeleteFailure_IEs); |
| 572 | } |
| 573 | else |
| 574 | return e2err_RICSubscriptionDeleteFailureAllocRICrequestIDFail; |
| 575 | |
| 576 | // RANfunctionID |
| 577 | pRICsubscriptionDeleteFailure_IEs = calloc(1, sizeof(RICsubscriptionDeleteFailure_IEs_t)); |
| 578 | if (pRICsubscriptionDeleteFailure_IEs) { |
| 579 | pRICsubscriptionDeleteFailure_IEs->id = ProtocolIE_ID_id_RANfunctionID; |
| 580 | pRICsubscriptionDeleteFailure_IEs->criticality = Criticality_reject; |
| 581 | pRICsubscriptionDeleteFailure_IEs->value.present = RICsubscriptionDeleteFailure_IEs__value_PR_RANfunctionID; |
| 582 | pRICsubscriptionDeleteFailure_IEs->value.choice.RANfunctionID = pRICSubscriptionDeleteFailure->ranFunctionID; |
| 583 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list, pRICsubscriptionDeleteFailure_IEs); |
| 584 | } |
| 585 | else |
| 586 | return e2err_RICSubscriptionDeleteFailureAllocRANfunctionIDFail; |
| 587 | |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 588 | // Cause |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 589 | pRICsubscriptionDeleteFailure_IEs = calloc(1, sizeof(RICsubscriptionDeleteFailure_IEs_t)); |
| 590 | if (pRICsubscriptionDeleteFailure_IEs) { |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 591 | pRICsubscriptionDeleteFailure_IEs->id = ProtocolIE_ID_id_Cause; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 592 | pRICsubscriptionDeleteFailure_IEs->criticality = Criticality_reject; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 593 | pRICsubscriptionDeleteFailure_IEs->value.present = RICsubscriptionDeleteFailure_IEs__value_PR_Cause; |
| 594 | if (pRICSubscriptionDeleteFailure->cause.content == Cause_PR_ricRequest) { |
| 595 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present = Cause_PR_ricRequest; |
| 596 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.ricRequest = |
| 597 | pRICSubscriptionDeleteFailure->cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 598 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 599 | else if (pRICSubscriptionDeleteFailure->cause.content == Cause_PR_ricService) { |
| 600 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present = Cause_PR_ricService; |
| 601 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.ricService = |
| 602 | pRICSubscriptionDeleteFailure->cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 603 | } |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 604 | else if (pRICSubscriptionDeleteFailure->cause.content == Cause_PR_e2Node) { |
| 605 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present = Cause_PR_e2Node; |
| 606 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.e2Node = |
| 607 | pRICSubscriptionDeleteFailure->cause.causeVal; |
| 608 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 609 | else if (pRICSubscriptionDeleteFailure->cause.content == Cause_PR_transport) { |
| 610 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present = Cause_PR_transport; |
| 611 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.transport = |
| 612 | pRICSubscriptionDeleteFailure->cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 613 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 614 | else if (pRICSubscriptionDeleteFailure->cause.content == Cause_PR_protocol) { |
| 615 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present = Cause_PR_protocol; |
| 616 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.protocol = |
| 617 | pRICSubscriptionDeleteFailure->cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 618 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 619 | else if (pRICSubscriptionDeleteFailure->cause.content == Cause_PR_misc) { |
| 620 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present = Cause_PR_misc; |
| 621 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.misc = |
| 622 | pRICSubscriptionDeleteFailure->cause.causeVal; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 623 | } |
| 624 | ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure.protocolIEs.list, pRICsubscriptionDeleteFailure_IEs); |
| 625 | } |
| 626 | else |
| 627 | return e2err_RICSubscriptionDeleteFailureAllocRICcauseFail; |
| 628 | |
| 629 | // CriticalityDiagnostics, OPTIONAL |
| 630 | |
| 631 | if (E2encode(pE2AP_PDU, pDataBufferSize, pDataBuffer, pLogBuffer)) |
| 632 | return e2err_OK; |
| 633 | else |
| 634 | return e2err_RICSubscriptionDeleteFailureEncodeFail; |
| 635 | } |
| 636 | else |
| 637 | return e2err_RICSubscriptionDeleteFailureAllocE2AP_PDUFail; |
| 638 | } |
| 639 | |
| 640 | ////////////////////////////////////////////////////////////////////// |
| 641 | e2ap_pdu_ptr_t* unpackE2AP_pdu(const size_t dataBufferSize, const byte* dataBuffer, char* pLogBuffer, E2MessageInfo_t* pMessageInfo) { |
| 642 | |
| 643 | E2AP_PDU_t* pE2AP_PDU = 0; |
| 644 | asn_dec_rval_t rval; |
| 645 | rval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, (void **)&pE2AP_PDU, dataBuffer, dataBufferSize); |
| 646 | switch (rval.code) { |
| 647 | case RC_OK: |
Anssi Mannila | e1af87f | 2021-11-10 13:10:54 +0200 | [diff] [blame] | 648 | if (debugPrints) { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 649 | sprintf(pLogBuffer,"Successfully decoded E2AP-PDU"); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 650 | asn_fprint(stdout, &asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 651 | } |
| 652 | |
| 653 | if (pE2AP_PDU->present == E2AP_PDU_PR_initiatingMessage) { |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 654 | if (pE2AP_PDU->choice.initiatingMessage.procedureCode == ProcedureCode_id_RICsubscription) { |
| 655 | if (pE2AP_PDU->choice.initiatingMessage.value.present == InitiatingMessage__value_PR_RICsubscriptionRequest) { |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 656 | pMessageInfo->messageType = cE2InitiatingMessage; |
| 657 | pMessageInfo->messageId = cRICSubscriptionRequest; |
| 658 | return (e2ap_pdu_ptr_t*)pE2AP_PDU; |
| 659 | } |
| 660 | else { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 661 | sprintf(pLogBuffer,"Error. Not supported initiatingMessage MessageId = %u",pE2AP_PDU->choice.initiatingMessage.value.present); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 662 | return 0; |
| 663 | } |
| 664 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 665 | else if (pE2AP_PDU->choice.initiatingMessage.procedureCode == ProcedureCode_id_RICsubscriptionDelete) { |
| 666 | if (pE2AP_PDU->choice.initiatingMessage.value.present == InitiatingMessage__value_PR_RICsubscriptionDeleteRequest) { |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 667 | pMessageInfo->messageType = cE2InitiatingMessage; |
| 668 | pMessageInfo->messageId = cRICSubscriptionDeleteRequest; |
| 669 | return (e2ap_pdu_ptr_t*)pE2AP_PDU; |
| 670 | } |
| 671 | else { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 672 | sprintf(pLogBuffer,"Error. Not supported initiatingMessage MessageId = %u",pE2AP_PDU->choice.initiatingMessage.value.present); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 673 | return 0; |
| 674 | } |
| 675 | } |
| 676 | else { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 677 | sprintf(pLogBuffer,"Error. Procedure not supported. ProcedureCode = %li",pE2AP_PDU->choice.initiatingMessage.procedureCode); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 678 | return 0; |
| 679 | } |
| 680 | } |
| 681 | else if (pE2AP_PDU->present == E2AP_PDU_PR_successfulOutcome) { |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 682 | if (pE2AP_PDU->choice.successfulOutcome.procedureCode == ProcedureCode_id_RICsubscription) { |
| 683 | if (pE2AP_PDU->choice.successfulOutcome.value.present == SuccessfulOutcome__value_PR_RICsubscriptionResponse) { |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 684 | pMessageInfo->messageType = cE2SuccessfulOutcome; |
| 685 | pMessageInfo->messageId = cRICSubscriptionResponse; |
| 686 | return (e2ap_pdu_ptr_t*)pE2AP_PDU; |
| 687 | } |
| 688 | else { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 689 | sprintf(pLogBuffer,"Error. Not supported successfulOutcome MessageId = %u",pE2AP_PDU->choice.successfulOutcome.value.present); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 690 | return 0; |
| 691 | } |
| 692 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 693 | else if (pE2AP_PDU->choice.successfulOutcome.procedureCode == ProcedureCode_id_RICsubscriptionDelete) { |
| 694 | if (pE2AP_PDU->choice.successfulOutcome.value.present == SuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse) { |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 695 | pMessageInfo->messageType = cE2SuccessfulOutcome; |
| 696 | pMessageInfo->messageId = cRICsubscriptionDeleteResponse; |
| 697 | return (e2ap_pdu_ptr_t*)pE2AP_PDU; |
| 698 | } |
| 699 | else { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 700 | sprintf(pLogBuffer,"Error. Not supported successfulOutcome MessageId = %u",pE2AP_PDU->choice.successfulOutcome.value.present); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 701 | return 0; |
| 702 | } |
| 703 | } |
| 704 | else { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 705 | sprintf(pLogBuffer,"Error. Procedure not supported. ProcedureCode = %li",pE2AP_PDU->choice.successfulOutcome.procedureCode); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 706 | return 0; |
| 707 | } |
| 708 | } |
| 709 | else if (pE2AP_PDU->present == E2AP_PDU_PR_unsuccessfulOutcome) { |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 710 | if (pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode == ProcedureCode_id_RICsubscription) { |
| 711 | if (pE2AP_PDU->choice.unsuccessfulOutcome.value.present == UnsuccessfulOutcome__value_PR_RICsubscriptionFailure) { |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 712 | pMessageInfo->messageType = cE2UnsuccessfulOutcome; |
| 713 | pMessageInfo->messageId = cRICSubscriptionFailure; |
| 714 | return (e2ap_pdu_ptr_t*)pE2AP_PDU; |
| 715 | } |
| 716 | else { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 717 | sprintf(pLogBuffer,"Error. Not supported unsuccessfulOutcome MessageId = %u",pE2AP_PDU->choice.unsuccessfulOutcome.value.present); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 718 | return 0; |
| 719 | } |
| 720 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 721 | else if (pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode == ProcedureCode_id_RICsubscriptionDelete) { |
| 722 | if (pE2AP_PDU->choice.unsuccessfulOutcome.value.present == UnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure) { |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 723 | pMessageInfo->messageType = cE2UnsuccessfulOutcome; |
| 724 | pMessageInfo->messageId = cRICsubscriptionDeleteFailure; |
| 725 | return (e2ap_pdu_ptr_t*)pE2AP_PDU; |
| 726 | } |
| 727 | else { |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 728 | sprintf(pLogBuffer,"Error. Not supported unsuccessfulOutcome MessageId = %u",pE2AP_PDU->choice.unsuccessfulOutcome.value.present); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 729 | return 0; |
| 730 | } |
| 731 | } |
| 732 | } |
| 733 | else |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 734 | sprintf(pLogBuffer,"Decode failed. Invalid message type %u",pE2AP_PDU->present); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 735 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 736 | return 0; |
| 737 | case RC_WMORE: |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 738 | sprintf(pLogBuffer,"Decode failed. More data needed. Buffer size %zu, %s, consumed %zu",dataBufferSize, asn_DEF_E2AP_PDU.name, rval.consumed); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 739 | return 0; |
| 740 | case RC_FAIL: |
Anssi Mannila | 4721d4e | 2020-01-16 09:14:47 +0200 | [diff] [blame] | 741 | sprintf(pLogBuffer,"Decode failed. Buffer size %zu, %s, consumed %zu",dataBufferSize, asn_DEF_E2AP_PDU.name, rval.consumed); |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 742 | return 0; |
| 743 | default: |
| 744 | return 0; |
| 745 | } |
| 746 | } |
| 747 | |
| 748 | ////////////////////////////////////////////////////////////////////// |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 749 | uint64_t getRICSubscriptionRequestData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionRequest_t* pRICSubscriptionRequest) { |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 750 | |
| 751 | E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer; |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 752 | |
| 753 | RICsubscriptionRequest_t *asnRicSubscriptionRequest = &pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 754 | RICsubscriptionRequest_IEs_t* pRICsubscriptionRequest_IEs; |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 755 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 756 | // RICrequestID |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 757 | if (asnRicSubscriptionRequest->protocolIEs.list.count > 0 && |
| 758 | asnRicSubscriptionRequest->protocolIEs.list.array[0]->id == ProtocolIE_ID_id_RICrequestID) { |
| 759 | pRICsubscriptionRequest_IEs = asnRicSubscriptionRequest->protocolIEs.list.array[0]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 760 | pRICSubscriptionRequest->ricRequestID.ricRequestorID = pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 761 | pRICSubscriptionRequest->ricRequestID.ricInstanceID = pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 762 | } |
| 763 | else { |
| 764 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 765 | return e2err_RICsubscriptionRequestRICrequestIDMissing; |
| 766 | } |
| 767 | |
| 768 | // RANfunctionID |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 769 | if (asnRicSubscriptionRequest->protocolIEs.list.count > 1 && |
| 770 | asnRicSubscriptionRequest->protocolIEs.list.array[1]->id == ProtocolIE_ID_id_RANfunctionID) { |
| 771 | pRICsubscriptionRequest_IEs = asnRicSubscriptionRequest->protocolIEs.list.array[1]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 772 | pRICSubscriptionRequest->ranFunctionID = pRICsubscriptionRequest_IEs->value.choice.RANfunctionID; |
| 773 | } |
| 774 | else { |
| 775 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 776 | return e2err_RICsubscriptionRequestRANfunctionIDMissing; |
| 777 | } |
| 778 | |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 779 | // RICsubscriptionDetails |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 780 | if (asnRicSubscriptionRequest->protocolIEs.list.count > 2 && |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 781 | asnRicSubscriptionRequest->protocolIEs.list.array[2]->id == ProtocolIE_ID_id_RICsubscriptionDetails) { |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 782 | pRICsubscriptionRequest_IEs = asnRicSubscriptionRequest->protocolIEs.list.array[2]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 783 | |
| 784 | // Unpack EventTriggerDefinition |
| 785 | RICeventTriggerDefinition_t* pRICeventTriggerDefinition = |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 786 | (RICeventTriggerDefinition_t*)&pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition; |
| 787 | pRICSubscriptionRequest->ricSubscriptionDetails.ricEventTriggerDefinition.octetString.contentLength = pRICeventTriggerDefinition->size; |
| 788 | memcpy(pRICSubscriptionRequest->ricSubscriptionDetails.ricEventTriggerDefinition.octetString.data, pRICeventTriggerDefinition->buf, pRICeventTriggerDefinition->size); |
| 789 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 790 | // RICactions-ToBeSetup-List |
| 791 | RICaction_ToBeSetup_ItemIEs_t* pRICaction_ToBeSetup_ItemIEs; |
| 792 | uint64_t index = 0; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 793 | while (index < pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.list.count) |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 794 | { |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 795 | pRICaction_ToBeSetup_ItemIEs = (RICaction_ToBeSetup_ItemIEs_t*)pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.list.array[index]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 796 | |
| 797 | // RICActionID |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 798 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID = |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 799 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionID; |
| 800 | |
| 801 | // RICActionType |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 802 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType = |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 803 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionType; |
| 804 | |
| 805 | // RICactionDefinition, OPTIONAL |
| 806 | if (pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition) |
| 807 | { |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 808 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionChoice.octetString.contentLength = |
| 809 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition->size; |
| 810 | memcpy(pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionChoice.octetString.data, |
| 811 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition->buf, |
| 812 | pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition->size); |
| 813 | |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 814 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent = true; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 815 | } |
| 816 | else |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 817 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent = false; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 818 | |
| 819 | // RICsubsequentAction, OPTIONAL |
| 820 | RICsubsequentAction_t* pRICsubsequentAction; |
| 821 | if (pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction) |
| 822 | { |
| 823 | pRICsubsequentAction = pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 824 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent = true; |
| 825 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType = |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 826 | pRICsubsequentAction->ricSubsequentActionType; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 827 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait = |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 828 | pRICsubsequentAction->ricTimeToWait; |
| 829 | } |
| 830 | else |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 831 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent = false; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 832 | index++; |
| 833 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 834 | pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength = index; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 835 | } |
| 836 | else { |
| 837 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 838 | return e2err_RICsubscriptionRequestICsubscriptionMissing; |
| 839 | } |
| 840 | |
| 841 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 842 | return e2err_OK; |
| 843 | } |
| 844 | |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 845 | |
| 846 | ////////////////////////////////////////////////////////////////////// |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 847 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 848 | uint64_t getRICSubscriptionResponseData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionResponse_t* pRICSubscriptionResponse) { |
| 849 | |
| 850 | E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer; |
| 851 | |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 852 | RICsubscriptionResponse_t *asnRicSubscriptionResponse = &pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 853 | RICsubscriptionResponse_IEs_t* pRICsubscriptionResponse_IEs; |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 854 | |
| 855 | // RICrequestID |
| 856 | if (asnRicSubscriptionResponse->protocolIEs.list.count > 0 && |
| 857 | asnRicSubscriptionResponse->protocolIEs.list.array[0]->id == ProtocolIE_ID_id_RICrequestID) { |
| 858 | pRICsubscriptionResponse_IEs = asnRicSubscriptionResponse->protocolIEs.list.array[0]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 859 | pRICSubscriptionResponse->ricRequestID.ricRequestorID = pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 860 | pRICSubscriptionResponse->ricRequestID.ricInstanceID = pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 861 | } |
| 862 | else { |
| 863 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 864 | return e2err_RICsubscriptionResponseRICrequestIDMissing; |
| 865 | } |
| 866 | |
| 867 | // RANfunctionID |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 868 | if (asnRicSubscriptionResponse->protocolIEs.list.count > 1 && |
| 869 | asnRicSubscriptionResponse->protocolIEs.list.array[1]->id == ProtocolIE_ID_id_RANfunctionID) { |
| 870 | pRICsubscriptionResponse_IEs = asnRicSubscriptionResponse->protocolIEs.list.array[1]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 871 | pRICSubscriptionResponse->ranFunctionID = pRICsubscriptionResponse_IEs->value.choice.RANfunctionID; |
| 872 | } |
| 873 | else { |
| 874 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 875 | return e2err_RICsubscriptionResponseRANfunctionIDMissing; |
| 876 | } |
| 877 | |
| 878 | // RICaction-Admitted-List |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 879 | if (asnRicSubscriptionResponse->protocolIEs.list.count > 2 && |
| 880 | asnRicSubscriptionResponse->protocolIEs.list.array[2]->id == ProtocolIE_ID_id_RICactions_Admitted) { |
| 881 | pRICsubscriptionResponse_IEs = asnRicSubscriptionResponse->protocolIEs.list.array[2]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 882 | pRICSubscriptionResponse->ricActionAdmittedList.contentLength = 0; |
| 883 | uint64_t index = 0; |
| 884 | while ((index < maxofRICactionID) && (index < pRICsubscriptionResponse_IEs->value.choice.RICaction_Admitted_List.list.count)) { |
| 885 | RICaction_Admitted_ItemIEs_t* pRICaction_Admitted_ItemIEs = |
| 886 | (RICaction_Admitted_ItemIEs_t*)pRICsubscriptionResponse_IEs->value.choice.RICaction_Admitted_List.list.array[index]; |
| 887 | |
| 888 | // RICActionID |
| 889 | pRICSubscriptionResponse->ricActionAdmittedList.ricActionID[index] = |
| 890 | pRICaction_Admitted_ItemIEs->value.choice.RICaction_Admitted_Item.ricActionID; |
| 891 | index++; |
| 892 | } |
| 893 | pRICSubscriptionResponse->ricActionAdmittedList.contentLength = index; |
| 894 | } |
| 895 | else { |
| 896 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 897 | return e2err_RICsubscriptionResponseRICaction_Admitted_ListMissing; |
| 898 | } |
| 899 | |
| 900 | // RICaction-NotAdmitted-List, OPTIONAL |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 901 | if (asnRicSubscriptionResponse->protocolIEs.list.count > 3 && |
| 902 | asnRicSubscriptionResponse->protocolIEs.list.array[3]->id == ProtocolIE_ID_id_RICactions_NotAdmitted) { |
| 903 | pRICsubscriptionResponse_IEs = asnRicSubscriptionResponse->protocolIEs.list.array[3]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 904 | if (pRICsubscriptionResponse_IEs->value.present == RICsubscriptionResponse_IEs__value_PR_RICaction_NotAdmitted_List) { |
| 905 | pRICSubscriptionResponse->ricActionNotAdmittedListPresent = true; |
| 906 | pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength = 0; |
| 907 | uint64_t index = 0; |
| 908 | while ((index < maxofRICactionID) && (index < pRICsubscriptionResponse_IEs->value.choice.RICaction_NotAdmitted_List.list.count)) { |
| 909 | RICaction_NotAdmitted_ItemIEs_t* pRICaction_NotAdmitted_ItemIEs = |
| 910 | (RICaction_NotAdmitted_ItemIEs_t*)pRICsubscriptionResponse_IEs->value.choice.RICaction_NotAdmitted_List.list.array[index]; |
| 911 | |
| 912 | // RICActionID |
| 913 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID = |
| 914 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.ricActionID; |
| 915 | |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 916 | // Cause |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 917 | if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present == Cause_PR_ricRequest) { |
| 918 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content = Cause_PR_ricRequest; |
| 919 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal = |
| 920 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.ricRequest; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 921 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 922 | else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present == Cause_PR_ricService) { |
| 923 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content = Cause_PR_ricService; |
| 924 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal = |
| 925 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.ricService; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 926 | } |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 927 | else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present == Cause_PR_e2Node) { |
| 928 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content = Cause_PR_e2Node; |
| 929 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal = |
| 930 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.e2Node; |
| 931 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 932 | else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present == Cause_PR_transport) { |
| 933 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content = Cause_PR_transport; |
| 934 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal = |
| 935 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.transport; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 936 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 937 | else if (pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present == Cause_PR_protocol) { |
| 938 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content = Cause_PR_protocol; |
| 939 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal = |
| 940 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.protocol; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 941 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 942 | else if(pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.present == Cause_PR_misc) { |
| 943 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content = Cause_PR_misc; |
| 944 | pRICSubscriptionResponse->ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal = |
| 945 | pRICaction_NotAdmitted_ItemIEs->value.choice.RICaction_NotAdmitted_Item.cause.choice.misc; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 946 | } |
| 947 | index++; |
| 948 | } |
| 949 | pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength = index; |
| 950 | } |
| 951 | } |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 952 | else { |
| 953 | pRICSubscriptionResponse->ricActionNotAdmittedListPresent = false; |
| 954 | pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength = 0; |
| 955 | } |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 956 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 957 | return e2err_OK; |
| 958 | } |
| 959 | |
| 960 | ////////////////////////////////////////////////////////////////////// |
| 961 | uint64_t getRICSubscriptionFailureData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionFailure_t* pRICSubscriptionFailure) { |
| 962 | |
| 963 | E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer; |
| 964 | |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 965 | RICsubscriptionFailure_t *asnRicSubscriptionFailure = &pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 966 | RICsubscriptionFailure_IEs_t* pRICsubscriptionFailure_IEs; |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 967 | |
| 968 | // RICrequestID |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 969 | if (asnRicSubscriptionFailure->protocolIEs.list.count > 0 && |
| 970 | asnRicSubscriptionFailure->protocolIEs.list.array[0]->id == ProtocolIE_ID_id_RICrequestID) { |
| 971 | pRICsubscriptionFailure_IEs = asnRicSubscriptionFailure->protocolIEs.list.array[0]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 972 | pRICSubscriptionFailure->ricRequestID.ricRequestorID = pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 973 | pRICSubscriptionFailure->ricRequestID.ricInstanceID = pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 974 | } |
| 975 | else { |
| 976 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 977 | return e2err_RICsubscriptionFailureRICrequestIDMissing; |
| 978 | } |
| 979 | |
| 980 | // RANfunctionID |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 981 | if (asnRicSubscriptionFailure->protocolIEs.list.count > 1 && |
| 982 | asnRicSubscriptionFailure->protocolIEs.list.array[1]->id == ProtocolIE_ID_id_RANfunctionID) { |
| 983 | pRICsubscriptionFailure_IEs = asnRicSubscriptionFailure->protocolIEs.list.array[1]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 984 | pRICSubscriptionFailure->ranFunctionID = pRICsubscriptionFailure_IEs->value.choice.RANfunctionID; |
| 985 | } |
| 986 | else { |
| 987 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 988 | return e2err_RICsubscriptionFailureRANfunctionIDMissing; |
| 989 | } |
| 990 | |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 991 | // Cause |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 992 | if (asnRicSubscriptionFailure->protocolIEs.list.count > 2 && |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 993 | asnRicSubscriptionFailure->protocolIEs.list.array[2]->id == ProtocolIE_ID_id_Cause) { |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 994 | pRICsubscriptionFailure_IEs = asnRicSubscriptionFailure->protocolIEs.list.array[2]; |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 995 | if (pRICsubscriptionFailure_IEs->value.choice.Cause.present == Cause_PR_ricRequest) { |
| 996 | pRICSubscriptionFailure->cause.content = Cause_PR_ricRequest; |
| 997 | pRICSubscriptionFailure->cause.causeVal = |
| 998 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.ricRequest; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 999 | } |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 1000 | else if (pRICsubscriptionFailure_IEs->value.choice.Cause.present == Cause_PR_ricService) { |
| 1001 | pRICSubscriptionFailure->cause.content = Cause_PR_ricService; |
| 1002 | pRICSubscriptionFailure->cause.causeVal = |
| 1003 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.ricService; |
| 1004 | } |
| 1005 | else if (pRICsubscriptionFailure_IEs->value.choice.Cause.present == Cause_PR_e2Node) { |
| 1006 | pRICSubscriptionFailure->cause.content = Cause_PR_e2Node; |
| 1007 | pRICSubscriptionFailure->cause.causeVal = |
| 1008 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.e2Node; |
| 1009 | } |
| 1010 | else if (pRICsubscriptionFailure_IEs->value.choice.Cause.present == Cause_PR_transport) { |
| 1011 | pRICSubscriptionFailure->cause.content = Cause_PR_transport; |
| 1012 | pRICSubscriptionFailure->cause.causeVal = |
| 1013 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.transport; |
| 1014 | } |
| 1015 | else if (pRICsubscriptionFailure_IEs->value.choice.Cause.present == Cause_PR_protocol) { |
| 1016 | pRICSubscriptionFailure->cause.content = Cause_PR_protocol; |
| 1017 | pRICSubscriptionFailure->cause.causeVal = |
| 1018 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.protocol; |
| 1019 | } |
| 1020 | else if(pRICsubscriptionFailure_IEs->value.choice.Cause.present == Cause_PR_misc) { |
| 1021 | pRICSubscriptionFailure->cause.content = Cause_PR_misc; |
| 1022 | pRICSubscriptionFailure->cause.causeVal = |
| 1023 | pRICsubscriptionFailure_IEs->value.choice.Cause.choice.misc; |
| 1024 | } |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1025 | } |
| 1026 | else { |
| 1027 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 1028 | return e2err_RICsubscriptionFailureCauseMissing; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1029 | } |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 1030 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1031 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1032 | return e2err_OK; |
| 1033 | } |
| 1034 | |
| 1035 | ////////////////////////////////////////////////////////////////////// |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1036 | uint64_t getRICSubscriptionDeleteRequestData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionDeleteRequest_t* pRICSubscriptionDeleteRequest) { |
| 1037 | |
| 1038 | E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer; |
| 1039 | |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1040 | RICsubscriptionDeleteRequest_t *asnRicSubscriptionDeleteRequest = &pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1041 | RICsubscriptionDeleteRequest_IEs_t* pRICsubscriptionDeleteRequest_IEs; |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1042 | |
| 1043 | // RICrequestID |
| 1044 | if (asnRicSubscriptionDeleteRequest->protocolIEs.list.count > 0 && |
| 1045 | asnRicSubscriptionDeleteRequest->protocolIEs.list.array[0]->id == ProtocolIE_ID_id_RICrequestID) { |
| 1046 | pRICsubscriptionDeleteRequest_IEs = asnRicSubscriptionDeleteRequest->protocolIEs.list.array[0]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1047 | pRICSubscriptionDeleteRequest->ricRequestID.ricRequestorID = pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1048 | pRICSubscriptionDeleteRequest->ricRequestID.ricInstanceID = pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1049 | } |
| 1050 | else { |
| 1051 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1052 | return e2err_RICsubscriptionDeleteRequestRICrequestIDMissing; |
| 1053 | } |
| 1054 | |
| 1055 | // RANfunctionID |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1056 | if (asnRicSubscriptionDeleteRequest->protocolIEs.list.count > 1 && |
| 1057 | asnRicSubscriptionDeleteRequest->protocolIEs.list.array[1]->id == ProtocolIE_ID_id_RANfunctionID) { |
| 1058 | pRICsubscriptionDeleteRequest_IEs = asnRicSubscriptionDeleteRequest->protocolIEs.list.array[1]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1059 | pRICSubscriptionDeleteRequest->ranFunctionID = pRICsubscriptionDeleteRequest_IEs->value.choice.RANfunctionID; |
| 1060 | } |
| 1061 | else { |
| 1062 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1063 | return e2err_RICsubscriptionDeleteRequestRANfunctionIDMissing; |
| 1064 | } |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1065 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1066 | return e2err_OK; |
| 1067 | } |
| 1068 | |
| 1069 | ////////////////////////////////////////////////////////////////////// |
| 1070 | uint64_t getRICSubscriptionDeleteResponseData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionDeleteResponse_t* pRICSubscriptionDeleteResponse) { |
| 1071 | |
| 1072 | E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer; |
| 1073 | |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1074 | RICsubscriptionDeleteResponse_t *asnRicSubscriptionDeleteResponse = &pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1075 | RICsubscriptionDeleteResponse_IEs_t* pRICsubscriptionDeleteResponse_IEs; |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1076 | |
| 1077 | // RICrequestID |
| 1078 | if (asnRicSubscriptionDeleteResponse->protocolIEs.list.count > 0 && |
| 1079 | asnRicSubscriptionDeleteResponse->protocolIEs.list.array[0]->id == ProtocolIE_ID_id_RICrequestID) { |
| 1080 | pRICsubscriptionDeleteResponse_IEs = asnRicSubscriptionDeleteResponse->protocolIEs.list.array[0]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1081 | pRICSubscriptionDeleteResponse->ricRequestID.ricRequestorID = pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1082 | pRICSubscriptionDeleteResponse->ricRequestID.ricInstanceID = pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1083 | } |
| 1084 | else { |
| 1085 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1086 | return e2err_RICsubscriptionDeleteResponseRICrequestIDMissing; |
| 1087 | } |
| 1088 | |
| 1089 | // RANfunctionID |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1090 | if (asnRicSubscriptionDeleteResponse->protocolIEs.list.count > 1 && |
| 1091 | asnRicSubscriptionDeleteResponse->protocolIEs.list.array[1]->id == ProtocolIE_ID_id_RANfunctionID) { |
| 1092 | pRICsubscriptionDeleteResponse_IEs = asnRicSubscriptionDeleteResponse->protocolIEs.list.array[1]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1093 | pRICSubscriptionDeleteResponse->ranFunctionID = pRICsubscriptionDeleteResponse_IEs->value.choice.RANfunctionID; |
| 1094 | } |
| 1095 | else { |
| 1096 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1097 | return e2err_RICsubscriptionDeleteResponseRANfunctionIDMissing; |
| 1098 | } |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1099 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1100 | return e2err_OK; |
| 1101 | } |
| 1102 | |
| 1103 | ////////////////////////////////////////////////////////////////////// |
| 1104 | uint64_t getRICSubscriptionDeleteFailureData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionDeleteFailure_t* pRICSubscriptionDeleteFailure) { |
| 1105 | |
| 1106 | E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer; |
| 1107 | |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1108 | RICsubscriptionDeleteFailure_t *asnRicSubscriptionDeleteFailure = &pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1109 | RICsubscriptionDeleteFailure_IEs_t* pRICsubscriptionDeleteFailure_IEs; |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1110 | |
| 1111 | // RICrequestID |
| 1112 | if (asnRicSubscriptionDeleteFailure->protocolIEs.list.count > 0 && |
| 1113 | asnRicSubscriptionDeleteFailure->protocolIEs.list.array[0]->id == ProtocolIE_ID_id_RICrequestID) { |
| 1114 | pRICsubscriptionDeleteFailure_IEs = asnRicSubscriptionDeleteFailure->protocolIEs.list.array[0]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1115 | pRICSubscriptionDeleteFailure->ricRequestID.ricRequestorID = pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricRequestorID; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1116 | pRICSubscriptionDeleteFailure->ricRequestID.ricInstanceID = pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricInstanceID; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1117 | } |
| 1118 | else { |
| 1119 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1120 | return e2err_RICsubscriptionDeleteFailureRICrequestIDMissing; |
| 1121 | } |
| 1122 | |
| 1123 | // RANfunctionID |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1124 | if (asnRicSubscriptionDeleteFailure->protocolIEs.list.count > 1 && |
| 1125 | asnRicSubscriptionDeleteFailure->protocolIEs.list.array[1]->id == ProtocolIE_ID_id_RANfunctionID) { |
| 1126 | pRICsubscriptionDeleteFailure_IEs = asnRicSubscriptionDeleteFailure->protocolIEs.list.array[1]; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1127 | pRICSubscriptionDeleteFailure->ranFunctionID = pRICsubscriptionDeleteFailure_IEs->value.choice.RANfunctionID; |
| 1128 | } |
| 1129 | else { |
| 1130 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1131 | return e2err_RICsubscriptionDeleteFailureRANfunctionIDMissing; |
| 1132 | } |
| 1133 | |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 1134 | // Cause |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1135 | if (asnRicSubscriptionDeleteFailure->protocolIEs.list.count > 2 && |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1136 | asnRicSubscriptionDeleteFailure->protocolIEs.list.array[2]->id == ProtocolIE_ID_id_Cause) { |
Juha Hyttinen | 5504022 | 2020-01-16 09:41:04 +0200 | [diff] [blame] | 1137 | pRICsubscriptionDeleteFailure_IEs = asnRicSubscriptionDeleteFailure->protocolIEs.list.array[2]; |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1138 | if (pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present == Cause_PR_ricRequest) { |
| 1139 | pRICSubscriptionDeleteFailure->cause.content = Cause_PR_ricRequest; |
| 1140 | pRICSubscriptionDeleteFailure->cause.causeVal = |
| 1141 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.ricRequest; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1142 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1143 | else if (pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present == Cause_PR_ricService) { |
| 1144 | pRICSubscriptionDeleteFailure->cause.content = Cause_PR_ricService; |
| 1145 | pRICSubscriptionDeleteFailure->cause.causeVal = |
| 1146 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.ricService; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1147 | } |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame^] | 1148 | else if (pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present == Cause_PR_e2Node) { |
| 1149 | pRICSubscriptionDeleteFailure->cause.content = Cause_PR_e2Node; |
| 1150 | pRICSubscriptionDeleteFailure->cause.causeVal = |
| 1151 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.e2Node; |
| 1152 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1153 | else if (pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present == Cause_PR_transport) { |
| 1154 | pRICSubscriptionDeleteFailure->cause.content = Cause_PR_transport; |
| 1155 | pRICSubscriptionDeleteFailure->cause.causeVal = |
| 1156 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.transport; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1157 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1158 | else if (pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present == Cause_PR_protocol) { |
| 1159 | pRICSubscriptionDeleteFailure->cause.content = Cause_PR_protocol; |
| 1160 | pRICSubscriptionDeleteFailure->cause.causeVal = |
| 1161 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.protocol; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1162 | } |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1163 | else if(pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.present == Cause_PR_misc) { |
| 1164 | pRICSubscriptionDeleteFailure->cause.content = Cause_PR_misc; |
| 1165 | pRICSubscriptionDeleteFailure->cause.causeVal = |
| 1166 | pRICsubscriptionDeleteFailure_IEs->value.choice.Cause.choice.misc; |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 1167 | } |
| 1168 | } |
| 1169 | else { |
| 1170 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1171 | return e2err_RICsubscriptionDeleteFailureRICcauseMissing; |
| 1172 | } |
| 1173 | // CriticalityDiagnostics, OPTIONAL |
| 1174 | |
| 1175 | ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); |
| 1176 | return e2err_OK; |
| 1177 | } |