1 /*
2  * libpri: An implementation of Primary Rate ISDN
3  *
4  * Copyright (C) 2009 Digium, Inc.
5  *
6  * Richard Mudgett <rmudgett@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2 as published by the
16  * Free Software Foundation. See the LICENSE file included with
17  * this program for more details.
18  *
19  * In addition, when this program is distributed with Asterisk in
20  * any form that would qualify as a 'combined work' or as a
21  * 'derivative work' (but not mere aggregation), you can redistribute
22  * and/or modify the combination under the terms of the license
23  * provided with that copy of Asterisk, instead of the license
24  * terms granted here.
25  */
26 
27 /*!
28  * \file
29  * \brief ROSE Status-Request/CCBS/CCBS-T/CCNR/CCNR-T operations
30  *
31  * Status-Request ETS 300 196-1 D.7
32  * CCBS Supplementary Services ETS 300 359-1
33  * CCNR Supplementary Services ETS 301 065-1
34  *
35  * \author Richard Mudgett <rmudgett@digium.com>
36  */
37 
38 
39 #include "compat.h"
40 #include "libpri.h"
41 #include "pri_internal.h"
42 #include "rose.h"
43 #include "rose_internal.h"
44 #include "asn1.h"
45 
46 
47 /* ------------------------------------------------------------------- */
48 
49 /*!
50  * \internal
51  * \brief Encode the array of call information details type.
52  *
53  * \param ctrl D channel controller for diagnostic messages or global options.
54  * \param pos Starting position to encode ASN.1 component.
55  * \param end End of ASN.1 encoding data buffer.
56  * \param tag Component tag to identify the encoded component.
57  *   The tag should be ASN1_TAG_SEQUENCE unless the caller implicitly
58  *   tags it otherwise.
59  * \param call_information Call information record to encode.
60  *
61  * \retval Start of the next ASN.1 component to encode on success.
62  * \retval NULL on error.
63  */
rose_enc_etsi_CallInformation(struct pri * ctrl,unsigned char * pos,unsigned char * end,unsigned tag,const struct roseEtsiCallInformation * call_information)64 static unsigned char *rose_enc_etsi_CallInformation(struct pri *ctrl, unsigned char *pos,
65 	unsigned char *end, unsigned tag,
66 	const struct roseEtsiCallInformation *call_information)
67 {
68 	unsigned char *seq_len;
69 
70 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, tag);
71 
72 	ASN1_CALL(pos, rose_enc_Address(ctrl, pos, end, ASN1_TAG_SEQUENCE,
73 		&call_information->address_of_b));
74 	ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
75 		&call_information->q931ie));
76 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
77 		call_information->ccbs_reference));
78 	if (call_information->subaddress_of_a.length) {
79 		ASN1_CALL(pos, rose_enc_PartySubaddress(ctrl, pos, end,
80 			&call_information->subaddress_of_a));
81 	}
82 
83 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
84 
85 	return pos;
86 }
87 
88 /*!
89  * \internal
90  * \brief Encode the array of call information details type.
91  *
92  * \param ctrl D channel controller for diagnostic messages or global options.
93  * \param pos Starting position to encode ASN.1 component.
94  * \param end End of ASN.1 encoding data buffer.
95  * \param tag Component tag to identify the encoded component.
96  *   The tag should be ASN1_TAG_SEQUENCE unless the caller implicitly
97  *   tags it otherwise.
98  * \param call_details Call detail list information to encode.
99  *
100  * \retval Start of the next ASN.1 component to encode on success.
101  * \retval NULL on error.
102  */
rose_enc_etsi_CallDetails(struct pri * ctrl,unsigned char * pos,unsigned char * end,unsigned tag,const struct roseEtsiCallDetailsList * call_details)103 static unsigned char *rose_enc_etsi_CallDetails(struct pri *ctrl, unsigned char *pos,
104 	unsigned char *end, unsigned tag, const struct roseEtsiCallDetailsList *call_details)
105 {
106 	unsigned index;
107 	unsigned char *seq_len;
108 
109 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, tag);
110 
111 	for (index = 0; index < call_details->num_records; ++index) {
112 		ASN1_CALL(pos, rose_enc_etsi_CallInformation(ctrl, pos, end, ASN1_TAG_SEQUENCE,
113 			&call_details->list[index]));
114 	}
115 
116 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
117 
118 	return pos;
119 }
120 
121 /*!
122  * \brief Encode the StatusRequest invoke facility ie arguments.
123  *
124  * \param ctrl D channel controller for diagnostic messages or global options.
125  * \param pos Starting position to encode ASN.1 component.
126  * \param end End of ASN.1 encoding data buffer.
127  * \param args Arguments to encode in the buffer.
128  *
129  * \retval Start of the next ASN.1 component to encode on success.
130  * \retval NULL on error.
131  */
rose_enc_etsi_StatusRequest_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)132 unsigned char *rose_enc_etsi_StatusRequest_ARG(struct pri *ctrl, unsigned char *pos,
133 	unsigned char *end, const union rose_msg_invoke_args *args)
134 {
135 	const struct roseEtsiStatusRequest_ARG *status_request;
136 	unsigned char *seq_len;
137 
138 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
139 
140 	status_request = &args->etsi.StatusRequest;
141 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
142 		status_request->compatibility_mode));
143 	ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
144 		&status_request->q931ie));
145 
146 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
147 
148 	return pos;
149 }
150 
151 /*!
152  * \brief Encode the StatusRequest result facility ie arguments.
153  *
154  * \param ctrl D channel controller for diagnostic messages or global options.
155  * \param pos Starting position to encode ASN.1 component.
156  * \param end End of ASN.1 encoding data buffer.
157  * \param args Arguments to encode in the buffer.
158  *
159  * \retval Start of the next ASN.1 component to encode on success.
160  * \retval NULL on error.
161  */
rose_enc_etsi_StatusRequest_RES(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_result_args * args)162 unsigned char *rose_enc_etsi_StatusRequest_RES(struct pri *ctrl, unsigned char *pos,
163 	unsigned char *end, const union rose_msg_result_args *args)
164 {
165 	return asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED, args->etsi.StatusRequest.status);
166 }
167 
168 /*!
169  * \brief Encode the CallInfoRetain invoke facility ie arguments.
170  *
171  * \param ctrl D channel controller for diagnostic messages or global options.
172  * \param pos Starting position to encode ASN.1 component.
173  * \param end End of ASN.1 encoding data buffer.
174  * \param args Arguments to encode in the buffer.
175  *
176  * \retval Start of the next ASN.1 component to encode on success.
177  * \retval NULL on error.
178  */
rose_enc_etsi_CallInfoRetain_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)179 unsigned char *rose_enc_etsi_CallInfoRetain_ARG(struct pri *ctrl, unsigned char *pos,
180 	unsigned char *end, const union rose_msg_invoke_args *args)
181 {
182 	return asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
183 		args->etsi.CallInfoRetain.call_linkage_id);
184 }
185 
186 /*!
187  * \brief Encode the EraseCallLinkageID invoke facility ie arguments.
188  *
189  * \param ctrl D channel controller for diagnostic messages or global options.
190  * \param pos Starting position to encode ASN.1 component.
191  * \param end End of ASN.1 encoding data buffer.
192  * \param args Arguments to encode in the buffer.
193  *
194  * \retval Start of the next ASN.1 component to encode on success.
195  * \retval NULL on error.
196  */
rose_enc_etsi_EraseCallLinkageID_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)197 unsigned char *rose_enc_etsi_EraseCallLinkageID_ARG(struct pri *ctrl, unsigned char *pos,
198 	unsigned char *end, const union rose_msg_invoke_args *args)
199 {
200 	return asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
201 		args->etsi.EraseCallLinkageID.call_linkage_id);
202 }
203 
204 /*!
205  * \brief Encode the CCBSDeactivate invoke facility ie arguments.
206  *
207  * \param ctrl D channel controller for diagnostic messages or global options.
208  * \param pos Starting position to encode ASN.1 component.
209  * \param end End of ASN.1 encoding data buffer.
210  * \param args Arguments to encode in the buffer.
211  *
212  * \retval Start of the next ASN.1 component to encode on success.
213  * \retval NULL on error.
214  */
rose_enc_etsi_CCBSDeactivate_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)215 unsigned char *rose_enc_etsi_CCBSDeactivate_ARG(struct pri *ctrl, unsigned char *pos,
216 	unsigned char *end, const union rose_msg_invoke_args *args)
217 {
218 	return asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
219 		args->etsi.CCBSDeactivate.ccbs_reference);
220 }
221 
222 /*!
223  * \brief Encode the CCBSErase invoke facility ie arguments.
224  *
225  * \param ctrl D channel controller for diagnostic messages or global options.
226  * \param pos Starting position to encode ASN.1 component.
227  * \param end End of ASN.1 encoding data buffer.
228  * \param args Arguments to encode in the buffer.
229  *
230  * \retval Start of the next ASN.1 component to encode on success.
231  * \retval NULL on error.
232  */
rose_enc_etsi_CCBSErase_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)233 unsigned char *rose_enc_etsi_CCBSErase_ARG(struct pri *ctrl, unsigned char *pos,
234 	unsigned char *end, const union rose_msg_invoke_args *args)
235 {
236 	const struct roseEtsiCCBSErase_ARG *ccbs_erase;
237 	unsigned char *seq_len;
238 
239 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
240 
241 	ccbs_erase = &args->etsi.CCBSErase;
242 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
243 		ccbs_erase->recall_mode));
244 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
245 		ccbs_erase->ccbs_reference));
246 	ASN1_CALL(pos, rose_enc_Address(ctrl, pos, end, ASN1_TAG_SEQUENCE,
247 		&ccbs_erase->address_of_b));
248 	ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
249 		&ccbs_erase->q931ie));
250 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED, ccbs_erase->reason));
251 
252 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
253 
254 	return pos;
255 }
256 
257 /*!
258  * \brief Encode the CCBSRemoteUserFree invoke facility ie arguments.
259  *
260  * \param ctrl D channel controller for diagnostic messages or global options.
261  * \param pos Starting position to encode ASN.1 component.
262  * \param end End of ASN.1 encoding data buffer.
263  * \param args Arguments to encode in the buffer.
264  *
265  * \retval Start of the next ASN.1 component to encode on success.
266  * \retval NULL on error.
267  */
rose_enc_etsi_CCBSRemoteUserFree_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)268 unsigned char *rose_enc_etsi_CCBSRemoteUserFree_ARG(struct pri *ctrl, unsigned char *pos,
269 	unsigned char *end, const union rose_msg_invoke_args *args)
270 {
271 	const struct roseEtsiCCBSRemoteUserFree_ARG *ccbs_remote_user_free;
272 	unsigned char *seq_len;
273 
274 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
275 
276 	ccbs_remote_user_free = &args->etsi.CCBSRemoteUserFree;
277 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
278 		ccbs_remote_user_free->recall_mode));
279 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
280 		ccbs_remote_user_free->ccbs_reference));
281 	ASN1_CALL(pos, rose_enc_Address(ctrl, pos, end, ASN1_TAG_SEQUENCE,
282 		&ccbs_remote_user_free->address_of_b));
283 	ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
284 		&ccbs_remote_user_free->q931ie));
285 
286 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
287 
288 	return pos;
289 }
290 
291 /*!
292  * \brief Encode the CCBSCall invoke facility ie arguments.
293  *
294  * \param ctrl D channel controller for diagnostic messages or global options.
295  * \param pos Starting position to encode ASN.1 component.
296  * \param end End of ASN.1 encoding data buffer.
297  * \param args Arguments to encode in the buffer.
298  *
299  * \retval Start of the next ASN.1 component to encode on success.
300  * \retval NULL on error.
301  */
rose_enc_etsi_CCBSCall_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)302 unsigned char *rose_enc_etsi_CCBSCall_ARG(struct pri *ctrl, unsigned char *pos,
303 	unsigned char *end, const union rose_msg_invoke_args *args)
304 {
305 	return asn1_enc_int(pos, end, ASN1_TYPE_INTEGER, args->etsi.CCBSCall.ccbs_reference);
306 }
307 
308 /*!
309  * \brief Encode the CCBSBFree invoke facility ie arguments.
310  *
311  * \param ctrl D channel controller for diagnostic messages or global options.
312  * \param pos Starting position to encode ASN.1 component.
313  * \param end End of ASN.1 encoding data buffer.
314  * \param args Arguments to encode in the buffer.
315  *
316  * \retval Start of the next ASN.1 component to encode on success.
317  * \retval NULL on error.
318  */
rose_enc_etsi_CCBSBFree_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)319 unsigned char *rose_enc_etsi_CCBSBFree_ARG(struct pri *ctrl, unsigned char *pos,
320 	unsigned char *end, const union rose_msg_invoke_args *args)
321 {
322 	const struct roseEtsiCCBSBFree_ARG *ccbs_b_free;
323 	unsigned char *seq_len;
324 
325 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
326 
327 	ccbs_b_free = &args->etsi.CCBSBFree;
328 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
329 		ccbs_b_free->recall_mode));
330 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
331 		ccbs_b_free->ccbs_reference));
332 	ASN1_CALL(pos, rose_enc_Address(ctrl, pos, end, ASN1_TAG_SEQUENCE,
333 		&ccbs_b_free->address_of_b));
334 	ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
335 		&ccbs_b_free->q931ie));
336 
337 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
338 
339 	return pos;
340 }
341 
342 /*!
343  * \brief Encode the CCBSStopAlerting invoke facility ie arguments.
344  *
345  * \param ctrl D channel controller for diagnostic messages or global options.
346  * \param pos Starting position to encode ASN.1 component.
347  * \param end End of ASN.1 encoding data buffer.
348  * \param args Arguments to encode in the buffer.
349  *
350  * \retval Start of the next ASN.1 component to encode on success.
351  * \retval NULL on error.
352  */
rose_enc_etsi_CCBSStopAlerting_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)353 unsigned char *rose_enc_etsi_CCBSStopAlerting_ARG(struct pri *ctrl, unsigned char *pos,
354 	unsigned char *end, const union rose_msg_invoke_args *args)
355 {
356 	return asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
357 		args->etsi.CCBSStopAlerting.ccbs_reference);
358 }
359 
360 /*!
361  * \brief Encode the CCBSStatusRequest invoke facility ie arguments.
362  *
363  * \param ctrl D channel controller for diagnostic messages or global options.
364  * \param pos Starting position to encode ASN.1 component.
365  * \param end End of ASN.1 encoding data buffer.
366  * \param args Arguments to encode in the buffer.
367  *
368  * \retval Start of the next ASN.1 component to encode on success.
369  * \retval NULL on error.
370  */
rose_enc_etsi_CCBSStatusRequest_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)371 unsigned char *rose_enc_etsi_CCBSStatusRequest_ARG(struct pri *ctrl, unsigned char *pos,
372 	unsigned char *end, const union rose_msg_invoke_args *args)
373 {
374 	const struct roseEtsiCCBSStatusRequest_ARG *ccbs_status_request;
375 	unsigned char *seq_len;
376 
377 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
378 
379 	ccbs_status_request = &args->etsi.CCBSStatusRequest;
380 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
381 		ccbs_status_request->recall_mode));
382 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
383 		ccbs_status_request->ccbs_reference));
384 	ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
385 		&ccbs_status_request->q931ie));
386 
387 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
388 
389 	return pos;
390 }
391 
392 /*!
393  * \brief Encode the CCBSStatusRequest result facility ie arguments.
394  *
395  * \param ctrl D channel controller for diagnostic messages or global options.
396  * \param pos Starting position to encode ASN.1 component.
397  * \param end End of ASN.1 encoding data buffer.
398  * \param args Arguments to encode in the buffer.
399  *
400  * \retval Start of the next ASN.1 component to encode on success.
401  * \retval NULL on error.
402  */
rose_enc_etsi_CCBSStatusRequest_RES(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_result_args * args)403 unsigned char *rose_enc_etsi_CCBSStatusRequest_RES(struct pri *ctrl, unsigned char *pos,
404 	unsigned char *end, const union rose_msg_result_args *args)
405 {
406 	return asn1_enc_boolean(pos, end, ASN1_TYPE_BOOLEAN,
407 		args->etsi.CCBSStatusRequest.free);
408 }
409 
410 /*!
411  * \internal
412  * \brief Encode the CCBS/CCNR-Request invoke facility ie arguments.
413  *
414  * \param ctrl D channel controller for diagnostic messages or global options.
415  * \param pos Starting position to encode ASN.1 component.
416  * \param end End of ASN.1 encoding data buffer.
417  * \param ccbs_request Information to encode.
418  *
419  * \retval Start of the next ASN.1 component to encode on success.
420  * \retval NULL on error.
421  */
rose_enc_etsi_CC_Request_ARG_Backend(struct pri * ctrl,unsigned char * pos,unsigned char * end,const struct roseEtsiCCBSRequest_ARG * ccbs_request)422 static unsigned char *rose_enc_etsi_CC_Request_ARG_Backend(struct pri *ctrl,
423 	unsigned char *pos, unsigned char *end,
424 	const struct roseEtsiCCBSRequest_ARG *ccbs_request)
425 {
426 	return asn1_enc_int(pos, end, ASN1_TYPE_INTEGER, ccbs_request->call_linkage_id);
427 }
428 
429 /*!
430  * \brief Encode the CCBS-Request invoke facility ie arguments.
431  *
432  * \param ctrl D channel controller for diagnostic messages or global options.
433  * \param pos Starting position to encode ASN.1 component.
434  * \param end End of ASN.1 encoding data buffer.
435  * \param args Arguments to encode in the buffer.
436  *
437  * \retval Start of the next ASN.1 component to encode on success.
438  * \retval NULL on error.
439  */
rose_enc_etsi_CCBSRequest_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)440 unsigned char *rose_enc_etsi_CCBSRequest_ARG(struct pri *ctrl, unsigned char *pos,
441 	unsigned char *end, const union rose_msg_invoke_args *args)
442 {
443 	return rose_enc_etsi_CC_Request_ARG_Backend(ctrl, pos, end, &args->etsi.CCBSRequest);
444 }
445 
446 /*!
447  * \brief Encode the CCNR-Request invoke facility ie arguments.
448  *
449  * \param ctrl D channel controller for diagnostic messages or global options.
450  * \param pos Starting position to encode ASN.1 component.
451  * \param end End of ASN.1 encoding data buffer.
452  * \param args Arguments to encode in the buffer.
453  *
454  * \retval Start of the next ASN.1 component to encode on success.
455  * \retval NULL on error.
456  */
rose_enc_etsi_CCNRRequest_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)457 unsigned char *rose_enc_etsi_CCNRRequest_ARG(struct pri *ctrl, unsigned char *pos,
458 	unsigned char *end, const union rose_msg_invoke_args *args)
459 {
460 	return rose_enc_etsi_CC_Request_ARG_Backend(ctrl, pos, end, &args->etsi.CCNRRequest);
461 }
462 
463 /*!
464  * \internal
465  * \brief Encode the CCBS/CCNR-Request result facility ie arguments.
466  *
467  * \param ctrl D channel controller for diagnostic messages or global options.
468  * \param pos Starting position to encode ASN.1 component.
469  * \param end End of ASN.1 encoding data buffer.
470  * \param ccbs_request Information to encode.
471  *
472  * \retval Start of the next ASN.1 component to encode on success.
473  * \retval NULL on error.
474  */
rose_enc_etsi_CC_Request_RES_Backend(struct pri * ctrl,unsigned char * pos,unsigned char * end,const struct roseEtsiCCBSRequest_RES * ccbs_request)475 static unsigned char *rose_enc_etsi_CC_Request_RES_Backend(struct pri *ctrl,
476 	unsigned char *pos, unsigned char *end,
477 	const struct roseEtsiCCBSRequest_RES *ccbs_request)
478 {
479 	unsigned char *seq_len;
480 
481 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
482 
483 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
484 		ccbs_request->recall_mode));
485 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
486 		ccbs_request->ccbs_reference));
487 
488 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
489 
490 	return pos;
491 }
492 
493 /*!
494  * \brief Encode the CCBS-Request result facility ie arguments.
495  *
496  * \param ctrl D channel controller for diagnostic messages or global options.
497  * \param pos Starting position to encode ASN.1 component.
498  * \param end End of ASN.1 encoding data buffer.
499  * \param args Arguments to encode in the buffer.
500  *
501  * \retval Start of the next ASN.1 component to encode on success.
502  * \retval NULL on error.
503  */
rose_enc_etsi_CCBSRequest_RES(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_result_args * args)504 unsigned char *rose_enc_etsi_CCBSRequest_RES(struct pri *ctrl, unsigned char *pos,
505 	unsigned char *end, const union rose_msg_result_args *args)
506 {
507 	return rose_enc_etsi_CC_Request_RES_Backend(ctrl, pos, end, &args->etsi.CCBSRequest);
508 }
509 
510 /*!
511  * \brief Encode the CCNR-Request result facility ie arguments.
512  *
513  * \param ctrl D channel controller for diagnostic messages or global options.
514  * \param pos Starting position to encode ASN.1 component.
515  * \param end End of ASN.1 encoding data buffer.
516  * \param args Arguments to encode in the buffer.
517  *
518  * \retval Start of the next ASN.1 component to encode on success.
519  * \retval NULL on error.
520  */
rose_enc_etsi_CCNRRequest_RES(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_result_args * args)521 unsigned char *rose_enc_etsi_CCNRRequest_RES(struct pri *ctrl, unsigned char *pos,
522 	unsigned char *end, const union rose_msg_result_args *args)
523 {
524 	return rose_enc_etsi_CC_Request_RES_Backend(ctrl, pos, end, &args->etsi.CCNRRequest);
525 }
526 
527 /*!
528  * \internal
529  * \brief Encode the CCBS/CCNR-Interrogate invoke facility ie arguments.
530  *
531  * \param ctrl D channel controller for diagnostic messages or global options.
532  * \param pos Starting position to encode ASN.1 component.
533  * \param end End of ASN.1 encoding data buffer.
534  * \param ccbs_interrogate Information to encode.
535  *
536  * \retval Start of the next ASN.1 component to encode on success.
537  * \retval NULL on error.
538  */
rose_enc_etsi_CC_Interrogate_ARG_Backend(struct pri * ctrl,unsigned char * pos,unsigned char * end,const struct roseEtsiCCBSInterrogate_ARG * ccbs_interrogate)539 static unsigned char *rose_enc_etsi_CC_Interrogate_ARG_Backend(struct pri *ctrl,
540 	unsigned char *pos, unsigned char *end,
541 	const struct roseEtsiCCBSInterrogate_ARG *ccbs_interrogate)
542 {
543 	unsigned char *seq_len;
544 
545 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
546 
547 	if (ccbs_interrogate->ccbs_reference_present) {
548 		ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
549 			ccbs_interrogate->ccbs_reference));
550 	}
551 	if (ccbs_interrogate->a_party_number.length) {
552 		ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end,
553 			&ccbs_interrogate->a_party_number));
554 	}
555 
556 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
557 
558 	return pos;
559 }
560 
561 /*!
562  * \brief Encode the CCBSInterrogate invoke facility ie arguments.
563  *
564  * \param ctrl D channel controller for diagnostic messages or global options.
565  * \param pos Starting position to encode ASN.1 component.
566  * \param end End of ASN.1 encoding data buffer.
567  * \param args Arguments to encode in the buffer.
568  *
569  * \retval Start of the next ASN.1 component to encode on success.
570  * \retval NULL on error.
571  */
rose_enc_etsi_CCBSInterrogate_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)572 unsigned char *rose_enc_etsi_CCBSInterrogate_ARG(struct pri *ctrl, unsigned char *pos,
573 	unsigned char *end, const union rose_msg_invoke_args *args)
574 {
575 	return rose_enc_etsi_CC_Interrogate_ARG_Backend(ctrl, pos, end,
576 		&args->etsi.CCBSInterrogate);
577 }
578 
579 /*!
580  * \brief Encode the CCNRInterrogate invoke facility ie arguments.
581  *
582  * \param ctrl D channel controller for diagnostic messages or global options.
583  * \param pos Starting position to encode ASN.1 component.
584  * \param end End of ASN.1 encoding data buffer.
585  * \param args Arguments to encode in the buffer.
586  *
587  * \retval Start of the next ASN.1 component to encode on success.
588  * \retval NULL on error.
589  */
rose_enc_etsi_CCNRInterrogate_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)590 unsigned char *rose_enc_etsi_CCNRInterrogate_ARG(struct pri *ctrl, unsigned char *pos,
591 	unsigned char *end, const union rose_msg_invoke_args *args)
592 {
593 	return rose_enc_etsi_CC_Interrogate_ARG_Backend(ctrl, pos, end,
594 		&args->etsi.CCNRInterrogate);
595 }
596 
597 /*!
598  * \internal
599  * \brief Encode the CCBS/CCNR-Interrogate result facility ie arguments.
600  *
601  * \param ctrl D channel controller for diagnostic messages or global options.
602  * \param pos Starting position to encode ASN.1 component.
603  * \param end End of ASN.1 encoding data buffer.
604  * \param ccbs_interrogate Information to encode.
605  *
606  * \retval Start of the next ASN.1 component to encode on success.
607  * \retval NULL on error.
608  */
rose_enc_etsi_CC_Interrogate_RES_Backend(struct pri * ctrl,unsigned char * pos,unsigned char * end,const struct roseEtsiCCBSInterrogate_RES * ccbs_interrogate)609 static unsigned char *rose_enc_etsi_CC_Interrogate_RES_Backend(struct pri *ctrl,
610 	unsigned char *pos, unsigned char *end,
611 	const struct roseEtsiCCBSInterrogate_RES *ccbs_interrogate)
612 {
613 	unsigned char *seq_len;
614 
615 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
616 
617 	ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
618 		ccbs_interrogate->recall_mode));
619 	if (ccbs_interrogate->call_details.num_records) {
620 		ASN1_CALL(pos, rose_enc_etsi_CallDetails(ctrl, pos, end, ASN1_TAG_SEQUENCE,
621 			&ccbs_interrogate->call_details));
622 	}
623 
624 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
625 
626 	return pos;
627 }
628 
629 /*!
630  * \brief Encode the CCBSInterrogate result facility ie arguments.
631  *
632  * \param ctrl D channel controller for diagnostic messages or global options.
633  * \param pos Starting position to encode ASN.1 component.
634  * \param end End of ASN.1 encoding data buffer.
635  * \param args Arguments to encode in the buffer.
636  *
637  * \retval Start of the next ASN.1 component to encode on success.
638  * \retval NULL on error.
639  */
rose_enc_etsi_CCBSInterrogate_RES(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_result_args * args)640 unsigned char *rose_enc_etsi_CCBSInterrogate_RES(struct pri *ctrl, unsigned char *pos,
641 	unsigned char *end, const union rose_msg_result_args *args)
642 {
643 	return rose_enc_etsi_CC_Interrogate_RES_Backend(ctrl, pos, end,
644 		&args->etsi.CCBSInterrogate);
645 }
646 
647 /*!
648  * \brief Encode the CCNRInterrogate result facility ie arguments.
649  *
650  * \param ctrl D channel controller for diagnostic messages or global options.
651  * \param pos Starting position to encode ASN.1 component.
652  * \param end End of ASN.1 encoding data buffer.
653  * \param args Arguments to encode in the buffer.
654  *
655  * \retval Start of the next ASN.1 component to encode on success.
656  * \retval NULL on error.
657  */
rose_enc_etsi_CCNRInterrogate_RES(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_result_args * args)658 unsigned char *rose_enc_etsi_CCNRInterrogate_RES(struct pri *ctrl, unsigned char *pos,
659 	unsigned char *end, const union rose_msg_result_args *args)
660 {
661 	return rose_enc_etsi_CC_Interrogate_RES_Backend(ctrl, pos, end,
662 		&args->etsi.CCNRInterrogate);
663 }
664 
665 /*!
666  * \internal
667  * \brief Encode the CCBS-T/CCNR-T-Request invoke facility ie arguments.
668  *
669  * \param ctrl D channel controller for diagnostic messages or global options.
670  * \param pos Starting position to encode ASN.1 component.
671  * \param end End of ASN.1 encoding data buffer.
672  * \param ccbs_t_request Information to encode.
673  *
674  * \retval Start of the next ASN.1 component to encode on success.
675  * \retval NULL on error.
676  */
rose_enc_etsi_CC_T_Request_ARG_Backend(struct pri * ctrl,unsigned char * pos,unsigned char * end,const struct roseEtsiCCBS_T_Request_ARG * ccbs_t_request)677 static unsigned char *rose_enc_etsi_CC_T_Request_ARG_Backend(struct pri *ctrl,
678 	unsigned char *pos, unsigned char *end,
679 	const struct roseEtsiCCBS_T_Request_ARG *ccbs_t_request)
680 {
681 	unsigned char *seq_len;
682 
683 	ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
684 
685 	ASN1_CALL(pos, rose_enc_Address(ctrl, pos, end, ASN1_TAG_SEQUENCE,
686 		&ccbs_t_request->destination));
687 	ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
688 		&ccbs_t_request->q931ie));
689 	if (ccbs_t_request->retention_supported) {
690 		/* Not the DEFAULT value */
691 		ASN1_CALL(pos, asn1_enc_boolean(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 1,
692 			ccbs_t_request->retention_supported));
693 	}
694 	if (ccbs_t_request->presentation_allowed_indicator_present) {
695 		ASN1_CALL(pos, asn1_enc_boolean(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 2,
696 			ccbs_t_request->presentation_allowed_indicator));
697 	}
698 	if (ccbs_t_request->originating.number.length) {
699 		ASN1_CALL(pos, rose_enc_Address(ctrl, pos, end, ASN1_TAG_SEQUENCE,
700 			&ccbs_t_request->originating));
701 	}
702 
703 	ASN1_CONSTRUCTED_END(seq_len, pos, end);
704 
705 	return pos;
706 }
707 
708 /*!
709  * \brief Encode the CCBS_T_Request invoke facility ie arguments.
710  *
711  * \param ctrl D channel controller for diagnostic messages or global options.
712  * \param pos Starting position to encode ASN.1 component.
713  * \param end End of ASN.1 encoding data buffer.
714  * \param args Arguments to encode in the buffer.
715  *
716  * \retval Start of the next ASN.1 component to encode on success.
717  * \retval NULL on error.
718  */
rose_enc_etsi_CCBS_T_Request_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)719 unsigned char *rose_enc_etsi_CCBS_T_Request_ARG(struct pri *ctrl, unsigned char *pos,
720 	unsigned char *end, const union rose_msg_invoke_args *args)
721 {
722 	return rose_enc_etsi_CC_T_Request_ARG_Backend(ctrl, pos, end,
723 		&args->etsi.CCBS_T_Request);
724 }
725 
726 /*!
727  * \brief Encode the CCNR_T_Request invoke facility ie arguments.
728  *
729  * \param ctrl D channel controller for diagnostic messages or global options.
730  * \param pos Starting position to encode ASN.1 component.
731  * \param end End of ASN.1 encoding data buffer.
732  * \param args Arguments to encode in the buffer.
733  *
734  * \retval Start of the next ASN.1 component to encode on success.
735  * \retval NULL on error.
736  */
rose_enc_etsi_CCNR_T_Request_ARG(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_invoke_args * args)737 unsigned char *rose_enc_etsi_CCNR_T_Request_ARG(struct pri *ctrl, unsigned char *pos,
738 	unsigned char *end, const union rose_msg_invoke_args *args)
739 {
740 	return rose_enc_etsi_CC_T_Request_ARG_Backend(ctrl, pos, end,
741 		&args->etsi.CCNR_T_Request);
742 }
743 
744 /*!
745  * \internal
746  * \brief Encode the CCBS-T/CCNR-T-Request result facility ie arguments.
747  *
748  * \param ctrl D channel controller for diagnostic messages or global options.
749  * \param pos Starting position to encode ASN.1 component.
750  * \param end End of ASN.1 encoding data buffer.
751  * \param ccbs_t_request Information to encode.
752  *
753  * \retval Start of the next ASN.1 component to encode on success.
754  * \retval NULL on error.
755  */
rose_enc_etsi_CC_T_Request_RES_Backend(struct pri * ctrl,unsigned char * pos,unsigned char * end,const struct roseEtsiCCBS_T_Request_RES * ccbs_t_request)756 static unsigned char *rose_enc_etsi_CC_T_Request_RES_Backend(struct pri *ctrl,
757 	unsigned char *pos, unsigned char *end,
758 	const struct roseEtsiCCBS_T_Request_RES *ccbs_t_request)
759 {
760 	return asn1_enc_boolean(pos, end, ASN1_TYPE_BOOLEAN,
761 		ccbs_t_request->retention_supported);
762 }
763 
764 /*!
765  * \brief Encode the CCBS_T_Request result facility ie arguments.
766  *
767  * \param ctrl D channel controller for diagnostic messages or global options.
768  * \param pos Starting position to encode ASN.1 component.
769  * \param end End of ASN.1 encoding data buffer.
770  * \param args Arguments to encode in the buffer.
771  *
772  * \retval Start of the next ASN.1 component to encode on success.
773  * \retval NULL on error.
774  */
rose_enc_etsi_CCBS_T_Request_RES(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_result_args * args)775 unsigned char *rose_enc_etsi_CCBS_T_Request_RES(struct pri *ctrl, unsigned char *pos,
776 	unsigned char *end, const union rose_msg_result_args *args)
777 {
778 	return rose_enc_etsi_CC_T_Request_RES_Backend(ctrl, pos, end,
779 		&args->etsi.CCBS_T_Request);
780 }
781 
782 /*!
783  * \brief Encode the CCNR_T_Request result facility ie arguments.
784  *
785  * \param ctrl D channel controller for diagnostic messages or global options.
786  * \param pos Starting position to encode ASN.1 component.
787  * \param end End of ASN.1 encoding data buffer.
788  * \param args Arguments to encode in the buffer.
789  *
790  * \retval Start of the next ASN.1 component to encode on success.
791  * \retval NULL on error.
792  */
rose_enc_etsi_CCNR_T_Request_RES(struct pri * ctrl,unsigned char * pos,unsigned char * end,const union rose_msg_result_args * args)793 unsigned char *rose_enc_etsi_CCNR_T_Request_RES(struct pri *ctrl, unsigned char *pos,
794 	unsigned char *end, const union rose_msg_result_args *args)
795 {
796 	return rose_enc_etsi_CC_T_Request_RES_Backend(ctrl, pos, end,
797 		&args->etsi.CCNR_T_Request);
798 }
799 
800 /*!
801  * \internal
802  * \brief Decode the CallInformation argument parameters.
803  *
804  * \param ctrl D channel controller for diagnostic messages or global options.
805  * \param name Field name
806  * \param tag Component tag that identified this production.
807  * \param pos Starting position of the ASN.1 component length.
808  * \param end End of ASN.1 decoding data buffer.
809  * \param call_information Parameter storage to fill.
810  *
811  * \retval Start of the next ASN.1 component on success.
812  * \retval NULL on error.
813  */
rose_dec_etsi_CallInformation(struct pri * ctrl,const char * name,unsigned tag,const unsigned char * pos,const unsigned char * end,struct roseEtsiCallInformation * call_information)814 static const unsigned char *rose_dec_etsi_CallInformation(struct pri *ctrl,
815 	const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
816 	struct roseEtsiCallInformation *call_information)
817 {
818 	int32_t value;
819 	int length;
820 	int seq_offset;
821 	const unsigned char *seq_end;
822 
823 	if (ctrl->debug & PRI_DEBUG_APDU) {
824 		pri_message(ctrl, "  %s CallInformation %s\n", name, asn1_tag2str(tag));
825 	}
826 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
827 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
828 
829 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
830 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
831 	ASN1_CALL(pos, rose_dec_Address(ctrl, "addressOfB", tag, pos, seq_end,
832 		&call_information->address_of_b));
833 
834 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
835 	ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_CLASS_APPLICATION | 0);
836 	ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "q931ie", tag, pos, seq_end,
837 		&call_information->q931ie, sizeof(call_information->q931ie_contents)));
838 
839 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
840 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
841 	ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, seq_end, &value));
842 	call_information->ccbs_reference = value;
843 
844 	if (pos < seq_end && *pos != ASN1_INDEF_TERM) {
845 		/* The optional subaddress must be present since there is something left. */
846 		ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
847 		ASN1_CALL(pos, rose_dec_PartySubaddress(ctrl, "subaddressOfA", tag, pos, seq_end,
848 			&call_information->subaddress_of_a));
849 	} else {
850 		/* Subaddress not present */
851 		call_information->subaddress_of_a.length = 0;
852 	}
853 
854 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
855 
856 	return pos;
857 }
858 
859 /*!
860  * \internal
861  * \brief Decode the array of call information details argument parameters.
862  *
863  * \param ctrl D channel controller for diagnostic messages or global options.
864  * \param name Field name
865  * \param tag Component tag that identified this production.
866  * \param pos Starting position of the ASN.1 component length.
867  * \param end End of ASN.1 decoding data buffer.
868  * \param call_details Parameter storage array to fill.
869  *
870  * \retval Start of the next ASN.1 component on success.
871  * \retval NULL on error.
872  */
rose_dec_etsi_CallDetails(struct pri * ctrl,const char * name,unsigned tag,const unsigned char * pos,const unsigned char * end,struct roseEtsiCallDetailsList * call_details)873 static const unsigned char *rose_dec_etsi_CallDetails(struct pri *ctrl, const char *name,
874 	unsigned tag, const unsigned char *pos, const unsigned char *end,
875 	struct roseEtsiCallDetailsList *call_details)
876 {
877 	int length;
878 	int seq_offset;
879 	const unsigned char *seq_end;
880 
881 	if (ctrl->debug & PRI_DEBUG_APDU) {
882 		pri_message(ctrl, "  %s CallDetails %s\n", name, asn1_tag2str(tag));
883 	}
884 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
885 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
886 
887 	call_details->num_records = 0;
888 	while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
889 		if (ARRAY_LEN(call_details->list) <= call_details->num_records) {
890 			/* Too many records */
891 			return NULL;
892 		}
893 		ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
894 		ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
895 		ASN1_CALL(pos, rose_dec_etsi_CallInformation(ctrl, "listEntry", tag, pos,
896 			seq_end, &call_details->list[call_details->num_records]));
897 		++call_details->num_records;
898 	}
899 
900 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
901 
902 	return pos;
903 }
904 
905 /*!
906  * \brief Decode the StatusRequest invoke argument parameters.
907  *
908  * \param ctrl D channel controller for diagnostic messages or global options.
909  * \param tag Component tag that identified this structure.
910  * \param pos Starting position of the ASN.1 component length.
911  * \param end End of ASN.1 decoding data buffer.
912  * \param args Arguments to fill in from the decoded buffer.
913  *
914  * \retval Start of the next ASN.1 component on success.
915  * \retval NULL on error.
916  */
rose_dec_etsi_StatusRequest_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)917 const unsigned char *rose_dec_etsi_StatusRequest_ARG(struct pri *ctrl, unsigned tag,
918 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
919 {
920 	struct roseEtsiStatusRequest_ARG *status_request;
921 	int length;
922 	int seq_offset;
923 	const unsigned char *seq_end;
924 	int32_t value;
925 
926 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
927 	if (ctrl->debug & PRI_DEBUG_APDU) {
928 		pri_message(ctrl, "  StatusRequest %s\n", asn1_tag2str(tag));
929 	}
930 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
931 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
932 
933 	status_request = &args->etsi.StatusRequest;
934 
935 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
936 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
937 	ASN1_CALL(pos, asn1_dec_int(ctrl, "compatibilityMode", tag, pos, seq_end, &value));
938 	status_request->compatibility_mode = value;
939 
940 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
941 	ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_CLASS_APPLICATION | 0);
942 	ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "q931ie", tag, pos, seq_end,
943 		&status_request->q931ie, sizeof(status_request->q931ie_contents)));
944 
945 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
946 
947 	return pos;
948 }
949 
950 /*!
951  * \brief Decode the StatusRequest result argument parameters.
952  *
953  * \param ctrl D channel controller for diagnostic messages or global options.
954  * \param tag Component tag that identified this structure.
955  * \param pos Starting position of the ASN.1 component length.
956  * \param end End of ASN.1 decoding data buffer.
957  * \param args Arguments to fill in from the decoded buffer.
958  *
959  * \retval Start of the next ASN.1 component on success.
960  * \retval NULL on error.
961  */
rose_dec_etsi_StatusRequest_RES(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_result_args * args)962 const unsigned char *rose_dec_etsi_StatusRequest_RES(struct pri *ctrl, unsigned tag,
963 	const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
964 {
965 	int32_t value;
966 
967 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
968 	ASN1_CALL(pos, asn1_dec_int(ctrl, "status", tag, pos, end, &value));
969 	args->etsi.StatusRequest.status = value;
970 
971 	return pos;
972 }
973 
974 /*!
975  * \brief Decode the CallInfoRetain invoke argument parameters.
976  *
977  * \param ctrl D channel controller for diagnostic messages or global options.
978  * \param tag Component tag that identified this structure.
979  * \param pos Starting position of the ASN.1 component length.
980  * \param end End of ASN.1 decoding data buffer.
981  * \param args Arguments to fill in from the decoded buffer.
982  *
983  * \retval Start of the next ASN.1 component on success.
984  * \retval NULL on error.
985  */
rose_dec_etsi_CallInfoRetain_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)986 const unsigned char *rose_dec_etsi_CallInfoRetain_ARG(struct pri *ctrl, unsigned tag,
987 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
988 {
989 	int32_t value;
990 
991 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
992 	ASN1_CALL(pos, asn1_dec_int(ctrl, "callLinkageId", tag, pos, end, &value));
993 	args->etsi.CallInfoRetain.call_linkage_id = value;
994 
995 	return pos;
996 }
997 
998 /*!
999  * \brief Decode the EraseCallLinkageID invoke argument parameters.
1000  *
1001  * \param ctrl D channel controller for diagnostic messages or global options.
1002  * \param tag Component tag that identified this structure.
1003  * \param pos Starting position of the ASN.1 component length.
1004  * \param end End of ASN.1 decoding data buffer.
1005  * \param args Arguments to fill in from the decoded buffer.
1006  *
1007  * \retval Start of the next ASN.1 component on success.
1008  * \retval NULL on error.
1009  */
rose_dec_etsi_EraseCallLinkageID_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1010 const unsigned char *rose_dec_etsi_EraseCallLinkageID_ARG(struct pri *ctrl, unsigned tag,
1011 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1012 {
1013 	int32_t value;
1014 
1015 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1016 	ASN1_CALL(pos, asn1_dec_int(ctrl, "callLinkageId", tag, pos, end, &value));
1017 	args->etsi.EraseCallLinkageID.call_linkage_id = value;
1018 
1019 	return pos;
1020 }
1021 
1022 /*!
1023  * \brief Decode the CCBSDeactivate invoke argument parameters.
1024  *
1025  * \param ctrl D channel controller for diagnostic messages or global options.
1026  * \param tag Component tag that identified this structure.
1027  * \param pos Starting position of the ASN.1 component length.
1028  * \param end End of ASN.1 decoding data buffer.
1029  * \param args Arguments to fill in from the decoded buffer.
1030  *
1031  * \retval Start of the next ASN.1 component on success.
1032  * \retval NULL on error.
1033  */
rose_dec_etsi_CCBSDeactivate_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1034 const unsigned char *rose_dec_etsi_CCBSDeactivate_ARG(struct pri *ctrl, unsigned tag,
1035 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1036 {
1037 	int32_t value;
1038 
1039 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1040 	ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, end, &value));
1041 	args->etsi.CCBSDeactivate.ccbs_reference = value;
1042 
1043 	return pos;
1044 }
1045 
1046 /*!
1047  * \brief Decode the CCBSErase invoke argument parameters.
1048  *
1049  * \param ctrl D channel controller for diagnostic messages or global options.
1050  * \param tag Component tag that identified this structure.
1051  * \param pos Starting position of the ASN.1 component length.
1052  * \param end End of ASN.1 decoding data buffer.
1053  * \param args Arguments to fill in from the decoded buffer.
1054  *
1055  * \retval Start of the next ASN.1 component on success.
1056  * \retval NULL on error.
1057  */
rose_dec_etsi_CCBSErase_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1058 const unsigned char *rose_dec_etsi_CCBSErase_ARG(struct pri *ctrl, unsigned tag,
1059 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1060 {
1061 	struct roseEtsiCCBSErase_ARG *ccbs_erase;
1062 	int length;
1063 	int seq_offset;
1064 	const unsigned char *seq_end;
1065 	int32_t value;
1066 
1067 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1068 	if (ctrl->debug & PRI_DEBUG_APDU) {
1069 		pri_message(ctrl, "  CCBSErase %s\n", asn1_tag2str(tag));
1070 	}
1071 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
1072 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
1073 
1074 	ccbs_erase = &args->etsi.CCBSErase;
1075 
1076 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1077 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
1078 	ASN1_CALL(pos, asn1_dec_int(ctrl, "recallMode", tag, pos, seq_end, &value));
1079 	ccbs_erase->recall_mode = value;
1080 
1081 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1082 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1083 	ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, seq_end, &value));
1084 	ccbs_erase->ccbs_reference = value;
1085 
1086 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1087 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1088 	ASN1_CALL(pos, rose_dec_Address(ctrl, "addressOfB", tag, pos, seq_end,
1089 		&ccbs_erase->address_of_b));
1090 
1091 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1092 	ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_CLASS_APPLICATION | 0);
1093 	ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "q931ie", tag, pos, seq_end,
1094 		&ccbs_erase->q931ie, sizeof(ccbs_erase->q931ie_contents)));
1095 
1096 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1097 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
1098 	ASN1_CALL(pos, asn1_dec_int(ctrl, "eraseReason", tag, pos, seq_end, &value));
1099 	ccbs_erase->reason = value;
1100 
1101 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
1102 
1103 	return pos;
1104 }
1105 
1106 /*!
1107  * \brief Decode the CCBSRemoteUserFree invoke argument parameters.
1108  *
1109  * \param ctrl D channel controller for diagnostic messages or global options.
1110  * \param tag Component tag that identified this structure.
1111  * \param pos Starting position of the ASN.1 component length.
1112  * \param end End of ASN.1 decoding data buffer.
1113  * \param args Arguments to fill in from the decoded buffer.
1114  *
1115  * \retval Start of the next ASN.1 component on success.
1116  * \retval NULL on error.
1117  */
rose_dec_etsi_CCBSRemoteUserFree_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1118 const unsigned char *rose_dec_etsi_CCBSRemoteUserFree_ARG(struct pri *ctrl, unsigned tag,
1119 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1120 {
1121 	struct roseEtsiCCBSRemoteUserFree_ARG *ccbs_remote_user_free;
1122 	int length;
1123 	int seq_offset;
1124 	const unsigned char *seq_end;
1125 	int32_t value;
1126 
1127 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1128 	if (ctrl->debug & PRI_DEBUG_APDU) {
1129 		pri_message(ctrl, "  CCBSRemoteUserFree %s\n", asn1_tag2str(tag));
1130 	}
1131 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
1132 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
1133 
1134 	ccbs_remote_user_free = &args->etsi.CCBSRemoteUserFree;
1135 
1136 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1137 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
1138 	ASN1_CALL(pos, asn1_dec_int(ctrl, "recallMode", tag, pos, seq_end, &value));
1139 	ccbs_remote_user_free->recall_mode = value;
1140 
1141 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1142 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1143 	ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, seq_end, &value));
1144 	ccbs_remote_user_free->ccbs_reference = value;
1145 
1146 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1147 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1148 	ASN1_CALL(pos, rose_dec_Address(ctrl, "addressOfB", tag, pos, seq_end,
1149 		&ccbs_remote_user_free->address_of_b));
1150 
1151 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1152 	ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_CLASS_APPLICATION | 0);
1153 	ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "q931ie", tag, pos, seq_end,
1154 		&ccbs_remote_user_free->q931ie, sizeof(ccbs_remote_user_free->q931ie_contents)));
1155 
1156 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
1157 
1158 	return pos;
1159 }
1160 
1161 /*!
1162  * \brief Decode the CCBSCall invoke argument parameters.
1163  *
1164  * \param ctrl D channel controller for diagnostic messages or global options.
1165  * \param tag Component tag that identified this structure.
1166  * \param pos Starting position of the ASN.1 component length.
1167  * \param end End of ASN.1 decoding data buffer.
1168  * \param args Arguments to fill in from the decoded buffer.
1169  *
1170  * \retval Start of the next ASN.1 component on success.
1171  * \retval NULL on error.
1172  */
rose_dec_etsi_CCBSCall_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1173 const unsigned char *rose_dec_etsi_CCBSCall_ARG(struct pri *ctrl, unsigned tag,
1174 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1175 {
1176 	int32_t value;
1177 
1178 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1179 	ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, end, &value));
1180 	args->etsi.CCBSCall.ccbs_reference = value;
1181 
1182 	return pos;
1183 }
1184 
1185 /*!
1186  * \brief Decode the CCBSBFree invoke argument parameters.
1187  *
1188  * \param ctrl D channel controller for diagnostic messages or global options.
1189  * \param tag Component tag that identified this structure.
1190  * \param pos Starting position of the ASN.1 component length.
1191  * \param end End of ASN.1 decoding data buffer.
1192  * \param args Arguments to fill in from the decoded buffer.
1193  *
1194  * \retval Start of the next ASN.1 component on success.
1195  * \retval NULL on error.
1196  */
rose_dec_etsi_CCBSBFree_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1197 const unsigned char *rose_dec_etsi_CCBSBFree_ARG(struct pri *ctrl, unsigned tag,
1198 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1199 {
1200 	struct roseEtsiCCBSBFree_ARG *ccbs_b_free;
1201 	int length;
1202 	int seq_offset;
1203 	const unsigned char *seq_end;
1204 	int32_t value;
1205 
1206 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1207 	if (ctrl->debug & PRI_DEBUG_APDU) {
1208 		pri_message(ctrl, "  CCBSBFree %s\n", asn1_tag2str(tag));
1209 	}
1210 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
1211 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
1212 
1213 	ccbs_b_free = &args->etsi.CCBSBFree;
1214 
1215 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1216 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
1217 	ASN1_CALL(pos, asn1_dec_int(ctrl, "recallMode", tag, pos, seq_end, &value));
1218 	ccbs_b_free->recall_mode = value;
1219 
1220 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1221 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1222 	ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, seq_end, &value));
1223 	ccbs_b_free->ccbs_reference = value;
1224 
1225 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1226 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1227 	ASN1_CALL(pos, rose_dec_Address(ctrl, "addressOfB", tag, pos, seq_end,
1228 		&ccbs_b_free->address_of_b));
1229 
1230 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1231 	ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_CLASS_APPLICATION | 0);
1232 	ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "q931ie", tag, pos, seq_end,
1233 		&ccbs_b_free->q931ie, sizeof(ccbs_b_free->q931ie_contents)));
1234 
1235 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
1236 
1237 	return pos;
1238 }
1239 
1240 /*!
1241  * \brief Decode the CCBSStopAlerting invoke argument parameters.
1242  *
1243  * \param ctrl D channel controller for diagnostic messages or global options.
1244  * \param tag Component tag that identified this structure.
1245  * \param pos Starting position of the ASN.1 component length.
1246  * \param end End of ASN.1 decoding data buffer.
1247  * \param args Arguments to fill in from the decoded buffer.
1248  *
1249  * \retval Start of the next ASN.1 component on success.
1250  * \retval NULL on error.
1251  */
rose_dec_etsi_CCBSStopAlerting_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1252 const unsigned char *rose_dec_etsi_CCBSStopAlerting_ARG(struct pri *ctrl, unsigned tag,
1253 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1254 {
1255 	int32_t value;
1256 
1257 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1258 	ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, end, &value));
1259 	args->etsi.CCBSStopAlerting.ccbs_reference = value;
1260 
1261 	return pos;
1262 }
1263 
1264 /*!
1265  * \brief Decode the CCBSStatusRequest invoke argument parameters.
1266  *
1267  * \param ctrl D channel controller for diagnostic messages or global options.
1268  * \param tag Component tag that identified this structure.
1269  * \param pos Starting position of the ASN.1 component length.
1270  * \param end End of ASN.1 decoding data buffer.
1271  * \param args Arguments to fill in from the decoded buffer.
1272  *
1273  * \retval Start of the next ASN.1 component on success.
1274  * \retval NULL on error.
1275  */
rose_dec_etsi_CCBSStatusRequest_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1276 const unsigned char *rose_dec_etsi_CCBSStatusRequest_ARG(struct pri *ctrl, unsigned tag,
1277 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1278 {
1279 	struct roseEtsiCCBSStatusRequest_ARG *ccbs_status_request;
1280 	int length;
1281 	int seq_offset;
1282 	const unsigned char *seq_end;
1283 	int32_t value;
1284 
1285 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1286 	if (ctrl->debug & PRI_DEBUG_APDU) {
1287 		pri_message(ctrl, "  CCBSStatusRequest %s\n", asn1_tag2str(tag));
1288 	}
1289 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
1290 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
1291 
1292 	ccbs_status_request = &args->etsi.CCBSStatusRequest;
1293 
1294 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1295 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
1296 	ASN1_CALL(pos, asn1_dec_int(ctrl, "recallMode", tag, pos, seq_end, &value));
1297 	ccbs_status_request->recall_mode = value;
1298 
1299 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1300 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1301 	ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, seq_end, &value));
1302 	ccbs_status_request->ccbs_reference = value;
1303 
1304 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1305 	ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_CLASS_APPLICATION | 0);
1306 	ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "q931ie", tag, pos, seq_end,
1307 		&ccbs_status_request->q931ie, sizeof(ccbs_status_request->q931ie_contents)));
1308 
1309 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
1310 
1311 	return pos;
1312 }
1313 
1314 /*!
1315  * \brief Decode the CCBSStatusRequest result argument parameters.
1316  *
1317  * \param ctrl D channel controller for diagnostic messages or global options.
1318  * \param tag Component tag that identified this structure.
1319  * \param pos Starting position of the ASN.1 component length.
1320  * \param end End of ASN.1 decoding data buffer.
1321  * \param args Arguments to fill in from the decoded buffer.
1322  *
1323  * \retval Start of the next ASN.1 component on success.
1324  * \retval NULL on error.
1325  */
rose_dec_etsi_CCBSStatusRequest_RES(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_result_args * args)1326 const unsigned char *rose_dec_etsi_CCBSStatusRequest_RES(struct pri *ctrl, unsigned tag,
1327 	const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
1328 {
1329 	int32_t value;
1330 
1331 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_BOOLEAN);
1332 	ASN1_CALL(pos, asn1_dec_boolean(ctrl, "free", tag, pos, end, &value));
1333 	args->etsi.CCBSStatusRequest.free = value;
1334 
1335 	return pos;
1336 }
1337 
1338 /*!
1339  * \internal
1340  * \brief Decode the CCBS/CCNR-Request invoke argument parameters.
1341  *
1342  * \param ctrl D channel controller for diagnostic messages or global options.
1343  * \param tag Component tag that identified this structure.
1344  * \param pos Starting position of the ASN.1 component length.
1345  * \param end End of ASN.1 decoding data buffer.
1346  * \param ccbs_request Parameter storage to fill.
1347  *
1348  * \retval Start of the next ASN.1 component on success.
1349  * \retval NULL on error.
1350  */
rose_dec_etsi_CC_Request_ARG_Backend(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,struct roseEtsiCCBSRequest_ARG * ccbs_request)1351 static const unsigned char *rose_dec_etsi_CC_Request_ARG_Backend(struct pri *ctrl,
1352 	unsigned tag, const unsigned char *pos, const unsigned char *end,
1353 	struct roseEtsiCCBSRequest_ARG *ccbs_request)
1354 {
1355 	int32_t value;
1356 
1357 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1358 	ASN1_CALL(pos, asn1_dec_int(ctrl, "callLinkageId", tag, pos, end, &value));
1359 	ccbs_request->call_linkage_id = value;
1360 
1361 	return pos;
1362 }
1363 
1364 /*!
1365  * \brief Decode the CCBSRequest invoke argument parameters.
1366  *
1367  * \param ctrl D channel controller for diagnostic messages or global options.
1368  * \param tag Component tag that identified this structure.
1369  * \param pos Starting position of the ASN.1 component length.
1370  * \param end End of ASN.1 decoding data buffer.
1371  * \param args Arguments to fill in from the decoded buffer.
1372  *
1373  * \retval Start of the next ASN.1 component on success.
1374  * \retval NULL on error.
1375  */
rose_dec_etsi_CCBSRequest_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1376 const unsigned char *rose_dec_etsi_CCBSRequest_ARG(struct pri *ctrl, unsigned tag,
1377 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1378 {
1379 	return rose_dec_etsi_CC_Request_ARG_Backend(ctrl, tag, pos, end,
1380 		&args->etsi.CCBSRequest);
1381 }
1382 
1383 /*!
1384  * \brief Decode the CCNRRequest invoke argument parameters.
1385  *
1386  * \param ctrl D channel controller for diagnostic messages or global options.
1387  * \param tag Component tag that identified this structure.
1388  * \param pos Starting position of the ASN.1 component length.
1389  * \param end End of ASN.1 decoding data buffer.
1390  * \param args Arguments to fill in from the decoded buffer.
1391  *
1392  * \retval Start of the next ASN.1 component on success.
1393  * \retval NULL on error.
1394  */
rose_dec_etsi_CCNRRequest_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1395 const unsigned char *rose_dec_etsi_CCNRRequest_ARG(struct pri *ctrl, unsigned tag,
1396 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1397 {
1398 	return rose_dec_etsi_CC_Request_ARG_Backend(ctrl, tag, pos, end,
1399 		&args->etsi.CCNRRequest);
1400 }
1401 
1402 /*!
1403  * \internal
1404  * \brief Decode the CCBS/CCNR-Request result argument parameters.
1405  *
1406  * \param ctrl D channel controller for diagnostic messages or global options.
1407  * \param name Field name
1408  * \param tag Component tag that identified this structure.
1409  * \param pos Starting position of the ASN.1 component length.
1410  * \param end End of ASN.1 decoding data buffer.
1411  * \param ccbs_request Parameter storage to fill.
1412  *
1413  * \retval Start of the next ASN.1 component on success.
1414  * \retval NULL on error.
1415  */
rose_dec_etsi_CC_Request_RES_Backend(struct pri * ctrl,const char * name,unsigned tag,const unsigned char * pos,const unsigned char * end,struct roseEtsiCCBSRequest_RES * ccbs_request)1416 static const unsigned char *rose_dec_etsi_CC_Request_RES_Backend(struct pri *ctrl,
1417 	const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
1418 	struct roseEtsiCCBSRequest_RES *ccbs_request)
1419 {
1420 	int length;
1421 	int seq_offset;
1422 	const unsigned char *seq_end;
1423 	int32_t value;
1424 
1425 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1426 	if (ctrl->debug & PRI_DEBUG_APDU) {
1427 		pri_message(ctrl, "  CC%sRequest %s\n", name, asn1_tag2str(tag));
1428 	}
1429 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
1430 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
1431 
1432 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1433 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
1434 	ASN1_CALL(pos, asn1_dec_int(ctrl, "recallMode", tag, pos, seq_end, &value));
1435 	ccbs_request->recall_mode = value;
1436 
1437 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1438 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
1439 	ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, seq_end, &value));
1440 	ccbs_request->ccbs_reference = value;
1441 
1442 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
1443 
1444 	return pos;
1445 }
1446 
1447 /*!
1448  * \brief Decode the CCBSRequest result argument parameters.
1449  *
1450  * \param ctrl D channel controller for diagnostic messages or global options.
1451  * \param tag Component tag that identified this structure.
1452  * \param pos Starting position of the ASN.1 component length.
1453  * \param end End of ASN.1 decoding data buffer.
1454  * \param args Arguments to fill in from the decoded buffer.
1455  *
1456  * \retval Start of the next ASN.1 component on success.
1457  * \retval NULL on error.
1458  */
rose_dec_etsi_CCBSRequest_RES(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_result_args * args)1459 const unsigned char *rose_dec_etsi_CCBSRequest_RES(struct pri *ctrl, unsigned tag,
1460 	const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
1461 {
1462 	return rose_dec_etsi_CC_Request_RES_Backend(ctrl, "BS", tag, pos, end,
1463 		&args->etsi.CCBSRequest);
1464 }
1465 
1466 /*!
1467  * \brief Decode the CCNRRequest result argument parameters.
1468  *
1469  * \param ctrl D channel controller for diagnostic messages or global options.
1470  * \param tag Component tag that identified this structure.
1471  * \param pos Starting position of the ASN.1 component length.
1472  * \param end End of ASN.1 decoding data buffer.
1473  * \param args Arguments to fill in from the decoded buffer.
1474  *
1475  * \retval Start of the next ASN.1 component on success.
1476  * \retval NULL on error.
1477  */
rose_dec_etsi_CCNRRequest_RES(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_result_args * args)1478 const unsigned char *rose_dec_etsi_CCNRRequest_RES(struct pri *ctrl, unsigned tag,
1479 	const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
1480 {
1481 	return rose_dec_etsi_CC_Request_RES_Backend(ctrl, "NR", tag, pos, end,
1482 		&args->etsi.CCNRRequest);
1483 }
1484 
1485 /*!
1486  * \internal
1487  * \brief Decode the CCBS/CCNR-Interrogate invoke argument parameters.
1488  *
1489  * \param ctrl D channel controller for diagnostic messages or global options.
1490  * \param name Field name
1491  * \param tag Component tag that identified this structure.
1492  * \param pos Starting position of the ASN.1 component length.
1493  * \param end End of ASN.1 decoding data buffer.
1494  * \param ccbs_interrogate Parameter storage to fill.
1495  *
1496  * \retval Start of the next ASN.1 component on success.
1497  * \retval NULL on error.
1498  */
rose_dec_etsi_CC_Interrogate_ARG_Backend(struct pri * ctrl,const char * name,unsigned tag,const unsigned char * pos,const unsigned char * end,struct roseEtsiCCBSInterrogate_ARG * ccbs_interrogate)1499 static const unsigned char *rose_dec_etsi_CC_Interrogate_ARG_Backend(struct pri *ctrl,
1500 	const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
1501 	struct roseEtsiCCBSInterrogate_ARG *ccbs_interrogate)
1502 {
1503 	int length;
1504 	int seq_offset;
1505 	const unsigned char *seq_end;
1506 	int32_t value;
1507 
1508 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1509 	if (ctrl->debug & PRI_DEBUG_APDU) {
1510 		pri_message(ctrl, "  CC%sInterrogate %s\n", name, asn1_tag2str(tag));
1511 	}
1512 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
1513 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
1514 
1515 	/*
1516 	 * A sequence specifies an ordered list of component types.
1517 	 * However, for simplicity we are not checking the order of
1518 	 * the optional components.
1519 	 */
1520 	ccbs_interrogate->ccbs_reference = 0;
1521 	ccbs_interrogate->ccbs_reference_present = 0;
1522 	ccbs_interrogate->a_party_number.length = 0;	/* Assume A party number not present */
1523 	while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
1524 		ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1525 		switch (tag) {
1526 		case ASN1_TYPE_INTEGER:
1527 			ASN1_CALL(pos, asn1_dec_int(ctrl, "ccbsReference", tag, pos, seq_end,
1528 				&value));
1529 			ccbs_interrogate->ccbs_reference = value;
1530 			ccbs_interrogate->ccbs_reference_present = 1;
1531 			break;
1532 		default:
1533 			ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "partyNumberOfA", tag, pos,
1534 				seq_end, &ccbs_interrogate->a_party_number));
1535 			break;
1536 		}
1537 	}
1538 
1539 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
1540 
1541 	return pos;
1542 }
1543 
1544 /*!
1545  * \brief Decode the CCBSInterrogate invoke argument parameters.
1546  *
1547  * \param ctrl D channel controller for diagnostic messages or global options.
1548  * \param tag Component tag that identified this structure.
1549  * \param pos Starting position of the ASN.1 component length.
1550  * \param end End of ASN.1 decoding data buffer.
1551  * \param args Arguments to fill in from the decoded buffer.
1552  *
1553  * \retval Start of the next ASN.1 component on success.
1554  * \retval NULL on error.
1555  */
rose_dec_etsi_CCBSInterrogate_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1556 const unsigned char *rose_dec_etsi_CCBSInterrogate_ARG(struct pri *ctrl, unsigned tag,
1557 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1558 {
1559 	return rose_dec_etsi_CC_Interrogate_ARG_Backend(ctrl, "BS", tag, pos, end,
1560 		&args->etsi.CCBSInterrogate);
1561 }
1562 
1563 /*!
1564  * \brief Decode the CCNRInterrogate invoke argument parameters.
1565  *
1566  * \param ctrl D channel controller for diagnostic messages or global options.
1567  * \param tag Component tag that identified this structure.
1568  * \param pos Starting position of the ASN.1 component length.
1569  * \param end End of ASN.1 decoding data buffer.
1570  * \param args Arguments to fill in from the decoded buffer.
1571  *
1572  * \retval Start of the next ASN.1 component on success.
1573  * \retval NULL on error.
1574  */
rose_dec_etsi_CCNRInterrogate_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1575 const unsigned char *rose_dec_etsi_CCNRInterrogate_ARG(struct pri *ctrl, unsigned tag,
1576 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1577 {
1578 	return rose_dec_etsi_CC_Interrogate_ARG_Backend(ctrl, "NR", tag, pos, end,
1579 		&args->etsi.CCNRInterrogate);
1580 }
1581 
1582 /*!
1583  * \internal
1584  * \brief Decode the CCBS/CCNR-Interrogate result argument parameters.
1585  *
1586  * \param ctrl D channel controller for diagnostic messages or global options.
1587  * \param name Field name
1588  * \param tag Component tag that identified this structure.
1589  * \param pos Starting position of the ASN.1 component length.
1590  * \param end End of ASN.1 decoding data buffer.
1591  * \param ccbs_interrogate Parameter storage to fill.
1592  *
1593  * \retval Start of the next ASN.1 component on success.
1594  * \retval NULL on error.
1595  */
rose_dec_etsi_CC_Interrogate_RES_Backend(struct pri * ctrl,const char * name,unsigned tag,const unsigned char * pos,const unsigned char * end,struct roseEtsiCCBSInterrogate_RES * ccbs_interrogate)1596 static const unsigned char *rose_dec_etsi_CC_Interrogate_RES_Backend(struct pri *ctrl,
1597 	const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
1598 	struct roseEtsiCCBSInterrogate_RES *ccbs_interrogate)
1599 {
1600 	int length;
1601 	int seq_offset;
1602 	const unsigned char *seq_end;
1603 	int32_t value;
1604 
1605 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1606 	if (ctrl->debug & PRI_DEBUG_APDU) {
1607 		pri_message(ctrl, "  CC%sInterrogate %s\n", name, asn1_tag2str(tag));
1608 	}
1609 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
1610 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
1611 
1612 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1613 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
1614 	ASN1_CALL(pos, asn1_dec_int(ctrl, "recallMode", tag, pos, seq_end, &value));
1615 	ccbs_interrogate->recall_mode = value;
1616 
1617 	ccbs_interrogate->call_details.num_records = 0;
1618 	if (pos < seq_end && *pos != ASN1_INDEF_TERM) {
1619 		ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1620 		ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1621 		ASN1_CALL(pos, rose_dec_etsi_CallDetails(ctrl, "callDetails", tag, pos, seq_end,
1622 			&ccbs_interrogate->call_details));
1623 	}
1624 
1625 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
1626 
1627 	return pos;
1628 }
1629 
1630 /*!
1631  * \brief Decode the CCBSInterrogate result argument parameters.
1632  *
1633  * \param ctrl D channel controller for diagnostic messages or global options.
1634  * \param tag Component tag that identified this structure.
1635  * \param pos Starting position of the ASN.1 component length.
1636  * \param end End of ASN.1 decoding data buffer.
1637  * \param args Arguments to fill in from the decoded buffer.
1638  *
1639  * \retval Start of the next ASN.1 component on success.
1640  * \retval NULL on error.
1641  */
rose_dec_etsi_CCBSInterrogate_RES(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_result_args * args)1642 const unsigned char *rose_dec_etsi_CCBSInterrogate_RES(struct pri *ctrl, unsigned tag,
1643 	const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
1644 {
1645 	return rose_dec_etsi_CC_Interrogate_RES_Backend(ctrl, "BS", tag, pos, end,
1646 		&args->etsi.CCBSInterrogate);
1647 }
1648 
1649 /*!
1650  * \brief Decode the CCNRInterrogate result argument parameters.
1651  *
1652  * \param ctrl D channel controller for diagnostic messages or global options.
1653  * \param tag Component tag that identified this structure.
1654  * \param pos Starting position of the ASN.1 component length.
1655  * \param end End of ASN.1 decoding data buffer.
1656  * \param args Arguments to fill in from the decoded buffer.
1657  *
1658  * \retval Start of the next ASN.1 component on success.
1659  * \retval NULL on error.
1660  */
rose_dec_etsi_CCNRInterrogate_RES(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_result_args * args)1661 const unsigned char *rose_dec_etsi_CCNRInterrogate_RES(struct pri *ctrl, unsigned tag,
1662 	const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
1663 {
1664 	return rose_dec_etsi_CC_Interrogate_RES_Backend(ctrl, "NR", tag, pos, end,
1665 		&args->etsi.CCNRInterrogate);
1666 }
1667 
1668 /*!
1669  * \internal
1670  * \brief Decode the CCBS-T/CCNR-T-Request invoke argument parameters.
1671  *
1672  * \param ctrl D channel controller for diagnostic messages or global options.
1673  * \param name Field name
1674  * \param tag Component tag that identified this structure.
1675  * \param pos Starting position of the ASN.1 component length.
1676  * \param end End of ASN.1 decoding data buffer.
1677  * \param ccbs_t_request Parameter storage to fill.
1678  *
1679  * \retval Start of the next ASN.1 component on success.
1680  * \retval NULL on error.
1681  */
rose_dec_etsi_CC_T_Request_ARG_Backend(struct pri * ctrl,const char * name,unsigned tag,const unsigned char * pos,const unsigned char * end,struct roseEtsiCCBS_T_Request_ARG * ccbs_t_request)1682 static const unsigned char *rose_dec_etsi_CC_T_Request_ARG_Backend(struct pri *ctrl,
1683 	const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
1684 	struct roseEtsiCCBS_T_Request_ARG *ccbs_t_request)
1685 {
1686 	int length;
1687 	int seq_offset;
1688 	const unsigned char *seq_end;
1689 	const unsigned char *save_pos;
1690 	int32_t value;
1691 
1692 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1693 	if (ctrl->debug & PRI_DEBUG_APDU) {
1694 		pri_message(ctrl, "  CC%s-T-Request %s\n", name, asn1_tag2str(tag));
1695 	}
1696 	ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
1697 	ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
1698 
1699 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1700 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
1701 	ASN1_CALL(pos, rose_dec_Address(ctrl, "destinationAddress", tag, pos, seq_end,
1702 		&ccbs_t_request->destination));
1703 
1704 	ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1705 	ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_CLASS_APPLICATION | 0);
1706 	ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "q931ie", tag, pos, seq_end,
1707 		&ccbs_t_request->q931ie, sizeof(ccbs_t_request->q931ie_contents)));
1708 
1709 	/*
1710 	 * A sequence specifies an ordered list of component types.
1711 	 * However, for simplicity we are not checking the order of
1712 	 * the remaining optional components.
1713 	 */
1714 	ccbs_t_request->retention_supported = 0;	/* DEFAULT retention_supported value (FALSE) */
1715 	ccbs_t_request->presentation_allowed_indicator = 0;
1716 	ccbs_t_request->presentation_allowed_indicator_present = 0;
1717 	ccbs_t_request->originating.number.length = 0;	/* Assume originating party number not present */
1718 	while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
1719 		save_pos = pos;
1720 		ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
1721 		switch (tag) {
1722 		case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
1723 			ASN1_CALL(pos, asn1_dec_boolean(ctrl, "retentionSupported", tag, pos,
1724 				seq_end, &value));
1725 			ccbs_t_request->retention_supported = value;
1726 			break;
1727 		case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
1728 			ASN1_CALL(pos, asn1_dec_boolean(ctrl, "presentationAllowedIndicator", tag,
1729 				pos, seq_end, &value));
1730 			ccbs_t_request->presentation_allowed_indicator = value;
1731 			ccbs_t_request->presentation_allowed_indicator_present = 1;
1732 			break;
1733 		case ASN1_TAG_SEQUENCE:
1734 			ASN1_CALL(pos, rose_dec_Address(ctrl, "originatingAddress", tag, pos,
1735 				seq_end, &ccbs_t_request->originating));
1736 			break;
1737 		default:
1738 			pos = save_pos;
1739 			goto cancel_options;
1740 		}
1741 	}
1742 cancel_options:;
1743 
1744 	ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
1745 
1746 	return pos;
1747 }
1748 
1749 /*!
1750  * \brief Decode the CCBS_T_Request invoke argument parameters.
1751  *
1752  * \param ctrl D channel controller for diagnostic messages or global options.
1753  * \param tag Component tag that identified this structure.
1754  * \param pos Starting position of the ASN.1 component length.
1755  * \param end End of ASN.1 decoding data buffer.
1756  * \param args Arguments to fill in from the decoded buffer.
1757  *
1758  * \retval Start of the next ASN.1 component on success.
1759  * \retval NULL on error.
1760  */
rose_dec_etsi_CCBS_T_Request_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1761 const unsigned char *rose_dec_etsi_CCBS_T_Request_ARG(struct pri *ctrl, unsigned tag,
1762 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1763 {
1764 	return rose_dec_etsi_CC_T_Request_ARG_Backend(ctrl, "BS", tag, pos, end,
1765 		&args->etsi.CCBS_T_Request);
1766 }
1767 
1768 /*!
1769  * \brief Decode the CCNR_T_Request invoke argument parameters.
1770  *
1771  * \param ctrl D channel controller for diagnostic messages or global options.
1772  * \param tag Component tag that identified this structure.
1773  * \param pos Starting position of the ASN.1 component length.
1774  * \param end End of ASN.1 decoding data buffer.
1775  * \param args Arguments to fill in from the decoded buffer.
1776  *
1777  * \retval Start of the next ASN.1 component on success.
1778  * \retval NULL on error.
1779  */
rose_dec_etsi_CCNR_T_Request_ARG(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_invoke_args * args)1780 const unsigned char *rose_dec_etsi_CCNR_T_Request_ARG(struct pri *ctrl, unsigned tag,
1781 	const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
1782 {
1783 	return rose_dec_etsi_CC_T_Request_ARG_Backend(ctrl, "NR", tag, pos, end,
1784 		&args->etsi.CCNR_T_Request);
1785 }
1786 
1787 /*!
1788  * \internal
1789  * \brief Decode the CCBS-T/CCNR-T-Request result argument parameters.
1790  *
1791  * \param ctrl D channel controller for diagnostic messages or global options.
1792  * \param name Field name
1793  * \param tag Component tag that identified this structure.
1794  * \param pos Starting position of the ASN.1 component length.
1795  * \param end End of ASN.1 decoding data buffer.
1796  * \param ccbs_t_request Parameter storage to fill.
1797  *
1798  * \retval Start of the next ASN.1 component on success.
1799  * \retval NULL on error.
1800  */
rose_dec_etsi_CC_T_Request_RES_Backend(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,struct roseEtsiCCBS_T_Request_RES * ccbs_t_request)1801 static const unsigned char *rose_dec_etsi_CC_T_Request_RES_Backend(struct pri *ctrl,
1802 	unsigned tag, const unsigned char *pos, const unsigned char *end,
1803 	struct roseEtsiCCBS_T_Request_RES *ccbs_t_request)
1804 {
1805 	int32_t value;
1806 
1807 	ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_BOOLEAN);
1808 	ASN1_CALL(pos, asn1_dec_boolean(ctrl, "retentionSupported", tag, pos, end, &value));
1809 	ccbs_t_request->retention_supported = value;
1810 
1811 	return pos;
1812 }
1813 
1814 /*!
1815  * \brief Decode the CCBS_T_Request result argument parameters.
1816  *
1817  * \param ctrl D channel controller for diagnostic messages or global options.
1818  * \param tag Component tag that identified this structure.
1819  * \param pos Starting position of the ASN.1 component length.
1820  * \param end End of ASN.1 decoding data buffer.
1821  * \param args Arguments to fill in from the decoded buffer.
1822  *
1823  * \retval Start of the next ASN.1 component on success.
1824  * \retval NULL on error.
1825  */
rose_dec_etsi_CCBS_T_Request_RES(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_result_args * args)1826 const unsigned char *rose_dec_etsi_CCBS_T_Request_RES(struct pri *ctrl, unsigned tag,
1827 	const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
1828 {
1829 	return rose_dec_etsi_CC_T_Request_RES_Backend(ctrl, tag, pos, end,
1830 		&args->etsi.CCBS_T_Request);
1831 }
1832 
1833 /*!
1834  * \brief Decode the CCNR_T_Request result argument parameters.
1835  *
1836  * \param ctrl D channel controller for diagnostic messages or global options.
1837  * \param tag Component tag that identified this structure.
1838  * \param pos Starting position of the ASN.1 component length.
1839  * \param end End of ASN.1 decoding data buffer.
1840  * \param args Arguments to fill in from the decoded buffer.
1841  *
1842  * \retval Start of the next ASN.1 component on success.
1843  * \retval NULL on error.
1844  */
rose_dec_etsi_CCNR_T_Request_RES(struct pri * ctrl,unsigned tag,const unsigned char * pos,const unsigned char * end,union rose_msg_result_args * args)1845 const unsigned char *rose_dec_etsi_CCNR_T_Request_RES(struct pri *ctrl, unsigned tag,
1846 	const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
1847 {
1848 	return rose_dec_etsi_CC_T_Request_RES_Backend(ctrl, tag, pos, end,
1849 		&args->etsi.CCNR_T_Request);
1850 }
1851 
1852 /* ------------------------------------------------------------------- */
1853 /* end rose_etsi_cc.c */
1854