From Tobias Witek: Add dissector table to 'meta' dissector.

The attached patch adds a dissector table to the 'meta' dissector
  so that other protocol dissectors can register for specific values
  of 'meta.proto'.

  Additionally, the patch also adds three more protocol values.

  https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6730


svn path=/trunk/; revision=40445
This commit is contained in:
Bill Meier 2012-01-12 22:13:09 +00:00
parent 34a0aba9d3
commit d412a94dd5
2 changed files with 19 additions and 2 deletions

View file

@ -87,6 +87,8 @@ static dissector_handle_t ethwithoutfcs_handle;
static dissector_handle_t fphint_handle;
static dissector_handle_t erf_handle;
static dissector_table_t meta_dissector_table;
static const value_string meta_schema_vals[] = {
{ META_SCHEMA_PCAP, "PCAP" },
{ META_SCHEMA_DXT, "DXT" },
@ -100,6 +102,9 @@ static const value_string meta_proto_vals[] = {
{ META_PROTO_DXT_ERF_AAL5, "ERF AAL5" },
{ META_PROTO_DXT_ATM_AAL2, "ATM AAL2" },
{ META_PROTO_DXT_ATM, "ATM" },
{ META_PROTO_DXT_CONTAINER, "DXT CONTAINER" },
{ META_PROTO_DXT_FP_CAPTURE, "FP CAPTURE" },
{ META_PROTO_DXT_UTRAN_CAPSULE, "UTRAN CAPSULE" },
{ 0, NULL }
};
@ -446,7 +451,7 @@ dissect_meta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *meta_tree = NULL;
proto_item *ti = NULL;
tvbuff_t *next_tvb;
dissector_handle_t next_dissector = data_handle;
dissector_handle_t next_dissector = NULL;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "META");
@ -517,10 +522,14 @@ dissect_meta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pinfo->pseudo_header->atm.aal = AAL_5;
next_dissector = atm_untrunc_handle;
break;
default:
next_dissector =
dissector_get_uint_handle(meta_dissector_table, proto);
}
}
next_tvb = tvb_new_subset(tvb, item_len + META_HEADER_SIZE, -1, -1);
call_dissector(next_dissector, next_tvb, pinfo, tree);
call_dissector(next_dissector ? next_dissector : data_handle,
next_tvb, pinfo, tree);
}
void
@ -574,6 +583,9 @@ proto_register_meta(void)
proto_register_field_array(proto_meta, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
meta_dissector_table = register_dissector_table("meta.proto",
"META protocol", FT_UINT16, BASE_DEC);
}
void

View file

@ -30,8 +30,13 @@
#define META_PROTO_DXT_ETHERNET_CRC 36
#define META_PROTO_DXT_ATM 41
#define META_PROTO_DXT_ERF_AAL5 49
#define META_PROTO_DXT_M3UA 61
#define META_PROTO_DXT_NBAP 69
#define META_PROTO_DXT_ATM_AAL2 76
#define META_PROTO_DXT_FP_HINT 82
#define META_PROTO_DXT_CONTAINER 127
#define META_PROTO_DXT_FP_CAPTURE 193
#define META_PROTO_DXT_UTRAN_CAPSULE 194
/* data types */
#define META_TYPE_NONE 0