diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-07-02 19:51:22 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-07-03 02:51:51 +0000 |
commit | 363511cb670a42e449bb4e208775715748b81879 (patch) | |
tree | f41db4124f1c2a75c613468e792996546d610f86 /ui/gtk | |
parent | df5a315048e9b318f7862901c1bd40fa2c08dad5 (diff) |
Move some frame control field #defines to a header and use them elsewhere.
Move a bunch of #defines that involve the frame control field to
packet-ieee80211.h and have the WLAN statistics tap use them rather than
hardcoded numbers.
Change-Id: I893cc50e546af67c910755357cefd86c39a1c783
Reviewed-on: https://code.wireshark.org/review/9476
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/wlan_stat_dlg.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/ui/gtk/wlan_stat_dlg.c b/ui/gtk/wlan_stat_dlg.c index 278b58823e..8b92c3e8fe 100644 --- a/ui/gtk/wlan_stat_dlg.c +++ b/ui/gtk/wlan_stat_dlg.c @@ -318,29 +318,29 @@ wlanstat_packet_details (wlan_ep_t *te, guint32 type, const address *addr, gbool wlan_details_ep_t *d_te = get_details_ep (te, addr); switch (type) { - case 0x04: + case MGT_PROBE_REQ: d_te->probe_req++; break; - case 0x05: + case MGT_PROBE_RESP: d_te->probe_rsp++; break; - case 0x08: + case MGT_BEACON: /* No counting for beacons */ break; - case 0x0B: + case MGT_AUTHENTICATION: d_te->auth++; break; - case 0x0C: + case MGT_DEAUTHENTICATION: d_te->deauth++; break; - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x28: - case 0x29: - case 0x2A: - case 0x2B: + case DATA: + case DATA_CF_ACK: + case DATA_CF_POLL: + case DATA_CF_ACK_POLL: + case DATA_QOS_DATA: + case DATA_QOS_DATA_CF_ACK: + case DATA_QOS_DATA_CF_POLL: + case DATA_QOS_DATA_CF_ACK_POLL: if (src) { d_te->data_sent++; } else { @@ -352,7 +352,7 @@ wlanstat_packet_details (wlan_ep_t *te, guint32 type, const address *addr, gbool break; } - if (type != 0x08) { + if (type != MGT_BEACON) { /* Do not count beacons in details */ d_te->number_of_packets++; } @@ -397,12 +397,12 @@ wlanstat_packet (void *phs, packet_info *pinfo, epan_dissect_t *edt _U_, const v te->is_broadcast = is_broadcast(&si->bssid); } else { for (tmp = hs->ep_list; tmp; tmp = tmp->next) { - if ((((si->type == 0x04) && ( + if ((((si->type == MGT_PROBE_REQ) && ( ((tmp->stats.ssid_len == 0) && (si->stats.ssid_len == 0) && tmp->is_broadcast) || ((si->stats.ssid_len != 0) && (ssid_equal(&tmp->stats, &si->stats))) ))) || - ((si->type != 0x04) && !CMP_ADDRESS(&tmp->bssid, &si->bssid))) { + ((si->type != MGT_PROBE_REQ) && !CMP_ADDRESS(&tmp->bssid, &si->bssid))) { te = tmp; break; } @@ -415,7 +415,7 @@ wlanstat_packet (void *phs, packet_info *pinfo, epan_dissect_t *edt _U_, const v hs->ep_list = te; } - if (!te->probe_req_searched && (si->type != 0x04) && (te->type[0x04] == 0) && + if (!te->probe_req_searched && (si->type != MGT_PROBE_REQ) && (te->type[MGT_PROBE_REQ] == 0) && (si->stats.ssid_len > 1 || si->stats.ssid[0] != 0)) { /* * We have found a matching entry without Probe Requests. @@ -434,18 +434,18 @@ wlanstat_packet (void *phs, packet_info *pinfo, epan_dissect_t *edt _U_, const v * Found a matching entry. Merge with the previous * found entry and remove from list. */ - te->type[0x04] += tmp->type[0x04]; + te->type[MGT_PROBE_REQ] += tmp->type[MGT_PROBE_REQ]; te->number_of_packets += tmp->number_of_packets; if (tmp->details && tmp->details->next) { /* Adjust received probe requests */ wlan_details_ep_t *d_te; d_te = get_details_ep (te, &tmp->details->addr); - d_te->probe_req += tmp->type[0x04]; - d_te->number_of_packets += tmp->type[0x04]; + d_te->probe_req += tmp->type[MGT_PROBE_REQ]; + d_te->number_of_packets += tmp->type[MGT_PROBE_REQ]; d_te = get_details_ep (te, &tmp->details->next->addr); - d_te->probe_req += tmp->type[0x04]; - d_te->number_of_packets += tmp->type[0x04]; + d_te->probe_req += tmp->type[MGT_PROBE_REQ]; + d_te->number_of_packets += tmp->type[MGT_PROBE_REQ]; } if (prev) { prev->next = tmp->next; @@ -504,8 +504,8 @@ wlanstat_draw_details(wlanstat_t *hs, wlan_ep_t *wlan_ep, gboolean clear) broadcast_flag = is_broadcast(&tmp->addr); basestation_flag = !broadcast_flag && !CMP_ADDRESS(&tmp->addr, &wlan_ep->bssid); - if ((wlan_ep->number_of_packets - wlan_ep->type[0x08]) > 0) { - f = (float)(((float)tmp->number_of_packets * 100.0) / (wlan_ep->number_of_packets - wlan_ep->type[0x08])); + if ((wlan_ep->number_of_packets - wlan_ep->type[MGT_BEACON]) > 0) { + f = (float)(((float)tmp->number_of_packets * 100.0) / (wlan_ep->number_of_packets - wlan_ep->type[MGT_BEACON])); } else { f = 0.0f; } @@ -569,10 +569,10 @@ wlanstat_draw(void *phs) continue; } - data = tmp->type[0x20] + tmp->type[0x21] + tmp->type[0x22] + tmp->type[0x23] + - tmp->type[0x28] + tmp->type[0x29] + tmp->type[0x2A] + tmp->type[0x2B]; - other = tmp->number_of_packets - data - tmp->type[0x08] - tmp->type[0x04] - - tmp->type[0x05] - tmp->type[0x0B] - tmp->type[0x0C]; + data = tmp->type[DATA] + tmp->type[DATA_CF_ACK] + tmp->type[DATA_CF_POLL] + tmp->type[DATA_CF_ACK_POLL] + + tmp->type[DATA_QOS_DATA] + tmp->type[DATA_QOS_DATA_CF_ACK] + tmp->type[DATA_QOS_DATA_CF_POLL] + tmp->type[DATA_QOS_DATA_CF_ACK_POLL]; + other = tmp->number_of_packets - data - tmp->type[MGT_BEACON] - tmp->type[MGT_PROBE_REQ] - + tmp->type[MGT_PROBE_RESP] - tmp->type[MGT_AUTHENTICATION] - tmp->type[MGT_DEAUTHENTICATION]; f = (float)(((float)tmp->number_of_packets * 100.0) / hs->number_of_packets); bssid = (char*)get_conversation_address(NULL, &tmp->bssid, hs->resolve_names); @@ -599,12 +599,12 @@ wlanstat_draw(void *phs) CHANNEL_COLUMN, channel, SSID_COLUMN, ssid, PERCENT_COLUMN, percent, - BEACONS_COLUMN, tmp->type[0x08], + BEACONS_COLUMN, tmp->type[MGT_BEACON], DATA_COLUMN, data, - PROBE_REQ_COLUMN, tmp->type[0x04], - PROBE_RESP_COLUMN, tmp->type[0x05], - AUTH_COLUMN, tmp->type[0x0B], - DEAUTH_COLUMN, tmp->type[0x0C], + PROBE_REQ_COLUMN, tmp->type[MGT_PROBE_REQ], + PROBE_RESP_COLUMN, tmp->type[MGT_PROBE_RESP], + AUTH_COLUMN, tmp->type[MGT_AUTHENTICATION], + DEAUTH_COLUMN, tmp->type[MGT_DEAUTHENTICATION], OTHER_COLUMN, other, PROTECTION_COLUMN, tmp->stats.protection, PERCENT_VALUE_COLUMN, f, |