2012-08-02 19:28:08 +00:00
|
|
|
/* packet-flexnet.c
|
|
|
|
*
|
|
|
|
* Routines for Amateur Packet Radio protocol dissection
|
|
|
|
* Copyright 2005,2006,2007,2008,2009,2010,2012 R.W. Stearn <richard@rns-stearn.demon.co.uk>
|
|
|
|
*
|
2012-10-22 20:46:47 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2012-08-02 19:28:08 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2012-08-02 19:28:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Information on the protocol drawn from:
|
|
|
|
*
|
|
|
|
* Inspiration on how to build the dissector drawn from
|
|
|
|
* packet-sdlc.c
|
|
|
|
* packet-x25.c
|
|
|
|
* packet-lapb.c
|
|
|
|
* paket-gprs-llc.c
|
|
|
|
* xdlc.c
|
|
|
|
* with the base file built from README.developers.
|
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2012-08-02 19:28:08 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2012-08-03 01:58:12 +00:00
|
|
|
#include <epan/ax25_pids.h>
|
2012-08-02 19:28:08 +00:00
|
|
|
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_flexnet(void);
|
|
|
|
void proto_reg_handoff_flexnet(void);
|
|
|
|
|
2012-08-02 19:28:08 +00:00
|
|
|
#define FLEXNET_ADRLEN 15
|
|
|
|
#define FLEXNET_CTLLEN 15
|
|
|
|
#define FLEXNET_HDRLEN (FLEXNET_ADRLEN + FLEXNET_ADRLEN + FLEXNET_CTLLEN)
|
|
|
|
|
|
|
|
static int proto_flexnet = -1;
|
|
|
|
static int hf_flexnet_dst = -1;
|
|
|
|
static int hf_flexnet_src = -1;
|
|
|
|
static int hf_flexnet_ctl = -1;
|
|
|
|
|
|
|
|
static gint ett_flexnet = -1;
|
|
|
|
static gint ett_flexnet_ctl = -1;
|
|
|
|
|
2015-11-15 13:00:10 +00:00
|
|
|
static int
|
|
|
|
dissect_flexnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
|
2012-08-02 19:28:08 +00:00
|
|
|
{
|
2012-10-22 20:46:47 +00:00
|
|
|
tvbuff_t *next_tvb;
|
2012-08-02 19:28:08 +00:00
|
|
|
|
|
|
|
col_set_str( pinfo->cinfo, COL_PROTOCOL, "Flexnet");
|
|
|
|
col_clear( pinfo->cinfo, COL_INFO );
|
|
|
|
|
|
|
|
if ( parent_tree )
|
|
|
|
{
|
2012-10-22 20:46:47 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *flexnet_tree;
|
|
|
|
int offset;
|
|
|
|
|
2012-08-02 19:28:08 +00:00
|
|
|
/* create display subtree for the protocol */
|
|
|
|
|
|
|
|
ti = proto_tree_add_protocol_format( parent_tree, proto_flexnet, tvb, 0, FLEXNET_HDRLEN, "FLEXNET" );
|
|
|
|
|
|
|
|
flexnet_tree = proto_item_add_subtree( ti, ett_flexnet );
|
|
|
|
|
|
|
|
offset = 0;
|
|
|
|
|
2012-10-22 20:46:47 +00:00
|
|
|
proto_tree_add_item( flexnet_tree, hf_flexnet_dst, tvb, offset, FLEXNET_ADRLEN, ENC_NA );
|
2012-08-02 19:28:08 +00:00
|
|
|
offset +=FLEXNET_ADRLEN;
|
|
|
|
|
2012-10-22 20:46:47 +00:00
|
|
|
proto_tree_add_item( flexnet_tree, hf_flexnet_src, tvb, offset, FLEXNET_ADRLEN, ENC_NA );
|
2012-08-02 19:28:08 +00:00
|
|
|
offset +=FLEXNET_ADRLEN;
|
|
|
|
|
2012-10-22 20:46:47 +00:00
|
|
|
proto_tree_add_item( flexnet_tree, hf_flexnet_ctl, tvb, offset, FLEXNET_CTLLEN, ENC_NA );
|
|
|
|
/* offset +=FLEXNET_CTLLEN; */
|
2012-08-02 19:28:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Call sub-dissectors here */
|
|
|
|
|
2013-02-19 23:17:07 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, FLEXNET_HDRLEN);
|
2016-03-20 00:33:14 +00:00
|
|
|
call_data_dissector(next_tvb, pinfo, parent_tree );
|
2015-11-15 13:00:10 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2012-08-02 19:28:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_flexnet(void)
|
2012-08-02 21:44:22 +00:00
|
|
|
{
|
2012-08-02 19:28:08 +00:00
|
|
|
/* Setup list of header fields */
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_flexnet_dst,
|
|
|
|
{ "Destination", "flexnet.dst",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
"Destination address", HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_flexnet_src,
|
|
|
|
{ "Source", "flexnet.src",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
"Source address", HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_flexnet_ctl,
|
|
|
|
{ "Control", "flexnet.ctl",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
2012-08-02 21:44:22 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 19:28:08 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_flexnet,
|
|
|
|
&ett_flexnet_ctl,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
|
|
|
proto_flexnet = proto_register_protocol("FlexNet", "FLEXNET", "flexnet");
|
|
|
|
|
|
|
|
/* Required function calls to register the header fields and subtrees used */
|
|
|
|
proto_register_field_array( proto_flexnet, hf, array_length( hf ) );
|
|
|
|
proto_register_subtree_array( ett, array_length( ett ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_flexnet(void)
|
|
|
|
{
|
2015-12-09 03:49:44 +00:00
|
|
|
dissector_add_uint( "ax25.pid", AX25_P_FLEXNET, create_dissector_handle( dissect_flexnet, proto_flexnet ) );
|
2012-08-02 19:28:08 +00:00
|
|
|
}
|
2014-10-05 19:57:05 +00:00
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2014-10-05 19:57:05 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|