2 ==================================================================================
3 Copyright (c) 2018-2019 AT&T Intellectual Property.
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 ==================================================================================
20 #include "subscription_response.hpp"
22 /* The xAPP need only worry about the get_fields from a response, since it does
23 not generate a response. Generating response however is included to support testing.
27 // Primarly for generation
28 subscription_response::subscription_response(void){
31 e2ap_pdu_obj = (E2N_E2AP_PDU_t *)calloc(1, sizeof(E2N_E2AP_PDU_t));
32 assert(e2ap_pdu_obj != 0);
35 successMsg = (E2N_SuccessfulOutcome_t *)calloc(1, sizeof(E2N_SuccessfulOutcome_t));
36 assert(successMsg != 0);
39 unsuccessMsg = (E2N_UnsuccessfulOutcome_t *)calloc(1, sizeof(E2N_UnsuccessfulOutcome_t));
40 assert(unsuccessMsg != 0);
43 IE_array = (E2N_RICsubscriptionResponse_IEs_t *)calloc(NUM_SUBSCRIPTION_RESPONSE_IES, sizeof(E2N_RICsubscriptionResponse_IEs_t));
44 assert(IE_array != 0);
47 IE_Failure_array = (E2N_RICsubscriptionFailure_IEs_t *)calloc(NUM_SUBSCRIPTION_FAILURE_IES, sizeof(E2N_RICsubscriptionFailure_IEs_t));
48 assert(IE_Failure_array != 0);
51 ie_admitted_list = (E2N_RICaction_Admitted_ItemIEs_t *)calloc(INITIAL_RESPONSE_LIST_SIZE, sizeof(E2N_RICaction_Admitted_ItemIEs_t));
52 assert(ie_admitted_list != 0);
53 ie_admitted_list_size = INITIAL_RESPONSE_LIST_SIZE;
55 ie_not_admitted_list = 0;
56 ie_not_admitted_list = (E2N_RICaction_NotAdmitted_ItemIEs_t *)calloc(INITIAL_RESPONSE_LIST_SIZE, sizeof(E2N_RICaction_NotAdmitted_ItemIEs_t));
57 assert(ie_not_admitted_list != 0);
58 ie_not_admitted_list_size = INITIAL_RESPONSE_LIST_SIZE;
68 // Clear assigned protocolIE list from RIC indication IE container
69 subscription_response::~subscription_response(void){
71 mdclog_write(MDCLOG_DEBUG, "Freeing subscription response memory");
72 E2N_RICaction_Admitted_List_t * response_admitted_list = (E2N_RICaction_Admitted_List_t *) &(IE_array[2].value.choice.RICaction_Admitted_List);
74 for(int i = 0; i < response_admitted_list->list.size; i++){
75 response_admitted_list->list.array[i] = 0;
79 if (response_admitted_list->list.size > 0){
80 free(response_admitted_list->list.array);
81 response_admitted_list->list.array = 0;
82 response_admitted_list->list.size = 0;
83 response_admitted_list->list.count = 0;
87 E2N_RICaction_NotAdmitted_List_t * response_not_admitted_list = &(IE_array[3].value.choice.RICaction_NotAdmitted_List);
88 for(int i = 0; i < response_not_admitted_list->list.size; i++){
89 response_not_admitted_list->list.array[i] = 0;
92 if (response_not_admitted_list->list.size > 0){
93 free(response_not_admitted_list->list.array);
94 response_not_admitted_list->list.array = 0;
95 response_not_admitted_list->list.size = 0;
96 response_not_admitted_list->list.count = 0;
99 E2N_RICsubscriptionResponse_t * ric_subscription_response = &(successMsg->value.choice.RICsubscriptionResponse);
100 for(int i = 0; i < ric_subscription_response->protocolIEs.list.size ; i++){
101 ric_subscription_response->protocolIEs.list.array[i] = 0;
104 if (ric_subscription_response->protocolIEs.list.size > 0){
105 free(ric_subscription_response->protocolIEs.list.array);
106 ric_subscription_response->protocolIEs.list.array = 0;
107 ric_subscription_response->protocolIEs.list.size = 0;
108 ric_subscription_response->protocolIEs.list.count = 0;
112 E2N_RICaction_NotAdmitted_List_t * failure_not_admitted_list = &(IE_Failure_array[2].value.choice.RICaction_NotAdmitted_List);
113 for(int i = 0; i < failure_not_admitted_list->list.size; i++){
114 failure_not_admitted_list->list.array[i] = 0;
117 if ( failure_not_admitted_list->list.size > 0){
118 free( failure_not_admitted_list->list.array);
119 failure_not_admitted_list->list.array = 0;
120 failure_not_admitted_list->list.size = 0;
121 failure_not_admitted_list->list.count = 0;
125 E2N_RICsubscriptionFailure_t * ric_subscription_failure = &(unsuccessMsg->value.choice.RICsubscriptionFailure);
126 for(int i = 0; i < ric_subscription_failure->protocolIEs.list.size; i++){
127 ric_subscription_failure->protocolIEs.list.array[i] = 0;
130 if ( ric_subscription_failure->protocolIEs.list.size > 0){
131 free(ric_subscription_failure->protocolIEs.list.array);
132 ric_subscription_failure->protocolIEs.list.array = 0;
133 ric_subscription_failure->protocolIEs.list.size = 0;
134 ric_subscription_failure->protocolIEs.list.count = 0;
138 free(ie_admitted_list);
139 free(ie_not_admitted_list);
140 free(IE_Failure_array);
144 ASN_STRUCT_FREE(asn_DEF_E2N_SuccessfulOutcome, successMsg);
145 ASN_STRUCT_FREE(asn_DEF_E2N_UnsuccessfulOutcome, unsuccessMsg);
148 e2ap_pdu_obj->choice.initiatingMessage = NULL;
149 e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_NOTHING;
150 ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
152 mdclog_write(MDCLOG_DEBUG, "Freed subscription response memory ");
158 bool subscription_response::encode_e2ap_subscription_response(unsigned char *buf, size_t *size, subscription_response_helper &dinput, bool is_success){
162 set_fields_success(dinput);
163 e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_successfulOutcome;
164 e2ap_pdu_obj->choice.successfulOutcome = successMsg;
166 successMsg->procedureCode = E2N_ProcedureCode_id_ricSubscription;
167 successMsg->criticality = E2N_Criticality_reject;
168 successMsg->value.present = E2N_SuccessfulOutcome__value_PR_RICsubscriptionResponse;
172 set_fields_unsuccess(dinput);
173 e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_unsuccessfulOutcome;
174 e2ap_pdu_obj->choice.unsuccessfulOutcome = unsuccessMsg;
176 unsuccessMsg->procedureCode = E2N_ProcedureCode_id_ricSubscription;
177 unsuccessMsg->criticality = E2N_Criticality_reject;
178 unsuccessMsg->value.present = E2N_UnsuccessfulOutcome__value_PR_RICsubscriptionFailure;
182 //xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2ap_pdu_obj);
184 int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
186 error_string.assign(errbuf, errbuf_len);
187 error_string = "Constraints failed for encoding subscription response. Reason = " + error_string;
191 asn_enc_rval_t res = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj, buf, *size);
193 if(res.encoded == -1){
194 std::cout <<"Error encoding PDU. Reason =" << strerror(errno) << std::endl;
198 if(*size < res.encoded){
199 fprintf(stderr, "Buffer assigned too small to encode: %s",(char *)(asn_DEF_E2N_E2AP_PDU.name));
210 void subscription_response::set_fields_success(subscription_response_helper &helper){
214 E2N_RICsubscriptionResponse_t * subscription_response = &(successMsg->value.choice.RICsubscriptionResponse);
215 //reset list count ..
216 subscription_response->protocolIEs.list.count = 0;
219 E2N_RICsubscriptionResponse_IEs_t *ies_ricreq = &IE_array[ie_index];
221 ies_ricreq->criticality = E2N_Criticality_reject;
222 ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
223 ies_ricreq->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_RICrequestID;
224 E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
225 ricrequest_ie->ricRequestorID = helper.get_request_id();
226 ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
227 ASN_SEQUENCE_ADD(&subscription_response->protocolIEs, &(IE_array[ie_index]));
231 E2N_RICsubscriptionResponse_IEs_t *ies_ranfunc = &IE_array[ie_index];
232 ies_ranfunc->criticality = E2N_Criticality_reject;
233 ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
234 ies_ranfunc->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_RANfunctionID;
235 E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
236 *ranfunction_ie = helper.get_function_id();
237 ASN_SEQUENCE_ADD(&subscription_response->protocolIEs, &(IE_array[ie_index]));
241 E2N_RICsubscriptionResponse_IEs_t *ies_admitted_actid = &IE_array[ie_index];
242 ies_admitted_actid->criticality = E2N_Criticality_reject;
243 ies_admitted_actid->id = E2N_ProtocolIE_ID_id_RICactions_Admitted;
244 E2N_RICaction_Admitted_List_t *ric_admitted_actions_ie = &ies_admitted_actid->value.choice.RICaction_Admitted_List;
245 ric_admitted_actions_ie->list.count = 0;
246 std::vector<ActionResponse> * ref_admitted_action_array = helper.get_admitted_list();
248 if(ref_admitted_action_array->size() == 0){
249 ies_admitted_actid->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_NOTHING;
252 ies_admitted_actid->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_RICaction_Admitted_List;
255 if (ref_admitted_action_array->size() >= ie_admitted_list_size){
256 ie_admitted_list_size = 2 * ref_admitted_action_array->size();
257 free(ie_admitted_list);
258 ie_admitted_list = (E2N_RICaction_Admitted_ItemIEs_t *)calloc(ie_admitted_list_size, sizeof(E2N_RICaction_Admitted_ItemIEs_t));
259 assert(ie_admitted_list != 0);
263 for(unsigned int i = 0; i < ref_admitted_action_array->size(); i ++){
264 ie_admitted_list[i].criticality = E2N_Criticality_ignore;
265 ie_admitted_list[i].id = E2N_ProtocolIE_ID_id_RICaction_Admitted_Item ;
266 ie_admitted_list[i].value.present = E2N_RICaction_Admitted_ItemIEs__value_PR_RICaction_Admitted_Item;
267 ie_admitted_list[i].value.choice.RICaction_Admitted_Item.ricActionID = (*ref_admitted_action_array)[i].get_id();
268 ASN_SEQUENCE_ADD(ric_admitted_actions_ie, &(ie_admitted_list[i]));
271 ASN_SEQUENCE_ADD(&subscription_response->protocolIEs, &(IE_array[ie_index]));
273 // optional IE : add only if non-zero list
275 std::vector<ActionResponse> * ref_notadmitted_action_array = helper.get_not_admitted_list();
276 if (ref_notadmitted_action_array->size() > 0){
278 E2N_RICsubscriptionResponse_IEs_t *ies_notadmitted_actid = &IE_array[ie_index];
279 ies_notadmitted_actid->criticality = E2N_Criticality_reject;
280 ies_notadmitted_actid->id = E2N_ProtocolIE_ID_id_RICactions_NotAdmitted;
282 E2N_RICaction_NotAdmitted_List_t *ric_not_admitted_actions_ie = &ies_notadmitted_actid->value.choice.RICaction_NotAdmitted_List;
283 ric_not_admitted_actions_ie->list.count = 0;
286 ies_notadmitted_actid->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_RICaction_NotAdmitted_List;
289 if (ref_notadmitted_action_array->size() >= ie_not_admitted_list_size){
290 ie_not_admitted_list_size = 2 * ref_notadmitted_action_array->size();
291 free(ie_not_admitted_list);
292 ie_not_admitted_list = (E2N_RICaction_NotAdmitted_ItemIEs_t *)calloc(ie_not_admitted_list_size, sizeof(E2N_RICaction_NotAdmitted_ItemIEs_t));
293 assert(ie_not_admitted_list != 0);
298 for(unsigned int i = 0; i < ref_notadmitted_action_array->size(); i ++){
299 ie_not_admitted_list[i].criticality = E2N_Criticality_ignore;
300 ie_not_admitted_list[i].id = E2N_ProtocolIE_ID_id_RICaction_NotAdmitted_Item ;
301 ie_not_admitted_list[i].value.present = E2N_RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;;
302 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricActionID = (*ref_notadmitted_action_array)[i].get_id();
304 int cause = (*ref_notadmitted_action_array)[i].get_cause();
306 case E2N_RICcause_PR_radioNetwork:
307 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork = (*ref_notadmitted_action_array)[i].get_sub_cause();
309 case E2N_RICcause_PR_transport:
310 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport = (*ref_notadmitted_action_array)[i].get_sub_cause();
312 case E2N_RICcause_PR_protocol:
313 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol= (*ref_notadmitted_action_array)[i].get_sub_cause();
315 case E2N_RICcause_PR_misc:
316 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc = (*ref_notadmitted_action_array)[i].get_sub_cause();
318 case E2N_RICcause_PR_ric:
319 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric = (*ref_notadmitted_action_array)[i].get_sub_cause();
322 mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Unknown RIC cause %d\n", __FILE__, __LINE__, cause);
326 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.present = (E2N_RICcause_PR)cause;
327 ASN_SEQUENCE_ADD(ric_not_admitted_actions_ie, &(ie_not_admitted_list[i]));
330 ASN_SEQUENCE_ADD(&subscription_response->protocolIEs, &(IE_array[ie_index]));
335 void subscription_response:: get_fields(E2N_SuccessfulOutcome_t * success_msg, subscription_response_helper & dout)
338 assert(success_msg != NULL);
340 E2N_RICrequestID_t *requestid;
341 E2N_RANfunctionID_t * ranfunctionid;
342 E2N_RICaction_Admitted_List_t * ric_admitted_action_list;
343 E2N_RICaction_NotAdmitted_List_t * ric_not_admitted_action_list;
345 for(int edx = 0; edx < success_msg->value.choice.RICsubscriptionResponse.protocolIEs.list.count; edx++) {
346 E2N_RICsubscriptionResponse_IEs_t *memb_ptr = success_msg->value.choice.RICsubscriptionResponse.protocolIEs.list.array[edx];
350 case (E2N_ProtocolIE_ID_id_RICrequestID):
351 requestid = &memb_ptr->value.choice.RICrequestID;
352 dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
355 case (E2N_ProtocolIE_ID_id_RANfunctionID):
356 ranfunctionid = &memb_ptr->value.choice.RANfunctionID;
357 dout.set_function_id(*ranfunctionid);
360 case (E2N_ProtocolIE_ID_id_RICactions_Admitted):
361 ric_admitted_action_list = &memb_ptr->value.choice.RICaction_Admitted_List;
364 for(int index = 0; index < ric_admitted_action_list->list.count; index ++){
365 E2N_RICaction_Admitted_ItemIEs_t * item = (E2N_RICaction_Admitted_ItemIEs_t *)ric_admitted_action_list->list.array[index];
366 long int id = item->value.choice.RICaction_Admitted_Item.ricActionID;
367 dout.get_admitted_list()->push_back(ActionResponse(id));
372 case (E2N_ProtocolIE_ID_id_RICactions_NotAdmitted):
373 ric_not_admitted_action_list = &memb_ptr->value.choice.RICaction_NotAdmitted_List;
375 for(int index = 0; index < ric_not_admitted_action_list->list.count; index ++){
376 E2N_RICaction_NotAdmitted_ItemIEs_t * item = (E2N_RICaction_NotAdmitted_ItemIEs_t *)ric_not_admitted_action_list->list.array[index];
377 long int id = item->value.choice.RICaction_NotAdmitted_Item.ricActionID;
378 int cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.present;
382 case E2N_RICcause_PR_radioNetwork :
383 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork;
386 case E2N_RICcause_PR_transport :
387 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport;
390 case E2N_RICcause_PR_protocol :
391 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol;
394 case E2N_RICcause_PR_misc :
395 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc;
398 case E2N_RICcause_PR_ric :
399 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric;
403 std::cout <<"Error ! Illegal cause enum" << cause << std::endl;
406 dout.get_not_admitted_list()->push_back(ActionResponse(id, cause, sub_cause));
413 //asn_fprint(stdout, &asn_DEF_E2AP_PDU, e2pdu);
417 void subscription_response::set_fields_unsuccess( subscription_response_helper &helper){
420 E2N_RICsubscriptionFailure_t * ric_subscription_failure = &(unsuccessMsg->value.choice.RICsubscriptionFailure);
422 ric_subscription_failure->protocolIEs.list.count = 0;
425 E2N_RICsubscriptionFailure_IEs_t *ies_ricreq = &IE_Failure_array[ie_index];
426 ies_ricreq->criticality = E2N_Criticality_reject;
427 ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
428 ies_ricreq->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_RICrequestID;
429 E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
430 ricrequest_ie->ricRequestorID = helper.get_request_id();
431 ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
432 ASN_SEQUENCE_ADD(&ric_subscription_failure->protocolIEs, &(IE_Failure_array[ie_index]));
435 E2N_RICsubscriptionFailure_IEs_t *ies_ranfunc = &IE_Failure_array[ie_index];
436 ies_ranfunc->criticality = E2N_Criticality_reject;
437 ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
438 ies_ranfunc->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_RANfunctionID;
439 E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
440 *ranfunction_ie = helper.get_function_id();
441 ASN_SEQUENCE_ADD(&ric_subscription_failure->protocolIEs, &(IE_Failure_array[ie_index]));
444 E2N_RICsubscriptionFailure_IEs_t *ies_notadmitted_actid = &IE_Failure_array[ie_index];
445 ies_notadmitted_actid->criticality = E2N_Criticality_reject;
446 ies_notadmitted_actid->id = E2N_ProtocolIE_ID_id_RICactions_NotAdmitted;
447 E2N_RICaction_NotAdmitted_List_t *ric_not_admitted_actions_ie = &ies_notadmitted_actid->value.choice.RICaction_NotAdmitted_List;
448 ric_not_admitted_actions_ie->list.count = 0;
449 std::vector<ActionResponse> * ref_notadmitted_action_array = helper.get_not_admitted_list();
450 if(ref_notadmitted_action_array->size() == 0){
451 ies_notadmitted_actid->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_NOTHING;
454 ies_notadmitted_actid->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_RICaction_NotAdmitted_List;
457 if (ref_notadmitted_action_array->size() >= ie_not_admitted_list_size){
458 ie_not_admitted_list_size = 2 * ref_notadmitted_action_array->size();
459 free(ie_not_admitted_list);
460 ie_not_admitted_list = (E2N_RICaction_NotAdmitted_ItemIEs_t *)calloc(ie_not_admitted_list_size, sizeof(E2N_RICaction_NotAdmitted_ItemIEs_t));
461 assert(ie_not_admitted_list != 0);
465 // reset the list count on ricAction_ToBeSetup_List;
466 for(unsigned int i = 0; i < ref_notadmitted_action_array->size(); i ++){
467 ie_not_admitted_list[i].criticality = E2N_Criticality_ignore;
468 ie_not_admitted_list[i].id = E2N_ProtocolIE_ID_id_RICaction_NotAdmitted_Item ;
469 ie_not_admitted_list[i].value.present = E2N_RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;;
470 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricActionID = (*ref_notadmitted_action_array)[i].get_id();
472 int cause = (*ref_notadmitted_action_array)[i].get_cause();
474 case E2N_RICcause_PR_radioNetwork:
475 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork = (*ref_notadmitted_action_array)[i].get_sub_cause();
477 case E2N_RICcause_PR_transport:
478 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport = (*ref_notadmitted_action_array)[i].get_sub_cause();
480 case E2N_RICcause_PR_protocol:
481 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol= (*ref_notadmitted_action_array)[i].get_sub_cause();
483 case E2N_RICcause_PR_misc:
484 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc = (*ref_notadmitted_action_array)[i].get_sub_cause();
486 case E2N_RICcause_PR_ric:
487 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric = (*ref_notadmitted_action_array)[i].get_sub_cause();
490 mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Unknown RIC cause %d\n", __FILE__, __LINE__, cause);
494 ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.present = (E2N_RICcause_PR)cause;
496 ASN_SEQUENCE_ADD(ric_not_admitted_actions_ie, &(ie_not_admitted_list[i]));
500 ASN_SEQUENCE_ADD(&ric_subscription_failure->protocolIEs, &(IE_Failure_array[ie_index]));
503 // // criticality diagnostics is not generated/parsed currently since optional
505 // E2N_RICsubscriptionFailure_IEs_t *ies_criticality_diagnostics= &IE_Failure_array[i];
506 // ies_criticality_diagnostics->criticality = E2N_Criticality_ignore;
507 // ies_criticality_diagnostics->id = E2N_ProtocolIE_ID_id_CriticalityDiagnostics ;
508 // ies_criticality_diagnostics->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_NOTHING;
513 void subscription_response:: get_fields(E2N_UnsuccessfulOutcome_t * unsuccess_msg, subscription_response_helper & dout)
516 assert(unsuccess_msg != NULL);
518 E2N_RICrequestID_t *requestid;
519 E2N_RANfunctionID_t * ranfunctionid;
520 E2N_RICaction_NotAdmitted_List_t * ric_not_admitted_action_list;
522 for(int edx = 0; edx < unsuccess_msg->value.choice.RICsubscriptionFailure.protocolIEs.list.count; edx++) {
523 E2N_RICsubscriptionFailure_IEs_t *memb_ptr = unsuccess_msg->value.choice.RICsubscriptionFailure.protocolIEs.list.array[edx];
527 case (E2N_ProtocolIE_ID_id_RICrequestID):
528 requestid = &memb_ptr->value.choice.RICrequestID;
529 dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
532 case (E2N_ProtocolIE_ID_id_RANfunctionID):
533 ranfunctionid = &memb_ptr->value.choice.RANfunctionID;
534 dout.set_function_id(*ranfunctionid);
538 case (E2N_ProtocolIE_ID_id_RICactions_NotAdmitted):
539 ric_not_admitted_action_list = &memb_ptr->value.choice.RICaction_NotAdmitted_List;
541 for(int index = 0; index < ric_not_admitted_action_list->list.count; index ++){
542 E2N_RICaction_NotAdmitted_ItemIEs_t * item = (E2N_RICaction_NotAdmitted_ItemIEs_t *)ric_not_admitted_action_list->list.array[index];
543 long int id = item->value.choice.RICaction_NotAdmitted_Item.ricActionID;
544 int cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.present;
548 case E2N_RICcause_PR_radioNetwork :
549 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork;
552 case E2N_RICcause_PR_transport :
553 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport;
556 case E2N_RICcause_PR_protocol :
557 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol;
560 case E2N_RICcause_PR_misc :
561 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc;
564 case E2N_RICcause_PR_ric :
565 sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric;
569 mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Unknown RIC cause %d\n", __FILE__, __LINE__, cause);
572 dout.get_not_admitted_list()->push_back(ActionResponse(id, cause, sub_cause));
579 //asn_fprint(stdout, &asn_DEF_E2AP_PDU, e2pdu);