Expand, correct, and otherwise improve comments.

Change-Id: Id33a1a66114f6b01d203ad717342ae90c12981cc
Reviewed-on: https://code.wireshark.org/review/10789
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2015-10-04 11:50:00 -07:00
parent 89b227f44e
commit f6283eb4dd
2 changed files with 89 additions and 6 deletions

View File

@ -1006,6 +1006,11 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
}
offset += 4;
/*
* XXX - this appears to be the NDP flag for received frames and 0
* for transmitted frames. The PLCP header follows it.
*/
/*** 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 ***/
@ -1027,8 +1032,16 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
}
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);
@ -1045,7 +1058,7 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_su_nsts,
tvb, offset, 2, vht_su_nsts, "VHT NSTS: %u ",vht_su_nsts);
offset = offset + 1; /*** to decode partial id ***/
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);
@ -1066,7 +1079,7 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
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 = offset + 1;
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,
@ -1077,8 +1090,21 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
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);
}
/*
* 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);

View File

@ -512,7 +512,7 @@ typedef struct {
guint32 L1P_2_OFF; /* offset 2nd Byte of l1params */
guint32 L4ID_OFF; /* LAYER 4 id offset*/
guint32 IPLEN_OFF; /* */
guint32 PLCP_LENGTH_OFF; /* plcp length offset*/
guint32 PLCP_LENGTH_OFF; /* offset of length field in the PLCP header */
guint32 FPGA_VERSION_OFF; /* offset of fpga version field, 16 bits */
guint32 HEADER_VERSION_OFF; /* offset of header version, 16 bits */
guint32 RXTX_OFF; /* offset of CMD bit, rx or tx */
@ -1331,6 +1331,27 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr,
/* decode OFDM or CCK PLCP header and determine rate and short preamble flag */
/* the SIGNAL byte is always the first byte of the PLCP header in the frame */
if (plcp_type == vVW510021_W_PLCP_LEGACY){
/*
* From IEEE Std 802.11-2012:
*
* According to section 17.2.2 "PPDU format", the PLCP header
* for the High Rate DSSS PHY (11b) has a SIGNAL field that's
* 8 bits, followed by a SERVICE field that's 8 bits, followed
* by a LENGTH field that's 16 bits, followed by a CRC field
* that's 16 bits. The PSDU follows it. Section 17.2.3 "PPDU
* field definitions" describes those fields.
*
* According to sections 18.3.2 "PLCP frame format" and 18.3.4
* "SIGNAL field", the PLCP for the OFDM PHY (11a) has a SIGNAL
* field that's 24 bits, followed by a service field that's
* 16 bits, followed by the PSDU. Section 18.3.5.2 "SERVICE
* field" describes the SERVICE field.
*
* According to section 19.3.2 "PPDU format", the frames for the
* Extended Rate PHY (11g) either extend the 11b format, using
* additional bits in the SERVICE field, or extend the 11a
* format.
*/
if (mcs_index < 4) {
chanflags |= CHAN_CCK;
}
@ -1339,18 +1360,50 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr,
}
}
else if (plcp_type == vVW510021_W_PLCP_MIXED) {
/*
* According to section 20.3.2 "PPDU format", the HT-mixed
* PLCP header has a "Non-HT SIGNAL field" (L-SIG), which
* looks like an 11a SIGNAL field, followed by an HT SIGNAL
* field (HT-SIG) described in section 20.3.9.4.3 "HT-SIG
* definition".
*
* This means that the first octet of HT-SIG is at
* plcp_ptr[3], skipping the 3 octets of the L-SIG field.
*
* 0x80 is the CBW 20/40 bit of HT-SIG.
*/
/* set the appropriate flags to indicate HT mode and CB */
radioflags |= FLAGS_CHAN_HT | ((plcp_ptr[3] & 0x80) ? FLAGS_CHAN_40MHZ : 0) |
((l1p_1 & vVW510021_W_IS_LONGGI) ? 0 : FLAGS_CHAN_SHORTGI);
chanflags |= CHAN_OFDM;
}
else if (plcp_type == vVW510021_W_PLCP_GREENFIELD) {
/*
* According to section 20.3.2 "PPDU format", the HT-greenfield
* PLCP header just has the HT SIGNAL field (HT-SIG) above, with
* no L-SIG field.
*
* This means that the first octet of HT-SIG is at
* plcp_ptr[0], as there's no L-SIG field to skip.
*
* 0x80 is the CBW 20/40 bit of HT-SIG.
*/
/* set the appropriate flags to indicate HT mode and CB */
radioflags |= FLAGS_CHAN_HT | ((plcp_ptr[0] & 0x80) ? FLAGS_CHAN_40MHZ : 0) |
((l1p_1 & vVW510021_W_IS_LONGGI) ? 0 : FLAGS_CHAN_SHORTGI);
chanflags |= CHAN_OFDM;
}
else if (plcp_type == vVW510021_W_PLCP_VHT_MIXED) {
/*
* According to section 22.3.2 "VHTPPDU format" of IEEE Std
* 802.11ac-2013, the VHT PLCP header has a "non-HT SIGNAL field"
* (L-SIG), which looks like an 11a SIGNAL field, followed by
* a VHT Signal A field (VHT-SIG-A) described in section
* 22.3.8.3.3 "VHT-SIG-A definition", with training fields
* between it and a VHT Signal B field (VHT-SIG-B) described
* in section 22.3.8.3.6 "VHT-SIG-B definition", followed by
* the PSDU.
*/
guint8 SBW = vVW510021_W_BANDWIDTH_VHT(l1p_2);
radioflags |= FLAGS_CHAN_VHT | ((l1p_1 & vVW510021_W_IS_LONGGI) ? 0 : FLAGS_CHAN_SHORTGI);
chanflags |= CHAN_OFDM;
@ -1533,6 +1586,10 @@ 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 {
@ -1545,7 +1602,7 @@ static gboolean vwr_read_s2_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr,
*
* XXX - shouldn't that use plcp_ptr?
*
* XXX - what about S3, where we don't have 16 bytes of PLCP?
* XXX - what about S2, where we don't have 16 bytes of PLCP?
*/
memcpy(&data_ptr[bytes_written], &rec[16], 16);
bytes_written += 16;
@ -1987,8 +2044,8 @@ static void setup_defaults(vwr_t *vwr, guint16 fpga)
vwr->PLCP_LENGTH_OFF = 16;
/*
* The 8 is from the 16 bytes of stats block that precede the
* PLCP; the 16 is for, umm, something.
* The first 16 is from the 16 bytes of stats block that
* precede the PLCP; the 16 is for 16 bytes of PLCP.
*/
vwr->MPDU_OFF = 16 + 16;