aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-08-18 11:46:12 -0700
committerGerald Combs <gerald@wireshark.org>2015-08-20 23:12:37 +0000
commit2ed3d91b45332a2cbb4114b61f18c80fb28a6840 (patch)
tree1c37bec81ce931d54d8e0a3f59812dcdfe9c505f /epan
parent0f9bbbc6f7146747841760102a74efb96161ad99 (diff)
Add the WLAN statistics dialog.
Instead of splitting the stats into two lists as with the GTK+ UI, add everything to an expandable tree. This allows viewing nodes on more than one network. Rename the top-level Bluetooth menu item to Wireless and put the WLAN stats dialog there. The Qt UI matches SSIDs (WlanNetworkTreeWidgetItem::isMatch) a bit differently than the GTK+ UI. Try to make the logic as plain as possible since we'll likely have to update it in the future. The addition of a custom BSSID address types means that we can't assume that everything is AT_ETHER. Add routines for checking for broadcast BSSIDs and comparing only the data portions of addresses. Move PercentBarDelegate into its own module. Use it in WlanStatisticsDialog. Change-Id: Ie4214eb00671a890871380c4a07213ebfb7585c6 Reviewed-on: https://code.wireshark.org/review/10171 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan')
-rw-r--r--epan/address.h19
-rw-r--r--epan/dissectors/packet-ieee80211.c16
-rw-r--r--epan/dissectors/packet-ieee80211.h17
-rw-r--r--epan/wslua/taps2
4 files changed, 46 insertions, 8 deletions
diff --git a/epan/address.h b/epan/address.h
index c48cc7020d..5855d22641 100644
--- a/epan/address.h
+++ b/epan/address.h
@@ -143,6 +143,25 @@ addresses_equal(const address *addr1, const address *addr2) {
}
#define ADDRESSES_EQUAL(addr1, addr2) addresses_equal((addr1), (addr2))
+/** Check the data of two addresses for equality.
+ *
+ * Given two addresses, return "true" if they have the same length and,
+ * their data is equal, "false" otherwise.
+ * The address types are ignored. This can be used to compare custom
+ * address types defined with address_type_dissector_register.
+ *
+ * @param addr1 [in] The first address to compare.
+ * @param addr2 [in] The second address to compare.
+ * @return TRUE if the adresses are equal, FALSE otherwise.
+ */
+static inline gboolean
+addresses_data_equal(const address *addr1, const address *addr2) {
+ if ( addr1->len == addr2->len
+ && memcmp(addr1->data, addr2->data, addr1->len) == 0
+ ) return TRUE;
+ return FALSE;
+}
+
/** Copy an address, allocating a new buffer for the address data.
*
* @param to [in,out] The destination address.
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index 53e782109a..13f36e620e 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -5177,6 +5177,11 @@ static const enum_val_t wlan_ignore_wep_options[] = {
static int wlan_address_type = -1;
static int wlan_bssid_address_type = -1;
+static address bssid_broadcast;
+gboolean is_broadcast_bssid(const address *bssid) {
+ return addresses_equal(&bssid_broadcast, bssid);
+}
+
static dissector_handle_t ieee80211_handle;
static dissector_handle_t llc_handle;
static dissector_handle_t ipx_handle;
@@ -5294,7 +5299,7 @@ static int
wlan_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pct;
- const wlan_hdr *whdr=(const wlan_hdr *)vip;
+ const wlan_hdr_t *whdr=(const wlan_hdr_t *)vip;
add_conversation_table_data(hash, &whdr->src, &whdr->dst, 0, 0, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->fd->abs_ts, &wlan_ct_dissector_info, PT_NONE);
@@ -5315,7 +5320,7 @@ static int
wlan_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
- const wlan_hdr *whdr=(const wlan_hdr *)vip;
+ const wlan_hdr_t *whdr=(const wlan_hdr_t *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
@@ -16558,14 +16563,14 @@ dissect_ieee80211_common (tvbuff_t *tvb, packet_info *pinfo,
gint meshctl_len = 0;
guint8 mesh_flags;
guint16 meshoff = 0;
- static wlan_hdr whdrs[4];
+ static wlan_hdr_t whdrs[4];
gboolean retransmitted;
gboolean isDMG = (tree == NULL) ? FALSE : proto_tree_traverse_post_order(proto_tree_get_root(tree), is_80211ad, NULL);
volatile encap_t encap_type;
proto_tree *volatile hdr_tree = NULL;
tvbuff_t *volatile next_tvb = NULL;
- wlan_hdr *volatile whdr;
+ wlan_hdr_t *volatile whdr;
AIRPDCAP_KEY_ITEM used_key;
@@ -26923,6 +26928,8 @@ proto_register_ieee80211 (void)
module_t *wlan_module;
+ const unsigned char bssid_broadcast_data[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
memset(&wlan_stats, 0, sizeof wlan_stats);
proto_aggregate = proto_register_protocol("IEEE 802.11 wireless LAN aggregate frame",
@@ -26963,6 +26970,7 @@ proto_register_ieee80211 (void)
ether_len, ether_name_resolution_str, ether_name_resolution_len);
wlan_bssid_address_type = address_type_dissector_register("AT_ETHER_BSSID", "WLAN BSSID Address", ether_to_str, ether_str_len, wlan_bssid_col_filter_str,
ether_len, ether_name_resolution_str, ether_name_resolution_len);
+ set_address(&bssid_broadcast, wlan_bssid_address_type, 6, bssid_broadcast_data);
/* Register configuration options */
wlan_module = prefs_register_protocol(proto_wlan, init_wepkeys);
diff --git a/epan/dissectors/packet-ieee80211.h b/epan/dissectors/packet-ieee80211.h
index df63bf2e77..93fa7fcf89 100644
--- a/epan/dissectors/packet-ieee80211.h
+++ b/epan/dissectors/packet-ieee80211.h
@@ -27,6 +27,10 @@
#include "ws_symbol_export.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
WS_DLL_PUBLIC
void capture_ieee80211 (const guchar *, int, int, packet_counts *);
void capture_ieee80211_datapad (const guchar *, int, int, packet_counts *);
@@ -65,6 +69,13 @@ WS_DLL_PUBLIC const float ieee80211_float_htrates[MAX_MCS_INDEX+1][2][2];
WS_DLL_PUBLIC value_string_ext ieee80211_supported_rates_vals_ext;
+WS_DLL_PUBLIC
+gboolean is_broadcast_bssid(const address *bssid);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
/*
* Extract the protocol version from the frame control field
*/
@@ -225,12 +236,12 @@ WS_DLL_PUBLIC value_string_ext ieee80211_supported_rates_vals_ext;
*/
#define EXTENSION_DMG_BEACON 0x30 /* Extension DMG beacon */
-struct _wlan_stats {
+typedef struct _wlan_stats {
guint8 channel;
guint8 ssid_len;
guchar ssid[MAX_SSID_LEN];
gchar protection[MAX_PROTECT_LEN];
-};
+} wlan_stats_t;
typedef struct _wlan_hdr {
address bssid;
@@ -238,7 +249,7 @@ typedef struct _wlan_hdr {
address dst;
guint16 type;
struct _wlan_stats stats;
-} wlan_hdr;
+} wlan_hdr_t;
#define WLANCAP_MAGIC_COOKIE_BASE 0x80211000
#define WLANCAP_MAGIC_COOKIE_V1 0x80211001
diff --git a/epan/wslua/taps b/epan/wslua/taps
index 56f4242a5b..eee8176bcf 100644
--- a/epan/wslua/taps
+++ b/epan/wslua/taps
@@ -76,5 +76,5 @@ smb2 ../dissectors/packet-smb2.h smb2_info_t
tcp ../dissectors/packet-tcp.h tcp_info_t
#teredo ../dissectors/packet-teredo.h teredo_info_t
#tr ../dissectors/packet-tr.h tr_info_t
-wlan ../dissectors/packet-ieee80211.h wlan_hdr
+wlan ../dissectors/packet-ieee80211.h wlan_hdr_t
#wsp ../dissectors/packet-wsp.h wsp_info_t