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.
24 #include <asn_application.h>
26 #include <ProcedureCode.h>
27 #include <SuccessfulOutcome.h>
28 #include <UnsuccessfulOutcome.h>
29 #include <ProtocolIE-ID.h>
30 #include <ProtocolIE-Field.h>
31 #include <configuration_update_wrapper.h>
34 * Build and pack ENB Configuration Update Acknowledge (successful outcome response).
35 * Abort the process on allocation failure.
36 * packed_buf_size - in: size of packed_buf; out: number of chars used.
39 build_pack_x2enb_configuration_update_ack(
40 size_t* packed_buf_size,
41 unsigned char* packed_buf,
46 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
47 SuccessfulOutcome_t *successfulOutcome = calloc(1, sizeof(SuccessfulOutcome_t));
48 ENBConfigurationUpdateAcknowledge_t *enbConfigurationUpdateAcknowledge;
49 ENBConfigurationUpdateAcknowledge_IEs_t *enbConfigurationUpdateAcknowledge_IEs = calloc(1, sizeof(ENBConfigurationUpdateAcknowledge_IEs_t));
52 assert(successfulOutcome != 0);
53 assert(enbConfigurationUpdateAcknowledge_IEs != 0);
55 pdu->present = E2AP_PDU_PR_successfulOutcome;
56 pdu->choice.successfulOutcome = successfulOutcome;
58 successfulOutcome->procedureCode = ProcedureCode_id_eNBConfigurationUpdate;
59 successfulOutcome->criticality = Criticality_reject;
60 successfulOutcome->value.present = SuccessfulOutcome__value_PR_ENBConfigurationUpdateAcknowledge;
61 enbConfigurationUpdateAcknowledge = &successfulOutcome->value.choice.ENBConfigurationUpdateAcknowledge;
63 enbConfigurationUpdateAcknowledge_IEs->id = ProtocolIE_ID_id_CriticalityDiagnostics;
64 enbConfigurationUpdateAcknowledge_IEs->criticality = Criticality_ignore;
65 enbConfigurationUpdateAcknowledge_IEs->value.present = ENBConfigurationUpdateAcknowledge_IEs__value_PR_CriticalityDiagnostics;
67 ASN_SEQUENCE_ADD(&enbConfigurationUpdateAcknowledge->protocolIEs, enbConfigurationUpdateAcknowledge_IEs);
69 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
71 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
76 * Build and pack ENB Configuration Update Failure (unsuccessful outcome message).
77 * Abort the process on allocation failure.
78 * packed_buf_size - in: size of packed_buf; out: number of chars used.
81 build_pack_x2enb_configuration_update_failure(
82 size_t* packed_buf_size,
83 unsigned char* packed_buf,
88 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
89 UnsuccessfulOutcome_t *unsuccessfulOutcome = calloc(1, sizeof(UnsuccessfulOutcome_t));
90 ENBConfigurationUpdateFailure_t *enbConfigurationUpdateFailure;
91 ENBConfigurationUpdateFailure_IEs_t *enbConfigurationUpdateFailure_IEs = calloc(1, sizeof(ENBConfigurationUpdateFailure_IEs_t));
94 assert(unsuccessfulOutcome != 0);
95 assert(enbConfigurationUpdateFailure_IEs != 0);
98 pdu->present = E2AP_PDU_PR_unsuccessfulOutcome;
99 pdu->choice.unsuccessfulOutcome = unsuccessfulOutcome;
101 unsuccessfulOutcome->procedureCode = ProcedureCode_id_eNBConfigurationUpdate;
102 unsuccessfulOutcome->criticality = Criticality_reject;
103 unsuccessfulOutcome->value.present = UnsuccessfulOutcome__value_PR_ENBConfigurationUpdateFailure;
104 enbConfigurationUpdateFailure = &unsuccessfulOutcome->value.choice.ENBConfigurationUpdateFailure;
106 enbConfigurationUpdateFailure_IEs->id = ProtocolIE_ID_id_Cause;
107 enbConfigurationUpdateFailure_IEs->criticality = Criticality_ignore;
108 enbConfigurationUpdateFailure_IEs->value.present = ENBConfigurationUpdateFailure_IEs__value_PR_Cause;
109 enbConfigurationUpdateFailure_IEs->value.choice.Cause.present = Cause_PR_protocol;
110 enbConfigurationUpdateFailure_IEs->value.choice.Cause.choice.protocol= CauseProtocol_abstract_syntax_error_reject;
111 ASN_SEQUENCE_ADD(&enbConfigurationUpdateFailure->protocolIEs, enbConfigurationUpdateFailure_IEs);
114 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
116 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
121 * Build and pack ENDC Configuration Update Acknowledge (successful outcome response).
122 * Abort the process on allocation failure.
123 * packed_buf_size - in: size of packed_buf; out: number of chars used.
126 build_pack_endc_configuration_update_ack(
127 size_t* packed_buf_size,
128 unsigned char* packed_buf,
133 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
134 SuccessfulOutcome_t *successfulOutcome = calloc(1, sizeof(SuccessfulOutcome_t));
135 ENDCConfigurationUpdateAcknowledge_t *endcConfigurationUpdateAcknowledge;
136 ENDCConfigurationUpdateAcknowledge_IEs_t *endcConfigurationUpdateAcknowledge_IEs = calloc(1, sizeof(ENDCConfigurationUpdateAcknowledge_IEs_t));
139 assert(successfulOutcome != 0);
140 assert(endcConfigurationUpdateAcknowledge_IEs != 0);
142 pdu->present = E2AP_PDU_PR_successfulOutcome;
143 pdu->choice.successfulOutcome = successfulOutcome;
145 successfulOutcome->procedureCode = ProcedureCode_id_endcConfigurationUpdate;
146 successfulOutcome->criticality = Criticality_reject;
147 successfulOutcome->value.present = SuccessfulOutcome__value_PR_ENDCConfigurationUpdateAcknowledge;
148 endcConfigurationUpdateAcknowledge = &successfulOutcome->value.choice.ENDCConfigurationUpdateAcknowledge;
149 ASN_SEQUENCE_ADD(&endcConfigurationUpdateAcknowledge->protocolIEs, endcConfigurationUpdateAcknowledge_IEs);
151 endcConfigurationUpdateAcknowledge_IEs->id = ProtocolIE_ID_id_RespondingNodeType_EndcConfigUpdate;
152 endcConfigurationUpdateAcknowledge_IEs->criticality = Criticality_reject;
153 endcConfigurationUpdateAcknowledge_IEs->value.present = ENDCConfigurationUpdateAcknowledge_IEs__value_PR_RespondingNodeType_EndcConfigUpdate;
154 endcConfigurationUpdateAcknowledge_IEs->value.choice.RespondingNodeType_EndcConfigUpdate.present = RespondingNodeType_EndcConfigUpdate_PR_respond_eNB;
156 ProtocolIE_Container_119P95_t *enb_ENDCConfigUpdateAckIEs_Container = calloc(1, sizeof(ProtocolIE_Container_119P95_t));
157 assert(enb_ENDCConfigUpdateAckIEs_Container != 0);
158 endcConfigurationUpdateAcknowledge_IEs->value.choice.RespondingNodeType_EndcConfigUpdate.choice.respond_eNB = (struct ProtocolIE_Container*)enb_ENDCConfigUpdateAckIEs_Container;
160 //Leave the respond_eNB container empty (ENB_ENDCConfigUpdateAckIEs_t is an empty element).
162 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
164 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
169 * Build and pack ENDC Configuration Update Failure (unsuccessful outcome message).
170 * Abort the process on allocation failure.
171 * packed_buf_size - in: size of packed_buf; out: number of chars used.
174 build_pack_endc_configuration_update_failure(
175 size_t* packed_buf_size,
176 unsigned char* packed_buf,
181 E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
182 UnsuccessfulOutcome_t *unsuccessfulOutcome = calloc(1, sizeof(UnsuccessfulOutcome_t));
183 ENDCConfigurationUpdateFailure_t *endcConfigurationUpdateFailure;
184 ENDCConfigurationUpdateFailure_IEs_t *endcConfigurationUpdateFailure_IEs = calloc(1, sizeof(ENDCConfigurationUpdateFailure_IEs_t));
187 assert(unsuccessfulOutcome != 0);
188 assert(endcConfigurationUpdateFailure_IEs != 0);
191 pdu->present = E2AP_PDU_PR_unsuccessfulOutcome;
192 pdu->choice.unsuccessfulOutcome = unsuccessfulOutcome;
194 unsuccessfulOutcome->procedureCode = ProcedureCode_id_endcConfigurationUpdate;
195 unsuccessfulOutcome->criticality = Criticality_reject;
196 unsuccessfulOutcome->value.present = UnsuccessfulOutcome__value_PR_ENDCConfigurationUpdateFailure;
197 endcConfigurationUpdateFailure = &unsuccessfulOutcome->value.choice.ENDCConfigurationUpdateFailure;
199 endcConfigurationUpdateFailure_IEs->id = ProtocolIE_ID_id_Cause;
200 endcConfigurationUpdateFailure_IEs->criticality = Criticality_ignore;
201 endcConfigurationUpdateFailure_IEs->value.present = ENDCConfigurationUpdateFailure_IEs__value_PR_Cause;
202 endcConfigurationUpdateFailure_IEs->value.choice.Cause.present = Cause_PR_protocol;
203 endcConfigurationUpdateFailure_IEs->value.choice.Cause.choice.protocol= CauseProtocol_abstract_syntax_error_reject;
204 ASN_SEQUENCE_ADD(&endcConfigurationUpdateFailure->protocolIEs, endcConfigurationUpdateFailure_IEs);
206 rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
208 ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);