From cc9b38a734ac64603e78fe2dc00ad5bdc214e3ff Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Tue, 25 Apr 2017 23:26:59 -0400 Subject: [PATCH] Improve ixveriwave dissector Bug: 13652 Bug: 12535 Change-Id: Ie4c140acbe983a585776bc1430cf407cdcd6e07a Reviewed-on: https://code.wireshark.org/review/21356 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- epan/dissectors/packet-ixveriwave.c | 4039 ++++++++++++++++++++++----- wiretap/vwr.c | 1116 ++++++-- wiretap/wtap-int.h | 16 + 3 files changed, 4268 insertions(+), 903 deletions(-) diff --git a/epan/dissectors/packet-ixveriwave.c b/epan/dissectors/packet-ixveriwave.c index d0cd5c1c7e..cde3724ea3 100644 --- a/epan/dissectors/packet-ixveriwave.c +++ b/epan/dissectors/packet-ixveriwave.c @@ -24,16 +24,21 @@ #include "config.h" +#include + #include #include +#include +#include #include + void proto_register_ixveriwave(void); 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); +static void wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *tap_tree, guint16 vw_msdu_length, guint8 cmd_type, guint8 mgmt_byte); typedef struct { guint32 previous_frame_num; @@ -68,10 +73,21 @@ static frame_end_data previous_frame_data = {0,0}; #define VW_RADIOTAP_FPGA_VER_vVW510021 0x000C /* vVW510021 version detected */ #define VW_RADIOTAP_FPGA_VER_vVW510021_11n 0x000D +#define FLAGS_CHAN_SHORTGI 0x0100 /* short guard interval */ +#define IEEE80211_RADIOTAP_F_CFP 0x0001 /* sent/received during CFP */ +#define IEEE80211_RADIOTAP_F_DATAPAD 0x0020 /* frame has padding between + * 802.11 header and payload + * (to 32-bit boundary) + */ #define CHAN_CCK 0x00020 /* CCK channel */ #define CHAN_OFDM 0x00040 /* OFDM channel */ - +#define IEEE80211_CHAN_2GHZ 0x00080 /* 2 GHz spectrum channel. */ +#define IEEE80211_CHAN_5GHZ 0x00100 /* 5 GHz spectrum channel */ +#define IEEE80211_RADIOTAP_F_FRAG 0x0008 /* sent/received + * with fragmentation + */ +#define IEEE80211_PLCP_RATE_MASK 0x7f /* parses out the rate or MCS index from the PLCP header(s) */ #define FLAGS_SHORTPRE 0x0002 /* sent/received * with short * preamble @@ -99,8 +115,24 @@ static frame_end_data previous_frame_data = {0,0}; #define PLCP_TYPE_GREENFIELD 0x02 /* HT, greenfield (11n) */ #define PLCP_TYPE_VHT_MIXED 0x03 /* VHT (11ac) */ +/* For RADIOTAP_FLAGS */ +#define RADIOTAP_F_CFP 0x001 /* sent/received during CFP */ +#define RADIOTAP_F_SHORTPRE 0x002 /* sent/received with short preamble */ +#define RADIOTAP_F_WEP 0x004 /* sent/received with WEP encryption */ +#define RADIOTAP_F_FRAG 0x008 /* sent/received with fragmentation */ +#define RADIOTAP_F_FCS 0x010 /* frame includes FCS */ +#define RADIOTAP_F_DATAPAD 0x020 /* padding between 802.11 hdr & payload */ +#define RADIOTAP_F_CHAN_HT 0x040 /* In HT mode */ +#define RADIOTAP_F_CHAN_40MHZ 0x080 /* 40 Mhz CBW */ +#define RADIOTAP_F_CHAN_80MHZ 0x100 /* 80 Mhz CBW */ +#define RADIOTAP_F_CHAN_SHORTGI 0x200 /* Short guard interval */ + #define ETHERNET_PORT 1 #define WLAN_PORT 0 +#define OCTO_TIMESTAMP_FIELDS_LEN 32 /* (4+4+8+8+4+4) */ +#define OCTO_MODIFIED_RF_LEN 76 /* Number of RF bytes to be displayed*/ +#define VW_INFO_OFF 48 +#define IFG_MAX_VAL 0xEE6B2800 static int proto_ixveriwave = -1; static dissector_handle_t ethernet_handle; @@ -119,9 +151,11 @@ static int hf_ixveriwave_vw_mslatency = -1; static int hf_ixveriwave_vw_latency = -1; static int hf_ixveriwave_vw_pktdur = -1; static int hf_ixveriwave_vw_ifg = -1; +static int hf_ixveriwave_vw_ifg_neg = -1; static int hf_ixveriwave = -1; static int hf_ixveriwave_vw_startt = -1; static int hf_ixveriwave_vw_endt = -1; +static int hf_ixveriwave_vw_delay = -1; static gint ett_commontap = -1; static gint ett_commontap_times = -1; @@ -176,14 +210,21 @@ static int hf_radiotap_datarate = -1; static int hf_radiotap_mcsindex = -1; static int hf_radiotap_plcptype = -1; static int hf_radiotap_nss = -1; -static int hf_radiotap_dbm_antsignal = -1; +static int hf_radiotap_dbm_anta = -1; static int hf_radiotap_dbm_antb = -1; static int hf_radiotap_dbm_antc = -1; static int hf_radiotap_dbm_antd = -1; +static int hf_radiotap_dbm_tx_anta = -1; +static int hf_radiotap_dbm_tx_antb = -1; +static int hf_radiotap_dbm_tx_antc = -1; +static int hf_radiotap_dbm_tx_antd = -1; +static int hf_radiotap_flags_cfp = -1; static int hf_radiotap_flags_preamble = -1; static int hf_radiotap_flags_wep = -1; -static int hf_radiotap_flags_fcs_present = -1; +static int hf_radiotap_flags_frag = -1; +static int hf_radiotap_flags_fcs = -1; +static int hf_radiotap_flags_datapad = -1; static int hf_radiotap_flags_ht = -1; static int hf_radiotap_flags_vht = -1; static int hf_radiotap_flags_40mhz = -1; @@ -197,6 +238,7 @@ static int hf_radiotap_vw_ht_length = -1; static int hf_radiotap_vht_grp_id = -1; static int hf_radiotap_vht_su_nsts = -1; static int hf_radiotap_vht_su_partial_aid = -1; +static int hf_radiotap_vht_su_coding_type = -1; static int hf_radiotap_vht_u0_nsts = -1; static int hf_radiotap_vht_u1_nsts = -1; static int hf_radiotap_vht_u2_nsts = -1; @@ -204,17 +246,98 @@ static int hf_radiotap_vht_u3_nsts = -1; static int hf_radiotap_vht_beamformed = -1; static int hf_radiotap_vht_user_pos = -1; static int hf_radiotap_vht_mu_mimo_flg = -1; +static int hf_radiotap_vht_su_mimo_flg = -1; static int hf_radiotap_vht_u0_coding_type = -1; static int hf_radiotap_vht_u1_coding_type = -1; static int hf_radiotap_vht_u2_coding_type = -1; static int hf_radiotap_vht_u3_coding_type = -1; +static int hf_radiotap_vw_info_tx_bit0 = -1; +static int hf_radiotap_vw_info_tx_bit1 = -1; +static int hf_radiotap_vw_info_tx_bit3 = -1; +static int hf_radiotap_vw_info_tx_bit4 = -1; +static int hf_radiotap_vw_info_tx_bit5 = -1; +static int hf_radiotap_vw_info_tx_bit6 = -1; +static int hf_radiotap_vw_info_tx_bit7 = -1; +static int hf_radiotap_vw_info_tx_bit8 = -1; +static int hf_radiotap_vw_info_tx_bit9 = -1; static int hf_radiotap_vw_info_tx_bit10 = -1; static int hf_radiotap_vw_info_tx_bit11 = -1; static int hf_radiotap_vw_info_tx_bit12 = -1; static int hf_radiotap_vw_info_tx_bit13 = -1; static int hf_radiotap_vw_info_tx_bit14 = -1; static int hf_radiotap_vw_info_tx_bit15 = -1; +static const int *radiotap_info_tx_fields[] = { + &hf_radiotap_vw_info_tx_bit0, + &hf_radiotap_vw_info_tx_bit1, + &hf_radiotap_vw_info_tx_bit3, + &hf_radiotap_vw_info_tx_bit4, + &hf_radiotap_vw_info_tx_bit5, + &hf_radiotap_vw_info_tx_bit6, + &hf_radiotap_vw_info_tx_bit7, + &hf_radiotap_vw_info_tx_bit8, + &hf_radiotap_vw_info_tx_bit9, + &hf_radiotap_vw_info_tx_bit10, + &hf_radiotap_vw_info_tx_bit11, + &hf_radiotap_vw_info_tx_bit12, + &hf_radiotap_vw_info_tx_bit13, + &hf_radiotap_vw_info_tx_bit14, + &hf_radiotap_vw_info_tx_bit15, + NULL, +}; + +static int hf_radiotap_vw_info_tx = -1; +static int hf_radiotap_vw_info_rx = -1; +static int hf_radiotap_vw_info_rx_bit0 = -1; +static int hf_radiotap_vw_info_rx_bit1 = -1; +static int hf_radiotap_vw_info_rx_bit3 = -1; +static int hf_radiotap_vw_info_rx_bit4 = -1; +static int hf_radiotap_vw_info_rx_bit5 = -1; +static int hf_radiotap_vw_info_rx_bit6 = -1; +static int hf_radiotap_vw_info_rx_bit7 = -1; +static int hf_radiotap_vw_info_rx_bit8 = -1; +static int hf_radiotap_vw_info_rx_bit9 = -1; +static int hf_radiotap_vw_info_rx_bit10 = -1; +static int hf_radiotap_vw_info_rx_bit11 = -1; +static int hf_radiotap_vw_info_rx_bit12 = -1; +static int hf_radiotap_vw_info_rx_bit13 = -1; +static int hf_radiotap_vw_info_rx_bit14 = -1; +static int hf_radiotap_vw_info_rx_bit15 = -1; +static int hf_radiotap_vw_info_rx_bit16 = -1; +static int hf_radiotap_vw_info_rx_bit17 = -1; +static int hf_radiotap_vw_info_rx_bit18 = -1; +static int hf_radiotap_vw_info_rx_bit19 = -1; +static int hf_radiotap_vw_info_rx_bit20 = -1; +static const int *radiotap_info_rx_fields[] = { + &hf_radiotap_vw_info_rx_bit0, + &hf_radiotap_vw_info_rx_bit1, + &hf_radiotap_vw_info_rx_bit3, + &hf_radiotap_vw_info_rx_bit4, + &hf_radiotap_vw_info_rx_bit5, + &hf_radiotap_vw_info_rx_bit6, + &hf_radiotap_vw_info_rx_bit7, + &hf_radiotap_vw_info_rx_bit8, + &hf_radiotap_vw_info_rx_bit9, + &hf_radiotap_vw_info_rx_bit10, + &hf_radiotap_vw_info_rx_bit11, + &hf_radiotap_vw_info_rx_bit12, + &hf_radiotap_vw_info_rx_bit13, + &hf_radiotap_vw_info_rx_bit14, + &hf_radiotap_vw_info_rx_bit15, + &hf_radiotap_vw_info_rx_bit16, + &hf_radiotap_vw_info_rx_bit17, + &hf_radiotap_vw_info_rx_bit18, + &hf_radiotap_vw_info_rx_bit19, + &hf_radiotap_vw_info_rx_bit20, + NULL, +}; + +static int hf_radiotap_vw_info_tx_2_bit10 = -1; +static int hf_radiotap_vw_info_tx_2_bit11 = -1; +static int hf_radiotap_vw_info_tx_2_bit12 = -1; +static int hf_radiotap_vw_info_tx_2_bit13 = -1; +static int hf_radiotap_vw_info_tx_2_bit14 = -1; +static int hf_radiotap_vw_info_tx_2_bit15 = -1; static int hf_radiotap_vw_info_rx_2_bit8 = -1; static int hf_radiotap_vw_info_rx_2_bit9 = -1; @@ -225,6 +348,44 @@ static int hf_radiotap_vw_info_rx_2_bit13 = -1; static int hf_radiotap_vw_info_rx_2_bit14 = -1; static int hf_radiotap_vw_info_rx_2_bit15 = -1; +static int hf_radiotap_vw_errors_tx_bit01 = -1; +static int hf_radiotap_vw_errors_tx_bit05 = -1; +static int hf_radiotap_vw_errors_tx_bit8 = -1; +static int hf_radiotap_vw_errors_tx_bit9 = -1; +static int hf_radiotap_vw_errors_tx_bit10 = -1; +static int hf_radiotap_vw_errors_tx_bit31 = -1; +static int hf_radiotap_vw_tx_retrycount = -1; +static int hf_radiotap_vw_tx_factorydebug = -1; + +static int hf_radiotap_vw_errors_tx_bit1 = -1; +static int hf_radiotap_vw_errors_tx_bit5 = -1; + +static int hf_radiotap_vw_errors_rx_bit0 = -1; +static int hf_radiotap_vw_errors_rx_bit1 = -1; +static int hf_radiotap_vw_errors_rx_bit2 = -1; +static int hf_radiotap_vw_errors_rx_bit3 = -1; +static int hf_radiotap_vw_errors_rx_bit4 = -1; +static int hf_radiotap_vw_errors_rx_bit5 = -1; +static int hf_radiotap_vw_errors_rx_bit6 = -1; +static int hf_radiotap_vw_errors_rx_bit7 = -1; +static int hf_radiotap_vw_errors_rx_bit8 = -1; +static int hf_radiotap_vw_errors_rx_bit9 = -1; +static int hf_radiotap_vw_errors_rx_bit10 = -1; +static int hf_radiotap_vw_errors_rx_bit11 = -1; +static int hf_radiotap_vw_errors_rx_bit12 = -1; +static int hf_radiotap_vw_errors_rx_bit14 = -1; +static int hf_radiotap_vw_errors_rx_bit15 = -1; +static int hf_radiotap_vw_errors_rx_bit16 = -1; +static int hf_radiotap_vw_errors_rx_bit17 = -1; +static int hf_radiotap_vw_errors_rx_bit18 = -1; +static int hf_radiotap_vw_errors_rx_bit19 = -1; +static int hf_radiotap_vw_errors_rx_bit20 = -1; +static int hf_radiotap_vw_errors_rx_bit21 = -1; +static int hf_radiotap_vw_errors_rx_bit22 = -1; +static int hf_radiotap_vw_errors_rx_bit23 = -1; +static int hf_radiotap_vw_errors_rx_bit24 = -1; +static int hf_radiotap_vw_errors_rx_bit31 = -1; + static int hf_radiotap_vw_errors_rx_2_bit0 = -1; static int hf_radiotap_vw_errors_rx_2_bit1 = -1; static int hf_radiotap_vw_errors_rx_2_bit2 = -1; @@ -236,9 +397,6 @@ static int hf_radiotap_vw_errors_rx_2_bit8 = -1; static int hf_radiotap_vw_errors_rx_2_bit10 = -1; static int hf_radiotap_vw_errors_rx_2_bit11 = -1; -static int hf_radiotap_vw_errors_tx_bit1 = -1; -static int hf_radiotap_vw_errors_tx_bit5 = -1; - static int hf_radiotap_vwf_txf = -1; static int hf_radiotap_vwf_fcserr = -1; static int hf_radiotap_vwf_dcrerr = -1; @@ -248,6 +406,167 @@ static int hf_radiotap_vwf_enctype = -1; static gint ett_radiotap_info = -1; static gint ett_radiotap_errors = -1; static gint ett_radiotap_times = -1; +static gint ett_radiotap_layer1 = -1; +static gint ett_radiotap_layer2to4 = -1; +static gint ett_radiotap_rf = -1; +static gint ett_radiotap_plcp = -1; +static gint ett_radiotap_infoc = -1; +static gint ett_radiotap_contextp = -1; +static gint ett_rf_info = -1; + +static int hf_radiotap_rf_info = -1; +static int hf_radiotap_rx = -1; +static int hf_radiotap_tx = -1; +static int hf_radiotap_modulation = -1; +static int hf_radiotap_preamble = -1; +static int hf_radiotap_sigbandwidth = -1; +/* static int hf_radiotap_rssi = -1; */ +static int hf_radiotap_l1infoc = -1; +static int hf_radiotap_sigbandwidthmask = -1; +static int hf_radiotap_antennaportenergydetect = -1; +static int hf_radiotap_mumask = -1; +static int hf_radiotap_plcp_info = -1; +static int hf_radiotap_l2_l4_info = -1; +/* static int hf_radiotap_rfinfo_tbd = -1; */ +static int hf_radiotap_rfinfo_rfid = -1; +static int hf_radiotap_bssid = -1; +static int hf_radiotap_unicastormulticast = -1; +static int hf_radiotap_clientidvalid = -1; +static int hf_radiotap_bssidvalid = -1; +static int hf_radiotap_flowvalid = -1; +static int hf_radiotap_l4idvalid = -1; +static int hf_radiotap_istypeqos = -1; +static int hf_radiotap_containshtfield = -1; +static int hf_radiotap_tid = -1; +/*static int hf_radiotap_wlantype = -1; */ +static int hf_radiotap_payloaddecode = -1; +static int hf_radiotap_vht_bw = -1; +static int hf_radiotap_vht_stbc = -1; +static int hf_radiotap_vht_txop_ps_notallowd = -1; +static int hf_radiotap_vht_shortgi = -1; +static int hf_radiotap_vht_shortginsymdisa = -1; +static int hf_radiotap_vht_ldpc_ofdmsymbol = -1; +static int hf_radiotap_vht_su_mcs = -1; +static int hf_radiotap_vht_crc = -1; +static int hf_radiotap_vht_tail = -1; +static int hf_radiotap_vht_length = -1; +static int hf_radiotap_rfid = -1; +static int hf_radiotap_vht_mcs = -1; +static int hf_radiotap_parity = -1; +static int hf_radiotap_rate = -1; +static int hf_radiotap_plcp_length = -1; +static int hf_radiotap_feccoding = -1; +static int hf_radiotap_aggregation = -1; +static int hf_radiotap_notsounding = -1; +static int hf_radiotap_smoothing = -1; +static int hf_radiotap_ness = -1; +static int hf_radiotap_plcp_service = -1; +static int hf_radiotap_plcp_signal = -1; +static int hf_radiotap_plcp_default = -1; +static int hf_radiotap_tx_antennaselect = -1; +static int hf_radiotap_tx_stbcselect = -1; +static int hf_radiotap_ac = -1; +static int hf_radiotap_crc16 = -1; +// RF LOGGING +static int hf_radiotap_rfinfo_pfe = -1; +/* +static int hf_radiotap_rfinfo_noise = -1; +static int hf_radiotap_rfinfo_noise_anta = -1; +static int hf_radiotap_rfinfo_noise_antb = -1; +static int hf_radiotap_rfinfo_noise_antc = -1; +static int hf_radiotap_rfinfo_noise_antd = -1; +*/ +static int hf_radiotap_rfinfo_snr = -1; +static int hf_radiotap_rfinfo_snr_anta = -1; +static int hf_radiotap_rfinfo_snr_antb = -1; +static int hf_radiotap_rfinfo_snr_antc = -1; +static int hf_radiotap_rfinfo_snr_antd = -1; +static int hf_radiotap_rfinfo_pfe_anta = -1; +static int hf_radiotap_rfinfo_pfe_antb = -1; +static int hf_radiotap_rfinfo_pfe_antc = -1; +static int hf_radiotap_rfinfo_pfe_antd = -1; +static int hf_radiotap_rfinfo_contextpa = -1; +static int hf_radiotap_rfinfo_contextpb = -1; +static int hf_radiotap_rfinfo_contextpc = -1; +static int hf_radiotap_rfinfo_contextpd = -1; +static int hf_radiotap_rfinfo_contextpA_bit0 = -1; +static int hf_radiotap_rfinfo_contextpA_bit1 = -1; +static int hf_radiotap_rfinfo_contextpA_bit2 = -1; +static int hf_radiotap_rfinfo_contextpA_bit3 = -1; +static int hf_radiotap_rfinfo_contextpA_bit4 = -1; +static int hf_radiotap_rfinfo_contextpA_bit5 = -1; +/* static int hf_radiotap_rfinfo_contextpA_bit8 = -1; */ +/* static int hf_radiotap_rfinfo_contextpA_bit10 = -1; */ +/* static int hf_radiotap_rfinfo_contextpA_bit11 = -1; */ +static int hf_radiotap_rfinfo_contextpA_bit13 = -1; + +static int hf_radiotap_rfinfo_contextpB_bit0 = -1; +static int hf_radiotap_rfinfo_contextpB_bit1 = -1; +static int hf_radiotap_rfinfo_contextpB_bit2 = -1; +static int hf_radiotap_rfinfo_contextpB_bit3 = -1; +static int hf_radiotap_rfinfo_contextpB_bit4 = -1; +static int hf_radiotap_rfinfo_contextpB_bit5 = -1; +static int hf_radiotap_rfinfo_contextpB_bit13 = -1; + +static int hf_radiotap_rfinfo_contextpC_bit0 = -1; +static int hf_radiotap_rfinfo_contextpC_bit1 = -1; +static int hf_radiotap_rfinfo_contextpC_bit2 = -1; +static int hf_radiotap_rfinfo_contextpC_bit3 = -1; +static int hf_radiotap_rfinfo_contextpC_bit4 = -1; +static int hf_radiotap_rfinfo_contextpC_bit5 = -1; +static int hf_radiotap_rfinfo_contextpC_bit13 = -1; + +static int hf_radiotap_rfinfo_contextpD_bit0 = -1; +static int hf_radiotap_rfinfo_contextpD_bit1 = -1; +static int hf_radiotap_rfinfo_contextpD_bit2 = -1; +static int hf_radiotap_rfinfo_contextpD_bit3 = -1; +static int hf_radiotap_rfinfo_contextpD_bit4 = -1; +static int hf_radiotap_rfinfo_contextpD_bit5 = -1; +static int hf_radiotap_rfinfo_contextpD_bit13 = -1; + +static int hf_radiotap_rfinfo_avg_evm_sd_siga = -1; +static int hf_radiotap_rfinfo_avg_evm_sd_sigb = -1; +static int hf_radiotap_rfinfo_avg_evm_sd_sigc = -1; +static int hf_radiotap_rfinfo_avg_evm_sd_sigd = -1; +static int hf_radiotap_rfinfo_avg_evm_sp_siga = -1; +static int hf_radiotap_rfinfo_avg_evm_sp_sigb = -1; +static int hf_radiotap_rfinfo_avg_evm_sp_sigc = -1; +static int hf_radiotap_rfinfo_avg_evm_sp_sigd = -1; +static int hf_radiotap_rfinfo_avg_evm_dd_siga = -1; +static int hf_radiotap_rfinfo_avg_evm_dd_sigb = -1; +static int hf_radiotap_rfinfo_avg_evm_dd_sigc = -1; +static int hf_radiotap_rfinfo_avg_evm_dd_sigd = -1; +static int hf_radiotap_rfinfo_avg_evm_dp_siga = -1; +static int hf_radiotap_rfinfo_avg_evm_dp_sigb = -1; +static int hf_radiotap_rfinfo_avg_evm_dp_sigc = -1; +static int hf_radiotap_rfinfo_avg_evm_dp_sigd = -1; +static int hf_radiotap_rfinfo_avg_evm_ws_siga = -1; +static int hf_radiotap_rfinfo_avg_evm_ws_sigb = -1; +static int hf_radiotap_rfinfo_avg_evm_ws_sigc = -1; +static int hf_radiotap_rfinfo_avg_evm_ws_sigd = -1; +/* static int hf_radiotap_rfinfo_contextp_bits3 = -1; */ +static int hf_radiotap_rfinfo_frameformatA = -1; +static int hf_radiotap_rfinfo_frameformatB = -1; +static int hf_radiotap_rfinfo_frameformatC = -1; +static int hf_radiotap_rfinfo_frameformatD = -1; +static int hf_radiotap_rfinfo_sigbwevmA = -1; +static int hf_radiotap_rfinfo_sigbwevmB = -1; +static int hf_radiotap_rfinfo_sigbwevmC = -1; +static int hf_radiotap_rfinfo_sigbwevmD = -1; +static int hf_radiotap_rfinfo_legacytypeA = -1; +static int hf_radiotap_rfinfo_legacytypeB = -1; +static int hf_radiotap_rfinfo_legacytypeC = -1; +static int hf_radiotap_rfinfo_legacytypeD = -1; + +static int hf_radiotap_rfinfo_avg_ws_symbol = -1; +static int hf_radiotap_rfinfo_sigdata = -1; +static int hf_radiotap_rfinfo_sigpilot = -1; +static int hf_radiotap_rfinfo_datadata = -1; +static int hf_radiotap_rfinfo_datapilot = -1; +static int hf_radiotap_plcp_type = -1; +static int hf_radiotap_vht_ndp_flg = -1; + +static expert_field ei_radiotap_fcs_bad = EI_INIT; static dissector_handle_t ixveriwave_handle; @@ -261,100 +580,165 @@ dissect_ixveriwave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da proto_item *ti = NULL; proto_item *vw_times_ti = NULL; proto_tree *vw_times_tree = NULL; - int offset, time_tree_offset = 0; - guint16 version, length; + proto_item *rf_infot = NULL; + proto_tree *rf_info_tree = NULL; + int offset; + guint16 length; guint length_remaining; guint64 vw_startt=0, vw_endt=0; guint32 true_length; - guint32 vw_latency, vw_pktdur, vw_flowid; - guint16 vw_vcid, vw_msdu_length=0, vw_seqnum; + guint32 vw_latency, vw_pktdur; + guint32 vw_msdu_length=0; tvbuff_t *next_tvb; ifg_info *p_ifg_info; + guint8 ver_fpga, ixport_type,cmd_type, mgmt_byte; + guint8 frameformat, rfid, legacy_type; + gint8 noisevalida, noisevalidb, noisevalidc, noisevalidd, pfevalida, pfevalidb, pfevalidc, pfevalidd; + guint16 vw_info_ifg; + int ifg_flag = 0; + proto_tree *vwrft, *vw_rfinfo_tree = NULL, *rfinfo_contextp_tree; + + static const int * context_a_flags[] = { + &hf_radiotap_rfinfo_contextpA_bit0, + &hf_radiotap_rfinfo_contextpA_bit1, + &hf_radiotap_rfinfo_contextpA_bit2, + &hf_radiotap_rfinfo_contextpA_bit3, + &hf_radiotap_rfinfo_contextpA_bit4, + &hf_radiotap_rfinfo_contextpA_bit5, +/* + &hf_radiotap_rfinfo_contextpA_bit8, + &hf_radiotap_rfinfo_contextpA_bit10, + &hf_radiotap_rfinfo_contextpA_bit11, +*/ + &hf_radiotap_rfinfo_contextpA_bit13, + NULL + }; + static const int * context_b_flags[] = { + &hf_radiotap_rfinfo_contextpB_bit0, + &hf_radiotap_rfinfo_contextpB_bit1, + &hf_radiotap_rfinfo_contextpB_bit2, + &hf_radiotap_rfinfo_contextpB_bit3, + &hf_radiotap_rfinfo_contextpB_bit4, + &hf_radiotap_rfinfo_contextpB_bit5, +/* + &hf_radiotap_rfinfo_contextpB_bit8, + &hf_radiotap_rfinfo_contextpB_bit10, + &hf_radiotap_rfinfo_contextpB_bit11, +*/ + &hf_radiotap_rfinfo_contextpB_bit13, + NULL + }; + static const int * context_c_flags[] = { + &hf_radiotap_rfinfo_contextpC_bit0, + &hf_radiotap_rfinfo_contextpC_bit1, + &hf_radiotap_rfinfo_contextpC_bit2, + &hf_radiotap_rfinfo_contextpC_bit3, + &hf_radiotap_rfinfo_contextpC_bit4, + &hf_radiotap_rfinfo_contextpC_bit5, +/* + &hf_radiotap_rfinfo_contextpC_bit8, + &hf_radiotap_rfinfo_contextpC_bit10, + &hf_radiotap_rfinfo_contextpC_bit11, +*/ + &hf_radiotap_rfinfo_contextpC_bit13, + NULL + }; + static const int * context_d_flags[] = { + &hf_radiotap_rfinfo_contextpD_bit0, + &hf_radiotap_rfinfo_contextpD_bit1, + &hf_radiotap_rfinfo_contextpD_bit2, + &hf_radiotap_rfinfo_contextpD_bit3, + &hf_radiotap_rfinfo_contextpD_bit4, + &hf_radiotap_rfinfo_contextpD_bit5, +/* + &hf_radiotap_rfinfo_contextpD_bit8, + &hf_radiotap_rfinfo_contextpD_bit10, + &hf_radiotap_rfinfo_contextpD_bit11, +*/ + &hf_radiotap_rfinfo_contextpD_bit13, + NULL + }; offset = 0; - version = tvb_get_letohs(tvb, offset); + //mgmt_bytes = tvb_get_letohs(tvb, offset); + //1st octet are as command type((7..4 bits)which indicates as Tx, Rx or RF frame) & port type((3..0 bits)ethernet or wlantap). + //Command type Rx = 0, Tx = 1, RF = 3 , RF_RX = 4 + //2nd octet are as Reduce logging(7..4 bits) & fpga version(3..0 bits). + //log mode = 0 is normal capture and 1 is reduced capture + //FPGA version = 1 for OCTO versions + //OCTO version like 48, 61, 83 + ixport_type = tvb_get_guint8(tvb, offset); + cmd_type = (ixport_type & 0xf0) >> 4; + ixport_type &= 0x0f; + mgmt_byte = tvb_get_guint8(tvb, offset+1); + ver_fpga = mgmt_byte & 0x0f; length = tvb_get_letohs(tvb, offset + COMMON_LENGTH_OFFSET); - col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "%s", version ? "ETH" : "WLAN"); + col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "%s", ixport_type ? "ETH" : "WLAN"); col_clear(pinfo->cinfo, COL_INFO); true_length = pinfo->fd->pkt_len - length - tvb_get_letohs(tvb, offset + length) + 4; /* add FCS length into captured length */ col_add_fstr(pinfo->cinfo, COL_INFO, "%s Capture, Length %u", - version ? "IxVeriWave Ethernet Tap" : "IxVeriWave Radio Tap", length); + ixport_type ? "IxVeriWave Ethernet Tap" : "IxVeriWave Radio Tap", length); /* Dissect the packet */ - if (tree) { - ti = proto_tree_add_protocol_format(tree, proto_ixveriwave, - tvb, 0, length, "%s Header, Length %u", - version ? "IxVeriWave Ethernet Tap" : "IxVeriWave Radio Tap", length); + ti = proto_tree_add_protocol_format(tree, proto_ixveriwave, + tvb, 0, length, "%s Header", + ixport_type ? "IxVeriWave Ethernet Tap" : "IxVeriWave Radio Tap"); + common_tree = proto_item_add_subtree(ti, ett_commontap); - common_tree = proto_item_add_subtree(ti, ett_commontap); - - proto_tree_add_uint(common_tree, hf_ixveriwave_frame_length, - tvb, 4, 2, true_length); - } - - length_remaining = length; - - offset +=4; - length_remaining -=4; - - if (length_remaining >= 2) { - - vw_msdu_length = tvb_get_letohs(tvb, offset); - if (tree) { - proto_tree_add_uint(common_tree, hf_ixveriwave_vw_msdu_length, - tvb, offset, 2, vw_msdu_length); + //checked for only RF frames should be skipped from the other logging details. + if (cmd_type !=3) + { + //checked the fpga version in order to support the legacy version and showing the wireshark logs as it is before in case of fpga version 0 + if (!ver_fpga) { + proto_tree_add_uint(common_tree, hf_ixveriwave_frame_length, + tvb, 4, 2, true_length); } - offset +=2; - length_remaining -=2; - } - - /*extract flow id , 4bytes*/ - if (length_remaining >= 4) { - vw_flowid = tvb_get_letohl(tvb, offset); - if (tree) { - proto_tree_add_uint(common_tree, hf_ixveriwave_vw_flowid, - tvb, offset, 4, vw_flowid); - } + length_remaining = length; offset +=4; length_remaining -=4; - } - /*extract client id, 2bytes*/ - if (length_remaining >= 2) { - vw_vcid = tvb_get_letohs(tvb, offset); - if (tree) { - proto_tree_add_uint(common_tree, hf_ixveriwave_vw_vcid, - tvb, offset, 2, vw_vcid); + if (length_remaining >= 2) { + + proto_tree_add_item_ret_uint(common_tree, hf_ixveriwave_vw_msdu_length, tvb, offset, 2, ENC_LITTLE_ENDIAN, &vw_msdu_length); + offset +=2; + length_remaining -=2; } - offset +=2; - length_remaining -=2; - } + /*extract flow id , 4bytes*/ + if (length_remaining >= 4) { + proto_tree_add_item(common_tree, hf_ixveriwave_vw_flowid, tvb, offset, 4, ENC_LITTLE_ENDIAN); - /*extract sequence number , 2bytes*/ - if (length_remaining >= 2) { - - vw_seqnum = tvb_get_letohs(tvb, offset); - if (tree) { - proto_tree_add_uint(common_tree, hf_ixveriwave_vw_seqnum, - tvb, offset, 2, vw_seqnum); + offset +=4; + length_remaining -=4; } - offset +=2; - length_remaining -=2; - } + /*extract client id, 2bytes*/ + if (length_remaining >= 2) { + proto_tree_add_item(common_tree, hf_ixveriwave_vw_vcid, tvb, offset, 2, ENC_LITTLE_ENDIAN); - /*extract latency, 4 bytes*/ - if (length_remaining >= 4) { - vw_latency = tvb_get_letohl(tvb, offset); + offset +=2; + length_remaining -=2; + } + + /*extract sequence number , 2bytes*/ + if (length_remaining >= 2) { + + proto_tree_add_item(common_tree, hf_ixveriwave_vw_seqnum, tvb, offset, 2, ENC_LITTLE_ENDIAN); + + offset +=2; + length_remaining -=2; + } + + /*extract latency, 4 bytes*/ + if (length_remaining >= 4) { + vw_latency = tvb_get_letohl(tvb, offset); - if (tree) { /* start a tree going for the various packet times */ if (vw_latency != 0) { vw_times_ti = proto_tree_add_float_format(common_tree, @@ -364,9 +748,7 @@ dissect_ixveriwave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da (float)(vw_latency/1000000.0)); vw_times_tree = proto_item_add_subtree(vw_times_ti, ett_commontap_times); - proto_tree_add_uint_format(vw_times_tree, hf_ixveriwave_vw_latency, - tvb, offset, 4, vw_latency, - "Frame latency: %u nsec", vw_latency); + proto_tree_add_uint(vw_times_tree, hf_ixveriwave_vw_latency, tvb, offset, 4, vw_latency); } else { @@ -376,87 +758,170 @@ dissect_ixveriwave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da "Frame timestamp values:"); vw_times_tree = proto_item_add_subtree(vw_times_ti, ett_commontap_times); - proto_tree_add_uint_format(vw_times_tree, hf_ixveriwave_vw_latency, - tvb, offset, 4, vw_latency, - "Frame latency: N/A"); + proto_tree_add_uint_format_value(vw_times_tree, hf_ixveriwave_vw_latency, + tvb, offset, 4, vw_latency, "N/A"); } + + offset +=4; + length_remaining -=4; } - offset +=4; - length_remaining -=4; - } + /*extract signature timestamp, 4 bytes (32 LSBs only, nsec)*/ + if (length_remaining >= 4) { + /* TODO: what should this fieldname be? */ + proto_tree_add_item(vw_times_tree, hf_ixveriwave, + tvb, offset, 4, ENC_BIG_ENDIAN); + offset +=4; + length_remaining -=4; + } + /*extract frame start timestamp, 8 bytes (nsec)*/ + if (length_remaining >= 8) { + proto_tree_add_item_ret_uint64(vw_times_tree, hf_ixveriwave_vw_startt, + tvb, offset, 8, ENC_LITTLE_ENDIAN, &vw_startt); + offset +=8; + length_remaining -=8; + } - /*extract signature timestamp, 4 bytes (32 LSBs only, nsec)*/ - if (length_remaining >= 4) { - /* TODO: what should this fieldname be? */ - proto_tree_add_item(vw_times_tree, hf_ixveriwave, - tvb, offset, 4, ENC_BIG_ENDIAN); - time_tree_offset = offset; - offset +=4; - length_remaining -=4; - } + /* extract frame end timestamp, 8 bytes (nsec)*/ + if (length_remaining >= 8) { + proto_tree_add_item_ret_uint64(vw_times_tree, hf_ixveriwave_vw_endt, + tvb, offset, 8, ENC_LITTLE_ENDIAN, &vw_endt); - /*extract frame start timestamp, 8 bytes (nsec)*/ - if (length_remaining >= 8) { - vw_startt = tvb_get_letoh64(tvb, offset); + offset +=8; + length_remaining -=8; + } - proto_tree_add_uint64(vw_times_tree, hf_ixveriwave_vw_startt, - tvb, offset, 8, vw_startt); + /*extract frame duration , 4 bytes*/ + if (length_remaining >= 4) { + vw_pktdur = tvb_get_letohl(tvb, offset); - offset +=8; - length_remaining -=8; - } - - /* extract frame end timestamp, 8 bytes (nsec)*/ - if (length_remaining >= 8) { - vw_endt = tvb_get_letoh64(tvb, offset); - - proto_tree_add_uint64(vw_times_tree, hf_ixveriwave_vw_endt, - tvb, offset, 8, vw_endt); - - offset +=8; - length_remaining -=8; - } - /*extract frame duration , 4 bytes*/ - if (length_remaining >= 4) { - vw_pktdur = tvb_get_letohl(tvb, offset); - - if (vw_endt >= vw_startt) { - /* Add to root summary */ - if (version == ETHERNET_PORT) { - proto_item_append_text(vw_times_ti, " (Frame duration=%u nsecs)", vw_pktdur); - proto_tree_add_uint_format(vw_times_tree, hf_ixveriwave_vw_pktdur, - tvb, offset-16, 16, vw_pktdur, - "Frame duration: %u nsec", vw_pktdur); + if (vw_endt >= vw_startt) { + /* Add to root summary */ + if (ixport_type == ETHERNET_PORT) { + proto_item_append_text(vw_times_ti, " (Frame duration=%u nsecs)", vw_pktdur); + proto_tree_add_uint(vw_times_tree, hf_ixveriwave_vw_pktdur, + tvb, offset-16, 16, vw_pktdur); + } + else { + proto_item_append_text(vw_times_ti, " (Frame duration=%u usecs)", vw_pktdur); + proto_tree_add_uint(vw_times_tree, hf_ixveriwave_vw_pktdur, + tvb, offset-16, 16, vw_pktdur); + } } else { - proto_item_append_text(vw_times_ti, " (Frame duration=%u usecs)", vw_pktdur); - proto_tree_add_uint_format(vw_times_tree, hf_ixveriwave_vw_pktdur, - tvb, offset-16, 16, vw_pktdur, - "Frame duration: %u usec", vw_pktdur); - } - } - else { - proto_tree_add_uint_format(vw_times_tree, hf_ixveriwave_vw_pktdur, - tvb, offset, 0, vw_pktdur, - "Frame duration: N/A"); + proto_tree_add_uint_format_value(vw_times_tree, hf_ixveriwave_vw_pktdur, + tvb, offset, 0, vw_pktdur, "N/A"); - /* Add to root summary */ - proto_item_append_text(vw_times_ti, " (Frame duration=N/A)"); + /* Add to root summary */ + proto_item_append_text(vw_times_ti, " (Frame duration=N/A)"); + } + + offset +=4; } + } else { //Rather then the legacy it takes care to show the Time Header for RadioTapHeader in new format + length_remaining = length; + offset +=4; + length_remaining -=4; + /*extract latency, 4 bytes*/ + if (length_remaining >= 4) { + vw_latency = tvb_get_letohl(tvb, offset); + + /* start a tree going for the various packet times */ + if (vw_latency != 0) { + vw_times_ti = proto_tree_add_float_format(common_tree, + hf_ixveriwave_vw_mslatency, + tvb, offset, 4, (float)(vw_latency/1000000.0), + "Time Header(latency %.3f msec)", + (float)(vw_latency/1000000.0)); + vw_times_tree = proto_item_add_subtree(vw_times_ti, ett_commontap_times); + + proto_tree_add_uint(vw_times_tree, hf_ixveriwave_vw_latency, tvb, offset, 4, vw_latency); + } + else + { + vw_times_ti = proto_tree_add_float_format(common_tree, + hf_ixveriwave_vw_mslatency, + tvb, offset, 4, (float)(vw_latency/1000000.0), + "Time Header"); + vw_times_tree = proto_item_add_subtree(vw_times_ti, ett_commontap_times); + + if (cmd_type != 1) { + proto_tree_add_uint_format_value(vw_times_tree, hf_ixveriwave_vw_latency, + tvb, offset, 4, vw_latency, "N/A"); + } + } + offset +=4; + length_remaining -=4; + } + + /*extract signature timestamp, 4 bytes (32 LSBs only, nsec)*/ + if (length_remaining >= 4) { + /* TODO: what should this fieldname be? */ + if (cmd_type != 1) + proto_tree_add_item(vw_times_tree, hf_ixveriwave, + tvb, offset, 4, ENC_BIG_ENDIAN); + else + proto_tree_add_item(vw_times_tree, hf_ixveriwave_vw_delay, + tvb, offset, 4, ENC_BIG_ENDIAN); + offset +=4; + length_remaining -=4; + } + + /*extract frame start timestamp, 8 bytes (nsec)*/ + if (length_remaining >= 8) { + proto_tree_add_item_ret_uint64(vw_times_tree, hf_ixveriwave_vw_startt, + tvb, offset, 8, ENC_LITTLE_ENDIAN, &vw_startt); + + offset +=8; + length_remaining -=8; + } + + /* extract frame end timestamp, 8 bytes (nsec)*/ + if (length_remaining >= 8) { + proto_tree_add_item_ret_uint64(vw_times_tree, hf_ixveriwave_vw_endt, + tvb, offset, 8, ENC_LITTLE_ENDIAN, &vw_endt); + + offset +=8; + length_remaining -=8; + } + + /*extract frame duration , 4 bytes*/ + if (length_remaining >= 4) { + vw_pktdur = tvb_get_letohl(tvb, offset); + + if (vw_endt >= vw_startt) { + /* Add to root summary */ + if (ixport_type == ETHERNET_PORT) { + proto_item_append_text(vw_times_ti, " (Frame duration=%u nsecs)", vw_pktdur); + proto_tree_add_uint(vw_times_tree, hf_ixveriwave_vw_pktdur, + tvb, offset-16, 16, vw_pktdur); + } + else { + proto_item_append_text(vw_times_ti, " (Frame duration=%u usecs)", vw_pktdur); + proto_tree_add_uint(vw_times_tree, hf_ixveriwave_vw_pktdur, + tvb, offset, 4, vw_pktdur); + } + } + else { + proto_tree_add_uint_format_value(vw_times_tree, hf_ixveriwave_vw_pktdur, + tvb, offset, 0, vw_pktdur, "N/A"); + + /* Add to root summary */ + proto_item_append_text(vw_times_ti, " (Frame duration=N/A)"); + } + + offset += 4; + } } - if (vw_times_ti) { - proto_item_set_len(vw_times_ti, offset-time_tree_offset); - } - - /* Calculate the IFG */ - - /* Check for an existing ifg value associated with the frame */ + /* + * Calculate the IFG + * Check for an existing ifg value associated with the frame + */ p_ifg_info = (ifg_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_ixveriwave, 0); if (!p_ifg_info) { @@ -486,14 +951,490 @@ dissect_ixveriwave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da p_add_proto_data(wmem_file_scope(), pinfo, proto_ixveriwave, 0, p_ifg_info); } - /* Grab the rest of the frame. */ - next_tvb = tvb_new_subset_remaining(tvb, length); + if (ver_fpga) { + p_ifg_info = (struct ifg_info *) p_get_proto_data(wmem_file_scope(), pinfo, proto_ixveriwave, 0); + switch (cmd_type) { + case 0: + vw_info_ifg = tvb_get_ntohs(tvb, offset+ VW_INFO_OFF ); + if ((vw_info_ifg & 0x0004) && !(vw_info_ifg & 0x0008)) /* If the packet is part of an A-MPDU but not the first MPDU */ + ifg_flag = 1; + else + ifg_flag = 0; + break; + case 1: + vw_info_ifg = tvb_get_letohs(tvb, offset+ VW_INFO_OFF); + if ((vw_info_ifg & 0x0400) && !(vw_info_ifg & 0x0800)) /* If the packet is part of an A-MPDU but not the first MPDU */ + ifg_flag = 1; + else + ifg_flag = 0; + break; - /* dissect the ethernet or wlan header next */ - if (version == ETHERNET_PORT) + case 4: + vw_info_ifg = tvb_get_ntohs(tvb, offset+ VW_INFO_OFF + OCTO_MODIFIED_RF_LEN); + if ((vw_info_ifg & 0x0004) && !(vw_info_ifg & 0x0008)) /* If the packet is part of an A-MPDU but not the first MPDU */ + ifg_flag = 1; + else + ifg_flag = 0; + break; + + default: + break; + } + + if (ifg_flag == 1) /* If the packet is part of an A-MPDU but not the first MPDU */ + ti = proto_tree_add_uint(common_tree, hf_ixveriwave_vw_ifg, tvb, 18, 0, 0); + else { + /*** if (p_ifg_info->ifg < IFG_MAX_VAL) ***/ + if ((gint32) p_ifg_info->ifg >= 0) + ti = proto_tree_add_uint(common_tree, hf_ixveriwave_vw_ifg, tvb, 18, 0, p_ifg_info->ifg); + else + ti = proto_tree_add_string(common_tree, hf_ixveriwave_vw_ifg_neg, tvb, 18, 0, "Cannot be determined"); + } + + PROTO_ITEM_SET_GENERATED(ti); + } + + if(cmd_type ==3 || cmd_type ==4) + { + float flttmp; + frameformat = tvb_get_guint8(tvb, offset+33)& 0x03; + legacy_type = tvb_get_guint8(tvb, offset+33)& 0x04 >>2; + + if(cmd_type ==3) + offset += 1; + + // Only RF header implementation + if (tree) { + + rfid = tvb_get_guint8(tvb, offset); + vwrft = proto_tree_add_uint(common_tree, hf_radiotap_rf_info, + tvb, offset, 76, rfid); + proto_item_append_text(vwrft, " (RFID = %u)",rfid); + vw_rfinfo_tree = proto_item_add_subtree(vwrft, ett_radiotap_rf); + + proto_tree_add_uint(vw_rfinfo_tree, + hf_radiotap_rfinfo_rfid, tvb, offset, 1, rfid); + offset += 4; + //Section for Noise + noisevalida = tvb_get_guint8(tvb, offset+65)& 0x01; + noisevalidb = tvb_get_guint8(tvb, offset+67)& 0x01; + noisevalidc = tvb_get_guint8(tvb, offset+69)& 0x01; + noisevalidd = tvb_get_guint8(tvb, offset+71)& 0x01; + + /* + noisea = (gint16) tvb_get_ntohs(tvb, offset); + //noisevalida = tvb_get_guint8(tvb, offset+65)& 0x01; + if (noisevalida == 1) + rf_infot = proto_tree_add_float_format(vw_rfinfo_tree, hf_radiotap_rfinfo_noise, + tvb, offset, 8, (float)(noisea/16.0),"Noise: A:%.2fdBm, ", (float)(noisea/16.0)); + //These are 16-bit signed numbers with four fraction bits representing NOISE in dBm. So 0xFFFF represents -1/16 dBm. + else + rf_infot = proto_tree_add_float_format(vw_rfinfo_tree, hf_radiotap_rfinfo_noise, + tvb, offset, 8, (float)(noisea/16.0),"Noise: A: N/A, ", (float)(noisea/16.0)); + rf_info_tree = proto_item_add_subtree(rf_infot, ett_rf_info); + noiseb = tvb_get_ntohs(tvb, offset+2); + noisevalidb = tvb_get_guint8(tvb, offset+67)& 0x01; + if (noisevalidb == 1) + proto_item_append_text(rf_infot, "B:%.2fdBm, ", (float)(noiseb/16.0)); + else + proto_item_append_text(rf_infot, "B: N/A, ", (float)(noiseb/16.0)); + noisec = tvb_get_ntohs(tvb, offset+4); + noisevalidc = tvb_get_guint8(tvb, offset+69)& 0x01; + if (noisevalidc == 1) + proto_item_append_text(rf_infot, "C:%.2fdBm, ", (float)(noisec/16.0)); + else + proto_item_append_text(rf_infot, "C: N/A, ", (float)(noisec/16.0)); + noised = tvb_get_ntohs(tvb, offset+6); + noisevalidd = tvb_get_guint8(tvb, offset+71)& 0x01; + if (noisevalidd == 1) + proto_item_append_text(rf_infot, "D:%.2fdBm", (float)(noised/16.0)); + else + proto_item_append_text(rf_infot, "D: N/A", (float)(noised/16.0)); + */ + + offset += 8; + //Section for SNR + //These are 16-bit signed numbers with four fraction bits in units of dB . So 0xFFFF represents -1/16 dB. + rf_infot = proto_tree_add_none_format(vw_rfinfo_tree, hf_radiotap_rfinfo_snr, tvb, offset, 8, "SNR: "); + rf_info_tree = proto_item_add_subtree(rf_infot, ett_rf_info); + + flttmp = (float)round(tvb_get_ntohs(tvb, offset) / 16.0f); + if (noisevalida == 1) + { + proto_tree_add_float(rf_info_tree, hf_radiotap_rfinfo_snr_anta, tvb, offset, 2, flttmp); + proto_item_append_text(rf_infot, "A:%.0fdB, ", flttmp); + } + else + { + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_snr_anta, tvb, offset, 2, flttmp, "N/A"); + proto_item_append_text(rf_infot, "A:N/A, "); + } + offset += 2; + flttmp = (float)round(tvb_get_ntohs(tvb, offset) / 16.0f); + if (noisevalidb == 1) + { + proto_tree_add_float(rf_info_tree, hf_radiotap_rfinfo_snr_antb, tvb, offset, 2, flttmp); + proto_item_append_text(rf_infot, "B:%.0fdB, ", flttmp); + } + else + { + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_snr_antb, tvb, offset, 2, flttmp, "N/A"); + proto_item_append_text(rf_infot, "B:N/A, "); + } + offset += 2; + flttmp = (float)round(tvb_get_ntohs(tvb, offset) / 16.0f); + if (noisevalidc == 1) + { + proto_tree_add_float(rf_info_tree, hf_radiotap_rfinfo_snr_antc, tvb, offset, 2, flttmp); + proto_item_append_text(rf_infot, "C:%.0fdB, ", flttmp); + } + else + { + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_snr_antc, tvb, offset, 2, flttmp, "N/A"); + proto_item_append_text(rf_infot, "C:N/A, "); + } + offset += 2; + flttmp = (float)round(tvb_get_ntohs(tvb, offset) / 16.0f); + if (noisevalidd == 1) + { + proto_tree_add_float(rf_info_tree, hf_radiotap_rfinfo_snr_antd, tvb, offset, 2, flttmp); + proto_item_append_text(rf_infot, "D:%.0fdB", flttmp); + } + else + { + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_snr_antd, tvb, offset, 2, flttmp, "N/A"); + proto_item_append_text(rf_infot, "D:N/A"); + } + offset += 2; + //Section for PFE + pfevalida = (tvb_get_guint8(tvb, offset+49)& 0x02) >>1; + pfevalidb = (tvb_get_guint8(tvb, offset+51)& 0x02) >>1; + pfevalidc = (tvb_get_guint8(tvb, offset+53)& 0x02) >>1; + pfevalidd = (tvb_get_guint8(tvb, offset+55)& 0x02) >>1; + rf_infot = proto_tree_add_none_format(vw_rfinfo_tree, hf_radiotap_rfinfo_pfe, + tvb, offset, 8, "PFE: "); + rf_info_tree = proto_item_add_subtree(rf_infot, ett_rf_info); + if ((frameformat == 0) && (legacy_type == 0)) + { + //The basic unit of OFDM frequency error measurement is in units of 80 MHz/2^22. + //This works out to approximately 19.073 Hz per measurement unit. + flttmp = (float)(tvb_get_ntohs(tvb, offset)*19.073); + } + else + { + //The basic unit of CCK frequency error measurement is in units of 88 MHz/2^22. + //This works out to approximately 20.981 Hz. + flttmp = (float)(tvb_get_ntohs(tvb, offset)*20.981); + } + + if (pfevalida == 1) + { + proto_item_append_text(rf_infot, "SS#1:%.0fHz, ", flttmp); + proto_tree_add_float(rf_info_tree, hf_radiotap_rfinfo_pfe_anta, + tvb, offset, 2, flttmp); + } + else + { + proto_item_append_text(rf_infot, "SS#1:N/A, "); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_pfe_anta, + tvb, offset, 2, flttmp, "N/A"); + } + offset += 2; + + if ((frameformat == 0) && (legacy_type == 0)) + { + flttmp = (float)(tvb_get_ntohs(tvb, offset)*19.073); + } + else + { + flttmp = (float)(tvb_get_ntohs(tvb, offset)*20.981); + } + if (pfevalidb == 1) + { + proto_item_append_text(rf_infot, "SS#2:%.0fHz, ", flttmp); + proto_tree_add_float(rf_info_tree, hf_radiotap_rfinfo_pfe_antb, + tvb, offset, 2, flttmp); + } + else + { + proto_item_append_text(rf_infot, "SS#2:N/A, "); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_pfe_antb, + tvb, offset, 2, flttmp, "N/A"); + } + offset += 2; + + if ((frameformat == 0) && (legacy_type == 0)) + { + flttmp = (float)(tvb_get_ntohs(tvb, offset)*19.073); + } + else + { + flttmp = (float)(tvb_get_ntohs(tvb, offset)*20.981); + } + if (pfevalidc == 1) + { + proto_item_append_text(rf_infot, "SS#3:%.0fHz, ", flttmp); + proto_tree_add_float(rf_info_tree, hf_radiotap_rfinfo_pfe_antc, + tvb, offset, 2, flttmp); + } + else + { + proto_item_append_text(rf_infot, "SS#3:N/A, "); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_pfe_antc, + tvb, offset, 2, flttmp, "N/A"); + } + offset += 2; + + if ((frameformat == 0) && (legacy_type == 0)) + { + flttmp = (float)(tvb_get_ntohs(tvb, offset)*19.073); + } + else + { + flttmp = (float)(tvb_get_ntohs(tvb, offset)*20.981); + } + if (pfevalidd == 1) + { + proto_item_append_text(rf_infot, "SS#4:%.0fHz", flttmp); + proto_tree_add_float(rf_info_tree, hf_radiotap_rfinfo_pfe_antd, + tvb, offset, 2, flttmp); + } + else + { + proto_item_append_text(rf_infot, "SS#4:N/A"); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_pfe_antd, + tvb, offset, 2, flttmp, "N/A"); + } + offset += 2; + + //AVG EVM SIG Data + rf_infot = proto_tree_add_none_format(vw_rfinfo_tree, hf_radiotap_rfinfo_sigdata, tvb, offset, 8, "AVG EVM SIG Data: "); + rf_info_tree = proto_item_add_subtree(rf_infot, ett_rf_info); + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#1:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_sd_siga, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#2:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_sd_sigb, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#3:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_sd_sigc, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#4:%.1f%%", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_sd_sigd, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + //AVG EVM SIG Pilot + rf_infot = proto_tree_add_none_format(vw_rfinfo_tree, hf_radiotap_rfinfo_sigpilot, tvb, offset, 8, "AVG EVM SIG Pilot: "); + rf_info_tree = proto_item_add_subtree(rf_infot, ett_rf_info); + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#1:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_sp_siga, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#2:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_sp_sigb, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#3:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_sp_sigc, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#4:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_sp_sigd, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + //AVG EVM DATA Data + rf_infot = proto_tree_add_none_format(vw_rfinfo_tree, hf_radiotap_rfinfo_datadata, + tvb, offset, 8, "AVG EVM DATA Data: "); + rf_info_tree = proto_item_add_subtree(rf_infot, ett_rf_info); + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#1:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_dd_siga, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#2:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_dd_sigb, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#3:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_dd_sigc, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#4:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_dd_sigd, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + //AVG EVM DATA Pilot + rf_infot = proto_tree_add_none_format(vw_rfinfo_tree, hf_radiotap_rfinfo_datapilot, + tvb, offset, 8, "AVG EVM DATA Pilot: "); + rf_info_tree = proto_item_add_subtree(rf_infot, ett_rf_info); + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#1:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_dp_siga, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#2:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_dp_sigb, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#3:%.1f%%, ", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_dp_sigc, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + flttmp = (float)(tvb_get_ntohs(tvb, offset)/512.0); + proto_item_append_text(rf_infot, "SS#4:%.1f%%", flttmp); + proto_tree_add_float_format_value(rf_info_tree, hf_radiotap_rfinfo_avg_evm_dp_sigd, + tvb, offset, 2, flttmp, "%.1f%%", flttmp); + offset += 2; + + //EVM Worst Symbol + rf_infot = proto_tree_add_item(vw_rfinfo_tree, hf_radiotap_rfinfo_avg_ws_symbol, + tvb, offset, 8, ENC_NA); + rf_info_tree = proto_item_add_subtree(rf_infot, ett_rf_info); + + proto_tree_add_item(rf_info_tree, hf_radiotap_rfinfo_avg_evm_ws_siga, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_item_append_text(rf_infot, ": SS#1:%u%%, ", tvb_get_ntohs(tvb, offset)); + offset += 2; + + proto_tree_add_item(rf_info_tree, hf_radiotap_rfinfo_avg_evm_ws_sigb, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_item_append_text(rf_infot, "SS#2:%u%%, ", tvb_get_ntohs(tvb, offset)); + offset += 2; + + proto_tree_add_item(rf_info_tree, hf_radiotap_rfinfo_avg_evm_ws_sigc, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_item_append_text(rf_infot, "SS#3:%u%%, ", tvb_get_ntohs(tvb, offset)); + offset += 2; + + proto_tree_add_item(rf_info_tree, hf_radiotap_rfinfo_avg_evm_ws_sigd, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_item_append_text(rf_infot, "SS#4:%u%%", tvb_get_ntohs(tvb, offset)); + offset += 2; + + //ContextA + ti = proto_tree_add_bitmask(rf_info_tree, tvb, offset, hf_radiotap_rfinfo_contextpa, ett_radiotap_contextp, context_a_flags, ENC_BIG_ENDIAN); + rfinfo_contextp_tree = proto_item_add_subtree(ti, ett_radiotap_contextp); + + frameformat = tvb_get_guint8(tvb, offset)& 0x03; + if (frameformat == 0) + { + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_legacytypeA, tvb, offset, 1, ENC_NA); + } + else + { + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_frameformatA, tvb, offset, 1, ENC_NA); + } + + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_sigbwevmA, tvb, offset, 1, ENC_NA); + offset += 2; + + //ContextB + ti = proto_tree_add_bitmask(rf_info_tree, tvb, offset, hf_radiotap_rfinfo_contextpb, ett_radiotap_contextp, context_b_flags, ENC_BIG_ENDIAN); + rfinfo_contextp_tree = proto_item_add_subtree(ti, ett_radiotap_contextp); + + frameformat = tvb_get_guint8(tvb, offset)& 0x03; + if (frameformat == 0) + { + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_legacytypeB, tvb, offset, 1, ENC_NA); + } + else + { + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_frameformatB, tvb, offset, 1, ENC_NA); + } + + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_sigbwevmB, tvb, offset, 1, ENC_NA); + offset += 2; + + //ContextC + ti = proto_tree_add_bitmask(vw_rfinfo_tree, tvb, offset, hf_radiotap_rfinfo_contextpc, ett_radiotap_contextp, context_c_flags, ENC_BIG_ENDIAN); + rfinfo_contextp_tree = proto_item_add_subtree(ti, ett_radiotap_contextp); + + frameformat = tvb_get_guint8(tvb, offset)& 0x03; + if (frameformat == 0) + { + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_legacytypeC, tvb, offset, 1, ENC_NA); + } + else + { + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_frameformatC, tvb, offset, 1, ENC_NA); + } + + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_sigbwevmC, tvb, offset, 1, ENC_NA); + offset += 2; + + //ContextD + ti = proto_tree_add_bitmask(vw_rfinfo_tree, tvb, offset, hf_radiotap_rfinfo_contextpd, ett_radiotap_contextp, context_d_flags, ENC_BIG_ENDIAN); + rfinfo_contextp_tree = proto_item_add_subtree(ti, ett_radiotap_contextp); + + frameformat = tvb_get_guint8(tvb, offset)& 0x03; + if (frameformat == 0) + { + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_legacytypeD, tvb, offset, 1, ENC_NA); + } + else + { + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_frameformatD, tvb, offset, 1, ENC_NA); + } + + proto_tree_add_item(rfinfo_contextp_tree, hf_radiotap_rfinfo_sigbwevmD, tvb, offset, 1, ENC_NA); + offset += 2; + } + } + if (cmd_type !=3) //only RF + { + proto_item_set_len(vw_times_ti, 28); + + /* Grab the rest of the frame. */ + if(!ver_fpga) + { + next_tvb = tvb_new_subset_remaining(tvb, length); + } + else + { + if (cmd_type ==4) //RF+Rx + next_tvb = tvb_new_subset_remaining(tvb, 108); + else + next_tvb = tvb_new_subset_remaining(tvb, 32); + } + + /* dissect the ethernet or wlan header next */ + if (ixport_type == ETHERNET_PORT) ethernettap_dissect(next_tvb, pinfo, tree, common_tree); - else - wlantap_dissect(next_tvb, pinfo, tree, common_tree, vw_msdu_length); + else + wlantap_dissect(next_tvb, pinfo, tree, common_tree,vw_msdu_length, cmd_type, mgmt_byte); + } + return tvb_captured_length(tvb); } @@ -506,29 +1447,19 @@ dissect_ixveriwave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da static void ethernettap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *tap_tree) { - proto_tree *vweft, *vw_errorFlags_tree = NULL, *vwift,*vw_infoFlags_tree = NULL; - int offset; + proto_tree *vwift,*vw_infoFlags_tree = NULL; + int offset = 0; tvbuff_t *next_tvb; guint length, length_remaining; - guint16 vw_flags, vw_info; - guint16 vw_l4id; - guint32 vw_error; - gint32 vwf_txf, vwf_fcserr; + gboolean vwf_txf = FALSE; ifg_info *p_ifg_info; proto_item *ti; - vwf_txf = 0; - - offset = 0; - /* First add the IFG information */ p_ifg_info = (struct ifg_info *) p_get_proto_data(wmem_file_scope(), pinfo, proto_ixveriwave, 0); - if (tap_tree) { - ti = proto_tree_add_uint(tap_tree, hf_ixveriwave_vw_ifg, - tvb, offset, 0, p_ifg_info->ifg); - PROTO_ITEM_SET_GENERATED(ti); - } - + ti = proto_tree_add_uint(tap_tree, hf_ixveriwave_vw_ifg, + tvb, offset, 0, p_ifg_info->ifg); + PROTO_ITEM_SET_GENERATED(ti); length = tvb_get_letohs(tvb, offset); length_remaining = length; @@ -538,16 +1469,10 @@ ethernettap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_t /* extract flags (currently use only TX/RX and FCS error flag) */ if (length >= 2) { - vw_flags = tvb_get_letohs(tvb, offset); - vwf_txf = ((vw_flags & ETHERNETTAP_VWF_TXF) == 0) ? 0 : 1; - vwf_fcserr = ((vw_flags & ETHERNETTAP_VWF_FCSERR) == 0) ? 0 : 1; - - if (tap_tree) { - proto_tree_add_uint(tap_tree, hf_ixveriwave_vwf_txf, - tvb, 0, 0, vwf_txf); - proto_tree_add_uint(tap_tree, hf_ixveriwave_vwf_fcserr, - tvb, 0, 0, vwf_fcserr); - } + proto_tree_add_item_ret_boolean(tap_tree, hf_ixveriwave_vwf_txf, + tvb, offset, 2, ENC_LITTLE_ENDIAN, &vwf_txf); + proto_tree_add_item(tap_tree, hf_ixveriwave_vwf_fcserr, + tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; length_remaining -= 2; @@ -556,26 +1481,20 @@ ethernettap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_t /*extract info flags , 2bytes*/ if (length_remaining >= 2) { - vw_info = tvb_get_letohs(tvb, offset); + vwift = proto_tree_add_item(tap_tree, hf_ixveriwave_vw_info, tvb, offset, 2, ENC_LITTLE_ENDIAN); + vw_infoFlags_tree = proto_item_add_subtree(vwift, ett_ethernettap_info); - if (tap_tree) { - vwift = proto_tree_add_uint(tap_tree, hf_ixveriwave_vw_info, - tvb, offset, 2, vw_info); - vw_infoFlags_tree = proto_item_add_subtree(vwift, ett_ethernettap_info); - - if (vwf_txf == 0) { - /* then it's an rx case */ - proto_tree_add_item(vw_infoFlags_tree, hf_ixveriwave_vw_info_rx_1_bit8, + if (vwf_txf == 0) { + /* then it's an rx case */ + proto_tree_add_item(vw_infoFlags_tree, hf_ixveriwave_vw_info_rx_1_bit8, + tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(vw_infoFlags_tree, hf_ixveriwave_vw_info_rx_1_bit9, + tvb, offset, 2, ENC_LITTLE_ENDIAN); + } else { + /* it's a tx case */ + proto_tree_add_item(vw_infoFlags_tree, hf_ixveriwave_vw_info_retryCount, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, hf_ixveriwave_vw_info_rx_1_bit9, - tvb, offset, 2, ENC_LITTLE_ENDIAN); - } else { - /* it's a tx case */ - proto_tree_add_uint_format(vw_infoFlags_tree, hf_ixveriwave_vw_info_retryCount, - tvb, offset, 2, vw_info, - "Retry count: %u ", vw_info); - } - } /*end of if tree */ + } offset +=2; length_remaining -=2; @@ -583,67 +1502,51 @@ ethernettap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_t /*extract error , 4bytes*/ if (length_remaining >= 4) { - vw_error = tvb_get_letohl(tvb, offset); + if (vwf_txf == 0) { + /* then it's an rx case */ + static const int * vw_error_rx_flags[] = { + &hf_ixveriwave_vw_error_rx_1_bit0, + &hf_ixveriwave_vw_error_rx_1_bit1, + &hf_ixveriwave_vw_error_rx_1_bit2, + &hf_ixveriwave_vw_error_rx_1_bit3, + &hf_ixveriwave_vw_error_rx_1_bit4, + &hf_ixveriwave_vw_error_rx_1_bit5, + &hf_ixveriwave_vw_error_rx_1_bit6, + &hf_ixveriwave_vw_error_rx_1_bit7, + &hf_ixveriwave_vw_error_rx_1_bit8, + &hf_ixveriwave_vw_error_rx_1_bit9, + NULL + }; - if (tap_tree) { - vweft = proto_tree_add_uint(tap_tree, hf_ixveriwave_vw_error, - tvb, offset, 4, vw_error); - vw_errorFlags_tree = proto_item_add_subtree(vweft, ett_ethernettap_error); + proto_tree_add_bitmask(tap_tree, tvb, offset, hf_ixveriwave_vw_error, ett_ethernettap_error, vw_error_rx_flags, ENC_LITTLE_ENDIAN); + } else { + /* it's a tx case */ + static const int * vw_error_tx_flags[] = { + &hf_ixveriwave_vw_error_tx_bit1, + &hf_ixveriwave_vw_error_tx_bit5, + &hf_ixveriwave_vw_error_tx_bit9, + &hf_ixveriwave_vw_error_tx_bit10, + &hf_ixveriwave_vw_error_tx_bit11, + NULL + }; - if (vwf_txf == 0) { - /* then it's an rx case */ - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit0, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit1, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit2, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit3, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit4, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit5, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit6, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit7, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit8, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_rx_1_bit9, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - } else { - /* it's a tx case */ - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_tx_bit1, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_tx_bit5, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_tx_bit9, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_tx_bit10, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_errorFlags_tree, hf_ixveriwave_vw_error_tx_bit11, - tvb, offset, 4, ENC_LITTLE_ENDIAN); - } - } /*end of if (tap_tree) */ + proto_tree_add_bitmask(tap_tree, tvb, offset, hf_ixveriwave_vw_error, ett_ethernettap_error, vw_error_tx_flags, ENC_LITTLE_ENDIAN); + } offset +=4; length_remaining -=4; } /*extract l4id , 4bytes*/ if (length_remaining >= 4) { - vw_l4id = tvb_get_letohl(tvb, offset); - if (tap_tree) { - proto_tree_add_uint(tap_tree, hf_ixveriwave_vw_l4id, - tvb, offset, 4, vw_l4id); - } + proto_tree_add_item(tap_tree, hf_ixveriwave_vw_l4id, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset +=4; length_remaining -=4; } /*extract pad, 4bytes*/ if (length_remaining >= 4) { - tvb_get_letohl(tvb, offset); /* throw away pad */ + /* throw away pad */ } /* Grab the rest of the frame. */ @@ -654,27 +1557,37 @@ ethernettap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_t } static void -wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *tap_tree, guint16 vw_msdu_length) +wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *tap_tree, guint16 vw_msdu_length, guint8 cmd_type, guint8 mgmt_byte) { proto_tree *ft, *flags_tree = NULL; + proto_item *hdr_fcs_ti = NULL; int align_offset, offset; + guint32 calc_fcs; tvbuff_t *next_tvb; guint length; gint8 dbm; - guint8 plcp_type; - guint8 mcs_index; - guint8 nss; + guint8 rflags = 0; + guint8 mcs_index, vw_plcp_info, vw_bssid; + guint8 plcp_type, vht_u3_coding_type = 0, vht_reserved_coding_type=1; guint8 vht_ndp_flag,vht_mu_mimo_flg,vht_coding_type,vht_u0_coding_type,vht_u1_coding_type,vht_u2_coding_type; float phyRate; guint i; - proto_tree *vweft, *vw_errorFlags_tree = NULL, *vwift,*vw_infoFlags_tree = NULL; - guint16 vw_flags, vw_chanflags, vw_info, vw_ht_length, vht_su_partial_id, vw_rflags; + proto_tree *vweft, *vw_errorFlags_tree = NULL, *vwict,*vw_infoC_tree = NULL; + guint16 vw_info, vw_chanflags, vw_flags, vw_ht_length, vht_su_partial_id,vw_rflags,vw_vcid, vw_seqnum, mpdu_length, vht_length, crc16, vht_plcp_length, plcp_service_ofdm; guint32 vw_errors; - guint8 vht_grp_id1, vht_grp_id2, vht_grp_id, vht_su_nsts,vht_beamformed,vht_user_pos,vht_u0_nsts,vht_u1_nsts,vht_u2_nsts,vht_u3_nsts,vht_su_partial_id1,vht_su_partial_id2; + guint8 vht_grp_id, vht_grp_id1, vht_grp_id2, vht_su_nsts,vht_beamformed,vht_user_pos,vht_su_partial_id1,vht_su_partial_id2; + guint32 vht_u0_nsts,vht_u1_nsts,vht_u2_nsts,vht_u3_nsts; + guint8 vht_bw, vht_stbc, vht_txop_ps_notallowd, vht_shortgi, vht_shortginsymdisa, vht_ldpc_ofdmsymbol, vht_su_mcs, vht_crc1, vht_crc2, vht_crc, vht_tail, rfid; + guint8 vht_mcs1, vht_mcs2, vht_mcs, vht_plcp_length1, vht_plcp_length2, vht_plcp_length3, vht_rate, vht_parity; + guint8 feccoding, aggregation, notsounding, smoothing, ness, plcp_service, signal, plcp_default; + guint8 ver_fpga, log_mode; ifg_info *p_ifg_info; proto_item *ti; + proto_tree *vwl1t,*vw_l1info_tree = NULL, *vwl2l4t,*vw_l2l4info_tree = NULL, *vwplt,*vw_plcpinfo_tree = NULL; + guint8 preamble, nss, direction, sigbw, cidv, bssidv, flowv, l4idv; + struct ieee_802_11_phdr phdr; /* We don't have any 802.11 metadata yet. */ @@ -684,100 +1597,103 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree phdr.datapad = FALSE; phdr.phy = PHDR_802_11_PHY_UNKNOWN; - /* First add the IFG information, need to grab the info bit field here */ - vw_info = tvb_get_letohs(tvb, 20); - p_ifg_info = (struct ifg_info *) p_get_proto_data(wmem_file_scope(), pinfo, proto_ixveriwave, 0); - if (tap_tree) { + //mgmt_bytes = tvb_get_letohs(tvb, offset); + //1st octet are as command type((7..4 bits)which indicates as Tx, Rx or RF frame) & port type((3..0 bits)ethernet or wlantap). + //Command type Rx = 0, Tx = 1, RF = 3 , RF_RX = 4 + //2nd octet are as Reduce logging(7..4 bits) & fpga version(3..0 bits). + //log mode = 0 is normal capture and 1 is reduced capture + //FPGA version = 1 for OCTO versions + //OCTO version like 48, 61, 83 + log_mode = (mgmt_byte & 0xf0) >> 4; + ver_fpga = mgmt_byte & 0x0f; + + if (!ver_fpga) + { + /* First add the IFG information, need to grab the info bit field here */ + vw_info = tvb_get_letohs(tvb, 20); + p_ifg_info = (struct ifg_info *) p_get_proto_data(wmem_file_scope(), pinfo, proto_ixveriwave, 0); if ((vw_info & INFO_MPDU_OF_A_MPDU) && !(vw_info & INFO_FIRST_MPDU_OF_A_MPDU)) /* If the packet is part of an A-MPDU but not the first MPDU */ ti = proto_tree_add_uint(tap_tree, hf_ixveriwave_vw_ifg, tvb, 18, 0, 0); else ti = proto_tree_add_uint(tap_tree, hf_ixveriwave_vw_ifg, tvb, 18, 0, p_ifg_info->ifg); PROTO_ITEM_SET_GENERATED(ti); - } - offset = 0; + offset = 0; + length = tvb_get_letohs(tvb, offset); + offset += 2; - /* Length of the metadata header */ - length = tvb_get_letohs(tvb, offset); - offset += 2; + vw_rflags = tvb_get_letohs(tvb, offset); + if (vw_rflags & FLAGS_FCS) + phdr.fcs_len = 4; + else + phdr.fcs_len = 0; - vw_rflags = tvb_get_letohs(tvb, offset); - if (vw_rflags & FLAGS_FCS) - phdr.fcs_len = 4; - else - phdr.fcs_len = 0; - if (tap_tree) { - ft = proto_tree_add_uint(tap_tree, hf_radiotap_flags, tvb, offset, 2, vw_rflags); + ft = proto_tree_add_item(tap_tree, hf_radiotap_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN); flags_tree = proto_item_add_subtree(ft, ett_radiotap_flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_preamble, - tvb, offset, 2, vw_rflags); - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_wep, - tvb, offset, 2, vw_rflags); - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_fcs_present, - tvb, offset, 2, vw_rflags); + proto_tree_add_item(flags_tree, hf_radiotap_flags_cfp, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_preamble, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_wep, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_frag, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_fcs, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_datapad, tvb, offset, 2, ENC_LITTLE_ENDIAN); if ( vw_rflags & FLAGS_CHAN_HT ) { - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_ht, - tvb, offset, 2, vw_rflags); - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_40mhz, - tvb, offset, 2, vw_rflags); - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_shortgi, - tvb, offset, 2, vw_rflags); + proto_tree_add_item(flags_tree, hf_radiotap_flags_ht, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_40mhz, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_shortgi, tvb, offset, 2, ENC_LITTLE_ENDIAN); } if ( vw_rflags & FLAGS_CHAN_VHT ) { - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_vht, - tvb, offset, 2, vw_rflags); - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_shortgi, - tvb, offset, 2, vw_rflags); - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_40mhz, - tvb, offset, 2, vw_rflags); - proto_tree_add_boolean(flags_tree, hf_radiotap_flags_80mhz, - tvb, offset, 2, vw_rflags); + proto_tree_add_item(flags_tree, hf_radiotap_flags_vht, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_shortgi, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_40mhz, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(flags_tree, hf_radiotap_flags_80mhz, tvb, offset, 2, ENC_LITTLE_ENDIAN); } - } - offset += 2; + offset += 2; - vw_chanflags = tvb_get_letohs(tvb, offset); - offset += 2; - phyRate = (float)tvb_get_letohs(tvb, offset) / 10; - offset += 2; - plcp_type = tvb_get_guint8(tvb,offset) & 0x03; - vht_ndp_flag = tvb_get_guint8(tvb,offset) & 0x80; - offset++; + /* Need to add in 2 more bytes to the offset to account for the channel flags */ + vw_chanflags = tvb_get_letohs(tvb, offset); + offset += 2; + phyRate = (float)tvb_get_letohs(tvb, offset) / 10; + offset += 2; + plcp_type = tvb_get_guint8(tvb,offset) & 0x03; + vht_ndp_flag = tvb_get_guint8(tvb,offset) & 0x80; + offset++; - mcs_index = tvb_get_guint8(tvb, offset); - offset++; - nss = tvb_get_guint8(tvb, offset); - offset++; + vw_flags = tvb_get_letohs(tvb, 16); /**extract the transmit/rcvd direction flag**/ - if ((vw_rflags & FLAGS_CHAN_HT) || (vw_rflags & FLAGS_CHAN_VHT)) { - if (vw_rflags & FLAGS_CHAN_VHT) { - phdr.phy = PHDR_802_11_PHY_11AC; - phdr.phy_info.info_11ac.has_short_gi = TRUE; - phdr.phy_info.info_11ac.short_gi = ((vw_rflags & FLAGS_CHAN_SHORTGI) != 0); - /* - * XXX - this probably has only one user, so only one MCS index - * and only one NSS. - */ - phdr.phy_info.info_11ac.nss[0] = nss; - phdr.phy_info.info_11ac.mcs[0] = mcs_index; - for (i = 1; i < 4; i++) - phdr.phy_info.info_11ac.nss[i] = 0; - } else { - /* - * XXX - where's the number of extension spatial streams? - * The code in wiretap/vwr.c doesn't seem to provide it. - */ - phdr.phy = PHDR_802_11_PHY_11N; - phdr.phy_info.info_11n.has_mcs_index = TRUE; - phdr.phy_info.info_11n.mcs_index = mcs_index; + mcs_index = tvb_get_guint8(tvb, offset); + offset++; + nss = tvb_get_guint8(tvb, offset); + offset++; - phdr.phy_info.info_11n.has_short_gi = TRUE; - phdr.phy_info.info_11n.short_gi = ((vw_rflags & FLAGS_CHAN_SHORTGI) != 0); + if ((vw_rflags & FLAGS_CHAN_HT) || (vw_rflags & FLAGS_CHAN_VHT)) { + if (vw_rflags & FLAGS_CHAN_VHT) { + phdr.phy = PHDR_802_11_PHY_11AC; + phdr.phy_info.info_11ac.has_short_gi = TRUE; + phdr.phy_info.info_11ac.short_gi = ((vw_rflags & FLAGS_CHAN_SHORTGI) != 0); + /* + * XXX - this probably has only one user, so only one MCS index + * and only one NSS. + */ + phdr.phy_info.info_11ac.nss[0] = nss; + phdr.phy_info.info_11ac.mcs[0] = mcs_index; + for (i = 1; i < 4; i++) + phdr.phy_info.info_11ac.nss[i] = 0; + } else { + /* + * XXX - where's the number of extension spatial streams? + * The code in wiretap/vwr.c doesn't seem to provide it. + */ + phdr.phy = PHDR_802_11_PHY_11N; + phdr.phy_info.info_11n.has_mcs_index = TRUE; + phdr.phy_info.info_11n.mcs_index = mcs_index; + + phdr.phy_info.info_11n.has_short_gi = TRUE; + phdr.phy_info.info_11n.short_gi = ((vw_rflags & FLAGS_CHAN_SHORTGI) != 0); + + phdr.phy_info.info_11n.has_greenfield = TRUE; + phdr.phy_info.info_11n.greenfield = (plcp_type == PLCP_TYPE_GREENFIELD); + } - phdr.phy_info.info_11n.has_greenfield = TRUE; - phdr.phy_info.info_11n.greenfield = (plcp_type == PLCP_TYPE_GREENFIELD); - } - if (tap_tree) { proto_tree_add_item(tap_tree, hf_radiotap_mcsindex, tvb, offset - 2, 1, ENC_BIG_ENDIAN); @@ -785,157 +1701,124 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree tvb, offset - 1, 1, ENC_BIG_ENDIAN); proto_tree_add_uint_format_value(tap_tree, hf_radiotap_datarate, - tvb, offset - 5, 2, tvb_get_letohs(tvb, offset-5), - "%.1f (MCS %d)", phyRate, mcs_index); - } - } else { - /* - * XXX - CHAN_OFDM could be 11a or 11g. Unfortunately, we don't - * have the frequency, or anything else, to distinguish between - * them. - */ - if (vw_chanflags & CHAN_CCK) { - phdr.phy = PHDR_802_11_PHY_11B; - } - phdr.has_data_rate = TRUE; - phdr.data_rate = tvb_get_letohs(tvb, offset-5) / 5; - if (tap_tree) { - proto_tree_add_uint_format_value(tap_tree, hf_radiotap_datarate, - tvb, offset - 5, 2, tvb_get_letohs(tvb, offset-5), - "%.1f Mb/s", phyRate); - } - } - col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%.1f", phyRate); - - dbm = (gint8) tvb_get_guint8(tvb, offset); - phdr.has_signal_dbm = TRUE; - phdr.signal_dbm = dbm; - col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm); - if (tap_tree) { - proto_tree_add_int(tap_tree, - hf_radiotap_dbm_antsignal, - tvb, offset, 1, dbm); - } - - offset++; - dbm = (gint8) tvb_get_guint8(tvb, offset); - if (tap_tree && dbm != 100) { - proto_tree_add_int(tap_tree, - hf_radiotap_dbm_antb, - tvb, offset, 1, dbm); - } - offset++; - dbm = (gint8) tvb_get_guint8(tvb, offset); - if (tap_tree && dbm != 100) { - proto_tree_add_int(tap_tree, - hf_radiotap_dbm_antc, - tvb, offset, 1, dbm); - } - offset++; - dbm = (gint8) tvb_get_guint8(tvb, offset); - if (tap_tree && dbm != 100) { - proto_tree_add_int(tap_tree, - hf_radiotap_dbm_antd, - tvb, offset, 1, dbm); - } - offset+=2; - - vw_flags = tvb_get_letohs(tvb, offset); - - if (tap_tree) { - if ((vw_rflags & FLAGS_CHAN_HT) || (vw_rflags & FLAGS_CHAN_VHT)) { - if (plcp_type == PLCP_TYPE_VHT_MIXED) { - if (!(vw_flags & VW_RADIOTAPF_TXF) && (vht_ndp_flag == 0x80)) { - /*** VHT-NDP rx frame and ndp_flag is set***/ - proto_tree_add_uint_format(tap_tree, hf_radiotap_plcptype, - tvb, offset-3, 1, plcp_type, - "VHT-NDP"); - } else { - /*** VHT-NDP transmitted frame ***/ - if (vw_msdu_length == 4) { /*** Transmit frame and msdu_length = 4***/ - proto_tree_add_uint_format(tap_tree, hf_radiotap_plcptype, - tvb, offset-3, 1, plcp_type, - "VHT-NDP"); + tvb, offset - 5, 2, tvb_get_letohs(tvb, offset-5), + "%.1f (MCS %d)", phyRate, mcs_index); + } else { + /* + * XXX - CHAN_OFDM could be 11a or 11g. Unfortunately, we don't + * have the frequency, or anything else, to distinguish between + * them. + */ + if (vw_chanflags & CHAN_CCK) { + phdr.phy = PHDR_802_11_PHY_11B; } - } + phdr.has_data_rate = TRUE; + phdr.data_rate = tvb_get_letohs(tvb, offset-5) / 5; + + proto_tree_add_uint_format_value(tap_tree, hf_radiotap_datarate, + tvb, offset - 5, 2, tvb_get_letohs(tvb, offset-5), + "%.1f Mb/s", phyRate); } - } + col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%.1f", phyRate); - proto_tree_add_uint(tap_tree, hf_radiotap_vwf_txf, - tvb, offset, 2, (vw_flags & VW_RADIOTAPF_TXF) != 0); - proto_tree_add_uint(tap_tree, hf_radiotap_vwf_fcserr, - tvb, offset, 2, (vw_flags & VW_RADIOTAPF_FCSERR) != 0); - proto_tree_add_uint(tap_tree, hf_radiotap_vwf_dcrerr, - tvb, offset, 2, (vw_flags & VW_RADIOTAPF_DCRERR) != 0); - proto_tree_add_uint(tap_tree, hf_radiotap_vwf_retrerr, - tvb, offset, 2, (vw_flags & VW_RADIOTAPF_RETRERR) != 0); - proto_tree_add_uint(tap_tree, hf_radiotap_vwf_enctype, - tvb, offset, 2, (vw_flags & VW_RADIOTAPF_ENCMSK) >> - VW_RADIOTAPF_ENCSHIFT); - } + dbm = (gint8) tvb_get_guint8(tvb, offset); + phdr.has_signal_dbm = TRUE; + phdr.signal_dbm = dbm; + col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm); - offset += 2; + proto_tree_add_item(tap_tree, hf_radiotap_dbm_anta, tvb, offset, 1, ENC_NA); + offset++; - align_offset = ALIGN_OFFSET(offset, 2); - offset += align_offset; + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (dbm != 100) { + proto_tree_add_item(tap_tree, hf_radiotap_dbm_antb, tvb, offset, 1, ENC_NA); + } + offset++; + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (dbm != 100) { + proto_tree_add_item(tap_tree, hf_radiotap_dbm_antc, tvb, offset, 1, ENC_NA); + } + offset++; + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (dbm != 100) { + proto_tree_add_item(tap_tree, hf_radiotap_dbm_antd, tvb, offset, 1, ENC_NA); + } + offset+=2; - vw_ht_length = tvb_get_letohs(tvb, offset); - if ((tree) && (vw_ht_length != 0)) { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vw_ht_length, - tvb, offset, 2, vw_ht_length, "HT length: %u (includes the sum of the pieces of the aggregate and their respective Start_Spacing + Delimiter + MPDU + Padding)", - vw_ht_length); - } - offset += 2; + vw_flags = tvb_get_letohs(tvb, offset); - align_offset = ALIGN_OFFSET(offset, 2); - offset += align_offset; + if ((vw_rflags & FLAGS_CHAN_HT) || (vw_rflags & FLAGS_CHAN_VHT)) { + if (plcp_type == PLCP_TYPE_VHT_MIXED) { + if (!(vw_flags & VW_RADIOTAPF_TXF) && (vht_ndp_flag == 0x80)) { + /*** VHT-NDP rx frame and ndp_flag is set***/ + proto_tree_add_uint(tap_tree, hf_radiotap_plcptype, + tvb, offset-3, 1, plcp_type); + } else { + /*** VHT-NDP transmitted frame ***/ + if (vw_msdu_length == 4) { /*** Transmit frame and msdu_length = 4***/ + proto_tree_add_uint(tap_tree, hf_radiotap_plcptype, + tvb, offset-3, 1, plcp_type); + } + } + } + } - /* vw_info grabbed in the beginning of the dissector */ + proto_tree_add_item(tap_tree, hf_radiotap_vwf_txf, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tap_tree, hf_radiotap_vwf_fcserr, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tap_tree, hf_radiotap_vwf_dcrerr, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tap_tree, hf_radiotap_vwf_retrerr, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tap_tree, hf_radiotap_vwf_enctype, tvb, offset, 2, ENC_LITTLE_ENDIAN); - if (tap_tree) { - vwift = proto_tree_add_uint(tap_tree, hf_radiotap_vw_info, - tvb, offset, 2, vw_info); - vw_infoFlags_tree = proto_item_add_subtree(vwift, ett_radiotap_info); + offset += 2; + + align_offset = ALIGN_OFFSET(offset, 2); + offset += align_offset; + + vw_ht_length = tvb_get_letohs(tvb, offset); + if ((vw_ht_length != 0)) { + proto_tree_add_uint_format_value(tap_tree, hf_radiotap_vw_ht_length, + tvb, offset, 2, vw_ht_length, "%u (includes the sum of the pieces of the aggregate and their respective Start_Spacing + Delimiter + MPDU + Padding)", + vw_ht_length); + } + offset += 2; + + align_offset = ALIGN_OFFSET(offset, 2); + offset += align_offset; if (!(vw_flags & VW_RADIOTAPF_TXF)) { /* then it's an rx case */ /*FPGA_VER_vVW510021 version decodes */ + static const int * vw_info_rx_2_flags[] = { + &hf_radiotap_vw_info_rx_2_bit8, + &hf_radiotap_vw_info_rx_2_bit9, + &hf_radiotap_vw_info_rx_2_bit10, + &hf_radiotap_vw_info_rx_2_bit11, + &hf_radiotap_vw_info_rx_2_bit12, + &hf_radiotap_vw_info_rx_2_bit13, + &hf_radiotap_vw_info_rx_2_bit14, + &hf_radiotap_vw_info_rx_2_bit15, + NULL + }; + + proto_tree_add_bitmask(tap_tree, tvb, offset, hf_radiotap_vw_info, ett_radiotap_info, vw_info_rx_2_flags, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_rx_2_bit8, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_rx_2_bit9, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_rx_2_bit10, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_rx_2_bit11, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_rx_2_bit12, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_rx_2_bit13, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_rx_2_bit14, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_rx_2_bit15, tvb, offset, 2, ENC_LITTLE_ENDIAN); } else { /* it's a tx case */ - /* FPGA_VER_vVW510021 and VW_FPGA_VER_vVW510006 tx info decodes same*/ - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_tx_bit10, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_tx_bit11, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_tx_bit12, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_tx_bit13, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_tx_bit14, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(vw_infoFlags_tree, - hf_radiotap_vw_info_tx_bit15, tvb, offset, 2, ENC_LITTLE_ENDIAN); - } - } - offset += 2; + static const int * vw_info_tx_2_flags[] = { + &hf_radiotap_vw_info_tx_2_bit10, + &hf_radiotap_vw_info_tx_2_bit11, + &hf_radiotap_vw_info_tx_2_bit12, + &hf_radiotap_vw_info_tx_2_bit13, + &hf_radiotap_vw_info_tx_2_bit14, + &hf_radiotap_vw_info_tx_2_bit15, + NULL + }; + + /* FPGA_VER_vVW510021 and VW_FPGA_VER_vVW510006 tx info decodes same*/ + proto_tree_add_bitmask(tap_tree, tvb, offset, hf_radiotap_vw_info, ett_radiotap_info, vw_info_tx_2_flags, ENC_LITTLE_ENDIAN); + } + offset += 2; + + vw_errors = tvb_get_letohl(tvb, offset); - vw_errors = tvb_get_letohl(tvb, offset); - if (tap_tree) { vweft = proto_tree_add_uint(tap_tree, hf_radiotap_vw_errors, tvb, offset, 4, vw_errors); vw_errorFlags_tree = proto_item_add_subtree(vweft, ett_radiotap_errors); @@ -982,248 +1865,1122 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree hf_radiotap_vw_errors_tx_bit5, tvb, offset, 2, ENC_LITTLE_ENDIAN); } + offset += 4; + + /*** POPULATE THE AMSDU VHT MIXED MODE CONTAINER FORMAT ***/ + if ((vw_rflags & FLAGS_CHAN_VHT) && vw_ht_length != 0) + { + if (plcp_type == 0x03) //If the frame is VHT type + { + offset += 4; /*** 4 bytes of ERROR ***/ + + /*** Extract SU/MU MIMO flag from RX L1 Info ***/ + vht_user_pos = tvb_get_guint8(tvb, offset); + vht_mu_mimo_flg = (vht_user_pos & 0x08) >> 3; + + if (vht_mu_mimo_flg == 1) { + proto_tree_add_item(tap_tree, hf_radiotap_vht_mu_mimo_flg, tvb, offset, 1, ENC_NA); + + /*** extract user Position in case of mu-mimo ***/ + proto_tree_add_item(tap_tree, hf_radiotap_vht_user_pos, tvb, offset, 1, ENC_NA); + + } else { + proto_tree_add_item(tap_tree, hf_radiotap_vht_su_mimo_flg, tvb, offset, 1, ENC_NA); + } + offset += 1; /*** skip the RX L1 Info byte ****/ + + /* + * XXX - no, 3 bytes are for the L-SIG. + */ + offset += 3; /** 3 bytes are for HT length ***/ + + /* + * Beginning of VHT-SIG-A1, 24 bits. + * XXX - get STBC from the 0x08 bit of the first byte + * and BW from the 0x03 bits? + */ + /* vht_grp_id = tvb_get_letohs(tvb, offset); */ + vht_grp_id1 = tvb_get_guint8(tvb, offset); + vht_grp_id2 = tvb_get_guint8(tvb, offset+1); + vht_grp_id = ((vht_grp_id1 &0xF0) >> 4) + ((vht_grp_id2 &0x03) << 4); + phdr.phy_info.info_11ac.has_group_id = TRUE; + phdr.phy_info.info_11ac.group_id = vht_grp_id; + proto_tree_add_uint(tap_tree, hf_radiotap_vht_grp_id, tvb, offset, 2, vht_grp_id); + + if ((vht_grp_id == 0) || (vht_grp_id == 63)) /*** SU VHT type*/ + { + proto_tree_add_item(tap_tree, hf_radiotap_vht_su_nsts, tvb, offset+1, 1, ENC_NA); + + /* Skip to second byte of VHT-SIG-A1 */ + offset += 1; /*** to decode partial id ***/ + vht_su_partial_id1 = tvb_get_guint8(tvb,offset); + vht_su_partial_id2 = tvb_get_guint8(tvb,offset+1); + vht_su_partial_id = ((vht_su_partial_id1 &0xE0) >> 5) + ((vht_su_partial_id2 &0x3f) << 3); + phdr.phy_info.info_11ac.has_partial_aid = TRUE; + phdr.phy_info.info_11ac.partial_aid = vht_su_partial_id; + proto_tree_add_item(tap_tree, hf_radiotap_vht_su_partial_aid, tvb, offset, 2, ENC_LITTLE_ENDIAN); + } + else { + /*** The below is MU VHT type**/ + proto_tree_add_item_ret_uint(tap_tree, hf_radiotap_vht_u0_nsts, tvb, offset, 2, ENC_LITTLE_ENDIAN, &vht_u0_nsts); + proto_tree_add_item_ret_uint(tap_tree, hf_radiotap_vht_u1_nsts, tvb, offset, 2, ENC_LITTLE_ENDIAN, &vht_u1_nsts); + proto_tree_add_item_ret_uint(tap_tree, hf_radiotap_vht_u2_nsts, tvb, offset, 2, ENC_LITTLE_ENDIAN, &vht_u2_nsts); + proto_tree_add_item_ret_uint(tap_tree, hf_radiotap_vht_u3_nsts, tvb, offset, 2, ENC_LITTLE_ENDIAN, &vht_u3_nsts); + } + + /* + * Skip past the other 2 bytes of VHT-SIG-A1. + * + * XXX - extract TXOP_PS_NOT_ALLOWED from the third byte of + * the VHT-SIG-A1 structure? + */ + offset += 2; + + /* + * Beginning of VHT-SIG-A2, 24 bits. + * + * XXX - extract Short GI NSYM Disambiguation from the first + * byte? + */ + + /*** extract LDPC or BCC coding *****/ + vht_coding_type = tvb_get_guint8(tvb, offset); + vht_u0_coding_type = ((vht_coding_type & 0x04) >> 2); + /*vht_su_coding_type = vht_u0_coding_type; */ + if ((vht_grp_id == 0) || (vht_grp_id == 63)) /*** SU VHT type*/ + { + if (vht_u0_coding_type == 0) { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, + tvb, offset, 1, vht_u0_coding_type, "VHT BCC Coding : %u ",vht_u0_coding_type); + } + else { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, + tvb, offset, 1, vht_u0_coding_type, "VHT LDPC Coding : %u ",vht_u0_coding_type); + } + /*** extract SU-MIMO VHT MCS ******/ + /***** + vht_su_mcs = tvb_get_guint8(tvb, offset); + vht_su_mcs = ((vht_su_mcs & 0xF0) >> 4); + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_su_mcs, + tvb, offset, 1, vht_su_mcs, "VHT SU MCS : %u ",vht_su_mcs); + *******/ + } else { + /*** it is MU MIMO type BCC coding ****/ + /*** extract U0 Coding ***/ + if (vht_u0_nsts) { + if (vht_u0_coding_type == 0) { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, + tvb, offset, 1, vht_u0_coding_type, "VHT U0 BCC Coding : %u ",vht_u0_coding_type); + } else { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, + tvb, offset, 1, vht_u0_coding_type, "VHT U0 LDPC Coding : %u ",vht_u0_coding_type); + } + } else { + /*** reserved **/ + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, + tvb, offset, 1, vht_u0_coding_type, "VHT U0 Reserved Coding : %u ",vht_u0_coding_type); + } + /*** extract U1 Coding type***/ + vht_u1_coding_type = ((vht_coding_type & 0x10) >> 4); + if (vht_u1_nsts) { + if (vht_u1_coding_type == 0) { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u1_coding_type, + tvb, offset, 1, vht_u1_coding_type, "VHT U1 BCC Coding : %u ",vht_u1_coding_type); + } else { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u1_coding_type, + tvb, offset, 1, vht_u1_coding_type, "VHT U1 LDPC Coding : %u ",vht_u1_coding_type); + } + } else { + /*** Reserved **/ + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u1_coding_type, + tvb, offset, 1, vht_u1_coding_type, "VHT U1 Reserved Coding : %u ",vht_u1_coding_type); + } + + /*** extract U2 Coding type***/ + vht_u2_coding_type = ((vht_coding_type & 0x20) >> 5); + if (vht_u2_nsts) { + if (vht_u2_coding_type == 0) { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u2_coding_type, + tvb, offset, 1, vht_u2_coding_type, "VHT U2 BCC Coding : %u ",vht_u2_coding_type); + } else { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u2_coding_type, + tvb, offset, 1, vht_u2_coding_type, "VHT U2 LDPC Coding : %u ",vht_u2_coding_type); + } + } else { + /**** Reserved *******/ + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u2_coding_type, + tvb, offset, 1, vht_u2_coding_type, "VHT U2 Reserved Coding : %u ",vht_u2_coding_type); + } + + /*** extract U3 Coding type***/ + if (vht_u3_nsts == 1) { + //guint vht_u3_coding_type; + + vht_u3_coding_type = ((vht_coding_type & 0x40) >> 6); + if (vht_u3_coding_type == 0) { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u3_coding_type, + tvb, offset, 1, vht_u3_coding_type, "VHT U3 BCC Coding : %u ",vht_u3_coding_type); + } else { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u3_coding_type, + tvb, offset, 1, vht_u3_coding_type, "VHT U3 LDPC Coding : %u ",vht_u3_coding_type); + } + } + } + + /*** decode Beamformed bit ****/ + offset += 1; + vht_beamformed = tvb_get_guint8(tvb, offset) & 0x01; + phdr.phy_info.info_11ac.has_beamformed = TRUE; + phdr.phy_info.info_11ac.beamformed = vht_beamformed; + proto_tree_add_item(tap_tree, hf_radiotap_vht_beamformed, tvb, offset, 1, ENC_NA); + } + } } - offset += 4; + else { + //RadioTapHeader New format for L1Info + offset = 0; - /* - * XXX - this appears to be the NDP flag for received frames and 0 - * for transmitted frames. The PLCP header follows it. - */ + length = tvb_get_letohs(tvb, offset); + offset += 2; - /*** POPULATE THE AMSDU VHT MIXED MODE CONTAINER FORMAT ***/ - if ((vw_rflags & FLAGS_CHAN_VHT) && vw_ht_length != 0) { - /*** Extract SU/MU MIMO flag from RX L1 Info ***/ - vht_user_pos = tvb_get_guint8(tvb, offset); - vht_mu_mimo_flg = (vht_user_pos & 0x08) >> 3; + if (tvb_get_guint8(tvb, offset+1) & 0x01) + vwl1t = proto_tree_add_item(tap_tree, hf_radiotap_tx, tvb, offset, 12, ENC_NA); + else + vwl1t = proto_tree_add_item(tap_tree, hf_radiotap_rx, tvb, offset, 12, ENC_NA); + vw_l1info_tree = proto_item_add_subtree(vwl1t, ett_radiotap_layer1); - if (vht_mu_mimo_flg == 1) { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_mu_mimo_flg, - tvb, offset, 1, vht_mu_mimo_flg, "VHT MU MIMO: %u ",vht_mu_mimo_flg); + preamble = (tvb_get_guint8(tvb, offset) & 0x40) >> 6; + plcp_type = tvb_get_guint8(tvb, offset+4) & 0x0f; + if (plcp_type == 3) + mcs_index = tvb_get_guint8(tvb, offset) & 0x0f; + else + mcs_index = tvb_get_guint8(tvb, offset) & 0x3f; - /*** extract user Position in case of mu-mimo ***/ - vht_user_pos = (vht_user_pos & 0x03); - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_user_pos, - tvb, offset, 1, vht_user_pos, "VHT User Pos: %u ",vht_user_pos); + proto_tree_add_uint(vw_l1info_tree, hf_radiotap_preamble, + tvb, offset, 1, preamble); + proto_tree_add_uint(vw_l1info_tree, hf_radiotap_mcsindex, + tvb, offset, 1, mcs_index); + offset++; - } else { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_mu_mimo_flg, - tvb, offset, 1, vht_mu_mimo_flg, "VHT SU MIMO: %u ",vht_mu_mimo_flg); - } - offset += 1; /*** skip the RX L1 Info byte ****/ + nss = (tvb_get_guint8(tvb, offset) & 0xf0) >> 4; + direction = tvb_get_guint8(tvb, offset) & 0x01; - /* - * XXX - no, 3 bytes are for the L-SIG. - */ - offset += 3; /** 3 bytes are for HT length ***/ + if (plcp_type) + proto_tree_add_uint(vw_l1info_tree, hf_radiotap_nss, tvb, offset, 1, nss); - /* - * Beginning of VHT-SIG-A1, 24 bits. - * XXX - get STBC from the 0x08 bit of the first byte - * and BW from the 0x03 bits? - */ - /* vht_grp_id = tvb_get_letohs(tvb, offset); */ - vht_grp_id1 = tvb_get_guint8(tvb, offset); - vht_grp_id2 = tvb_get_guint8(tvb, offset+1); - vht_grp_id = ((vht_grp_id1 &0xF0) >> 4) + ((vht_grp_id2 &0x03) << 4); - phdr.phy_info.info_11ac.has_group_id = TRUE; - phdr.phy_info.info_11ac.group_id = vht_grp_id; - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_grp_id, - tvb, offset, 2, vht_grp_id, "VHT Group Id: %u ",vht_grp_id); + proto_tree_add_uint(vw_l1info_tree, hf_radiotap_vwf_txf, tvb, offset, 1, direction); + offset++; - if ((vht_grp_id == 0) || (vht_grp_id == 63)) /*** SU VHT type*/ + /* New pieces of lines for + * #802.11 radio information# + * Referred from code changes done for old FPGA version + * **/ + phdr.fcs_len = 0; + switch (plcp_type) //To check 5 types of PLCP(NULL, CCK, OFDM, HT & VHT) { - vht_su_nsts = tvb_get_guint8(tvb, offset+1); - vht_su_nsts = ((vht_su_nsts & 0x1c) >> 2); - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_su_nsts, - tvb, offset, 2, vht_su_nsts, "VHT NSTS: %u ",vht_su_nsts); + case 0: + /* + * XXX - CHAN_OFDM could be 11a or 11g. Unfortunately, we don't + * have the frequency, or anything else, to distinguish between + * them. + */ + if (mcs_index < 4) + { + phdr.phy = PHDR_802_11_PHY_11B; + } + phdr.has_data_rate = TRUE; + phdr.data_rate = tvb_get_letohs(tvb, offset) / 5; + break; - offset += 1; /* Skip to second byte of VHT-SIG-A1 */ - vht_su_partial_id1 = tvb_get_guint8(tvb,offset); - vht_su_partial_id2 = tvb_get_guint8(tvb,offset+1); - vht_su_partial_id = ((vht_su_partial_id1 &0xE0) >> 5) + ((vht_su_partial_id2 &0x3f) << 3); - phdr.phy_info.info_11ac.has_partial_aid = TRUE; - phdr.phy_info.info_11ac.partial_aid = vht_su_partial_id; - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_su_partial_aid, - tvb, offset, 2, vht_su_partial_id, "VHT PARTIAL AID: %u ",vht_su_partial_id); - } - else { - /*** The below is MU VHT type**/ - vht_u0_nsts = tvb_get_guint8(tvb, offset+1); - vht_u0_nsts = ((vht_u0_nsts & 0x1c) >> 2); - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_nsts, - tvb, offset, 2, vht_u0_nsts, "VHT U0 NSTS: %u ",vht_u0_nsts); + case 1: + case 2: /* PLCP_TYPE =2 Greenfeild (Not supported)*/ + /* + * XXX - where's the number of extension spatial streams? + * The code in wiretap/vwr.c doesn't seem to provide it. + */ + phdr.phy = PHDR_802_11_PHY_11N; + phdr.phy_info.info_11n.has_mcs_index = TRUE; + phdr.phy_info.info_11n.mcs_index = mcs_index; + phdr.phy_info.info_11n.has_short_gi = TRUE; + phdr.phy_info.info_11n.short_gi = preamble; + phdr.phy_info.info_11n.has_greenfield = TRUE; + phdr.phy_info.info_11n.greenfield = (plcp_type == PLCP_TYPE_GREENFIELD); + break; - vht_u1_nsts = tvb_get_guint8(tvb, offset+1); - vht_u1_nsts = ((vht_u1_nsts & 0xe0) >> 5); - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u1_nsts, - tvb, offset, 2, vht_u1_nsts, "VHT U1 NSTS: %u ",vht_u1_nsts); - - offset += 1; /* Skip to second byte of VHT-SIG-A1 */ - vht_u2_nsts = tvb_get_guint8(tvb, offset+1); - vht_u2_nsts = (vht_u2_nsts & 0x07); - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u2_nsts, - tvb, offset, 2, vht_u2_nsts, "VHT U2 NSTS: %u ",vht_u2_nsts); - - vht_u3_nsts = tvb_get_guint8(tvb, offset+1); - vht_u3_nsts = ((vht_u3_nsts & 0x38) >> 3); - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u3_nsts, - tvb, offset, 2, vht_u3_nsts, "VHT U3 NSTS: %u ",vht_u3_nsts); + case 3: + phdr.phy = PHDR_802_11_PHY_11AC; + phdr.phy_info.info_11ac.has_short_gi = TRUE; + phdr.phy_info.info_11ac.short_gi = preamble; + /* + * XXX - this probably has only one user, so only one MCS index + * and only one NSS. + */ + phdr.phy_info.info_11ac.nss[0] = nss; + phdr.phy_info.info_11ac.mcs[0] = mcs_index; + for (i = 1; i < 4; i++) + phdr.phy_info.info_11ac.nss[i] = 0; + break; } - /* - * Skip past the other 2 bytes of VHT-SIG-A1. - * - * XXX - extract TXOP_PS_NOT_ALLOWED from the third byte of - * the VHT-SIG-A1 structure? - */ - offset += 2; + phyRate = (float)tvb_get_letohs(tvb, offset) / 10; + proto_tree_add_uint_format_value(vw_l1info_tree, hf_radiotap_datarate, + tvb, offset, 2, tvb_get_letohs(tvb, offset), + "%.1f Mb/s", phyRate); + offset = offset + 2; + col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%.1f", phyRate); - /* - * Beginning of VHT-SIG-A2, 24 bits. - * - * XXX - extract Short GI NSYM Disambiguation from the first - * byte? - */ - /*** extract LDPC or BCC coding *****/ - vht_coding_type = tvb_get_guint8(tvb, offset); - vht_u0_coding_type = ((vht_coding_type & 0x04) >> 2); - if ((vht_grp_id == 0) || (vht_grp_id == 63)) /*** SU VHT type*/ + sigbw = (tvb_get_guint8(tvb, offset) & 0xf0) >> 4; + plcp_type = tvb_get_guint8(tvb, offset) & 0x0f; + proto_tree_add_uint(vw_l1info_tree, + hf_radiotap_sigbandwidth, tvb, offset, 1, sigbw); + + if (plcp_type) + proto_tree_add_uint(vw_l1info_tree, + hf_radiotap_modulation, tvb, offset, 1, plcp_type); + else { - if (vht_u0_coding_type == 0) { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, - tvb, offset, 1, vht_u0_coding_type, "VHT BCC Coding : %u ",vht_u0_coding_type); + if (mcs_index < 4) + proto_tree_add_uint_format_value(vw_l1info_tree, hf_radiotap_modulation, + tvb, offset, 1, plcp_type, "CCK (%u)", plcp_type); + else + proto_tree_add_uint_format_value(vw_l1info_tree, hf_radiotap_modulation, + tvb, offset, 1, plcp_type, "OFDM (%u)", plcp_type); + } + offset++; + + dbm = (gint8) tvb_get_guint8(tvb, offset); + + phdr.has_signal_dbm = TRUE; + phdr.signal_dbm = dbm; + + col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm); + + if (cmd_type != 1) + proto_tree_add_item(vwl1t, hf_radiotap_dbm_anta, + tvb, offset, 1, ENC_NA); + else + proto_tree_add_item(vwl1t, hf_radiotap_dbm_tx_anta, + tvb, offset, 1, ENC_NA); + offset++; + + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (dbm != 100) { + if (cmd_type != 1) + proto_tree_add_item(vwl1t, hf_radiotap_dbm_antb, + tvb, offset, 1, ENC_NA); + else + proto_tree_add_item(vwl1t, + hf_radiotap_dbm_tx_antb, + tvb, offset, 1, ENC_NA); + } + offset++; + + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (dbm != 100) { + if (cmd_type != 1) + proto_tree_add_item(vwl1t, hf_radiotap_dbm_antc, + tvb, offset, 1, ENC_NA); + else + proto_tree_add_item(vwl1t, hf_radiotap_dbm_tx_antc, + tvb, offset, 1, ENC_NA); + } + offset++; + + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (dbm != 100) { + if (cmd_type != 1) + proto_tree_add_item(vwl1t, hf_radiotap_dbm_antd, + tvb, offset, 1, ENC_NA); + else + proto_tree_add_item(vwl1t, + hf_radiotap_dbm_tx_antd, + tvb, offset, 1, ENC_NA); + } + offset++; + + proto_tree_add_item(vw_l1info_tree, hf_radiotap_sigbandwidthmask, tvb, offset, 1, ENC_NA); + offset++; + + if (cmd_type != 1) + { + proto_tree_add_item(vw_l1info_tree, hf_radiotap_antennaportenergydetect, tvb, offset, 1, ENC_NA); + } + else + { + proto_tree_add_item(vw_l1info_tree, hf_radiotap_tx_antennaselect, tvb, offset, 1, ENC_NA); + proto_tree_add_item(vw_l1info_tree, hf_radiotap_tx_stbcselect, tvb, offset, 1, ENC_NA); + } + if (plcp_type == 3) + { + proto_tree_add_item(vw_l1info_tree, hf_radiotap_mumask, tvb, offset, 1, ENC_NA); + } + offset++; + + if (plcp_type == 3) + { + // Extract SU/MU MIMO flag from RX L1 Info + vht_user_pos = tvb_get_guint8(tvb, offset); + + vwict = proto_tree_add_item(vw_l1info_tree, + hf_radiotap_l1infoc, tvb, offset, 1, vht_user_pos); + vw_infoC_tree = proto_item_add_subtree(vwict, ett_radiotap_infoc); + + vht_ndp_flag = (vht_user_pos & 0x80) >> 7; + vht_mu_mimo_flg = (vht_user_pos & 0x08) >> 3; + proto_tree_add_item(vw_infoC_tree, hf_radiotap_vht_ndp_flg, tvb, offset, 1, ENC_NA); + if (vht_ndp_flag == 0) + { + if (vht_mu_mimo_flg == 1) { + proto_tree_add_uint(vw_infoC_tree, hf_radiotap_vht_mu_mimo_flg, + tvb, offset, 1, vht_mu_mimo_flg); + + // extract user Postiion in case of mu-mimo + proto_tree_add_item(vw_infoC_tree, hf_radiotap_vht_user_pos, tvb, offset, 1, ENC_NA); + + } else { + proto_tree_add_item(vw_infoC_tree, hf_radiotap_vht_su_mimo_flg, tvb, offset, 1, ENC_NA); + } + } + } + offset++; + + mpdu_length = tvb_get_letohs(tvb, offset); + if (cmd_type != 1) //Checking for Rx and Tx + { + proto_tree_add_item(vw_l1info_tree, hf_ixveriwave_frame_length, tvb, offset, 2, mpdu_length); + } + offset += 2; + + //RadioTapHeader New format for PLCP section + vw_plcp_info = tvb_get_guint8(tvb, offset); + + vwplt = proto_tree_add_item(tap_tree, hf_radiotap_plcp_info, tvb, offset, 16, vw_plcp_info); + vw_plcpinfo_tree = proto_item_add_subtree(vwplt, ett_radiotap_plcp); + + switch (plcp_type) //To check 5 types of PLCP(NULL, CCK, OFDM, HT & VHT) + { + case 0: + if (mcs_index < 4) + { + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_type, + tvb, offset-10, 1, plcp_type, "Format: Legacy CCK "); + signal = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_plcp_signal, + tvb, offset, 1, signal); + offset = offset + 1; + plcp_service = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_plcp_service, + tvb, offset, 1, plcp_service); + offset = offset + 1; + vht_plcp_length = tvb_get_letohs(tvb, offset); + // proto_tree_add_item(vw_plcpinfo_tree, + // hf_radiotap_vht_length, tvb, offset, 2, vht_length); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_length, + tvb, offset, 2, vht_plcp_length, "PLCP Length: %u ",vht_plcp_length); + offset += 2; + crc16 = tvb_get_letohs(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_crc16, + tvb, offset, 2, crc16, "CRC 16: %u ",crc16); + offset += 2; + offset = offset + 9; + rfid = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_rfid, + tvb, offset, 1, rfid); + offset = offset + 1; + } + else + { + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_type, "Format: Legacy OFDM "); + vht_plcp_length1 = tvb_get_guint8(tvb, offset); + vht_plcp_length2 = tvb_get_guint8(tvb, offset+1); + vht_plcp_length3 = tvb_get_guint8(tvb, offset+2); + vht_plcp_length1 = ((vht_plcp_length1 & 0xe0) >> 5); + vht_plcp_length3 = ((vht_plcp_length3) & 0x01); + vht_plcp_length = (vht_plcp_length1 + (vht_plcp_length2 << 3) + (vht_plcp_length3 << 11)); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_plcp_length, + tvb, offset, 3, vht_plcp_length); + vht_rate = (tvb_get_guint8(tvb, offset) &0x0f); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_rate, + tvb, offset, 1, vht_rate); + vht_parity = (tvb_get_guint8(tvb, offset+2) &0x02)>>1; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_parity, + tvb, offset+2, 1, vht_parity); + offset = offset + 3; + plcp_service_ofdm = tvb_get_letohs(tvb, offset); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_plcp_service, + tvb, offset, 2, plcp_service_ofdm); + + offset = offset + 2; + offset = offset + 10; + rfid = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_rfid, + tvb, offset, 1, rfid); + offset = offset + 1; + + } + break; + + case 1: + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_type, "Format: HT "); + vht_plcp_length1 = tvb_get_guint8(tvb, offset); + vht_plcp_length2 = tvb_get_guint8(tvb, offset+1); + vht_plcp_length3 = tvb_get_guint8(tvb, offset+2); + vht_plcp_length1 = ((vht_plcp_length1 & 0xe0) >> 5); + vht_plcp_length3 = ((vht_plcp_length3) & 0x01); + vht_plcp_length = (vht_plcp_length1 + (vht_plcp_length2 << 3) + (vht_plcp_length3 << 11)); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_plcp_length, + tvb, offset, 3, vht_plcp_length); + vht_rate = (tvb_get_guint8(tvb, offset) &0x0f); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_rate, + tvb, offset, 1, vht_rate); + vht_parity = (tvb_get_guint8(tvb, offset+2) &0x02)>>1; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_parity, + tvb, offset+2, 1, vht_parity); + offset = offset + 3; + + vht_bw = tvb_get_guint8(tvb, offset) &0x80 >>7; + //proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_bw, + // tvb, offset, 1, vht_bw); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_bw, + tvb, offset, 1, vht_bw, "CBW 20/40: %u ",vht_bw); + vht_mcs = (tvb_get_guint8(tvb, offset)&0x7f); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_mcs, + tvb, offset, 1, vht_mcs); + offset = offset + 1; + vht_length = tvb_get_letohs(tvb, offset); + //proto_tree_add_item(vw_plcpinfo_tree, + // hf_radiotap_vht_length, tvb, offset, 2, vht_length); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_length, + tvb, offset, 2, vht_length, "HT Length: %u ", vht_length); + offset += 2; + vht_shortgi = (tvb_get_guint8(tvb, offset) &0x80) >> 7; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_shortgi, + tvb, offset, 1, vht_shortgi); + feccoding = (tvb_get_guint8(tvb, offset) &0x40) >> 6; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_feccoding, + tvb, offset, 1, feccoding); + vht_stbc = (tvb_get_guint8(tvb, offset) &0x30) >> 4; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_stbc, + tvb, offset, 1, vht_stbc); + aggregation = (tvb_get_guint8(tvb, offset) &0x08) >> 3; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_aggregation, + tvb, offset, 1, aggregation); + notsounding = (tvb_get_guint8(tvb, offset) &0x02) >> 1; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_notsounding, + tvb, offset, 1, notsounding); + smoothing = (tvb_get_guint8(tvb, offset) &0x01); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_smoothing, + tvb, offset, 1, smoothing); + offset = offset + 1; + + vht_crc1 = tvb_get_guint8(tvb, offset); + vht_crc2 = tvb_get_guint8(tvb, offset+1); + vht_crc = ((vht_crc1 &0xFC) >> 2) + ((vht_crc2 &0x03) << 2); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_crc, + tvb, offset, 2, vht_crc); + ness = (tvb_get_guint8(tvb, offset) &0x03); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_ness, + tvb, offset, 1, ness); + offset = offset + 1; + vht_tail = (tvb_get_guint8(tvb, offset) &0xFC) >> 2; + //proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_tail, + // tvb, offset, 1, vht_tail); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_tail, + tvb, offset, 1, vht_tail, "Signal Tail: %u ", vht_tail); + offset = offset + 1; + plcp_service_ofdm = tvb_get_letohs(tvb, offset); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_plcp_service, + tvb, offset, 2, plcp_service_ofdm); + + offset = offset + 2; + offset = offset + 4; + rfid = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_rfid, + tvb, offset, 1, rfid); + offset = offset + 1; + break; + + case 2: + //PLCP_TYPE =2 Greenfeild (Not supported) + break; + + case 3: + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_type, "Format: VHT "); + vht_plcp_length1 = tvb_get_guint8(tvb, offset); + vht_plcp_length2 = tvb_get_guint8(tvb, offset+1); + vht_plcp_length3 = tvb_get_guint8(tvb, offset+2); + vht_plcp_length1 = ((vht_plcp_length1 & 0xe0) >> 5); + vht_plcp_length3 = ((vht_plcp_length3) & 0x01); + vht_plcp_length = (vht_plcp_length1 + (vht_plcp_length2 << 3) + (vht_plcp_length3 << 11)); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_plcp_length, + tvb, offset, 3, vht_plcp_length); + vht_rate = (tvb_get_guint8(tvb, offset) &0x0f); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_rate, + tvb, offset, 1, vht_rate); + vht_parity = (tvb_get_guint8(tvb, offset+2) &0x02) >>1; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_parity, + tvb, offset+2, 1, vht_parity); + offset = offset + 3; // 3 bytes are for HT length + vht_bw = tvb_get_guint8(tvb, offset) &0x03; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_bw, + tvb, offset, 1, vht_bw); + vht_stbc = (tvb_get_guint8(tvb, offset) &0x08) >> 3; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_stbc, + tvb, offset, 1, vht_stbc); + // vht_grp_id = tvb_get_letohs(tvb, offset); + vht_grp_id1 = tvb_get_guint8(tvb, offset); + vht_grp_id2 = tvb_get_guint8(tvb, offset+1); + vht_grp_id = ((vht_grp_id1 &0xF0) >> 4) + ((vht_grp_id2 &0x03) << 4); + + phdr.phy_info.info_11ac.has_group_id = TRUE; + phdr.phy_info.info_11ac.group_id = vht_grp_id; + + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_grp_id, + tvb, offset, 2, vht_grp_id); + offset = offset + 1; + if ((vht_grp_id == 0) || (vht_grp_id == 63)) // SU VHT type + { + vht_su_nsts = tvb_get_guint8(tvb, offset); + vht_su_nsts = ((vht_su_nsts & 0x1c) >> 2); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_su_nsts, + tvb, offset, 2, vht_su_nsts); + + vht_su_partial_id1 = tvb_get_guint8(tvb,offset); + vht_su_partial_id2 = tvb_get_guint8(tvb,offset+1); + vht_su_partial_id = ((vht_su_partial_id1 &0xE0) >> 5) + ((vht_su_partial_id2 &0x3f) << 3); + + phdr.phy_info.info_11ac.has_partial_aid = TRUE; + phdr.phy_info.info_11ac.partial_aid = vht_su_partial_id; + + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_su_partial_aid, + tvb, offset, 2, vht_su_partial_id, "PARTIAL AID: %u ",vht_su_partial_id); + offset = offset + 1; } else { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, - tvb, offset, 1, vht_u0_coding_type, "VHT LDPC Coding : %u ",vht_u0_coding_type); + // The below is MU VHT type* + vht_u0_nsts = tvb_get_guint8(tvb, offset); + vht_u0_nsts = ((vht_u0_nsts & 0x1c) >> 2); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_u0_nsts, + tvb, offset, 2, vht_u0_nsts, "MU[0] NSTS: %u ",vht_u0_nsts); + + vht_u1_nsts = tvb_get_guint8(tvb, offset); + vht_u1_nsts = ((vht_u1_nsts & 0xe0) >> 5); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_u1_nsts, + tvb, offset, 2, vht_u1_nsts, "MU[1] NSTS: %u ",vht_u1_nsts); + + vht_u2_nsts = tvb_get_guint8(tvb, offset+1); + vht_u2_nsts = (vht_u2_nsts & 0x07); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_u2_nsts, + tvb, offset, 2, vht_u2_nsts, "MU[2] NSTS: %u ",vht_u2_nsts); + + vht_u3_nsts = tvb_get_guint8(tvb, offset+1); + vht_u3_nsts = ((vht_u3_nsts & 0x38) >> 3); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_u3_nsts, + tvb, offset, 2, vht_u3_nsts, "MU[3] NSTS: %u ",vht_u3_nsts); + offset = offset + 1; } - /*** extract SU-MIMO VHT MCS ******/ - /***** - vht_su_mcs = tvb_get_guint8(tvb, offset); - vht_su_mcs = ((vht_su_mcs & 0xF0) >> 4); - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_su_mcs, - tvb, offset, 1, vht_su_mcs, "VHT SU MCS : %u ",vht_su_mcs); - *******/ - } else { - /*** it is MU MIMO type BCC coding ****/ - /*** extract U0 Coding ***/ - if (vht_u0_nsts) { - if (vht_u0_coding_type == 0) { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, - tvb, offset, 1, vht_u0_coding_type, "VHT U0 BCC Coding : %u ",vht_u0_coding_type); - } else { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, - tvb, offset, 1, vht_u0_coding_type, "VHT U0 LDPC Coding : %u ",vht_u0_coding_type); - } + // extract LDPC or BCC coding + vht_txop_ps_notallowd = (tvb_get_guint8(tvb, offset) &0x40) >> 6; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_txop_ps_notallowd, + tvb, offset, 1, vht_txop_ps_notallowd); + offset = offset + 1; + + vht_shortgi = tvb_get_guint8(tvb, offset) &0x01; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_shortgi, + tvb, offset, 1, vht_shortgi); + vht_shortginsymdisa = (tvb_get_guint8(tvb, offset) &0x02) >> 1; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_shortginsymdisa, + tvb, offset, 1, vht_shortginsymdisa); +/* + vht_coding_type = (tvb_get_guint8(tvb, offset)& 0x04) >> 2; + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_u0_coding_type, + tvb, offset, 1, vht_coding_type, "SU/MU[0] Coding : %u ",vht_coding_type); +*/ + vht_ldpc_ofdmsymbol = (tvb_get_guint8(tvb, offset) &0x08) >> 3; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_ldpc_ofdmsymbol, + tvb, offset, 1, vht_ldpc_ofdmsymbol); + vht_coding_type = tvb_get_guint8(tvb, offset); + + //vht_su_coding_type = vht_u0_coding_type; + if ((vht_grp_id == 0) || (vht_grp_id == 63)) // SU VHT type + { + vht_coding_type = (tvb_get_guint8(tvb, offset)& 0x04) >> 2; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_su_coding_type, + tvb, offset, 1, vht_coding_type); + vht_su_mcs = (tvb_get_guint8(tvb, offset) &0xf0) >> 4; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_su_mcs, + tvb, offset, 1, vht_su_mcs); + } else { - /*** reserved **/ - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u0_coding_type, - tvb, offset, 1, vht_u0_coding_type, "VHT U0 Reserved Coding : %u ",vht_u0_coding_type); - } - /*** extract U1 Coding type***/ - vht_u1_coding_type = ((vht_coding_type & 0x10) >> 4); - if (vht_u1_nsts) { - if (vht_u1_coding_type == 0) { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u1_coding_type, - tvb, offset, 1, vht_u1_coding_type, "VHT U1 BCC Coding : %u ",vht_u1_coding_type); - } else { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u1_coding_type, - tvb, offset, 1, vht_u1_coding_type, "VHT U1 LDPC Coding : %u ",vht_u1_coding_type); - } - } else { - /*** Reserved **/ - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u1_coding_type, - tvb, offset, 1, vht_u1_coding_type, "VHT U1 Reserved Coding : %u ",vht_u1_coding_type); + // it is MU MIMO type BCC coding + // extract U0 Coding + vht_u0_coding_type = ((vht_coding_type & 0x04) >> 2); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_u0_coding_type, + tvb, offset, 1, vht_u0_coding_type); + + // extract U1 Coding type + vht_u1_coding_type = ((vht_coding_type & 0x10) >> 4); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_u1_coding_type, + tvb, offset, 1, vht_u1_coding_type); + + // extract U2 Coding type + vht_u2_coding_type = ((vht_coding_type & 0x20) >> 5); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_u2_coding_type, + tvb, offset, 1, vht_u2_coding_type); + + // extract U3 Coding type + // reserved + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_vht_u3_coding_type, + tvb, offset, 1, vht_u3_coding_type, "MU[3] Coding Type: Reserved (%u)",vht_reserved_coding_type); + } - /*** extract U2 Coding type***/ - vht_u2_coding_type = ((vht_coding_type & 0x20) >> 5); - if (vht_u2_nsts) { - if (vht_u2_coding_type == 0) { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u2_coding_type, - tvb, offset, 1, vht_u2_coding_type, "VHT U2 BCC Coding : %u ",vht_u2_coding_type); - } else { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u2_coding_type, - tvb, offset, 1, vht_u2_coding_type, "VHT U2 LDPC Coding : %u ",vht_u2_coding_type); - } - }else { - /**** Reserved *******/ - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u2_coding_type, - tvb, offset, 1, vht_u2_coding_type, "VHT U2 Reserved Coding : %u ",vht_u2_coding_type); - } + // decode Beamformed bit + offset = offset + 1; + vht_beamformed = tvb_get_guint8(tvb, offset); + vht_beamformed = (vht_beamformed & 0x01); - /*** extract U3 Coding type***/ - if (vht_u3_nsts == 1) { - guint vht_u3_coding_type; + phdr.phy_info.info_11ac.has_beamformed = TRUE; + phdr.phy_info.info_11ac.beamformed = vht_beamformed; - vht_u3_coding_type = ((vht_coding_type & 0x40) >> 6); - if (vht_u3_coding_type == 0) { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u3_coding_type, - tvb, offset, 1, vht_u3_coding_type, "VHT U3 BCC Coding : %u ",vht_u3_coding_type); - } else { - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_u3_coding_type, - tvb, offset, 1, vht_u3_coding_type, "VHT U3 LDPC Coding : %u ",vht_u3_coding_type); - } - } + proto_tree_add_item(vw_plcpinfo_tree, hf_radiotap_vht_beamformed, tvb, offset, 1, ENC_NA); + vht_crc1 = tvb_get_guint8(tvb, offset); + vht_crc2 = tvb_get_guint8(tvb, offset+1); + vht_crc = ((vht_crc1 &0xFC) >> 2) + ((vht_crc2 &0x03) << 2); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_crc, + tvb, offset, 2, vht_crc); + offset = offset + 1; + vht_tail = (tvb_get_guint8(tvb, offset) &0xFC) >> 2; + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_tail, + tvb, offset, 1, vht_tail); + offset = offset + 1; + vht_length = tvb_get_letohs(tvb, offset); + proto_tree_add_item(vw_plcpinfo_tree, + hf_radiotap_vht_length, tvb, offset, 2, vht_length); + offset += 2; + vht_mcs1 = tvb_get_guint8(tvb, offset); + vht_mcs2 = tvb_get_guint8(tvb, offset+1); + vht_mcs = ((vht_mcs1 &0xC0) >> 6) + ((vht_mcs2 &0x03) << 2); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_vht_mcs, + tvb, offset, 2, vht_mcs); + offset = offset + 2; + + offset = offset + 2; + rfid = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_rfid, + tvb, offset, 1, rfid); + offset = offset + 1; + break; + + default: + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_type, "Format: Null "); + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP0: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP1: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP2: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP3: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP4: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP5: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP6: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP7: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP8: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP9: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP10: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP11: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP12: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP13: %u ", plcp_default); + offset = offset + 1; + plcp_default = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(vw_plcpinfo_tree, hf_radiotap_plcp_default, + tvb, offset, 1, plcp_default, "PLCP14: %u ", plcp_default); + offset = offset + 1; + rfid = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(vw_plcpinfo_tree, hf_radiotap_rfid, + tvb, offset, 1, rfid); + offset = offset + 1; } - /*** decode Beamformed bit ****/ - offset = offset + 1; - vht_beamformed = tvb_get_guint8(tvb, offset); - vht_beamformed = (vht_beamformed & 0x01); - phdr.phy_info.info_11ac.has_beamformed = TRUE; - phdr.phy_info.info_11ac.beamformed = vht_beamformed; - proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_beamformed, - tvb, offset, 1, vht_beamformed, "VHT Beamformed: %u ",vht_beamformed); + //RadioTapHeader New format for L2-L4_Info + vwl2l4t = proto_tree_add_item(tap_tree, hf_radiotap_l2_l4_info, + tvb, offset, 23, ENC_NA); + vw_l2l4info_tree = proto_item_add_subtree(vwl2l4t, ett_radiotap_layer2to4); + cidv = ((tvb_get_guint8(tvb, offset+3)& 0x20) >> 5); + bssidv = ((tvb_get_guint8(tvb, offset+3)& 0x40) >> 6); + if (cmd_type != 1) + { + vw_vcid = (tvb_get_letohs(tvb, offset)) &0x0fff; + if (cidv == 1) + { + proto_tree_add_uint(vw_l2l4info_tree, hf_ixveriwave_vw_vcid, tvb, offset, 2, vw_vcid); + } + else + { + proto_tree_add_uint_format_value(vw_l2l4info_tree, hf_ixveriwave_vw_vcid, + tvb, offset, 2, vw_vcid, "Invalid"); + } + + offset++; + vw_bssid = ((tvb_get_letohs(tvb, offset)) &0x0ff0)>>4; + if (bssidv == 1) + { + proto_tree_add_uint(vw_l2l4info_tree, hf_radiotap_bssid, + tvb, offset, 2, vw_bssid); + } + else + { + proto_tree_add_uint_format_value(vw_l2l4info_tree, hf_radiotap_bssid, + tvb, offset, 2, vw_bssid, "Invalid"); + } + offset +=2; + + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_clientidvalid, tvb, offset, 1, ENC_NA); + bssidv = ((tvb_get_guint8(tvb, offset)& 0x40) >> 6); + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_bssidvalid, tvb, offset, 1, ENC_NA); + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_unicastormulticast, tvb, offset, 1, ENC_NA); + offset++; + } + else + { + if (cidv == 1) + { + proto_tree_add_item(vw_l2l4info_tree, hf_ixveriwave_vw_vcid, + tvb, offset, 2, ENC_LITTLE_ENDIAN); + } + else + { + vw_vcid = tvb_get_letohs(tvb, offset); + proto_tree_add_uint_format_value(vw_l2l4info_tree, hf_ixveriwave_vw_vcid, + tvb, offset, 2, vw_vcid, "Invalid"); + } + offset +=3; + + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_clientidvalid, tvb, offset, 1, ENC_NA); + offset++; + } + /* + wlantype = tvb_get_guint8(tvb, offset)& 0x3f; + proto_tree_add_uint(vw_l2l4info_tree, hf_radiotap_wlantype, + tvb, offset, 1, wlantype); + */ + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_tid, tvb, offset, 2, ENC_LITTLE_ENDIAN); + offset++; + if (cmd_type == 1) + { + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_ac, tvb, offset, 1, ENC_NA); + } + l4idv = (tvb_get_guint8(tvb, offset)& 0x10) >> 4; + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_l4idvalid, tvb, offset, 1, ENC_NA); + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_containshtfield, tvb, offset, 1, ENC_NA); + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_istypeqos, tvb, offset, 1, ENC_NA); + flowv = (tvb_get_guint8(tvb, offset)& 0x80) >> 7; + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_flowvalid, tvb, offset, 1, ENC_NA); + offset++; + + vw_seqnum = tvb_get_guint8(tvb, offset); + proto_tree_add_item(vw_l2l4info_tree, hf_ixveriwave_vw_seqnum, + tvb, offset, 1, vw_seqnum); + offset++; + if (flowv == 1) + { + proto_tree_add_item(vw_l2l4info_tree, hf_ixveriwave_vw_flowid, + tvb, offset, 3, ENC_LITTLE_ENDIAN); + } + else + { + proto_tree_add_uint_format_value(vw_l2l4info_tree, hf_ixveriwave_vw_flowid, + tvb, offset, 2, tvb_get_letohl(tvb, offset) & 0xffffff, "Invalid"); + } + offset +=3; + if (l4idv == 1) + { + proto_tree_add_item(vw_l2l4info_tree, hf_ixveriwave_vw_l4id, + tvb, offset, 2, ENC_LITTLE_ENDIAN); + } + else + { + proto_tree_add_uint_format_value(vw_l2l4info_tree, hf_ixveriwave_vw_l4id, + tvb, offset, 2, tvb_get_letohs(tvb, offset), "Invalid"); + } + offset +=2; + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_payloaddecode, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset +=4; + + if (cmd_type != 1) { /* then it's an rx case */ + /*FPGA_VER_vVW510021 version decodes */ + proto_tree_add_bitmask(vw_l2l4info_tree, tvb, offset, hf_radiotap_vw_info_rx, ett_radiotap_info, radiotap_info_rx_fields, ENC_LITTLE_ENDIAN); + + } else { /* it's a tx case */ + /* FPGA_VER_vVW510021 and VW_FPGA_VER_vVW510006 tx info decodes same*/ + proto_tree_add_bitmask(vw_l2l4info_tree, tvb, offset, hf_radiotap_vw_info_tx, ett_radiotap_info, radiotap_info_tx_fields, ENC_LITTLE_ENDIAN); + } + + offset +=3; + vw_errors = tvb_get_letohl(tvb, offset); + + /* build the individual subtrees for the various types of error flags */ + /* NOTE: as the upper 16 bits aren't used at the moment, we pretend that */ + /* the error flags field is only 16 bits (instead of 32) to save space */ + if (cmd_type != 1) { + /* then it's an rx case */ + static const int * vw_errors_rx_flags[] = { + &hf_radiotap_vw_errors_rx_bit0, + &hf_radiotap_vw_errors_rx_bit1, + &hf_radiotap_vw_errors_rx_bit2, + &hf_radiotap_vw_errors_rx_bit3, + &hf_radiotap_vw_errors_rx_bit4, + &hf_radiotap_vw_errors_rx_bit5, + &hf_radiotap_vw_errors_rx_bit6, + &hf_radiotap_vw_errors_rx_bit7, + &hf_radiotap_vw_errors_rx_bit8, + &hf_radiotap_vw_errors_rx_bit9, + &hf_radiotap_vw_errors_rx_bit10, + &hf_radiotap_vw_errors_rx_bit11, + &hf_radiotap_vw_errors_rx_bit12, + &hf_radiotap_vw_errors_rx_bit14, + &hf_radiotap_vw_errors_rx_bit15, + &hf_radiotap_vw_errors_rx_bit16, + &hf_radiotap_vw_errors_rx_bit17, + &hf_radiotap_vw_errors_rx_bit18, + &hf_radiotap_vw_errors_rx_bit19, + &hf_radiotap_vw_errors_rx_bit20, + &hf_radiotap_vw_errors_rx_bit21, + &hf_radiotap_vw_errors_rx_bit22, + &hf_radiotap_vw_errors_rx_bit23, + &hf_radiotap_vw_errors_rx_bit24, + &hf_radiotap_vw_errors_rx_bit31, + NULL + }; + + proto_tree_add_bitmask(vw_l2l4info_tree, tvb, offset, hf_radiotap_vw_errors, ett_radiotap_errors, vw_errors_rx_flags, ENC_LITTLE_ENDIAN); + + } else { /* it's a tx case */ + static const int * vw_errors_tx_flags[] = { + &hf_radiotap_vw_errors_tx_bit01, + &hf_radiotap_vw_errors_tx_bit05, + &hf_radiotap_vw_errors_tx_bit8, + &hf_radiotap_vw_errors_tx_bit9, + &hf_radiotap_vw_errors_tx_bit10, + &hf_radiotap_vw_errors_tx_bit31, + NULL + }; + + /* FPGA_VER_vVW510021 and VW_FPGA_VER_vVW510006 tx error decodes same*/ + proto_tree_add_bitmask(vw_l2l4info_tree, tvb, offset, hf_radiotap_vw_errors, ett_radiotap_errors, vw_errors_tx_flags, ENC_LITTLE_ENDIAN); + + // proto_tree_add_item(vw_l2l4info_tree, hf_ixveriwave_vw_seqnum, + // tvb, offset, 1, vw_seqnum); + //offset++; + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_vw_tx_retrycount, tvb, offset+2, 1, ENC_NA); + proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_vw_tx_factorydebug, tvb, offset+2, 2, ENC_LITTLE_ENDIAN); + } + offset +=4; + + if (vwl2l4t && log_mode) + proto_item_append_text(vwl2l4t, " (Reduced)"); + } +/* + align_offset = ALIGN_OFFSET(offset, 2); + offset += align_offset; + + vw_ht_length = tvb_get_letohs(tvb, offset); + if ((tree) && (vw_ht_length != 0)) + if (plcp_type == 3) + { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vw_ht_length, + tvb, offset, 2, vw_ht_length, "VHT length: %u (includes the sum of the pieces of the aggregate and their respective Start_Spacing + Delimiter + MPDU + Padding)", + vw_ht_length); + } + else + { + proto_tree_add_uint_format(tap_tree, hf_radiotap_vw_ht_length, + tvb, offset, 2, vw_ht_length, "HT length: %u (includes the sum of the pieces of the aggregate and their respective Start_Spacing + Delimiter + MPDU + Padding)", + vw_ht_length); + } + offset +=2; + + align_offset = ALIGN_OFFSET(offset, 2); + offset += align_offset;*/ + + /* vw_info grabbed in the beginning of the dissector */ + + + /*** POPULATE THE AMSDU VHT MIXED MODE CONTAINER FORMAT ***/ + /**** + if (vw_ht_length != 0) + ***/ + /*** + else { + offset = offset + 17; + } + ***/ + + /* This handles the case of an FCS existing at the end of the frame. */ + if (rflags & FLAGS_FCS) + pinfo->pseudo_header->ieee_802_11.fcs_len = 4; + else + pinfo->pseudo_header->ieee_802_11.fcs_len = 0; + + if (!ver_fpga) + { + /* Grab the rest of the frame. */ + if (plcp_type == 3) { + length = length + 17; /*** 16 bytes of PLCP + 1 byte of L1InfoC(UserPos) **/ + } + + next_tvb = tvb_new_subset_remaining(tvb, length); + } + else + { + if (cmd_type != 4) + proto_item_set_len(tap_tree, length + OCTO_TIMESTAMP_FIELDS_LEN); + else + proto_item_set_len(tap_tree, length + OCTO_TIMESTAMP_FIELDS_LEN + OCTO_MODIFIED_RF_LEN); + + /* Grab the rest of the frame. */ + next_tvb = tvb_new_subset_remaining(tvb, length); } - /* - * Skip the 16 bytes of PLCP + 1 byte of L1InfoC(UserPos) inserted - * by the Veriwave reader code in libwiretap. - */ - length = length + 17; + /* If we had an in-header FCS, check it. */ + if (hdr_fcs_ti) { + /* It would be very strange for the header to have an FCS for the + * frame *and* the frame to have the FCS at the end, but it's possible, so + * take that into account by using the FCS length recorded in pinfo. */ - /* Grab the rest of the frame. */ - next_tvb = tvb_new_subset_remaining(tvb, length); + /* Watch out for [erroneously] short frames */ + if (tvb_captured_length(next_tvb) > (unsigned int) pinfo->pseudo_header->ieee_802_11.fcs_len) { + guint32 sent_fcs = 0; + calc_fcs = crc32_802_tvb(next_tvb, + tvb_captured_length(next_tvb) - pinfo->pseudo_header->ieee_802_11.fcs_len); - /* dissect the 802.11 packet next */ - call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr); + /* By virtue of hdr_fcs_ti being set, we know that 'tree' is set, + * so there's no need to check it here. */ + if (calc_fcs == sent_fcs) { + proto_item_append_text(hdr_fcs_ti, " [correct]"); + } + else { + proto_item_append_text(hdr_fcs_ti, " [incorrect, should be 0x%08x]", calc_fcs); + proto_tree_add_expert(tap_tree, pinfo, &ei_radiotap_fcs_bad, + tvb, 0, 4); + } + } + else { + proto_item_append_text(hdr_fcs_ti, + " [cannot verify - not enough data]"); + } + } + /* dissect the 802.11 header next */ + if(!ver_fpga || mpdu_length != 0) + call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr); } void proto_register_ixveriwave(void) { /* value_strings for TX/RX and FCS error flags */ - static const value_string tx_rx_type[] = { - { 0, "Received" }, - { 1, "Transmitted" }, - { 0, NULL }, - }; - - static const value_string fcserr_type[] = { - { 0, "Correct" }, - { 1, "Incorrect" }, - { 0, NULL }, - }; - - static const true_false_string preamble_type = { - "Short", - "Long", - }; + static const true_false_string tfs_tx_rx_type = { "Transmitted", "Received" }; + static const true_false_string tfs_fcserr_type = { "Incorrect", "Correct" }; + static const true_false_string tfs_preamble_type = { "Short", "Long", }; /* Added value_string for decrypt error flag */ - static const value_string decrypterr_type[] = { - { 0, "Decrypt Succeeded" }, - { 1, "Decrypt Failed" }, + static const true_false_string tfs_decrypterr_type = { "Decrypt Failed", "Decrypt Succeeded" }; + + /* Added value_string for excess retry error flag */ + static const true_false_string tfs_retryerr_type = {"Excess retry abort", "Retry limit not reached" }; + + static const true_false_string tfs_legacy_type = {"802.11b LEGACY CCK", "LEGACY OFDM"}; + + static const value_string vht_coding_vals[] = { + { 0, "BCC" }, + { 1, "LDPC" }, { 0, NULL }, }; - /* Added value_string for excess retry error flag */ - static const value_string retryerr_type[] = { - { 0, "Retry limit not reached" }, - { 1, "Excess retry abort" }, - { 0, NULL }, + + static const value_string l1_preamble_type[] = { + { 0, "Short" }, + { 1, "Long" }, + { 0, NULL }, }; + static const value_string modulation_type[] = { + { 0, "LEGACY" }, + { 1, "HT" }, + { 2, "HT-Greenfield" }, + { 3, "VHT" }, + { 0, NULL }, + }; + + static const value_string sbw_type[] = { + { 0, "5 MHz" }, + { 1, "10 MHz" }, + { 2, "20 MHz" }, + { 3, "40 MHz" }, + { 4, "80 MHz" }, + { 5, "reserved" }, + { 6, "reserved" }, + { 7, "reserved" }, + { 0, NULL }, + }; +#if 0 + static const value_string mcs[] = { + { 0, "DBPSK" }, + { 1, "DQPSK" }, + { 2, "CCK (4bits)" }, + { 3, "CCK (8bits)" }, + { 4, "BPSK (1/2)" }, + { 5, "BPSK (3/4)" }, + { 6, "QPSK (1/2)" }, + { 7, "QPSK (3/4)" }, + { 8, "16-QAM (1/2)" }, + { 9, "16-QAM (3/4)" }, + { 10, "64-QAM (1/2)" }, + { 11, "64-QAM (3/4)" }, + { 0, NULL }, + }; +#endif /* Added value_string for encryption type field */ static const value_string encrypt_type[] = { { 0, "No encryption" }, @@ -1233,6 +2990,34 @@ void proto_register_ixveriwave(void) { 0, NULL }, }; + static const value_string bmbit[] = { + {0, "Unicast"}, + {1, "Multicast"}, + { 0, NULL }, + }; + + static const value_string sbw_evm[] = { + { 0, "20 MHz" }, + { 1, "40 MHz" }, + { 2, "80 MHz" }, + { 3, "160 MHz" }, + { 0, NULL }, + }; + static const value_string frameformat_type[] = { + { 0x0, "LEGACY" }, + { 0x1, "HT" }, + { 0x3, "VHT" }, + { 0, NULL }, + }; + + static const value_string crypto_TKIP_type[] = { + { 0x0, "False" }, + { 0x1, "TKIP Encapped" }, + { 0x2, "CCMP Encapped" }, + { 0x3, "BIP Encapped" }, + { 0, NULL }, + }; + static hf_register_info hf[] = { { &hf_ixveriwave_frame_length, { "Actual frame length", "ixveriwave.frame_length", @@ -1259,11 +3044,15 @@ void proto_register_ixveriwave(void) FT_FLOAT, 0, NULL, 0x0, NULL, HFILL } }, { &hf_ixveriwave_vw_latency, - { "Latency", "ixveriwave.latency", - FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "Frame latency", "ixveriwave.latency", + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_nanoseconds, 0x0, NULL, HFILL } }, { &hf_ixveriwave, - { "Signature (32 LSBs)", "ixveriwave.sig_ts", + { "Frame Signature Timestamp(32 LSBs)", "ixveriwave.sig_ts", + FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + { &hf_ixveriwave_vw_delay, + { "Frame Queue Delay (32 LSBs)", "ixveriwave.delay_ts", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_ixveriwave_vw_startt, @@ -1275,27 +3064,31 @@ void proto_register_ixveriwave(void) FT_UINT64, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0, NULL, HFILL } }, { &hf_ixveriwave_vw_pktdur, - { "Packet duration", "ixveriwave.pktdur", - FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "Frame duration", "ixveriwave.pktdur", + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_nanoseconds, 0x0, NULL, HFILL } }, { &hf_ixveriwave_vw_ifg, { "Inter-frame gap (usecs)", "ixveriwave.ifg", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_ixveriwave_vw_ifg_neg, + { "Inter-frame gap (usecs)", "ixveriwave.ifg", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_ixveriwave_vwf_txf, { "Frame direction", "ixveriwave.vwflags.txframe", - FT_UINT32, BASE_DEC, VALS(tx_rx_type), 0x0, NULL, HFILL } }, + FT_BOOLEAN, 8, TFS(&tfs_tx_rx_type), ETHERNETTAP_VWF_TXF, NULL, HFILL } }, { &hf_ixveriwave_vwf_fcserr, { "MAC FCS check", "ixveriwave.vwflags.fcserr", - FT_UINT32, BASE_DEC, VALS(fcserr_type), 0x0, NULL, HFILL } }, + FT_BOOLEAN, 8, TFS(&tfs_fcserr_type), ETHERNETTAP_VWF_FCSERR, NULL, HFILL } }, { &hf_ixveriwave_vw_info, { "Info field", "ixveriwave.info", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_ixveriwave_vw_info_retryCount, - { "Info field retry count", "ixveriwave.info", + { "Retry count", "ixveriwave.info.retry_count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* tx info decodes for VW510024 and 510012 */ @@ -1382,6 +3175,23 @@ framing signal deasserted. this is caused by software setting the drain all reg { "Layer 4 ID", "ixveriwave.layer4id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + /* Presense flags */ +#define RADIOTAP_MASK_VW_FPGA_VERSION (1 << VW_RADIOTAP_FPGA_VERSION) +#define RADIOTAP_MASK_VW_MCID (1 << VW_RADIOTAP_MCID) +#define RADIOTAP_MASK_VW_ERRORS (1 << VW_RADIOTAP_ERRORS) +#define RADIOTAP_MASK_VW_INFO (1 << VW_RADIOTAP_INFO) +#define RADIOTAP_MASK_VW_MSDU_LENGTH (1 << VW_RADIOTAP_MSDU_LENGTH) +#define RADIOTAP_MASK_VW_HT_LENGTH (1 << VW_RADIOTAP_HT_LENGTH) +#define RADIOTAP_MASK_VW_FLOWID (1 << VW_RADIOTAP_FLOWID) +#define RADIOTAP_MASK_VW_SEQNUM (1 << VW_RADIOTAP_SEQNUM) +#define RADIOTAP_MASK_VW_LATENCY (1 << VW_RADIOTAP_LATENCY) +#define RADIOTAP_MASK_VW_SIG_TS (1 << VW_RADIOTAP_SIG_TS) +#define RADIOTAP_MASK_VW_STARTT (1 << VW_RADIOTAP_STARTT) +#define RADIOTAP_MASK_VW_ENDT (1 << VW_RADIOTAP_ENDT) +#define RADIOTAP_MASK_VW_PKTDUR (1 << VW_RADIOTAP_PKTDUR) +#define RADIOTAP_MASK_VW_IFG (1 << VW_RADIOTAP_IFG) + /* end veriwave addition*/ + { &hf_radiotap_datarate, { "Data rate", "ixveriwave.datarate", FT_UINT32, BASE_DEC, NULL, 0x0, @@ -1404,9 +3214,14 @@ framing signal deasserted. this is caused by software setting the drain all reg { "Flags", "ixveriwave.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_flags_cfp, + { "CFP", "ixveriwave.flags.cfp", + FT_BOOLEAN, 12, NULL, IEEE80211_RADIOTAP_F_CFP, + "Sent/Received radha CFP", HFILL } }, + { &hf_radiotap_flags_preamble, { "Preamble", "ixveriwave.flags.preamble", - FT_BOOLEAN, 12, TFS(&preamble_type), FLAGS_SHORTPRE, + FT_BOOLEAN, 12, TFS(&tfs_preamble_type), FLAGS_SHORTPRE, "Sent/Received with short preamble", HFILL } }, { &hf_radiotap_flags_wep, @@ -1414,10 +3229,20 @@ framing signal deasserted. this is caused by software setting the drain all reg FT_BOOLEAN, 12, NULL, FLAGS_WEP, "Sent/Received with WEP encryption", HFILL } }, - { &hf_radiotap_flags_fcs_present, - { "FCS present", "ixveriwave.flags.fcs_present", + { &hf_radiotap_flags_frag, + { "Fragmentation", "ixveriwave.flags.frag", + FT_BOOLEAN, 12, NULL, IEEE80211_RADIOTAP_F_FRAG, + "Sent/Received with fragmentation", HFILL } }, + + { &hf_radiotap_flags_fcs, + { "FCS at end", "ixveriwave.flags.fcs", FT_BOOLEAN, 12, NULL, FLAGS_FCS, - "FCS present in frame", HFILL } }, + "Frame includes FCS at end", HFILL } }, + + { &hf_radiotap_flags_datapad, + { "Data Pad", "ixveriwave.flags.datapad", + FT_BOOLEAN, 12, NULL, IEEE80211_RADIOTAP_F_DATAPAD, + "Frame has padding between 802.11 header and payload", HFILL } }, { &hf_radiotap_flags_ht, { "HT frame", "ixveriwave.flags.ht", @@ -1439,8 +3264,8 @@ framing signal deasserted. this is caused by software setting the drain all reg { "Short guard interval", "ixveriwave.flags.shortgi", FT_BOOLEAN, 12, NULL, FLAGS_CHAN_SHORTGI, NULL, HFILL } }, - { &hf_radiotap_dbm_antsignal, - { "SSI Signal", "ixveriwave.dbm_antsignal", + { &hf_radiotap_dbm_anta, + { "SSI Signal for Antenna A", "ixveriwave.dbm_anta", FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0x0, "RF signal power at the antenna from a fixed, arbitrary value in decibels from one milliwatt", HFILL } }, @@ -1459,89 +3284,604 @@ framing signal deasserted. this is caused by software setting the drain all reg FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0x0, "RF signal power at the antenna from a fixed, arbitrary value in decibels from one milliwatt", HFILL } }, + { &hf_radiotap_dbm_tx_anta, + { "TX Power for Antenna A", "ixveriwave.dbm_anta", + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0x0, + "RF signal power at the antenna from a fixed, arbitrary value in decibels from one milliwatt", HFILL } }, + + { &hf_radiotap_dbm_tx_antb, + { "TX Power for Antenna B", "ixveriwave.dbm_antb", + FT_INT32, BASE_DEC, NULL, 0x0, + "RF signal power at the antenna from a fixed, arbitrary value in decibels from one milliwatt", HFILL } }, + + { &hf_radiotap_dbm_tx_antc, + { "TX Power for Antenna C", "ixveriwave.dbm_antc", + FT_INT32, BASE_DEC, NULL, 0x0, + "RF signal power at the antenna from a fixed, arbitrary value in decibels from one milliwatt", HFILL } }, + + { &hf_radiotap_dbm_tx_antd, + { "TX Power for Antenna D", "ixveriwave.dbm_antd", + FT_INT32, BASE_DEC, NULL, 0x0, + "RF signal power at the antenna from a fixed, arbitrary value in decibels from one milliwatt", HFILL } }, + /* Boolean 'present' flags */ /* VeriWave-specific flags */ { &hf_radiotap_vwf_txf, { "Frame direction", "ixveriwave.vwflags.txframe", - FT_UINT32, BASE_DEC, VALS(tx_rx_type), 0x0, NULL, HFILL } }, + FT_BOOLEAN, 16, TFS(&tfs_tx_rx_type), VW_RADIOTAPF_TXF, NULL, HFILL } }, { &hf_radiotap_vwf_fcserr, { "MAC FCS check", "ixveriwave.vwflags.fcserr", - FT_UINT32, BASE_DEC, VALS(fcserr_type), 0x0, NULL, HFILL } }, + FT_BOOLEAN, 16, TFS(&tfs_fcserr_type), VW_RADIOTAPF_FCSERR, NULL, HFILL } }, { &hf_radiotap_vwf_dcrerr, { "Decryption error", "ixveriwave.vwflags.decrypterr", - FT_UINT32, BASE_DEC, VALS(decrypterr_type), 0x0, NULL, HFILL } }, + FT_BOOLEAN, 16, TFS(&tfs_decrypterr_type), VW_RADIOTAPF_DCRERR, NULL, HFILL } }, { &hf_radiotap_vwf_retrerr, { "TX retry limit", "ixveriwave.vwflags.retryerr", - FT_UINT32, BASE_DEC, VALS(retryerr_type), 0x0, NULL, HFILL } }, + FT_BOOLEAN, 16, TFS(&tfs_retryerr_type), VW_RADIOTAPF_RETRERR, NULL, HFILL } }, { &hf_radiotap_vwf_enctype, { "Encryption type", "ixveriwave.vwflags.encrypt", - FT_UINT32, BASE_DEC, VALS(encrypt_type), 0x0, NULL, HFILL } }, + FT_UINT32, BASE_DEC, VALS(encrypt_type), VW_RADIOTAPF_ENCMSK, NULL, HFILL } }, /* start VeriWave-specific radiotap header elements 6-2007 */ { &hf_radiotap_vw_ht_length, - { "Total IP length (incl all pieces of an aggregate)", "ixveriwave.ht_length", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "HT length", "ixveriwave.ht_length", + FT_UINT16, BASE_DEC, NULL, 0x0, "Total IP length (incl all pieces of an aggregate)", HFILL } }, { &hf_radiotap_vht_grp_id, - { "VHT GRP ID})", "ixveriwave.VHT_GRPID", + { "Group Id", "ixveriwave.GRPID", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_radiotap_vht_su_nsts, - { "VHT SU NSTS})", "ixveriwave.VHT_SU_NSTS", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "SU NSTS", "ixveriwave.SU_NSTS", + FT_UINT16, BASE_DEC, NULL, 0x1c, NULL, HFILL } }, { &hf_radiotap_vht_su_partial_aid, - { "VHT SU Partial ID})", "ixveriwave.VHT_SU_PARTIAL_AID", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "SU Partial ID", "ixveriwave.VHT_SU_PARTIAL_AID", + FT_UINT16, BASE_HEX, NULL, 0x3FE0, NULL, HFILL } }, + + { &hf_radiotap_vht_su_coding_type, + { "SU Coding Type", "ixveriwave.vht_su_coding_type", + FT_UINT16, BASE_DEC, VALS(vht_coding_vals), 0x0, NULL, HFILL } }, { &hf_radiotap_vht_u0_nsts, - { "VHT U0 NSTS})", "ixveriwave.VHT_U0_NSTS", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "MU[0] NSTS", "ixveriwave.VHT_U0_NSTS", + FT_UINT16, BASE_DEC, NULL, 0x001c, NULL, HFILL } }, { &hf_radiotap_vht_u1_nsts, - { "VHT U1 NSTS})", "ixveriwave.VHT_U1_NSTS", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "MU[1] NSTS", "ixveriwave.VHT_U1_NSTS", + FT_UINT16, BASE_DEC, NULL, 0x000e, NULL, HFILL } }, { &hf_radiotap_vht_u2_nsts, - { "VHT U2 NSTS})", "ixveriwave.VHT_U2_NSTS", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "MU[2] NSTS", "ixveriwave.VHT_U2_NSTS", + FT_UINT16, BASE_DEC, NULL, 0x0700, NULL, HFILL } }, { &hf_radiotap_vht_u3_nsts, - { "VHT U3 NSTS})", "ixveriwave.VHT_U3_NSTS", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "MU[3] NSTS", "ixveriwave.VHT_U3_NSTS", + FT_UINT16, BASE_DEC, NULL, 0x3800, NULL, HFILL } }, { &hf_radiotap_vht_beamformed, - { "VHT Beamformed", "ixveriwave.VHT_BEAMFORMED", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "Beamformed", "ixveriwave.BEAMFORMED", + FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL } }, { &hf_radiotap_vht_user_pos, { "VHT User Pos", "ixveriwave.VHT_user_pos", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + FT_UINT8, BASE_DEC, NULL, 0x03, NULL, HFILL } }, + + { &hf_radiotap_vht_ndp_flg, + { "NDP", "ixveriwave.VHT_ndp_flg", + FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL } }, { &hf_radiotap_vht_mu_mimo_flg, - { "VHT MU SU", "ixveriwave.VHT_mu_mimo_flg", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "VHT MU MIMO", "ixveriwave.VHT_mu_mimo_flg", + FT_UINT8, BASE_DEC, NULL, 0x08, NULL, HFILL } }, + + { &hf_radiotap_vht_su_mimo_flg, + { "VHT SU MIMO", "ixveriwave.VHT_su_mimo_flg", + FT_UINT8, BASE_DEC, NULL, 0x04, NULL, HFILL } }, { &hf_radiotap_vht_u0_coding_type, - { "VHT CODING", "ixveriwave.VHT_u0_CODING_TYPE", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "MU[0] Coding Type", "ixveriwave.vht_u0_coding_type", + FT_UINT16, BASE_DEC, VALS(vht_coding_vals), 0x0, NULL, HFILL } }, { &hf_radiotap_vht_u1_coding_type, - { "VHT CODING", "ixveriwave.VHT_u1_CODING_TYPE", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "MU[1] Coding Type", "ixveriwave.vht_u1_coding_type", + FT_UINT16, BASE_DEC, VALS(vht_coding_vals), 0x0, NULL, HFILL } }, { &hf_radiotap_vht_u2_coding_type, - { "VHT CODING", "ixveriwave.VHT_u2_CODING_TYPE", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { "MU[2] Coding Type", "ixveriwave.vht_u2_coding_type", + FT_UINT16, BASE_DEC, VALS(vht_coding_vals), 0x0, NULL, HFILL } }, { &hf_radiotap_vht_u3_coding_type, - { "VHT CODING", "ixveriwave.VHT_u3_CODING_TYPE", + { "MU[3] Coding Type", "ixveriwave.vht_u3_coding_type", + FT_UINT16, BASE_DEC, VALS(vht_coding_vals), 0x0, NULL, HFILL } }, + + { &hf_radiotap_rf_info, + { "RF Header", "ixveriwave.RFInfo", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } }, + + { &hf_radiotap_tx, + { "Layer 1 Header (Direction=Transmit)", "ixveriwave.l1info", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_radiotap_rx, + { "Layer 1 Header (Direction=Receive)", "ixveriwave.l1info", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } }, + + { &hf_radiotap_modulation, + { "Modulation", "ixveriwave.Modulation", + FT_UINT8, BASE_DEC, VALS(modulation_type), 0x0, NULL, HFILL } }, + + { &hf_radiotap_preamble, + { "Preamble", "ixveriwave.preamble", + FT_UINT8, BASE_DEC, VALS(l1_preamble_type), 0x0, NULL, HFILL } }, + + { &hf_radiotap_sigbandwidth, + { "Signaling Band Width", "ixveriwave.sigbandwidth", + FT_UINT8, BASE_DEC, VALS(sbw_type), 0x0, NULL, HFILL } }, +#if 0 + {&hf_radiotap_rssi, + { "RSSI", "ixveriwave.rssi", + FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, +#endif + {&hf_radiotap_l1infoc, + {"L1InfoC", "ixveriwave.l1InfoC", + FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_sigbandwidthmask, + { "Signaling Band Width Mask", "ixveriwave.sigbandwidthmask", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_antennaportenergydetect, + { "Antenna Port Energy Detect", "ixveriwave.antennaportenergydetect", + FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL } }, + + { &hf_radiotap_mumask, + { "MU_MASK", "ixveriwave.mumask", + FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL } }, + + { &hf_radiotap_plcp_info, + {"PLCP Header", "ixveriwave.plcp_info", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_radiotap_l2_l4_info, + {"Layer 2-4 Header", "ixveriwave.l2_l4info", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_radiotap_bssid, + {"BSS ID", "ixveriwave.bssid", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_unicastormulticast, + { "Unicast/Multicast", "ixveriwave.unicastormulticast", + FT_UINT8, BASE_DEC, VALS(bmbit), 0x80, NULL, HFILL } }, + + { &hf_radiotap_clientidvalid, + { "Client Id Valid", "ixveriwave.clientidvalid", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL } }, + + { &hf_radiotap_bssidvalid, + { "BSS ID Valid", "ixveriwave.bssidvalid", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL } }, + + { &hf_radiotap_flowvalid, + { "Flow Id Valid", "ixveriwave.flowvalid", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL } }, + + { &hf_radiotap_l4idvalid, + { "Layer 4 Id Valid", "ixveriwave.l4idvalid", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL } }, + + { &hf_radiotap_istypeqos, + { "Is Type QOS", "ixveriwave.istypeqos", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL } }, + + { &hf_radiotap_containshtfield, + { "Contains HT Field", "ixveriwave.containshtfield", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL } }, + + { &hf_radiotap_tid, + { "TID", "ixveriwave.tid", + FT_UINT16, BASE_HEX, NULL, 0x01c0, NULL, HFILL } }, +#if 0 + { &hf_radiotap_wlantype, + { "WLAN Type", "ixveriwave.wlantype", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, +#endif + { &hf_radiotap_payloaddecode, + { "Payload Decode", "ixveriwave.payloaddecode", + FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_bw, + { "BW", "ixveriwave.bw", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_stbc, + { "STBC", "ixveriwave.stbc", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_vht_txop_ps_notallowd, + { "TXOP_PS_NOT_ALLOWD", "ixveriwave.txop_ps_notallowd", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_shortgi, + { "Short GI", "ixveriwave.shortgi", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_shortginsymdisa, + { "Short GI NSYM DISA", "ixveriwave.shortginsymdisa", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_ldpc_ofdmsymbol, + { "LDPC Extra OFDM Symbol", "ixveriwave.ldpc_ofdmsymbol", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_su_mcs, + { "SU VHT-MCS", "ixveriwave.su_mcs", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_crc, + { "CRC8", "ixveriwave.crc", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_tail, + { "Tail", "ixveriwave.tail", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_length, + { "VHT Length", "ixveriwave.vht.length", + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_rfid, + { "RFID", "ixveriwave.rfid", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_vht_mcs, + { "VHT MCS", "ixveriwave.vhtmcs", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_parity, + { "Parity", "ixveriwave.parity", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_rate, + { "Rate", "ixveriwave.rate", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_plcp_length, + { "PLCP Length", "ixveriwave.length", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_feccoding, + { "FEC Coding", "ixveriwave.feccoding", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_aggregation, + { "Aggregation", "ixveriwave.aggregation", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_notsounding, + { "Not Sounding", "ixveriwave.notsounding", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_smoothing, + { "Smoothing", "ixveriwave.smoothing", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_ness, + { "NUMBER of Extension Spatial Streams", "ixveriwave.ness", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_plcp_service, + { "Service", "ixveriwave.plcp.service", + FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_plcp_signal, + { "Signal", "ixveriwave.plcp.signal", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_plcp_default, + { "PLCP", "ixveriwave.plcp", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_tx_antennaselect, + { "Antenna Select", "ixveriwave.tx.antennaselect", + FT_UINT8, BASE_HEX, NULL, 0x07, NULL, HFILL } }, + { &hf_radiotap_tx_stbcselect, + { "STBC Select", "ixveriwave.tx.stbcselect", + FT_UINT8, BASE_HEX, NULL, 0x18, NULL, HFILL } }, + { &hf_radiotap_ac, + { "AC", "ixveriwave.tx.ac", + FT_UINT8, BASE_HEX, NULL, 0x0e, NULL, HFILL } }, + { &hf_radiotap_crc16, + { "CRC16", "ixveriwave.crc16", + FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_plcp_type, + { "PLCP_TYPE", "ixveriwave.plcp.type", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + // RF LOGGING +#if 0 + { &hf_radiotap_rfinfo_noise, + { "Noise", "ixveriwave.rfinfo.noise", + FT_FLOAT, 0, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_noise_anta, + { "Noise Antenna A", "ixveriwave.noise_anta", + FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_noise_antb, + { "Noise Antenna B", "ixveriwave.noise_antb", + FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_noise_antc, + { "Noise Antenna C", "ixveriwave.noise_antc", + FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_noise_antd, + { "Noise Antenna D", "ixveriwave.noise_antd", + FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, +#endif + { &hf_radiotap_rfinfo_snr, + { "SNR", "ixveriwave.snr", + FT_NONE, BASE_NONE, NULL, 0x0, "Signal-to-noise ratio", HFILL } }, + { &hf_radiotap_rfinfo_snr_anta, + { "SNR Antenna A", "ixveriwave.snr_anta", + FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_decibels, 0x0, "Signal-to-noise ratio", HFILL } }, + { &hf_radiotap_rfinfo_snr_antb, + { "SNR Antenna B", "ixveriwave.snr_antb", + FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_decibels, 0x0, "Signal-to-noise ratio", HFILL } }, + { &hf_radiotap_rfinfo_snr_antc, + { "SNR Antenna C", "ixveriwave.snr_antc", + FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_decibels, 0x0, "Signal-to-noise ratio", HFILL } }, + { &hf_radiotap_rfinfo_snr_antd, + { "SNR Antenna D", "ixveriwave.snr_antd", + FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_decibels, 0x0, "Signal-to-noise ratio", HFILL } }, + + { &hf_radiotap_rfinfo_pfe, + { "PFE", "ixveriwave.rfinfo.pfe", + FT_NONE, BASE_NONE, NULL, 0x0, "Preamble Frequency Error metric", HFILL } }, + { &hf_radiotap_rfinfo_pfe_anta, + { "PFE SS#1", "ixveriwave.pfe_anta", + FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_hz, 0x0, "Preamble Frequency Error metric", HFILL } }, + { &hf_radiotap_rfinfo_pfe_antb, + { "PFE SS#2", "ixveriwave.pfe_antb", + FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_hz, 0x0, "Preamble Frequency Error metric", HFILL } }, + { &hf_radiotap_rfinfo_pfe_antc, + { "PFE SS#3", "ixveriwave.pfe_antc", + FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_hz, 0x0, "Preamble Frequency Error metric", HFILL } }, + { &hf_radiotap_rfinfo_pfe_antd, + { "PFE SS#4", "ixveriwave.pfe_antd", + FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_hz, 0x0, "Preamble Frequency Error metric", HFILL } }, + + { &hf_radiotap_rfinfo_contextpa, + { "CONTEXT_A", "ixveriwave.contextpa", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpb, + { "CONTEXT_B", "ixveriwave.contextpb", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpc, + { "CONTEXT_C", "ixveriwave.contextpc", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpd, + { "CONTEXT_D", "ixveriwave.contextpd", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpA_bit0, + { "SNR_NOISE_valid", "ixveriwave.contextpA.bit0", + FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpA_bit1, + { "PFE_valid", "ixveriwave.contextpA.bit1", + FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpA_bit2, + { "PFE_is_CCK", "ixveriwave.contextpA.bit2", + FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } }, +#if 0 + { &hf_radiotap_rfinfo_contextp_bits3, + { "AGC", "ixveriwave.contextp.bits3", + FT_BOOLEAN, 16, NULL, 0x0038, "Automatic Gain Control", HFILL } }, +#endif + { &hf_radiotap_rfinfo_contextpA_bit3, + { "AGC 3", "ixveriwave.contextpA.bit3", + FT_BOOLEAN, 16, NULL, 0x0008, "Automatic Gain Control-[3] agc_idle2iqrdy_no_gain_change", HFILL } }, + { &hf_radiotap_rfinfo_contextpA_bit4, + { "AGC 4", "ixveriwave.contextpA.bit4", + FT_BOOLEAN, 16, NULL, 0x0010, "Automatic Gain Control-[4] agc_high_pwr_terminated", HFILL } }, + { &hf_radiotap_rfinfo_contextpA_bit5, + { "AGC 5", "ixveriwave.contextpA.bit5", + FT_BOOLEAN, 16, NULL, 0x0020, "Automatic Gain Control-[5] agc_high_pwr_terminator", HFILL } }, +#if 0 + { &hf_radiotap_rfinfo_contextpA_bit8, + { "Frame format", "ixveriwave.contextp.bits8", + FT_UINT16, BASE_DEC, VALS(frameformat_type), 0x0300, "0: LEGACY. 1:HT. 3:-VHT.", HFILL } }, + { &hf_radiotap_rfinfo_contextpA_bit10, + { "OFDM or CCK", "ixveriwave.contextp.bit10", + FT_BOOLEAN, 16, TFS(&tfs_legacy_type), 0x0400, "0: LEGACY OFDM 1: 802.11b LEGACY CCK", HFILL } }, + { &hf_radiotap_rfinfo_contextpA_bit11, + { "SigBandWidth of EVM", "ixveriwave.contextp.bits11", + FT_UINT16, BASE_DEC, VALS(sbw_evm), 0x1800, "Signal Bandwidth of EVM measurement", HFILL } }, +#endif + { &hf_radiotap_rfinfo_contextpA_bit13, + { "QAM modulation", "ixveriwave.contextpA.bits13", + FT_BOOLEAN, 16, NULL, 0xe000, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_contextpB_bit0, + { "SNR_NOISE_valid", "ixveriwave.contextpB.bit0", + FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpB_bit1, + { "PFE_valid", "ixveriwave.contextpB.bit1", + FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpB_bit2, + { "PFE_is_CCK", "ixveriwave.contextpB.bit2", + FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpB_bit3, + { "AGC 3", "ixveriwave.contextpB.bit3", + FT_BOOLEAN, 16, NULL, 0x0008, "Automatic Gain Control-[3] agc_idle2iqrdy_no_gain_change", HFILL } }, + { &hf_radiotap_rfinfo_contextpB_bit4, + { "AGC 4", "ixveriwave.contextpB.bit4", + FT_BOOLEAN, 16, NULL, 0x0010, "Automatic Gain Control-[4] agc_high_pwr_terminated", HFILL } }, + { &hf_radiotap_rfinfo_contextpB_bit5, + { "AGC 5", "ixveriwave.contextpB.bit5", + FT_BOOLEAN, 16, NULL, 0x0020, "Automatic Gain Control-[5] agc_high_pwr_terminator", HFILL } }, + { &hf_radiotap_rfinfo_contextpB_bit13, + { "QAM modulation", "ixveriwave.contextpB.bits13", + FT_BOOLEAN, 16, NULL, 0xe000, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_contextpC_bit0, + { "SNR_NOISE_valid", "ixveriwave.contextpC.bit0", + FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpC_bit1, + { "PFE_valid", "ixveriwave.contextpC.bit1", + FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpC_bit2, + { "PFE_is_CCK", "ixveriwave.contextpC.bit2", + FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpC_bit3, + { "AGC 3", "ixveriwave.contextpC.bit3", + FT_BOOLEAN, 16, NULL, 0x0008, "Automatic Gain Control-[3] agc_idle2iqrdy_no_gain_change", HFILL } }, + { &hf_radiotap_rfinfo_contextpC_bit4, + { "AGC 4", "ixveriwave.contextpC.bit4", + FT_BOOLEAN, 16, NULL, 0x0010, "Automatic Gain Control-[4] agc_high_pwr_terminated", HFILL } }, + { &hf_radiotap_rfinfo_contextpC_bit5, + { "AGC 5", "ixveriwave.contextpC.bit5", + FT_BOOLEAN, 16, NULL, 0x0020, "Automatic Gain Control-[5] agc_high_pwr_terminator", HFILL } }, + { &hf_radiotap_rfinfo_contextpC_bit13, + { "QAM modulation", "ixveriwave.contextpC.bits13", + FT_BOOLEAN, 16, NULL, 0xe000, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_contextpD_bit0, + { "SNR_NOISE_valid", "ixveriwave.contextpD.bit0", + FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpD_bit1, + { "PFE_valid", "ixveriwave.contextpD.bit1", + FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpD_bit2, + { "PFE_is_CCK", "ixveriwave.contextpD.bit2", + FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } }, + { &hf_radiotap_rfinfo_contextpD_bit3, + { "AGC 3", "ixveriwave.contextpD.bit3", + FT_BOOLEAN, 16, NULL, 0x0008, "Automatic Gain Control-[3] agc_idle2iqrdy_no_gain_change", HFILL } }, + { &hf_radiotap_rfinfo_contextpD_bit4, + { "AGC 4", "ixveriwave.contextpD.bit4", + FT_BOOLEAN, 16, NULL, 0x0010, "Automatic Gain Control-[4] agc_high_pwr_terminated", HFILL } }, + { &hf_radiotap_rfinfo_contextpD_bit5, + { "AGC 5", "ixveriwave.contextpD.bit5", + FT_BOOLEAN, 16, NULL, 0x0020, "Automatic Gain Control-[5] agc_high_pwr_terminator", HFILL } }, + { &hf_radiotap_rfinfo_contextpD_bit13, + { "QAM modulation", "ixveriwave.contextpD.bits13", + FT_BOOLEAN, 16, NULL, 0xe000, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_frameformatA, + { "Frame format", "ixveriwave.rfinfo.frameformatA", + FT_UINT8, BASE_DEC, VALS(frameformat_type), 0x03, NULL, HFILL } }, + { &hf_radiotap_rfinfo_frameformatB, + { "Frame format", "ixveriwave.rfinfo.frameformatB", + FT_UINT8, BASE_DEC, VALS(frameformat_type), 0x03, NULL, HFILL } }, + { &hf_radiotap_rfinfo_frameformatC, + { "Frame format", "ixveriwave.rfinfo.frameformatC", + FT_UINT8, BASE_DEC, VALS(frameformat_type), 0x03, NULL, HFILL } }, + { &hf_radiotap_rfinfo_frameformatD, + { "Frame format", "ixveriwave.rfinfo.frameformatD", + FT_UINT8, BASE_DEC, VALS(frameformat_type), 0x03, NULL, HFILL } }, + { &hf_radiotap_rfinfo_legacytypeA, + { "Frame format", "ixveriwave.rfinfo.legacytypeA", + FT_BOOLEAN, 8, TFS(&tfs_legacy_type), 0x04, NULL, HFILL } }, + { &hf_radiotap_rfinfo_legacytypeB, + { "Frame format", "ixveriwave.rfinfo.legacytypeB", + FT_BOOLEAN, 8, TFS(&tfs_legacy_type), 0x04, NULL, HFILL } }, + { &hf_radiotap_rfinfo_legacytypeC, + { "Frame format", "ixveriwave.rfinfo.legacytypeC", + FT_BOOLEAN, 8, TFS(&tfs_legacy_type), 0x04, NULL, HFILL } }, + { &hf_radiotap_rfinfo_legacytypeD, + { "Frame format", "ixveriwave.rfinfo.legacytypeD", + FT_BOOLEAN, 8, TFS(&tfs_legacy_type), 0x04, NULL, HFILL } }, + { &hf_radiotap_rfinfo_sigbwevmA, + { "SigBandWidth of EVM", "ixveriwave.rfinfo.sigbwevmA", + FT_UINT8, BASE_DEC, VALS(sbw_evm), 0x18, NULL, HFILL } }, + { &hf_radiotap_rfinfo_sigbwevmB, + { "SigBandWidth of EVM", "ixveriwave.rfinfo.sigbwevmB", + FT_UINT8, BASE_DEC, VALS(sbw_evm), 0x18, NULL, HFILL } }, + { &hf_radiotap_rfinfo_sigbwevmC, + { "SigBandWidth of EVM", "ixveriwave.rfinfo.sigbwevmC", + FT_UINT8, BASE_DEC, VALS(sbw_evm), 0x18, NULL, HFILL } }, + { &hf_radiotap_rfinfo_sigbwevmD, + { "SigBandWidth of EVM", "ixveriwave.rfinfo.sigbwevmD", + FT_UINT8, BASE_DEC, VALS(sbw_evm), 0x18, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_sigdata, + { "AVG EVM SIG Data", "ixveriwave.rfinfo.sigdata", + FT_NONE, BASE_NONE, NULL, 0x0, "Average EVM for DATA SUBCARRIERS for all SIG symbols of the frame", HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_sd_siga, + { "AVG EVM SIG Data SS#1", "ixveriwave.avg_evm_sda", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_sd_sigb, + { "AVG EVM SIG Data SS#2", "ixveriwave.avg_evm_sdb", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_sd_sigc, + { "AVG EVM SIG Data SS#3", "ixveriwave.avg_evm_sdc", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_sd_sigd, + { "AVG EVM SIG Data SS#4", "ixveriwave.avg_evm_sdd", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_sigpilot, + { "AVG EVM SIG Pilot", "ixveriwave.rfinfo.sigpilot", + FT_NONE, BASE_NONE, NULL, 0x0, "Average EVM for PILOT SUBCARRIERS for all SIG symbols of the frame", HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_sp_siga, + { "AVG EVM SIG Pilot SS#1", "ixveriwave.avg_evm_spa", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_sp_sigb, + { "AVG EVM SIG Pilot SS#2", "ixveriwave.avg_evm_spb", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_sp_sigc, + { "AVG EVM SIG Pilot SS#3", "ixveriwave.avg_evm_spc", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_sp_sigd, + { "AVG EVM SIG Pilot SS#4", "ixveriwave.avg_evm_spd", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_datadata, + { "AVG EVM DATA Data", "ixveriwave.rfinfo.datadata", + FT_NONE, BASE_NONE, NULL, 0x0, "Average EVM for DATA SUBCARRIERS for all DATA symbols of the frame", HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_dd_siga, + { "AVG EVM DATA Data SS#1", "ixveriwave.avg_evm_dda", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_dd_sigb, + { "AVG EVM DATA Data SS#2", "ixveriwave.avg_evm_ddb", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_dd_sigc, + { "AVG EVM DATA Data SS#3", "ixveriwave.avg_evm_ddc", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_dd_sigd, + { "AVG EVM DATA Data SS#4", "ixveriwave.avg_evm_ddd", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_datapilot, + { "AVG EVM DATA Pilot", "ixveriwave.rfinfo.datapilot", + FT_NONE, BASE_NONE, NULL, 0x0, "Average EVM for PILOT SUBCARRIERS for all DATA symbols of the frame", HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_dp_siga, + { "AVG EVM DATA Pilot SSI-1", "ixveriwave.avg_evm_dpa", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_dp_sigb, + { "AVG EVM DATA Pilot SSI-2", "ixveriwave.avg_evm_dpb", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_dp_sigc, + { "AVG EVM DATA Pilot SSI-3", "ixveriwave.avg_evm_dpc", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_dp_sigd, + { "AVG EVM DATA Pilot SSI-4", "ixveriwave.avg_evm_dpd", + FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_avg_ws_symbol, + { "EVM Worst Symbol", "ixveriwave.wssymbol", + FT_NONE, BASE_NONE, NULL, 0, "WORST-CASE SYMBOL", HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_ws_siga, + { "EVM Worst Symbol SS#1", "ixveriwave.avg_evm_wsa", + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_percent, 0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_ws_sigb, + { "EVM Worst Symbol SS#2", "ixveriwave.avg_evm_wsb", + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_percent, 0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_ws_sigc, + { "EVM Worst Symbol SS#3", "ixveriwave.avg_evm_wsc", + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_percent, 0, NULL, HFILL } }, + { &hf_radiotap_rfinfo_avg_evm_ws_sigd, + { "EVM Worst Symbol SS#4", "ixveriwave.avg_evm_wsd", + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_percent, 0, NULL, HFILL } }, + + { &hf_radiotap_rfinfo_rfid, + { "RF_ID", "ixveriwave.rfinfo.rfid", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, +#if 0 + { &hf_radiotap_rfinfo_tbd, + { "RF_TBD", "ixveriwave.rfinfo.tbd", + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, +#endif { &hf_radiotap_vw_errors, { "Errors", "ixveriwave.errors", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, @@ -1587,11 +3927,148 @@ framing signal deasserted. this is caused by software setting the drain all reg { "L4(TCP/ICMP/IGMP/UDP) checksum error", "ixveriwave.errors.bit11", FT_BOOLEAN, 16, NULL, 0x0800, NULL, HFILL } }, + { &hf_radiotap_vw_errors_tx_bit01, + { "CRC32 Error", "ixveriwave.errors.bit1", + FT_BOOLEAN, 32, NULL, 0x00000002, NULL, HFILL } }, + { &hf_radiotap_vw_errors_tx_bit05, + { "IP Checksum Error", "ixveriwave.errors.bit5", + FT_BOOLEAN, 32, NULL, 0x00000020, NULL, HFILL } }, + { &hf_radiotap_vw_errors_tx_bit8, + { "ACK Timeout", "ixveriwave.errors.bit8", + FT_BOOLEAN, 32, NULL, 0x00000100, NULL, HFILL } }, + { &hf_radiotap_vw_errors_tx_bit9, + { "CTS Timeout", "ixveriwave.errors.bit9", + FT_BOOLEAN, 32, NULL, 0x00000200, NULL, HFILL } }, + { &hf_radiotap_vw_errors_tx_bit10, + { "Last Retry Attempt for this MPDU", "ixveriwave.errors.bit10", + FT_BOOLEAN, 32, NULL, 0x00000400, NULL, HFILL } }, + { &hf_radiotap_vw_errors_tx_bit31, + { "Internal Error", "ixveriwave.errors.bit31", + FT_BOOLEAN, 32, NULL, 0x80000000, NULL, HFILL } }, + { &hf_radiotap_vw_tx_retrycount, + { "Retry Count", "ixveriwave.tx.retrycount", + FT_UINT8, BASE_DEC, NULL, 0x1f, NULL, HFILL } }, + { &hf_radiotap_vw_tx_factorydebug, + { "Factory Debug", "ixveriwave.tx.factorydebug", + FT_UINT8, BASE_HEX, NULL, 0x7f80, NULL, HFILL } }, + + { &hf_radiotap_vw_errors_rx_bit0, + { "SIG Field CRC/Parity Error", "ixveriwave.errors.bit0", + FT_BOOLEAN, 32, NULL, 0x00000001, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit1, + { "Non-supported service field", "ixveriwave.errors.bit1", + FT_BOOLEAN, 32, NULL, 0x00000002, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit2, + { "Frame Length Error", "ixveriwave.errors.bit2", + FT_BOOLEAN, 32, NULL, 0x00000004, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit3, + { "VHT_SIG_A/B CRC Error", "ixveriwave.errors.bit3", + FT_BOOLEAN, 32, NULL, 0x00000008, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit4, + { "CRC32 Error", "ixveriwave.errors.bit4", + FT_BOOLEAN, 32, NULL, 0x00000010, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit5, + { "L2 de-aggregation error", "ixveriwave.errors.bit5", + FT_BOOLEAN, 32, NULL, 0x00000020, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit6, + { "Duplicate MPDU", "ixveriwave.errors.bit6", + FT_BOOLEAN, 32, NULL, 0x00000040, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit7, + { "Bad Flow Magic Number", "ixveriwave.errors.bit7", + FT_BOOLEAN, 32, NULL, 0x00000080, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit8, + { "Bad flow payload checksum", "ixveriwave.errors.bit8", + FT_BOOLEAN, 32, NULL, 0x00000100, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit9, + { "Illegal VHT_SIG Value", "ixveriwave.errors.bit9", + FT_BOOLEAN, 32, NULL, 0x00000200, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit10, + { "Bad IP checksum error", "ixveriwave.errors.bit10", + FT_BOOLEAN, 32, NULL, 0x00000400, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit11, + { "TCP/ICMP/IGMP/UDP Checksum Error", "ixveriwave.errors.bit11", + FT_BOOLEAN, 32, NULL, 0x00000800, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit12, + { "Layer 1 Unsupported Feature", "ixveriwave.errors.bit12", + FT_BOOLEAN, 32, NULL, 0x00001000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit14, + { "Layer 1 Packet Termination", "ixveriwave.errors.bit14", + FT_BOOLEAN, 32, NULL, 0x00004000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit15, + { "Internal Error", "ixveriwave.errors.bit15", + FT_BOOLEAN, 32, NULL, 0x00008000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit16, + { "WEP IVC/TKIP/CCMP/BIP MIC Miscompare", "ixveriwave.errors.bit16", + FT_BOOLEAN, 32, NULL, 0x00010000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit17, + { "WEP/TKIP Rate Exceeded", "ixveriwave.errors.bit17", + FT_BOOLEAN, 32, NULL, 0x00020000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit18, + { "Crypto Short Error", "ixveriwave.errors.bit18", + FT_BOOLEAN, 32, NULL, 0x00040000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit19, + { "EXTIV Fault A", "ixveriwave.errors.bit19", + FT_BOOLEAN, 32, NULL, 0x00080000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit20, + { "EXTIV Fault B", "ixveriwave.errors.bit20", + FT_BOOLEAN, 32, NULL, 0x00100000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit21, + { "Internal Error", "ixveriwave.errors.bit21", + FT_BOOLEAN, 32, NULL, 0x00200000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit22, + { "Protected Fault A", "ixveriwave.errors.bit22", + FT_BOOLEAN, 32, NULL, 0x00400000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit23, + { "RX MAC Crypto Incompatibility", "ixveriwave.errors.bit23", + FT_BOOLEAN, 32, NULL, 0x00800000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit24, + { "Factory Debug", "ixveriwave.errors.bit24", + FT_BOOLEAN, 32, NULL, 0x7F000000, NULL, HFILL } }, + { &hf_radiotap_vw_errors_rx_bit31, + { "Internal Error", "ixveriwave.errors.bit31", + FT_BOOLEAN, 32, NULL, 0x80000000, NULL, HFILL } }, + { &hf_radiotap_vw_info, { "Info field", "ixveriwave.info", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx, + { "Info field", "ixveriwave.info", + FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx, + { "Info field", "ixveriwave.info", + FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* tx info decodes for VW510021 and previous versions */ + + /* + { &hf_radiotap_vw_info_tx_bit0, + { "Crypto WEP Encoded", "ixveriwave.info.bit0", + FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit1, + { "Crypto TKIP Encoded", "ixveriwave.info.bit1", + FT_BOOLEAN, 16, NULL, 0x0006, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit3, + { "Crypto C bit Error", "ixveriwave.info.bit3", + FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit4, + { "Crypto TKIP not full MSDU", "ixveriwave.info.bit4", + FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit5, + { "Crypto Software Error", "ixveriwave.info.bit5", + FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit6, + { "Crypto Short Fault", "ixveriwave.info.bit6", + FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit7, + { "Crypto Payload Length Fault", "ixveriwave.info.bit7", + FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit8, + { "Sent RTS before Data", "ixveriwave.info.bit8", + FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit9, + { "Sent CTS to Self before Data", "ixveriwave.info.bit9", + FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit10, { "MPDU of A-MPDU", "ixveriwave.info.bit10", FT_BOOLEAN, 16, NULL, INFO_MPDU_OF_A_MPDU, NULL, HFILL } }, @@ -1615,9 +4092,155 @@ framing signal deasserted. this is caused by software setting the drain all reg { &hf_radiotap_vw_info_tx_bit15, { "Last MSDU of A-MSDU", "ixveriwave.info.bit15", FT_BOOLEAN, 16, NULL, INFO_LAST_MSDU_OF_A_MSDU, NULL, HFILL } }, + */ + /* tx info decodes for VW510021 and previous versions */ + { &hf_radiotap_vw_info_tx_bit0, + { "Crypto WEP Encoded", "ixveriwave.info.bit0", + FT_UINT16, BASE_DEC, NULL, 0x0001, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit1, + { "Crypto TKIP Encoded", "ixveriwave.info.bit1", + FT_UINT16, BASE_DEC, VALS(crypto_TKIP_type), 0x0006, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit3, + { "Crypto C bit Error", "ixveriwave.info.bit3", + FT_UINT16, BASE_DEC, NULL, 0x0008, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit4, + { "Crypto TKIP not full MSDU", "ixveriwave.info.bit4", + FT_UINT16, BASE_DEC, NULL, 0x0010, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit5, + { "Crypto Software Error", "ixveriwave.info.bit5", + FT_UINT16, BASE_DEC, NULL, 0x0020, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit6, + { "Crypto Short Fault", "ixveriwave.info.bit6", + FT_UINT16, BASE_DEC, NULL, 0x0040, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit7, + { "Crypto Payload Length Fault", "ixveriwave.info.bit7", + FT_UINT16, BASE_DEC, NULL, 0x0080, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit8, + { "Sent RTS before Data", "ixveriwave.info.bit8", + FT_UINT16, BASE_DEC, NULL, 0x0100, NULL, HFILL } }, + { &hf_radiotap_vw_info_tx_bit9, + { "Sent CTS to Self before Data", "ixveriwave.info.bit9", + FT_UINT16, BASE_DEC, NULL, 0x0200, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_bit10, + { "MPDU of A-MPDU", "ixveriwave.info.bit10", + FT_UINT16, BASE_DEC, NULL, INFO_MPDU_OF_A_MPDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_bit11, + { "First MPDU of A-MPDU", "ixveriwave.info.bit11", + FT_UINT16, BASE_DEC, NULL, INFO_FIRST_MPDU_OF_A_MPDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_bit12, + { "Last MPDU of A-MPDU", "ixveriwave.info.bit12", + FT_UINT16, BASE_DEC, NULL, INFO_LAST_MPDU_OF_A_MPDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_bit13, + { "MSDU of A-MSDU", "ixveriwave.info.bit13", + FT_UINT16, BASE_DEC, NULL, INFO_MSDU_OF_A_MSDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_bit14, + { "First MSDU of A-MSDU", "ixveriwave.info.bit14", + FT_UINT16, BASE_DEC, NULL, INFO_FIRST_MSDU_OF_A_MSDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_bit15, + { "Last MSDU of A-MSDU", "ixveriwave.info.bit15", + FT_UINT16, BASE_DEC, NULL, INFO_LAST_MSDU_OF_A_MSDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_2_bit10, + { "MPDU of A-MPDU", "ixveriwave.info.bit10", + FT_BOOLEAN, 16, NULL, INFO_MPDU_OF_A_MPDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_2_bit11, + { "First MPDU of A-MPDU", "ixveriwave.info.bit11", + FT_BOOLEAN, 16, NULL, INFO_FIRST_MPDU_OF_A_MPDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_2_bit12, + { "Last MPDU of A-MPDU", "ixveriwave.info.bit12", + FT_BOOLEAN, 16, NULL, INFO_LAST_MPDU_OF_A_MPDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_2_bit13, + { "MSDU of A-MSDU", "ixveriwave.info.bit13", + FT_BOOLEAN, 16, NULL, INFO_MSDU_OF_A_MSDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_2_bit14, + { "First MSDU of A-MSDU", "ixveriwave.info.bit14", + FT_BOOLEAN, 16, NULL, INFO_FIRST_MSDU_OF_A_MSDU, NULL, HFILL } }, + + { &hf_radiotap_vw_info_tx_2_bit15, + { "Last MSDU of A-MSDU", "ixveriwave.info.bit15", + FT_BOOLEAN, 16, NULL, INFO_LAST_MSDU_OF_A_MSDU, NULL, HFILL } }, /*v510006 uses bits */ /* rx info decodes for fpga ver VW510021 */ + { &hf_radiotap_vw_info_rx_bit0, + { "Crypto WEP Encoded", "ixveriwave.info.bit0", + FT_UINT24, BASE_DEC, NULL, 0x000001, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit1, + { "Crypto TKIP Encoded", "ixveriwave.info.bit1", + FT_UINT24, BASE_DEC, VALS(crypto_TKIP_type), 0x000006, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit3, + { "Crypto RX TKIP TSC SEQSKIP", "ixveriwave.info.bit3", + FT_UINT24, BASE_DEC, NULL, 0x000008, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit4, + { "Crypto RX CCMP PN SEQSKIP", "ixveriwave.info.bit4", + FT_UINT24, BASE_DEC, NULL, 0x000010, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit5, + { "TKIP not full MSDU", "ixveriwave.info.bit5", + FT_UINT24, BASE_DEC, NULL, 0x000020, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit6, + { "MPDU Length field is greater than MPDU octets", "ixveriwave.info.bit6", + FT_UINT24, BASE_DEC, NULL, 0x000040, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit7, + { "RX TKIP / CCMP TSC SEQERR", "ixveriwave.info.bit7", + FT_UINT24, BASE_DEC, NULL, 0x000080, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit8, + { "ACK withheld from frame", "ixveriwave.info.bit8", + FT_UINT24, BASE_DEC, NULL, 0x000100, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit9, + { "Client BSSID matched", "ixveriwave.info.bit9", + FT_UINT24, BASE_DEC, NULL, 0x000200, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit10, + { "MPDU of an A-MPDU", "ixveriwave.info.bit10", + FT_UINT24, BASE_DEC, NULL, 0x000400, NULL, HFILL } }, + + { &hf_radiotap_vw_info_rx_bit11, + { "First MPDU of A-MPDU", "ixveriwave.info.bit11", + FT_UINT24, BASE_DEC, NULL, 0x000800, NULL, HFILL } }, + + { &hf_radiotap_vw_info_rx_bit12, + { "Last MPDU of A-MPDU", "ixveriwave.info.bit12", + FT_UINT24, BASE_DEC, NULL, 0x001000, NULL, HFILL } }, + + { &hf_radiotap_vw_info_rx_bit13, + { "MSDU of A-MSDU", "ixveriwave.info.bit13", + FT_UINT24, BASE_DEC, NULL, 0x002000, NULL, HFILL } }, + + { &hf_radiotap_vw_info_rx_bit14, + { "First MSDU of A-MSDU", "ixveriwave.info.bit14", + FT_UINT24, BASE_DEC, NULL, 0x004000, NULL, HFILL } }, + + { &hf_radiotap_vw_info_rx_bit15, + { "Last MSDU of A-MSDU", "ixveriwave.info.bit15", + FT_UINT24, BASE_DEC, NULL, 0x008000, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit16, + { "Layer 1 Info[0]", "ixveriwave.info.bit16", + FT_UINT24, BASE_DEC, NULL, 0x010000, NULL, HFILL } }, + + { &hf_radiotap_vw_info_rx_bit17, + { "Layer 1 Info[1]", "ixveriwave.info.bit17", + FT_UINT24, BASE_DEC, NULL, 0x020000, NULL, HFILL } }, + + { &hf_radiotap_vw_info_rx_bit18, + { "VHT frame received with the use of the VHT_SIG_B.LENGTH", "ixveriwave.info.bit18", + FT_UINT24, BASE_DEC, NULL, 0x040000, NULL, HFILL } }, + + { &hf_radiotap_vw_info_rx_bit19, + { "VHT frame received without the use of VHT_SIG_B.LENGTH", "ixveriwave.info.bit19", + FT_UINT24, BASE_DEC, NULL, 0x080000, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_bit20, + { "Factory Internal", "ixveriwave.info.bit20", + FT_UINT24, BASE_DEC, NULL, 0xf00000, NULL, HFILL } }, + { &hf_radiotap_vw_info_rx_2_bit8, { "ACK withheld from frame", "ixveriwave.info.bit8", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL } }, @@ -1660,12 +4283,28 @@ framing signal deasserted. this is caused by software setting the drain all reg &ett_radiotap_flags, &ett_radiotap_info, &ett_radiotap_times, - &ett_radiotap_errors + &ett_radiotap_errors, + &ett_radiotap_layer1, + &ett_radiotap_layer2to4, + &ett_radiotap_rf, + &ett_radiotap_plcp, + &ett_radiotap_infoc, + &ett_rf_info, + &ett_radiotap_contextp, }; + static ei_register_info ei[] = { + { &ei_radiotap_fcs_bad, { "ixveriwave.fcs_error", PI_CHECKSUM, PI_WARN, "FCS error", EXPFILL } }, + }; + + expert_module_t* expert_ixveriwave; + proto_ixveriwave = proto_register_protocol("ixveriwave", "ixveriwave", "ixveriwave"); proto_register_field_array(proto_ixveriwave, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ixveriwave = expert_register_protocol(proto_ixveriwave); + expert_register_field_array(expert_ixveriwave, ei, array_length(ei)); + ixveriwave_handle = register_dissector("ixveriwave", dissect_ixveriwave, proto_ixveriwave); } diff --git a/wiretap/vwr.c b/wiretap/vwr.c index 225a01b5e4..e55a450513 100644 --- a/wiretap/vwr.c +++ b/wiretap/vwr.c @@ -140,7 +140,6 @@ /* Flags, for rflags field */ #define FLAGS_SHORTPRE 0x0002 /* sent/received with short preamble */ #define FLAGS_WEP 0x0004 /* sent/received with WEP encryption */ -#define FLAGS_FCS 0x0010 /* frame includes FCS */ #define FLAGS_CHAN_HT 0x0040 /* In HT mode */ #define FLAGS_CHAN_VHT 0x0080 /* VHT Mode */ #define FLAGS_CHAN_SHORTGI 0x0100 /* Short guard interval */ @@ -177,6 +176,26 @@ /* Size of the VeriWave Ethernet metadata header */ #define EXT_ETHERNET_FIELDS_LEN (2+2+2+4+4+4) +/* Size of Timestamp header including 1st 4 Management bytes for OCTO version FPGA*/ +#define OCTO_TIMESTAMP_FIELDS_LEN (4+4+8+8+4+4) +/* Size of Layer-1, PLCP, and Layer-2/4 header incase of OCTO version FPGA */ +#define OCTO_LAYER1TO4_LEN (2+14+16+23) +/* Size of RF header*/ +#define OCTO_RF_MOD_ACTUAL_LEN 100 /* */ +#define OCTO_MODIFIED_RF_LEN 76 /* 24 bytes of RF are not displayed*/ +/*Offset of differnt parameters of RF header for port-1*/ +#define RF_PORT_1_NOISE_OFF 4 +#define RF_PORT_1_SNR_OFF 6 +#define RF_PORT_1_PFE_OFF 8 +#define RF_PORT_1_CONTEXT_OFF 10 +#define RF_PORT_1_EVM_SD_SIG_OFF 12 +#define RF_PORT_1_EVM_SP_SIG_OFF 14 +#define RF_PORT_1_EVM_SD_DATA_OFF 16 +#define RF_PORT_1_EVM_SP_DATA_OFF 18 +#define RF_PORT_1_DSYMBOL_IDX_OFF 22 +#define RF_INTER_PORT_GAP_OFF 24 /*As size of RF information per port is 24 bytes*/ +#define RF_NUMBER_OF_PORTS 4 + /* FPGA-generated frame buffer STATS block offsets and definitions */ /* definitions for v2.2 frames, Ethernet format */ @@ -225,10 +244,10 @@ #define v22_E_DIFFERENTIATOR_MASK 0x3F /* mask to differentiate ethernet from */ /* Bits in FRAME_TYPE field */ -#define v22_E_IS_TCP 0x00000040 /* TCP */ -#define v22_E_IS_UDP 0x00000010 /* UDP */ -#define v22_E_IS_ICMP 0x00000020 /* ICMP */ -#define v22_E_IS_IGMP 0x00000080 /* IGMP */ +#define v22_E_IS_TCP 0x00000040 /* TCP bit in FRAME_TYPE field */ +#define v22_E_IS_UDP 0x00000010 /* UDP bit in FRAME_TYPE field */ +#define v22_E_IS_ICMP 0x00000020 /* ICMP bit in FRAME_TYPE field */ +#define v22_E_IS_IGMP 0x00000080 /* IGMP bit in FRAME_TYPE field */ /* Bits in MTYPE field (WLAN only) */ #define v22_E_IS_QOS 0x80 /* QoS bit in MTYPE field (WLAN only) */ @@ -240,6 +259,9 @@ #define v22_E_FC_PROT_BIT 0x40 /* Protected Frame bit in FC1 of frame */ +#define v22_E_HEADER_IS_RX 0x21 +#define v22_E_HEADER_IS_TX 0x31 + #define v22_E_IS_ETHERNET 0x00700000 /* bits set in frame type if ethernet */ #define v22_E_IS_80211 0x7F000000 /* bits set in frame type if 802.11 */ @@ -273,13 +295,13 @@ #define v22_W_MT_OFDM 2 /* OFDM modulation */ /* Bits in FRAME_TYPE field */ -#define v22_W_IS_TCP 0x00000040 /* TCP */ -#define v22_W_IS_UDP 0x00000010 /* UDP */ -#define v22_W_IS_ICMP 0x00000020 /* ICMP */ -#define v22_W_IS_IGMP 0x00000080 /* IGMP */ +#define v22_W_IS_TCP 0x00000040 /* TCP bit in FRAME_TYPE field */ +#define v22_W_IS_UDP 0x00000010 /* UDP bit in FRAME_TYPE field */ +#define v22_W_IS_ICMP 0x00000020 /* ICMP bit in FRAME_TYPE field */ +#define v22_W_IS_IGMP 0x00000080 /* IGMP bit in FRAME_TYPE field */ /* Bits in MTYPE field (WLAN only) */ -#define v22_W_IS_QOS 0x80 /* QoS */ +#define v22_W_IS_QOS 0x80 /* QoS */ /* Error flags */ #define v22_W_FCS_ERROR 0x0002 /* FCS error flag in error vector */ @@ -322,6 +344,9 @@ v22_W_FIRST_MSDU_OF_A_MSDU | \ v22_W_LAST_MSDU_OF_A_MSDU) +#define v22_W_HEADER_IS_RX 0x21 +#define v22_W_HEADER_IS_TX 0x31 + #define v22_W_FC_PROT_BIT 0x40 /* Protected Frame bit in FC1 of frame */ #define v22_W_IS_ETHERNET 0x00100000 /* bits set in frame type if ethernet */ @@ -379,7 +404,10 @@ #define vVW510021_W_QOS_VALID 0x4000 #define vVW510021_W_HT_VALID 0x2000 #define vVW510021_W_L4ID_VALID 0x1000 +#define vVW510021_W_PREAMBLE_MASK 0x40 /* short/long preamble/guard(ofdm) mask */ +#define vVW510021_W_MCS_MASK 0x3f /* mcs index (a/b) type mask */ #define vVW510021_W_MOD_SCHEME_MASK 0x3f /* modulation type mask */ +#define vVW510021_W_PLCPC_MASK 0x03 /* PLPCP type mask */ #define vVW510021_W_SEL_MASK 0x80 #define vVW510021_W_WEP_MASK 0x0001 #define vVW510021_W_CBW_MASK 0xC0 @@ -387,14 +415,24 @@ #define vVW510024_W_VCID_MASK 0x03ff /* VC ID is only 10 bits */ #define vVW510021_W_MT_SEL_LEGACY 0x00 - +#define vVW510021_W_PLCP_LEGACY 0x00 +#define vVW510021_W_PLCP_MIXED 0x01 +#define vVW510021_W_PLCP_GREENFIELD 0x02 +#define vVW510021_W_PLCP_VHT_MIXED 0x03 +#define vVW510021_W_HEADER_IS_RX 0x21 +#define vVW510021_W_HEADER_IS_TX 0x31 #define vVW510021_W_IS_WEP 0x0001 -/* L1p byte 1 info */ +#define vVW510021_W_IS_LONGPREAMBLE 0x40 +#define vVW510021_W_HEADER_IS_RFN 0x30 +#define vVW510021_W_HEADER_IS_RF 0x38 +#define vVW510021_W_HEADER_IS_RFRX 0x39 -/* Common to Series II and Series III */ +#define vVW510021_W_IS_TCP 0x01000000 /* TCP bit in FRAME_TYPE field */ +#define vVW510021_W_IS_UDP 0x00100000 /* UDP bit in FRAME_TYPE field */ +#define vVW510021_W_IS_ICMP 0x00001000 /* ICMP bit in FRAME_TYPE field */ +#define vVW510021_W_IS_IGMP 0x00010000 /* IGMP bit in FRAME_TYPE field */ -#define vVW510021_W_IS_LONGPREAMBLE 0x40 /* short/long preamble bit */ #define vVW510021_W_IS_LONGGI 0x40 /* short/long guard interval bit */ /* Series II */ @@ -452,7 +490,9 @@ #define vVW510021_W_CRYPTO_ERROR 0x50000 -/* Info bits are the same as for the VWS10006 FPGA */ +#define vVW510021_W_WEPTYPE 0x0001 /* WEP frame */ +#define vVW510021_W_TKIPTYPE 0x0002 /* TKIP frame */ +#define vVW510021_W_CCMPTYPE 0x0004 /* CCMP frame */ /* definitions for VW510024 FPGA, wired ethernet format */ /* FORMAT: @@ -493,8 +533,10 @@ #define vVW510024_E_QOS_VALID 0x0000 /** not valid for ethernet **/ #define vVW510024_E_L4ID_VALID 0x1000 #define vVW510024_E_CBW_MASK 0xC0 +#define vVW510024_E_VCID_MASK 0x3FFF /* VCID is only 14 bits */ -#define vVW510024_E_VCID_MASK 0x3fff /* VCID is only 14 bits */ +#define vVW510024_E_HEADER_IS_RX 0x21 +#define vVW510024_E_HEADER_IS_TX 0x31 #define vVW510024_E_IS_TCP 0x01000000 /* TCP bit in FRAME_TYPE field */ #define vVW510024_E_IS_UDP 0x00100000 /* UDP bit in FRAME_TYPE field */ @@ -586,7 +628,7 @@ typedef struct { guint32 RETRY_ERR; /* excessive retries on TX failure */ guint8 IS_RX; /* TX/RX bit in STATS block */ guint8 MT_MASK; /* modulation type mask */ - guint16 VCID_MASK; /* VC ID might not be a full 16 bits */ + guint16 VCID_MASK; /* VC ID is only 9 bits */ guint32 FLOW_VALID; /* flow-is-valid flag (else force to 0) */ guint16 QOS_VALID; guint32 RX_DECRYPTS; /* RX-frame-was-decrypted bits */ @@ -595,7 +637,10 @@ typedef struct { guint32 MT_CCKL; /* CCK modulation, long preamble */ guint32 MT_CCKS; /* CCK modulation, short preamble */ guint32 MT_OFDM; /* OFDM modulation */ + guint32 MCS_INDEX_MASK; /* mcs index type mask */ guint32 FPGA_VERSION; + guint32 HEADER_IS_RX; + guint32 HEADER_IS_TX; guint32 WEPTYPE; /* frame is WEP */ guint32 TKIPTYPE; /* frame is TKIP */ guint32 CCMPTYPE; /* frame is CCMP */ @@ -606,10 +651,14 @@ typedef struct { guint16 IS_QOS; guint32 IS_VLAN; guint32 MPDU_OFF; + guint32 HEADER_IS_RFN; + guint32 HEADER_IS_RF; + guint32 HEADER_IS_RXRF; + guint32 OCTO_VERSION; } vwr_t; /* internal utility functions */ -static int decode_msg(register guint8 *, int *, int *); +static int decode_msg(vwr_t *vwr, register guint8 *, int *, int *, int *); static guint8 get_ofdm_rate(const guint8 *); static guint8 get_cck_rate(const guint8 *plcp); static void setup_defaults(vwr_t *, guint16); @@ -618,23 +667,26 @@ static gboolean vwr_read(wtap *, int *, gchar **, gint64 *); static gboolean vwr_seek_read(wtap *, gint64, struct wtap_pkthdr *phdr, Buffer *, int *, gchar **); -static gboolean vwr_read_rec_header(FILE_T, int *, int *, int *, gchar **); +static gboolean vwr_read_rec_header(vwr_t *, FILE_T, int *, int *, int *, int *, gchar **); static gboolean vwr_process_rec_data(FILE_T fh, int rec_size, struct wtap_pkthdr *phdr, Buffer *buf, - vwr_t *vwr, int IS_TX, int *err, + vwr_t *vwr, int IS_TX, int log_mode, int *err, gchar **err_info); static int vwr_get_fpga_version(wtap *, int *, gchar **); static gboolean vwr_read_s1_W_rec(vwr_t *, struct wtap_pkthdr *, Buffer *, const guint8 *, int, int *, gchar **); -static gboolean vwr_read_s2_s3_W_rec(vwr_t *, struct wtap_pkthdr *, Buffer *, - const guint8 *, int, int, int *, - gchar **); +static gboolean vwr_read_s2_W_rec(vwr_t *, struct wtap_pkthdr *, Buffer *, + const guint8 *, int, int, int, int *, + gchar **); +/* For FPGA version >= 48 (OCTO Platform), following function will be used */ +static gboolean vwr_read_s3_W_rec(vwr_t *, struct wtap_pkthdr *, Buffer *, + const guint8 *, int, int, int, int *, + gchar **); static gboolean vwr_read_rec_data_ethernet(vwr_t *, struct wtap_pkthdr *, Buffer *, const guint8 *, int, int, int *, gchar **); - static int find_signature(const guint8 *, int, int, register guint32, register guint8); static guint64 get_signature_ts(const guint8 *, int); static float getRate( guint8 plcpType, guint8 mcsIndex, guint16 rflags, guint8 nss ); @@ -692,10 +744,10 @@ wtap_open_return_val vwr_open(wtap *wth, int *err, gchar **err_info) static gboolean vwr_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { vwr_t *vwr = (vwr_t *)wth->priv; - int rec_size = 0, IS_TX; + int rec_size = 0, IS_TX, log_mode; /* read the next frame record header in the capture file; if no more frames, return */ - if (!vwr_read_rec_header(wth->fh, &rec_size, &IS_TX, err, err_info)) + if (!vwr_read_rec_header(vwr, wth->fh, &rec_size, &IS_TX, &log_mode, err, err_info)) return FALSE; /* Read error or EOF */ /* @@ -706,7 +758,7 @@ static gboolean vwr_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off /* got a frame record; read and process it */ if (!vwr_process_rec_data(wth->fh, rec_size, &wth->phdr, - wth->frame_buffer, vwr, IS_TX, err, err_info)) + wth->frame_buffer, vwr, IS_TX, log_mode, err, err_info)) return FALSE; /* If the per-file encapsulation isn't known, set it to this packet's encapsulation. */ @@ -729,18 +781,18 @@ static gboolean vwr_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) { vwr_t *vwr = (vwr_t *)wth->priv; - int rec_size, IS_TX; + int rec_size, IS_TX, log_mode; /* first seek to the indicated record header */ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; /* read in the record header */ - if (!vwr_read_rec_header(wth->random_fh, &rec_size, &IS_TX, err, err_info)) + if (!vwr_read_rec_header(vwr, wth->random_fh, &rec_size, &IS_TX, &log_mode, err, err_info)) return FALSE; /* Read error or EOF */ return vwr_process_rec_data(wth->random_fh, rec_size, phdr, buf, - vwr, IS_TX, err, err_info); + vwr, IS_TX, log_mode, err, err_info); } /* Scan down in the input capture file to find the next frame header. */ @@ -748,7 +800,7 @@ static gboolean vwr_seek_read(wtap *wth, gint64 seek_off, /* Return TRUE on success, FALSE on EOF or error. */ /* Also return the frame size in bytes and the "is transmitted frame" flag. */ -static gboolean vwr_read_rec_header(FILE_T fh, int *rec_size, int *IS_TX, int *err, gchar **err_info) +static gboolean vwr_read_rec_header(vwr_t *vwr, FILE_T fh, int *rec_size, int *IS_TX, int *log_mode, int *err, gchar **err_info) { int f_len, v_type; guint8 header[VW_RECORD_HEADER_LENGTH]; @@ -768,7 +820,7 @@ static gboolean vwr_read_rec_header(FILE_T fh, int *rec_size, int *IS_TX, int *e /* If the function returns a length, then a frame or variable-length message */ /* follows the 16-byte message. */ /* If the variable length message is not a frame, simply skip over it. */ - if ((f_len = decode_msg(header, &v_type, IS_TX)) != 0) { + if ((f_len = decode_msg(vwr, header, &v_type, IS_TX, log_mode)) != 0) { if (f_len > B_SIZE) { *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup_printf("vwr: Invalid message record length %d", f_len); @@ -799,7 +851,7 @@ static int vwr_get_fpga_version(wtap *wth, int *err, gchar **err_info) guint8 *s_510006_ptr = NULL; guint8 *s_510024_ptr = NULL; guint8 *s_510012_ptr = NULL; /* stats pointers */ - gint64 filePos; + gint64 filePos = -1; guint32 frame_type = 0; int f_len, v_type; guint16 data_length = 0; @@ -826,7 +878,7 @@ static int vwr_get_fpga_version(wtap *wth, int *err, gchar **err_info) /* If the function returns a length, then a frame or variable-length message */ /* follows the 16-byte message. */ /* If the variable length message is not a frame, simply skip over it. */ - if ((f_len = decode_msg(header, &v_type, NULL)) != 0) { + if ((f_len = decode_msg(NULL, header, &v_type, NULL, NULL)) != 0) { if (f_len > B_SIZE) { g_free(rec); /* Treat this here as an indication that the file probably */ @@ -1109,8 +1161,8 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, * adding the lengths of the metadata headers, is less than * WTAP_MAX_PACKET_SIZE will ever be, so we don't need to check it. */ - phdr->len = STATS_COMMON_FIELDS_LEN + EXT_WLAN_FIELDS_LEN + 1 + 16 + actual_octets; - phdr->caplen = STATS_COMMON_FIELDS_LEN + EXT_WLAN_FIELDS_LEN + 1 + 16 + actual_octets; + phdr->len = STATS_COMMON_FIELDS_LEN + EXT_WLAN_FIELDS_LEN + actual_octets; + phdr->caplen = STATS_COMMON_FIELDS_LEN + EXT_WLAN_FIELDS_LEN + actual_octets; phdr->ts.secs = (time_t)s_sec; phdr->ts.nsecs = (int)(s_usec * 1000); @@ -1128,8 +1180,10 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, * * All values are copied out in little-endian byte order. */ - phtoles(&data_ptr[bytes_written], WLAN_PORT); /* port_type */ - bytes_written += 2; + phtole8(&data_ptr[bytes_written], WLAN_PORT); /* 1st octet of record for port_type*/ + bytes_written += 1; + phtole8(&data_ptr[bytes_written], 0); /* 2nd octet of record for fpga version*/ + bytes_written += 1; phtoles(&data_ptr[bytes_written], STATS_COMMON_FIELDS_LEN); /* it_len */ bytes_written += 2; phtoles(&data_ptr[bytes_written], msdu_length); @@ -1218,21 +1272,6 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, phtolel(&data_ptr[bytes_written], errors); bytes_written += 4; - /* - * No VHT, no VHT NDP flag, so just zero. - * - * XXX - is this supposed to be the RX L1 info, i.e. the "1 byte of L1P - * for user position"? - */ - data_ptr[bytes_written] = 0; - bytes_written += 1; - - /* - * XXX - put a PLCP header here? That's what's done for S3. - */ - memset(&data_ptr[bytes_written], 0, 16); - bytes_written += 16; - /* * Finally, copy the whole MAC frame to the packet buffer as-is. * This does not include the PLCP; the MPDU starts at 4 or 6 @@ -1246,9 +1285,9 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, } -static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, +static gboolean vwr_read_s2_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, Buffer *buf, const guint8 *rec, int rec_size, - int IS_TX, int *err, gchar **err_info) + int IS_TX, int log_mode _U_, int *err, gchar **err_info) { guint8 *data_ptr; int bytes_written = 0; /* bytes output to buf so far */ @@ -1275,7 +1314,8 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, guint64 delta_b; /* Used for calculating latency */ guint16 phyRate; guint16 vw_flags; /* VeriWave-specific packet flags */ - guint8 vht_ndp_flag = 0; + guint8 L1InfoC,vht_ndp_flag = 0; + guint8 plcp_hdr_flag = 0; /* indicates plcp hdr info */ /* * The record data must be large enough to hold the statistics header, @@ -1323,32 +1363,31 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, rssi[2] = 100; rssi[3] = 100; - nss = 0; + nss = (mcs_index / 8) + 1; - /* XXX - S2 claims to have 11 bytes of PLCP and 1 byte of pad */ plcp_ptr = &(rec[8]); } else { - /* XXX - what indicates which packets include the FCS? */ - radioflags |= FLAGS_FCS; plcp_type = vVW510021_W_S3_PLCP_TYPE(l1p_2); if (plcp_type == vVW510021_W_PLCP_VHT_MIXED) { - /* VHT */ + /* S3 FPGA VHT frames ***/ mcs_index = vVW510021_W_S3_MCS_INDEX_VHT(l1p_1); - nss = vVW510021_W_S3_NSS_VHT(l1p_1); + nss = vVW510021_W_S3_NSS_VHT(l1p_1); /* The nss is zero based from the fpga - increment it here */ + + plcp_hdr_flag = 1; } - else + else /*** S3_FPGA HT frames ***/ { - /* HT */ - mcs_index = vVW510021_W_S3_MCS_INDEX_HT(l1p_1); - nss = 0; + mcs_index = l1p_1 & 0x3f; + nss = (mcs_index / 8) + 1; } /*** Extract NDP Flag if it is a received frame ***/ if (!IS_TX){ - vht_ndp_flag = s_start_ptr[8]; + L1InfoC = s_start_ptr[8]; + vht_ndp_flag = L1InfoC & 0x80; } msdu_length = pntoh24(&s_start_ptr[9]); @@ -1370,8 +1409,14 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, *something*. Are those 16 bytes the PLCP? */ plcp_ptr = &(rec[16]); } + /*** Add the PLCP length for S3_W_FPGA version VHT frames for Beamforming decode ***/ actual_octets = msdu_length; + if (plcp_hdr_flag == 1) { + /*** 16 bytes of PLCP header + 1 byte of L1P for user position ***/ + actual_octets = actual_octets + 17; + } + /* * Sanity check the octets field to determine if it's greater than * the packet data available in the record - i.e., the record size @@ -1488,6 +1533,25 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, radioflags |= FLAGS_CHAN_80MHZ; } + /* + * The MSDU length includes the FCS. + * + * The packet data does *not* include the FCS - it's just 4 bytes + * of junk - so we have to remove it. + * + * We'll be stripping off an FCS (?), so make sure we have at + * least 4 octets worth of FCS. + */ + if (actual_octets < 4) { + *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", + actual_octets); + *err = WTAP_ERR_BAD_FILE; + return FALSE; + } + if (actual_octets > 4) { + actual_octets -= 4; + } + /* Calculate start & end times (in sec/usec), converting 64-bit times to usec. */ /* 64-bit times are "Corey-endian" */ s_time = pcoreytohll(&s_trail_ptr[vVW510021_W_STARTT_OFF]); @@ -1531,17 +1595,10 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, /* * Fill up the per-packet header. * - * We also copy over 16 bytes of PLCP header + 1 byte of L1P for user - * position. - * - * XXX - for S2, we don't have 16 bytes of PLCP header; do we have - * the 1 byte of L1P? The current VeriWave dissector just blindly - * assumes there's a 17-byte blob before the 802.11 header. - * * We include the length of the metadata headers in the packet lengths. */ - phdr->len = STATS_COMMON_FIELDS_LEN + EXT_WLAN_FIELDS_LEN + 1 + 16 + actual_octets; - phdr->caplen = STATS_COMMON_FIELDS_LEN + EXT_WLAN_FIELDS_LEN + 1 + 16 + actual_octets; + phdr->len = STATS_COMMON_FIELDS_LEN + EXT_WLAN_FIELDS_LEN + actual_octets; + phdr->caplen = STATS_COMMON_FIELDS_LEN + EXT_WLAN_FIELDS_LEN + actual_octets; if (phdr->caplen > WTAP_MAX_PACKET_SIZE) { /* * Probably a corrupt capture file; return an error, @@ -1571,8 +1628,10 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, * All values are copied out in little-endian byte order. */ /*** msdu_length = msdu_length + 16; ***/ - phtoles(&data_ptr[bytes_written], WLAN_PORT); /* port_type */ - bytes_written += 2; + phtole8(&data_ptr[bytes_written], WLAN_PORT); /* 1st octet of record for port*/ + bytes_written += 1; + phtole8(&data_ptr[bytes_written], 0); /* 2nd octet of record for fpga version*/ + bytes_written += 1; phtoles(&data_ptr[bytes_written], STATS_COMMON_FIELDS_LEN); /* it_len */ bytes_written += 2; phtoles(&data_ptr[bytes_written], msdu_length); @@ -1607,7 +1666,7 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, bytes_written += 2; if (info & vVW510021_W_IS_WEP) radioflags |= FLAGS_WEP; - if (!(l1p_1 & vVW510021_W_IS_LONGPREAMBLE) && (plcp_type == vVW510021_W_PLCP_LEGACY)) + if ((l1p_1 & vVW510021_W_PREAMBLE_MASK) != vVW510021_W_IS_LONGPREAMBLE && (plcp_type == vVW510021_W_PLCP_LEGACY)) radioflags |= FLAGS_SHORTPRE; phtoles(&data_ptr[bytes_written], radioflags); bytes_written += 2; @@ -1669,132 +1728,730 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, phtolel(&data_ptr[bytes_written], errors); bytes_written += 4; - /* - * XXX - is this supposed to be the RX L1 info, i.e. the "1 byte of L1P - * for user position"? - */ - if (!IS_TX){ - data_ptr[bytes_written] = vht_ndp_flag; - } else { - data_ptr[bytes_written] = 0; + /*** copy PLCP header and L1InfoC for VHT frames***/ + + if (plcp_hdr_flag == 1) { + + data_ptr[bytes_written] = L1InfoC; + bytes_written += 1; + memcpy(&data_ptr[bytes_written], &rec[16], 16); + bytes_written += 16; } - bytes_written += 1; - - /* - * Copy PLCP header. - * - * XXX - shouldn't that use plcp_ptr? - * - * XXX - what about S2, where we don't have 16 bytes of PLCP? - */ - memcpy(&data_ptr[bytes_written], &rec[16], 16); - bytes_written += 16; - - /* - * Finally, copy the whole MAC frame to the packet buffer as-is. - * This does not include the stats header or the PLCP header. + /* Finally, copy the whole MAC frame to the packet buffer as-is. + * This does not include the stats header or the PLCP. + * This also does not include the last 4 bytes, as those don't + * contain an FCS, they just contain junk. */ memcpy(&data_ptr[bytes_written], &rec[vwr->MPDU_OFF], actual_octets); return TRUE; } +static gboolean vwr_read_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, + Buffer *buf, const guint8 *rec, int rec_size, + int IS_TX, int log_mode, int *err, gchar **err_info) +{ + guint8 *data_ptr; + int bytes_written = 0; /* bytes output to buf so far */ + register int i,j = 0; /* temps */ + const guint8 *s_start_ptr = NULL,*s_trail_ptr = NULL, *plcp_ptr, *m_ptr; /* stats & MPDU ptr */ + guint32 msdu_length = 0, actual_octets = 0; /* octets in frame */ + guint8 l1p_1 = 0,l1p_2 = 0, plcp_type, mcs_index, nss = 0; /* mod (CCK-L/CCK-S/OFDM) */ + guint64 s_time = LL_ZERO, e_time = LL_ZERO; /* start/end */ + /* times, nsec */ + guint64 latency = LL_ZERO; + guint64 start_time = 0, s_sec = 0, s_usec = LL_ZERO; /* start time, sec + usec */ + guint64 end_time = 0; /* end time */ + guint16 info = 0; /* INFO/ERRORS fields in stats blk */ + guint32 errors = 0; + gint8 info_2nd = 0,rssi[] = {0,0,0,0}; /* RSSI, signed 8-bit number */ + int frame_size; /* flag: if set, is a TX frame */ + guint32 d_time = 0, flow_id = 0; /* packet duration, Flow Signature ID*/ + int sig_off, pay_off; /* MAC+SNAP header len, signature offset */ + guint64 sig_ts = 0, tsid; /* 32 LSBs of timestamp in signature */ + guint64 delta_b; /* Used for calculating latency */ + guint8 L1InfoC,port_type,ver_fpga = 0; + guint8 flow_seq =0,plcp_hdr_flag = 0,rf_id = 0; /* indicates plcp hdr info */ + const guint8 *rf_ptr = NULL; + guint16 phyRate = 0, radioflags = 0; /* flags for WLAN metadata header */ + + /* + * The record data must be large enough to hold the statistics header, + * the PLCP, and the statistics trailer. + */ + if (IS_TX == 3) { /*IS_TX =3, i.e., command type is RF Modified*/ + if ((guint)rec_size < OCTO_MODIFIED_RF_LEN) { + *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + rec_size, + OCTO_MODIFIED_RF_LEN); + *err = WTAP_ERR_BAD_FILE; + return FALSE; + } + + rf_ptr = &(rec[0]); + rf_id = rf_ptr[0]; + + phdr->len = OCTO_MODIFIED_RF_LEN + 1; /* 1st octet is reserved for detecting type of frame while displaying in wireshark */ + phdr->caplen = OCTO_MODIFIED_RF_LEN + 1; + + phdr->ts.secs = (time_t)s_sec; + phdr->ts.nsecs = (int)(s_usec * 1000); + phdr->pkt_encap = WTAP_ENCAP_IXVERIWAVE; + + phdr->rec_type = REC_TYPE_PACKET; + phdr->presence_flags = WTAP_HAS_TS; + + ws_buffer_assure_space(buf, phdr->caplen); + data_ptr = ws_buffer_start_ptr(buf); + + port_type = IS_TX << 4; + } + else { + if ((guint)rec_size < vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN) { + *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + rec_size, + vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN); + *err = WTAP_ERR_BAD_FILE; + return FALSE; + } + + /* Calculate the start of the statistics blocks in the buffer */ + /* Also get a bunch of fields from the stats blocks */ + /* 'j' variable is use to locate the exact offset. + * When a RX frame contrains RF, + * the postion of Stats, Layer 1-4, PLCP parameters are shifted to + 100 bytes + */ + if (IS_TX == 4) /*IS_TX =4, i.e., command type is RF-RX Modified*/ + { + j = OCTO_RF_MOD_ACTUAL_LEN; + rf_ptr = &(rec[0]); + rf_id = rf_ptr[0]; + } + else + { + j = 0; + } + + s_start_ptr = &(rec[j]); /* point to stats header */ + s_trail_ptr = &(rec[rec_size - vVW510021_W_STATS_TRAILER_LEN] ); /* point to stats trailer */ + + /* L1p info is different for series III and for Series II - need to check */ + l1p_1 = s_start_ptr[vVW510021_W_L1P_1_OFF]; + l1p_2 = s_start_ptr[vVW510021_W_L1P_2_OFF]; + + + plcp_type = vVW510021_W_S3_PLCP_TYPE(l1p_2); + if (plcp_type == vVW510021_W_PLCP_VHT_MIXED) /* S3 FPGA VHT frames ***/ + { + mcs_index = vVW510021_W_S3_MCS_INDEX_VHT(l1p_1); + nss = vVW510021_W_S3_NSS_VHT(l1p_1); /* The nss is zero based from the fpga - increment it here */ + plcp_hdr_flag = 1; + } + else + { + mcs_index = l1p_1 & 0x3f; + if (plcp_type == vVW510021_W_PLCP_LEGACY) + nss = 0; + else /*** S3_FPGA HT frames ***/ + nss = (mcs_index / 8) + 1; + } + + if (IS_TX == 0 || IS_TX == 4){ + L1InfoC = s_start_ptr[8]; + } + + msdu_length = pntoh24(&s_start_ptr[9]); + for (i = 0; i < 4; i++) + { + if (IS_TX == 1) + { + rssi[i] = (s_start_ptr[4+i] & 0x80) ? -1 * (s_start_ptr[4+i] & 0x7f) : s_start_ptr[4+i] & 0x7f; + } + else + { + rssi[i] = (s_start_ptr[4+i] >= 128) ? (s_start_ptr[4+i] - 256) : s_start_ptr[4+i]; + } + } + + plcp_ptr = &(rec[j+16]); + + /*** Add the PLCP length for S3_W_FPGA version VHT frames for Beamforming decode ***/ + if (log_mode == 3) { + frame_size = rec_size - 80 -j; + if (frame_size > ((int) msdu_length)) + actual_octets = msdu_length; + else + actual_octets = frame_size; + } + else + { + actual_octets = msdu_length; + } + /* + * Sanity check the octets field to determine if it's greater than + * the packet data available in the record - i.e., the record size + * minus the sum of (length of statistics header + PLCP) and + * (length of statistics trailer). + * + * Report an error if it is. + */ + if (actual_octets > rec_size - (vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN)) { + *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + actual_octets); + *err = WTAP_ERR_BAD_FILE; + return FALSE; + } + + flow_seq = s_trail_ptr[vVW510021_W_FLOWSEQ_OFF]; + + latency = 0x00000000; /* clear latency */ + flow_id = pntoh24(&s_trail_ptr[vVW510021_W_FLOWID_OFF]); /* all 24 bits valid */ + /* For tx latency is duration, for rx latency is timestamp */ + /* Get 48-bit latency value */ + tsid = pcorey48tohll(&s_trail_ptr[vVW510021_W_LATVAL_OFF]); + + errors = pntoh32(&s_trail_ptr[vVW510021_W_ERRORS_OFF]); + info = pntoh16(&s_trail_ptr[vVW510021_W_INFO_OFF]); + + if (IS_TX == 0 || IS_TX == 4) + info_2nd = s_trail_ptr[41]; + + /*** Calculate Data rate based on + * PLCP type, MCS index and number of spatial stream + * radioflags is temporarily calculated, which is used in getRate(). + **/ + if (plcp_type == vVW510021_W_PLCP_MIXED) + { + radioflags |= FLAGS_CHAN_HT | ((plcp_ptr[3] & 0x80) ? FLAGS_CHAN_40MHZ : 0) | + ((l1p_1 & 0x40) ? 0 : FLAGS_CHAN_SHORTGI); + } + else + { + if (plcp_type == vVW510021_W_PLCP_GREENFIELD) + { + radioflags |= FLAGS_CHAN_HT | ((plcp_ptr[0] & 0x80) ? FLAGS_CHAN_40MHZ : 0) | + ((l1p_1 & 0x40) ? 0 : FLAGS_CHAN_SHORTGI); + } + else + { + if (plcp_type == vVW510021_W_PLCP_VHT_MIXED) { + guint8 SBW = vVW510021_W_BANDWIDTH_VHT(l1p_2); + radioflags |= FLAGS_CHAN_VHT | ((l1p_1 & 0x40) ? 0 : FLAGS_CHAN_SHORTGI); + if (SBW == 3) + radioflags |= FLAGS_CHAN_40MHZ; + else if (SBW == 4) + radioflags |= FLAGS_CHAN_80MHZ; + } + } + } + if (info & vVW510021_W_IS_WEP) + radioflags |= FLAGS_WEP; + if ((l1p_1 & vVW510021_W_PREAMBLE_MASK) != vVW510021_W_IS_LONGPREAMBLE && (plcp_type == vVW510021_W_PLCP_LEGACY)) + radioflags |= FLAGS_SHORTPRE; + + phyRate = (guint16)(getRate(plcp_type, mcs_index, radioflags, nss) * 10); + /* Calculatetion of Data rate ends*/ + + /* + * The MSDU length includes the FCS. + * + * The packet data does *not* include the FCS - it's just 4 bytes + * of junk - so we have to remove it. + * + * We'll be stripping off an FCS (?), so make sure we have at + * least 4 octets worth of FCS. + */ + if (actual_octets < 4) { + *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", + actual_octets); + *err = WTAP_ERR_BAD_FILE; + return FALSE; + } + /* 'ver_fpga' is the 2nd Octet of each frame. + * msb/lsb nibble indicates log mode/fpga version respectively. + * where log mode = 0 is normal capture and 1 is reduced capture, + * lsb nibble is set to 1 always as this function is applicable for only FPGA version >= 48 + */ + if (log_mode == 3) { + if (actual_octets > 4 && (frame_size >= (int) msdu_length)) + actual_octets -=4; + ver_fpga = 0x11; + } + else { + if (actual_octets > 4) + actual_octets -= 4; + ver_fpga = 0x01; + } + + /* Calculate start & end times (in sec/usec), converting 64-bit times to usec. */ + /* 64-bit times are "Corey-endian" */ + s_time = pcoreytohll(&s_trail_ptr[vVW510021_W_STARTT_OFF]); + e_time = pcoreytohll(&s_trail_ptr[vVW510021_W_ENDT_OFF]); + + /* find the packet duration (difference between start and end times) */ + d_time = (guint32)((e_time - s_time) / NS_IN_US); /* find diff, converting to usec */ + + /* also convert the packet start time to seconds and microseconds */ + start_time = s_time / NS_IN_US; /* convert to microseconds first */ + s_sec = (start_time / US_IN_SEC); /* get the number of seconds */ + s_usec = start_time - (s_sec * US_IN_SEC); /* get the number of microseconds */ + + /* also convert the packet end time to seconds and microseconds */ + end_time = e_time / NS_IN_US; /* convert to microseconds first */ + + /* extract the 32 LSBs of the signature timestamp field */ + m_ptr = &(rec[j+8+12]); + pay_off = 42; /* 24 (MAC) + 8 (SNAP) + IP */ + sig_off = find_signature(m_ptr, rec_size - 20, pay_off, flow_id, flow_seq); + if ((m_ptr[sig_off] == 0xdd) && (sig_off + 15 <= (rec_size - vVW510021_W_STATS_TRAILER_LEN))) + sig_ts = get_signature_ts(m_ptr, sig_off); + else + sig_ts = 0; + + /* Set latency based on rx/tx and signature timestamp */ + if (IS_TX == 0 || IS_TX == 4) { + if (tsid < s_time) { + latency = s_time - tsid; + } else { + /* Account for the rollover case. Since we cannot use 0x100000000 - l_time + s_time */ + /* we look for a large difference between l_time and s_time. */ + delta_b = tsid - s_time; + if (delta_b > 0x10000000) + latency = 0; + else + latency = delta_b; + } + } + + nss = nss << 4; + nss |= IS_TX; + port_type = IS_TX << 4; + /* + * Fill up the per-packet header. + * + * We include the length of the metadata headers in the packet lengths. + */ + if (IS_TX == 4) { + phdr->len = OCTO_MODIFIED_RF_LEN + OCTO_TIMESTAMP_FIELDS_LEN + OCTO_LAYER1TO4_LEN + actual_octets; + phdr->caplen = OCTO_MODIFIED_RF_LEN + OCTO_TIMESTAMP_FIELDS_LEN + OCTO_LAYER1TO4_LEN + actual_octets; + } else { + phdr->len = OCTO_TIMESTAMP_FIELDS_LEN + OCTO_LAYER1TO4_LEN + actual_octets; + phdr->caplen = OCTO_TIMESTAMP_FIELDS_LEN + OCTO_LAYER1TO4_LEN + actual_octets; + } + + phdr->ts.secs = (time_t)s_sec; + phdr->ts.nsecs = (int)(s_usec * 1000); + phdr->pkt_encap = WTAP_ENCAP_IXVERIWAVE; + + phdr->rec_type = REC_TYPE_PACKET; + phdr->presence_flags = WTAP_HAS_TS; + + ws_buffer_assure_space(buf, phdr->caplen); + data_ptr = ws_buffer_start_ptr(buf); + } + + /* + * Generate and copy out the common metadata headers, + * set the port type to 0 (WLAN). + * + * All values are copied out in little-endian byte order. + */ + /*** msdu_length = msdu_length + 16; ***/ + phtole8(&data_ptr[bytes_written], port_type); /* 1st octet of record for Port_type*/ + bytes_written += 1; + + if (IS_TX != 3) { + phtole8(&data_ptr[bytes_written], ver_fpga); /* 2nd octet of record for FPGA version*/ + bytes_written += 1; + + phtoles(&data_ptr[bytes_written], OCTO_TIMESTAMP_FIELDS_LEN); /* it_len */ + bytes_written += 2; + + /*** Time Collapsible header started***/ + if (IS_TX == 1 && sig_ts != 0) { + phtolel(&data_ptr[bytes_written], latency); + } else { + phtolel(&data_ptr[bytes_written], 0); + } + bytes_written += 4; + phtolel(&data_ptr[bytes_written], sig_ts); /* 32 LSBs of signature timestamp (nsec) */ + bytes_written += 4; + phtolell(&data_ptr[bytes_written], start_time); /* record start & end times of frame */ + bytes_written += 8; + phtolell(&data_ptr[bytes_written], end_time); + bytes_written += 8; + phtolel(&data_ptr[bytes_written], d_time); + bytes_written += 4; + /*** Time Collapsible header ends ***/ + } + + /*** RF Collapsable header starts***/ + if (IS_TX == 3 || IS_TX == 4) { + phtole8(&data_ptr[bytes_written], rf_id); + bytes_written += 1; + data_ptr[bytes_written] = 0; + bytes_written += 1; + data_ptr[bytes_written] = 0; + bytes_written += 1; + data_ptr[bytes_written] = 0; + bytes_written += 1; + + /*** NOISE for all 4 Ports ***/ + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[RF_PORT_1_NOISE_OFF+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_NOISE_OFF+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_NOISE_OFF+1+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + + /*** SNR for all 4 Ports ***/ + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[RF_PORT_1_SNR_OFF+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_SNR_OFF+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_SNR_OFF+1+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + + /*** PFE for all 4 Ports ***/ + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[RF_PORT_1_PFE_OFF+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_PFE_OFF+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_PFE_OFF+1+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + + /*** EVM SIG Data for all 4 Ports ***/ + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[RF_PORT_1_EVM_SD_SIG_OFF+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_EVM_SD_SIG_OFF+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_EVM_SD_SIG_OFF+1+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + + /*** EVM SIG PILOT for all 4 Ports ***/ + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[RF_PORT_1_EVM_SP_SIG_OFF+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_EVM_SP_SIG_OFF+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_EVM_SP_SIG_OFF+1+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + + /*** EVM Data Data for all 4 Ports ***/ + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[RF_PORT_1_EVM_SD_DATA_OFF+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_EVM_SD_DATA_OFF+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_EVM_SD_DATA_OFF+1+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + + /*** EVM Data PILOT for all 4 Ports ***/ + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[RF_PORT_1_EVM_SP_DATA_OFF+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_EVM_SP_DATA_OFF+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_EVM_SP_DATA_OFF+1+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + + /*** EVM WORST SYMBOL for all 4 Ports ***/ + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[RF_PORT_1_DSYMBOL_IDX_OFF+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_DSYMBOL_IDX_OFF+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_DSYMBOL_IDX_OFF+1+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + + /*** CONTEXT_P for all 4 Ports ***/ + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[RF_PORT_1_CONTEXT_OFF+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_CONTEXT_OFF+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[RF_PORT_1_CONTEXT_OFF+1+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + + /*** FOR rest 24 RF data bytes are commented for future use ***/ +/*** + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[20+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[20+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[21+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[24+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[24+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[25+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } + for (i = 0; i < RF_NUMBER_OF_PORTS; i++) + { + if (pntoh16(&rf_ptr[26+i*RF_INTER_PORT_GAP_OFF]) == 0) { + phtoles(&data_ptr[bytes_written], 0); + bytes_written += 2; + } else { + data_ptr[bytes_written] = rf_ptr[26+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + data_ptr[bytes_written] = rf_ptr[27+i*RF_INTER_PORT_GAP_OFF]; + bytes_written += 1; + } + } +***/ + } + /*** RF Collapsable header ends***/ + + if (IS_TX != 3) { + /* + * Generate and copy out the WLAN metadata headers. + * + * All values are copied out in little-endian byte order. + */ + phtoles(&data_ptr[bytes_written], OCTO_LAYER1TO4_LEN); + bytes_written += 2; + + /*** Layer-1 Collapsible header started***/ + data_ptr[bytes_written] = l1p_1; + bytes_written += 1; + + data_ptr[bytes_written] = nss; + bytes_written += 1; + + phtoles(&data_ptr[bytes_written], phyRate); /* To dosplay Data rate based on the PLCP type & MCS*/ + bytes_written += 2; + + data_ptr[bytes_written] = l1p_2; + bytes_written += 1; + + data_ptr[bytes_written] = rssi[0]; + bytes_written += 1; + data_ptr[bytes_written] = rssi[1]; + bytes_written += 1; + data_ptr[bytes_written] = rssi[2]; + bytes_written += 1; + data_ptr[bytes_written] = rssi[3]; + bytes_written += 1; + + /* padding may not be required for S3_W*/ + + data_ptr[bytes_written] = s_start_ptr[2]; /*** For Signal Bandwidth Mask ***/ + bytes_written += 1; + data_ptr[bytes_written] = s_start_ptr[3]; /*** For Antenna Port Energy Detect and MU_MASK ***/ + bytes_written += 1; + + if (plcp_hdr_flag == 1 && (IS_TX == 0 || IS_TX == 4)) { + data_ptr[bytes_written] = L1InfoC; /*** For Other plcp type = VHT ***/ + } else { + data_ptr[bytes_written] = 0; /*** For Other plcp type, this offset is set to 0***/ + } + bytes_written += 1; + + phtoles(&data_ptr[bytes_written], msdu_length); + bytes_written += 2; + /*** Layer-1 Collapsible header Ends ***/ + + /*** PLCP Collapsible header Starts ***/ + memcpy(&data_ptr[bytes_written], &rec[j+16], 16); + bytes_written += 16; + /*** PLCP Collapsible header Ends ***/ + + /*** Layer 2-4 Collapsible header Starts ***/ + + phtolel(&data_ptr[bytes_written], pntoh32(&s_start_ptr[12])); /*** This 4 bytes includes BM,BV,CV,BSSID and ClientID ***/ + bytes_written += 4; + phtoles(&data_ptr[bytes_written], pntoh16(&s_trail_ptr[20])); /*** 2 bytes includes FV,QT,HT,L4V,TID and WLAN type ***/ + bytes_written += 2; + data_ptr[bytes_written] = flow_seq; + bytes_written += 1; + phtole24(&data_ptr[bytes_written], flow_id); + bytes_written += 3; + phtoles(&data_ptr[bytes_written], pntoh16(&s_trail_ptr[28])); /*** 2 bytes for Layer 4 ID ***/ + bytes_written += 2; + phtolel(&data_ptr[bytes_written], pntoh32(&s_trail_ptr[24])); /*** 4 bytes for Payload Decode ***/ + bytes_written += 4; + + /*** Incase of RX, Info has 3 bytes of data, whereas for TX, 2 bytes ***/ + if (IS_TX == 0 || IS_TX == 4) { + phtoles(&data_ptr[bytes_written], info); + bytes_written += 2; + data_ptr[bytes_written] = info_2nd; + bytes_written += 1; + } + else { + phtoles(&data_ptr[bytes_written], info); + bytes_written += 2; + data_ptr[bytes_written] = 0; + bytes_written += 1; + } + + phtolel(&data_ptr[bytes_written], errors); + bytes_written += 4; + /*** Layer 2-4 Collapsible header Ends ***/ + + /* Finally, copy the whole MAC frame to the packet buffer as-is. + * This does not include the stats header or the PLCP. + * This also does not include the last 4 bytes, as those don't + * contain an FCS, they just contain junk. + */ + memcpy(&data_ptr[bytes_written], &rec[j+(vwr->MPDU_OFF)], actual_octets); + } + + return TRUE; +} + /* read an Ethernet packet */ /* Copy the actual packet data from the capture file into the target data block. */ /* The packet is constructed as a 38-byte VeriWave-extended Radiotap header plus the raw */ /* MAC octets. */ - static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, struct wtap_pkthdr *phdr, - Buffer *buf, const guint8 *rec, - int rec_size, int IS_TX, int *err, - gchar **err_info) + Buffer *buf, const guint8 *rec, + int rec_size, int IS_TX, int *err, + gchar **err_info) { - guint8 *data_ptr; - int bytes_written = 0; /* bytes output to buf so far */ - const guint8 *s_ptr, *m_ptr; /* stats and MPDU pointers */ - guint16 msdu_length, actual_octets; /* octets in frame */ - guint flow_seq; /* seqnum */ - guint64 s_time = LL_ZERO, e_time = LL_ZERO; /* start/end */ - /* times, nsec */ - guint32 latency = 0; - guint64 start_time, s_sec, s_usec = LL_ZERO; /* start time, sec + usec */ - guint64 end_time; /* end time */ - guint l4id; - guint16 info, validityBits; /* INFO/ERRORS fields in stats */ - guint32 errors; - guint16 vc_id; /* VC ID, total (incl of aggregates) */ - guint32 flow_id, d_time; /* packet duration */ - int f_flow; /* flags: flow valid */ - guint32 frame_type; /* frame type field */ - int mac_len, sig_off, pay_off; /* MAC header len, signature offset */ - /* XXX - the code here fetched tsid, but never used it! */ - guint64 sig_ts/*, tsid*/; /* 32 LSBs of timestamp in signature */ - guint64 delta_b; /* Used for calculating latency */ - guint16 vw_flags; /* VeriWave-specific packet flags */ + guint8 *data_ptr; + int bytes_written = 0; /* bytes output to buf so far */ + const guint8 *s_ptr, *m_ptr; /* stats and MPDU pointers */ + guint16 msdu_length, actual_octets; /* octets in frame */ + guint flow_seq; /* seqnum */ + guint64 s_time = LL_ZERO, e_time = LL_ZERO; /* start/end */ + /* times, nsec */ + guint32 latency = 0; + guint64 start_time, s_sec = LL_ZERO, s_usec = LL_ZERO; /* start time, sec + usec */ + guint64 end_time; /* end time */ + guint l4id; + guint16 info, validityBits; /* INFO/ERRORS fields in stats */ + guint32 errors; + guint16 vc_id; /* VC ID, total (incl of aggregates) */ + guint32 flow_id, d_time; /* packet duration */ + int f_flow; /* flags: flow valid */ + guint32 frame_type; /* frame type field */ + int mac_len, sig_off, pay_off; /* MAC header len, signature offset */ + /* XXX - the code here fetched tsid, but never used it! */ + guint64 sig_ts/*, tsid*/; /* 32 LSBs of timestamp in signature */ + guint64 delta_b; /* Used for calculating latency */ + guint16 vw_flags; /* VeriWave-specific packet flags */ - if ((guint)rec_size < vwr->STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->STATS_LEN); - *err = WTAP_ERR_BAD_FILE; - return FALSE; - } + if ((guint)rec_size < vwr->STATS_LEN) { + *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->STATS_LEN); + *err = WTAP_ERR_BAD_FILE; + return FALSE; + } - /* Calculate the start of the statistics block in the buffer. */ - /* Also get a bunch of fields from the stats block. */ - m_ptr = &(rec[0]); /* point to the data block */ - s_ptr = &(rec[rec_size - vwr->STATS_LEN]); /* point to the stats block */ + /* Calculate the start of the statistics block in the buffer. */ + /* Also get a bunch of fields from the stats block. */ + m_ptr = &(rec[0]); /* point to the data block */ + s_ptr = &(rec[rec_size - vwr->STATS_LEN]); /* point to the stats block */ - msdu_length = pntoh16(&s_ptr[vwr->OCTET_OFF]); - actual_octets = msdu_length; + msdu_length = pntoh16(&s_ptr[vwr->OCTET_OFF]); + actual_octets = msdu_length; - /* - * Sanity check the octets field to determine if it's greater than - * the packet data available in the record - i.e., the record size - * minus the length of the statistics block. - * - * Report an error if it is. - */ - if (actual_octets > rec_size - vwr->STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", - actual_octets); - *err = WTAP_ERR_BAD_FILE; - return FALSE; - } - /* - * The maximum value of actual_octets is 65535, which, even after - * adding the lengths of the metadata headers, is less than - * WTAP_MAX_PACKET_SIZE will ever be, so we don't need to check it. - */ + /* + * Sanity check the octets field to determine if it's greater than + * the packet data available in the record - i.e., the record size + * minus the length of the statistics block. + * + * Report an error if it is. + */ + if (actual_octets > rec_size - vwr->STATS_LEN) { + *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + actual_octets); + *err = WTAP_ERR_BAD_FILE; + return FALSE; + } - vc_id = pntoh16(&s_ptr[vwr->VCID_OFF]) & vwr->VCID_MASK; - flow_seq = s_ptr[vwr->FLOWSEQ_OFF]; - frame_type = pntoh32(&s_ptr[vwr->FRAME_TYPE_OFF]); + vc_id = pntoh16(&s_ptr[vwr->VCID_OFF]) & vwr->VCID_MASK; + flow_seq = s_ptr[vwr->FLOWSEQ_OFF]; + frame_type = pntoh32(&s_ptr[vwr->FRAME_TYPE_OFF]); - if (vwr->FPGA_VERSION == vVW510024_E_FPGA) { - validityBits = pntoh16(&s_ptr[vwr->VALID_OFF]); - f_flow = validityBits & vwr->FLOW_VALID; + if (vwr->FPGA_VERSION == vVW510024_E_FPGA) { + validityBits = pntoh16(&s_ptr[vwr->VALID_OFF]); + f_flow = validityBits & vwr->FLOW_VALID; - mac_len = (validityBits & vwr->IS_VLAN) ? 16 : 14; /* MAC hdr length based on VLAN tag */ + mac_len = (validityBits & vwr->IS_VLAN) ? 16 : 14; /* MAC hdr length based on VLAN tag */ - errors = pntoh16(&s_ptr[vwr->ERRORS_OFF]); - } - else { - f_flow = s_ptr[vwr->VALID_OFF] & vwr->FLOW_VALID; - mac_len = (frame_type & vwr->IS_VLAN) ? 16 : 14; /* MAC hdr length based on VLAN tag */ + errors = pntoh16(&s_ptr[vwr->ERRORS_OFF]); + } + else { + f_flow = s_ptr[vwr->VALID_OFF] & vwr->FLOW_VALID; + mac_len = (frame_type & vwr->IS_VLAN) ? 16 : 14; /* MAC hdr length based on VLAN tag */ - /* for older fpga errors is only represented by 16 bits) */ - errors = pntoh16(&s_ptr[vwr->ERRORS_OFF]); - } + /* for older fpga errors is only represented by 16 bits) */ + errors = pntoh16(&s_ptr[vwr->ERRORS_OFF]); + } - info = pntoh16(&s_ptr[vwr->INFO_OFF]); - /* 24 LSBs */ - flow_id = pntoh24(&s_ptr[vwr->FLOWID_OFF]); + info = pntoh16(&s_ptr[vwr->INFO_OFF]); + /* 24 LSBs */ + flow_id = pntoh24(&s_ptr[vwr->FLOWID_OFF]); #if 0 - /* For tx latency is duration, for rx latency is timestamp. */ - /* Get 64-bit latency value. */ - tsid = pcorey48tohll(&s_ptr[vwr->LATVAL_OFF]); + /* For tx latency is duration, for rx latency is timestamp. */ + /* Get 64-bit latency value. */ + tsid = pcorey48tohll(&s_ptr[vwr->LATVAL_OFF]); #endif l4id = pntoh16(&s_ptr[vwr->L4ID_OFF]); @@ -1900,8 +2557,10 @@ static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, struct wtap_pkthdr *phdr, * * All values are copied out in little-endian byte order. */ - phtoles(&data_ptr[bytes_written], ETHERNET_PORT); - bytes_written += 2; + phtole8(&data_ptr[bytes_written], ETHERNET_PORT); /* 1st octet of record*/ + bytes_written += 1; + phtole8(&data_ptr[bytes_written], 0); /* 2nd octet of record*/ + bytes_written += 1; phtoles(&data_ptr[bytes_written], STATS_COMMON_FIELDS_LEN); bytes_written += 2; phtoles(&data_ptr[bytes_written], msdu_length); @@ -1965,52 +2624,82 @@ static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, struct wtap_pkthdr *phdr, /*--------------------------------------------------------------------------------------*/ /* utility to split up and decode a 16-byte message record */ -static int decode_msg(guint8 *rec, int *v_type, int *IS_TX) +static int decode_msg(vwr_t *vwr, guint8 *rec, int *v_type, int *IS_TX, int *log_mode) { - guint8 cmd; /* components of message */ + guint8 cmd,fpga_log_mode; /* components of message */ guint32 wd2, wd3; int v_size = 0; /* size of var-len message */ /* assume it's zero */ /* break up the message record into its pieces */ - cmd = rec[0]; /* command byte */ - wd2 = pntoh32(&rec[8]); /* first 32-bit quantity */ - wd3 = pntoh32(&rec[12]); /* second 32-bit quantity */ + cmd = rec[0]; + fpga_log_mode = rec[1]; + fpga_log_mode = ((fpga_log_mode & 0x30) >> 4); + + wd2 = pntoh32(&rec[8]); + wd3 = pntoh32(&rec[12]); + + if (vwr != NULL) { + + if ((cmd & vwr->HEADER_IS_TX) == vwr->HEADER_IS_TX) { + *IS_TX = 1; + } + else if ((cmd & vwr->HEADER_IS_RX) == vwr->HEADER_IS_RX) { + *IS_TX = 0; + } + else { + *IS_TX = 2; /*NULL case*/ + } + } + + if (vwr != NULL) + *log_mode = fpga_log_mode; /* Log mode = 3, when MPDU data is reduced */ /* now decode based on the command byte */ switch (cmd) { case COMMAND_RX: - if (IS_TX != NULL) - *IS_TX = 0; + case COMMAND_TX: + v_size = (int)(wd2 & 0xffff); + *v_type = VT_FRAME; + break; +/* + case 0x30: + if (vwr != NULL) { + v_size = (int)(wd2 & 0xffff); + *v_type = VT_FRAME; + *IS_TX = 3; + } + break; +*/ + case 0x38: /* For RF Modified only */ + if (vwr != NULL) { + *IS_TX = 3; + } v_size = (int)(wd2 & 0xffff); *v_type = VT_FRAME; break; - case COMMAND_TX: - if (IS_TX != NULL) - *IS_TX = 1; + case 0x39: /* For RF_RX Modified only */ + if (vwr != NULL) { + *IS_TX = 4; + } v_size = (int)(wd2 & 0xffff); *v_type = VT_FRAME; break; case 0xc1: case 0x8b: - if (IS_TX != NULL) - *IS_TX = 2; /*NULL case*/ + case 0xbb: v_size = (int)(wd2 & 0xffff); *v_type = VT_CPMSG; break; case 0xfe: - if (IS_TX != NULL) - *IS_TX = 2; /*NULL case*/ v_size = (int)(wd3 & 0xffff); *v_type = VT_CPMSG; break; default: - if (IS_TX != NULL) - *IS_TX = 2; /*NULL case*/ break; } @@ -2086,7 +2775,10 @@ static void setup_defaults(vwr_t *vwr, guint16 fpga) vwr->IPLEN_OFF = vVW510021_W_IPLEN_OFF; vwr->PLCP_LENGTH_OFF = vVW510021_W_PLCP_LENGTH_OFF; + vwr->HEADER_IS_RX = vVW510021_W_HEADER_IS_RX; + vwr->HEADER_IS_TX = vVW510021_W_HEADER_IS_TX; vwr->MT_MASK = vVW510021_W_SEL_MASK; + vwr->MCS_INDEX_MASK = vVW510021_W_MCS_MASK; vwr->VCID_MASK = 0xffff; vwr->FLOW_VALID = vVW510021_W_FLOW_VALID; vwr->STATS_START_OFF = vVW510021_W_HEADER_LEN; @@ -2108,9 +2800,9 @@ static void setup_defaults(vwr_t *vwr, guint16 fpga) vwr->MT_CCKS = v22_W_MT_CCKS; /*vwr->MT_OFDM = vVW510021_W_MT_OFDM;*/ - vwr->WEPTYPE = v22_W_WEPTYPE; - vwr->TKIPTYPE = v22_W_TKIPTYPE; - vwr->CCMPTYPE = v22_W_CCMPTYPE; + vwr->WEPTYPE = vVW510021_W_WEPTYPE; + vwr->TKIPTYPE = vVW510021_W_TKIPTYPE; + vwr->CCMPTYPE = vVW510021_W_CCMPTYPE; vwr->FRAME_TYPE_OFF = vVW510021_W_FRAME_TYPE_OFF; vwr->IS_TCP = vVW510021_W_IS_TCP; @@ -2131,6 +2823,12 @@ static void setup_defaults(vwr_t *vwr, guint16 fpga) vwr->STATS_LEN = vVW510021_W_STATS_TRAILER_LEN; vwr->PLCP_LENGTH_OFF = 16; + vwr->HEADER_IS_RX = vVW510021_W_HEADER_IS_RX; + vwr->HEADER_IS_TX = vVW510021_W_HEADER_IS_TX; + vwr->HEADER_IS_RFN = vVW510021_W_HEADER_IS_RFN; + vwr->HEADER_IS_RF = vVW510021_W_HEADER_IS_RF; + vwr->HEADER_IS_RXRF = vVW510021_W_HEADER_IS_RFRX; + /* * The first 16 is from the 16 bytes of stats block that * precede the PLCP; the 16 is for 16 bytes of PLCP. @@ -2157,6 +2855,9 @@ static void setup_defaults(vwr_t *vwr, guint16 fpga) vwr->INFO_OFF = v22_E_INFO_OFF; vwr->L4ID_OFF = v22_E_L4ID_OFF; + vwr->HEADER_IS_RX = v22_E_HEADER_IS_RX; + vwr->HEADER_IS_TX = v22_E_HEADER_IS_TX; + vwr->IS_RX = v22_E_IS_RX; vwr->MT_MASK = v22_E_MT_MASK; vwr->VCID_MASK = v22_E_VCID_MASK; @@ -2217,6 +2918,9 @@ static void setup_defaults(vwr_t *vwr, guint16 fpga) vwr->VCID_MASK = v22_W_VCID_MASK; vwr->FLOW_VALID = v22_W_FLOW_VALID; + vwr->HEADER_IS_RX = v22_W_HEADER_IS_RX; + vwr->HEADER_IS_TX = v22_W_HEADER_IS_TX; + vwr->RX_DECRYPTS = v22_W_RX_DECRYPTS; vwr->TX_DECRYPTS = v22_W_TX_DECRYPTS; vwr->FC_PROT_BIT = v22_W_FC_PROT_BIT; @@ -2265,6 +2969,9 @@ static void setup_defaults(vwr_t *vwr, guint16 fpga) vwr->FPGA_VERSION_OFF = vVW510024_E_FPGA_VERSION_OFF; vwr->HEADER_VERSION_OFF = vVW510024_E_HEADER_VERSION_OFF; + vwr->HEADER_IS_RX = vVW510024_E_HEADER_IS_RX; + vwr->HEADER_IS_TX = vVW510024_E_HEADER_IS_TX; + vwr->VCID_MASK = vVW510024_E_VCID_MASK; vwr->FLOW_VALID = vVW510024_E_FLOW_VALID; vwr->FCS_ERROR = v22_E_FCS_ERROR; @@ -2374,9 +3081,9 @@ static float getRate( guint8 plcpType, guint8 mcsIndex, guint16 rflags, guint8 n symbol_tx_time = 4.0f; if ( rflags & FLAGS_CHAN_40MHZ ) - ndbps = canonical_ndbps_40_ht[mcsIndex & 0x07]; + ndbps = canonical_ndbps_40_ht[mcsIndex - 8*(int)(mcsIndex/8)]; else - ndbps = canonical_ndbps_20_ht[mcsIndex & 0x07]; + ndbps = canonical_ndbps_20_ht[mcsIndex - 8*(int)(mcsIndex/8)]; bitrate = ( ndbps * (((int)(mcsIndex >> 3) + 1) )) / symbol_tx_time; } @@ -2408,7 +3115,7 @@ static float getRate( guint8 plcpType, guint8 mcsIndex, guint16 rflags, guint8 n static gboolean vwr_process_rec_data(FILE_T fh, int rec_size, struct wtap_pkthdr *phdr, Buffer *buf, vwr_t *vwr, - int IS_TX, int *err, gchar **err_info) + int IS_TX, int log_mode, int *err, gchar **err_info) { guint8* rec; /* local buffer (holds input record) */ gboolean ret = FALSE; @@ -2420,6 +3127,7 @@ vwr_process_rec_data(FILE_T fh, int rec_size, if (!wtap_read_bytes(fh, rec, rec_size, err, err_info)) { g_free(rec); + *err = WTAP_ERR_SHORT_READ; return FALSE; } @@ -2430,8 +3138,10 @@ vwr_process_rec_data(FILE_T fh, int rec_size, ret = vwr_read_s1_W_rec(vwr, phdr, buf, rec, rec_size, err, err_info); break; case S2_W_FPGA: + ret = vwr_read_s2_W_rec(vwr, phdr, buf, rec, rec_size, IS_TX, log_mode, err, err_info); + break; case S3_W_FPGA: - ret = vwr_read_s2_s3_W_rec(vwr, phdr, buf, rec, rec_size, IS_TX, err, err_info); + ret = vwr_read_s3_W_rec(vwr, phdr, buf, rec, rec_size, IS_TX, log_mode, err, err_info); break; case vVW510012_E_FPGA: case vVW510024_E_FPGA: diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h index decfdcd975..2aa119e7c8 100644 --- a/wiretap/wtap-int.h +++ b/wiretap/wtap-int.h @@ -208,6 +208,13 @@ extern gint wtap_num_file_types; } #endif +#ifndef phtole8 +#define phtole8(p, v) \ + { \ + (p)[0] = (guint8)((v) >> 0); \ + } +#endif + #ifndef phtoles #define phtoles(p, v) \ { \ @@ -216,6 +223,15 @@ extern gint wtap_num_file_types; } #endif +#ifndef phtole24 +#define phtole24(p, v) \ + { \ + (p)[0] = (guint8)((v) >> 0); \ + (p)[1] = (guint8)((v) >> 8); \ + (p)[2] = (guint8)((v) >> 16); \ + } +#endif + #ifndef phtolel #define phtolel(p, v) \ { \