blob: 521ecab9f2859aae91c90ab310d51baba57a81b1 [file] [log] [blame]
Harald Weltee180c162015-08-29 20:34:40 +02001/*******************************************************************************
2
3 Eurecom OpenAirInterface
4 Copyright(c) 1999 - 2012 Eurecom
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Contact Information
23 Openair Admin: openair_admin@eurecom.fr
24 Openair Tech : openair_tech@eurecom.fr
25 Forums : http://forums.eurecom.fr/openairinterface
26 Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
27 06410 Biot FRANCE
28
29*******************************************************************************/
30
31/*******************************************************************************
32 * This file had been created by asn1tostruct.py script v0.5
33 * Please do not modify this file but regenerate it via script.
34 * Created on: 2015-08-29 14:31:31.109013 by laforge
35 * from ['../RUA-CommonDataTypes.asn', '../RUA-Constants.asn', '../RUA-Containers.asn', '../RUA-IEs.asn', '../RUA-PDU-Contents.asn', '../RUA-PDU-Descriptions.asn']
36 ******************************************************************************/
37#include "rua_common.h"
38#include "rua_ies_defs.h"
39
40int rua_decode_connecties(
41 ConnectIEs_t *connectIEs,
42 ANY_t *any_p) {
43
44 Connect_t connect;
45 Connect_t *connect_p = &connect;
46 int i, decoded = 0;
47 int tempDecoded = 0;
48 assert(any_p != NULL);
49 assert(connectIEs != NULL);
50
51 RUA_DEBUG("Decoding message ConnectIEs (%s:%d)\n", __FILE__, __LINE__);
52
53 ANY_to_type_aper(any_p, &asn_DEF_Connect, (void**)&connect_p);
54
55 for (i = 0; i < connect_p->connect_ies.list.count; i++) {
56 IE_t *ie_p;
57 ie_p = connect_p->connect_ies.list.array[i];
58 switch(ie_p->id) {
59 case ProtocolIE_ID_id_CN_DomainIndicator:
60 {
61 CN_DomainIndicator_t cnDomainIndicator;
62 CN_DomainIndicator_t *cnDomainIndicator_p = &cnDomainIndicator;
63 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_CN_DomainIndicator, (void**)&cnDomainIndicator_p);
64 if (tempDecoded < 0) {
65 RUA_DEBUG("Decoding of IE cN_DomainIndicator failed\n");
66 return -1;
67 }
68 decoded += tempDecoded;
69 if (asn1_xer_print)
70 xer_fprint(stdout, &asn_DEF_CN_DomainIndicator, cnDomainIndicator_p);
71 memcpy(&connectIEs->cN_DomainIndicator, cnDomainIndicator_p, sizeof(CN_DomainIndicator_t));
72 } break;
73 case ProtocolIE_ID_id_Context_ID:
74 {
75 Context_ID_t contextID;
76 Context_ID_t *contextID_p = &contextID;
77 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_Context_ID, (void**)&contextID_p);
78 if (tempDecoded < 0) {
79 RUA_DEBUG("Decoding of IE context_ID failed\n");
80 return -1;
81 }
82 decoded += tempDecoded;
83 if (asn1_xer_print)
84 xer_fprint(stdout, &asn_DEF_Context_ID, contextID_p);
85 memcpy(&connectIEs->context_ID, contextID_p, sizeof(Context_ID_t));
86 } break;
87 /* Optional field */
88 case ProtocolIE_ID_id_IntraDomainNasNodeSelector:
89 {
90 IntraDomainNasNodeSelector_t intraDomainNasNodeSelector;
91 IntraDomainNasNodeSelector_t *intraDomainNasNodeSelector_p = &intraDomainNasNodeSelector;
92 connectIEs->presenceMask |= CONNECTIES_INTRADOMAINNASNODESELECTOR_PRESENT;
93 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_IntraDomainNasNodeSelector, (void**)&intraDomainNasNodeSelector_p);
94 if (tempDecoded < 0) {
95 RUA_DEBUG("Decoding of IE intraDomainNasNodeSelector failed\n");
96 return -1;
97 }
98 decoded += tempDecoded;
99 if (asn1_xer_print)
100 xer_fprint(stdout, &asn_DEF_IntraDomainNasNodeSelector, intraDomainNasNodeSelector_p);
101 memcpy(&connectIEs->intraDomainNasNodeSelector, intraDomainNasNodeSelector_p, sizeof(IntraDomainNasNodeSelector_t));
102 } break;
103 case ProtocolIE_ID_id_Establishment_Cause:
104 {
105 Establishment_Cause_t establishmentCause;
106 Establishment_Cause_t *establishmentCause_p = &establishmentCause;
107 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_Establishment_Cause, (void**)&establishmentCause_p);
108 if (tempDecoded < 0) {
109 RUA_DEBUG("Decoding of IE establishment_Cause failed\n");
110 return -1;
111 }
112 decoded += tempDecoded;
113 if (asn1_xer_print)
114 xer_fprint(stdout, &asn_DEF_Establishment_Cause, establishmentCause_p);
115 memcpy(&connectIEs->establishment_Cause, establishmentCause_p, sizeof(Establishment_Cause_t));
116 } break;
117 case ProtocolIE_ID_id_RANAP_Message:
118 {
119 RANAP_Message_t ranapMessage;
120 RANAP_Message_t *ranapMessage_p = &ranapMessage;
121 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_RANAP_Message, (void**)&ranapMessage_p);
122 if (tempDecoded < 0) {
123 RUA_DEBUG("Decoding of IE ranaP_Message failed\n");
124 return -1;
125 }
126 decoded += tempDecoded;
127 if (asn1_xer_print)
128 xer_fprint(stdout, &asn_DEF_RANAP_Message, ranapMessage_p);
129 memcpy(&connectIEs->ranaP_Message, ranapMessage_p, sizeof(RANAP_Message_t));
130 } break;
131 default:
132 RUA_DEBUG("Unknown protocol IE id (%d) for message connecties\n", (int)ie_p->id);
133 return -1;
134 }
135 }
136 return decoded;
137}
138
139int rua_decode_disconnecties(
140 DisconnectIEs_t *disconnectIEs,
141 ANY_t *any_p) {
142
143 Disconnect_t disconnect;
144 Disconnect_t *disconnect_p = &disconnect;
145 int i, decoded = 0;
146 int tempDecoded = 0;
147 assert(any_p != NULL);
148 assert(disconnectIEs != NULL);
149
150 RUA_DEBUG("Decoding message DisconnectIEs (%s:%d)\n", __FILE__, __LINE__);
151
152 ANY_to_type_aper(any_p, &asn_DEF_Disconnect, (void**)&disconnect_p);
153
154 for (i = 0; i < disconnect_p->disconnect_ies.list.count; i++) {
155 IE_t *ie_p;
156 ie_p = disconnect_p->disconnect_ies.list.array[i];
157 switch(ie_p->id) {
158 case ProtocolIE_ID_id_CN_DomainIndicator:
159 {
160 CN_DomainIndicator_t cnDomainIndicator;
161 CN_DomainIndicator_t *cnDomainIndicator_p = &cnDomainIndicator;
162 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_CN_DomainIndicator, (void**)&cnDomainIndicator_p);
163 if (tempDecoded < 0) {
164 RUA_DEBUG("Decoding of IE cN_DomainIndicator failed\n");
165 return -1;
166 }
167 decoded += tempDecoded;
168 if (asn1_xer_print)
169 xer_fprint(stdout, &asn_DEF_CN_DomainIndicator, cnDomainIndicator_p);
170 memcpy(&disconnectIEs->cN_DomainIndicator, cnDomainIndicator_p, sizeof(CN_DomainIndicator_t));
171 } break;
172 case ProtocolIE_ID_id_Context_ID:
173 {
174 Context_ID_t contextID;
175 Context_ID_t *contextID_p = &contextID;
176 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_Context_ID, (void**)&contextID_p);
177 if (tempDecoded < 0) {
178 RUA_DEBUG("Decoding of IE context_ID failed\n");
179 return -1;
180 }
181 decoded += tempDecoded;
182 if (asn1_xer_print)
183 xer_fprint(stdout, &asn_DEF_Context_ID, contextID_p);
184 memcpy(&disconnectIEs->context_ID, contextID_p, sizeof(Context_ID_t));
185 } break;
186 case ProtocolIE_ID_id_Cause:
187 {
188 Cause_t cause;
189 Cause_t *cause_p = &cause;
190 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_Cause, (void**)&cause_p);
191 if (tempDecoded < 0) {
192 RUA_DEBUG("Decoding of IE cause failed\n");
193 return -1;
194 }
195 decoded += tempDecoded;
196 if (asn1_xer_print)
197 xer_fprint(stdout, &asn_DEF_Cause, cause_p);
198 memcpy(&disconnectIEs->cause, cause_p, sizeof(Cause_t));
199 } break;
200 /* Conditional field */
201 case ProtocolIE_ID_id_RANAP_Message:
202 {
203 RANAP_Message_t ranapMessage;
204 RANAP_Message_t *ranapMessage_p = &ranapMessage;
205 disconnectIEs->presenceMask |= DISCONNECTIES_RANAP_MESSAGE_PRESENT;
206 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_RANAP_Message, (void**)&ranapMessage_p);
207 if (tempDecoded < 0) {
208 RUA_DEBUG("Decoding of IE ranaP_Message failed\n");
209 return -1;
210 }
211 decoded += tempDecoded;
212 if (asn1_xer_print)
213 xer_fprint(stdout, &asn_DEF_RANAP_Message, ranapMessage_p);
214 memcpy(&disconnectIEs->ranaP_Message, ranapMessage_p, sizeof(RANAP_Message_t));
215 } break;
216 default:
217 RUA_DEBUG("Unknown protocol IE id (%d) for message disconnecties\n", (int)ie_p->id);
218 return -1;
219 }
220 }
221 return decoded;
222}
223
224int rua_decode_errorindicationies(
225 ErrorIndicationIEs_t *errorIndicationIEs,
226 ANY_t *any_p) {
227
228 ErrorIndication_t errorIndication;
229 ErrorIndication_t *errorIndication_p = &errorIndication;
230 int i, decoded = 0;
231 int tempDecoded = 0;
232 assert(any_p != NULL);
233 assert(errorIndicationIEs != NULL);
234
235 RUA_DEBUG("Decoding message ErrorIndicationIEs (%s:%d)\n", __FILE__, __LINE__);
236
237 ANY_to_type_aper(any_p, &asn_DEF_ErrorIndication, (void**)&errorIndication_p);
238
239 for (i = 0; i < errorIndication_p->errorIndication_ies.list.count; i++) {
240 IE_t *ie_p;
241 ie_p = errorIndication_p->errorIndication_ies.list.array[i];
242 switch(ie_p->id) {
243 case ProtocolIE_ID_id_Cause:
244 {
245 Cause_t cause;
246 Cause_t *cause_p = &cause;
247 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_Cause, (void**)&cause_p);
248 if (tempDecoded < 0) {
249 RUA_DEBUG("Decoding of IE cause failed\n");
250 return -1;
251 }
252 decoded += tempDecoded;
253 if (asn1_xer_print)
254 xer_fprint(stdout, &asn_DEF_Cause, cause_p);
255 memcpy(&errorIndicationIEs->cause, cause_p, sizeof(Cause_t));
256 } break;
257 /* Optional field */
258 case ProtocolIE_ID_id_CriticalityDiagnostics:
259 {
260 CriticalityDiagnostics_t criticalityDiagnostics;
261 CriticalityDiagnostics_t *criticalityDiagnostics_p = &criticalityDiagnostics;
262 errorIndicationIEs->presenceMask |= ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT;
263 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_CriticalityDiagnostics, (void**)&criticalityDiagnostics_p);
264 if (tempDecoded < 0) {
265 RUA_DEBUG("Decoding of IE criticalityDiagnostics failed\n");
266 return -1;
267 }
268 decoded += tempDecoded;
269 if (asn1_xer_print)
270 xer_fprint(stdout, &asn_DEF_CriticalityDiagnostics, criticalityDiagnostics_p);
271 memcpy(&errorIndicationIEs->criticalityDiagnostics, criticalityDiagnostics_p, sizeof(CriticalityDiagnostics_t));
272 } break;
273 default:
274 RUA_DEBUG("Unknown protocol IE id (%d) for message errorindicationies\n", (int)ie_p->id);
275 return -1;
276 }
277 }
278 return decoded;
279}
280
281int rua_decode_connectionlesstransferies(
282 ConnectionlessTransferIEs_t *connectionlessTransferIEs,
283 ANY_t *any_p) {
284
285 ConnectionlessTransfer_t connectionlessTransfer;
286 ConnectionlessTransfer_t *connectionlessTransfer_p = &connectionlessTransfer;
287 int i, decoded = 0;
288 int tempDecoded = 0;
289 assert(any_p != NULL);
290 assert(connectionlessTransferIEs != NULL);
291
292 RUA_DEBUG("Decoding message ConnectionlessTransferIEs (%s:%d)\n", __FILE__, __LINE__);
293
294 ANY_to_type_aper(any_p, &asn_DEF_ConnectionlessTransfer, (void**)&connectionlessTransfer_p);
295
296 for (i = 0; i < connectionlessTransfer_p->connectionlessTransfer_ies.list.count; i++) {
297 IE_t *ie_p;
298 ie_p = connectionlessTransfer_p->connectionlessTransfer_ies.list.array[i];
299 switch(ie_p->id) {
300 case ProtocolIE_ID_id_RANAP_Message:
301 {
302 RANAP_Message_t ranapMessage;
303 RANAP_Message_t *ranapMessage_p = &ranapMessage;
304 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_RANAP_Message, (void**)&ranapMessage_p);
305 if (tempDecoded < 0) {
306 RUA_DEBUG("Decoding of IE ranaP_Message failed\n");
307 return -1;
308 }
309 decoded += tempDecoded;
310 if (asn1_xer_print)
311 xer_fprint(stdout, &asn_DEF_RANAP_Message, ranapMessage_p);
312 memcpy(&connectionlessTransferIEs->ranaP_Message, ranapMessage_p, sizeof(RANAP_Message_t));
313 } break;
314 default:
315 RUA_DEBUG("Unknown protocol IE id (%d) for message connectionlesstransferies\n", (int)ie_p->id);
316 return -1;
317 }
318 }
319 return decoded;
320}
321
322int rua_decode_directtransferies(
323 DirectTransferIEs_t *directTransferIEs,
324 ANY_t *any_p) {
325
326 DirectTransfer_t directTransfer;
327 DirectTransfer_t *directTransfer_p = &directTransfer;
328 int i, decoded = 0;
329 int tempDecoded = 0;
330 assert(any_p != NULL);
331 assert(directTransferIEs != NULL);
332
333 RUA_DEBUG("Decoding message DirectTransferIEs (%s:%d)\n", __FILE__, __LINE__);
334
335 ANY_to_type_aper(any_p, &asn_DEF_DirectTransfer, (void**)&directTransfer_p);
336
337 for (i = 0; i < directTransfer_p->directTransfer_ies.list.count; i++) {
338 IE_t *ie_p;
339 ie_p = directTransfer_p->directTransfer_ies.list.array[i];
340 switch(ie_p->id) {
341 case ProtocolIE_ID_id_CN_DomainIndicator:
342 {
343 CN_DomainIndicator_t cnDomainIndicator;
344 CN_DomainIndicator_t *cnDomainIndicator_p = &cnDomainIndicator;
345 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_CN_DomainIndicator, (void**)&cnDomainIndicator_p);
346 if (tempDecoded < 0) {
347 RUA_DEBUG("Decoding of IE cN_DomainIndicator failed\n");
348 return -1;
349 }
350 decoded += tempDecoded;
351 if (asn1_xer_print)
352 xer_fprint(stdout, &asn_DEF_CN_DomainIndicator, cnDomainIndicator_p);
353 memcpy(&directTransferIEs->cN_DomainIndicator, cnDomainIndicator_p, sizeof(CN_DomainIndicator_t));
354 } break;
355 case ProtocolIE_ID_id_Context_ID:
356 {
357 Context_ID_t contextID;
358 Context_ID_t *contextID_p = &contextID;
359 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_Context_ID, (void**)&contextID_p);
360 if (tempDecoded < 0) {
361 RUA_DEBUG("Decoding of IE context_ID failed\n");
362 return -1;
363 }
364 decoded += tempDecoded;
365 if (asn1_xer_print)
366 xer_fprint(stdout, &asn_DEF_Context_ID, contextID_p);
367 memcpy(&directTransferIEs->context_ID, contextID_p, sizeof(Context_ID_t));
368 } break;
369 case ProtocolIE_ID_id_RANAP_Message:
370 {
371 RANAP_Message_t ranapMessage;
372 RANAP_Message_t *ranapMessage_p = &ranapMessage;
373 tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_RANAP_Message, (void**)&ranapMessage_p);
374 if (tempDecoded < 0) {
375 RUA_DEBUG("Decoding of IE ranaP_Message failed\n");
376 return -1;
377 }
378 decoded += tempDecoded;
379 if (asn1_xer_print)
380 xer_fprint(stdout, &asn_DEF_RANAP_Message, ranapMessage_p);
381 memcpy(&directTransferIEs->ranaP_Message, ranapMessage_p, sizeof(RANAP_Message_t));
382 } break;
383 default:
384 RUA_DEBUG("Unknown protocol IE id (%d) for message directtransferies\n", (int)ie_p->id);
385 return -1;
386 }
387 }
388 return decoded;
389}
390