3 * Copyright 2019 AT&T Intellectual Property
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 /*******************************************************************************
22 * Copyright (c) 2019 AT&T Intellectual Property.
24 * Licensed under the Apache License, Version 2.0 (the "License");
25 * you may not use this file except in compliance with the License.
26 * You may obtain a copy of the License at
28 * http://www.apache.org/licenses/LICENSE-2.0
30 * Unless required by applicable law or agreed to in writing, software
31 * distributed under the License is distributed on an "AS IS" BASIS,
32 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 * See the License for the specific language governing permissions and
34 * limitations under the License.
36 *******************************************************************************/
38 // Standard Includes: ANSI C/C++, MSA, and Third-Party Libraries
40 // Platform Includes: Platform specific classes, functions, and libraries
42 // Local Includes: Application specific classes, functions, and libraries
48 #include <asn_application.h>
50 #include <ProcedureCode.h>
51 #include <SuccessfulOutcome.h>
52 #include <UnsuccessfulOutcome.h>
53 #include <ProtocolIE-ID.h>
54 #include <ProtocolIE-Field.h>
55 #include <configuration_update_wrapper.h>
58 * Build and pack ENB Configuration Update Acknowledge (successful outcome response).
59 * Abort the process on allocation failure.
60 * packed_buf_size - in: size of packed_buf; out: number of chars used.
63 build_pack_x2enb_configuration_update_ack(
64 size_t* packed_buf_size,
65 unsigned char* packed_buf,
70 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
71 SuccessfulOutcome_t *successfulOutcome = calloc(1, sizeof(SuccessfulOutcome_t));
72 ENBConfigurationUpdateAcknowledge_t *enbConfigurationUpdateAcknowledge;
73 ENBConfigurationUpdateAcknowledge_IEs_t *enbConfigurationUpdateAcknowledge_IEs = calloc(1, sizeof(ENBConfigurationUpdateAcknowledge_IEs_t));
76 assert(successfulOutcome != 0);
77 assert(enbConfigurationUpdateAcknowledge_IEs != 0);
79 pdu->present = E2AP_PDU_PR_successfulOutcome;
80 pdu->choice.successfulOutcome = successfulOutcome;
82 successfulOutcome->procedureCode = ProcedureCode_id_eNBConfigurationUpdate;
83 successfulOutcome->criticality = Criticality_reject;
84 successfulOutcome->value.present = SuccessfulOutcome__value_PR_ENBConfigurationUpdateAcknowledge;
85 enbConfigurationUpdateAcknowledge = &successfulOutcome->value.choice.ENBConfigurationUpdateAcknowledge;
87 enbConfigurationUpdateAcknowledge_IEs->id = ProtocolIE_ID_id_CriticalityDiagnostics;
88 enbConfigurationUpdateAcknowledge_IEs->criticality = Criticality_ignore;
89 enbConfigurationUpdateAcknowledge_IEs->value.present = ENBConfigurationUpdateAcknowledge_IEs__value_PR_CriticalityDiagnostics;
91 ASN_SEQUENCE_ADD(&enbConfigurationUpdateAcknowledge->protocolIEs, enbConfigurationUpdateAcknowledge_IEs);
93 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
95 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
100 * Build and pack ENB Configuration Update Failure (unsuccessful outcome message).
101 * Abort the process on allocation failure.
102 * packed_buf_size - in: size of packed_buf; out: number of chars used.
105 build_pack_x2enb_configuration_update_failure(
106 size_t* packed_buf_size,
107 unsigned char* packed_buf,
112 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
113 UnsuccessfulOutcome_t *unsuccessfulOutcome = calloc(1, sizeof(UnsuccessfulOutcome_t));
114 ENBConfigurationUpdateFailure_t *enbConfigurationUpdateFailure;
115 ENBConfigurationUpdateFailure_IEs_t *enbConfigurationUpdateFailure_IEs = calloc(1, sizeof(ENBConfigurationUpdateFailure_IEs_t));
118 assert(unsuccessfulOutcome != 0);
119 assert(enbConfigurationUpdateFailure_IEs != 0);
122 pdu->present = E2AP_PDU_PR_unsuccessfulOutcome;
123 pdu->choice.unsuccessfulOutcome = unsuccessfulOutcome;
125 unsuccessfulOutcome->procedureCode = ProcedureCode_id_eNBConfigurationUpdate;
126 unsuccessfulOutcome->criticality = Criticality_reject;
127 unsuccessfulOutcome->value.present = UnsuccessfulOutcome__value_PR_ENBConfigurationUpdateFailure;
128 enbConfigurationUpdateFailure = &unsuccessfulOutcome->value.choice.ENBConfigurationUpdateFailure;
130 enbConfigurationUpdateFailure_IEs->id = ProtocolIE_ID_id_Cause;
131 enbConfigurationUpdateFailure_IEs->criticality = Criticality_ignore;
132 enbConfigurationUpdateFailure_IEs->value.present = ENBConfigurationUpdateFailure_IEs__value_PR_Cause;
133 enbConfigurationUpdateFailure_IEs->value.choice.Cause.present = Cause_PR_protocol;
134 enbConfigurationUpdateFailure_IEs->value.choice.Cause.choice.protocol= CauseProtocol_abstract_syntax_error_reject;
135 ASN_SEQUENCE_ADD(&enbConfigurationUpdateFailure->protocolIEs, enbConfigurationUpdateFailure_IEs);
138 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
140 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
145 * Build and pack ENDC Configuration Update Acknowledge (successful outcome response).
146 * Abort the process on allocation failure.
147 * packed_buf_size - in: size of packed_buf; out: number of chars used.
150 build_pack_endc_configuration_update_ack(
151 size_t* packed_buf_size,
152 unsigned char* packed_buf,
157 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
158 SuccessfulOutcome_t *successfulOutcome = calloc(1, sizeof(SuccessfulOutcome_t));
159 ENDCConfigurationUpdateAcknowledge_t *endcConfigurationUpdateAcknowledge;
160 ENDCConfigurationUpdateAcknowledge_IEs_t *endcConfigurationUpdateAcknowledge_IEs = calloc(1, sizeof(ENDCConfigurationUpdateAcknowledge_IEs_t));
163 assert(successfulOutcome != 0);
164 assert(endcConfigurationUpdateAcknowledge_IEs != 0);
166 pdu->present = E2AP_PDU_PR_successfulOutcome;
167 pdu->choice.successfulOutcome = successfulOutcome;
169 successfulOutcome->procedureCode = ProcedureCode_id_endcConfigurationUpdate;
170 successfulOutcome->criticality = Criticality_reject;
171 successfulOutcome->value.present = SuccessfulOutcome__value_PR_ENDCConfigurationUpdateAcknowledge;
172 endcConfigurationUpdateAcknowledge = &successfulOutcome->value.choice.ENDCConfigurationUpdateAcknowledge;
173 ASN_SEQUENCE_ADD(&endcConfigurationUpdateAcknowledge->protocolIEs, endcConfigurationUpdateAcknowledge_IEs);
175 endcConfigurationUpdateAcknowledge_IEs->id = ProtocolIE_ID_id_RespondingNodeType_EndcConfigUpdate;
176 endcConfigurationUpdateAcknowledge_IEs->criticality = Criticality_reject;
177 endcConfigurationUpdateAcknowledge_IEs->value.present = ENDCConfigurationUpdateAcknowledge_IEs__value_PR_RespondingNodeType_EndcConfigUpdate;
178 endcConfigurationUpdateAcknowledge_IEs->value.choice.RespondingNodeType_EndcConfigUpdate.present = RespondingNodeType_EndcConfigUpdate_PR_respond_eNB;
180 ProtocolIE_Container_119P95_t *enb_ENDCConfigUpdateAckIEs_Container = calloc(1, sizeof(ProtocolIE_Container_119P95_t));
181 assert(enb_ENDCConfigUpdateAckIEs_Container != 0);
182 endcConfigurationUpdateAcknowledge_IEs->value.choice.RespondingNodeType_EndcConfigUpdate.choice.respond_eNB = (struct ProtocolIE_Container*)enb_ENDCConfigUpdateAckIEs_Container;
184 //Leave the respond_eNB container empty (ENB_ENDCConfigUpdateAckIEs_t is an empty element).
186 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
188 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
193 * Build and pack ENDC Configuration Update Failure (unsuccessful outcome message).
194 * Abort the process on allocation failure.
195 * packed_buf_size - in: size of packed_buf; out: number of chars used.
198 build_pack_endc_configuration_update_failure(
199 size_t* packed_buf_size,
200 unsigned char* packed_buf,
205 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
206 UnsuccessfulOutcome_t *unsuccessfulOutcome = calloc(1, sizeof(UnsuccessfulOutcome_t));
207 ENDCConfigurationUpdateFailure_t *endcConfigurationUpdateFailure;
208 ENDCConfigurationUpdateFailure_IEs_t *endcConfigurationUpdateFailure_IEs = calloc(1, sizeof(ENDCConfigurationUpdateFailure_IEs_t));
211 assert(unsuccessfulOutcome != 0);
212 assert(endcConfigurationUpdateFailure_IEs != 0);
215 pdu->present = E2AP_PDU_PR_unsuccessfulOutcome;
216 pdu->choice.unsuccessfulOutcome = unsuccessfulOutcome;
218 unsuccessfulOutcome->procedureCode = ProcedureCode_id_endcConfigurationUpdate;
219 unsuccessfulOutcome->criticality = Criticality_reject;
220 unsuccessfulOutcome->value.present = UnsuccessfulOutcome__value_PR_ENDCConfigurationUpdateFailure;
221 endcConfigurationUpdateFailure = &unsuccessfulOutcome->value.choice.ENDCConfigurationUpdateFailure;
223 endcConfigurationUpdateFailure_IEs->id = ProtocolIE_ID_id_Cause;
224 endcConfigurationUpdateFailure_IEs->criticality = Criticality_ignore;
225 endcConfigurationUpdateFailure_IEs->value.present = ENDCConfigurationUpdateFailure_IEs__value_PR_Cause;
226 endcConfigurationUpdateFailure_IEs->value.choice.Cause.present = Cause_PR_protocol;
227 endcConfigurationUpdateFailure_IEs->value.choice.Cause.choice.protocol= CauseProtocol_abstract_syntax_error_reject;
228 ASN_SEQUENCE_ADD(&endcConfigurationUpdateFailure->protocolIEs, endcConfigurationUpdateFailure_IEs);
230 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
232 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);