blob: 4a2a018d451a5b25a319e857cdeae0039a6143d7 [file] [log] [blame]
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001/*
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 Hyttinenaada6452020-04-07 08:47:58 +030026
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020027#include "asn_constant.h"
28#include "E2AP_if.h"
29
Anssi Mannilae1af87f2021-11-10 13:10:54 +020030static bool debugPrints = false;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020031
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020032const int64_t cMaxNrOfErrors = 256;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020033const uint64_t cMaxSizeOfOctetString = 1024;
34
35const size_t cMacroENBIDP_20Bits = 20;
36const size_t cHomeENBID_28Bits = 28;
37const size_t cShortMacroENBID_18Bits = 18;
38const size_t clongMacroENBIDP_21Bits = 21;
39
Juha Hyttinenaada6452020-04-07 08:47:58 +030040const int cCauseRICRequest = 1;
41const int cCauseRICService = 2;
42const int cCauseTransport = 3;
43const int cCauseProtocol = 4;
44const int cCauseMisc = 5;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020045
46//////////////////////////////////////////////////////////////////////
47// Message definitons
48
49// Below constant values are same as in E2AP, E2SM and X2AP specs
50const uint64_t cE2InitiatingMessage = 1;
51const uint64_t cE2SuccessfulOutcome = 2;
52const uint64_t cE2UnsuccessfulOutcome = 3;
53
54// E2AP messages
55// Initiating message
56const uint64_t cRICSubscriptionRequest = 1;
57const uint64_t cRICSubscriptionDeleteRequest = 2;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020058
59// Successful outcome
60const uint64_t cRICSubscriptionResponse = 1;
61const uint64_t cRICsubscriptionDeleteResponse = 2;
62
63// Unsuccessful outcome
64const uint64_t cRICSubscriptionFailure = 1;
65const uint64_t cRICsubscriptionDeleteFailure = 2;
66
67typedef union {
68 uint32_t nodeID;
69 uint8_t octets[4];
70} IdOctects_t;
71
72//////////////////////////////////////////////////////////////////////
Anssi Mannilae1af87f2021-11-10 13:10:54 +020073void allowASN1DebugPrints(bool allowASN1DebugPrints) {
74 debugPrints = allowASN1DebugPrints;
75}
76
77//////////////////////////////////////////////////////////////////////
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020078const char* getE2ErrorString(uint64_t errorCode) {
79
80 return E2ErrorStrings[errorCode];
81}
82
83/////////////////////////////////////////////////////////////////////
84bool E2encode(E2AP_PDU_t* pE2AP_PDU, size_t* dataBufferSize, byte* dataBuffer, char* pLogBuffer) {
85
Anssi Mannilae1af87f2021-11-10 13:10:54 +020086 if (debugPrints)
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020087 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 Mannilaf729b4d2020-04-13 21:02:11 +030092 sprintf(pLogBuffer,"Serialization of %s failed", asn_DEF_E2AP_PDU.name);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020093 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
94 return false;
95 }
96 else if (rval.encoded > *dataBufferSize) {
Anssi Mannila4721d4e2020-01-16 09:14:47 +020097 sprintf(pLogBuffer,"Buffer of size %zu is too small for %s, need %zu",*dataBufferSize, asn_DEF_E2AP_PDU.name, rval.encoded);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +020098 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
99 return false;
100 }
101 else {
Anssi Mannilae1af87f2021-11-10 13:10:54 +0200102 if (debugPrints)
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200103 sprintf(pLogBuffer,"Successfully encoded %s. Buffer size %zu, encoded size %zu",asn_DEF_E2AP_PDU.name, *dataBufferSize, rval.encoded);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200104
105 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
106 *dataBufferSize = rval.encoded;
107 return true;
108 }
109}
110
111//////////////////////////////////////////////////////////////////////
112uint64_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 Hyttinenaada6452020-04-07 08:47:58 +0300118 pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_RICsubscription;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200119 pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300120 pE2AP_PDU->choice.initiatingMessage.value.present = InitiatingMessage__value_PR_RICsubscriptionRequest;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200121
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 Hyttinenaada6452020-04-07 08:47:58 +0300129 pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionRequest->ricRequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200130 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 Hyttinenaada6452020-04-07 08:47:58 +0300147 // RICsubscriptionDetails
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200148 pRICsubscriptionRequest_IEs = calloc(1, sizeof(RICsubscriptionRequest_IEs_t));
149 if (pRICsubscriptionRequest_IEs) {
Juha Hyttinenaada6452020-04-07 08:47:58 +0300150 pRICsubscriptionRequest_IEs->id = ProtocolIE_ID_id_RICsubscriptionDetails;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200151 pRICsubscriptionRequest_IEs->criticality = Criticality_reject;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300152 pRICsubscriptionRequest_IEs->value.present = RICsubscriptionRequest_IEs__value_PR_RICsubscriptionDetails;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200153
154 // RICeventTriggerDefinition
Juha Hyttinenaada6452020-04-07 08:47:58 +0300155 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200163 }
164 else
165 return e2err_RICSubscriptionRequestAllocRICeventTriggerDefinitionBufFail;
166
167 // RICactions-ToBeSetup-List
168 uint64_t index = 0;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300169 while (index < pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength && index < maxofRICactionID) {
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200170 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 Mannila7eb69042020-04-27 12:34:36 +0300173 pRICaction_ToBeSetup_ItemIEs->criticality = Criticality_ignore;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200174 pRICaction_ToBeSetup_ItemIEs->value.present = RICaction_ToBeSetup_ItemIEs__value_PR_RICaction_ToBeSetup_Item;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300175
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200176 // RICActionID
177 pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionID =
Juha Hyttinenaada6452020-04-07 08:47:58 +0300178 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID;
179
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200180 // RICActionType
181 pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionType =
Juha Hyttinenaada6452020-04-07 08:47:58 +0300182 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType;
183
184 // RICactionDefinition, OPTIONAL
Juha Hyttinenaada6452020-04-07 08:47:58 +0300185 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200217 }
218 else
219 return e2err_RICSubscriptionRequestAllocRICaction_ToBeSetup_ItemIEsFail;
220
Juha Hyttinenaada6452020-04-07 08:47:58 +0300221 ASN_SEQUENCE_ADD(&pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.list, pRICaction_ToBeSetup_ItemIEs);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200222 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200228 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200236
237//////////////////////////////////////////////////////////////////////
238uint64_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 Hyttinenaada6452020-04-07 08:47:58 +0300244 pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_RICsubscription;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200245 pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300246 pE2AP_PDU->choice.initiatingMessage.value.present = SuccessfulOutcome__value_PR_RICsubscriptionResponse;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200247
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 Hyttinenaada6452020-04-07 08:47:58 +0300255 pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionResponse->ricRequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200256 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 Mannilaa93ec3c2020-01-21 10:10:32 +0200304 // RICaction-NotAdmitted list, OPTIONAL
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200305 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 Mannila483bd162022-01-20 11:11:48 +0200326 // Cause
Juha Hyttinenaada6452020-04-07 08:47:58 +0300327 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200331 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300332 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200336 }
Anssi Mannila483bd162022-01-20 11:11:48 +0200337 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 Hyttinenaada6452020-04-07 08:47:58 +0300342 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200346 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300347 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200351 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300352 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200356 }
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 Hyttinenff8dccd2019-12-10 14:34:07 +0200366
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//////////////////////////////////////////////////////////////////////
376uint64_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 Hyttinenaada6452020-04-07 08:47:58 +0300382 pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode = ProcedureCode_id_RICsubscription;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200383 pE2AP_PDU->choice.unsuccessfulOutcome.criticality = Criticality_ignore;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300384 pE2AP_PDU->choice.unsuccessfulOutcome.value.present = UnsuccessfulOutcome__value_PR_RICsubscriptionFailure;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200385
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 Hyttinenaada6452020-04-07 08:47:58 +0300393 pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionFailure->ricRequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200394 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 Mannila483bd162022-01-20 11:11:48 +0200411 // Cause
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200412 pRICsubscriptionFailure_IEs = calloc(1, sizeof(RICsubscriptionFailure_IEs_t));
413 if (pRICsubscriptionFailure_IEs) {
Anssi Mannila483bd162022-01-20 11:11:48 +0200414 pRICsubscriptionFailure_IEs->id = ProtocolIE_ID_id_Cause;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200415 pRICsubscriptionFailure_IEs->criticality = Criticality_reject;
Anssi Mannila483bd162022-01-20 11:11:48 +0200416 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200446 }
447 ASN_SEQUENCE_ADD(&pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure.protocolIEs.list, pRICsubscriptionFailure_IEs);
448 }
449 else
Anssi Mannila483bd162022-01-20 11:11:48 +0200450 return e2err_RICSubscriptionFailureAllocCauseFail;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200451
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 Hyttinenff8dccd2019-12-10 14:34:07 +0200464uint64_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 Hyttinenaada6452020-04-07 08:47:58 +0300470 pE2AP_PDU->choice.initiatingMessage.procedureCode = ProcedureCode_id_RICsubscriptionDelete;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200471 pE2AP_PDU->choice.initiatingMessage.criticality = Criticality_ignore;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300472 pE2AP_PDU->choice.initiatingMessage.value.present = InitiatingMessage__value_PR_RICsubscriptionDeleteRequest;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200473
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 Hyttinenaada6452020-04-07 08:47:58 +0300481 pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionDeleteRequest->ricRequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200482 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//////////////////////////////////////////////////////////////////////
509uint64_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 Hyttinenaada6452020-04-07 08:47:58 +0300515 pE2AP_PDU->choice.successfulOutcome.procedureCode = ProcedureCode_id_RICsubscriptionDelete;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200516 pE2AP_PDU->choice.successfulOutcome.criticality = Criticality_ignore;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300517 pE2AP_PDU->choice.successfulOutcome.value.present = SuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200518
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 Hyttinenaada6452020-04-07 08:47:58 +0300526 pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionDeleteResponse->ricRequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200527 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
553uint64_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 Hyttinenaada6452020-04-07 08:47:58 +0300559 pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode = ProcedureCode_id_RICsubscriptionDelete;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200560 pE2AP_PDU->choice.unsuccessfulOutcome.criticality = Criticality_ignore;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300561 pE2AP_PDU->choice.unsuccessfulOutcome.value.present = UnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200562
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 Hyttinenaada6452020-04-07 08:47:58 +0300570 pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricInstanceID = pRICSubscriptionDeleteFailure->ricRequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200571 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 Mannila483bd162022-01-20 11:11:48 +0200588 // Cause
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200589 pRICsubscriptionDeleteFailure_IEs = calloc(1, sizeof(RICsubscriptionDeleteFailure_IEs_t));
590 if (pRICsubscriptionDeleteFailure_IEs) {
Juha Hyttinenaada6452020-04-07 08:47:58 +0300591 pRICsubscriptionDeleteFailure_IEs->id = ProtocolIE_ID_id_Cause;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200592 pRICsubscriptionDeleteFailure_IEs->criticality = Criticality_reject;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300593 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200598 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300599 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200603 }
Anssi Mannila483bd162022-01-20 11:11:48 +0200604 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 Hyttinenaada6452020-04-07 08:47:58 +0300609 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200613 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300614 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200618 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300619 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200623 }
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//////////////////////////////////////////////////////////////////////
641e2ap_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 Mannilae1af87f2021-11-10 13:10:54 +0200648 if (debugPrints) {
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200649 sprintf(pLogBuffer,"Successfully decoded E2AP-PDU");
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200650 asn_fprint(stdout, &asn_DEF_E2AP_PDU, pE2AP_PDU);
651 }
652
653 if (pE2AP_PDU->present == E2AP_PDU_PR_initiatingMessage) {
Juha Hyttinenaada6452020-04-07 08:47:58 +0300654 if (pE2AP_PDU->choice.initiatingMessage.procedureCode == ProcedureCode_id_RICsubscription) {
655 if (pE2AP_PDU->choice.initiatingMessage.value.present == InitiatingMessage__value_PR_RICsubscriptionRequest) {
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200656 pMessageInfo->messageType = cE2InitiatingMessage;
657 pMessageInfo->messageId = cRICSubscriptionRequest;
658 return (e2ap_pdu_ptr_t*)pE2AP_PDU;
659 }
660 else {
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200661 sprintf(pLogBuffer,"Error. Not supported initiatingMessage MessageId = %u",pE2AP_PDU->choice.initiatingMessage.value.present);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200662 return 0;
663 }
664 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300665 else if (pE2AP_PDU->choice.initiatingMessage.procedureCode == ProcedureCode_id_RICsubscriptionDelete) {
666 if (pE2AP_PDU->choice.initiatingMessage.value.present == InitiatingMessage__value_PR_RICsubscriptionDeleteRequest) {
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200667 pMessageInfo->messageType = cE2InitiatingMessage;
668 pMessageInfo->messageId = cRICSubscriptionDeleteRequest;
669 return (e2ap_pdu_ptr_t*)pE2AP_PDU;
670 }
671 else {
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200672 sprintf(pLogBuffer,"Error. Not supported initiatingMessage MessageId = %u",pE2AP_PDU->choice.initiatingMessage.value.present);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200673 return 0;
674 }
675 }
676 else {
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200677 sprintf(pLogBuffer,"Error. Procedure not supported. ProcedureCode = %li",pE2AP_PDU->choice.initiatingMessage.procedureCode);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200678 return 0;
679 }
680 }
681 else if (pE2AP_PDU->present == E2AP_PDU_PR_successfulOutcome) {
Juha Hyttinenaada6452020-04-07 08:47:58 +0300682 if (pE2AP_PDU->choice.successfulOutcome.procedureCode == ProcedureCode_id_RICsubscription) {
683 if (pE2AP_PDU->choice.successfulOutcome.value.present == SuccessfulOutcome__value_PR_RICsubscriptionResponse) {
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200684 pMessageInfo->messageType = cE2SuccessfulOutcome;
685 pMessageInfo->messageId = cRICSubscriptionResponse;
686 return (e2ap_pdu_ptr_t*)pE2AP_PDU;
687 }
688 else {
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200689 sprintf(pLogBuffer,"Error. Not supported successfulOutcome MessageId = %u",pE2AP_PDU->choice.successfulOutcome.value.present);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200690 return 0;
691 }
692 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300693 else if (pE2AP_PDU->choice.successfulOutcome.procedureCode == ProcedureCode_id_RICsubscriptionDelete) {
694 if (pE2AP_PDU->choice.successfulOutcome.value.present == SuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse) {
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200695 pMessageInfo->messageType = cE2SuccessfulOutcome;
696 pMessageInfo->messageId = cRICsubscriptionDeleteResponse;
697 return (e2ap_pdu_ptr_t*)pE2AP_PDU;
698 }
699 else {
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200700 sprintf(pLogBuffer,"Error. Not supported successfulOutcome MessageId = %u",pE2AP_PDU->choice.successfulOutcome.value.present);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200701 return 0;
702 }
703 }
704 else {
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200705 sprintf(pLogBuffer,"Error. Procedure not supported. ProcedureCode = %li",pE2AP_PDU->choice.successfulOutcome.procedureCode);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200706 return 0;
707 }
708 }
709 else if (pE2AP_PDU->present == E2AP_PDU_PR_unsuccessfulOutcome) {
Juha Hyttinenaada6452020-04-07 08:47:58 +0300710 if (pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode == ProcedureCode_id_RICsubscription) {
711 if (pE2AP_PDU->choice.unsuccessfulOutcome.value.present == UnsuccessfulOutcome__value_PR_RICsubscriptionFailure) {
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200712 pMessageInfo->messageType = cE2UnsuccessfulOutcome;
713 pMessageInfo->messageId = cRICSubscriptionFailure;
714 return (e2ap_pdu_ptr_t*)pE2AP_PDU;
715 }
716 else {
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200717 sprintf(pLogBuffer,"Error. Not supported unsuccessfulOutcome MessageId = %u",pE2AP_PDU->choice.unsuccessfulOutcome.value.present);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200718 return 0;
719 }
720 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300721 else if (pE2AP_PDU->choice.unsuccessfulOutcome.procedureCode == ProcedureCode_id_RICsubscriptionDelete) {
722 if (pE2AP_PDU->choice.unsuccessfulOutcome.value.present == UnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure) {
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200723 pMessageInfo->messageType = cE2UnsuccessfulOutcome;
724 pMessageInfo->messageId = cRICsubscriptionDeleteFailure;
725 return (e2ap_pdu_ptr_t*)pE2AP_PDU;
726 }
727 else {
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200728 sprintf(pLogBuffer,"Error. Not supported unsuccessfulOutcome MessageId = %u",pE2AP_PDU->choice.unsuccessfulOutcome.value.present);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200729 return 0;
730 }
731 }
732 }
733 else
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200734 sprintf(pLogBuffer,"Decode failed. Invalid message type %u",pE2AP_PDU->present);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200735 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
736 return 0;
737 case RC_WMORE:
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200738 sprintf(pLogBuffer,"Decode failed. More data needed. Buffer size %zu, %s, consumed %zu",dataBufferSize, asn_DEF_E2AP_PDU.name, rval.consumed);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200739 return 0;
740 case RC_FAIL:
Anssi Mannila4721d4e2020-01-16 09:14:47 +0200741 sprintf(pLogBuffer,"Decode failed. Buffer size %zu, %s, consumed %zu",dataBufferSize, asn_DEF_E2AP_PDU.name, rval.consumed);
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200742 return 0;
743 default:
744 return 0;
745 }
746}
747
748//////////////////////////////////////////////////////////////////////
Juha Hyttinencdc35bf2020-07-11 13:32:57 +0300749uint64_t getRICSubscriptionRequestData(e2ap_pdu_ptr_t* pE2AP_PDU_pointer, RICSubscriptionRequest_t* pRICSubscriptionRequest) {
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200750
751 E2AP_PDU_t* pE2AP_PDU = (E2AP_PDU_t*)pE2AP_PDU_pointer;
Juha Hyttinen55040222020-01-16 09:41:04 +0200752
753 RICsubscriptionRequest_t *asnRicSubscriptionRequest = &pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionRequest;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200754 RICsubscriptionRequest_IEs_t* pRICsubscriptionRequest_IEs;
Juha Hyttinen55040222020-01-16 09:41:04 +0200755
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200756 // RICrequestID
Juha Hyttinen55040222020-01-16 09:41:04 +0200757 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200760 pRICSubscriptionRequest->ricRequestID.ricRequestorID = pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricRequestorID;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300761 pRICSubscriptionRequest->ricRequestID.ricInstanceID = pRICsubscriptionRequest_IEs->value.choice.RICrequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200762 }
763 else {
764 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
765 return e2err_RICsubscriptionRequestRICrequestIDMissing;
766 }
767
768 // RANfunctionID
Juha Hyttinen55040222020-01-16 09:41:04 +0200769 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200772 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 Hyttinenaada6452020-04-07 08:47:58 +0300779 // RICsubscriptionDetails
Juha Hyttinen55040222020-01-16 09:41:04 +0200780 if (asnRicSubscriptionRequest->protocolIEs.list.count > 2 &&
Juha Hyttinenaada6452020-04-07 08:47:58 +0300781 asnRicSubscriptionRequest->protocolIEs.list.array[2]->id == ProtocolIE_ID_id_RICsubscriptionDetails) {
Juha Hyttinen55040222020-01-16 09:41:04 +0200782 pRICsubscriptionRequest_IEs = asnRicSubscriptionRequest->protocolIEs.list.array[2];
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200783
784 // Unpack EventTriggerDefinition
785 RICeventTriggerDefinition_t* pRICeventTriggerDefinition =
Juha Hyttinenaada6452020-04-07 08:47:58 +0300786 (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 Hyttinenff8dccd2019-12-10 14:34:07 +0200790 // RICactions-ToBeSetup-List
791 RICaction_ToBeSetup_ItemIEs_t* pRICaction_ToBeSetup_ItemIEs;
792 uint64_t index = 0;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300793 while (index < pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.list.count)
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200794 {
Juha Hyttinenaada6452020-04-07 08:47:58 +0300795 pRICaction_ToBeSetup_ItemIEs = (RICaction_ToBeSetup_ItemIEs_t*)pRICsubscriptionRequest_IEs->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.list.array[index];
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200796
797 // RICActionID
Juha Hyttinenaada6452020-04-07 08:47:58 +0300798 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID =
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200799 pRICaction_ToBeSetup_ItemIEs->value.choice.RICaction_ToBeSetup_Item.ricActionID;
800
801 // RICActionType
Juha Hyttinenaada6452020-04-07 08:47:58 +0300802 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType =
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200803 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 Hyttinenaada6452020-04-07 08:47:58 +0300808 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 Hyttinenaada6452020-04-07 08:47:58 +0300814 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent = true;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200815 }
816 else
Juha Hyttinenaada6452020-04-07 08:47:58 +0300817 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent = false;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200818
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 Hyttinenaada6452020-04-07 08:47:58 +0300824 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent = true;
825 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType =
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200826 pRICsubsequentAction->ricSubsequentActionType;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300827 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait =
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200828 pRICsubsequentAction->ricTimeToWait;
829 }
830 else
Juha Hyttinenaada6452020-04-07 08:47:58 +0300831 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent = false;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200832 index++;
833 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300834 pRICSubscriptionRequest->ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength = index;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200835 }
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 Hyttinenaada6452020-04-07 08:47:58 +0300845
846//////////////////////////////////////////////////////////////////////
Juha Hyttinenaada6452020-04-07 08:47:58 +0300847
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200848uint64_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 Hyttinen55040222020-01-16 09:41:04 +0200852 RICsubscriptionResponse_t *asnRicSubscriptionResponse = &pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionResponse;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200853 RICsubscriptionResponse_IEs_t* pRICsubscriptionResponse_IEs;
Juha Hyttinen55040222020-01-16 09:41:04 +0200854
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 Hyttinenff8dccd2019-12-10 14:34:07 +0200859 pRICSubscriptionResponse->ricRequestID.ricRequestorID = pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricRequestorID;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300860 pRICSubscriptionResponse->ricRequestID.ricInstanceID = pRICsubscriptionResponse_IEs->value.choice.RICrequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200861 }
862 else {
863 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
864 return e2err_RICsubscriptionResponseRICrequestIDMissing;
865 }
866
867 // RANfunctionID
Juha Hyttinen55040222020-01-16 09:41:04 +0200868 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200871 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 Hyttinen55040222020-01-16 09:41:04 +0200879 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200882 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 Hyttinen55040222020-01-16 09:41:04 +0200901 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200904 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 Mannila483bd162022-01-20 11:11:48 +0200916 // Cause
Juha Hyttinenaada6452020-04-07 08:47:58 +0300917 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200921 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300922 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200926 }
Anssi Mannila483bd162022-01-20 11:11:48 +0200927 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 Hyttinenaada6452020-04-07 08:47:58 +0300932 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200936 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300937 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200941 }
Juha Hyttinenaada6452020-04-07 08:47:58 +0300942 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200946 }
947 index++;
948 }
949 pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength = index;
950 }
951 }
Juha Hyttinen55040222020-01-16 09:41:04 +0200952 else {
953 pRICSubscriptionResponse->ricActionNotAdmittedListPresent = false;
954 pRICSubscriptionResponse->ricActionNotAdmittedList.contentLength = 0;
955 }
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200956 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
957 return e2err_OK;
958}
959
960//////////////////////////////////////////////////////////////////////
961uint64_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 Hyttinen55040222020-01-16 09:41:04 +0200965 RICsubscriptionFailure_t *asnRicSubscriptionFailure = &pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionFailure;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200966 RICsubscriptionFailure_IEs_t* pRICsubscriptionFailure_IEs;
Juha Hyttinen55040222020-01-16 09:41:04 +0200967
968 // RICrequestID
Juha Hyttinen55040222020-01-16 09:41:04 +0200969 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200972 pRICSubscriptionFailure->ricRequestID.ricRequestorID = pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricRequestorID;
Juha Hyttinenaada6452020-04-07 08:47:58 +0300973 pRICSubscriptionFailure->ricRequestID.ricInstanceID = pRICsubscriptionFailure_IEs->value.choice.RICrequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +0200974 }
975 else {
976 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
977 return e2err_RICsubscriptionFailureRICrequestIDMissing;
978 }
979
980 // RANfunctionID
Juha Hyttinen55040222020-01-16 09:41:04 +0200981 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200984 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 Mannila483bd162022-01-20 11:11:48 +0200991 // Cause
Juha Hyttinen55040222020-01-16 09:41:04 +0200992 if (asnRicSubscriptionFailure->protocolIEs.list.count > 2 &&
Anssi Mannila483bd162022-01-20 11:11:48 +0200993 asnRicSubscriptionFailure->protocolIEs.list.array[2]->id == ProtocolIE_ID_id_Cause) {
Juha Hyttinen55040222020-01-16 09:41:04 +0200994 pRICsubscriptionFailure_IEs = asnRicSubscriptionFailure->protocolIEs.list.array[2];
Anssi Mannila483bd162022-01-20 11:11:48 +0200995 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 Hyttinenff8dccd2019-12-10 14:34:07 +0200999 }
Anssi Mannila483bd162022-01-20 11:11:48 +02001000 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001025 }
1026 else {
1027 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
Anssi Mannila483bd162022-01-20 11:11:48 +02001028 return e2err_RICsubscriptionFailureCauseMissing;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001029 }
Anssi Mannila483bd162022-01-20 11:11:48 +02001030
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001031 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
1032 return e2err_OK;
1033}
1034
1035//////////////////////////////////////////////////////////////////////
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001036uint64_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 Hyttinen55040222020-01-16 09:41:04 +02001040 RICsubscriptionDeleteRequest_t *asnRicSubscriptionDeleteRequest = &pE2AP_PDU->choice.initiatingMessage.value.choice.RICsubscriptionDeleteRequest;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001041 RICsubscriptionDeleteRequest_IEs_t* pRICsubscriptionDeleteRequest_IEs;
Juha Hyttinen55040222020-01-16 09:41:04 +02001042
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 Hyttinenff8dccd2019-12-10 14:34:07 +02001047 pRICSubscriptionDeleteRequest->ricRequestID.ricRequestorID = pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricRequestorID;
Juha Hyttinenaada6452020-04-07 08:47:58 +03001048 pRICSubscriptionDeleteRequest->ricRequestID.ricInstanceID = pRICsubscriptionDeleteRequest_IEs->value.choice.RICrequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001049 }
1050 else {
1051 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
1052 return e2err_RICsubscriptionDeleteRequestRICrequestIDMissing;
1053 }
1054
1055 // RANfunctionID
Juha Hyttinen55040222020-01-16 09:41:04 +02001056 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001059 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001065 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
1066 return e2err_OK;
1067}
1068
1069//////////////////////////////////////////////////////////////////////
1070uint64_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 Hyttinen55040222020-01-16 09:41:04 +02001074 RICsubscriptionDeleteResponse_t *asnRicSubscriptionDeleteResponse = &pE2AP_PDU->choice.successfulOutcome.value.choice.RICsubscriptionDeleteResponse;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001075 RICsubscriptionDeleteResponse_IEs_t* pRICsubscriptionDeleteResponse_IEs;
Juha Hyttinen55040222020-01-16 09:41:04 +02001076
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 Hyttinenff8dccd2019-12-10 14:34:07 +02001081 pRICSubscriptionDeleteResponse->ricRequestID.ricRequestorID = pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricRequestorID;
Juha Hyttinenaada6452020-04-07 08:47:58 +03001082 pRICSubscriptionDeleteResponse->ricRequestID.ricInstanceID = pRICsubscriptionDeleteResponse_IEs->value.choice.RICrequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001083 }
1084 else {
1085 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
1086 return e2err_RICsubscriptionDeleteResponseRICrequestIDMissing;
1087 }
1088
1089 // RANfunctionID
Juha Hyttinen55040222020-01-16 09:41:04 +02001090 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001093 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001099 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
1100 return e2err_OK;
1101}
1102
1103//////////////////////////////////////////////////////////////////////
1104uint64_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 Hyttinen55040222020-01-16 09:41:04 +02001108 RICsubscriptionDeleteFailure_t *asnRicSubscriptionDeleteFailure = &pE2AP_PDU->choice.unsuccessfulOutcome.value.choice.RICsubscriptionDeleteFailure;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001109 RICsubscriptionDeleteFailure_IEs_t* pRICsubscriptionDeleteFailure_IEs;
Juha Hyttinen55040222020-01-16 09:41:04 +02001110
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 Hyttinenff8dccd2019-12-10 14:34:07 +02001115 pRICSubscriptionDeleteFailure->ricRequestID.ricRequestorID = pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricRequestorID;
Juha Hyttinenaada6452020-04-07 08:47:58 +03001116 pRICSubscriptionDeleteFailure->ricRequestID.ricInstanceID = pRICsubscriptionDeleteFailure_IEs->value.choice.RICrequestID.ricInstanceID;
Juha Hyttinenff8dccd2019-12-10 14:34:07 +02001117 }
1118 else {
1119 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU);
1120 return e2err_RICsubscriptionDeleteFailureRICrequestIDMissing;
1121 }
1122
1123 // RANfunctionID
Juha Hyttinen55040222020-01-16 09:41:04 +02001124 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001127 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 Mannila483bd162022-01-20 11:11:48 +02001134 // Cause
Juha Hyttinen55040222020-01-16 09:41:04 +02001135 if (asnRicSubscriptionDeleteFailure->protocolIEs.list.count > 2 &&
Juha Hyttinenaada6452020-04-07 08:47:58 +03001136 asnRicSubscriptionDeleteFailure->protocolIEs.list.array[2]->id == ProtocolIE_ID_id_Cause) {
Juha Hyttinen55040222020-01-16 09:41:04 +02001137 pRICsubscriptionDeleteFailure_IEs = asnRicSubscriptionDeleteFailure->protocolIEs.list.array[2];
Juha Hyttinenaada6452020-04-07 08:47:58 +03001138 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001142 }
Juha Hyttinenaada6452020-04-07 08:47:58 +03001143 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001147 }
Anssi Mannila483bd162022-01-20 11:11:48 +02001148 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 Hyttinenaada6452020-04-07 08:47:58 +03001153 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001157 }
Juha Hyttinenaada6452020-04-07 08:47:58 +03001158 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001162 }
Juha Hyttinenaada6452020-04-07 08:47:58 +03001163 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 Hyttinenff8dccd2019-12-10 14:34:07 +02001167 }
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}