Regenerate a few more of the ASN.1 dissectors
[obnox/wireshark/wip.git] / epan / dissectors / packet-q932-ros.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler   */
3 /* packet-q932-ros.c                                                          */
4 /* ../../tools/asn2wrs.py -b -p q932.ros -c ./q932-ros.cnf -s ./packet-q932-ros-template -D . ../ros/Remote-Operations-Information-Objects.asn Facility-Information-Element-Components.asn */
5
6 /* Input file: packet-q932-ros-template.c */
7
8 #line 1 "packet-q932-ros-template.c"
9 /* packet-q932-ros.c
10  * Routines for Q.932 packet dissection
11  * 2007  Tomas Kukosa
12  *
13  * $Id$
14  *
15  * Wireshark - Network traffic analyzer
16  * By Gerald Combs <gerald@wireshark.org>
17  * Copyright 1998 Gerald Combs
18  *
19  * This program is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License
21  * as published by the Free Software Foundation; either version 2
22  * of the License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program; if not, write to the Free Software
31  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
32  */
33
34 #ifdef HAVE_CONFIG_H
35 # include "config.h"
36 #endif
37
38 #include <epan/packet.h>
39 #include <epan/strutil.h>
40 #include <epan/asn1.h>
41 #include <epan/expert.h>
42
43 #include "packet-ber.h"
44
45 #define PNAME  "Q.932 Operations Service Element"
46 #define PSNAME "Q932.ROS"
47 #define PFNAME "q932.ros"
48
49 /* Initialize the protocol and registered fields */
50 static int proto_q932_ros = -1;
51
52 /*--- Included file: packet-q932-ros-hf.c ---*/
53 #line 1 "packet-q932-ros-hf.c"
54 static int hf_q932_ros_ROS_PDU = -1;              /* ROS */
55 static int hf_q932_ros_local = -1;                /* T_local */
56 static int hf_q932_ros_global = -1;               /* T_global */
57 static int hf_q932_ros_invoke = -1;               /* Invoke */
58 static int hf_q932_ros_returnResult = -1;         /* ReturnResult */
59 static int hf_q932_ros_returnError = -1;          /* ReturnError */
60 static int hf_q932_ros_reject = -1;               /* Reject */
61 static int hf_q932_ros_invokeId = -1;             /* InvokeId */
62 static int hf_q932_ros_linkedId = -1;             /* T_linkedId */
63 static int hf_q932_ros_linkedIdPresent = -1;      /* T_linkedIdPresent */
64 static int hf_q932_ros_absent = -1;               /* NULL */
65 static int hf_q932_ros_opcode = -1;               /* Code */
66 static int hf_q932_ros_argument = -1;             /* InvokeArgument */
67 static int hf_q932_ros_result = -1;               /* T_result */
68 static int hf_q932_ros_resultArgument = -1;       /* ResultArgument */
69 static int hf_q932_ros_errcode = -1;              /* Code */
70 static int hf_q932_ros_parameter = -1;            /* T_parameter */
71 static int hf_q932_ros_problem = -1;              /* T_problem */
72 static int hf_q932_ros_general = -1;              /* GeneralProblem */
73 static int hf_q932_ros_invokeProblem = -1;        /* InvokeProblem */
74 static int hf_q932_ros_returnResultProblem = -1;  /* ReturnResultProblem */
75 static int hf_q932_ros_returnErrorProblem = -1;   /* ReturnErrorProblem */
76 static int hf_q932_ros_present = -1;              /* INTEGER */
77 static int hf_q932_ros_InvokeId_present = -1;     /* InvokeId_present */
78
79 /*--- End of included file: packet-q932-ros-hf.c ---*/
80 #line 44 "packet-q932-ros-template.c"
81
82 /* Initialize the subtree pointers */
83
84 /*--- Included file: packet-q932-ros-ett.c ---*/
85 #line 1 "packet-q932-ros-ett.c"
86 static gint ett_q932_ros_Code = -1;
87 static gint ett_q932_ros_ROS = -1;
88 static gint ett_q932_ros_Invoke = -1;
89 static gint ett_q932_ros_T_linkedId = -1;
90 static gint ett_q932_ros_ReturnResult = -1;
91 static gint ett_q932_ros_T_result = -1;
92 static gint ett_q932_ros_ReturnError = -1;
93 static gint ett_q932_ros_Reject = -1;
94 static gint ett_q932_ros_T_problem = -1;
95 static gint ett_q932_ros_InvokeId = -1;
96
97 /*--- End of included file: packet-q932-ros-ett.c ---*/
98 #line 47 "packet-q932-ros-template.c"
99
100 /* Preferences */
101
102 /* Subdissectors */
103 static dissector_handle_t data_handle = NULL; 
104
105 /* Gloabl variables */
106 static rose_ctx_t *rose_ctx_tmp;
107
108 static guint32 problem_val;
109 static gchar problem_str[64];
110 static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb;
111
112
113
114 /*--- Included file: packet-q932-ros-fn.c ---*/
115 #line 1 "packet-q932-ros-fn.c"
116
117
118 static int
119 dissect_q932_ros_T_local(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
120   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
121                                                 &actx->rose_ctx->d.code_local);
122
123   return offset;
124 }
125
126
127
128 static int
129 dissect_q932_ros_T_global(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
130   offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->rose_ctx->d.code_global);
131
132   return offset;
133 }
134
135
136 static const value_string q932_ros_Code_vals[] = {
137   {   0, "local" },
138   {   1, "global" },
139   { 0, NULL }
140 };
141
142 static const ber_choice_t Code_choice[] = {
143   {   0, &hf_q932_ros_local      , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_q932_ros_T_local },
144   {   1, &hf_q932_ros_global     , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_q932_ros_T_global },
145   { 0, NULL, 0, 0, 0, NULL }
146 };
147
148 static int
149 dissect_q932_ros_Code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
150   offset = dissect_ber_choice(actx, tree, tvb, offset,
151                                  Code_choice, hf_index, ett_q932_ros_Code,
152                                  &actx->rose_ctx->d.code);
153
154 #line 43 "q932-ros.cnf"
155   actx->rose_ctx->d.code_item = actx->created_item;
156
157   return offset;
158 }
159
160
161
162 static int
163 dissect_q932_ros_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
164   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
165                                                 NULL);
166
167   return offset;
168 }
169
170
171
172 static int
173 dissect_q932_ros_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
174   offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
175
176   return offset;
177 }
178
179
180 static const value_string q932_ros_InvokeId_vals[] = {
181   {   0, "present" },
182   {   1, "absent" },
183   { 0, NULL }
184 };
185
186 static const ber_choice_t InvokeId_choice[] = {
187   {   0, &hf_q932_ros_present    , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_q932_ros_INTEGER },
188   {   1, &hf_q932_ros_absent     , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_q932_ros_NULL },
189   { 0, NULL, 0, 0, 0, NULL }
190 };
191
192 static int
193 dissect_q932_ros_InvokeId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
194   offset = dissect_ber_choice(actx, tree, tvb, offset,
195                                  InvokeId_choice, hf_index, ett_q932_ros_InvokeId,
196                                  NULL);
197
198   return offset;
199 }
200
201
202
203 static int
204 dissect_q932_ros_InvokeId_present(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
205   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
206                                                 NULL);
207
208   return offset;
209 }
210
211
212
213 static int
214 dissect_q932_ros_T_linkedIdPresent(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
215   offset = dissect_q932_ros_InvokeId_present(implicit_tag, tvb, offset, actx, tree, hf_index);
216
217   return offset;
218 }
219
220
221 static const value_string q932_ros_T_linkedId_vals[] = {
222   {   0, "present" },
223   {   1, "absent" },
224   { 0, NULL }
225 };
226
227 static const ber_choice_t T_linkedId_choice[] = {
228   {   0, &hf_q932_ros_linkedIdPresent, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_q932_ros_T_linkedIdPresent },
229   {   1, &hf_q932_ros_absent     , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_q932_ros_NULL },
230   { 0, NULL, 0, 0, 0, NULL }
231 };
232
233 static int
234 dissect_q932_ros_T_linkedId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
235   offset = dissect_ber_choice(actx, tree, tvb, offset,
236                                  T_linkedId_choice, hf_index, ett_q932_ros_T_linkedId,
237                                  NULL);
238
239   return offset;
240 }
241
242
243
244 static int
245 dissect_q932_ros_InvokeArgument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
246 #line 69 "q932-ros.cnf"
247   gint len;
248
249   len = tvb_length_remaining(tvb, offset);
250   if (len)
251     proto_tree_add_item(tree, hf_index, tvb, offset, len, FALSE);
252   arg_next_tvb = tvb_new_subset(tvb, offset, len, len);
253
254   offset += tvb_length_remaining(tvb, offset);
255
256
257   return offset;
258 }
259
260
261 static const ber_sequence_t Invoke_sequence[] = {
262   { &hf_q932_ros_invokeId   , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_ros_InvokeId },
263   { &hf_q932_ros_linkedId   , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_ros_T_linkedId },
264   { &hf_q932_ros_opcode     , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_ros_Code },
265   { &hf_q932_ros_argument   , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_q932_ros_InvokeArgument },
266   { NULL, 0, 0, 0, NULL }
267 };
268
269 static int
270 dissect_q932_ros_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
271 #line 8 "ros-inv.cnf"
272   dissector_handle_t arg_handle = NULL;
273   const gchar *descr = "";
274
275   arg_next_tvb = NULL;
276
277   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
278                                    Invoke_sequence, hf_index, ett_q932_ros_Invoke);
279
280 #line 13 "ros-inv.cnf"
281   actx->rose_ctx->d.pdu = 1;
282
283   if ((actx->rose_ctx->d.code == 0) && actx->rose_ctx->arg_local_dissector_table) {
284     arg_handle = dissector_get_port_handle(actx->rose_ctx->arg_local_dissector_table, actx->rose_ctx->d.code_local);
285   } else if ((actx->rose_ctx->d.code == 1) && actx->rose_ctx->arg_global_dissector_table) {
286     arg_handle = dissector_get_string_handle(actx->rose_ctx->arg_global_dissector_table, actx->rose_ctx->d.code_global);
287   } else {
288     arg_handle = NULL;
289   }
290
291   if (!arg_handle || 
292       !proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(arg_handle)))) {
293     if (actx->rose_ctx->d.code == 0)
294       descr = ep_strdup_printf("INV: %d", actx->rose_ctx->d.code_local);
295     else if (actx->rose_ctx->d.code == 1)
296       descr = ep_strdup_printf("INV: %s", actx->rose_ctx->d.code_global);
297   } else {
298     descr = ep_strdup_printf("INV:");
299   }
300
301   if (actx->rose_ctx->apdu_depth >= 0)
302     proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), "  %s", descr);
303   if (actx->rose_ctx->fillin_info && check_col(actx->pinfo->cinfo, COL_INFO))
304     col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
305   if (actx->rose_ctx->fillin_ptr)
306     g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
307
308   if (!arg_next_tvb) {  /* empty argument */
309     arg_next_tvb = tvb_new_subset(tvb, (actx->encoding==ASN1_ENC_PER)?offset>>3:offset, 0, 0);
310   }
311   actx->pinfo->private_data = actx->rose_ctx;
312   call_dissector((arg_handle)?arg_handle:data_handle, arg_next_tvb, actx->pinfo, tree);
313   if (!arg_handle) {
314     expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr);
315   }
316
317   return offset;
318 }
319
320
321
322 static int
323 dissect_q932_ros_ResultArgument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
324 #line 87 "q932-ros.cnf"
325   gint len;
326
327   len = tvb_length_remaining(tvb, offset);
328   if (len)
329     proto_tree_add_item(tree, hf_index, tvb, offset, len, FALSE);
330   res_next_tvb = tvb_new_subset(tvb, offset, len, len);
331
332   offset += tvb_length_remaining(tvb, offset);
333
334
335
336   return offset;
337 }
338
339
340 static const ber_sequence_t T_result_sequence[] = {
341   { &hf_q932_ros_opcode     , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_ros_Code },
342   { &hf_q932_ros_resultArgument, BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, dissect_q932_ros_ResultArgument },
343   { NULL, 0, 0, 0, NULL }
344 };
345
346 static int
347 dissect_q932_ros_T_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
348   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
349                                    T_result_sequence, hf_index, ett_q932_ros_T_result);
350
351   return offset;
352 }
353
354
355 static const ber_sequence_t ReturnResult_sequence[] = {
356   { &hf_q932_ros_invokeId   , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_ros_InvokeId },
357   { &hf_q932_ros_result     , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_q932_ros_T_result },
358   { NULL, 0, 0, 0, NULL }
359 };
360
361 static int
362 dissect_q932_ros_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
363 #line 7 "ros-res.cnf"
364   dissector_handle_t res_handle = NULL;
365   const gchar *descr = "";
366
367   res_next_tvb = NULL;
368
369   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
370                                    ReturnResult_sequence, hf_index, ett_q932_ros_ReturnResult);
371
372 #line 12 "ros-res.cnf"
373   actx->rose_ctx->d.pdu = 2;
374
375   if ((actx->rose_ctx->d.code == 0) && actx->rose_ctx->res_local_dissector_table) {
376     res_handle = dissector_get_port_handle(actx->rose_ctx->res_local_dissector_table, actx->rose_ctx->d.code_local);
377   } else if ((actx->rose_ctx->d.code == 1) && actx->rose_ctx->res_global_dissector_table) {
378     res_handle = dissector_get_string_handle(actx->rose_ctx->res_global_dissector_table, actx->rose_ctx->d.code_global);
379   } else {
380     res_handle = NULL;
381   }
382
383   if (!res_handle || 
384       !proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(res_handle)))) {
385     if (actx->rose_ctx->d.code == 0)
386       descr = ep_strdup_printf("RES: %d", actx->rose_ctx->d.code_local);
387     else if (actx->rose_ctx->d.code == 1)
388       descr = ep_strdup_printf("RES: %s", actx->rose_ctx->d.code_global);
389   } else {
390     descr = ep_strdup_printf("RES:");
391   }
392
393   if (actx->rose_ctx->apdu_depth >= 0)
394     proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), "  %s", descr);
395   if (actx->rose_ctx->fillin_info && check_col(actx->pinfo->cinfo, COL_INFO))
396     col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
397   if (actx->rose_ctx->fillin_ptr)
398     g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
399
400   if (!res_next_tvb) {  /* empty result */
401     res_next_tvb = tvb_new_subset(tvb, (actx->encoding==ASN1_ENC_PER)?offset>>3:offset, 0, 0);
402   }
403   actx->pinfo->private_data = actx->rose_ctx;
404   call_dissector((res_handle)?res_handle:data_handle, res_next_tvb, actx->pinfo, tree); 
405   if (!res_handle) {
406     expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr);
407   }
408
409   return offset;
410 }
411
412
413
414 static int
415 dissect_q932_ros_T_parameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
416 #line 106 "q932-ros.cnf"
417
418   gint len;
419
420   len = tvb_length_remaining(tvb, offset);
421   if (len)
422     proto_tree_add_item(tree, hf_index, tvb, offset, len, FALSE);
423   err_next_tvb = tvb_new_subset(tvb, offset, len, len);
424
425   offset += tvb_length_remaining(tvb, offset);
426
427
428   return offset;
429 }
430
431
432 static const ber_sequence_t ReturnError_sequence[] = {
433   { &hf_q932_ros_invokeId   , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_ros_InvokeId },
434   { &hf_q932_ros_errcode    , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_ros_Code },
435   { &hf_q932_ros_parameter  , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_q932_ros_T_parameter },
436   { NULL, 0, 0, 0, NULL }
437 };
438
439 static int
440 dissect_q932_ros_ReturnError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
441 #line 7 "ros-err.cnf"
442   dissector_handle_t err_handle = NULL;
443   const gchar *descr = "";
444
445   err_next_tvb = NULL;
446
447   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
448                                    ReturnError_sequence, hf_index, ett_q932_ros_ReturnError);
449
450 #line 12 "ros-err.cnf"
451   actx->rose_ctx->d.pdu = 3;
452
453   if ((actx->rose_ctx->d.code == 0) && actx->rose_ctx->err_local_dissector_table) {
454     err_handle = dissector_get_port_handle(actx->rose_ctx->err_local_dissector_table, actx->rose_ctx->d.code_local);
455   } else if ((actx->rose_ctx->d.code == 1) && actx->rose_ctx->err_global_dissector_table) {
456     err_handle = dissector_get_string_handle(actx->rose_ctx->err_global_dissector_table, actx->rose_ctx->d.code_global);
457   } else {
458     err_handle = NULL;
459   }
460
461   if (!err_handle || 
462       !proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(err_handle)))) {
463     if (actx->rose_ctx->d.code == 0)
464       descr = ep_strdup_printf("ERR: %d", actx->rose_ctx->d.code_local);
465     else if (actx->rose_ctx->d.code == 1)
466       descr = ep_strdup_printf("ERR: %s", actx->rose_ctx->d.code_global);
467   } else {
468     descr = ep_strdup_printf("ERR:");
469   }
470
471   if (actx->rose_ctx->apdu_depth >= 0)
472     proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), "  %s", descr);
473   if (actx->rose_ctx->fillin_info && check_col(actx->pinfo->cinfo, COL_INFO))
474     col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
475   if (actx->rose_ctx->fillin_ptr)
476     g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
477
478   if (!err_next_tvb) {  /* empty error */
479     err_next_tvb = tvb_new_subset(tvb, (actx->encoding==ASN1_ENC_PER)?offset>>3:offset, 0, 0);
480   }
481   actx->pinfo->private_data = actx->rose_ctx;
482   call_dissector((err_handle)?err_handle:data_handle, err_next_tvb, actx->pinfo, tree); 
483   if (!err_handle) {
484     expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr);
485   }
486
487   return offset;
488 }
489
490
491 static const value_string q932_ros_GeneralProblem_vals[] = {
492   {   0, "unrecognizedComponent" },
493   {   1, "mistypedComponent" },
494   {   2, "badlyStructuredComponent" },
495   { 0, NULL }
496 };
497
498
499 static int
500 dissect_q932_ros_GeneralProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
501   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
502                                                 &problem_val);
503
504 #line 54 "q932-ros.cnf"
505   g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_GeneralProblem_vals), ""), 64);
506
507   return offset;
508 }
509
510
511 static const value_string q932_ros_InvokeProblem_vals[] = {
512   {   0, "duplicateInvocation" },
513   {   1, "unrecognizedOperation" },
514   {   2, "mistypedArgument" },
515   {   3, "resourceLimitation" },
516   {   4, "releaseInProgress" },
517   {   5, "unrecognizedLinkedId" },
518   {   6, "linkedResponseUnexpected" },
519   {   7, "unexpectedLinkedOperation" },
520   { 0, NULL }
521 };
522
523
524 static int
525 dissect_q932_ros_InvokeProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
526   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
527                                                 &problem_val);
528
529 #line 56 "q932-ros.cnf"
530   g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_InvokeProblem_vals), ""), 64);
531
532   return offset;
533 }
534
535
536 static const value_string q932_ros_ReturnResultProblem_vals[] = {
537   {   0, "unrecognizedInvocation" },
538   {   1, "resultResponseUnexpected" },
539   {   2, "mistypedResult" },
540   { 0, NULL }
541 };
542
543
544 static int
545 dissect_q932_ros_ReturnResultProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
546   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
547                                                 &problem_val);
548
549 #line 58 "q932-ros.cnf"
550   g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_ReturnResultProblem_vals), ""), 64);
551
552   return offset;
553 }
554
555
556 static const value_string q932_ros_ReturnErrorProblem_vals[] = {
557   {   0, "unrecognizedInvocation" },
558   {   1, "errorResponseUnexpected" },
559   {   2, "unrecognizedError" },
560   {   3, "unexpectedError" },
561   {   4, "mistypedParameter" },
562   { 0, NULL }
563 };
564
565
566 static int
567 dissect_q932_ros_ReturnErrorProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
568   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
569                                                 &problem_val);
570
571 #line 60 "q932-ros.cnf"
572   g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_ReturnErrorProblem_vals), ""), 64);
573
574   return offset;
575 }
576
577
578 static const value_string q932_ros_T_problem_vals[] = {
579   {   0, "general" },
580   {   1, "invoke" },
581   {   2, "returnResult" },
582   {   3, "returnError" },
583   { 0, NULL }
584 };
585
586 static const ber_choice_t T_problem_choice[] = {
587   {   0, &hf_q932_ros_general    , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_q932_ros_GeneralProblem },
588   {   1, &hf_q932_ros_invokeProblem, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_q932_ros_InvokeProblem },
589   {   2, &hf_q932_ros_returnResultProblem, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_q932_ros_ReturnResultProblem },
590   {   3, &hf_q932_ros_returnErrorProblem, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_q932_ros_ReturnErrorProblem },
591   { 0, NULL, 0, 0, 0, NULL }
592 };
593
594 static int
595 dissect_q932_ros_T_problem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
596   offset = dissect_ber_choice(actx, tree, tvb, offset,
597                                  T_problem_choice, hf_index, ett_q932_ros_T_problem,
598                                  NULL);
599
600   return offset;
601 }
602
603
604 static const ber_sequence_t Reject_sequence[] = {
605   { &hf_q932_ros_invokeId   , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_ros_InvokeId },
606   { &hf_q932_ros_problem    , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_ros_T_problem },
607   { NULL, 0, 0, 0, NULL }
608 };
609
610 static int
611 dissect_q932_ros_Reject(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
612 #line 7 "ros-rej.cnf"
613   const gchar *descr = "";
614
615   problem_str[0] = '\0';
616
617   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
618                                    Reject_sequence, hf_index, ett_q932_ros_Reject);
619
620 #line 11 "ros-rej.cnf"
621   descr = ep_strdup_printf("REJ: %s", problem_str);
622
623   if (actx->rose_ctx->apdu_depth >= 0)
624     proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), "  %s", descr);
625   if (actx->rose_ctx->fillin_info && check_col(actx->pinfo->cinfo, COL_INFO))
626     col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
627   if (actx->rose_ctx->fillin_ptr)
628     g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
629
630   return offset;
631 }
632
633
634 static const value_string q932_ros_ROS_vals[] = {
635   {   1, "invoke" },
636   {   2, "returnResult" },
637   {   3, "returnError" },
638   {   4, "reject" },
639   { 0, NULL }
640 };
641
642 static const ber_choice_t ROS_choice[] = {
643   {   1, &hf_q932_ros_invoke     , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_q932_ros_Invoke },
644   {   2, &hf_q932_ros_returnResult, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_q932_ros_ReturnResult },
645   {   3, &hf_q932_ros_returnError, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_q932_ros_ReturnError },
646   {   4, &hf_q932_ros_reject     , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_q932_ros_Reject },
647   { 0, NULL, 0, 0, 0, NULL }
648 };
649
650 static int
651 dissect_q932_ros_ROS(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
652 #line 31 "q932-ros.cnf"
653   /* will be moved to ROS_PDU when PDU function can be alternated from conformance file */
654   actx->rose_ctx = rose_ctx_tmp;
655   rose_ctx_clean_data(actx->rose_ctx);
656
657   offset = dissect_ber_choice(actx, tree, tvb, offset,
658                                  ROS_choice, hf_index, ett_q932_ros_ROS,
659                                  NULL);
660
661   return offset;
662 }
663
664 /*--- PDUs ---*/
665
666 static int dissect_ROS_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
667   int offset = 0;
668   asn1_ctx_t asn1_ctx;
669   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
670   offset = dissect_q932_ros_ROS(FALSE, tvb, offset, &asn1_ctx, tree, hf_q932_ros_ROS_PDU);
671   return offset;
672 }
673
674
675 /*--- End of included file: packet-q932-ros-fn.c ---*/
676 #line 62 "packet-q932-ros-template.c"
677
678 /*--- dissect_q932_ros -----------------------------------------------------*/
679 static int dissect_q932_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
680   rose_ctx_tmp = get_rose_ctx(pinfo->private_data);
681   DISSECTOR_ASSERT(rose_ctx_tmp);
682   return dissect_ROS_PDU(tvb, pinfo, tree);
683 }
684
685 /*--- proto_register_q932_ros -----------------------------------------------*/
686 void proto_register_q932_ros(void) {
687
688   /* List of fields */
689   static hf_register_info hf[] = {
690
691 /*--- Included file: packet-q932-ros-hfarr.c ---*/
692 #line 1 "packet-q932-ros-hfarr.c"
693     { &hf_q932_ros_ROS_PDU,
694       { "ROS", "q932.ros.ROS",
695         FT_UINT32, BASE_DEC, VALS(q932_ros_ROS_vals), 0,
696         NULL, HFILL }},
697     { &hf_q932_ros_local,
698       { "local", "q932.ros.local",
699         FT_INT32, BASE_DEC, NULL, 0,
700         "T_local", HFILL }},
701     { &hf_q932_ros_global,
702       { "global", "q932.ros.global",
703         FT_OID, BASE_NONE, NULL, 0,
704         "T_global", HFILL }},
705     { &hf_q932_ros_invoke,
706       { "invoke", "q932.ros.invoke",
707         FT_NONE, BASE_NONE, NULL, 0,
708         NULL, HFILL }},
709     { &hf_q932_ros_returnResult,
710       { "returnResult", "q932.ros.returnResult",
711         FT_NONE, BASE_NONE, NULL, 0,
712         NULL, HFILL }},
713     { &hf_q932_ros_returnError,
714       { "returnError", "q932.ros.returnError",
715         FT_NONE, BASE_NONE, NULL, 0,
716         NULL, HFILL }},
717     { &hf_q932_ros_reject,
718       { "reject", "q932.ros.reject",
719         FT_NONE, BASE_NONE, NULL, 0,
720         NULL, HFILL }},
721     { &hf_q932_ros_invokeId,
722       { "invokeId", "q932.ros.invokeId",
723         FT_UINT32, BASE_DEC, VALS(q932_ros_InvokeId_vals), 0,
724         NULL, HFILL }},
725     { &hf_q932_ros_linkedId,
726       { "linkedId", "q932.ros.linkedId",
727         FT_UINT32, BASE_DEC, VALS(q932_ros_T_linkedId_vals), 0,
728         "T_linkedId", HFILL }},
729     { &hf_q932_ros_linkedIdPresent,
730       { "present", "q932.ros.present",
731         FT_INT32, BASE_DEC, NULL, 0,
732         "T_linkedIdPresent", HFILL }},
733     { &hf_q932_ros_absent,
734       { "absent", "q932.ros.absent",
735         FT_NONE, BASE_NONE, NULL, 0,
736         "NULL", HFILL }},
737     { &hf_q932_ros_opcode,
738       { "opcode", "q932.ros.opcode",
739         FT_UINT32, BASE_DEC, VALS(q932_ros_Code_vals), 0,
740         "Code", HFILL }},
741     { &hf_q932_ros_argument,
742       { "argument", "q932.ros.argument",
743         FT_BYTES, BASE_NONE, NULL, 0,
744         "InvokeArgument", HFILL }},
745     { &hf_q932_ros_result,
746       { "result", "q932.ros.result",
747         FT_NONE, BASE_NONE, NULL, 0,
748         "T_result", HFILL }},
749     { &hf_q932_ros_resultArgument,
750       { "result", "q932.ros.result",
751         FT_BYTES, BASE_NONE, NULL, 0,
752         "ResultArgument", HFILL }},
753     { &hf_q932_ros_errcode,
754       { "errcode", "q932.ros.errcode",
755         FT_UINT32, BASE_DEC, VALS(q932_ros_Code_vals), 0,
756         "Code", HFILL }},
757     { &hf_q932_ros_parameter,
758       { "parameter", "q932.ros.parameter",
759         FT_BYTES, BASE_NONE, NULL, 0,
760         "T_parameter", HFILL }},
761     { &hf_q932_ros_problem,
762       { "problem", "q932.ros.problem",
763         FT_UINT32, BASE_DEC, VALS(q932_ros_T_problem_vals), 0,
764         "T_problem", HFILL }},
765     { &hf_q932_ros_general,
766       { "general", "q932.ros.general",
767         FT_INT32, BASE_DEC, VALS(q932_ros_GeneralProblem_vals), 0,
768         "GeneralProblem", HFILL }},
769     { &hf_q932_ros_invokeProblem,
770       { "invoke", "q932.ros.invoke",
771         FT_INT32, BASE_DEC, VALS(q932_ros_InvokeProblem_vals), 0,
772         "InvokeProblem", HFILL }},
773     { &hf_q932_ros_returnResultProblem,
774       { "returnResult", "q932.ros.returnResult",
775         FT_INT32, BASE_DEC, VALS(q932_ros_ReturnResultProblem_vals), 0,
776         "ReturnResultProblem", HFILL }},
777     { &hf_q932_ros_returnErrorProblem,
778       { "returnError", "q932.ros.returnError",
779         FT_INT32, BASE_DEC, VALS(q932_ros_ReturnErrorProblem_vals), 0,
780         "ReturnErrorProblem", HFILL }},
781     { &hf_q932_ros_present,
782       { "present", "q932.ros.present",
783         FT_INT32, BASE_DEC, NULL, 0,
784         "INTEGER", HFILL }},
785     { &hf_q932_ros_InvokeId_present,
786       { "InvokeId.present", "q932.ros.InvokeId_present",
787         FT_INT32, BASE_DEC, NULL, 0,
788         "InvokeId_present", HFILL }},
789
790 /*--- End of included file: packet-q932-ros-hfarr.c ---*/
791 #line 76 "packet-q932-ros-template.c"
792   };
793
794   /* List of subtrees */
795   static gint *ett[] = {
796
797 /*--- Included file: packet-q932-ros-ettarr.c ---*/
798 #line 1 "packet-q932-ros-ettarr.c"
799     &ett_q932_ros_Code,
800     &ett_q932_ros_ROS,
801     &ett_q932_ros_Invoke,
802     &ett_q932_ros_T_linkedId,
803     &ett_q932_ros_ReturnResult,
804     &ett_q932_ros_T_result,
805     &ett_q932_ros_ReturnError,
806     &ett_q932_ros_Reject,
807     &ett_q932_ros_T_problem,
808     &ett_q932_ros_InvokeId,
809
810 /*--- End of included file: packet-q932-ros-ettarr.c ---*/
811 #line 81 "packet-q932-ros-template.c"
812   };
813
814   /* Register protocol and dissector */
815   proto_q932_ros = proto_register_protocol(PNAME, PSNAME, PFNAME);
816   proto_set_cant_toggle(proto_q932_ros);
817
818   /* Register fields and subtrees */
819   proto_register_field_array(proto_q932_ros, hf, array_length(hf));
820   proto_register_subtree_array(ett, array_length(ett));
821
822   new_register_dissector(PFNAME, dissect_q932_ros, proto_q932_ros);
823 }
824
825 /*--- proto_reg_handoff_q932_ros --------------------------------------------*/
826 void proto_reg_handoff_q932_ros(void) {
827   data_handle = find_dissector("data");
828 }
829
830 /*---------------------------------------------------------------------------*/