2 * Copyright 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.
19 * This source code is part of the near-RT RIC (RAN Intelligent Controller)
20 * platform project (RICP).
28 #include <asn_application.h>
30 #include <ProcedureCode.h>
31 #include <SuccessfulOutcome.h>
32 #include <ProtocolIE-ID.h>
33 #include <ProtocolIE-Field.h>
34 #include <x2reset_response_wrapper.h>
37 * Build and pack a reset response.
38 * Abort the process on allocation failure.
39 * packed_buf_size - in: size of packed_buf; out: number of chars used.
43 build_pack_x2reset_response(size_t* packed_buf_size, unsigned char* packed_buf,size_t err_buf_size, char* err_buf)
46 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
48 ResetResponse_t *resetResponse;
49 SuccessfulOutcome_t *successfulOutcome = calloc(1, sizeof(SuccessfulOutcome_t));
50 ResetResponse_IEs_t *resetResponse_ie = calloc(1, sizeof(ResetResponse_IEs_t));
53 assert(successfulOutcome != 0);
54 assert(resetResponse_ie != 0);
56 pdu->present = E2AP_PDU_PR_successfulOutcome;
57 pdu->choice.successfulOutcome = successfulOutcome;
59 successfulOutcome->procedureCode = ProcedureCode_id_reset;
60 successfulOutcome->criticality = Criticality_reject;
61 successfulOutcome->value.present = SuccessfulOutcome__value_PR_ResetResponse;
62 resetResponse = &successfulOutcome->value.choice.ResetResponse;
64 resetResponse_ie->id = ProtocolIE_ID_id_CriticalityDiagnostics;
65 resetResponse_ie->criticality = Criticality_ignore;
66 resetResponse_ie->value.present = ResetResponse_IEs__value_PR_CriticalityDiagnostics;
68 ASN_SEQUENCE_ADD(&resetResponse->protocolIEs, resetResponse_ie);
70 CriticalityDiagnostics_IE_List_t *critList = calloc(1, sizeof(CriticalityDiagnostics_IE_List_t));
71 assert(critList != 0);
73 CriticalityDiagnostics_IE_List__Member *member= calloc(1, sizeof(CriticalityDiagnostics_IE_List__Member));
76 ASN_SEQUENCE_ADD(critList ,member);
77 ASN_SEQUENCE_ADD(resetResponse_ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics, critList);
79 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
80 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);