8c663d9b7b387a0516f8f950c3a82e2d1f4be0a3
[metze/wireshark/wip.git] / asn1 / ros / ros-inv.cnf
1 # ros-inv.cnf
2 # ROS Invoke common code
3 # Copyright 2007 Tomas Kukosa
4 # $Id$
5
6
7 #.FN_HDR Invoke
8   dissector_handle_t arg_handle = NULL;
9   const gchar *descr = "";
10
11   arg_next_tvb = NULL;
12 #.FN_FTR Invoke
13   actx->rose_ctx->d.pdu = 1;
14
15   if ((actx->rose_ctx->d.code == 0) && actx->rose_ctx->arg_local_dissector_table) {
16     arg_handle = dissector_get_uint_handle(actx->rose_ctx->arg_local_dissector_table, actx->rose_ctx->d.code_local);
17   } else if ((actx->rose_ctx->d.code == 1) && actx->rose_ctx->arg_global_dissector_table) {
18     arg_handle = dissector_get_string_handle(actx->rose_ctx->arg_global_dissector_table, actx->rose_ctx->d.code_global);
19   } else {
20     arg_handle = NULL;
21   }
22
23   if (!arg_handle || 
24       !proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(arg_handle)))) {
25     if (actx->rose_ctx->d.code == 0)
26       descr = ep_strdup_printf("INV: %d", actx->rose_ctx->d.code_local);
27     else if (actx->rose_ctx->d.code == 1)
28       descr = ep_strdup_printf("INV: %s", actx->rose_ctx->d.code_global);
29   } else {
30     descr = ep_strdup_printf("INV:");
31   }
32
33   if (actx->rose_ctx->apdu_depth >= 0)
34     proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), "  %s", descr);
35   if (actx->rose_ctx->fillin_info && check_col(actx->pinfo->cinfo, COL_INFO))
36     col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
37   if (actx->rose_ctx->fillin_ptr)
38     g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
39
40   if (!arg_next_tvb) {  /* empty argument */
41     arg_next_tvb = tvb_new_subset(tvb, (actx->encoding==ASN1_ENC_PER)?offset>>3:offset, 0, 0);
42   }
43   actx->pinfo->private_data = actx->rose_ctx;
44   call_dissector((arg_handle)?arg_handle:data_handle, arg_next_tvb, actx->pinfo, tree);
45   if (!arg_handle) {
46     expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr);
47   }
48 #.END