Fix various: whitespace, comments & etc.
authorBill Meier <wmeier@newsguy.com>
Wed, 16 Oct 2013 02:39:09 +0000 (02:39 -0000)
committerBill Meier <wmeier@newsguy.com>
Wed, 16 Oct 2013 02:39:09 +0000 (02:39 -0000)
Add editor modelines.

svn path=/trunk/; revision=52639

wiretap/vwr.c

index 148d51d017d0a3802edcbebebd6d4429caa0dc67..aa8cfd01ad6240836f32a3c52022e1afeae3ac1c 100644 (file)
@@ -230,11 +230,11 @@ enum radiotap_type {
 #define RADIOTAP_F_CHAN_160MHZ  0x800               /* 160 MHz channel bandwidth */
 
 /* For VeriWave-specific RADIOTAP_FLAGS and ETHERNETTAP_FLAGS */
-#define RADIOTAP_VWF_TXF    0x01                    /* frame was transmitted */
-#define RADIOTAP_VWF_FCSERR 0x02                    /* FCS error detected */
-#define RADIOTAP_VWF_RETRERR 0x04                   /* excess retry error detected */
-#define RADIOTAP_VWF_DCRERR 0x10                    /* decrypt error detected (WLAN) */
-#define RADIOTAP_VWF_ENCMSK 0x60                    /* encryption type mask */
+#define RADIOTAP_VWF_TXF        0x01                /* frame was transmitted */
+#define RADIOTAP_VWF_FCSERR     0x02                /* FCS error detected */
+#define RADIOTAP_VWF_RETRERR    0x04                /* excess retry error detected */
+#define RADIOTAP_VWF_DCRERR     0x10                /* decrypt error detected (WLAN) */
+#define RADIOTAP_VWF_ENCMSK     0x60                /* encryption type mask */
                                                     /* 0 = none, 1 = WEP, 2 = TKIP, 3 = CCKM */
 #define RADIOTAP_VWF_IS_WEP     0x20                /* WEP */
 #define RADIOTAP_VWF_IS_TKIP    0x40                /* TKIP */
@@ -250,24 +250,24 @@ enum radiotap_type {
 /* FPGA-generated frame buffer STATS block offsets and definitions */
 
 /* definitions for v2.2 frames, Ethernet format */
-#define v22_E_STATS_LEN     44                      /* length of stats block trailer */
-#define v22_E_VALID_OFF     0                       /* bit 6 (0x40) is flow-is-valid flag */
-#define v22_E_MTYPE_OFF     1                       /* offset of modulation type */
-#define v22_E_VCID_OFF      2                       /* offset of VC ID */
-#define v22_E_FLOWSEQ_OFF   4                       /* offset of signature sequence number */
-#define v22_E_FLOWID_OFF    5                       /* offset of flow ID */
-#define v22_E_OCTET_OFF     8                       /* offset of octets */
-#define v22_E_ERRORS_OFF    10                      /* offset of error vector */
-#define v22_E_PATN_OFF      12                      /* offset of pattern match vector */
-#define v22_E_L4ID_OFF      12
-#define v22_E_IPLEN_OFF     14
-#define v22_E_FRAME_TYPE_OFF   16                   /* offset of frame type, 32 bits */
-#define v22_E_RSSI_OFF      21                      /* RSSI (NOTE: invalid for Ethernet) */
-#define v22_E_STARTT_OFF    20                      /* offset of start time, 64 bits */
-#define v22_E_ENDT_OFF      28                      /* offset of end time, 64 bits */
-#define v22_E_LATVAL_OFF    36                      /* offset of latency, 32 bits */
-#define v22_E_INFO_OFF      40                      /* NO INFO FIELD IN ETHERNET STATS! */
-#define v22_E_DIFFERENTIATOR_OFF    0               /* offset to determine whether */
+#define v22_E_STATS_LEN          44                 /* length of stats block trailer */
+#define v22_E_VALID_OFF           0                 /* bit 6 (0x40) is flow-is-valid flag */
+#define v22_E_MTYPE_OFF           1                 /* offset of modulation type */
+#define v22_E_VCID_OFF            2                 /* offset of VC ID */
+#define v22_E_FLOWSEQ_OFF         4                 /* offset of signature sequence number */
+#define v22_E_FLOWID_OFF          5                 /* offset of flow ID */
+#define v22_E_OCTET_OFF           8                 /* offset of octets */
+#define v22_E_ERRORS_OFF         10                 /* offset of error vector */
+#define v22_E_PATN_OFF           12                 /* offset of pattern match vector */
+#define v22_E_L4ID_OFF           12
+#define v22_E_IPLEN_OFF          14
+#define v22_E_FRAME_TYPE_OFF     16                 /* offset of frame type, 32 bits */
+#define v22_E_RSSI_OFF           21                 /* RSSI (NOTE: invalid for Ethernet) */
+#define v22_E_STARTT_OFF         20                 /* offset of start time, 64 bits */
+#define v22_E_ENDT_OFF           28                 /* offset of end time, 64 bits */
+#define v22_E_LATVAL_OFF         36                 /* offset of latency, 32 bits */
+#define v22_E_INFO_OFF           40                 /* NO INFO FIELD IN ETHERNET STATS! */
+#define v22_E_DIFFERENTIATOR_OFF  0                 /* offset to determine whether */
                                                     /* eth/802.11, 8 bits */
 
 #define v22_E_MT_10_HALF    0                       /* 10 Mb/s half-duplex */
@@ -277,22 +277,22 @@ enum radiotap_type {
 #define v22_E_MT_1G_HALF    4                       /* 1 Gb/s half-duplex */
 #define v22_E_MT_1G_FULL    5                       /* 1 Gb/s full-duplex */
 
-#define v22_E_FCS_ERROR     0x0002                  /* FCS error flag in error vector */
-#define v22_E_CRYPTO_ERR    0x1f00                  /* RX decrypt error flags (UNUSED) */
-#define v22_E_SIG_ERR       0x0004                  /* signature magic byte mismatch */
-#define v22_E_PAYCHK_ERR    0x0008                  /* payload checksum failure */
-#define v22_E_RETRY_ERR     0x0400                  /* excessive retries on TX fail (UNUSED)*/
-#define v22_E_IS_RX         0x08                    /* TX/RX bit in STATS block */
-#define v22_E_MT_MASK       0x07                    /* modulation type mask (UNUSED) */
-#define v22_E_VCID_MASK     0x03ff                  /* VC ID is only 9 bits */
-#define v22_E_FLOW_VALID    0x40                    /* flow-is-valid flag (else force to 0) */
+#define v22_E_FCS_ERROR           0x0002            /* FCS error flag in error vector */
+#define v22_E_CRYPTO_ERR          0x1f00            /* RX decrypt error flags (UNUSED) */
+#define v22_E_SIG_ERR             0x0004            /* signature magic byte mismatch */
+#define v22_E_PAYCHK_ERR          0x0008            /* payload checksum failure */
+#define v22_E_RETRY_ERR           0x0400            /* excessive retries on TX fail (UNUSED)*/
+#define v22_E_IS_RX               0x08              /* TX/RX bit in STATS block */
+#define v22_E_MT_MASK             0x07              /* modulation type mask (UNUSED) */
+#define v22_E_VCID_MASK           0x03ff            /* VC ID is only 9 bits */
+#define v22_E_FLOW_VALID          0x40              /* flow-is-valid flag (else force to 0) */
 #define v22_E_DIFFERENTIATOR_MASK 0X3F              /* mask to differentiate ethernet from */
-#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 */
-#define v22_E_IS_QOS            0x80                        /* QoS bit in MTYPE field (WLAN only) */
-#define v22_E_IS_VLAN           0x00200000
+#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 */
+#define v22_E_IS_QOS              0x80              /* QoS bit in MTYPE field (WLAN only) */
+#define v22_E_IS_VLAN             0x00200000
 
 
 #define v22_E_RX_DECRYPTS   0x0007                  /* RX-frame-was-decrypted (UNUSED) */
@@ -308,27 +308,27 @@ enum radiotap_type {
 #define v22_E_IS_80211      0x7F000000              /* bits set in frame type if 802.11 */
 
 /* definitions for v2.2 frames, WLAN format for VW510006 FPGA*/
-#define v22_W_STATS_LEN     64                      /* length of stats block trailer */
-#define v22_W_VALID_OFF     0                       /* bit 6 (0x40) is flow-is-valid flag */
-#define v22_W_MTYPE_OFF     1                       /* offset of modulation type */
-#define v22_W_VCID_OFF      2                       /* offset of VC ID */
-#define v22_W_FLOWSEQ_OFF   4                       /* offset of signature sequence number */
-#define v22_W_FLOWID_OFF    5                       /* offset of flow ID */
-#define v22_W_OCTET_OFF     8                       /* offset of octets */
-#define v22_W_ERRORS_OFF    10                      /* offset of error vector */
-#define v22_W_PATN_OFF      12
-#define v22_W_L4ID_OFF      12
-#define v22_W_IPLEN_OFF     14
-#define v22_W_FRAME_TYPE_OFF        16              /* offset of frame type, 32 bits */
-#define v22_W_RSSI_OFF      21                      /* RSSI (NOTE: RSSI must be negated!) */
-#define v22_W_STARTT_OFF    24                      /* offset of start time, 64 bits */
-#define v22_W_ENDT_OFF      32                      /* offset of end time, 64 bits */
-#define v22_W_LATVAL_OFF    40                      /* offset of latency, 32 bits */
-#define v22_W_INFO_OFF      54                      /* offset of INFO field, 16 LSBs */
-#define v22_W_DIFFERENTIATOR_OFF    20              /* offset to determine whether */
+#define v22_W_STATS_LEN          64                 /* length of stats block trailer */
+#define v22_W_VALID_OFF           0                 /* bit 6 (0x40) is flow-is-valid flag */
+#define v22_W_MTYPE_OFF           1                 /* offset of modulation type */
+#define v22_W_VCID_OFF            2                 /* offset of VC ID */
+#define v22_W_FLOWSEQ_OFF         4                 /* offset of signature sequence number */
+#define v22_W_FLOWID_OFF          5                 /* offset of flow ID */
+#define v22_W_OCTET_OFF           8                 /* offset of octets */
+#define v22_W_ERRORS_OFF         10                 /* offset of error vector */
+#define v22_W_PATN_OFF           12
+#define v22_W_L4ID_OFF           12
+#define v22_W_IPLEN_OFF          14
+#define v22_W_FRAME_TYPE_OFF     16                 /* offset of frame type, 32 bits */
+#define v22_W_RSSI_OFF           21                 /* RSSI (NOTE: RSSI must be negated!) */
+#define v22_W_STARTT_OFF         24                 /* offset of start time, 64 bits */
+#define v22_W_ENDT_OFF           32                 /* offset of end time, 64 bits */
+#define v22_W_LATVAL_OFF         40                 /* offset of latency, 32 bits */
+#define v22_W_INFO_OFF           54                 /* offset of INFO field, 16 LSBs */
+#define v22_W_DIFFERENTIATOR_OFF 20                 /* offset to determine whether */
                                                     /*  eth/802.11, 32 bits */
 
-#define v22_W_PLCP_LENGTH_OFF       4               /* LENGTH field in the plcp header */
+#define v22_W_PLCP_LENGTH_OFF     4                 /* LENGTH field in the plcp header */
 
 
 #define v22_W_MT_CCKL       0                       /* CCK modulation, long preamble */
@@ -379,8 +379,8 @@ enum radiotap_type {
 */
 /* offsets in the stats block */
 #define vVW510021_W_STATS_LEN           48          /* length of stats block trailer after the plcp portion*/
-#define vVW510021_W_STARTT_OFF                    /* offset of start time, 64 bits */
-#define vVW510021_W_ENDT_OFF                      /* offset of end time, 64 bits */
+#define vVW510021_W_STARTT_OFF           0          /* offset of start time, 64 bits */
+#define vVW510021_W_ENDT_OFF             8          /* offset of end time, 64 bits */
 #define vVW510021_W_ERRORS_OFF          16          /* offset of error vector */
 #define vVW510021_W_VALID_OFF           20          /* 2 Bytes with different validity bits */
 #define vVW510021_W_INFO_OFF            22          /* offset of INFO field, 16 LSBs */
@@ -396,21 +396,21 @@ enum radiotap_type {
 
 /* offsets in the header block */
 #define vVW510021_W_HEADER_LEN          16          /* length of FRAME header */
-#define vVW510021_W_RXTX_OFF                      /* rxtx offset, cmd byte of header */
-#define vVW510021_W_HEADER_VERSION_OFF            /* version, 2bytes */
+#define vVW510021_W_RXTX_OFF             0          /* rxtx offset, cmd byte of header */
+#define vVW510021_W_HEADER_VERSION_OFF   9          /* version, 2bytes */
 #define vVW510021_MSG_LENGTH_OFF        10          /* MSG LENGTH, 2bytes */
-#define vVW510021_W_DEVICE_TYPE_OFF               /* version, 2bytes */
+#define vVW510021_W_DEVICE_TYPE_OFF      8          /* version, 2bytes */
 
-/* offsets that occurs right after the header */
-#define vVW510021_W_AFTERHEADER_LEN               /* length of STATs info directly after header */
-#define vVW510021_W_L1P_1_OFF                     /* offset of 1st byte of layer one info */
-#define vVW510021_W_L1P_2_OFF                     /* offset of 2nd byte of layer one info */
+/* offsets that occur right after the header */
+#define vVW510021_W_AFTERHEADER_LEN      8          /* length of STATs info directly after header */
+#define vVW510021_W_L1P_1_OFF            0          /* offset of 1st byte of layer one info */
+#define vVW510021_W_L1P_2_OFF            1          /* offset of 2nd byte of layer one info */
 #define vVW510021_W_MTYPE_OFF           vVW510021_W_L1P_2_OFF
 #define vVW510021_W_PREAMBLE_OFF        vVW510021_W_L1P_1_OFF
-#define vVW510021_W_RSSI_TXPOWER_OFF              /* RSSI (NOTE: RSSI must be negated!) */
-#define vVW510021_W_MSDU_LENGTH_OFF               /* 7:0 of length, next byte 11:8 in top 4 bits */
-#define vVW510021_W_BVCV_VALID_OFF                /* BV,CV Determine validaity of bssid and txpower */
-#define vVW510021_W_VCID_OFF                      /* offset of VC (client) ID */
+#define vVW510021_W_RSSI_TXPOWER_OFF     2          /* RSSI (NOTE: RSSI must be negated!) */
+#define vVW510021_W_MSDU_LENGTH_OFF      3          /* 7:0 of length, next byte 11:8 in top 4 bits */
+#define vVW510021_W_BVCV_VALID_OFF       4          /* BV,CV Determine validaity of bssid and txpower */
+#define vVW510021_W_VCID_OFF             6          /* offset of VC (client) ID */
 #define vVW510021_W_PLCP_LENGTH_OFF     12          /* LENGTH field in the plcp header */
 
 /* Masks and defines */
@@ -465,11 +465,11 @@ enum radiotap_type {
 */
 /* offsets in the stats block */
 #define vVW510024_E_STATS_LEN           48          /* length of stats block trailer */
-#define vVW510024_E_MSDU_LENGTH_OFF               /* MSDU 16 BITS */
-#define vVW510024_E_BMCV_VALID_OFF                /* BM,CV Determine validITY */
-#define vVW510024_E_VCID_OFF                      /* offset of VC (client) ID 13:8, */
+#define vVW510024_E_MSDU_LENGTH_OFF      0          /* MSDU 16 BITS */
+#define vVW510024_E_BMCV_VALID_OFF       2          /* BM,CV Determine validITY */
+#define vVW510024_E_VCID_OFF             2          /* offset of VC (client) ID 13:8, */
                                                     /*  7:0 IN offset 7*/
-#define vVW510024_E_STARTT_OFF                    /* offset of start time, 64 bits */
+#define vVW510024_E_STARTT_OFF           4          /* offset of start time, 64 bits */
 #define vVW510024_E_ENDT_OFF            12          /* offset of end time, 64 bits */
 #define vVW510024_E_ERRORS_OFF          22          /* offset of error vector */
 #define vVW510024_E_VALID_OFF           24          /* 2 Bytes with different validity bits */
@@ -484,9 +484,9 @@ enum radiotap_type {
 #define vVW510024_E_MATCH_OFF           51          /* offset of pattern match vector */
 
 /* offsets in the header block */
-#define vVW510024_E_HEADER_LEN          vVW510021_W_HEADER_LEN  /* length of FRAME header */
-#define vVW510024_E_RXTX_OFF            vVW510021_W_RXTX_OFF    /* rxtx offset, cmd byte */
-#define vVW510024_E_HEADER_VERSION_OFF  16                      /* version, 2bytes */
+#define vVW510024_E_HEADER_LEN          vVW510021_W_HEADER_LEN      /* length of FRAME header */
+#define vVW510024_E_RXTX_OFF            vVW510021_W_RXTX_OFF        /* rxtx offset, cmd byte */
+#define vVW510024_E_HEADER_VERSION_OFF  16                          /* version, 2bytes */
 #define vVW510024_E_MSG_LENGTH_OFF      vVW510021_MSG_LENGTH_OFF    /* MSG LENGTH, 2bytes */
 #define vVW510024_E_DEVICE_TYPE_OFF     vVW510021_W_DEVICE_TYPE_OFF /* Device Type, 2bytes */
 
@@ -494,7 +494,7 @@ enum radiotap_type {
 #define vVW510024_E_IS_BV               0x80                    /* Bm bit in STATS block */
 #define vVW510024_E_IS_CV               0x40                    /* cV bit in STATS block */
 #define vVW510024_E_FLOW_VALID          0x8000                  /* valid_off flow-is-valid flag (else force to 0) */
-#define vVW510024_E_QOS_VALID           0x0000                  /*not valid for ethernet*/
+#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
@@ -521,7 +521,7 @@ enum radiotap_type {
 #define vVW510024_E_FPGA                4
 #define S3_W_FPGA                       5
 
-    /*the flow signature is:
+    /* the flow signature is:
     Byte Description
 0   Magic Number (0xDD)
 1   Chassis Number[7:0]
@@ -541,10 +541,10 @@ enum radiotap_type {
 15  CRC16
 
 */
-#define SIG_SIZE        16                          /* size of signature field, bytes */
-#define SIG_FID_OFF     4                           /* offset of flow ID in signature */
-#define SIG_FSQ_OFF     7                           /* offset of flow seqnum in signature */
-#define SIG_TS_OFF      8                           /* offset of flow seqnum in signature */
+#define SIG_SIZE        16                           /* size of signature field, bytes     */
+#define SIG_FID_OFF      4                           /* offset of flow ID in signature     */
+#define SIG_FSQ_OFF      7                           /* offset of flow seqnum in signature */
+#define SIG_TS_OFF       8                           /* offset of flow seqnum in signature */
 
 
 
@@ -644,13 +644,13 @@ static int          find_signature(register guint8 *, int, int, register guint32
 static guint64      get_signature_ts(register guint8 *, int);
 static float        getRate( guint8 plcpType, guint8 mcsIndex, guint16 rflags, guint8 nss );
 
-/* open a .vwr file for reading */
-/* this does very little, except setting the wiretap header for a VWR file type */
-/* and the timestamp precision to microseconds */
+/* Open a .vwr file for reading */
+/* This does very little, except setting the wiretap header for a VWR file type */
+/*  and setting the timestamp precision to microseconds.                        */
 
 int vwr_open(wtap *wth, int *err, gchar **err_info)
 {
-    int fpgaVer;
+    int    fpgaVer;
     vwr_t *vwr;
 
     *err = 0;
@@ -682,38 +682,38 @@ int vwr_open(wtap *wth, int *err, gchar **err_info)
     else if (fpgaVer == vVW510012_E_FPGA || fpgaVer == vVW510024_E_FPGA)
         wth->file_type = WTAP_FILE_VWR_ETH;
 
-    return(1);
+    return 1;
 }
 
 
 /* Read the next packet */
-/* note that the VWR file format consists of a sequence of fixed 16-byte record headers of */
-/* different types; some types, including frame record headers, are followed by */
-/* variable-length data */
-/* a frame record consists of: the above 16-byte record header, a 1-16384 byte raw PLCP */
-/* frame, and a 64-byte statistics block trailer */
-/* the PLCP frame consists of a 4-byte or 6-byte PLCP header, followed by the MAC frame */
+/* Note that the VWR file format consists of a sequence of fixed 16-byte record headers of */
+/*  different types; some types, including frame record headers, are followed by           */
+/*  variable-length data.                                                                  */
+/* A frame record consists of: the above 16-byte record header, a 1-16384 byte raw PLCP    */
+/*  frame, and a 64-byte statistics block trailer.                                         */
+/* The PLCP frame consists of a 4-byte or 6-byte PLCP header, followed by the MAC frame    */
 
 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;
+    vwr_t *vwr      = (vwr_t *)wth->priv;
+    int    rec_size = 0, IS_TX;
 
     /* read the next frame record header in the capture file; if no more frames, return */
     if (!vwr_read_rec_header(vwr, wth->fh, &rec_size, &IS_TX, err, err_info))
-        return(FALSE);                                  /* Read error or EOF */
+        return FALSE;                                   /* Read error or EOF */
 
     *data_offset = (file_tell(wth->fh) - 16);           /* set offset for random seek @PLCP */
 
     /* got a frame record; read and process it */
-    if (!vwr_process_rec_data(wth, wth->fh, rec_size, 
+    if (!vwr_process_rec_data(wth, wth->fh, rec_size,
                               wth->frame_buffer, vwr, IS_TX, err, err_info))
-       return(FALSE);
+       return FALSE;
 
-    /* If the per-file encapsulation isn't known, set it to this packet's encapsulation */
-    /* If it *is* known, and it isn't this packet's encapsulation, set it to */
-    /* WTAP_ENCAP_PER_PACKET, as this file doesn't have a single encapsulation for all */
-    /* packets in the file */
+    /* If the per-file encapsulation isn't known, set it to this packet's encapsulation. */
+    /* If it *is* known, and it isn't this packet's encapsulation, set it to             */
+    /*  WTAP_ENCAP_PER_PACKET, as this file doesn't have a single encapsulation for all  */
+    /*  packets in the file.                                                             */
     if (wth->file_encap == WTAP_ENCAP_UNKNOWN)
         wth->file_encap = wth->phdr.pkt_encap;
     else {
@@ -721,7 +721,7 @@ static gboolean vwr_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off
             wth->file_encap = WTAP_ENCAP_PER_PACKET;
     }
 
-    return(TRUE);
+    return TRUE;
 }
 
 /* read a random frame in the middle of a file; the start of the PLCP frame is @ seek_off */
@@ -730,25 +730,25 @@ static gboolean vwr_seek_read(wtap *wth, gint64 seek_off,
     struct wtap_pkthdr *phdr _U_, Buffer *buf, int pkt_size _U_,
     int *err, gchar **err_info)
 {
-    vwr_t       *vwr = (vwr_t *)wth->priv;
-    int         rec_size, IS_TX;
+    vwr_t *vwr = (vwr_t *)wth->priv;
+    int    rec_size, IS_TX;
 
     /* first seek to the indicated record header */
     if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
-        return(FALSE);
+        return FALSE;
 
     /* read in the record header */
     if (!vwr_read_rec_header(vwr, wth->random_fh, &rec_size, &IS_TX, err, err_info))
-        return(FALSE);                                  /* Read error or EOF */
+        return FALSE;                                  /* Read error or EOF */
 
     return vwr_process_rec_data(wth, wth->random_fh, rec_size, buf,
                                 vwr, IS_TX, err, err_info);
 }
 
-/* scan down in the input capture file to find the next frame header */
-/* decode and skip over all non-frame messages that are in the way */
-/* return TRUE on success, FALSE on EOF or error */
-/* also return the frame size in bytes and the "is transmitted frame" flag */
+/* Scan down in the input capture file to find the next frame header.       */
+/* Decode and skip over all non-frame messages that are in the way.         */
+/* 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(vwr_t *vwr, FILE_T fh, int *rec_size, int *IS_TX, int *err, gchar **err_info)
 {
@@ -758,104 +758,104 @@ static gboolean vwr_read_rec_header(vwr_t *vwr, FILE_T fh, int *rec_size, int *I
     errno = WTAP_ERR_CANT_READ;
     *rec_size = 0;
 
-    /* read out the file data in 16-byte messages, stopping either after we find a frame, */
-    /* or if we run out of data */
-    /* each 16-byte message is decoded; if we run across a non-frame message followed by a*/
-    /* variable-length item, we read the variable length item out and discard it */
-    /* if we find a frame, we return (with the header in the passed buffer) */
+    /* Read out the file data in 16-byte messages, stopping either after we find a frame,  */
+    /*  or if we run out of data.                                                          */
+    /* Each 16-byte message is decoded; if we run across a non-frame message followed by a */
+    /*  variable-length item, we read the variable length item out and discard it.         */
+    /* If we find a frame, we return (with the header in the passed buffer).               */
     while (1) {
         if (file_read(header, 16, fh) != 16) {
             *err = file_error(fh, err_info);
-            return(FALSE);
+            return FALSE;
         }
 
-        /* got a header; invoke decode-message function to parse and process it */
-        /* 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 */
+        /* Got a header; invoke decode-message function to parse and process it.     */
+        /* 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(vwr, header, &v_type, IS_TX)) != 0) {
             if (f_len > B_SIZE) {
                 *err = WTAP_ERR_BAD_FILE;
                 *err_info = g_strdup_printf("vwr: Invalid message record length %d", f_len);
-                return(FALSE);
+                return FALSE;
             }
             else if (v_type != VT_FRAME) {
                 if (file_seek(fh, f_len, SEEK_CUR, err) < 0)
-                    return(FALSE);
+                    return FALSE;
             }
             else {
                 *rec_size = f_len;
-                return(TRUE);
+                return TRUE;
             }
         }
     }
 }
 
-/* figure out the FPGA version (and also see whether this is a VWR file type */
-/* return FPGA version if it's a known version, UNKNOWN_FPGA if it's not, */
-/* and -1 on an I/O error. */
+/* Figure out the FPGA version (and also see whether this is a VWR file type. */
+/* Return FPGA version if it's a known version, UNKNOWN_FPGA if it's not,     */
+/*  and -1 on an I/O error.                                                   */
 
 static int vwr_get_fpga_version(wtap *wth, int *err, gchar **err_info)
 {
-    guint8      rec[B_SIZE];                        /* local buffer (holds input record) */
-    guint8      header[16];
-    int         rec_size = 0;
-    guint8      i;
-    guint8      *s_510006_ptr = NULL;
-    guint8      *s_510024_ptr = NULL;
-    guint8      *s_510012_ptr = NULL;               /* stats pointers */
-    gint64      filePos = -1;
-    guint32     frame_type = 0;
-    int         f_len, v_type;
-    guint16     data_length = 0;
-    guint16     fpga_version;
+    guint8   rec[B_SIZE];         /* local buffer (holds input record) */
+    guint8   header[16];
+    int      rec_size     = 0;
+    guint8   i;
+    guint8  *s_510006_ptr = NULL;
+    guint8  *s_510024_ptr = NULL;
+    guint8  *s_510012_ptr = NULL; /* stats pointers */
+    gint64   filePos      = -1;
+    guint32  frame_type   = 0;
+    int      f_len, v_type;
+    guint16  data_length  = 0;
+    guint16  fpga_version;
 
     filePos = file_tell(wth->fh);
     if (filePos == -1) {
         *err = file_error(wth->fh, err_info);
-        return(-1);
+        return -1;
     }
 
     fpga_version = 1000;
-    /* got a frame record; see if it is vwr  */
-    /* if we don't get it all, then declare an error, we can't process the frame */
-    /* read out the file data in 16-byte messages, stopping either after we find a frame, */
-    /* or if we run out of data */
-    /* each 16-byte message is decoded; if we run across a non-frame message followed by a*/
-    /* variable-length item, we read the variable length item out and discard it */
-    /* if we find a frame, we return (with the header in the passed buffer) */
+    /* Got a frame record; see if it is vwr  */
+    /* If we don't get it all, then declare an error, we can't process the frame.          */
+    /* Read out the file data in 16-byte messages, stopping either after we find a frame,  */
+    /*  or if we run out of data.                                                          */
+    /* Each 16-byte message is decoded; if we run across a non-frame message followed by a */
+    /*  variable-length item, we read the variable length item out and discard it.         */
+    /* If we find a frame, we return (with the header in the passed buffer).               */
     while ((file_read(header, 16, wth->fh)) == 16) {
-        /* got a header; invoke decode-message function to parse and process it */
-        /* 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 */
+        /* Got a header; invoke decode-message function to parse and process it.     */
+        /* 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(NULL, header, &v_type, NULL)) != 0) {
             if (f_len > B_SIZE) {
                 /* Treat this here as an indication that the file probably */
-                /* isn't an vwr file. */
-                return(UNKNOWN_FPGA);
+                /*  isn't a vwr file. */
+                return UNKNOWN_FPGA;
             }
             else if (v_type != VT_FRAME) {
                 if (file_seek(wth->fh, f_len, SEEK_CUR, err) < 0)
-                    return(-1);
+                    return -1;
             }
             else {
                 rec_size = f_len;
-                /* got a frame record; read over entire record (frame + trailer) into a local buffer */
-                /* if we don't get it all, assume this isn't a vwr file */
+                /* Got a frame record; read over entire record (frame + trailer) into a local buffer */
+                /* If we don't get it all, assume this isn't a vwr file */
                 if (file_read(rec, rec_size, wth->fh) != rec_size) {
                     *err = file_error(wth->fh, err_info);
                     if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
-                        return(-1);
-                    return(UNKNOWN_FPGA); /* short read - not a vwr file */
+                        return -1;
+                    return UNKNOWN_FPGA; /* short read - not a vwr file */
                 }
 
 
                 /*  I'll grab the bytes where the Ethernet "octets" field should be and the bytes where */
-                /*  the 802.11 "octets" field should be. Then if I do rec_size - octets - */
-                /*  size_of_stats_block and it's 0, I can select the correct type. */
-                /*  octets + stats_len = rec_size only when octets have been incremented to nearest */
-                /*  number divisible by 4. */
+                /*   the 802.11 "octets" field should be. Then if I do rec_size - octets -              */
+                /*   size_of_stats_block and it's 0, I can select the correct type.                     */
+                /*  octets + stats_len = rec_size only when octets have been incremented to nearest     */
+                /*   number divisible by 4.                                                             */
 
                 /* First check for series I WLAN since the check is more rigorous. */
                 if (rec_size > v22_W_STATS_LEN) {
@@ -932,7 +932,7 @@ static int vwr_get_fpga_version(wtap *wth, int *err, gchar **err_info)
                         return (-1);
                     }
                     /* We found an FPGA that works */
-                    return(fpga_version);
+                    return fpga_version;
                 }
             }
         }
@@ -940,25 +940,25 @@ static int vwr_get_fpga_version(wtap *wth, int *err, gchar **err_info)
 
     *err = file_error(wth->fh, err_info);
     if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
-        return(-1);
-    return(UNKNOWN_FPGA); /* short read - not a vwr file */
+        return -1;
+    return UNKNOWN_FPGA; /* short read - not a vwr file */
 }
 
-/* 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 */
+/* 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 void vwr_read_rec_data_wlan(wtap *wth, guint8 *data_ptr, guint8 *rec, int rec_size, int IS_TX)
 {
-    vwr_t           *vwr = (vwr_t *)wth->priv;
-    int             bytes_written = 0;              /* bytes output to buf so far */
-    ext_rtap_fields er_fields;                      /* extended radiotap fields */
-    stats_common_fields common_fields;              /* extended radiotap fields */
-    int             mpdu_offset;
+    vwr_t               *vwr = (vwr_t *)wth->priv;
+    int                  bytes_written = 0; /* bytes output to buf so far */
+    ext_rtap_fields      er_fields;         /* extended radiotap fields   */
+    stats_common_fields  common_fields;     /* extended radiotap fields   */
+    int                  mpdu_offset;
 
     /* Parse the stats block and fill the common and er structs */
     switch (vwr->FPGA_VERSION) {
-        case S1_W_FPGA: 
+        case S1_W_FPGA:
             mpdu_offset = parse_s1_W_stats(wth, rec, rec_size, &er_fields, &common_fields);
             break;
         case S2_W_FPGA:
@@ -1031,7 +1031,7 @@ static void vwr_read_rec_data_wlan(wtap *wth, guint8 *data_ptr, guint8 *rec, int
     bytes_written += 4;
 
     /* finally, copy the whole MAC frame to the packet buffer as-is; exclude 4-byte FCS */
-    if ( rec_size < ((int)common_fields.vw_msdu_length + (int)vwr->STATS_LEN) ) 
+    if ( rec_size < ((int)common_fields.vw_msdu_length + (int)vwr->STATS_LEN) )
         /*something's been truncated, DUMP AS-IS*/
         memcpy(&data_ptr[bytes_written], &rec[mpdu_offset], common_fields.vw_msdu_length);
     else if (common_fields.vw_msdu_length >= 4)
@@ -1044,39 +1044,39 @@ static void vwr_read_rec_data_wlan(wtap *wth, guint8 *data_ptr, guint8 *rec, int
 static int parse_s1_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_fields * er_fields, stats_common_fields * common_fields)
 {
     vwr_t           *vwr = (vwr_t *)wth->priv;
-    register int    i;                              /* temps */
-    register guint8 *s_ptr, *m_ptr;                 /* stats pointer */
-    guint16         octets, msdu_length;            /* octets in frame */
-    guint64         tmp_len;
-    guint16         rflags;
-    guint8          m_type, flow_seq;               /* mod type (CCK-L/CCK-S/OFDM), seqnum */
-    guint64         s_time = LL_ZERO, e_time = LL_ZERO; /* start/end */
-                                                    /* times, nsec */
-    guint32         latency;
-    guint64         start_time, s_sec, s_usec = LL_ZERO; /* start time, sec + usec */
-    guint64         end_time;                       /* end time */
-    guint32         info;                           /* INFO/ERRORS fields in stats blk */
-    gint16          rssi;                           /* RSSI, signed 16-bit number */
-    int             f_tx;                           /* flag: if set, is a TX frame */
-    guint8          plcp_type, mcs_index, nss;      /* PLCP type 0: Legacy, 1: Mixed, 2: Green field, 3: VHT Mixed */
-    guint16         vc_id, flow_id, ht_len=0;       /* VC ID, flow ID, total ip length */
-    guint32         d_time, errors;                 /* packet duration & errors */
-    guint16         r_hdr_len;                      /* length of radiotap headers */
-    int             sig_off, pay_off;               /* MAC+SNAP header len, signature offset */
-    guint64         sig_ts;                         /* 32 LSBs of timestamp in signature */
-    float           phyRate;
+    register int     i;                                   /* temps */
+    register guint8 *s_ptr, *m_ptr;                       /* stats pointer */
+    guint16          octets, msdu_length;                 /* octets in frame */
+    guint64          tmp_len;
+    guint16          rflags;
+    guint8           m_type, flow_seq;                    /* mod type (CCK-L/CCK-S/OFDM), seqnum */
+    guint64          s_time = LL_ZERO, e_time = LL_ZERO;  /* start/end */
+                                                          /* times, nsec */
+    guint32          latency;
+    guint64          start_time, s_sec, s_usec = LL_ZERO; /* start time, sec + usec */
+    guint64          end_time;                            /* end time */
+    guint32          info;                                /* INFO/ERRORS fields in stats blk */
+    gint16           rssi;                                /* RSSI, signed 16-bit number */
+    int              f_tx;                                /* flag: if set, is a TX frame */
+    guint8           plcp_type, mcs_index, nss;           /* PLCP type 0: Legacy, 1: Mixed, 2: Green field, 3: VHT Mixed */
+    guint16          vc_id, flow_id, ht_len=0;            /* VC ID, flow ID, total ip length */
+    guint32          d_time, errors;                      /* packet duration & errors */
+    guint16          r_hdr_len;                           /* length of radiotap headers */
+    int              sig_off, pay_off;                    /* MAC+SNAP header len, signature offset */
+    guint64          sig_ts;                              /* 32 LSBs of timestamp in signature */
+    float            phyRate;
 
 
     if (rec_size<64)
        rec_size = 64;
 
-    /* calculate the start of the statistics block in the buffer */
-    /* also get a bunch of fields from the stats block */
-    s_ptr = &(rec[rec_size - 64]);               /* point to it */
-    m_type = s_ptr[1] & 0x7;
-    f_tx = !(s_ptr[1] & 0x8);
-    octets = pntohs(&s_ptr[8]);
-    vc_id = pntohs(&s_ptr[2]) & 0x3ff;
+    /* Calculate the start of the statistics block in the buffer */
+    /* Also get a bunch of fields from the stats block */
+    s_ptr    = &(rec[rec_size - 64]); /* point to it */
+    m_type   = s_ptr[1] & 0x7;
+    f_tx     = !(s_ptr[1] & 0x8);
+    octets   = pntohs(&s_ptr[8]);
+    vc_id    = pntohs(&s_ptr[2]) & 0x3ff;
     flow_seq = s_ptr[4];
 
     /* XXX - this is 48 bits, in a weird byte order */
@@ -1084,14 +1084,14 @@ static int parse_s1_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
     for (i = 0; i < 4; i++)
         latency = (latency << 8) | s_ptr[40 + i];
 
-    flow_id = pntohs(&s_ptr[6]);   /* only 16 LSBs kept */
-    errors = pntohs(&s_ptr[10]);
+    flow_id = pntohs(&s_ptr[6]);  /* only 16 LSBs kept */
+    errors  = pntohs(&s_ptr[10]);
 
     info = pntohs(&s_ptr[54]);
     rssi = (s_ptr[21] & 0x80) ? (-1 * (s_ptr[21] & 0x7f)) : s_ptr[21];
 
-    /* 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 */
+    /* 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.  */
     plcp_type = 0;
     nss = 1;
     if (m_type == vwr->MT_OFDM)
@@ -1100,11 +1100,11 @@ static int parse_s1_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
         mcs_index = get_cck_rate(rec);
     else
         mcs_index = 1;
-    rflags = (m_type == vwr->MT_CCKS) ? RADIOTAP_F_SHORTPRE : 0;
+    rflags  = (m_type == vwr->MT_CCKS) ? RADIOTAP_F_SHORTPRE : 0;
     phyRate = getRate(plcp_type, mcs_index, rflags, nss);
-    /* calculate the MPDU size/ptr stuff; MPDU starts at 4 or 6 depending on OFDM/CCK */
-    /* note that the number of octets in the frame also varies depending on OFDM/CCK, */
-    /*  because the PLCP header is prepended to the actual MPDU */
+    /* Calculate the MPDU size/ptr stuff; MPDU starts at 4 or 6 depending on OFDM/CCK. */
+    /* Note that the number of octets in the frame also varies depending on OFDM/CCK,  */
+    /*  because the PLCP header is prepended to the actual MPDU.                       */
     m_ptr = &(rec[((m_type == vwr->MT_OFDM) ? 4 : 6)]);
     tmp_len = (m_type == vwr->MT_OFDM) ? 4 : 6;
     if (octets >= tmp_len)
@@ -1112,14 +1112,14 @@ static int parse_s1_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
     else
        octets = 0;
 
-    /* sanity check the octets field to determine if it is OK (or segfaults result) */
-    /* if it's greater, then truncate to actual record size */
+    /* Sanity check the octets field to determine if it is OK (or segfaults result). */
+    /* ff it's greater, then truncate to actual record size. */
     if (octets > (rec_size - 64))
         octets = (rec_size - 64);
     msdu_length = octets;
 
 
-    /* calculate start & end times (in sec/usec), converting 64-bit times to usec */
+    /* Calculate start & end times (in sec/usec), converting 64-bit times to usec. */
     /* 64-bit times are "Corey-endian" */
     s_time = pcoreytohll(&s_ptr[24]);
     e_time = pcoreytohll(&s_ptr[32]);
@@ -1128,15 +1128,15 @@ static int parse_s1_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
     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 */
+    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 from the data block*/
-    pay_off = 42;    /* 24 (MAC) + 8 (SNAP) + IP */    
+    pay_off = 42;    /* 24 (MAC) + 8 (SNAP) + IP */
     sig_off = find_signature(m_ptr, rec_size - 6, pay_off, flow_id, flow_seq);
     if ((m_ptr[sig_off] == 0xdd) && (sig_off + 15 <= (rec_size - 48)))
         sig_ts = get_signature_ts(m_ptr, sig_off);
@@ -1144,49 +1144,49 @@ static int parse_s1_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
         sig_ts = 0;
 
     /* Pack the common and er structs) */
-    r_hdr_len = STATS_COMMON_FIELDS_LEN + EXT_RTAP_FIELDS_LEN;
+    r_hdr_len        = STATS_COMMON_FIELDS_LEN + EXT_RTAP_FIELDS_LEN;
 
-    tmp_len = (msdu_length - 4) + r_hdr_len;
-    wth->phdr.len = tmp_len<=G_MAXUINT32 ? (guint32) tmp_len : 0;
-    tmp_len = (octets - 4) + r_hdr_len;
+    tmp_len          = (msdu_length - 4) + r_hdr_len;
+    wth->phdr.len    = tmp_len<=G_MAXUINT32 ? (guint32) tmp_len : 0;
+    tmp_len          = (octets - 4) + r_hdr_len;
     wth->phdr.caplen = tmp_len<=G_MAXUINT32 ? (guint32) tmp_len : 0;
 
-    wth->phdr.len = (msdu_length - 4) + r_hdr_len;
+    wth->phdr.len    = (msdu_length - 4) + r_hdr_len;
     wth->phdr.caplen = (octets - 4) + r_hdr_len;
 
     wth->phdr.presence_flags = WTAP_HAS_TS;
 
-    wth->phdr.ts.secs = (time_t)s_sec;
-    wth->phdr.ts.nsecs = (int)(s_usec * 1000);
+    wth->phdr.ts.secs   = (time_t)s_sec;
+    wth->phdr.ts.nsecs  = (int)(s_usec * 1000);
     wth->phdr.pkt_encap = WTAP_ENCAP_IXVERIWAVE;
 
     /* generate and copy out the radiotap header, set the port type to 0 (WLAN) */
-    common_fields->vw_port_type = 0;
-    common_fields->it_len = STATS_COMMON_FIELDS_LEN;
-    common_fields->vw_vcid = (guint16)vc_id;
-    common_fields->vw_flowid = (guint16)flow_id;
-    common_fields->vw_seqnum = (guint16)flow_seq;
+    common_fields->vw_port_type   = 0;
+    common_fields->it_len         = STATS_COMMON_FIELDS_LEN;
+    common_fields->vw_vcid        = (guint16)vc_id;
+    common_fields->vw_flowid      = (guint16)flow_id;
+    common_fields->vw_seqnum      = (guint16)flow_seq;
     if (!f_tx && sig_ts != 0)
         common_fields->vw_latency = (guint32)latency;
     else
         common_fields->vw_latency = 0;
-    common_fields->vw_pktdur = (guint32)d_time;
+    common_fields->vw_pktdur      = (guint32)d_time;
     common_fields->vw_msdu_length = (guint16)msdu_length;
-    common_fields->vw_sig_ts = (guint32)sig_ts;              /* 32 LSBs of signature timestamp (nsec) */
-    common_fields->vw_startt = start_time;                   /* record start & end times of frame */
-    common_fields->vw_endt = end_time;
-
-    er_fields->it_len = EXT_RTAP_FIELDS_LEN;
-    er_fields->flags = rflags;
-    er_fields->phyRate = (guint16)(phyRate * 10);
-    er_fields->plcpType = plcp_type;
-    er_fields->mcsIndex = mcs_index;
-    er_fields->nss = nss;
+    common_fields->vw_sig_ts      = (guint32)sig_ts; /* 32 LSBs of signature timestamp (nsec) */
+    common_fields->vw_startt      = start_time; /* record start & end times of frame */
+    common_fields->vw_endt        = end_time;
+
+    er_fields->it_len    = EXT_RTAP_FIELDS_LEN;
+    er_fields->flags     = rflags;
+    er_fields->phyRate   = (guint16)(phyRate * 10);
+    er_fields->plcpType  = plcp_type;
+    er_fields->mcsIndex  = mcs_index;
+    er_fields->nss       = nss;
     er_fields->chanflags = (m_type == vwr->MT_OFDM) ? CHAN_OFDM : CHAN_CCK;
-    er_fields->signal = (gint8)rssi;
-    er_fields->signalb = 100;
-    er_fields->signalc = 100;
-    er_fields->signald = 100;
+    er_fields->signal    = (gint8)rssi;
+    er_fields->signalb   = 100;
+    er_fields->signalc   = 100;
+    er_fields->signald   = 100;
 
     /* fill in the VeriWave flags field */
     er_fields->vw_flags = 0;
@@ -1216,35 +1216,37 @@ static int parse_s1_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
 static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_fields * er_fields, stats_common_fields * common_fields, int IS_TX)
 {
     vwr_t           *vwr = (vwr_t *)wth->priv;
-    register int    i;                              /* temps */
-    register        guint8  *s_start_ptr,*s_trail_ptr, *plcp_ptr, *m_ptr; /* stats & MPDU ptr */
-    guint32         msdu_length, actual_octets;        /* octets in frame */
-    guint64         tmp_len;
-    guint8          l1p_1,l1p_2, flow_seq, plcp_type, mcs_index, nss;   /* 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, s_sec, s_usec = LL_ZERO; /* start time, sec + usec */
-    guint64         end_time;                       /* end time */
-    guint16         info;                           /* INFO/ERRORS fields in stats blk */
-    guint32         errors;
-    gint16          rssi[] = {0,0,0,0};                           /* RSSI, signed 16-bit number */
-    int             f_tx;                           /* flag: if set, is a TX frame */
-    guint16         vc_id, ht_len=0;                /* VC ID , total ip length*/
-    guint32         flow_id, d_time;                /* flow ID, packet duration*/
-    guint16         r_hdr_len;                      /* length of radiotap headers */
-    int             sig_off, pay_off;               /* MAC+SNAP header len, signature offset */
-    guint64         sig_ts, tsid;                   /* 32 LSBs of timestamp in signature */
-    guint16         chanflags = 0;                  /* extended radio tap channel flags */
-    guint16         radioflags = 0;                 /* extended radio tap flags */
-    guint64         delta_b;                        /* Used for calculating latency */
-    
+
+    register int     i;                                   /* temps */
+    register guint8 *s_start_ptr,*s_trail_ptr, *plcp_ptr, *m_ptr; /* stats & MPDU ptr */
+
+    guint32          msdu_length, actual_octets;          /* octets in frame */
+    guint64          tmp_len;
+    guint8           l1p_1,l1p_2, flow_seq, plcp_type, mcs_index, nss;   /* 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, s_sec, s_usec = LL_ZERO; /* start time, sec + usec */
+    guint64          end_time;                            /* end time */
+    guint16          info;                                /* INFO/ERRORS fields in stats blk */
+    guint32          errors;
+    gint16           rssi[] = {0,0,0,0};                  /* RSSI, signed 16-bit number */
+    int              f_tx;                                /* flag: if set, is a TX frame */
+    guint16          vc_id, ht_len=0;                     /* VC ID , total ip length*/
+    guint32          flow_id, d_time;                     /* flow ID, packet duration*/
+    guint16          r_hdr_len;                           /* length of radiotap headers */
+    int              sig_off, pay_off;                    /* MAC+SNAP header len, signature offset */
+    guint64          sig_ts, tsid;                        /* 32 LSBs of timestamp in signature */
+    guint16          chanflags = 0;                       /* extended radio tap channel flags */
+    guint16          radioflags = 0;                      /* extended radio tap flags */
+    guint64          delta_b;                             /* Used for calculating latency */
+
 
     if (rec_size<48)
        rec_size = 48;
 
-    /* calculate the start of the statistics block in the buffer */
-    /* also get a bunch of fields from the stats block */
+    /* Calculate the start of the statistics block in the buffer */
+    /* Also get a bunch of fields from the stats block */
     s_start_ptr = &(rec[0]);
     s_trail_ptr = &(rec[rec_size - 48]);             /* point to it */
 
@@ -1259,7 +1261,7 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
            into the wtap header */
         msdu_length = ((s_start_ptr[4] & 0x1f) << 8) + s_start_ptr[3];
         actual_octets = msdu_length;
-        
+
         vc_id = pntohs(&s_start_ptr[6]);
         if (IS_TX)
         {
@@ -1309,10 +1311,10 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
     f_tx = IS_TX;
     flow_seq = s_trail_ptr[32];
 
-    latency = 0x00000000;                                     /* clear latency */
+    latency = 0x00000000;                        /* clear latency */
     flow_id = pntoh24(&s_trail_ptr[33]);         /* all 24 bits valid */
-    /* for tx latency is duration, for rx latency is timestamp */
-    /* get 48-bit latency value */
+    /* For tx latency is duration, for rx latency is timestamp */
+    /* Get 48-bit latency value */
     tsid = (s_trail_ptr[36 + 6] << 8) | (s_trail_ptr[36 + 7]);
 
     for (i = 0; i < 4; i++)
@@ -1339,13 +1341,13 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
         /* set the appropriate flags to indicate HT mode and CB */
         radioflags |= RADIOTAP_F_CHAN_HT | ((plcp_ptr[3] & 0x80) ? RADIOTAP_F_CHAN_40MHZ : 0) |
                       ((l1p_1 & 0x40) ? 0 : RADIOTAP_F_CHAN_SHORTGI);
-        chanflags |= CHAN_OFDM;
+        chanflags  |= CHAN_OFDM;
     }
     else if (plcp_type == vVW510021_W_PLCP_GREENFIELD) {
         /* set the appropriate flags to indicate HT mode and CB */
         radioflags |= RADIOTAP_F_CHAN_HT | ((plcp_ptr[0] & 0x80) ? RADIOTAP_F_CHAN_40MHZ : 0) |
                       ((l1p_1 & 0x40) ?  0 : RADIOTAP_F_CHAN_SHORTGI);
-        chanflags |= CHAN_OFDM;
+        chanflags  |= CHAN_OFDM;
     }
     else if (plcp_type == vVW510021_W_PLCP_VHT_MIXED) {
         guint8 SBW = l1p_2 >> 4 & 0xf;
@@ -1356,12 +1358,12 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
         else if (SBW == 4)
             radioflags |= RADIOTAP_F_CHAN_80MHZ;
     }
-    
+
     if (msdu_length > (guint32)(rec_size - 48)) {
         msdu_length = (guint32)(rec_size - 48);
     }
 
-    /* calculate start & end times (in sec/usec), converting 64-bit times to usec */
+    /* 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[0]);
     e_time = pcoreytohll(&s_trail_ptr[8]);
@@ -1401,12 +1403,12 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
           }
     }
 
-    /* fill up the per-packet header (amazingly like a PCAP packet header! ;-) */
-    /* frames are always 802.11, with an extended radiotap header */
+    /* Fill up the per-packet header (amazingly like a PCAP packet header! ;-)          */
+    /* Frames are always 802.11, with an extended radiotap header.                      */
     /* caplen is the length that is captured into the file (i.e., the written-out frame */
-    /* block), and should always represent the actual number of bytes in the file */
-    /* len is the length of the original packet before truncation */
-    /* the FCS is NOT included */
+    /*  block), and should always represent the actual number of bytes in the file.     */
+    /* len is the length of the original packet before truncation.                      */
+    /* The FCS is NOT included.                                                         */
     r_hdr_len = STATS_COMMON_FIELDS_LEN + EXT_RTAP_FIELDS_LEN;
     tmp_len = (actual_octets - 4) + r_hdr_len;
     wth->phdr.len = tmp_len<=G_MAXUINT32 ? (guint32) tmp_len : 0;
@@ -1415,43 +1417,43 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
 
     wth->phdr.presence_flags = WTAP_HAS_TS;
 
-    wth->phdr.ts.secs = (time_t)s_sec;
-    wth->phdr.ts.nsecs = (int)(s_usec * 1000);
+    wth->phdr.ts.secs   = (time_t)s_sec;
+    wth->phdr.ts.nsecs  = (int)(s_usec * 1000);
     wth->phdr.pkt_encap = WTAP_ENCAP_IXVERIWAVE;
 
     /* generate and copy out the radiotap header, set the port type to 0 (WLAN) */
-    common_fields->vw_port_type = 0;
-    common_fields->it_len = STATS_COMMON_FIELDS_LEN;
-    common_fields->vw_vcid = (guint16)vc_id;
+    common_fields->vw_port_type   = 0;
+    common_fields->it_len         = STATS_COMMON_FIELDS_LEN;
+    common_fields->vw_vcid        = (guint16)vc_id;
     common_fields->vw_msdu_length = (guint16)msdu_length;
-    common_fields->vw_flowid = (guint32)flow_id;
-    common_fields->vw_seqnum = (guint16)flow_seq;
+    common_fields->vw_flowid      = (guint32)flow_id;
+    common_fields->vw_seqnum      = (guint16)flow_seq;
     if (!f_tx && (sig_ts != 0) )
         common_fields->vw_latency = (guint32)latency;
     else
         common_fields->vw_latency = 0;
-    common_fields->vw_pktdur = (guint32)d_time;
-    common_fields->vw_startt = start_time;                   /* record start & end times of frame */
-    common_fields->vw_endt = end_time;
-    common_fields->vw_sig_ts = (guint32)(sig_ts);/* 32 LSBs of signature  */
+    common_fields->vw_pktdur      = (guint32)d_time;
+    common_fields->vw_startt      = start_time; /* record start & end times of frame */
+    common_fields->vw_endt        = end_time;
+    common_fields->vw_sig_ts      = (guint32)(sig_ts); /* 32 LSBs of signature  */
 
-    er_fields->it_len = EXT_RTAP_FIELDS_LEN;
-    er_fields->flags = radioflags;
+    er_fields->it_len    = EXT_RTAP_FIELDS_LEN;
+    er_fields->flags     = radioflags;
     if (info & vVW510021_W_IS_WEP)
         er_fields->flags |= RADIOTAP_F_WEP;
     if ((l1p_1 & vVW510021_W_PREAMBLE_MASK) != vVW510021_W_IS_LONGPREAMBLE && (plcp_type == vVW510021_W_PLCP_LEGACY))
         er_fields->flags |= RADIOTAP_F_SHORTPRE;
-    er_fields->phyRate = (guint16)(getRate(plcp_type, mcs_index, er_fields->flags, nss) * 10);
-    er_fields->plcpType = plcp_type;
-    er_fields->mcsIndex = mcs_index;
-    er_fields->nss = nss;
-    er_fields->chanflags = chanflags;     
-    er_fields->signal = (gint8)rssi[0];
-    er_fields->signalb = (gint8)rssi[1];
-    er_fields->signalc = (gint8)rssi[2];
-    er_fields->signald = (gint8)rssi[3];
+    er_fields->phyRate   = (guint16)(getRate(plcp_type, mcs_index, er_fields->flags, nss) * 10);
+    er_fields->plcpType  = plcp_type;
+    er_fields->mcsIndex  = mcs_index;
+    er_fields->nss       = nss;
+    er_fields->chanflags = chanflags;
+    er_fields->signal    = (gint8)rssi[0];
+    er_fields->signalb   = (gint8)rssi[1];
+    er_fields->signalc   = (gint8)rssi[2];
+    er_fields->signald   = (gint8)rssi[3];
     /* fill in the VeriWave flags field */
-    er_fields->vw_flags = 0;
+    er_fields->vw_flags  = 0;
     if (f_tx)
         er_fields->vw_flags |= RADIOTAP_VWF_TXF;
     if (errors & 0x1f)  /* If any error is flagged, then set the FCS error bit */
@@ -1467,66 +1469,67 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
     else if (info & vwr->CCMPTYPE)
         er_fields->vw_flags |= RADIOTAP_VWF_IS_CCMP;
 
-    er_fields->vw_errors = (guint32)errors;
+    er_fields->vw_errors    = (guint32)errors;
     er_fields->vw_ht_length = (guint16)ht_len;
-    er_fields->vw_info = (guint16)info;
+    er_fields->vw_info      = (guint16)info;
 
     /* return the offset to the actual frame data */
-    /* calculate the MPDU size/ptr stuff; MPDU starts at 4 or 6 depending on OFDM/CCK */
-    /* note that the number of octets in the frame also varies depending on OFDM/CCK, */
-    /*  because the PLCP header is prepended to the actual MPDU */
-    /*the 8 is from the 8 bytes of stats block that precede the plcps , 
-    the 12 is for 11 bytes plcp and 1 byte of pad before the data*/
+    /* Calculate the MPDU size/ptr stuff; MPDU starts at 4 or 6 depending on OFDM/CCK. */
+    /* Note that the number of octets in the frame also varies depending on OFDM/CCK   */
+    /*  because the PLCP header is prepended to the actual MPDU.                       */
+    /* The 8 is from the 8 bytes of stats block that precede the plcps;                */
+    /* the 12 is for 11 bytes plcp and 1 byte of pad before the data.                  */
 
     return vwr->MPDU_OFF;
 }
 
 /* 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 */
+/* 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 void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec, int rec_size, int IS_TX)
 {
     vwr_t           *vwr = (vwr_t *)wth->priv;
-    int             bytes_written = 0;              /* bytes output to buf so far */
-    register int    i;                              /* temps */
-    register guint8 *s_ptr, *m_ptr;                 /* stats and MPDU pointers */
-    guint16         msdu_length,actual_octets;      /* octets in frame */
-    guint8          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 */
-    guint16         l4id, 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 */
-    stats_ethernettap_fields    etap_hdr;           /* VWR ethernettap header */
-    stats_common_fields common_hdr;                 /* VWR common header */
-    guint16         e_hdr_len;                      /* length of ethernettap headers */
-    int             mac_len, sig_off, pay_off;      /* MAC header len, signature offset */
-    guint64         sig_ts, tsid;                   /* 32 LSBs of timestamp in signature */
-    guint64         delta_b;    /* Used for calculating latency */
-
-    /* calculate the start of the statistics block in the buffer */
-    /* also get a bunch of fields from the stats block */
+    int              bytes_written = 0;                   /* bytes output to buf so far */
+    register int     i;                                   /* temps */
+    register guint8 *s_ptr, *m_ptr;                       /* stats and MPDU pointers */
+    guint16          msdu_length,actual_octets;           /* octets in frame */
+    guint8           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 */
+    guint16          l4id, 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 */
+    guint16          e_hdr_len;                           /* length of ethernettap headers */
+    int              mac_len, sig_off, pay_off;           /* MAC header len, signature offset */
+    guint64          sig_ts, tsid;                        /* 32 LSBs of timestamp in signature */
+    guint64          delta_b;                             /* Used for calculating latency */
+
+    stats_ethernettap_fields etap_hdr;                    /* VWR ethernettap header */
+    stats_common_fields      common_hdr;                  /* VWR common header */
+
+    /* 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 = pntohs(&s_ptr[vwr->OCTET_OFF]);
     actual_octets = msdu_length;
-    /* sanity check the msdu_length field to determine if it is OK (or segfaults result) */
-    /* if it's greater, then truncate to the indicated message length */
+    /* Sanity check the msdu_length field to determine if it is OK (or segfaults result). */
+    /* If it's greater, then truncate to the indicated message length.                    */
     if (msdu_length > (rec_size - (int)vwr->STATS_LEN)) {
         msdu_length = (rec_size - (int)vwr->STATS_LEN);
     }
 
     vc_id = pntohs(&s_ptr[vwr->VCID_OFF]) & vwr->VCID_MASK;
-    flow_seq = s_ptr[vwr->FLOWSEQ_OFF];
+    flow_seq   = s_ptr[vwr->FLOWSEQ_OFF];
     frame_type = pntohl(&s_ptr[vwr->FRAME_TYPE_OFF]);
 
     if (vwr->FPGA_VERSION == vVW510024_E_FPGA) {
@@ -1539,11 +1542,11 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
         errors = pntohs(&s_ptr[vwr->ERRORS_OFF]);
     }
     else {
-        f_flow = s_ptr[vwr->VALID_OFF] & vwr->FLOW_VALID;
+        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)*/
+        /* for older fpga errors is only represented by 16 bits) */
         errors = pntohs(&s_ptr[vwr->ERRORS_OFF]);
     }
 
@@ -1551,8 +1554,8 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
     /*  24 LSBs */
     flow_id = pntoh24(&s_ptr[vwr->FLOWID_OFF]);
 
-    /* for tx latency is duration, for rx latency is timestamp */
-    /* get 64-bit latency value */
+    /* For tx latency is duration, for rx latency is timestamp. */
+    /* Get 64-bit latency value. */
     tsid = (s_ptr[vwr->LATVAL_OFF + 6] << 8) | (s_ptr[vwr->LATVAL_OFF + 7]);
     for (i = 0; i < 4; i++)
         tsid = (tsid << 8) | s_ptr[vwr->LATVAL_OFF + i];
@@ -1560,8 +1563,8 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
 
     l4id = pntohs(&s_ptr[vwr->L4ID_OFF]);
 
-    /* calculate start & end times (in sec/usec), converting 64-bit times to usec */
-    /* 64-bit times are "Corey-endian" */
+    /* Calculate start & end times (in sec/usec), converting 64-bit times to usec. */
+    /* 64-bit times are "Corey-endian"                                             */
     s_time = pcoreytohll(&s_ptr[vwr->STARTT_OFF]);
     e_time = pcoreytohll(&s_ptr[vwr->ENDT_OFF]);
 
@@ -1609,7 +1612,7 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
             latency = (guint32)(s_time - sig_ts);
         } 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. */
+            /*  we look for a large difference between l_time and s_time.                       */
             delta_b = sig_ts - s_time;
             if (delta_b >  0x10000000) {
                 latency = 0;
@@ -1617,34 +1620,34 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
                 latency = (guint32)delta_b;
         }
     }
-    /* fill up the per-packet header (amazingly like a PCAP packet header! ;-) */
-    /* frames are always wired ethernet with a wired ethernettap header */
-    /* caplen is the length that is captured into the file (i.e., the written-out frame */
-    /* block), and should always represent the actual number of bytes in the file */
-    /* len is the length of the original packet before truncation*/
-    /* the FCS is NEVER included */
+    /* Fill up the per-packet header (amazingly like a PCAP packet header! ;-)          */
+    /* Frames are always wired ethernet with a wired ethernettap header.                */
+    /* Caplen is the length that is captured into the file (i.e., the written-out frame */
+    /*  block), and should always represent the actual number of bytes in the file.     */
+    /* len is the length of the original packet before truncation.                      */
+    /* The FCS is NEVER included.                                                       */
     e_hdr_len = STATS_COMMON_FIELDS_LEN + STATS_ETHERNETTAP_FIELDS_LEN;
-    wth->phdr.len = (actual_octets - 4) + e_hdr_len;
+    wth->phdr.len    = (actual_octets - 4) + e_hdr_len;
     wth->phdr.caplen = (msdu_length - 4) + e_hdr_len;
 
     wth->phdr.presence_flags = WTAP_HAS_TS;
 
-    wth->phdr.ts.secs = (time_t)s_sec;
-    wth->phdr.ts.nsecs = (int)(s_usec * 1000);
+    wth->phdr.ts.secs   = (time_t)s_sec;
+    wth->phdr.ts.nsecs  = (int)(s_usec * 1000);
     wth->phdr.pkt_encap = WTAP_ENCAP_IXVERIWAVE;
 
     /* generate and copy out the ETHERNETTAP header, set the port type to 1 (Ethernet) */
     common_hdr.vw_port_type = 1;
-    common_hdr.it_len = STATS_COMMON_FIELDS_LEN;
+    common_hdr.it_len       = STATS_COMMON_FIELDS_LEN;
     etap_hdr.it_len = STATS_ETHERNETTAP_FIELDS_LEN;
 
     etap_hdr.vw_errors = (guint32)errors;
-    etap_hdr.vw_info = (guint16)info;
+    etap_hdr.vw_info   = (guint16)info;
     common_hdr.vw_msdu_length = (guint16)msdu_length;
     /*etap_hdr.vw_ip_length = (guint16)ip_len;*/
 
     common_hdr.vw_flowid = (guint32)flow_id;
-    common_hdr.vw_vcid = (guint16)vc_id;
+    common_hdr.vw_vcid   = (guint16)vc_id;
     common_hdr.vw_seqnum = (guint16)flow_seq;
 
     if (!IS_TX && (sig_ts != 0))
@@ -1652,14 +1655,14 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
     else
         common_hdr.vw_latency = 0;
     common_hdr.vw_pktdur = (guint32)d_time;
-    etap_hdr.vw_l4id = (guint32)l4id;
+    etap_hdr.vw_l4id  = (guint32)l4id;
     etap_hdr.vw_flags = 0;
     if (IS_TX)
         etap_hdr.vw_flags |= RADIOTAP_VWF_TXF;
     if (errors & vwr->FCS_ERROR)
         etap_hdr.vw_flags |= RADIOTAP_VWF_FCSERR;
     common_hdr.vw_startt = start_time;                  /* record start & end times of frame */
-    common_hdr.vw_endt = end_time;
+    common_hdr.vw_endt   = end_time;
     common_hdr.vw_sig_ts = (guint32)(sig_ts);
 
     etap_hdr.it_pad2 = 0;
@@ -1704,7 +1707,7 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
     bytes_written += 4;
 
     /* finally, copy the whole MAC frame to the packet bufffer as-is; ALWAYS exclude 4-byte FCS */
-    if ( rec_size < ((int)actual_octets + (int)vwr->STATS_LEN) ) 
+    if ( rec_size < ((int)actual_octets + (int)vwr->STATS_LEN) )
         /*something's been truncated, DUMP AS-IS*/
         memcpy(&data_ptr[bytes_written], m_ptr, msdu_length);
     else if (msdu_length >= 4)
@@ -1739,18 +1742,18 @@ static int decode_msg(vwr_t *vwr, guint8 *rec, int *v_type, int *IS_TX)
     switch (cmd) {
         case 0x21:
         case 0x31:
-            v_size = (int)(wd2 & 0xffff);
+            v_size  = (int)(wd2 & 0xffff);
             *v_type = VT_FRAME;
             break;
 
         case 0xc1:
         case 0x8b:
-            v_size = (int)(wd2 & 0xffff);
+            v_size  = (int)(wd2 & 0xffff);
             *v_type = VT_CPMSG;
             break;
 
         case 0xfe:
-            v_size = (int)(wd3 & 0xffff);
+            v_size  = (int)(wd3 & 0xffff);
             *v_type = VT_CPMSG;
             break;
 
@@ -1758,29 +1761,29 @@ static int decode_msg(vwr_t *vwr, guint8 *rec, int *v_type, int *IS_TX)
             break;
     }
 
-    return(v_size);
+    return v_size;
 }
 
 
-/*--------------------------------------------------------------------------------------*/
-/* utilities to extract and decode the PHY bit rate from 802.11 PLCP headers (OFDM/CCK) */
-/* they are passed a pointer to 4 or 6 consecutive bytes of PLCP header */
-/* the integer returned by the get_xxx_rate() functions is in units of 0.5 Mb/s */
-/* The string returned by the decode_xxx_rate() functions is 3 characters wide */
+/*---------------------------------------------------------------------------------------*/
+/* Utilities to extract and decode the PHY bit rate from 802.11 PLCP headers (OFDM/CCK). */
+/* They are passed a pointer to 4 or 6 consecutive bytes of PLCP header.                 */
+/* The integer returned by the get_xxx_rate() functions is in units of 0.5 Mb/s.         */
+/* The string returned by the decode_xxx_rate() functions is 3 characters wide.          */
 
 static guint8 get_ofdm_rate(guint8 *plcp)
 {
     /* extract the RATE field (LS nibble of first byte) then convert it to the MCS index used by the L1p fields */
     switch (plcp[0] & 0x0f) {
-        case 0x0b:  return 4;
-        case 0x0f:  return 5;
-        case 0x0a:  return 6;
-        case 0x0e:  return 7;
-        case 0x09:  return 8;
-        case 0x0d:  return 9;
+        case 0x0b:  return  4;
+        case 0x0f:  return  5;
+        case 0x0a:  return  6;
+        case 0x0e:  return  7;
+        case 0x09:  return  8;
+        case 0x0d:  return  9;
         case 0x08:  return 10;
         case 0x0c:  return 11;
-        default:    return(0);
+        default:    return  0;
     }
 }
 
@@ -1804,235 +1807,235 @@ static void setup_defaults(vwr_t *vwr, guint16 fpga)
     switch (fpga) {
         /* WLAN frames */
         case S2_W_FPGA:
-            vwr->STATS_LEN = vVW510021_W_STATS_LEN;
-
-            vwr->VALID_OFF = vVW510021_W_VALID_OFF;
-            vwr->MTYPE_OFF = vVW510021_W_MTYPE_OFF;
-            vwr->VCID_OFF = vVW510021_W_VCID_OFF;
-            vwr->FLOWSEQ_OFF = vVW510021_W_FLOWSEQ_OFF;
-            vwr->FLOWID_OFF = vVW510021_W_FLOWID_OFF;
-
-            /*vwr->OCTET_OFF = v22_W_OCTET_OFF;*/
-
-            vwr->ERRORS_OFF = vVW510021_W_ERRORS_OFF;
-            vwr->PATN_OFF = vVW510021_W_MATCH_OFF;
-            vwr->RSSI_OFF = vVW510021_W_RSSI_TXPOWER_OFF;
-            vwr->STARTT_OFF = vVW510021_W_STARTT_OFF;
-            vwr->ENDT_OFF = vVW510021_W_ENDT_OFF;
-            vwr->LATVAL_OFF = vVW510021_W_LATVAL_OFF;
-            vwr->INFO_OFF = vVW510021_W_INFO_OFF;
-            vwr->FPGA_VERSION_OFF = S2_W_FPGA_VERSION_OFF;
+            vwr->STATS_LEN          = vVW510021_W_STATS_LEN;
+
+            vwr->VALID_OFF          = vVW510021_W_VALID_OFF;
+            vwr->MTYPE_OFF          = vVW510021_W_MTYPE_OFF;
+            vwr->VCID_OFF           = vVW510021_W_VCID_OFF;
+            vwr->FLOWSEQ_OFF        = vVW510021_W_FLOWSEQ_OFF;
+            vwr->FLOWID_OFF         = vVW510021_W_FLOWID_OFF;
+
+            /*vwr->OCTET_OFF        = v22_W_OCTET_OFF;*/
+
+            vwr->ERRORS_OFF         = vVW510021_W_ERRORS_OFF;
+            vwr->PATN_OFF           = vVW510021_W_MATCH_OFF;
+            vwr->RSSI_OFF           = vVW510021_W_RSSI_TXPOWER_OFF;
+            vwr->STARTT_OFF         = vVW510021_W_STARTT_OFF;
+            vwr->ENDT_OFF           = vVW510021_W_ENDT_OFF;
+            vwr->LATVAL_OFF         = vVW510021_W_LATVAL_OFF;
+            vwr->INFO_OFF           = vVW510021_W_INFO_OFF;
+            vwr->FPGA_VERSION_OFF   = S2_W_FPGA_VERSION_OFF;
             vwr->HEADER_VERSION_OFF = vVW510021_W_HEADER_VERSION_OFF;
-            vwr->OCTET_OFF = vVW510021_W_MSDU_LENGTH_OFF;
-            vwr->L1P_1_OFF = vVW510021_W_L1P_1_OFF;
-            vwr->L1P_2_OFF = vVW510021_W_L1P_2_OFF;
-            vwr->L4ID_OFF = vVW510021_W_L4ID_OFF;
-            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;
-            vwr->FCS_ERROR = vVW510021_W_FCS_ERROR;
-            vwr->CRYPTO_ERR = v22_W_CRYPTO_ERR;
-            vwr->RETRY_ERR = v22_W_RETRY_ERR;
-
-            /*vwr->STATS_START_OFF = 0;*/
-
-            vwr->RXTX_OFF = vVW510021_W_RXTX_OFF;
-
-            vwr->MT_10_HALF = 0;
-            vwr->MT_10_FULL = 0;
-            vwr->MT_100_HALF = 0;
-            vwr->MT_100_FULL = 0;
-            vwr->MT_1G_HALF = 0;
-            vwr->MT_1G_FULL = 0;
-            vwr->MT_CCKL = v22_W_MT_CCKL;
-            vwr->MT_CCKS = v22_W_MT_CCKS;
-            /*vwr->MT_OFDM = vVW510021_W_MT_OFDM;*/
-
-            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;
-            vwr->IS_UDP      =   vVW510021_W_IS_UDP;
-            vwr->IS_ICMP     =   vVW510021_W_IS_ICMP;
-            vwr->IS_IGMP     =   vVW510021_W_IS_IGMP;
-            vwr->IS_QOS      =   vVW510021_W_QOS_VALID;
-
-            vwr->MPDU_OFF = 20;
+            vwr->OCTET_OFF          = vVW510021_W_MSDU_LENGTH_OFF;
+            vwr->L1P_1_OFF          = vVW510021_W_L1P_1_OFF;
+            vwr->L1P_2_OFF          = vVW510021_W_L1P_2_OFF;
+            vwr->L4ID_OFF           = vVW510021_W_L4ID_OFF;
+            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;
+            vwr->FCS_ERROR          = vVW510021_W_FCS_ERROR;
+            vwr->CRYPTO_ERR         = v22_W_CRYPTO_ERR;
+            vwr->RETRY_ERR          = v22_W_RETRY_ERR;
+
+            /*vwr->STATS_START_OFF  = 0;*/
+
+            vwr->RXTX_OFF           = vVW510021_W_RXTX_OFF;
+
+            vwr->MT_10_HALF         = 0;
+            vwr->MT_10_FULL         = 0;
+            vwr->MT_100_HALF        = 0;
+            vwr->MT_100_FULL        = 0;
+            vwr->MT_1G_HALF         = 0;
+            vwr->MT_1G_FULL         = 0;
+            vwr->MT_CCKL            = v22_W_MT_CCKL;
+            vwr->MT_CCKS            = v22_W_MT_CCKS;
+            /*vwr->MT_OFDM          = vVW510021_W_MT_OFDM;*/
+
+            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;
+            vwr->IS_UDP             =   vVW510021_W_IS_UDP;
+            vwr->IS_ICMP            =   vVW510021_W_IS_ICMP;
+            vwr->IS_IGMP            =   vVW510021_W_IS_IGMP;
+            vwr->IS_QOS             =   vVW510021_W_QOS_VALID;
+
+            vwr->MPDU_OFF           = 20;
 
             break;
 
         case S3_W_FPGA:
-            vwr->STATS_LEN = STATS_COMMON_FIELDS_LEN + EXT_RTAP_FIELDS_LEN;
+            vwr->STATS_LEN       = STATS_COMMON_FIELDS_LEN + EXT_RTAP_FIELDS_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->MPDU_OFF = 32;
+            vwr->HEADER_IS_RX    = vVW510021_W_HEADER_IS_RX;
+            vwr->HEADER_IS_TX    = vVW510021_W_HEADER_IS_TX;
+            vwr->MPDU_OFF        = 32;
 
             break;
 
         case vVW510012_E_FPGA:
-            vwr->STATS_LEN = v22_E_STATS_LEN;
-
-            vwr->VALID_OFF = v22_E_VALID_OFF;
-            vwr->MTYPE_OFF = v22_E_MTYPE_OFF;
-            vwr->VCID_OFF = v22_E_VCID_OFF;
-            vwr->FLOWSEQ_OFF = v22_E_FLOWSEQ_OFF;
-            vwr->FLOWID_OFF = v22_E_FLOWID_OFF;
-            vwr->OCTET_OFF = v22_E_OCTET_OFF;
-            vwr->ERRORS_OFF = v22_E_ERRORS_OFF;
-            vwr->PATN_OFF = v22_E_PATN_OFF;
-            vwr->RSSI_OFF = v22_E_RSSI_OFF;
-            vwr->STARTT_OFF = v22_E_STARTT_OFF;
-            vwr->ENDT_OFF = v22_E_ENDT_OFF;
-            vwr->LATVAL_OFF = v22_E_LATVAL_OFF;
-            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;
-            vwr->FLOW_VALID = v22_E_FLOW_VALID;
-            vwr->FCS_ERROR = v22_E_FCS_ERROR;
-
-            vwr->RX_DECRYPTS = v22_E_RX_DECRYPTS;
-            vwr->TX_DECRYPTS = v22_E_TX_DECRYPTS;
-            vwr->FC_PROT_BIT = v22_E_FC_PROT_BIT;
-
-            vwr->MT_10_HALF = v22_E_MT_10_HALF;
-            vwr->MT_10_FULL = v22_E_MT_10_FULL;
-            vwr->MT_100_HALF = v22_E_MT_100_HALF;
-            vwr->MT_100_FULL = v22_E_MT_100_FULL;
-            vwr->MT_1G_HALF = v22_E_MT_1G_HALF;
-            vwr->MT_1G_FULL = v22_E_MT_1G_FULL;
-            vwr->MT_CCKL = 0;
-            vwr->MT_CCKS = 0;
-            vwr->MT_OFDM = 0;
+            vwr->STATS_LEN      = v22_E_STATS_LEN;
+
+            vwr->VALID_OFF      = v22_E_VALID_OFF;
+            vwr->MTYPE_OFF      = v22_E_MTYPE_OFF;
+            vwr->VCID_OFF       = v22_E_VCID_OFF;
+            vwr->FLOWSEQ_OFF    = v22_E_FLOWSEQ_OFF;
+            vwr->FLOWID_OFF     = v22_E_FLOWID_OFF;
+            vwr->OCTET_OFF      = v22_E_OCTET_OFF;
+            vwr->ERRORS_OFF     = v22_E_ERRORS_OFF;
+            vwr->PATN_OFF       = v22_E_PATN_OFF;
+            vwr->RSSI_OFF       = v22_E_RSSI_OFF;
+            vwr->STARTT_OFF     = v22_E_STARTT_OFF;
+            vwr->ENDT_OFF       = v22_E_ENDT_OFF;
+            vwr->LATVAL_OFF     = v22_E_LATVAL_OFF;
+            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;
+            vwr->FLOW_VALID     = v22_E_FLOW_VALID;
+            vwr->FCS_ERROR      = v22_E_FCS_ERROR;
+
+            vwr->RX_DECRYPTS    = v22_E_RX_DECRYPTS;
+            vwr->TX_DECRYPTS    = v22_E_TX_DECRYPTS;
+            vwr->FC_PROT_BIT    = v22_E_FC_PROT_BIT;
+
+            vwr->MT_10_HALF     = v22_E_MT_10_HALF;
+            vwr->MT_10_FULL     = v22_E_MT_10_FULL;
+            vwr->MT_100_HALF    = v22_E_MT_100_HALF;
+            vwr->MT_100_FULL    = v22_E_MT_100_FULL;
+            vwr->MT_1G_HALF     = v22_E_MT_1G_HALF;
+            vwr->MT_1G_FULL     = v22_E_MT_1G_FULL;
+            vwr->MT_CCKL        = 0;
+            vwr->MT_CCKS        = 0;
+            vwr->MT_OFDM        = 0;
 
             vwr->FRAME_TYPE_OFF =  v22_E_FRAME_TYPE_OFF;
-            vwr->IS_TCP      =   v22_E_IS_TCP;
-            vwr->IS_UDP      =   v22_E_IS_UDP;
-            vwr->IS_ICMP     =   v22_E_IS_ICMP;
-            vwr->IS_IGMP     =   v22_E_IS_IGMP;
-            vwr->IS_QOS      =   v22_E_IS_QOS;
-            vwr->IS_VLAN     =   v22_E_IS_VLAN;
+            vwr->IS_TCP         =   v22_E_IS_TCP;
+            vwr->IS_UDP         =   v22_E_IS_UDP;
+            vwr->IS_ICMP        =   v22_E_IS_ICMP;
+            vwr->IS_IGMP        =   v22_E_IS_IGMP;
+            vwr->IS_QOS         =   v22_E_IS_QOS;
+            vwr->IS_VLAN        =   v22_E_IS_VLAN;
 
             break;
 
             /* WLAN frames */
         case S1_W_FPGA:
-            vwr->STATS_LEN = v22_W_STATS_LEN;
-
-            vwr->MTYPE_OFF = v22_W_MTYPE_OFF;
-            vwr->VALID_OFF = v22_W_VALID_OFF;
-            vwr->VCID_OFF = v22_W_VCID_OFF;
-            vwr->FLOWSEQ_OFF = v22_W_FLOWSEQ_OFF;
-            vwr->FLOWID_OFF = v22_W_FLOWID_OFF;
-            vwr->OCTET_OFF = v22_W_OCTET_OFF;
-            vwr->ERRORS_OFF = v22_W_ERRORS_OFF;
-            vwr->PATN_OFF = v22_W_PATN_OFF;
-            vwr->RSSI_OFF = v22_W_RSSI_OFF;
-            vwr->STARTT_OFF = v22_W_STARTT_OFF;
-            vwr->ENDT_OFF = v22_W_ENDT_OFF;
-            vwr->LATVAL_OFF = v22_W_LATVAL_OFF;
-            vwr->INFO_OFF = v22_W_INFO_OFF;
-            vwr->L4ID_OFF = v22_W_L4ID_OFF;
-            vwr->IPLEN_OFF = v22_W_IPLEN_OFF;
-            vwr->PLCP_LENGTH_OFF = v22_W_PLCP_LENGTH_OFF;
-
-            vwr->FCS_ERROR = v22_W_FCS_ERROR;
-            vwr->CRYPTO_ERR = v22_W_CRYPTO_ERR;
-            vwr->PAYCHK_ERR = v22_W_PAYCHK_ERR;
-            vwr->RETRY_ERR = v22_W_RETRY_ERR;
-            vwr->IS_RX = v22_W_IS_RX;
-            vwr->MT_MASK = v22_W_MT_MASK;
-            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;
-
-            vwr->MT_10_HALF = 0;
-            vwr->MT_10_FULL = 0;
-            vwr->MT_100_HALF = 0;
-            vwr->MT_100_FULL = 0;
-            vwr->MT_1G_HALF = 0;
-            vwr->MT_1G_FULL = 0;
-            vwr->MT_CCKL = v22_W_MT_CCKL;
-            vwr->MT_CCKS = v22_W_MT_CCKS;
-            vwr->MT_OFDM = v22_W_MT_OFDM;
-
-            vwr->WEPTYPE = v22_W_WEPTYPE;
-            vwr->TKIPTYPE = v22_W_TKIPTYPE;
-            vwr->CCMPTYPE = v22_W_CCMPTYPE;
-
-            vwr->FRAME_TYPE_OFF =   v22_W_FRAME_TYPE_OFF;
-            vwr->IS_TCP      =   v22_W_IS_TCP;
-            vwr->IS_UDP      =   v22_W_IS_UDP;
-            vwr->IS_ICMP     =   v22_W_IS_ICMP;
-            vwr->IS_IGMP     =   v22_W_IS_IGMP;
-            vwr->IS_QOS      =   v22_W_IS_QOS;
+            vwr->STATS_LEN          = v22_W_STATS_LEN;
+
+            vwr->MTYPE_OFF          = v22_W_MTYPE_OFF;
+            vwr->VALID_OFF          = v22_W_VALID_OFF;
+            vwr->VCID_OFF           = v22_W_VCID_OFF;
+            vwr->FLOWSEQ_OFF        = v22_W_FLOWSEQ_OFF;
+            vwr->FLOWID_OFF         = v22_W_FLOWID_OFF;
+            vwr->OCTET_OFF          = v22_W_OCTET_OFF;
+            vwr->ERRORS_OFF         = v22_W_ERRORS_OFF;
+            vwr->PATN_OFF           = v22_W_PATN_OFF;
+            vwr->RSSI_OFF           = v22_W_RSSI_OFF;
+            vwr->STARTT_OFF         = v22_W_STARTT_OFF;
+            vwr->ENDT_OFF           = v22_W_ENDT_OFF;
+            vwr->LATVAL_OFF         = v22_W_LATVAL_OFF;
+            vwr->INFO_OFF           = v22_W_INFO_OFF;
+            vwr->L4ID_OFF           = v22_W_L4ID_OFF;
+            vwr->IPLEN_OFF          = v22_W_IPLEN_OFF;
+            vwr->PLCP_LENGTH_OFF    = v22_W_PLCP_LENGTH_OFF;
+
+            vwr->FCS_ERROR          = v22_W_FCS_ERROR;
+            vwr->CRYPTO_ERR         = v22_W_CRYPTO_ERR;
+            vwr->PAYCHK_ERR         = v22_W_PAYCHK_ERR;
+            vwr->RETRY_ERR          = v22_W_RETRY_ERR;
+            vwr->IS_RX              = v22_W_IS_RX;
+            vwr->MT_MASK            = v22_W_MT_MASK;
+            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;
+
+            vwr->MT_10_HALF         = 0;
+            vwr->MT_10_FULL         = 0;
+            vwr->MT_100_HALF        = 0;
+            vwr->MT_100_FULL        = 0;
+            vwr->MT_1G_HALF         = 0;
+            vwr->MT_1G_FULL         = 0;
+            vwr->MT_CCKL            = v22_W_MT_CCKL;
+            vwr->MT_CCKS            = v22_W_MT_CCKS;
+            vwr->MT_OFDM            = v22_W_MT_OFDM;
+
+            vwr->WEPTYPE            = v22_W_WEPTYPE;
+            vwr->TKIPTYPE           = v22_W_TKIPTYPE;
+            vwr->CCMPTYPE           = v22_W_CCMPTYPE;
+
+            vwr->FRAME_TYPE_OFF     =   v22_W_FRAME_TYPE_OFF;
+            vwr->IS_TCP             =   v22_W_IS_TCP;
+            vwr->IS_UDP             =   v22_W_IS_UDP;
+            vwr->IS_ICMP            =   v22_W_IS_ICMP;
+            vwr->IS_IGMP            =   v22_W_IS_IGMP;
+            vwr->IS_QOS             =   v22_W_IS_QOS;
 
             break;
 
         /* Ethernet frames */
         case vVW510024_E_FPGA:
-            vwr->STATS_LEN = vVW510024_E_STATS_LEN;
-
-            vwr->VALID_OFF = vVW510024_E_VALID_OFF;
-            vwr->VCID_OFF = vVW510024_E_VCID_OFF;
-            vwr->FLOWSEQ_OFF = vVW510024_E_FLOWSEQ_OFF;
-            vwr->FLOWID_OFF = vVW510024_E_FLOWID_OFF;
-            vwr->OCTET_OFF = vVW510024_E_MSDU_LENGTH_OFF;
-            vwr->ERRORS_OFF = vVW510024_E_ERRORS_OFF;
-            vwr->PATN_OFF = vVW510024_E_MATCH_OFF;
-            vwr->STARTT_OFF = vVW510024_E_STARTT_OFF;
-            vwr->ENDT_OFF = vVW510024_E_ENDT_OFF;
-            vwr->LATVAL_OFF = vVW510024_E_LATVAL_OFF;
-            vwr->INFO_OFF = vVW510024_E_INFO_OFF;
-            vwr->L4ID_OFF = vVW510024_E_L4ID_OFF;
-            vwr->IPLEN_OFF = vVW510024_E_IPLEN_OFF;
-
-            vwr->FPGA_VERSION_OFF = vVW510024_E_FPGA_VERSION_OFF;
+            vwr->STATS_LEN          = vVW510024_E_STATS_LEN;
+
+            vwr->VALID_OFF          = vVW510024_E_VALID_OFF;
+            vwr->VCID_OFF           = vVW510024_E_VCID_OFF;
+            vwr->FLOWSEQ_OFF        = vVW510024_E_FLOWSEQ_OFF;
+            vwr->FLOWID_OFF         = vVW510024_E_FLOWID_OFF;
+            vwr->OCTET_OFF          = vVW510024_E_MSDU_LENGTH_OFF;
+            vwr->ERRORS_OFF         = vVW510024_E_ERRORS_OFF;
+            vwr->PATN_OFF           = vVW510024_E_MATCH_OFF;
+            vwr->STARTT_OFF         = vVW510024_E_STARTT_OFF;
+            vwr->ENDT_OFF           = vVW510024_E_ENDT_OFF;
+            vwr->LATVAL_OFF         = vVW510024_E_LATVAL_OFF;
+            vwr->INFO_OFF           = vVW510024_E_INFO_OFF;
+            vwr->L4ID_OFF           = vVW510024_E_L4ID_OFF;
+            vwr->IPLEN_OFF          = vVW510024_E_IPLEN_OFF;
+
+            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->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;
+            vwr->VCID_MASK          = vVW510024_E_VCID_MASK;
+            vwr->FLOW_VALID         = vVW510024_E_FLOW_VALID;
+            vwr->FCS_ERROR          = v22_E_FCS_ERROR;
 
-            vwr->FRAME_TYPE_OFF  =   vVW510024_E_FRAME_TYPE_OFF;
-            vwr->IS_TCP      =   vVW510024_E_IS_TCP;
-            vwr->IS_UDP      =   vVW510024_E_IS_UDP;
-            vwr->IS_ICMP     =   vVW510024_E_IS_ICMP;
-            vwr->IS_IGMP     =   vVW510024_E_IS_IGMP;
-            vwr->IS_QOS      =   vVW510024_E_QOS_VALID;
-            vwr->IS_VLAN     =   vVW510024_E_IS_VLAN;
+            vwr->FRAME_TYPE_OFF     =   vVW510024_E_FRAME_TYPE_OFF;
+            vwr->IS_TCP             =   vVW510024_E_IS_TCP;
+            vwr->IS_UDP             =   vVW510024_E_IS_UDP;
+            vwr->IS_ICMP            =   vVW510024_E_IS_ICMP;
+            vwr->IS_IGMP            =   vVW510024_E_IS_IGMP;
+            vwr->IS_QOS             =   vVW510024_E_QOS_VALID;
+            vwr->IS_VLAN            =   vVW510024_E_IS_VLAN;
 
             break;
     }
 }
 #define SIG_SCAN_RANGE  64                          /* range of signature scanning region */
 
-/* utility routine: check that signature is at specified location; scan for it if not */
-/* if we can't find a signature at all, then simply return the originally supplied offset */
+/* Utility routine: check that signature is at specified location; scan for it if not.     */
+/* If we can't find a signature at all, then simply return the originally supplied offset. */
 int find_signature(guint8 *m_ptr, int rec_size, int pay_off, guint32 flow_id, guint8 flow_seq)
 {
     int     tgt;                /* temps */
@@ -2040,12 +2043,12 @@ int find_signature(guint8 *m_ptr, int rec_size, int pay_off, guint32 flow_id, gu
 
     /* initial check is very simple: look for a '0xdd' at the target location */
     if (m_ptr[pay_off] == 0xdd)                         /* if magic byte is present */
-        return(pay_off);                                /* got right offset, return it */
+        return pay_off;                                 /* got right offset, return it */
 
-    /* hmmm, signature magic byte is not where it is supposed to be; scan from start of */
-    /* payload until maximum scan range exhausted to see if we can find it */
-    /* the scanning process consists of looking for a '0xdd', then checking for the correct */
-    /* flow ID and sequence number at the appropriate offsets */
+    /* Hmmm, signature magic byte is not where it is supposed to be; scan from start of     */
+    /*  payload until maximum scan range exhausted to see if we can find it.                */
+    /* The scanning process consists of looking for a '0xdd', then checking for the correct */
+    /*  flow ID and sequence number at the appropriate offsets.                             */
     for (tgt = pay_off; tgt < (rec_size); tgt++) {
         if (m_ptr[tgt] == 0xdd) {                       /* found magic byte? check fields */
             if (m_ptr[tgt + 15] == 0xe2) {
@@ -2060,7 +2063,7 @@ int find_signature(guint8 *m_ptr, int rec_size, int pay_off, guint32 flow_id, gu
                 return (tgt);
             }
             else
-            {                                                  /* out which one... */
+            {                                               /* out which one... */
                 if (m_ptr[tgt + SIG_FSQ_OFF] != flow_seq)   /* check sequence number */
                     continue;                               /* if failed, keep scanning */
 
@@ -2075,13 +2078,13 @@ int find_signature(guint8 *m_ptr, int rec_size, int pay_off, guint32 flow_id, gu
     }
 
     /* failed to find the signature, return the original offset as default */
-    return(pay_off);
+    return pay_off;
 }
 
 /* utility routine: harvest the signature time stamp from the data frame */
 guint64 get_signature_ts(guint8 *m_ptr,int sig_off)
 {
-    int ts_offset;
+    int     ts_offset;
     guint64 sig_ts;
 
     if (m_ptr[sig_off + 15] == 0xe2)
@@ -2091,27 +2094,27 @@ guint64 get_signature_ts(guint8 *m_ptr,int sig_off)
 
     sig_ts = pletohl(&m_ptr[sig_off + ts_offset]);
 
-    return(sig_ts & 0xffffffff);
+    return (sig_ts & 0xffffffff);
 }
 
 static float getRate( guint8 plcpType, guint8 mcsIndex, guint16 rflags, guint8 nss )
 {
     /* Rate conversion data */
-    float canonical_rate_legacy[] = {1.0f, 2.0f, 5.5f, 11.0f, 6.0f, 9.0f, 12.0f, 18.0f, 24.0f, 36.0f, 48.0f, 54.0f};
-    
-    int canonical_ndbps_20_ht[] = {26, 52, 78, 104, 156, 208, 234, 260};
-    int canonical_ndbps_40_ht[] = {54, 108, 162, 216, 324, 432, 486, 540};
-
-    int canonical_ndbps_20_vht[] = {26,52, 78, 104, 156, 208, 234, 260, 312};
-    int canonical_ndbps_40_vht[] = {54, 108, 162, 216, 324, 432, 486, 540, 648, 720};
-    int canonical_ndbps_80_vht[] = {117, 234, 351, 468, 702, 936, 1053, 1170, 1404, 1560};
-    
-    int ndbps;
-    float symbol_tx_time, bitrate = 0.0f;
+    float canonical_rate_legacy[]  = {1.0f, 2.0f, 5.5f, 11.0f, 6.0f, 9.0f, 12.0f, 18.0f, 24.0f, 36.0f, 48.0f, 54.0f};
+
+    int   canonical_ndbps_20_ht[]  = {26, 52, 78, 104, 156, 208, 234, 260};
+    int   canonical_ndbps_40_ht[]  = {54, 108, 162, 216, 324, 432, 486, 540};
+
+    int   canonical_ndbps_20_vht[] = {26,52, 78, 104, 156, 208, 234, 260, 312};
+    int   canonical_ndbps_40_vht[] = {54, 108, 162, 216, 324, 432, 486, 540, 648, 720};
+    int   canonical_ndbps_80_vht[] = {117, 234, 351, 468, 702, 936, 1053, 1170, 1404, 1560};
+
+    int   ndbps;
+    float symbol_tx_time, bitrate  = 0.0f;
 
     if (plcpType == 0)
         bitrate =  canonical_rate_legacy[mcsIndex];
-    else if (plcpType == 1 || plcpType == 2) 
+    else if (plcpType == 1 || plcpType == 2)
     {
         if ( rflags & IEEE80211_RADIOTAP_F_SHORTGI)
             symbol_tx_time = 3.6f;
@@ -2155,23 +2158,23 @@ vwr_process_rec_data(wtap *wth, FILE_T fh, int rec_size,
                      Buffer *buf, vwr_t *vwr,
                      int IS_TX, int *err, gchar **err_info)
 {
-    guint8      rec[B_SIZE];                        /* local buffer (holds input record) */
-    guint16     pkt_len;                            /* length of radiotap headers */
-    guint8      *data_ptr;
+    guint8   rec[B_SIZE];       /* local buffer (holds input record) */
+    guint16  pkt_len;           /* length of radiotap headers */
+    guint8  *data_ptr;
 
-    /* read over the entire record (frame + trailer) into a local buffer */
-    /* if we don't get it all, then declare an error, we can't process the frame */
+    /* Read over the entire record (frame + trailer) into a local buffer.         */
+    /* If we don't get it all, then declare an error, we can't process the frame. */
     if (file_read(rec, rec_size, fh) != rec_size) {
         *err = file_error(fh, err_info);
         if (*err == 0)
             *err = WTAP_ERR_SHORT_READ;
-        return(FALSE);
+        return FALSE;
     }
 
     if (rec_size < (int)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);
+        return FALSE;
     }
 
     /* before writing anything out, make sure the buffer has enough space for everything */
@@ -2202,6 +2205,15 @@ vwr_process_rec_data(wtap *wth, FILE_T fh, int rec_size,
     return (TRUE);
 }
 
-/* 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 */
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */