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 <UnsuccessfulOutcome.h>
33 #include <ProtocolIE-ID.h>
34 #include <ProtocolIE-Field.h>
35 #include <configuration_update_wrapper.h>
38 * Build and pack ENB Configuration Update Acknowledge (successful outcome response).
39 * Abort the process on allocation failure.
40 * packed_buf_size - in: size of packed_buf; out: number of chars used.
43 build_pack_x2enb_configuration_update_ack(
44 size_t* packed_buf_size,
45 unsigned char* packed_buf,
50 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
51 SuccessfulOutcome_t *successfulOutcome = calloc(1, sizeof(SuccessfulOutcome_t));
52 ENBConfigurationUpdateAcknowledge_t *enbConfigurationUpdateAcknowledge;
53 ENBConfigurationUpdateAcknowledge_IEs_t *enbConfigurationUpdateAcknowledge_IEs = calloc(1, sizeof(ENBConfigurationUpdateAcknowledge_IEs_t));
56 assert(successfulOutcome != 0);
57 assert(enbConfigurationUpdateAcknowledge_IEs != 0);
59 pdu->present = E2AP_PDU_PR_successfulOutcome;
60 pdu->choice.successfulOutcome = successfulOutcome;
62 successfulOutcome->procedureCode = ProcedureCode_id_eNBConfigurationUpdate;
63 successfulOutcome->criticality = Criticality_reject;
64 successfulOutcome->value.present = SuccessfulOutcome__value_PR_ENBConfigurationUpdateAcknowledge;
65 enbConfigurationUpdateAcknowledge = &successfulOutcome->value.choice.ENBConfigurationUpdateAcknowledge;
67 enbConfigurationUpdateAcknowledge_IEs->id = ProtocolIE_ID_id_CriticalityDiagnostics;
68 enbConfigurationUpdateAcknowledge_IEs->criticality = Criticality_ignore;
69 enbConfigurationUpdateAcknowledge_IEs->value.present = ENBConfigurationUpdateAcknowledge_IEs__value_PR_CriticalityDiagnostics;
71 ASN_SEQUENCE_ADD(&enbConfigurationUpdateAcknowledge->protocolIEs, enbConfigurationUpdateAcknowledge_IEs);
73 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
75 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
80 * Build and pack ENB Configuration Update Failure (unsuccessful outcome message).
81 * Abort the process on allocation failure.
82 * packed_buf_size - in: size of packed_buf; out: number of chars used.
85 build_pack_x2enb_configuration_update_failure(
86 size_t* packed_buf_size,
87 unsigned char* packed_buf,
92 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
93 UnsuccessfulOutcome_t *unsuccessfulOutcome = calloc(1, sizeof(UnsuccessfulOutcome_t));
94 ENBConfigurationUpdateFailure_t *enbConfigurationUpdateFailure;
95 ENBConfigurationUpdateFailure_IEs_t *enbConfigurationUpdateFailure_IEs = calloc(1, sizeof(ENBConfigurationUpdateFailure_IEs_t));
98 assert(unsuccessfulOutcome != 0);
99 assert(enbConfigurationUpdateFailure_IEs != 0);
102 pdu->present = E2AP_PDU_PR_unsuccessfulOutcome;
103 pdu->choice.unsuccessfulOutcome = unsuccessfulOutcome;
105 unsuccessfulOutcome->procedureCode = ProcedureCode_id_eNBConfigurationUpdate;
106 unsuccessfulOutcome->criticality = Criticality_reject;
107 unsuccessfulOutcome->value.present = UnsuccessfulOutcome__value_PR_ENBConfigurationUpdateFailure;
108 enbConfigurationUpdateFailure = &unsuccessfulOutcome->value.choice.ENBConfigurationUpdateFailure;
110 enbConfigurationUpdateFailure_IEs->id = ProtocolIE_ID_id_Cause;
111 enbConfigurationUpdateFailure_IEs->criticality = Criticality_ignore;
112 enbConfigurationUpdateFailure_IEs->value.present = ENBConfigurationUpdateFailure_IEs__value_PR_Cause;
113 enbConfigurationUpdateFailure_IEs->value.choice.Cause.present = Cause_PR_protocol;
114 enbConfigurationUpdateFailure_IEs->value.choice.Cause.choice.protocol= CauseProtocol_abstract_syntax_error_reject;
115 ASN_SEQUENCE_ADD(&enbConfigurationUpdateFailure->protocolIEs, enbConfigurationUpdateFailure_IEs);
118 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
120 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
125 * Build and pack ENDC Configuration Update Acknowledge (successful outcome response).
126 * Abort the process on allocation failure.
127 * packed_buf_size - in: size of packed_buf; out: number of chars used.
130 build_pack_endc_configuration_update_ack(
131 size_t* packed_buf_size,
132 unsigned char* packed_buf,
137 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
138 SuccessfulOutcome_t *successfulOutcome = calloc(1, sizeof(SuccessfulOutcome_t));
139 ENDCConfigurationUpdateAcknowledge_t *endcConfigurationUpdateAcknowledge;
140 ENDCConfigurationUpdateAcknowledge_IEs_t *endcConfigurationUpdateAcknowledge_IEs = calloc(1, sizeof(ENDCConfigurationUpdateAcknowledge_IEs_t));
143 assert(successfulOutcome != 0);
144 assert(endcConfigurationUpdateAcknowledge_IEs != 0);
146 pdu->present = E2AP_PDU_PR_successfulOutcome;
147 pdu->choice.successfulOutcome = successfulOutcome;
149 successfulOutcome->procedureCode = ProcedureCode_id_endcConfigurationUpdate;
150 successfulOutcome->criticality = Criticality_reject;
151 successfulOutcome->value.present = SuccessfulOutcome__value_PR_ENDCConfigurationUpdateAcknowledge;
152 endcConfigurationUpdateAcknowledge = &successfulOutcome->value.choice.ENDCConfigurationUpdateAcknowledge;
153 ASN_SEQUENCE_ADD(&endcConfigurationUpdateAcknowledge->protocolIEs, endcConfigurationUpdateAcknowledge_IEs);
155 endcConfigurationUpdateAcknowledge_IEs->id = ProtocolIE_ID_id_RespondingNodeType_EndcConfigUpdate;
156 endcConfigurationUpdateAcknowledge_IEs->criticality = Criticality_reject;
157 endcConfigurationUpdateAcknowledge_IEs->value.present = ENDCConfigurationUpdateAcknowledge_IEs__value_PR_RespondingNodeType_EndcConfigUpdate;
158 endcConfigurationUpdateAcknowledge_IEs->value.choice.RespondingNodeType_EndcConfigUpdate.present = RespondingNodeType_EndcConfigUpdate_PR_respond_eNB;
160 ProtocolIE_Container_119P95_t *enb_ENDCConfigUpdateAckIEs_Container = calloc(1, sizeof(ProtocolIE_Container_119P95_t));
161 assert(enb_ENDCConfigUpdateAckIEs_Container != 0);
162 endcConfigurationUpdateAcknowledge_IEs->value.choice.RespondingNodeType_EndcConfigUpdate.choice.respond_eNB = (struct ProtocolIE_Container*)enb_ENDCConfigUpdateAckIEs_Container;
164 //Leave the respond_eNB container empty (ENB_ENDCConfigUpdateAckIEs_t is an empty element).
166 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
168 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
173 * Build and pack ENDC Configuration Update Failure (unsuccessful outcome message).
174 * Abort the process on allocation failure.
175 * packed_buf_size - in: size of packed_buf; out: number of chars used.
178 build_pack_endc_configuration_update_failure(
179 size_t* packed_buf_size,
180 unsigned char* packed_buf,
185 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
186 UnsuccessfulOutcome_t *unsuccessfulOutcome = calloc(1, sizeof(UnsuccessfulOutcome_t));
187 ENDCConfigurationUpdateFailure_t *endcConfigurationUpdateFailure;
188 ENDCConfigurationUpdateFailure_IEs_t *endcConfigurationUpdateFailure_IEs = calloc(1, sizeof(ENDCConfigurationUpdateFailure_IEs_t));
191 assert(unsuccessfulOutcome != 0);
192 assert(endcConfigurationUpdateFailure_IEs != 0);
195 pdu->present = E2AP_PDU_PR_unsuccessfulOutcome;
196 pdu->choice.unsuccessfulOutcome = unsuccessfulOutcome;
198 unsuccessfulOutcome->procedureCode = ProcedureCode_id_endcConfigurationUpdate;
199 unsuccessfulOutcome->criticality = Criticality_reject;
200 unsuccessfulOutcome->value.present = UnsuccessfulOutcome__value_PR_ENDCConfigurationUpdateFailure;
201 endcConfigurationUpdateFailure = &unsuccessfulOutcome->value.choice.ENDCConfigurationUpdateFailure;
203 endcConfigurationUpdateFailure_IEs->id = ProtocolIE_ID_id_Cause;
204 endcConfigurationUpdateFailure_IEs->criticality = Criticality_ignore;
205 endcConfigurationUpdateFailure_IEs->value.present = ENDCConfigurationUpdateFailure_IEs__value_PR_Cause;
206 endcConfigurationUpdateFailure_IEs->value.choice.Cause.present = Cause_PR_protocol;
207 endcConfigurationUpdateFailure_IEs->value.choice.Cause.choice.protocol= CauseProtocol_abstract_syntax_error_reject;
208 ASN_SEQUENCE_ADD(&endcConfigurationUpdateFailure->protocolIEs, endcConfigurationUpdateFailure_IEs);
210 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
212 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);