aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-aruba-erm.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-06-20 15:57:57 -0700
committerGuy Harris <guy@alum.mit.edu>2015-06-20 23:02:21 +0000
commit2895d58dc38321a72c82e1bf77d165ef4acbc73a (patch)
tree1091e87a52bf3c266edeb282f7baa7deea13fbd6 /epan/dissectors/packet-aruba-erm.c
parent77ed0387c6e03d9667a56ab5effca755bac78df2 (diff)
Call the "802.11 radio information" dissector for radio headers.
Have dissectors of various forms of radio information headers in the packets fill in a struct ieee_802_11_phdr with radio information as appropriate, and call the "802.11 radio information" dissector rather than the raw 802.11 dissector. This means that the radio information can be found in a protocol-independent and encapsulation-independent form when you're looking at the packet; that information can be presented in a form somewhat easier to read than the raw metadata header format. It also enables having a single "radio information" tap that allows statistics to handle all different sorts of radio information encapsulation. In addition, it lets us clean up some of the arguments passed to the common 802.11 dissector routine, by having it pull that information from the struct ieee_802_11_phdr. Ensure that the right structure gets passed to that routine, and that all the appropriate parts of that structure are filled in. Rename the 802.11 radio protocol to "wlan_radio", rather than just "radio", as it's 802.11-specific. Give all its fields "wlan_radio." names rather than "wlan." names. Change-Id: I78d79afece0ce0cf5fc17293c1e29596413b31c8 Reviewed-on: https://code.wireshark.org/review/8992 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-aruba-erm.c')
-rw-r--r--epan/dissectors/packet-aruba-erm.c75
1 files changed, 41 insertions, 34 deletions
diff --git a/epan/dissectors/packet-aruba-erm.c b/epan/dissectors/packet-aruba-erm.c
index 931c031d69..fffb839b16 100644
--- a/epan/dissectors/packet-aruba-erm.c
+++ b/epan/dissectors/packet-aruba-erm.c
@@ -89,6 +89,8 @@
#include "config.h"
+#include <wiretap/wtap.h>
+
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/prefs.h>
@@ -151,8 +153,8 @@ static dissector_handle_t aruba_erm_handle_type1;
static dissector_handle_t aruba_erm_handle_type2;
static dissector_handle_t aruba_erm_handle_type3;
static dissector_handle_t aruba_erm_handle_type4;
-static dissector_handle_t wlan_withoutfcs;
-static dissector_handle_t wlan_withfcs;
+static dissector_handle_t wlan_radio_handle;
+static dissector_handle_t wlan_withfcs_handle;
static dissector_handle_t peek_handle;
static dissector_handle_t ppi_handle;
static dissector_handle_t data_handle;
@@ -177,30 +179,6 @@ dissect_aruba_erm_pcap(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *aruba_
return offset;
}
-static int
-dissect_aruba_erm_pcap_radio(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *aruba_erm_tree, gint offset, guint32 *signal_strength)
-{
- proto_item *ti_data_rate;
- guint16 data_rate;
-
- data_rate = tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_data_rate, tvb, offset, 2, ENC_BIG_ENDIAN);
- ti_data_rate = proto_tree_add_float_format(aruba_erm_tree, hf_aruba_erm_data_rate_gen,
- tvb, 16, 2,
- (float)data_rate / 2,
- "Data Rate: %.1f Mb/s",
- (float)data_rate / 2);
- PROTO_ITEM_SET_GENERATED(ti_data_rate);
- offset += 2;
-
- proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
- offset += 1;
-
- proto_tree_add_item_ret_uint(aruba_erm_tree, hf_aruba_erm_signal_strength, tvb, offset, 1, ENC_BIG_ENDIAN, signal_strength);
- offset += 1;
-
- return offset;
-}
static proto_tree *
dissect_aruba_erm_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset _U_)
@@ -257,7 +235,7 @@ dissect_aruba_erm_type0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset_remaining(tvb, offset);
/* No way to determine if TX or RX packet... (TX = no FCS, RX = FCS...)*/
- call_dissector(wlan_withfcs, next_tvb, pinfo, tree);
+ call_dissector(wlan_withfcs_handle, next_tvb, pinfo, tree);
}
@@ -292,22 +270,51 @@ dissect_aruba_erm_type3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvbuff_t * next_tvb;
int offset = 0;
proto_tree *aruba_erm_tree;
+ struct ieee_802_11_phdr phdr;
guint32 signal_strength;
+ proto_item *ti_data_rate;
+ guint16 data_rate;
+ guint channel;
aruba_erm_tree = dissect_aruba_erm_common(tvb, pinfo, tree, &offset);
-
offset = dissect_aruba_erm_pcap(tvb, pinfo, aruba_erm_tree, offset);
- offset = dissect_aruba_erm_pcap_radio(tvb, pinfo, aruba_erm_tree, offset, &signal_strength);
+
+ phdr.decrypted = FALSE;
+ phdr.presence_flags |=
+ PHDR_802_11_HAS_DATA_RATE|
+ PHDR_802_11_HAS_CHANNEL|
+ PHDR_802_11_HAS_SIGNAL_PERCENT;
+ data_rate = tvb_get_ntohs(tvb, offset);
+ phdr.data_rate = data_rate;
+ proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_data_rate, tvb, offset, 2, ENC_BIG_ENDIAN);
+ ti_data_rate = proto_tree_add_float_format(aruba_erm_tree, hf_aruba_erm_data_rate_gen,
+ tvb, 16, 2,
+ (float)data_rate / 2,
+ "Data Rate: %.1f Mb/s",
+ (float)data_rate / 2);
+ PROTO_ITEM_SET_GENERATED(ti_data_rate);
+ offset += 2;
+
+ proto_tree_add_item_ret_uint(aruba_erm_tree, hf_aruba_erm_channel, tvb, offset, 1, ENC_BIG_ENDIAN, &channel);
+ phdr.channel = channel;
+ offset += 1;
+
+ proto_tree_add_item_ret_uint(aruba_erm_tree, hf_aruba_erm_signal_strength, tvb, offset, 1, ENC_BIG_ENDIAN, &signal_strength);
+ phdr.signal_percent = signal_strength;
+ offset += 1;
+
proto_item_set_len(aruba_erm_tree, offset);
next_tvb = tvb_new_subset_remaining(tvb, offset);
if(signal_strength == 100){ /* When signal = 100 %, it is TX packet and there is no FCS */
- call_dissector(wlan_withoutfcs, next_tvb, pinfo, tree);
+ phdr.fcs_len = 0; /* TX packet, no FCS */
} else {
- call_dissector(wlan_withfcs, next_tvb, pinfo, tree);
+ phdr.fcs_len = 4; /* We have an FCS */
}
-
+ phdr.decrypted = FALSE;
+ phdr.datapad = FALSE;
+ call_dissector_with_data(wlan_radio_handle, next_tvb, pinfo, tree, &phdr);
}
static void
@@ -446,8 +453,8 @@ proto_reg_handoff_aruba_erm(void)
static gboolean initialized = FALSE;
if (!initialized) {
- wlan_withoutfcs = find_dissector("wlan_withoutfcs");
- wlan_withfcs = find_dissector("wlan_withfcs");
+ wlan_radio_handle = find_dissector("wlan_radio");
+ wlan_withfcs_handle = find_dissector("wlan_withfcs");
ppi_handle = find_dissector("ppi");
peek_handle = find_dissector("peekremote");
data_handle = find_dissector("data");