aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ieee1722.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2012-03-02 03:30:30 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2012-03-02 03:30:30 +0000
commit1ff7c5d916952de778b580ce8cca81ec9ef0fc70 (patch)
tree36ac0e04665c9918270c78010e7cd2eeb415b665 /epan/dissectors/packet-ieee1722.c
parentf2c1c108f59f005918304dc39dbed18b57b71245 (diff)
From Tom Bottom and Chris Pane via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6887 :
A new dissector for IEEE 1722.1. From me: some code cleanup, including: - Get rid of some unnecessary local variable initializations. - Put all of 1722.1 under one subtree. - Just put if(tree)s in the top-level function rather than scattered throughout. - Remove a couple "set but not used" warnings (a couple are #if'd out). - Don't use deprecated functions. svn path=/trunk/; revision=41282
Diffstat (limited to 'epan/dissectors/packet-ieee1722.c')
-rw-r--r--epan/dissectors/packet-ieee1722.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/epan/dissectors/packet-ieee1722.c b/epan/dissectors/packet-ieee1722.c
index b084ee5f14..68f7d04d86 100644
--- a/epan/dissectors/packet-ieee1722.c
+++ b/epan/dissectors/packet-ieee1722.c
@@ -4,6 +4,8 @@
* Dave Olsen <dave.olsen@harman.com>
* Levi Pearson <levi.pearson@harman.com>
*
+ * Copyright 2011, Thomas Bottom <tom.bottom@labxtechnologies.com>
+ *
* $Id$
*
* Wireshark - Network traffic analyzer
@@ -116,15 +118,19 @@ static int ett_1722 = -1;
static int ett_1722_audio = -1;
static int ett_1722_sample = -1;
-static void dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static dissector_table_t avb_dissector_table;
+
+static void
+dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- proto_item *ti = NULL;
- proto_tree *ieee1722_tree = NULL;
- proto_tree *audio_tree = NULL;
- proto_tree *sample_tree = NULL;
- gint offset = 0;
- guint16 datalen = 0;
- guint8 dbs = 0;
+ proto_item *ti;
+ proto_tree *ieee1722_tree;
+ proto_tree *audio_tree;
+ proto_tree *sample_tree;
+ gint offset;
+ guint16 datalen;
+ guint8 dbs;
+ guint8 subtype;
int i, j;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IEEE1722");
@@ -149,6 +155,13 @@ static void dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(ieee1722_tree, hf_1722_gvfield, tvb, IEEE_1722_VERSION_OFFSET, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(ieee1722_tree, hf_1722_tvfield, tvb, IEEE_1722_VERSION_OFFSET, 1, ENC_BIG_ENDIAN);
+ /* Version field ends the common AVTPDU. Now parse the specfic packet type */
+ subtype = tvb_get_guint8(tvb, IEEE_1722_CD_OFFSET);
+ subtype &= 0x7F;
+
+ /* call subtype dissectors for 1722.1 */
+ if (dissector_try_uint(avb_dissector_table, subtype, tvb, pinfo, tree)) return;
+
/* Add the rest of the packet fields */
proto_tree_add_item(ieee1722_tree, hf_1722_seqnum, tvb,
IEEE_1722_SEQ_NUM_OFFSET, 1, ENC_BIG_ENDIAN);
@@ -373,6 +386,10 @@ void proto_register_1722(void)
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_1722, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ /* Sub-dissector for 1772.1 */
+ avb_dissector_table = register_dissector_table("ieee1722.subtype",
+ "AVBTP Subtype", FT_UINT8, BASE_HEX);
}
void proto_reg_handoff_1722(void)