2 * Routines for Aruba ADP header disassembly
6 * Giles Scott < gscott <at> arubanetworks dot 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #include <epan/packet.h>
35 #include <epan/addr_resolv.h>
37 #define UDP_PORT_ADP 8200
39 #define ADP_RESPONSE 2
41 static int proto_aruba_adp = -1;
42 static gint ett_aruba_adp = -1;
44 static int hf_adp_version = -1;
45 static int hf_adp_type = -1;
46 static int hf_adp_id = -1;
47 static int hf_adp_mac = -1;
48 static int hf_adp_switchip = -1;
50 static const value_string adp_type_val[] =
58 dissect_aruba_adp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
60 proto_tree *ti = NULL;
61 proto_tree *aruba_adp_tree = NULL;
63 const guint8 *src_mac;
64 const guint8 *switchip;
67 if (check_col(pinfo->cinfo, COL_PROTOCOL))
68 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ADP");
69 if (check_col(pinfo->cinfo, COL_INFO))
70 col_clear(pinfo->cinfo, COL_INFO);
74 ti = proto_tree_add_item(tree, proto_aruba_adp, tvb, 0, 0, FALSE);
75 aruba_adp_tree = proto_item_add_subtree(ti, ett_aruba_adp);
77 proto_tree_add_item(aruba_adp_tree, hf_adp_version, tvb, 0, 2, FALSE);
79 type = tvb_get_ntohs(tvb, 2);
82 proto_tree_add_item(aruba_adp_tree, hf_adp_type, tvb, 2, 2, FALSE);
84 proto_tree_add_item(aruba_adp_tree, hf_adp_id, tvb, 4, 2, FALSE);
90 proto_tree_add_item(aruba_adp_tree, hf_adp_mac, tvb, 6, 6, FALSE);
91 src_mac = tvb_get_ptr(tvb, 6, 6);
93 if (check_col(pinfo->cinfo, COL_INFO))
94 col_add_fstr(pinfo->cinfo, COL_INFO, "ADP Request Src MAC: %s", ether_to_str(src_mac));
96 proto_item_append_text(ti, ", Request Src MAC: %s", ether_to_str(src_mac));
101 proto_tree_add_item(aruba_adp_tree, hf_adp_switchip, tvb, 6, 4, FALSE);
102 switchip = tvb_get_ptr(tvb, 6, 4);
104 if (check_col(pinfo->cinfo, COL_INFO))
105 col_add_fstr(pinfo->cinfo, COL_INFO, "ADP Response Switch IP: %s", ip_to_str(switchip));
107 proto_item_append_text(ti, ", Response Switch IP: %s", ip_to_str(switchip));
117 proto_register_aruba_adp(void)
119 static hf_register_info hf[] = {
121 { "Version", "adp.version", FT_UINT16, BASE_DEC, NULL,0x0,
122 "ADP version", HFILL}},
125 { "Type", "adp.type", FT_UINT16, BASE_DEC, VALS(adp_type_val), 0x0,
129 { "Transaction ID", "adp.id", FT_UINT16, BASE_DEC, NULL, 0x0,
130 "ADP transaction ID", HFILL}},
133 { "MAC address", "adp.mac", FT_ETHER, BASE_NONE, NULL, 0x0,
134 "MAC address", HFILL}},
137 { "Switch IP", "adp.switch", FT_IPv4, BASE_NONE, NULL, 0x0,
138 "Switch IP address", HFILL}},
142 static gint *ett[] = {
146 proto_aruba_adp = proto_register_protocol("Aruba - Aruba Discovery Protocol",
148 proto_register_field_array(proto_aruba_adp, hf, array_length(hf));
149 proto_register_subtree_array(ett, array_length(ett));
154 proto_reg_handoff_aruba_adp(void)
156 dissector_handle_t adp_handle;
158 adp_handle = create_dissector_handle(dissect_aruba_adp, proto_aruba_adp);
159 dissector_add("udp.port", UDP_PORT_ADP, adp_handle);