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