2 * Routines for MAC Control ethernet header disassembly
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 #include <epan/packet.h>
31 #include "packet-ieee8023.h"
32 #include "packet-llc.h"
35 static int proto_macctrl = -1;
37 static gint ett_macctrl = -1;
38 static int hf_macctrl_pause = -1;
39 static int hf_macctrl_quanta = -1;
43 dissect_macctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
46 proto_tree *volatile macctrl_tree;
50 pause = tvb_get_ntohs(tvb, 0);
51 pause_quanta = tvb_get_ntohs(tvb, 2);
53 if (check_col(pinfo->cinfo, COL_PROTOCOL))
54 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CTRL");
55 if (check_col(pinfo->cinfo, COL_INFO))
56 col_clear(pinfo->cinfo, COL_INFO);
59 if (check_col(pinfo->cinfo, COL_INFO)) {
60 col_add_fstr(pinfo->cinfo, COL_INFO, "MAC PAUSE: Quanta %d", pause_quanta);
67 ti = proto_tree_add_item(tree, proto_macctrl, tvb, 0, 4, FALSE);
68 macctrl_tree = proto_item_add_subtree(ti, ett_macctrl);
70 proto_tree_add_uint(macctrl_tree, hf_macctrl_pause, tvb, 0, 2, pause);
71 proto_tree_add_uint(macctrl_tree, hf_macctrl_quanta, tvb, 2, 2, pause_quanta);
78 proto_register_macctrl(void)
80 static hf_register_info hf[] = {
82 { "Pause", "macctrl.pause", FT_UINT16, BASE_HEX,
83 NULL, 0x0, "MAC control Pause", HFILL}},
86 { "Quanta", "macctrl.quanta", FT_UINT16, BASE_DEC,
87 NULL, 0x0, "MAC control quanta", HFILL }}
90 static gint *ett[] = {
93 proto_macctrl = proto_register_protocol("MAC Control", "MACC", "macc");
94 proto_register_field_array(proto_macctrl, hf, array_length(hf));
95 proto_register_subtree_array(ett, array_length(ett));
99 proto_reg_handoff_macctrl(void)
101 dissector_handle_t macctrl_handle;
103 macctrl_handle = create_dissector_handle(dissect_macctrl, proto_macctrl);
104 dissector_add("ethertype", ETHERTYPE_MAC_CONTROL, macctrl_handle);