diff options
author | Bill Meier <wmeier@newsguy.com> | 2012-10-22 20:46:47 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2012-10-22 20:46:47 +0000 |
commit | 19d2c33091027f4d9d8a4d04515a35f3f73ed74f (patch) | |
tree | 10041b5e886962541f423c0bc731f33772bdddb3 /epan/dissectors/packet-flexnet.c | |
parent | 3b4260cfe064ef4bfefceb25a4f20c8750efd7d1 (diff) | |
download | wireshark-19d2c33091027f4d9d8a4d04515a35f3f73ed74f.tar.gz |
Cleanup:
- Ethereal --> Wireshark;
- gerald@ethereal.com --> gerald@wireshark.org;
- update FSF address;
- remove unneeded #includes;
- Fix ENC args for proto_tree_add_item() & etc;
- simplify/remove proto_reg_handoff...() as appropriate;
- remove some boilerplate comments;
- move proto_register...() and proto_reg_handoff...() to
the end of the file as per convention;
- remove some unneeded initializers.
- simplify some code;
- replace "" in hf[] blurb by NULL.
svn path=/trunk/; revision=45728
Diffstat (limited to 'epan/dissectors/packet-flexnet.c')
-rw-r--r-- | epan/dissectors/packet-flexnet.c | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/epan/dissectors/packet-flexnet.c b/epan/dissectors/packet-flexnet.c index 09ccc4d214..0b53747fc2 100644 --- a/epan/dissectors/packet-flexnet.c +++ b/epan/dissectors/packet-flexnet.c @@ -5,8 +5,8 @@ * * $Id$ * - * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@ethereal.com> + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or @@ -21,7 +21,7 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* @@ -38,53 +38,40 @@ #include "config.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #include <glib.h> -#include <epan/strutil.h> #include <epan/packet.h> -#include <epan/emem.h> #include <epan/ax25_pids.h> #define FLEXNET_ADRLEN 15 #define FLEXNET_CTLLEN 15 #define FLEXNET_HDRLEN (FLEXNET_ADRLEN + FLEXNET_ADRLEN + FLEXNET_CTLLEN) -/* Forward declaration we need below */ -void proto_reg_handoff_flexnet(void); - -/* Dissector handles - all the possibles are listed */ static dissector_handle_t default_handle; -/* Initialize the protocol and registered fields */ static int proto_flexnet = -1; static int hf_flexnet_dst = -1; static int hf_flexnet_src = -1; static int hf_flexnet_ctl = -1; -/* Initialize the subtree pointers */ static gint ett_flexnet = -1; static gint ett_flexnet_ctl = -1; -/* Code to actually dissect the packets */ static void dissect_flexnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { - proto_item *ti; - proto_tree *flexnet_tree; - int offset; - void *saved_private_data; - tvbuff_t *next_tvb = NULL; + void *saved_private_data; + tvbuff_t *next_tvb; col_set_str( pinfo->cinfo, COL_PROTOCOL, "Flexnet"); - col_clear( pinfo->cinfo, COL_INFO ); if ( parent_tree ) { + proto_item *ti; + proto_tree *flexnet_tree; + int offset; + /* create display subtree for the protocol */ ti = proto_tree_add_protocol_format( parent_tree, proto_flexnet, tvb, 0, FLEXNET_HDRLEN, "FLEXNET" ); @@ -93,14 +80,14 @@ dissect_flexnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) offset = 0; - proto_tree_add_item( flexnet_tree, hf_flexnet_dst, tvb, offset, FLEXNET_ADRLEN, FALSE ); + proto_tree_add_item( flexnet_tree, hf_flexnet_dst, tvb, offset, FLEXNET_ADRLEN, ENC_NA ); offset +=FLEXNET_ADRLEN; - proto_tree_add_item( flexnet_tree, hf_flexnet_src, tvb, offset, FLEXNET_ADRLEN, FALSE ); + proto_tree_add_item( flexnet_tree, hf_flexnet_src, tvb, offset, FLEXNET_ADRLEN, ENC_NA ); offset +=FLEXNET_ADRLEN; - proto_tree_add_item( flexnet_tree, hf_flexnet_ctl, tvb, offset, FLEXNET_CTLLEN, FALSE ); - offset +=FLEXNET_CTLLEN; + proto_tree_add_item( flexnet_tree, hf_flexnet_ctl, tvb, offset, FLEXNET_CTLLEN, ENC_NA ); + /* offset +=FLEXNET_CTLLEN; */ } /* Call sub-dissectors here */ @@ -152,15 +139,10 @@ proto_register_flexnet(void) void proto_reg_handoff_flexnet(void) { - static gboolean inited = FALSE; - - if( !inited ) { - dissector_add_uint( "ax25.pid", AX25_P_FLEXNET, create_dissector_handle( dissect_flexnet, proto_flexnet ) ); + dissector_add_uint( "ax25.pid", AX25_P_FLEXNET, create_dissector_handle( dissect_flexnet, proto_flexnet ) ); - /* - */ - default_handle = find_dissector( "data" ); + /* + */ + default_handle = find_dissector( "data" ); - inited = TRUE; - } } |