From de522e2ff722d6ddc58cec1b561e0ddf28f99f13 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Wed, 13 Jul 2016 15:44:43 +0200 Subject: osmux: Add osmuxh info for osmux tap Change-Id: Ic562ab92efe0a44d41f6426315d563ffd187e031 --- epan/dissectors/packet-osmux.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/epan/dissectors/packet-osmux.c b/epan/dissectors/packet-osmux.c index 8d464b7c8b..e800d7a0f6 100644 --- a/epan/dissectors/packet-osmux.c +++ b/epan/dissectors/packet-osmux.c @@ -27,6 +27,7 @@ #include #include #include +#include void proto_register_osmux(void); void proto_reg_handoff_osmux(void); @@ -43,6 +44,17 @@ static const value_string osmux_ft_vals[] = {0, NULL} }; +struct osmux_hdr { + int ft; + int ctr; + int amr_f; + int amr_q; + int seq; + int circuit_id; + int amr_cmr; + int amr_ft; +}; + /* Initialize the protocol and registered fields */ static dissector_handle_t osmux_handle; static int proto_osmux = -1; @@ -79,28 +91,36 @@ dissect_osmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U { int offset = 0; + struct osmux_hdr *osmuxh; proto_item *ti; proto_tree *osmux_tree = NULL; - guint8 ft_ctr, ft; - //, ctr, seq, circuit_id, amr_ft_cdr; + guint8 ft_ctr, amr_ft_cmr; col_set_str(pinfo->cinfo, COL_PROTOCOL, "OSmux"); col_clear(pinfo->cinfo, COL_INFO); + osmuxh = wmem_new0(wmem_packet_scope(), struct osmux_hdr); + ft_ctr = tvb_get_guint8(tvb, offset); - ft = ft_ctr >> 5; -// ctr = (ft_ctr >> 2) & 0x7; + osmuxh->ft = ft_ctr >> 5; + osmuxh->ctr = (ft_ctr >> 2) & 0x7; + osmuxh->amr_q = !!(ft_ctr & 0x02); + osmuxh->amr_f = !!(ft_ctr & 0x01); -// seq = tvb_get_guint8(tvb, offset+1); -// circuit_id = tvb_get_guint8(tvb, offset+2); -// amr_ft_cdr = tvb_get_guint8(tvb, offset+3); + osmuxh->seq = tvb_get_guint8(tvb, offset+1); + osmuxh->circuit_id = tvb_get_guint8(tvb, offset+2); + + amr_ft_cmr = tvb_get_guint8(tvb, offset+3); + osmuxh->amr_ft = (amr_ft_cmr & 0xf0) >> 4; + osmuxh->amr_cmr = amr_ft_cmr & 0x0f; col_append_fstr(pinfo->cinfo, COL_INFO, "OSMux "); + ti = proto_tree_add_protocol_format(tree, proto_osmux, tvb, offset, -1, "OSmux type %s frame", - val_to_str(ft, osmux_ft_vals, + val_to_str(osmuxh->ft, osmux_ft_vals, "unknown 0x%02x")); osmux_tree = proto_item_add_subtree(ti, ett_osmux); @@ -112,7 +132,7 @@ dissect_osmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U } col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", - val_to_str(ft, osmux_ft_vals, + val_to_str(osmuxh->ft, osmux_ft_vals, "unknown 0x%02x")); { @@ -143,7 +163,7 @@ dissect_osmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U offset++; } - tap_queue_packet(osmux_tap, pinfo, NULL); + tap_queue_packet(osmux_tap, pinfo, osmuxh); return offset; } -- cgit v1.2.3