diff options
author | wmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7> | 2012-07-16 12:34:33 +0000 |
---|---|---|
committer | wmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7> | 2012-07-16 12:34:33 +0000 |
commit | b60c917cdc3a11bf79ba180865e8bdbb51accd0f (patch) | |
tree | ec4a4daae9d8e2fc515200a03885e0a83e348e19 /epan/dissectors/packet-dmx.c | |
parent | 906b62e2ac11964281c93459e4971d81f8ce2217 (diff) |
Minor cleanup, including:
- Remove unneeded #includes;
- Simplify code slightly;
- Remove unused ett variable and related;
- Remove empty proto_reg_handoff...() functions;
- Fix a few cases of "set but unused".
- Do some whitespace changes.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@43748 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-dmx.c')
-rw-r--r-- | epan/dissectors/packet-dmx.c | 56 |
1 files changed, 15 insertions, 41 deletions
diff --git a/epan/dissectors/packet-dmx.c b/epan/dissectors/packet-dmx.c index 429936a7c1..29e1b2e345 100644 --- a/epan/dissectors/packet-dmx.c +++ b/epan/dissectors/packet-dmx.c @@ -4,7 +4,7 @@ * $Id$ * * This dissector is written by - * + * * Erwin Rol <erwin@erwinrol.com> * Copyright 2012 Erwin Rol * @@ -21,7 +21,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor @@ -41,14 +41,7 @@ # include "config.h" #endif -#include <stdlib.h> -#include <ctype.h> -#include <time.h> -#include <string.h> #include <epan/packet.h> -#include <epan/addr_resolv.h> -#include <epan/prefs.h> -#include <epan/strutil.h> #define DMX_SC_DMX 0x00 #define DMX_SC_TEXT 0x17 @@ -70,23 +63,21 @@ void proto_reg_handoff_dmx(void); static int proto_dmx = -1; static int hf_dmx_start_code = -1; -static int hf_dmx_frame_data = -1; - -static int ett_dmx = -1; static dissector_handle_t rdm_handle; static dissector_handle_t dmx_chan_handle; static dissector_handle_t dmx_test_handle; static dissector_handle_t dmx_text_handle; static dissector_handle_t dmx_sip_handle; +static dissector_handle_t data_handle; static void dissect_dmx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - tvbuff_t *next_tvb = NULL; - unsigned offset = 0; - guint8 start_code; + tvbuff_t *next_tvb; + unsigned offset = 0; + guint8 start_code; col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX"); col_clear(pinfo->cinfo, COL_INFO); @@ -96,31 +87,27 @@ dissect_dmx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset, 1, ENC_BIG_ENDIAN); offset++; + next_tvb = tvb_new_subset_remaining(tvb, offset); + switch (start_code) { case DMX_SC_DMX: - next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(dmx_chan_handle, next_tvb, pinfo, tree); break; case DMX_SC_TEXT: - next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(dmx_text_handle, next_tvb, pinfo, tree); break; case DMX_SC_TEST: - next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(dmx_test_handle, next_tvb, pinfo, tree); break; case DMX_SC_RDM: - next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(rdm_handle, next_tvb, pinfo, tree); break; case DMX_SC_SIP: - next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(dmx_sip_handle, next_tvb, pinfo, tree); break; default: if (offset < tvb_length(tvb)) - proto_tree_add_item(tree, hf_dmx_frame_data, tvb, - offset, -1, ENC_NA); + call_dissector(data_handle, next_tvb, pinfo, tree); break; } } @@ -133,33 +120,20 @@ proto_register_dmx(void) { "Start Code", "dmx.start_code", FT_UINT8, BASE_HEX, VALS(dmx_sc_vals), 0x0, NULL, HFILL }}, - { &hf_dmx_frame_data, - { "Frame Data", "dmx.frame_data", - FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - }; - - static gint *ett[] = { - &ett_dmx }; proto_dmx = proto_register_protocol("DMX", "DMX", "dmx"); proto_register_field_array(proto_dmx, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); register_dissector("dmx", dissect_dmx, proto_dmx); } void proto_reg_handoff_dmx(void) { - static gboolean dmx_initialized = FALSE; - - if (!dmx_initialized) { - rdm_handle = find_dissector("rdm"); - dmx_chan_handle = find_dissector("dmx-chan"); - dmx_test_handle = find_dissector("dmx-test"); - dmx_text_handle = find_dissector("dmx-text"); - dmx_sip_handle = find_dissector("dmx-sip"); - dmx_initialized = TRUE; - } + rdm_handle = find_dissector("rdm"); + dmx_chan_handle = find_dissector("dmx-chan"); + dmx_test_handle = find_dissector("dmx-test"); + dmx_text_handle = find_dissector("dmx-text"); + dmx_sip_handle = find_dissector("dmx-sip"); + data_handle = find_dissector("data"); } |