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 /* asn2wrs.py -b -q -L -p q932.ros -c ./q932-ros.cnf -s ./packet-q932-ros-template -D . -O ../.. ../ros/Remote-Operations-Information-Objects.asn Facility-Information-Element-Components.asn */
7 * Routines for Q.932 packet dissection
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
19 #include <epan/packet.h>
20 #include <epan/strutil.h>
21 #include <epan/asn1.h>
22 #include <epan/expert.h>
23 #include <wsutil/array.h>
25 #include "packet-ber.h"
27 #define PNAME "Q.932 Operations Service Element"
28 #define PSNAME "Q932.ROS"
29 #define PFNAME "q932.ros"
31 void proto_register_q932_ros(void);
32 void proto_reg_handoff_q932_ros(void);
34 /* Initialize the protocol and registered fields */
35 static int proto_q932_ros
;
36 static int hf_q932_ros_ROS_PDU
; /* ROS */
37 static int hf_q932_ros_local
; /* T_local */
38 static int hf_q932_ros_global
; /* T_global */
39 static int hf_q932_ros_invoke
; /* Invoke */
40 static int hf_q932_ros_returnResult
; /* ReturnResult */
41 static int hf_q932_ros_returnError
; /* ReturnError */
42 static int hf_q932_ros_reject
; /* Reject */
43 static int hf_q932_ros_invokeId
; /* InvokeId */
44 static int hf_q932_ros_linkedId
; /* T_linkedId */
45 static int hf_q932_ros_linkedIdPresent
; /* T_linkedIdPresent */
46 static int hf_q932_ros_absent
; /* NULL */
47 static int hf_q932_ros_opcode
; /* Code */
48 static int hf_q932_ros_argument
; /* InvokeArgument */
49 static int hf_q932_ros_result
; /* T_result */
50 static int hf_q932_ros_resultArgument
; /* ResultArgument */
51 static int hf_q932_ros_errcode
; /* Code */
52 static int hf_q932_ros_parameter
; /* T_parameter */
53 static int hf_q932_ros_problem
; /* T_problem */
54 static int hf_q932_ros_general
; /* GeneralProblem */
55 static int hf_q932_ros_invokeProblem
; /* InvokeProblem */
56 static int hf_q932_ros_returnResultProblem
; /* ReturnResultProblem */
57 static int hf_q932_ros_returnErrorProblem
; /* ReturnErrorProblem */
58 static int hf_q932_ros_present
; /* INTEGER */
59 static int hf_q932_ros_InvokeId_present
; /* InvokeId_present */
61 /* Initialize the subtree pointers */
62 static int ett_q932_ros_Code
;
63 static int ett_q932_ros_ROS
;
64 static int ett_q932_ros_Invoke
;
65 static int ett_q932_ros_T_linkedId
;
66 static int ett_q932_ros_ReturnResult
;
67 static int ett_q932_ros_T_result
;
68 static int ett_q932_ros_ReturnError
;
69 static int ett_q932_ros_Reject
;
70 static int ett_q932_ros_T_problem
;
71 static int ett_q932_ros_InvokeId
;
73 static expert_field ei_ros_undecoded
;
78 static dissector_handle_t data_handle
;
80 /* Global variables */
81 static rose_ctx_t
*rose_ctx_tmp
;
83 static uint32_t problem_val
;
84 static char problem_str
[64];
85 static tvbuff_t
*arg_next_tvb
, *res_next_tvb
, *err_next_tvb
;
91 dissect_q932_ros_T_local(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
92 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
93 &actx
->rose_ctx
->d
.code_local
);
101 dissect_q932_ros_T_global(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
102 offset
= dissect_ber_object_identifier_str(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
, &actx
->rose_ctx
->d
.code_global
);
108 static const value_string q932_ros_Code_vals
[] = {
114 static const ber_choice_t Code_choice
[] = {
115 { 0, &hf_q932_ros_local
, BER_CLASS_UNI
, BER_UNI_TAG_INTEGER
, BER_FLAGS_NOOWNTAG
, dissect_q932_ros_T_local
},
116 { 1, &hf_q932_ros_global
, BER_CLASS_UNI
, BER_UNI_TAG_OID
, BER_FLAGS_NOOWNTAG
, dissect_q932_ros_T_global
},
117 { 0, NULL
, 0, 0, 0, NULL
}
121 dissect_q932_ros_Code(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
122 offset
= dissect_ber_choice(actx
, tree
, tvb
, offset
,
123 Code_choice
, hf_index
, ett_q932_ros_Code
,
124 &actx
->rose_ctx
->d
.code
);
126 actx
->rose_ctx
->d
.code_item
= actx
->created_item
;
133 dissect_q932_ros_INTEGER(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
134 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
143 dissect_q932_ros_NULL(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
144 offset
= dissect_ber_null(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
);
150 static const value_string q932_ros_InvokeId_vals
[] = {
156 static const ber_choice_t InvokeId_choice
[] = {
157 { 0, &hf_q932_ros_present
, BER_CLASS_UNI
, BER_UNI_TAG_INTEGER
, BER_FLAGS_NOOWNTAG
, dissect_q932_ros_INTEGER
},
158 { 1, &hf_q932_ros_absent
, BER_CLASS_UNI
, BER_UNI_TAG_NULL
, BER_FLAGS_NOOWNTAG
, dissect_q932_ros_NULL
},
159 { 0, NULL
, 0, 0, 0, NULL
}
163 dissect_q932_ros_InvokeId(bool 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_choice(actx
, tree
, tvb
, offset
,
165 InvokeId_choice
, hf_index
, ett_q932_ros_InvokeId
,
174 dissect_q932_ros_InvokeId_present(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
175 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
184 dissect_q932_ros_T_linkedIdPresent(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
185 offset
= dissect_q932_ros_InvokeId_present(implicit_tag
, tvb
, offset
, actx
, tree
, hf_index
);
191 static const value_string q932_ros_T_linkedId_vals
[] = {
197 static const ber_choice_t T_linkedId_choice
[] = {
198 { 0, &hf_q932_ros_linkedIdPresent
, BER_CLASS_CON
, 0, BER_FLAGS_IMPLTAG
, dissect_q932_ros_T_linkedIdPresent
},
199 { 1, &hf_q932_ros_absent
, BER_CLASS_CON
, 1, BER_FLAGS_IMPLTAG
, dissect_q932_ros_NULL
},
200 { 0, NULL
, 0, 0, 0, NULL
}
204 dissect_q932_ros_T_linkedId(bool 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_choice(actx
, tree
, tvb
, offset
,
206 T_linkedId_choice
, hf_index
, ett_q932_ros_T_linkedId
,
215 dissect_q932_ros_InvokeArgument(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
218 len
= tvb_reported_length_remaining(tvb
, offset
);
220 proto_tree_add_item(tree
, hf_index
, tvb
, offset
, len
, ENC_NA
);
221 arg_next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
223 offset
+= tvb_reported_length_remaining(tvb
, offset
);
229 static const ber_sequence_t Invoke_sequence
[] = {
230 { &hf_q932_ros_invokeId
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_q932_ros_InvokeId
},
231 { &hf_q932_ros_linkedId
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL
|BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_q932_ros_T_linkedId
},
232 { &hf_q932_ros_opcode
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_q932_ros_Code
},
233 { &hf_q932_ros_argument
, BER_CLASS_ANY
, 0, BER_FLAGS_OPTIONAL
|BER_FLAGS_NOOWNTAG
, dissect_q932_ros_InvokeArgument
},
234 { NULL
, 0, 0, 0, NULL
}
238 dissect_q932_ros_Invoke(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
239 dissector_handle_t arg_handle
= NULL
;
240 const char *descr
= "";
243 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
244 Invoke_sequence
, hf_index
, ett_q932_ros_Invoke
);
246 actx
->rose_ctx
->d
.pdu
= 1;
248 if ((actx
->rose_ctx
->d
.code
== 0) && actx
->rose_ctx
->arg_local_dissector_table
) {
249 arg_handle
= dissector_get_uint_handle(actx
->rose_ctx
->arg_local_dissector_table
, actx
->rose_ctx
->d
.code_local
);
250 } else if ((actx
->rose_ctx
->d
.code
== 1) && actx
->rose_ctx
->arg_global_dissector_table
) {
251 arg_handle
= dissector_get_string_handle(actx
->rose_ctx
->arg_global_dissector_table
, actx
->rose_ctx
->d
.code_global
);
257 !proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(arg_handle
)))) {
258 if (actx
->rose_ctx
->d
.code
== 0)
259 descr
= wmem_strdup_printf(actx
->pinfo
->pool
, "INV: %d", actx
->rose_ctx
->d
.code_local
);
260 else if (actx
->rose_ctx
->d
.code
== 1)
261 descr
= wmem_strdup_printf(actx
->pinfo
->pool
, "INV: %s", actx
->rose_ctx
->d
.code_global
);
263 descr
= wmem_strdup(actx
->pinfo
->pool
, "INV:");
266 if (actx
->rose_ctx
->apdu_depth
>= 0)
267 proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree
), actx
->rose_ctx
->apdu_depth
), " %s", descr
);
268 if (actx
->rose_ctx
->fillin_info
)
269 col_append_str(actx
->pinfo
->cinfo
, COL_INFO
, descr
);
270 if (actx
->rose_ctx
->fillin_ptr
)
271 (void) g_strlcat(actx
->rose_ctx
->fillin_ptr
, descr
, actx
->rose_ctx
->fillin_buf_size
);
273 if (!arg_next_tvb
) { /* empty argument */
274 arg_next_tvb
= tvb_new_subset_length_caplen(tvb
, (actx
->encoding
==ASN1_ENC_PER
)?offset
>>3:offset
, 0, 0);
277 call_dissector_with_data((arg_handle
)?arg_handle
:data_handle
, arg_next_tvb
, actx
->pinfo
, tree
, actx
->rose_ctx
);
279 expert_add_info_format(actx
->pinfo
, tree
, &ei_ros_undecoded
, "Undecoded %s", descr
);
287 dissect_q932_ros_ResultArgument(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
290 len
= tvb_reported_length_remaining(tvb
, offset
);
292 proto_tree_add_item(tree
, hf_index
, tvb
, offset
, len
, ENC_NA
);
293 res_next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
295 offset
+= tvb_reported_length_remaining(tvb
, offset
);
302 static const ber_sequence_t T_result_sequence
[] = {
303 { &hf_q932_ros_opcode
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_q932_ros_Code
},
304 { &hf_q932_ros_resultArgument
, BER_CLASS_ANY
, 0, BER_FLAGS_NOOWNTAG
, dissect_q932_ros_ResultArgument
},
305 { NULL
, 0, 0, 0, NULL
}
309 dissect_q932_ros_T_result(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
310 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
311 T_result_sequence
, hf_index
, ett_q932_ros_T_result
);
317 static const ber_sequence_t ReturnResult_sequence
[] = {
318 { &hf_q932_ros_invokeId
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_q932_ros_InvokeId
},
319 { &hf_q932_ros_result
, BER_CLASS_UNI
, BER_UNI_TAG_SEQUENCE
, BER_FLAGS_OPTIONAL
|BER_FLAGS_NOOWNTAG
, dissect_q932_ros_T_result
},
320 { NULL
, 0, 0, 0, NULL
}
324 dissect_q932_ros_ReturnResult(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
325 dissector_handle_t res_handle
= NULL
;
326 const char *descr
= "";
328 actx
->rose_ctx
->d
.code
= -1;
330 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
331 ReturnResult_sequence
, hf_index
, ett_q932_ros_ReturnResult
);
333 actx
->rose_ctx
->d
.pdu
= 2;
335 if ((actx
->rose_ctx
->d
.code
== 0) && actx
->rose_ctx
->res_local_dissector_table
) {
336 res_handle
= dissector_get_uint_handle(actx
->rose_ctx
->res_local_dissector_table
, actx
->rose_ctx
->d
.code_local
);
337 } else if ((actx
->rose_ctx
->d
.code
== 1) && actx
->rose_ctx
->res_global_dissector_table
) {
338 res_handle
= dissector_get_string_handle(actx
->rose_ctx
->res_global_dissector_table
, actx
->rose_ctx
->d
.code_global
);
344 !proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(res_handle
)))) {
345 if (actx
->rose_ctx
->d
.code
== 0)
346 descr
= wmem_strdup_printf(actx
->pinfo
->pool
, "RES: %d", actx
->rose_ctx
->d
.code_local
);
347 else if (actx
->rose_ctx
->d
.code
== 1)
348 descr
= wmem_strdup_printf(actx
->pinfo
->pool
, "RES: %s", actx
->rose_ctx
->d
.code_global
);
350 descr
= wmem_strdup(actx
->pinfo
->pool
, "RES:");
353 if (actx
->rose_ctx
->apdu_depth
>= 0)
354 proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree
), actx
->rose_ctx
->apdu_depth
), " %s", descr
);
355 if (actx
->rose_ctx
->fillin_info
)
356 col_append_str(actx
->pinfo
->cinfo
, COL_INFO
, descr
);
357 if (actx
->rose_ctx
->fillin_ptr
)
358 (void) g_strlcat(actx
->rose_ctx
->fillin_ptr
, descr
, actx
->rose_ctx
->fillin_buf_size
);
360 if (actx
->rose_ctx
->d
.code
!= -1) {
361 if (!res_next_tvb
) { /* empty result */
362 res_next_tvb
= tvb_new_subset_length_caplen(tvb
, (actx
->encoding
==ASN1_ENC_PER
)?offset
>>3:offset
, 0, 0);
365 call_dissector_with_data((res_handle
)?res_handle
:data_handle
, res_next_tvb
, actx
->pinfo
, tree
, actx
->rose_ctx
);
367 expert_add_info_format(actx
->pinfo
, tree
, &ei_ros_undecoded
, "Undecoded %s", descr
);
376 dissect_q932_ros_T_parameter(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
380 len
= tvb_reported_length_remaining(tvb
, offset
);
382 proto_tree_add_item(tree
, hf_index
, tvb
, offset
, len
, ENC_NA
);
383 err_next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
385 offset
+= tvb_reported_length_remaining(tvb
, offset
);
391 static const ber_sequence_t ReturnError_sequence
[] = {
392 { &hf_q932_ros_invokeId
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_q932_ros_InvokeId
},
393 { &hf_q932_ros_errcode
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_q932_ros_Code
},
394 { &hf_q932_ros_parameter
, BER_CLASS_ANY
, 0, BER_FLAGS_OPTIONAL
|BER_FLAGS_NOOWNTAG
, dissect_q932_ros_T_parameter
},
395 { NULL
, 0, 0, 0, NULL
}
399 dissect_q932_ros_ReturnError(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
400 dissector_handle_t err_handle
= NULL
;
401 const char *descr
= "";
404 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
405 ReturnError_sequence
, hf_index
, ett_q932_ros_ReturnError
);
407 actx
->rose_ctx
->d
.pdu
= 3;
409 if ((actx
->rose_ctx
->d
.code
== 0) && actx
->rose_ctx
->err_local_dissector_table
) {
410 err_handle
= dissector_get_uint_handle(actx
->rose_ctx
->err_local_dissector_table
, actx
->rose_ctx
->d
.code_local
);
411 } else if ((actx
->rose_ctx
->d
.code
== 1) && actx
->rose_ctx
->err_global_dissector_table
) {
412 err_handle
= dissector_get_string_handle(actx
->rose_ctx
->err_global_dissector_table
, actx
->rose_ctx
->d
.code_global
);
418 !proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(err_handle
)))) {
419 if (actx
->rose_ctx
->d
.code
== 0)
420 descr
= wmem_strdup_printf(actx
->pinfo
->pool
, "ERR: %d", actx
->rose_ctx
->d
.code_local
);
421 else if (actx
->rose_ctx
->d
.code
== 1)
422 descr
= wmem_strdup_printf(actx
->pinfo
->pool
, "ERR: %s", actx
->rose_ctx
->d
.code_global
);
424 descr
= wmem_strdup(actx
->pinfo
->pool
, "ERR:");
427 if (actx
->rose_ctx
->apdu_depth
>= 0)
428 proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree
), actx
->rose_ctx
->apdu_depth
), " %s", descr
);
429 if (actx
->rose_ctx
->fillin_info
)
430 col_append_str(actx
->pinfo
->cinfo
, COL_INFO
, descr
);
431 if (actx
->rose_ctx
->fillin_ptr
)
432 (void) g_strlcat(actx
->rose_ctx
->fillin_ptr
, descr
, actx
->rose_ctx
->fillin_buf_size
);
434 if (!err_next_tvb
) { /* empty error */
435 err_next_tvb
= tvb_new_subset_length_caplen(tvb
, (actx
->encoding
==ASN1_ENC_PER
)?offset
>>3:offset
, 0, 0);
438 call_dissector_with_data((err_handle
)?err_handle
:data_handle
, err_next_tvb
, actx
->pinfo
, tree
, actx
->rose_ctx
);
440 expert_add_info_format(actx
->pinfo
, tree
, &ei_ros_undecoded
, "Undecoded %s", descr
);
446 static const value_string q932_ros_GeneralProblem_vals
[] = {
447 { 0, "unrecognizedComponent" },
448 { 1, "mistypedComponent" },
449 { 2, "badlyStructuredComponent" },
455 dissect_q932_ros_GeneralProblem(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
456 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
459 (void) g_strlcpy(problem_str
, val_to_str_const(problem_val
, VALS(q932_ros_GeneralProblem_vals
), ""), 64);
464 static const value_string q932_ros_InvokeProblem_vals
[] = {
465 { 0, "duplicateInvocation" },
466 { 1, "unrecognizedOperation" },
467 { 2, "mistypedArgument" },
468 { 3, "resourceLimitation" },
469 { 4, "releaseInProgress" },
470 { 5, "unrecognizedLinkedId" },
471 { 6, "linkedResponseUnexpected" },
472 { 7, "unexpectedLinkedOperation" },
478 dissect_q932_ros_InvokeProblem(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
479 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
482 (void) g_strlcpy(problem_str
, val_to_str_const(problem_val
, VALS(q932_ros_InvokeProblem_vals
), ""), 64);
487 static const value_string q932_ros_ReturnResultProblem_vals
[] = {
488 { 0, "unrecognizedInvocation" },
489 { 1, "resultResponseUnexpected" },
490 { 2, "mistypedResult" },
496 dissect_q932_ros_ReturnResultProblem(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
497 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
500 (void) g_strlcpy(problem_str
, val_to_str_const(problem_val
, VALS(q932_ros_ReturnResultProblem_vals
), ""), 64);
505 static const value_string q932_ros_ReturnErrorProblem_vals
[] = {
506 { 0, "unrecognizedInvocation" },
507 { 1, "errorResponseUnexpected" },
508 { 2, "unrecognizedError" },
509 { 3, "unexpectedError" },
510 { 4, "mistypedParameter" },
516 dissect_q932_ros_ReturnErrorProblem(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
517 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
520 (void) g_strlcpy(problem_str
, val_to_str_const(problem_val
, VALS(q932_ros_ReturnErrorProblem_vals
), ""), 64);
525 static const value_string q932_ros_T_problem_vals
[] = {
528 { 2, "returnResult" },
529 { 3, "returnError" },
533 static const ber_choice_t T_problem_choice
[] = {
534 { 0, &hf_q932_ros_general
, BER_CLASS_CON
, 0, BER_FLAGS_IMPLTAG
, dissect_q932_ros_GeneralProblem
},
535 { 1, &hf_q932_ros_invokeProblem
, BER_CLASS_CON
, 1, BER_FLAGS_IMPLTAG
, dissect_q932_ros_InvokeProblem
},
536 { 2, &hf_q932_ros_returnResultProblem
, BER_CLASS_CON
, 2, BER_FLAGS_IMPLTAG
, dissect_q932_ros_ReturnResultProblem
},
537 { 3, &hf_q932_ros_returnErrorProblem
, BER_CLASS_CON
, 3, BER_FLAGS_IMPLTAG
, dissect_q932_ros_ReturnErrorProblem
},
538 { 0, NULL
, 0, 0, 0, NULL
}
542 dissect_q932_ros_T_problem(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
543 offset
= dissect_ber_choice(actx
, tree
, tvb
, offset
,
544 T_problem_choice
, hf_index
, ett_q932_ros_T_problem
,
551 static const ber_sequence_t Reject_sequence
[] = {
552 { &hf_q932_ros_invokeId
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_q932_ros_InvokeId
},
553 { &hf_q932_ros_problem
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_q932_ros_T_problem
},
554 { NULL
, 0, 0, 0, NULL
}
558 dissect_q932_ros_Reject(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
561 problem_str
[0] = '\0';
562 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
563 Reject_sequence
, hf_index
, ett_q932_ros_Reject
);
565 descr
= wmem_strdup_printf(actx
->pinfo
->pool
, "REJ: %s", problem_str
);
567 if (actx
->rose_ctx
->apdu_depth
>= 0)
568 proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree
), actx
->rose_ctx
->apdu_depth
), " %s", descr
);
569 if (actx
->rose_ctx
->fillin_info
)
570 col_append_str(actx
->pinfo
->cinfo
, COL_INFO
, descr
);
571 if (actx
->rose_ctx
->fillin_ptr
)
572 (void) g_strlcat(actx
->rose_ctx
->fillin_ptr
, descr
, actx
->rose_ctx
->fillin_buf_size
);
577 static const value_string q932_ros_ROS_vals
[] = {
579 { 2, "returnResult" },
580 { 3, "returnError" },
585 static const ber_choice_t ROS_choice
[] = {
586 { 1, &hf_q932_ros_invoke
, BER_CLASS_CON
, 1, BER_FLAGS_IMPLTAG
, dissect_q932_ros_Invoke
},
587 { 2, &hf_q932_ros_returnResult
, BER_CLASS_CON
, 2, BER_FLAGS_IMPLTAG
, dissect_q932_ros_ReturnResult
},
588 { 3, &hf_q932_ros_returnError
, BER_CLASS_CON
, 3, BER_FLAGS_IMPLTAG
, dissect_q932_ros_ReturnError
},
589 { 4, &hf_q932_ros_reject
, BER_CLASS_CON
, 4, BER_FLAGS_IMPLTAG
, dissect_q932_ros_Reject
},
590 { 0, NULL
, 0, 0, 0, NULL
}
594 dissect_q932_ros_ROS(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
595 /* will be moved to ROS_PDU when PDU function can be alternated from conformance file */
596 actx
->rose_ctx
= rose_ctx_tmp
;
597 rose_ctx_clean_data(actx
->rose_ctx
);
598 offset
= dissect_ber_choice(actx
, tree
, tvb
, offset
,
599 ROS_choice
, hf_index
, ett_q932_ros_ROS
,
607 static int dissect_ROS_PDU(tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
) {
610 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
611 offset
= dissect_q932_ros_ROS(false, tvb
, offset
, &asn1_ctx
, tree
, hf_q932_ros_ROS_PDU
);
616 /*--- dissect_q932_ros -----------------------------------------------------*/
617 static int dissect_q932_ros(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
) {
618 /* Reject the packet if data is NULL */
621 rose_ctx_tmp
= get_rose_ctx(data
);
622 DISSECTOR_ASSERT(rose_ctx_tmp
);
623 return dissect_ROS_PDU(tvb
, pinfo
, tree
, NULL
);
626 /*--- proto_register_q932_ros -----------------------------------------------*/
627 void proto_register_q932_ros(void) {
630 static hf_register_info hf
[] = {
631 { &hf_q932_ros_ROS_PDU
,
632 { "ROS", "q932.ros.ROS",
633 FT_UINT32
, BASE_DEC
, VALS(q932_ros_ROS_vals
), 0,
635 { &hf_q932_ros_local
,
636 { "local", "q932.ros.local",
637 FT_INT32
, BASE_DEC
, NULL
, 0,
639 { &hf_q932_ros_global
,
640 { "global", "q932.ros.global",
641 FT_OID
, BASE_NONE
, NULL
, 0,
643 { &hf_q932_ros_invoke
,
644 { "invoke", "q932.ros.invoke_element",
645 FT_NONE
, BASE_NONE
, NULL
, 0,
647 { &hf_q932_ros_returnResult
,
648 { "returnResult", "q932.ros.returnResult_element",
649 FT_NONE
, BASE_NONE
, NULL
, 0,
651 { &hf_q932_ros_returnError
,
652 { "returnError", "q932.ros.returnError_element",
653 FT_NONE
, BASE_NONE
, NULL
, 0,
655 { &hf_q932_ros_reject
,
656 { "reject", "q932.ros.reject_element",
657 FT_NONE
, BASE_NONE
, NULL
, 0,
659 { &hf_q932_ros_invokeId
,
660 { "invokeId", "q932.ros.invokeId",
661 FT_UINT32
, BASE_DEC
, VALS(q932_ros_InvokeId_vals
), 0,
663 { &hf_q932_ros_linkedId
,
664 { "linkedId", "q932.ros.linkedId",
665 FT_UINT32
, BASE_DEC
, VALS(q932_ros_T_linkedId_vals
), 0,
667 { &hf_q932_ros_linkedIdPresent
,
668 { "present", "q932.ros.present",
669 FT_INT32
, BASE_DEC
, NULL
, 0,
670 "T_linkedIdPresent", HFILL
}},
671 { &hf_q932_ros_absent
,
672 { "absent", "q932.ros.absent_element",
673 FT_NONE
, BASE_NONE
, NULL
, 0,
675 { &hf_q932_ros_opcode
,
676 { "opcode", "q932.ros.opcode",
677 FT_UINT32
, BASE_DEC
, VALS(q932_ros_Code_vals
), 0,
679 { &hf_q932_ros_argument
,
680 { "argument", "q932.ros.argument",
681 FT_BYTES
, BASE_NONE
, NULL
, 0,
682 "InvokeArgument", HFILL
}},
683 { &hf_q932_ros_result
,
684 { "result", "q932.ros.result_element",
685 FT_NONE
, BASE_NONE
, NULL
, 0,
687 { &hf_q932_ros_resultArgument
,
688 { "result", "q932.ros.result",
689 FT_BYTES
, BASE_NONE
, NULL
, 0,
690 "ResultArgument", HFILL
}},
691 { &hf_q932_ros_errcode
,
692 { "errcode", "q932.ros.errcode",
693 FT_UINT32
, BASE_DEC
, VALS(q932_ros_Code_vals
), 0,
695 { &hf_q932_ros_parameter
,
696 { "parameter", "q932.ros.parameter",
697 FT_BYTES
, BASE_NONE
, NULL
, 0,
699 { &hf_q932_ros_problem
,
700 { "problem", "q932.ros.problem",
701 FT_UINT32
, BASE_DEC
, VALS(q932_ros_T_problem_vals
), 0,
703 { &hf_q932_ros_general
,
704 { "general", "q932.ros.general",
705 FT_INT32
, BASE_DEC
, VALS(q932_ros_GeneralProblem_vals
), 0,
706 "GeneralProblem", HFILL
}},
707 { &hf_q932_ros_invokeProblem
,
708 { "invoke", "q932.ros.invoke",
709 FT_INT32
, BASE_DEC
, VALS(q932_ros_InvokeProblem_vals
), 0,
710 "InvokeProblem", HFILL
}},
711 { &hf_q932_ros_returnResultProblem
,
712 { "returnResult", "q932.ros.returnResult",
713 FT_INT32
, BASE_DEC
, VALS(q932_ros_ReturnResultProblem_vals
), 0,
714 "ReturnResultProblem", HFILL
}},
715 { &hf_q932_ros_returnErrorProblem
,
716 { "returnError", "q932.ros.returnError",
717 FT_INT32
, BASE_DEC
, VALS(q932_ros_ReturnErrorProblem_vals
), 0,
718 "ReturnErrorProblem", HFILL
}},
719 { &hf_q932_ros_present
,
720 { "present", "q932.ros.present",
721 FT_INT32
, BASE_DEC
, NULL
, 0,
723 { &hf_q932_ros_InvokeId_present
,
724 { "InvokeId.present", "q932.ros.InvokeId_present",
725 FT_INT32
, BASE_DEC
, NULL
, 0,
726 "InvokeId_present", HFILL
}},
729 /* List of subtrees */
730 static int *ett
[] = {
733 &ett_q932_ros_Invoke
,
734 &ett_q932_ros_T_linkedId
,
735 &ett_q932_ros_ReturnResult
,
736 &ett_q932_ros_T_result
,
737 &ett_q932_ros_ReturnError
,
738 &ett_q932_ros_Reject
,
739 &ett_q932_ros_T_problem
,
740 &ett_q932_ros_InvokeId
,
743 static ei_register_info ei
[] = {
744 { &ei_ros_undecoded
, { "q932.ros.undecoded", PI_UNDECODED
, PI_WARN
, "Undecoded", EXPFILL
}},
747 expert_module_t
* expert_q932_ros
;
749 /* Register protocol and dissector */
750 proto_q932_ros
= proto_register_protocol(PNAME
, PSNAME
, PFNAME
);
751 proto_set_cant_toggle(proto_q932_ros
);
753 /* Register fields and subtrees */
754 proto_register_field_array(proto_q932_ros
, hf
, array_length(hf
));
755 proto_register_subtree_array(ett
, array_length(ett
));
756 expert_q932_ros
= expert_register_protocol(proto_q932_ros
);
757 expert_register_field_array(expert_q932_ros
, ei
, array_length(ei
));
759 register_dissector(PFNAME
, dissect_q932_ros
, proto_q932_ros
);
762 /*--- proto_reg_handoff_q932_ros --------------------------------------------*/
763 void proto_reg_handoff_q932_ros(void) {
764 data_handle
= find_dissector("data");
767 /*---------------------------------------------------------------------------*/