diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-05-02 03:11:00 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-05-02 03:11:00 +0000 |
commit | 0275247b9788e74a97414abc74f6e9f12868ee57 (patch) | |
tree | e683bcda97ba1f4c5b23656635d578a9d897f51a /epan/dissectors | |
parent | 8be799ecafab97966bb85f83ed105fe0e389c8dc (diff) |
Use WTAP_ENCAP_IEEE_802_11_xxx for all the "802.11 plus radio header"
encapsulations.
For pre-V9 AiroPeek captures, leave the radio information in the packet
data, just as we do with the Prism, AVS, radiotap, and NetMon headers.
Add a dissector for it.
svn path=/trunk/; revision=42379
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/Makefile.common | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee80211-airopeek.c | 141 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee80211-prism.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee80211-wlancap.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-netmon-802_11.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-radiotap.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-tzsp.c | 8 |
7 files changed, 150 insertions, 8 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 0a88228afa..29603874ed 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -613,6 +613,7 @@ DISSECTOR_SRC = \ packet-ieee1722.c \ packet-ieee17221.c \ packet-ieee80211.c \ + packet-ieee80211-airopeek.c \ packet-ieee80211-prism.c \ packet-ieee80211-radio.c \ packet-ieee80211-wlancap.c \ diff --git a/epan/dissectors/packet-ieee80211-airopeek.c b/epan/dissectors/packet-ieee80211-airopeek.c new file mode 100644 index 0000000000..f9e0179712 --- /dev/null +++ b/epan/dissectors/packet-ieee80211-airopeek.c @@ -0,0 +1,141 @@ +/* packet-ieee80211-airopeek.c + * Routines for pre-V9 WildPackets AiroPeek header dissection + * + * $Id$ + * + * 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 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <epan/packet.h> +#include "packet-ieee80211.h" + +static dissector_handle_t ieee80211_handle; + +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; + + 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); + } + + data_rate = tvb_get_guint8(tvb, 0); + /* 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) { + proto_tree_add_uint64_format(airopeek_tree, hf_data_rate, tvb, 0, 1, + (guint64)data_rate * 500000, + "Data Rate: %u.%u Mb/s", + data_rate / 2, + data_rate & 1 ? 5 : 0); + } + + if (tree) + proto_tree_add_item(airopeek_tree, hf_channel, tvb, 1, 1, ENC_NA); + + signal_level = tvb_get_guint8(tvb, 2); + /* XX - this is a percentage, not a dBm or normalized or raw RSSI */ + col_add_fstr(pinfo->cinfo, COL_RSSI, "%u", signal_level); + if (tree) { + proto_tree_add_uint_format(airopeek_tree, hf_signal_strength, tvb, 2, 1, + signal_level, + "Signal Strength: %u%%", + signal_level); + } + + /* dissect the 802.11 header next */ + pinfo->current_proto = "IEEE 802.11"; + next_tvb = tvb_new_subset_remaining(tvb, 4); + call_dissector(ieee80211_handle, next_tvb, pinfo, tree); +} + +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); + ieee80211_handle = find_dissector("wlan"); +} + +/* + * 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: + */ diff --git a/epan/dissectors/packet-ieee80211-prism.c b/epan/dissectors/packet-ieee80211-prism.c index 810d073e50..fbc1168445 100644 --- a/epan/dissectors/packet-ieee80211-prism.c +++ b/epan/dissectors/packet-ieee80211-prism.c @@ -460,7 +460,7 @@ void proto_reg_handoff_ieee80211_prism(void) dissector_handle_t prism_handle; prism_handle = create_dissector_handle(dissect_prism, proto_prism); - dissector_add_uint("wtap_encap", WTAP_ENCAP_PRISM_HEADER, prism_handle); + dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_PRISM, prism_handle); ieee80211_handle = find_dissector("wlan"); wlancap_handle = find_dissector("wlancap"); } diff --git a/epan/dissectors/packet-ieee80211-wlancap.c b/epan/dissectors/packet-ieee80211-wlancap.c index 9c8e16613c..4aaf3faaea 100644 --- a/epan/dissectors/packet-ieee80211-wlancap.c +++ b/epan/dissectors/packet-ieee80211-wlancap.c @@ -654,7 +654,7 @@ void proto_register_ieee80211_wlancap(void) register_dissector("wlancap", dissect_wlancap, proto_wlancap); wlancap_handle = create_dissector_handle(dissect_wlancap, proto_wlancap); - dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_WLAN_AVS, + dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_AVS, wlancap_handle); proto_register_subtree_array(tree_array, array_length(tree_array)); } diff --git a/epan/dissectors/packet-netmon-802_11.c b/epan/dissectors/packet-netmon-802_11.c index dc47c75b7d..9b2d91ba23 100644 --- a/epan/dissectors/packet-netmon-802_11.c +++ b/epan/dissectors/packet-netmon-802_11.c @@ -239,5 +239,5 @@ proto_reg_handoff_netmon_802_11(void) ieee80211_handle = find_dissector("wlan"); netmon_802_11_handle = new_create_dissector_handle(dissect_netmon_802_11, proto_netmon_802_11); - dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE802_11_NETMON_RADIO, netmon_802_11_handle); + dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_NETMON, netmon_802_11_handle); } diff --git a/epan/dissectors/packet-radiotap.c b/epan/dissectors/packet-radiotap.c index 041a647a1a..f646bcdd64 100644 --- a/epan/dissectors/packet-radiotap.c +++ b/epan/dissectors/packet-radiotap.c @@ -2119,7 +2119,7 @@ void proto_reg_handoff_radiotap(void) radiotap_handle = find_dissector("radiotap"); - dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_WLAN_RADIOTAP, + dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_RADIOTAP, radiotap_handle); } diff --git a/epan/dissectors/packet-tzsp.c b/epan/dissectors/packet-tzsp.c index b5781fb926..7b73f79e34 100644 --- a/epan/dissectors/packet-tzsp.c +++ b/epan/dissectors/packet-tzsp.c @@ -87,8 +87,8 @@ static int hf_sensormac = -1; #define TZSP_ENCAP_ETHERNET 1 #define TZSP_ENCAP_IEEE_802_11 18 -#define TZSP_ENCAP_PRISM_HEADER 119 -#define TZSP_ENCAP_WLAN_AVS 127 +#define TZSP_ENCAP_IEEE_802_11_PRISM 119 +#define TZSP_ENCAP_IEEE_802_11_AVS 127 /* ************************************************************************* */ /* Generic header options */ @@ -254,8 +254,8 @@ struct encap_map { static const struct encap_map map_table[] = { { TZSP_ENCAP_ETHERNET, WTAP_ENCAP_ETHERNET }, - { TZSP_ENCAP_PRISM_HEADER, WTAP_ENCAP_PRISM_HEADER }, - { TZSP_ENCAP_WLAN_AVS, WTAP_ENCAP_IEEE_802_11_WLAN_AVS }, + { TZSP_ENCAP_IEEE_802_11_PRISM, WTAP_ENCAP_IEEE_802_11_PRISM }, + { TZSP_ENCAP_IEEE_802_11_AVS, WTAP_ENCAP_IEEE_802_11_AVS }, { TZSP_ENCAP_IEEE_802_11, WTAP_ENCAP_IEEE_802_11 }, { 0, -1 } }; |