2012-05-02 03:11:00 +00:00
|
|
|
/* packet-ieee80211-airopeek.c
|
2015-05-05 22:18:38 +00:00
|
|
|
* Routines for pre-V9 Savvius (WildPackets) AiroPeek header dissection
|
2012-05-02 03:11:00 +00:00
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* 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
|
2012-06-28 23:18:38 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2012-05-02 03:11:00 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2012-05-02 03:11:00 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2013-11-29 20:53:00 +00:00
|
|
|
#include <wiretap/wtap.h>
|
|
|
|
|
2012-05-02 03:11:00 +00:00
|
|
|
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_ieee80211_airopeek(void);
|
|
|
|
void proto_reg_handoff_ieee80211_airopeek(void);
|
|
|
|
|
2015-06-20 22:57:57 +00:00
|
|
|
static dissector_handle_t ieee80211_radio_handle;
|
2012-05-02 03:11:00 +00:00
|
|
|
|
|
|
|
static int proto_airopeek = -1;
|
|
|
|
|
|
|
|
static int hf_data_rate = -1;
|
|
|
|
static int hf_channel = -1;
|
|
|
|
static int hf_signal_strength = -1;
|
|
|
|
|
|
|
|
static gint ett_airopeek = -1;
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_airopeek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_tree *airopeek_tree = NULL;
|
|
|
|
proto_item *ti;
|
|
|
|
guint8 data_rate;
|
|
|
|
guint8 signal_level;
|
|
|
|
tvbuff_t *next_tvb;
|
2015-06-20 22:57:57 +00:00
|
|
|
struct ieee_802_11_phdr phdr;
|
2012-05-02 03:11:00 +00:00
|
|
|
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AiroPeek");
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
|
|
|
|
|
|
|
/* Dissect the header */
|
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_item(tree, proto_airopeek, tvb, 0, 4, ENC_NA);
|
|
|
|
airopeek_tree = proto_item_add_subtree(ti, ett_airopeek);
|
|
|
|
}
|
|
|
|
|
2015-06-20 22:57:57 +00:00
|
|
|
/* We don't have any 802.11 metadata yet. */
|
|
|
|
phdr.fcs_len = 0;
|
|
|
|
phdr.decrypted = FALSE;
|
|
|
|
phdr.datapad = FALSE;
|
Clean up 802.11 radio information handling.
Have a field that holds the PHY type but nothing else. Have
a union with structures holding PHY-type-specific information, as a
bunch of attributes are PHY-specific.
If we have a channel and band, but don't have the frequency, attempt to
calculate the frequency, and add that to the radio information if we
succeed. If we have the frequency, but don't have the channel, attempt
to calculate the channel, and add that to the radio information if we
succeed.
Handle FHSS information, 11a "half/quarter-clocked" and turbo
information, 11g normal vs. Super G, additional 11n and 11ac
information, and the "short preamble" flag for 11b and 11g.
Add a PHY type for 11 legacy DSSS and detect it if possible.
Clean up the AVS dissector - make all fields wlancap. fields (if you
want generic fields, use the wlan_radio. fields).
Set more fields when writing out Commview Wi-Fi files.
Change-Id: I691ac59f5e9e1a23779b56a65124049914b72e69
Reviewed-on: https://code.wireshark.org/review/9146
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-25 19:14:39 +00:00
|
|
|
phdr.phy = PHDR_802_11_PHY_UNKNOWN;
|
2015-06-20 22:57:57 +00:00
|
|
|
phdr.presence_flags =
|
|
|
|
PHDR_802_11_HAS_CHANNEL|
|
|
|
|
PHDR_802_11_HAS_DATA_RATE|
|
|
|
|
PHDR_802_11_HAS_SIGNAL_PERCENT;
|
|
|
|
|
2012-05-02 03:11:00 +00:00
|
|
|
data_rate = tvb_get_guint8(tvb, 0);
|
2015-06-20 22:57:57 +00:00
|
|
|
phdr.data_rate = data_rate;
|
2012-05-02 03:11:00 +00:00
|
|
|
/* Add the radio information to the column information */
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u",
|
|
|
|
data_rate / 2,
|
|
|
|
data_rate & 1 ? 5 : 0);
|
|
|
|
if (tree) {
|
2013-09-30 15:52:24 +00:00
|
|
|
proto_tree_add_uint64_format_value(airopeek_tree, hf_data_rate, tvb, 0, 1,
|
2012-05-02 03:11:00 +00:00
|
|
|
(guint64)data_rate * 500000,
|
2013-09-30 15:52:24 +00:00
|
|
|
"%u.%u Mb/s",
|
2012-05-02 03:11:00 +00:00
|
|
|
data_rate / 2,
|
|
|
|
data_rate & 1 ? 5 : 0);
|
|
|
|
}
|
|
|
|
|
2015-06-20 22:57:57 +00:00
|
|
|
phdr.channel = tvb_get_guint8(tvb, 1);
|
2012-05-02 03:11:00 +00:00
|
|
|
if (tree)
|
2014-12-13 21:26:07 +00:00
|
|
|
proto_tree_add_item(airopeek_tree, hf_channel, tvb, 1, 1, ENC_BIG_ENDIAN);
|
2012-05-02 03:11:00 +00:00
|
|
|
|
|
|
|
signal_level = tvb_get_guint8(tvb, 2);
|
2013-02-15 00:34:05 +00:00
|
|
|
/*
|
|
|
|
* This is signal strength as a percentage of the maximum, i.e.
|
|
|
|
* (RXVECTOR RSSI/RXVECTOR RSSI_Max)*100, or, at least, that's
|
|
|
|
* what I infer it is, given what the WildPackets note "Converting
|
|
|
|
* Signal Strength Percentage to dBm Values" says.
|
|
|
|
*
|
|
|
|
* It also says that the conversion the percentage to a dBm value is
|
|
|
|
* an adapter-dependent process, so, as we don't know what type of
|
|
|
|
* adapter was used to do the capture, we can't do the conversion.
|
|
|
|
*/
|
2015-06-20 22:57:57 +00:00
|
|
|
phdr.signal_percent = signal_level;
|
2013-02-14 22:38:50 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_RSSI, "%u%%", signal_level);
|
2013-09-15 01:48:30 +00:00
|
|
|
|
|
|
|
proto_tree_add_uint_format_value(airopeek_tree, hf_signal_strength, tvb, 2, 1,
|
2012-05-02 03:11:00 +00:00
|
|
|
signal_level,
|
2013-09-15 01:48:30 +00:00
|
|
|
"%u%%",
|
2012-05-02 03:11:00 +00:00
|
|
|
signal_level);
|
|
|
|
|
|
|
|
/* dissect the 802.11 header next */
|
|
|
|
pinfo->current_proto = "IEEE 802.11";
|
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, 4);
|
2015-06-20 22:57:57 +00:00
|
|
|
call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr);
|
2012-05-02 03:11:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void proto_register_ieee80211_airopeek(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{&hf_data_rate,
|
|
|
|
{"Data Rate", "airopeek.data_rate", FT_UINT64, BASE_DEC, NULL, 0,
|
|
|
|
"Data rate (b/s)", HFILL }},
|
|
|
|
|
|
|
|
{&hf_channel,
|
|
|
|
{"Channel", "airopeek.channel", FT_UINT8, BASE_DEC, NULL, 0,
|
|
|
|
"802.11 channel number that this frame was sent/received on", HFILL }},
|
|
|
|
|
|
|
|
{&hf_signal_strength,
|
|
|
|
{"Signal Strength", "airopeek.signal_strength", FT_UINT8, BASE_DEC, NULL, 0,
|
|
|
|
"Signal strength (Percentage)", HFILL }}
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *tree_array[] = {
|
|
|
|
&ett_airopeek
|
|
|
|
};
|
|
|
|
|
|
|
|
proto_airopeek = proto_register_protocol("AiroPeek 802.11 radio information",
|
|
|
|
"AiroPeek",
|
|
|
|
"airopeek");
|
|
|
|
proto_register_field_array(proto_airopeek, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(tree_array, array_length(tree_array));
|
|
|
|
}
|
|
|
|
|
|
|
|
void proto_reg_handoff_ieee80211_airopeek(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t airopeek_handle;
|
|
|
|
|
|
|
|
/* Register handoff to airopeek-header dissectors */
|
|
|
|
airopeek_handle = create_dissector_handle(dissect_airopeek, proto_airopeek);
|
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_AIROPEEK,
|
|
|
|
airopeek_handle);
|
2015-06-20 22:57:57 +00:00
|
|
|
ieee80211_radio_handle = find_dissector("wlan_radio");
|
2012-05-02 03:11:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 2
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=2 tabstop=8 expandtab:
|
|
|
|
* :indentSize=2:tabSize=8:noTabs=true:
|
|
|
|
*/
|