Have two separate routines for wlantap dissection - OCTO and pre-OCTO.

The two code paths don't share any code, so they might as well be in
separate routines.

That makes it even easier to read.

Change-Id: I8ee335f4cac2aedc42216db7f9674e1a609d9347
Reviewed-on: https://code.wireshark.org/review/22179
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Guy Harris 2017-06-16 14:03:17 -07:00 committed by Michael Mann
parent 8ab033a283
commit 8b99bb7fbf
1 changed files with 997 additions and 961 deletions

View File

@ -37,8 +37,10 @@ void proto_reg_handoff_ixveriwave(void);
static void ethernettap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *tap_tree);
static void wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, proto_tree *tap_tree,
guint16 vw_msdu_length, guint8 cmd_type,
int log_mode, gboolean is_octo);
guint16 vw_msdu_length);
static void wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, proto_tree *tap_tree,
guint8 cmd_type, int log_mode);
typedef struct {
guint32 previous_frame_num;
@ -1494,9 +1496,14 @@ dissect_ixveriwave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
/* dissect the ethernet or wlan header next */
if (ixport_type == ETHERNET_PORT)
ethernettap_dissect(next_tvb, pinfo, tree, common_tree);
else {
if (is_octo)
wlantap_dissect_octo(next_tvb, pinfo, tree, common_tree,
cmd_type, log_mode);
else
wlantap_dissect(next_tvb, pinfo, tree, common_tree, vw_msdu_length,
cmd_type, log_mode, is_octo);
wlantap_dissect(next_tvb, pinfo, tree, common_tree,
vw_msdu_length);
}
}
return tvb_captured_length(tvb);
@ -1896,30 +1903,27 @@ decode_vht_sig(proto_tree *tree, tvbuff_t *tvb, int offset,
static void
wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree *tap_tree, guint16 vw_msdu_length, guint8 cmd_type,
int log_mode, gboolean is_octo)
proto_tree *tap_tree, guint16 vw_msdu_length)
{
proto_tree *ft, *flags_tree = NULL;
int align_offset, offset;
tvbuff_t *next_tvb;
guint length;
gint8 dbm;
guint8 rate_mcs_index = 0, vw_plcp_info, vw_bssid;
guint8 rate_mcs_index = 0;
guint8 plcp_type;
guint8 vht_ndp_flag, vht_mu_mimo_flg;
float phyRate;
proto_tree *vweft, *vw_errorFlags_tree = NULL, *vwict, *vw_infoC_tree = NULL;
guint16 vw_info, vw_chanflags, vw_flags, vw_ht_length, vw_rflags, vw_vcid, vw_seqnum, mpdu_length;
proto_tree *vweft, *vw_errorFlags_tree = NULL;
guint16 vw_info, vw_chanflags, vw_flags, vw_ht_length, vw_rflags;
guint32 vw_errors;
guint8 vht_user_pos;
guint8 plcp_default;
ifg_info *p_ifg_info;
proto_item *vwl1i, *ti;
proto_tree *vw_l1info_tree = NULL, *vwl2l4t,*vw_l2l4info_tree = NULL, *vwplt,*vw_plcpinfo_tree = NULL;
gboolean direction, short_preamble;
guint8 nss, sigbw, cidv, bssidv, flowv, l4idv;
proto_item *ti;
gboolean short_preamble;
guint8 nss;
struct ieee_802_11_phdr phdr;
@ -1932,10 +1936,7 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
//Command type Rx = 0, Tx = 1, RF = 3, RF_RX = 4
//log mode = 0 is normal capture and 1 is reduced capture
//is_octo is FALSE for non-OCTO versions and TRUE for OCTO versions
if (!is_octo)
{
/* Pre-OCTO. */
/* First add the IFG information, need to grab the info bit field here */
vw_info = tvb_get_letohs(tvb, 20);
@ -2261,8 +2262,44 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* dissect the 802.11 radio informaton and header next */
call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr);
}
else {
}
static void
wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree *tap_tree, guint8 cmd_type, int log_mode)
{
int offset;
tvbuff_t *next_tvb;
guint length;
gint8 dbm;
guint8 rate_mcs_index = 0, vw_plcp_info, vw_bssid;
guint8 plcp_type;
guint8 vht_ndp_flag, vht_mu_mimo_flg;
float phyRate;
proto_tree *vwict, *vw_infoC_tree = NULL;
guint16 vw_vcid, vw_seqnum, mpdu_length;
guint8 vht_user_pos;
guint8 plcp_default;
proto_item *vwl1i;
proto_tree *vw_l1info_tree = NULL, *vwl2l4t,*vw_l2l4info_tree = NULL, *vwplt,*vw_plcpinfo_tree = NULL;
gboolean direction, short_preamble;
guint8 nss, sigbw, cidv, bssidv, flowv, l4idv;
struct ieee_802_11_phdr phdr;
/* We don't have any 802.11 metadata yet. */
memset(&phdr, 0, sizeof(phdr));
phdr.fcs_len = -1;
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
phdr.phy = PHDR_802_11_PHY_UNKNOWN;
//Command type Rx = 0, Tx = 1, RF = 3, RF_RX = 4
//log mode = 0 is normal capture and 1 is reduced capture
/*
* FPGA version is non-zero, meaning this is OCTO.
* The first part is a timestamp header.
@ -2921,7 +2958,6 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* dissect the 802.11 radio informaton and header next */
call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr);
}
}
}
void proto_register_ixveriwave(void)