2 * Routines for Aruba ADP header disassembly
4 * Giles Scott < gscott <at> arubanetworks dot com>
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
15 #include <epan/packet.h>
16 #include <epan/addr_resolv.h>
18 #define UDP_PORT_ADP 8200 /* Not IANA registered */
20 #define ADP_RESPONSE 2
22 void proto_register_aruba_adp(void);
23 void proto_reg_handoff_aruba_adp(void);
25 static dissector_handle_t adp_handle
;
27 static int proto_aruba_adp
;
28 static int ett_aruba_adp
;
30 static int hf_adp_version
;
31 static int hf_adp_type
;
33 static int hf_adp_mac
;
34 static int hf_adp_switchip
;
36 static const value_string adp_type_val
[] =
44 dissect_aruba_adp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
46 proto_tree
*ti
= NULL
;
47 proto_tree
*aruba_adp_tree
= NULL
;
53 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "ADP");
54 col_clear(pinfo
->cinfo
, COL_INFO
);
58 ti
= proto_tree_add_item(tree
, proto_aruba_adp
, tvb
, 0, -1, ENC_NA
);
59 aruba_adp_tree
= proto_item_add_subtree(ti
, ett_aruba_adp
);
62 proto_tree_add_item(aruba_adp_tree
, hf_adp_version
, tvb
, 0, 2, ENC_BIG_ENDIAN
);
65 proto_tree_add_item(aruba_adp_tree
, hf_adp_type
, tvb
, 2, 2, ENC_BIG_ENDIAN
);
66 type
= tvb_get_ntohs(tvb
, 2);
68 proto_tree_add_item(aruba_adp_tree
, hf_adp_id
, tvb
, 4, 2, ENC_BIG_ENDIAN
);
73 proto_tree_add_item(aruba_adp_tree
, hf_adp_mac
, tvb
, 6, 6, ENC_NA
);
74 mac_str
= tvb_ether_to_str(pinfo
->pool
, tvb
, 6);
76 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "ADP Request Src MAC: %s", mac_str
);
78 proto_item_append_text(ti
, ", Request Src MAC: %s", mac_str
);
83 proto_tree_add_item(aruba_adp_tree
, hf_adp_switchip
, tvb
, 6, 4, ENC_BIG_ENDIAN
);
84 switchip
= tvb_ip_to_str(pinfo
->pool
, tvb
, 6);
86 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "ADP Response Switch IP: %s", switchip
);
88 proto_item_append_text(ti
, ", Response Switch IP: %s", switchip
);
95 return tvb_captured_length(tvb
);
99 proto_register_aruba_adp(void)
101 static hf_register_info hf
[] = {
103 { "Version", "adp.version", FT_UINT16
, BASE_DEC
, NULL
,0x0,
104 "ADP version", HFILL
}},
107 { "Type", "adp.type", FT_UINT16
, BASE_DEC
, VALS(adp_type_val
), 0x0,
111 { "Transaction ID", "adp.id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
112 "ADP transaction ID", HFILL
}},
115 { "MAC address", "adp.mac", FT_ETHER
, BASE_NONE
, NULL
, 0x0,
119 { "Switch IP", "adp.switch", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
120 "Switch IP address", HFILL
}},
124 static int *ett
[] = {
128 proto_aruba_adp
= proto_register_protocol("Aruba Discovery Protocol",
130 proto_register_field_array(proto_aruba_adp
, hf
, array_length(hf
));
131 proto_register_subtree_array(ett
, array_length(ett
));
133 adp_handle
= register_dissector("adp", dissect_aruba_adp
, proto_aruba_adp
);
138 proto_reg_handoff_aruba_adp(void)
140 dissector_add_uint_with_preference("udp.port", UDP_PORT_ADP
, adp_handle
);
144 * Editor modelines - https://www.wireshark.org/tools/modelines.html
149 * indent-tabs-mode: nil
152 * vi: set shiftwidth=4 tabstop=8 expandtab:
153 * :indentSize=4:tabSize=8:noTabs=true: