Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-flexnet.c
blob38d455b52499943687e502a9cc25acfc62f280c4
1 /* packet-flexnet.c
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>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
14 * Information on the protocol drawn from:
16 * Inspiration on how to build the dissector drawn from
17 * packet-sdlc.c
18 * packet-x25.c
19 * packet-lapb.c
20 * paket-gprs-llc.c
21 * xdlc.c
22 * with the base file built from README.developers.
25 #include "config.h"
27 #include <epan/packet.h>
28 #include <epan/ax25_pids.h>
30 void proto_register_flexnet(void);
31 void proto_reg_handoff_flexnet(void);
33 static dissector_handle_t flexnet_handle;
35 #define FLEXNET_ADRLEN 15
36 #define FLEXNET_CTLLEN 15
37 #define FLEXNET_HDRLEN (FLEXNET_ADRLEN + FLEXNET_ADRLEN + FLEXNET_CTLLEN)
39 static int proto_flexnet;
40 static int hf_flexnet_dst;
41 static int hf_flexnet_src;
42 static int hf_flexnet_ctl;
44 static int ett_flexnet;
45 static int ett_flexnet_ctl;
47 static int
48 dissect_flexnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
50 tvbuff_t *next_tvb;
52 col_set_str( pinfo->cinfo, COL_PROTOCOL, "Flexnet");
53 col_clear( pinfo->cinfo, COL_INFO );
55 if ( parent_tree )
57 proto_item *ti;
58 proto_tree *flexnet_tree;
59 int offset;
61 /* create display subtree for the protocol */
63 ti = proto_tree_add_protocol_format( parent_tree, proto_flexnet, tvb, 0, FLEXNET_HDRLEN, "FLEXNET" );
65 flexnet_tree = proto_item_add_subtree( ti, ett_flexnet );
67 offset = 0;
69 proto_tree_add_item( flexnet_tree, hf_flexnet_dst, tvb, offset, FLEXNET_ADRLEN, ENC_NA );
70 offset +=FLEXNET_ADRLEN;
72 proto_tree_add_item( flexnet_tree, hf_flexnet_src, tvb, offset, FLEXNET_ADRLEN, ENC_NA );
73 offset +=FLEXNET_ADRLEN;
75 proto_tree_add_item( flexnet_tree, hf_flexnet_ctl, tvb, offset, FLEXNET_CTLLEN, ENC_NA );
76 /* offset +=FLEXNET_CTLLEN; */
79 /* Call sub-dissectors here */
81 next_tvb = tvb_new_subset_remaining(tvb, FLEXNET_HDRLEN);
82 call_data_dissector(next_tvb, pinfo, parent_tree );
83 return tvb_captured_length(tvb);
86 void
87 proto_register_flexnet(void)
89 /* Setup list of header fields */
90 static hf_register_info hf[] = {
91 { &hf_flexnet_dst,
92 { "Destination", "flexnet.dst",
93 FT_BYTES, BASE_NONE, NULL, 0x0,
94 "Destination address", HFILL }
96 { &hf_flexnet_src,
97 { "Source", "flexnet.src",
98 FT_BYTES, BASE_NONE, NULL, 0x0,
99 "Source address", HFILL }
101 { &hf_flexnet_ctl,
102 { "Control", "flexnet.ctl",
103 FT_BYTES, BASE_NONE, NULL, 0x0,
104 NULL, HFILL }
108 /* Setup protocol subtree array */
109 static int *ett[] = {
110 &ett_flexnet,
111 &ett_flexnet_ctl,
114 /* Register the protocol name and description */
115 proto_flexnet = proto_register_protocol("FlexNet", "FLEXNET", "flexnet");
117 /* Required function calls to register the header fields and subtrees used */
118 proto_register_field_array( proto_flexnet, hf, array_length( hf ) );
119 proto_register_subtree_array( ett, array_length( ett ) );
121 flexnet_handle = register_dissector( "flexnet", dissect_flexnet, proto_flexnet );
124 void
125 proto_reg_handoff_flexnet(void)
127 dissector_add_uint( "ax25.pid", AX25_P_FLEXNET, flexnet_handle );
131 * Editor modelines - https://www.wireshark.org/tools/modelines.html
133 * Local variables:
134 * c-basic-offset: 8
135 * tab-width: 8
136 * indent-tabs-mode: t
137 * End:
139 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
140 * :indentSize=8:tabSize=8:noTabs=false: