2 * Routines for the disassembly of Aruba encapsulated remote mirroring frames
3 * (Adapted from packet-hp-erm.c and packet-cisco-erspan.c)
5 * Copyright 2010 Alexis La Goutte <alexis.lagoutte at gmail dot com>
7 * ERM Radio-Format added by Hadriel Kaplan
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 * Use the Header of Record (Packet) Header
32 * typedef struct pcaprec_hdr_s {
33 * guint32 ts_sec; timestamp seconds
34 * guint32 ts_usec; timestamp microseconds
35 * guint32 incl_len; number of octets of packet saved in file
36 * guint32 orig_len; actual length of packet
39 * Following with 802.11 header
44 * The ERM Radio-Format has the above header, plus more, like this:
46 * struct radio_pcap_hdr {
48 * __u32 capture_length;
50 * __u16 rate_per_half_mhz;
52 * __u8 signal_percent;
53 * } __attribute__ ((packed));
55 * Following with 802.11 header
61 #include <epan/packet.h>
62 #include <epan/prefs.h>
64 #define PROTO_SHORT_NAME "ARUBA_ERM"
65 #define PROTO_LONG_NAME "ARUBA encapsulated remote mirroring"
66 #define PROTO_RADIO_SHORT_NAME "ARUBA_ERM_RADIO_FORMAT"
67 #define PROTO_RADIO_LONG_NAME "ARUBA encapsulated remote mirroring - radio format"
69 void proto_register_aruba_erm(void);
70 void proto_reg_handoff_aruba_erm(void);
71 void proto_reg_handoff_aruba_erm_radio(void);
73 static range_t *global_aruba_erm_port_range;
74 static range_t *global_aruba_erm_radio_port_range;
76 static int proto_aruba_erm = -1;
78 static int hf_aruba_erm_time = -1;
79 static int hf_aruba_erm_incl_len = -1;
80 static int hf_aruba_erm_orig_len = -1;
81 static int hf_aruba_erm_data_rate = -1;
82 static int hf_aruba_erm_channel = -1;
83 static int hf_aruba_erm_signal_strength = -1;
85 static gint ett_aruba_erm = -1;
87 static dissector_handle_t aruba_erm_handle;
88 static dissector_handle_t aruba_erm_radio_handle;
89 static dissector_handle_t ieee80211_handle;
92 dissect_aruba_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_radio)
95 proto_tree *aruba_erm_tree;
100 guint8 signal_strength;
103 ti = proto_tree_add_item(tree, proto_aruba_erm, tvb, 0, -1, ENC_NA);
104 aruba_erm_tree = proto_item_add_subtree(ti, ett_aruba_erm);
106 ts.secs = tvb_get_ntohl(tvb, 0);
107 ts.nsecs = tvb_get_ntohl(tvb,4)*1000;
108 proto_tree_add_time(aruba_erm_tree, hf_aruba_erm_time, tvb, 0, 8,&ts);
109 proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_incl_len, tvb, 8, 4, ENC_BIG_ENDIAN);
110 proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_orig_len, tvb, 12, 4, ENC_BIG_ENDIAN);
113 data_rate = tvb_get_ntohs(tvb, 16);
114 proto_tree_add_uint_format(aruba_erm_tree, hf_aruba_erm_data_rate, tvb, 16, 2,
116 "Data Rate: %u.%u Mb/s",
118 data_rate & 1 ? 5 : 0);
120 proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_channel, tvb, 18, 1, ENC_NA);
122 signal_strength = tvb_get_guint8(tvb, 19);
123 proto_tree_add_uint_format(aruba_erm_tree, hf_aruba_erm_signal_strength, tvb, 19, 1,
124 (guint32)signal_strength,
125 "Signal Strength: %u%%",
131 eth_tvb = tvb_new_subset_remaining(tvb, offset);
132 call_dissector(ieee80211_handle, eth_tvb, pinfo, tree);
136 dissect_aruba_erm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
138 col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME);
139 col_set_str(pinfo->cinfo, COL_INFO, PROTO_SHORT_NAME ":");
141 dissect_aruba_common(tvb, pinfo, tree, FALSE);
145 dissect_aruba_erm_radio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
147 col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_RADIO_SHORT_NAME);
148 col_set_str(pinfo->cinfo, COL_INFO, PROTO_RADIO_SHORT_NAME ":");
150 dissect_aruba_common(tvb, pinfo, tree, TRUE);
154 proto_register_aruba_erm(void)
157 static hf_register_info hf[] = {
159 { &hf_aruba_erm_time,
160 { "Packet Capture Timestamp", "aruba_erm.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL,
161 0x00, NULL, HFILL }},
162 { &hf_aruba_erm_incl_len,
163 { "Packet Captured Length", "aruba_erm.incl_len", FT_UINT32, BASE_DEC, NULL,
164 0x00, NULL, HFILL }},
165 { &hf_aruba_erm_orig_len,
166 { "Packet Length", "aruba_erm.orig_len", FT_UINT32, BASE_DEC, NULL,
167 0x00, NULL, HFILL }},
168 { &hf_aruba_erm_data_rate,
169 { "Data Rate", "aruba_erm.data_rate", FT_UINT16, BASE_DEC, NULL,
170 0x00, "Data rate (1/2 Mb/s)", HFILL }},
171 { &hf_aruba_erm_channel,
172 { "Channel", "aruba_erm.channel", FT_UINT8, BASE_DEC, NULL,
173 0x00, "802.11 channel number that this frame was sent/received on", HFILL }},
174 { &hf_aruba_erm_signal_strength,
175 { "Signal Strength", "aruba_erm.signal_strength", FT_UINT8, BASE_DEC, NULL,
176 0x00, "Signal strength (Percentage)", HFILL }},
179 /* both formats share the same tree */
180 static gint *ett[] = {
184 module_t *aruba_erm_module;
186 proto_aruba_erm = proto_register_protocol(PROTO_LONG_NAME, PROTO_SHORT_NAME, "aruba_erm");
188 range_convert_str (&global_aruba_erm_port_range, "0", MAX_UDP_PORT);
189 range_convert_str (&global_aruba_erm_radio_port_range, "0", MAX_UDP_PORT);
191 aruba_erm_module = prefs_register_protocol(proto_aruba_erm, proto_reg_handoff_aruba_erm);
193 prefs_register_range_preference(aruba_erm_module, "udp.ports", "ARUBA_ERM UDP Port numbers",
194 "Set the UDP port numbers (typically the range 5555 to 5560) used for ARUBA"
195 " encapsulated remote mirroring frames;\n"
196 "0 (default) means that the ARUBA_ERM dissector is not active\n",
197 &global_aruba_erm_port_range, MAX_UDP_PORT);
199 prefs_register_range_preference(aruba_erm_module, "radio.udp.ports", "ARUBA_ERM_RADIO_FORMAT UDP Port numbers",
200 "Set the UDP port numbers (typically the range 5555 to 5560) used for ARUBA"
201 " encapsulated remote mirroring frames with radio format;\n"
202 "0 (default) means that the ARUBA_ERM_RADIO_FORMAT dissector is not active\n",
203 &global_aruba_erm_radio_port_range, MAX_UDP_PORT);
205 proto_register_field_array(proto_aruba_erm, hf, array_length(hf));
206 proto_register_subtree_array(ett, array_length(ett));
210 proto_reg_handoff_aruba_erm(void)
212 static range_t *aruba_erm_port_range;
213 static range_t *aruba_erm_radio_port_range;
214 static gboolean initialized = FALSE;
217 ieee80211_handle = find_dissector("wlan");
218 aruba_erm_handle = create_dissector_handle(dissect_aruba_erm, proto_aruba_erm);
219 aruba_erm_radio_handle = create_dissector_handle(dissect_aruba_erm_radio, proto_aruba_erm);
222 dissector_delete_uint_range("udp.port", aruba_erm_port_range, aruba_erm_handle);
223 dissector_delete_uint_range("udp.port", aruba_erm_radio_port_range, aruba_erm_radio_handle);
224 g_free(aruba_erm_port_range);
225 g_free(aruba_erm_radio_port_range);
228 aruba_erm_port_range = range_copy(global_aruba_erm_port_range);
229 aruba_erm_radio_port_range = range_copy(global_aruba_erm_radio_port_range);
231 dissector_add_uint_range("udp.port", aruba_erm_port_range, aruba_erm_handle);
232 dissector_add_uint_range("udp.port", aruba_erm_radio_port_range, aruba_erm_radio_handle);
236 * Editor modelines - http://www.wireshark.org/tools/modelines.html
241 * indent-tabs-mode: nil
244 * vi: set shiftwidth=4 tabstop=8 expandtab:
245 * :indentSize=4:tabSize=8:noTabs=true: