diff options
Diffstat (limited to 'epan/dissectors/packet-aruba-erm.c')
-rw-r--r-- | epan/dissectors/packet-aruba-erm.c | 75 |
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"); |