3 * Routines for Amateur Packet Radio protocol dissection
4 * Copyright 2005,2006,2007,2008,2009,2010,2012 R.W. Stearn <richard@rns-stearn.demon.co.uk>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 * Information on the protocol drawn from:
30 * Inspiration on how to build the dissector drawn from
36 * with the base file built from README.developers.
43 #include <epan/packet.h>
44 #include <epan/ax25_pids.h>
46 #define FLEXNET_ADRLEN 15
47 #define FLEXNET_CTLLEN 15
48 #define FLEXNET_HDRLEN (FLEXNET_ADRLEN + FLEXNET_ADRLEN + FLEXNET_CTLLEN)
50 static dissector_handle_t default_handle
;
52 static int proto_flexnet
= -1;
53 static int hf_flexnet_dst
= -1;
54 static int hf_flexnet_src
= -1;
55 static int hf_flexnet_ctl
= -1;
57 static gint ett_flexnet
= -1;
58 static gint ett_flexnet_ctl
= -1;
61 dissect_flexnet(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
)
65 col_set_str( pinfo
->cinfo
, COL_PROTOCOL
, "Flexnet");
66 col_clear( pinfo
->cinfo
, COL_INFO
);
71 proto_tree
*flexnet_tree
;
74 /* create display subtree for the protocol */
76 ti
= proto_tree_add_protocol_format( parent_tree
, proto_flexnet
, tvb
, 0, FLEXNET_HDRLEN
, "FLEXNET" );
78 flexnet_tree
= proto_item_add_subtree( ti
, ett_flexnet
);
82 proto_tree_add_item( flexnet_tree
, hf_flexnet_dst
, tvb
, offset
, FLEXNET_ADRLEN
, ENC_NA
);
83 offset
+=FLEXNET_ADRLEN
;
85 proto_tree_add_item( flexnet_tree
, hf_flexnet_src
, tvb
, offset
, FLEXNET_ADRLEN
, ENC_NA
);
86 offset
+=FLEXNET_ADRLEN
;
88 proto_tree_add_item( flexnet_tree
, hf_flexnet_ctl
, tvb
, offset
, FLEXNET_CTLLEN
, ENC_NA
);
89 /* offset +=FLEXNET_CTLLEN; */
92 /* Call sub-dissectors here */
94 next_tvb
= tvb_new_subset_remaining(tvb
, FLEXNET_HDRLEN
);
95 call_dissector( default_handle
, next_tvb
, pinfo
, parent_tree
);
99 proto_register_flexnet(void)
101 /* Setup list of header fields */
102 static hf_register_info hf
[] = {
104 { "Destination", "flexnet.dst",
105 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
106 "Destination address", HFILL
}
109 { "Source", "flexnet.src",
110 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
111 "Source address", HFILL
}
114 { "Control", "flexnet.ctl",
115 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
120 /* Setup protocol subtree array */
121 static gint
*ett
[] = {
126 /* Register the protocol name and description */
127 proto_flexnet
= proto_register_protocol("FlexNet", "FLEXNET", "flexnet");
129 /* Required function calls to register the header fields and subtrees used */
130 proto_register_field_array( proto_flexnet
, hf
, array_length( hf
) );
131 proto_register_subtree_array( ett
, array_length( ett
) );
135 proto_reg_handoff_flexnet(void)
137 dissector_add_uint( "ax25.pid", AX25_P_FLEXNET
, create_dissector_handle( dissect_flexnet
, proto_flexnet
) );
141 default_handle
= find_dissector( "data" );