2005-04-01 09:48:34 +00:00
|
|
|
/* packet-aruba-adp.c
|
|
|
|
* Routines for Aruba ADP header disassembly
|
|
|
|
*
|
2005-04-01 10:04:32 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
2005-04-01 09:48:34 +00:00
|
|
|
* Giles Scott < gscott <at> arubanetworks dot com>
|
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2005-04-01 09:48:34 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/addr_resolv.h>
|
|
|
|
|
|
|
|
#define UDP_PORT_ADP 8200
|
|
|
|
#define ADP_REQUEST 1
|
|
|
|
#define ADP_RESPONSE 2
|
|
|
|
|
|
|
|
static int proto_aruba_adp = -1;
|
|
|
|
static gint ett_aruba_adp = -1;
|
|
|
|
|
|
|
|
static int hf_adp_version = -1;
|
|
|
|
static int hf_adp_type = -1;
|
|
|
|
static int hf_adp_id = -1;
|
|
|
|
static int hf_adp_mac = -1;
|
|
|
|
static int hf_adp_switchip = -1;
|
|
|
|
|
2008-08-14 23:51:52 +00:00
|
|
|
static const value_string adp_type_val[] =
|
2005-04-01 09:48:34 +00:00
|
|
|
{
|
|
|
|
{1, "Request"},
|
|
|
|
{2, "Response"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_aruba_adp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_tree *ti = NULL;
|
|
|
|
proto_tree *aruba_adp_tree = NULL;
|
|
|
|
guint16 type;
|
2011-02-16 03:01:19 +00:00
|
|
|
const gchar *mac_str;
|
2011-01-16 03:29:03 +00:00
|
|
|
const gchar *switchip;
|
2005-04-01 09:48:34 +00:00
|
|
|
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ADP");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2005-04-01 09:48:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_item(tree, proto_aruba_adp, tvb, 0, 0, FALSE);
|
|
|
|
aruba_adp_tree = proto_item_add_subtree(ti, ett_aruba_adp);
|
|
|
|
|
|
|
|
proto_tree_add_item(aruba_adp_tree, hf_adp_version, tvb, 0, 2, FALSE);
|
|
|
|
}
|
|
|
|
type = tvb_get_ntohs(tvb, 2);
|
|
|
|
|
|
|
|
if (tree) {
|
2011-01-16 03:29:03 +00:00
|
|
|
proto_tree_add_item(aruba_adp_tree, hf_adp_type, tvb, 2, 2, FALSE);
|
2005-04-01 09:48:34 +00:00
|
|
|
|
|
|
|
proto_tree_add_item(aruba_adp_tree, hf_adp_id, tvb, 4, 2, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(type){
|
|
|
|
case ADP_REQUEST:
|
|
|
|
|
|
|
|
proto_tree_add_item(aruba_adp_tree, hf_adp_mac, tvb, 6, 6, FALSE);
|
2011-02-16 03:01:19 +00:00
|
|
|
mac_str = tvb_ether_to_str(tvb, 6);
|
2005-04-01 09:48:34 +00:00
|
|
|
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
2011-02-16 03:01:19 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "ADP Request Src MAC: %s", mac_str);
|
2005-04-01 09:48:34 +00:00
|
|
|
|
2011-02-16 03:01:19 +00:00
|
|
|
proto_item_append_text(ti, ", Request Src MAC: %s", mac_str);
|
2005-04-01 09:48:34 +00:00
|
|
|
break;
|
2011-01-16 03:29:03 +00:00
|
|
|
|
2005-04-01 09:48:34 +00:00
|
|
|
case ADP_RESPONSE:
|
2011-01-16 03:29:03 +00:00
|
|
|
|
2005-04-01 09:48:34 +00:00
|
|
|
proto_tree_add_item(aruba_adp_tree, hf_adp_switchip, tvb, 6, 4, FALSE);
|
2011-01-16 03:29:03 +00:00
|
|
|
switchip = tvb_ip_to_str(tvb, 6);
|
|
|
|
|
2005-04-01 09:48:34 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
2011-01-16 03:29:03 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "ADP Response Switch IP: %s", switchip);
|
|
|
|
|
|
|
|
proto_item_append_text(ti, ", Response Switch IP: %s", switchip);
|
2005-04-01 09:48:34 +00:00
|
|
|
break;
|
2011-01-16 03:29:03 +00:00
|
|
|
|
2005-04-01 09:48:34 +00:00
|
|
|
default:
|
|
|
|
break;
|
2011-01-16 03:29:03 +00:00
|
|
|
|
2005-04-01 09:48:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_aruba_adp(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_adp_version,
|
|
|
|
{ "Version", "adp.version", FT_UINT16, BASE_DEC, NULL,0x0,
|
|
|
|
"ADP version", HFILL}},
|
|
|
|
|
|
|
|
{ &hf_adp_type,
|
|
|
|
{ "Type", "adp.type", FT_UINT16, BASE_DEC, VALS(adp_type_val), 0x0,
|
|
|
|
"ADP type", HFILL}},
|
|
|
|
|
|
|
|
{ &hf_adp_id,
|
|
|
|
{ "Transaction ID", "adp.id", FT_UINT16, BASE_DEC, NULL, 0x0,
|
|
|
|
"ADP transaction ID", HFILL}},
|
|
|
|
|
|
|
|
{ &hf_adp_mac,
|
|
|
|
{ "MAC address", "adp.mac", FT_ETHER, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2005-04-01 09:48:34 +00:00
|
|
|
|
|
|
|
{ &hf_adp_switchip,
|
|
|
|
{ "Switch IP", "adp.switch", FT_IPv4, BASE_NONE, NULL, 0x0,
|
|
|
|
"Switch IP address", HFILL}},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_aruba_adp,
|
|
|
|
};
|
|
|
|
|
2008-12-15 12:40:28 +00:00
|
|
|
proto_aruba_adp = proto_register_protocol("Aruba Discovery Protocol",
|
2005-04-01 09:48:34 +00:00
|
|
|
"ADP", "adp");
|
|
|
|
proto_register_field_array(proto_aruba_adp, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_aruba_adp(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t adp_handle;
|
|
|
|
|
|
|
|
adp_handle = create_dissector_handle(dissect_aruba_adp, proto_aruba_adp);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("udp.port", UDP_PORT_ADP, adp_handle);
|
2005-04-01 09:48:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|