diff options
author | Michael Mann <mmann78@netscape.net> | 2017-05-08 20:32:56 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-05-09 04:52:00 +0000 |
commit | fa5f913256bc16d21f9b9727fdf2cec454059c8d (patch) | |
tree | 841d9388695919e49419659e7d45beb34cee8dce /plugins/docsis/packet-dpvrsp.c | |
parent | 954548fdb951cbffbfa3c7cadb2c202919c0204c (diff) |
Bring DOCSIS Mac Management "dissectors" into modernity.
1. Use proto_tree_add_item_ret_uint to remove separate "gets"
2. Remove if (tree)s that prevented expert_info
3. Apply consistent whitespace
4. Apply consistent TLV behavior, making T and L always filterable
5. Remove T name (of TLV) from field name itself (where applicable)
6. Use BASE_UNIT_STRING and BASE_NO_DISPLAY_VALUE
Tested with capture generated from https://github.com/AdrianSimionov/docsis-generator
Change-Id: I9987397ccb3248b2a26d850af468740f94b28a63
Reviewed-on: https://code.wireshark.org/review/21561
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'plugins/docsis/packet-dpvrsp.c')
-rw-r--r-- | plugins/docsis/packet-dpvrsp.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/plugins/docsis/packet-dpvrsp.c b/plugins/docsis/packet-dpvrsp.c index 23e1d95f98..c7ffb990c1 100644 --- a/plugins/docsis/packet-dpvrsp.c +++ b/plugins/docsis/packet-dpvrsp.c @@ -51,42 +51,26 @@ dissect_dpvrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* da { proto_item *it; proto_tree *dpvrsp_tree = NULL; - guint16 transid; - guint8 dschan; + guint32 transid, dschan; - transid = tvb_get_ntohs (tvb, 0); - dschan = tvb_get_guint8 (tvb, 2); + it = proto_tree_add_item (tree, proto_docsis_dpvrsp, tvb, 0, -1, ENC_NA); + dpvrsp_tree = proto_item_add_subtree (it, ett_docsis_dpvrsp); + proto_tree_add_item_ret_uint (dpvrsp_tree, hf_docsis_dpvrsp_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid); + proto_tree_add_item_ret_uint (dpvrsp_tree, hf_docsis_dpvrsp_dschan, tvb, 2, 1, ENC_BIG_ENDIAN, &dschan); col_add_fstr (pinfo->cinfo, COL_INFO, "DOCSIS Path Verify Response: Transaction-Id = %u DS-Ch %d", transid, dschan); - if (tree) - { - it = - proto_tree_add_protocol_format (tree, proto_docsis_dpvrsp, tvb, 0, -1, - "DPV Response"); - dpvrsp_tree = proto_item_add_subtree (it, ett_docsis_dpvrsp); - proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_tranid, tvb, - 0, 2, ENC_BIG_ENDIAN); - proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_dschan, tvb, - 2, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_flags, tvb, - 3, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_us_sf, tvb, - 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_n, tvb, - 8, 2, ENC_BIG_ENDIAN); - proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_start, tvb, - 10, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_end, tvb, - 11, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_ts_start, tvb, - 12, 4, ENC_BIG_ENDIAN); - proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_ts_end, tvb, - 16, 4, ENC_BIG_ENDIAN); - } - return tvb_captured_length(tvb); + proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_flags, tvb, 3, 1, ENC_BIG_ENDIAN); + proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_us_sf, tvb, 4, 4, ENC_BIG_ENDIAN); + proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_n, tvb, 8, 2, ENC_BIG_ENDIAN); + proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_start, tvb, 10, 1, ENC_BIG_ENDIAN); + proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_end, tvb, 11, 1, ENC_BIG_ENDIAN); + proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_ts_start, tvb, 12, 4, ENC_BIG_ENDIAN); + proto_tree_add_item (dpvrsp_tree, hf_docsis_dpvrsp_ts_end, tvb, 16, 4, ENC_BIG_ENDIAN); + + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ |