2 * Routines for Link Aggregation Marker protocol dissection.
5 * Copyright 2002 Steve Housley <steve_housley@3com.com>
6 * Copyright 2005 Dominique Bastien <dbastien@accedian.com>
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.
29 #include <epan/packet.h>
30 #include <epan/slow_protocol_subtypes.h>
32 /* General declarations */
33 void proto_register_marker(void);
34 void proto_reg_handoff_marker(void);
36 /* MARKER TLVs subtype */
37 #define MARKERPDU_END_MARKER 0x0
38 #define MARKERPDU_MARKER_INFO 0x1
39 #define MARKERPDU_MARKER_RESPONSE 0x2
41 static const value_string marker_vals[] = {
42 { MARKERPDU_MARKER_INFO, "Marker Information" },
43 { MARKERPDU_MARKER_RESPONSE, "Marker Response Information" },
47 /* Initialise the protocol and registered fields */
48 static int proto_marker = -1;
50 static int hf_marker_version_number = -1;
51 static int hf_marker_tlv_type = -1;
52 static int hf_marker_tlv_length = -1;
53 static int hf_marker_req_port = -1;
54 static int hf_marker_req_system = -1;
55 static int hf_marker_req_trans_id = -1;
57 /* Initialise the subtree pointers */
59 static gint ett_marker = -1;
62 * Name: dissect_marker
65 * This function is used to dissect the Link Aggregation Marker Protocol
66 * slow protocols defined in IEEE802.3 clause 43.5 (The PDUs are defined
67 * in section 43.5.3.2). The TLV types are 0x01 for a marker TLV and 0x02
68 * for a marker response. A value of 0x00 indicates an end of message.
71 * tvb: buffer associated with the rcv packet (see tvbuff.h).
72 * pinfo: structure associated with the rcv packet (see packet_info.h).
73 * tree: the protocol tree associated with the rcv packet (see proto.h).
78 * Dominique Bastien (dbastien@accedian.com)
79 * + add support for MARKER and MARKER Response PDUs.
82 dissect_marker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
87 proto_tree *marker_tree;
88 proto_item *marker_item;
91 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Marker");
92 col_set_str(pinfo->cinfo, COL_INFO, "Marker Protocol");
96 marker_item = proto_tree_add_protocol_format(tree, proto_marker, tvb,
97 0, -1, "Marker Protocol");
98 marker_tree = proto_item_add_subtree(marker_item, ett_marker);
101 proto_tree_add_item(marker_tree, hf_marker_version_number, tvb,
102 offset, 1, ENC_BIG_ENDIAN);
108 raw_octet = tvb_get_guint8(tvb, offset);
110 if (raw_octet == MARKERPDU_END_MARKER)
113 proto_tree_add_uint(marker_tree, hf_marker_tlv_type, tvb,
114 offset, 1, raw_octet);
118 proto_tree_add_item(marker_tree, hf_marker_tlv_length, tvb,
119 offset, 1, ENC_BIG_ENDIAN);
123 proto_tree_add_item(marker_tree, hf_marker_req_port, tvb,
124 offset, 2, ENC_BIG_ENDIAN);
127 /* Requester System */
128 proto_tree_add_item(marker_tree, hf_marker_req_system, tvb,
132 /* Requester Transaction ID */
133 proto_tree_add_item(marker_tree, hf_marker_req_trans_id, tvb,
134 offset, 4, ENC_BIG_ENDIAN);
141 return tvb_captured_length(tvb);
144 /* Register the protocol with Wireshark */
146 proto_register_marker(void)
148 /* Setup list of header fields */
150 static hf_register_info hf[] = {
151 { &hf_marker_version_number,
152 { "Version Number", "marker.version",
153 FT_UINT8, BASE_HEX, NULL, 0x0,
154 "Marker protocol version", HFILL }},
156 { &hf_marker_tlv_type,
157 { "TLV Type", "marker.tlvType",
158 FT_UINT8, BASE_HEX, VALS(marker_vals), 0x0,
161 { &hf_marker_tlv_length,
162 { "TLV Length", "marker.tlvLen",
163 FT_UINT8, BASE_HEX, NULL, 0x0,
164 "Length of the Actor TLV", HFILL }},
166 { &hf_marker_req_port,
167 { "Requester Port", "marker.requesterPort",
168 FT_UINT16, BASE_DEC, NULL, 0x0,
171 { &hf_marker_req_system,
172 { "Requester System", "marker.requesterSystem",
173 FT_ETHER, BASE_NONE, NULL, 0x0,
174 "Requester System ID encoded as a MAC address", HFILL }},
176 { &hf_marker_req_trans_id,
177 { "Requester Transaction ID", "marker.requesterTransId",
178 FT_UINT32, BASE_DEC, NULL, 0x0,
182 /* Setup protocol subtree array */
184 static gint *ett[] = {
188 /* Register the protocol name and description */
190 proto_marker = proto_register_protocol("Marker", "Link Aggregation Marker Protocol", "marker");
192 /* Required function calls to register the header fields and subtrees used */
194 proto_register_field_array(proto_marker, hf, array_length(hf));
195 proto_register_subtree_array(ett, array_length(ett));
199 proto_reg_handoff_marker(void)
201 dissector_handle_t marker_handle;
203 marker_handle = create_dissector_handle(dissect_marker, proto_marker);
204 dissector_add_uint("slow.subtype", MARKER_SUBTYPE, marker_handle);
208 * Editor modelines - http://www.wireshark.org/tools/modelines.html
213 * indent-tabs-mode: nil
216 * vi: set shiftwidth=4 tabstop=8 expandtab:
217 * :indentSize=4:tabSize=8:noTabs=true: