Refactor 802.11 radio flags.
authorSimon Barber <simon.barber@meraki.net>
Wed, 9 Dec 2015 22:26:46 +0000 (14:26 -0800)
committerGuy Harris <guy@alum.mit.edu>
Thu, 24 Dec 2015 07:58:51 +0000 (07:58 +0000)
The use of a flag field here is aesthetically unpleasing when the flags
are referred to frequently. Convert these into bitfield entries.

Change-Id: I6f47e31558439dfd343ec7f856d04480366a1237
Reviewed-on: https://code.wireshark.org/review/12511
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
20 files changed:
epan/dissectors/packet-aruba-erm.c
epan/dissectors/packet-cisco-wids.c
epan/dissectors/packet-ieee80211-netmon.c
epan/dissectors/packet-ieee80211-prism.c
epan/dissectors/packet-ieee80211-radio.c
epan/dissectors/packet-ieee80211-radiotap.c
epan/dissectors/packet-ieee80211-wlancap.c
epan/dissectors/packet-ieee80211.c
epan/dissectors/packet-ixveriwave.c
epan/dissectors/packet-peekremote.c
epan/dissectors/packet-ppi.c
wiretap/commview.c
wiretap/netmon.c
wiretap/network_instruments.c
wiretap/netxray.c
wiretap/pcap-common.c
wiretap/peekclassic.c
wiretap/peektagged.c
wiretap/snoop.c
wiretap/wtap.h

index 19004302f6ed9a19bbbe114730154aa1305e6a4b..65540b4b234cba412ca463a8e6a59fadc46d951e 100644 (file)
@@ -285,13 +285,11 @@ dissect_aruba_erm_type3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
 
     offset = dissect_aruba_erm_pcap(tvb, pinfo, aruba_erm_tree, offset);
 
+    memset(&phdr, 0, sizeof(phdr));
     phdr.decrypted = FALSE;
     phdr.datapad = FALSE;
     phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-    phdr.presence_flags =
-        PHDR_802_11_HAS_DATA_RATE|
-        PHDR_802_11_HAS_CHANNEL|
-        PHDR_802_11_HAS_SIGNAL_PERCENT;
+    phdr.has_data_rate = TRUE;
     data_rate = tvb_get_ntohs(tvb, offset);
     phdr.data_rate = data_rate;
     proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_data_rate, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -304,10 +302,12 @@ dissect_aruba_erm_type3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
     offset += 2;
 
     proto_tree_add_item_ret_uint(aruba_erm_tree, hf_aruba_erm_channel, tvb, offset, 1, ENC_BIG_ENDIAN, &channel);
+    phdr.has_channel = TRUE;
     phdr.channel = channel;
     offset += 1;
 
     proto_tree_add_item_ret_uint(aruba_erm_tree, hf_aruba_erm_signal_strength, tvb, offset, 1, ENC_BIG_ENDIAN, &signal_strength);
+    phdr.has_signal_percent = TRUE;
     phdr.signal_percent = signal_strength;
     offset += 1;
 
index c6e86c9953c0c3e7c618a2718c225abc61c40829..90505c383fb9cbdeb5272d35baea3132965ac2c4 100644 (file)
@@ -90,15 +90,16 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
                ti = proto_tree_add_item(tree, proto_cwids, tvb, offset, 28, ENC_NA);
                cwids_tree = proto_item_add_subtree(ti, ett_cwids);
 
+               memset(&phdr, 0, sizeof(phdr));
                phdr.fcs_len = 0;       /* no FCS */
                phdr.decrypted = FALSE;
                phdr.datapad = FALSE;
                phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-               phdr.presence_flags = PHDR_802_11_HAS_CHANNEL;
                proto_tree_add_item(cwids_tree, hf_cwids_version, tvb, offset, 2, ENC_BIG_ENDIAN);
                offset += 2;
                proto_tree_add_item(cwids_tree, hf_cwids_unknown1, tvb, offset, 7, ENC_NA);
                offset += 7;
+               phdr.has_channel = TRUE;
                phdr.channel = tvb_get_guint8(tvb, offset);
                proto_tree_add_item(cwids_tree, hf_cwids_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset += 1;
index a91a2fb4fab5220e1ec1833cc0f23f74777cdc96..8943f51a961aff54e5412149dde4d92887781584 100644 (file)
@@ -163,6 +163,8 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
      * uPhyId?
      */
     phy_type = tvb_get_letohl(tvb, offset);
+    memset(&phdr->phy_info, 0, sizeof(phdr->phy_info));
+
     switch (phy_type) {
 
     case PHY_TYPE_UNKNOWN:
@@ -171,7 +173,6 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
 
     case PHY_TYPE_FHSS:
         phdr->phy = PHDR_802_11_PHY_11_FHSS;
-        phdr->phy_info.info_11_fhss.presence_flags = 0;
         break;
 
     case PHY_TYPE_IR_BASEBAND:
@@ -184,27 +185,22 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
 
     case PHY_TYPE_HR_DSSS:
         phdr->phy = PHDR_802_11_PHY_11B;
-        phdr->phy_info.info_11b.presence_flags = 0;
         break;
 
     case PHY_TYPE_OFDM:
         phdr->phy = PHDR_802_11_PHY_11A;
-        phdr->phy_info.info_11a.presence_flags = 0;
         break;
 
     case PHY_TYPE_ERP:
         phdr->phy = PHDR_802_11_PHY_11G;
-        phdr->phy_info.info_11g.presence_flags = 0;
         break;
 
     case PHY_TYPE_HT:
         phdr->phy = PHDR_802_11_PHY_11N;
-        phdr->phy_info.info_11n.presence_flags = 0;
         break;
 
     case PHY_TYPE_VHT:
         phdr->phy = PHDR_802_11_PHY_11AC;
-        phdr->phy_info.info_11ac.presence_flags = 0;
         break;
 
     default:
@@ -227,7 +223,7 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
       } else {
         guint frequency;
 
-        phdr->presence_flags |= PHDR_802_11_HAS_CHANNEL;
+        phdr->has_channel = TRUE;
         phdr->channel = channel;
         proto_tree_add_uint(wlan_tree, hf_netmon_802_11_channel,
                             tvb, offset, 4, channel);
@@ -249,19 +245,19 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
           break;
         }
         if (frequency != 0) {
-          phdr->presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+          phdr->has_frequency = TRUE;
           phdr->frequency = frequency;
         }
       }
     } else {
-      phdr->presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+      phdr->has_frequency = TRUE;
       phdr->frequency = channel;
       proto_tree_add_uint_format_value(wlan_tree, hf_netmon_802_11_frequency,
                                        tvb, offset, 4, channel,
                                        "%u Mhz", channel);
       calc_channel = ieee80211_mhz_to_chan(channel);
       if (calc_channel != -1) {
-        phdr->presence_flags |= PHDR_802_11_HAS_CHANNEL;
+        phdr->has_channel = TRUE;
         phdr->channel = calc_channel;
       }
     }
@@ -280,7 +276,7 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
                                       tvb, offset, 4, rssi,
                                       "Unknown");
     } else {
-      phdr->presence_flags |= PHDR_802_11_HAS_SIGNAL_DBM;
+      phdr->has_signal_dbm = TRUE;
       phdr->signal_dbm = rssi;
       proto_tree_add_int_format_value(wlan_tree, hf_netmon_802_11_rssi,
                                       tvb, offset, 4, rssi,
@@ -297,7 +293,7 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
                                        tvb, offset, 1, rate,
                                        "Unknown");
     } else {
-      phdr->presence_flags |= PHDR_802_11_HAS_DATA_RATE;
+      phdr->has_data_rate = TRUE;
       phdr->data_rate = rate;
       proto_tree_add_uint_format_value(wlan_tree, hf_netmon_802_11_datarate,
                                        tvb, offset, 1, rate,
@@ -312,7 +308,7 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
    *
    * If so, should this check the presense flag in flags?
    */
-  phdr->presence_flags |= PHDR_802_11_HAS_TSF_TIMESTAMP;
+  phdr->has_tsf_timestamp = TRUE;
   phdr->tsf_timestamp = tvb_get_letoh64(tvb, offset);
   proto_tree_add_item(wlan_tree, hf_netmon_802_11_timestamp, tvb, offset, 8,
                       ENC_LITTLE_ENDIAN);
index 828b50febafe4e1638322a26c04eb15ca04921f7..1122081b04cb3ff0cc77eb8f7619baa17d3569ca 100644 (file)
@@ -311,11 +311,11 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
     }
 
     /* We don't have any 802.11 metadata yet. */
+    memset(&phdr, 0, sizeof(phdr));
     phdr.fcs_len = -1;
     phdr.decrypted = FALSE;
     phdr.datapad = FALSE;
     phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-    phdr.presence_flags = 0;
 
     col_set_str(pinfo->cinfo, COL_PROTOCOL, "Prism");
     col_clear(pinfo->cinfo, COL_INFO);
@@ -383,7 +383,7 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
               case PRISM_TYPE1_CHANNEL:
               case PRISM_TYPE2_CHANNEL:
                 channel = tvb_get_guint32(tvb, offset, byte_order);
-                phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+                phdr.has_channel = TRUE;
                 phdr.channel = channel;
                 if(tree){
                     proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_channel, tvb, offset, 4, byte_order);
@@ -428,7 +428,7 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
               case PRISM_TYPE1_RATE:
               case PRISM_TYPE2_RATE:
                 rate = tvb_get_guint32(tvb, offset, byte_order);
-                phdr.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
+                phdr.has_data_rate = TRUE;
                 phdr.data_rate = rate;
                 if(tree){
                     proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_rate, tvb, offset, 4, byte_order);
index c45f0f83462d82a3fdd807943b83cb8cde70366d..b71e505c58b22f503d7a4cb4b1ad2923dce8638a 100644 (file)
@@ -668,14 +668,14 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
   col_clear(pinfo->cinfo, COL_INFO);
 
   /* Calculate the data rate, if we have the necessary data */
-  if (phdr->presence_flags & PHDR_802_11_HAS_DATA_RATE) {
+  if (phdr->has_data_rate) {
     data_rate = phdr->data_rate * 0.5f;
     have_data_rate = TRUE;
   }
 
-  if (phdr->presence_flags & PHDR_802_11_HAS_SIGNAL_DBM) {
+  if (phdr->has_signal_dbm) {
     col_add_fstr(pinfo->cinfo, COL_RSSI, "%u dBm", phdr->signal_dbm);
-  } else if (phdr->presence_flags & PHDR_802_11_HAS_SIGNAL_PERCENT) {
+  } else if (phdr->has_signal_percent) {
     col_add_fstr(pinfo->cinfo, COL_RSSI, "%u%%", phdr->signal_percent);
   }
 
@@ -690,44 +690,44 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
       switch (phdr->phy) {
 
       case PHDR_802_11_PHY_11_FHSS:
-        if (phdr->phy_info.info_11_fhss.presence_flags & PHDR_802_11_FHSS_HAS_HOP_SET) {
+        if (phdr->phy_info.info_11_fhss.has_hop_set) {
           proto_tree_add_uint(radio_tree, hf_wlan_radio_11_fhss_hop_set, tvb, 0, 0,
                    phdr->phy_info.info_11_fhss.hop_set);
         }
-        if (phdr->phy_info.info_11_fhss.presence_flags & PHDR_802_11_FHSS_HAS_HOP_PATTERN) {
+        if (phdr->phy_info.info_11_fhss.has_hop_pattern) {
           proto_tree_add_uint(radio_tree, hf_wlan_radio_11_fhss_hop_pattern, tvb, 0, 0,
                    phdr->phy_info.info_11_fhss.hop_pattern);
         }
-        if (phdr->phy_info.info_11_fhss.presence_flags & PHDR_802_11_FHSS_HAS_HOP_INDEX) {
+        if (phdr->phy_info.info_11_fhss.has_hop_index) {
           proto_tree_add_uint(radio_tree, hf_wlan_radio_11_fhss_hop_index, tvb, 0, 0,
                    phdr->phy_info.info_11_fhss.hop_index);
         }
         break;
 
       case PHDR_802_11_PHY_11B:
-        if (phdr->phy_info.info_11b.presence_flags & PHDR_802_11B_HAS_SHORT_PREAMBLE) {
+        if (phdr->phy_info.info_11b.has_short_preamble) {
           proto_tree_add_boolean(radio_tree, hf_wlan_radio_short_preamble, tvb, 0, 0,
                    phdr->phy_info.info_11b.short_preamble);
         }
         break;
 
       case PHDR_802_11_PHY_11A:
-        if (phdr->phy_info.info_11a.presence_flags & PHDR_802_11A_HAS_CHANNEL_TYPE) {
+        if (phdr->phy_info.info_11a.has_channel_type) {
           proto_tree_add_uint(radio_tree, hf_wlan_radio_11a_channel_type, tvb, 0, 0,
                    phdr->phy_info.info_11a.channel_type);
         }
-        if (phdr->phy_info.info_11a.presence_flags & PHDR_802_11A_HAS_TURBO_TYPE) {
+        if (phdr->phy_info.info_11a.has_turbo_type) {
           proto_tree_add_uint(radio_tree, hf_wlan_radio_11a_turbo_type, tvb, 0, 0,
                    phdr->phy_info.info_11a.turbo_type);
         }
         break;
 
       case PHDR_802_11_PHY_11G:
-        if (phdr->phy_info.info_11g.presence_flags & PHDR_802_11G_HAS_SHORT_PREAMBLE) {
+        if (phdr->phy_info.info_11g.has_short_preamble) {
           proto_tree_add_boolean(radio_tree, hf_wlan_radio_short_preamble, tvb, 0, 0,
                    phdr->phy_info.info_11g.short_preamble);
         }
-        if (phdr->phy_info.info_11g.presence_flags & PHDR_802_11G_HAS_MODE) {
+        if (phdr->phy_info.info_11g.has_mode) {
           proto_tree_add_uint(radio_tree, hf_wlan_radio_11g_mode, tvb, 0, 0,
                    phdr->phy_info.info_11g.mode);
         }
@@ -737,37 +737,37 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
         {
           guint bandwidth_40;
 
-          if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_MCS_INDEX) {
+          if (phdr->phy_info.info_11n.has_mcs_index) {
             proto_tree_add_uint(radio_tree, hf_wlan_radio_11n_mcs_index, tvb, 0, 0,
                      phdr->phy_info.info_11n.mcs_index);
           }
 
-          if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_BANDWIDTH) {
+          if (phdr->phy_info.info_11n.has_bandwidth) {
             proto_tree_add_uint(radio_tree, hf_wlan_radio_11n_bandwidth, tvb, 0, 0,
                      phdr->phy_info.info_11n.bandwidth);
           }
 
-          if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_SHORT_GI) {
+          if (phdr->phy_info.info_11n.has_short_gi) {
             proto_tree_add_boolean(radio_tree, hf_wlan_radio_11n_short_gi, tvb, 0, 0,
                      phdr->phy_info.info_11n.short_gi);
           }
 
-          if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_GREENFIELD) {
+          if (phdr->phy_info.info_11n.has_greenfield) {
             proto_tree_add_boolean(radio_tree, hf_wlan_radio_11n_greenfield, tvb, 0, 0,
                      phdr->phy_info.info_11n.greenfield);
           }
 
-          if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_FEC) {
+          if (phdr->phy_info.info_11n.has_fec) {
             proto_tree_add_uint(radio_tree, hf_wlan_radio_11n_fec, tvb, 0, 0,
                      phdr->phy_info.info_11n.fec);
           }
 
-          if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_STBC_STREAMS) {
+          if (phdr->phy_info.info_11n.has_stbc_streams) {
             proto_tree_add_uint(radio_tree, hf_wlan_radio_11n_stbc_streams, tvb, 0, 0,
                      phdr->phy_info.info_11n.stbc_streams);
           }
 
-          if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_NESS) {
+          if (phdr->phy_info.info_11n.has_ness) {
             proto_tree_add_uint(radio_tree, hf_wlan_radio_11n_ness, tvb, 0, 0,
                      phdr->phy_info.info_11n.ness);
           }
@@ -776,12 +776,9 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
            * If we have all the fields needed to look up the data rate,
            * do so.
            */
-#define PHDR_802_11N_ALL_FIELDS_FOR_DATARATE \
-          (PHDR_802_11N_HAS_MCS_INDEX | \
-           PHDR_802_11N_HAS_BANDWIDTH | \
-           PHDR_802_11N_HAS_SHORT_GI)
-
-          if ((phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_ALL_FIELDS_FOR_DATARATE) == PHDR_802_11N_ALL_FIELDS_FOR_DATARATE) {
+          if (phdr->phy_info.info_11n.has_mcs_index &&
+              phdr->phy_info.info_11n.has_bandwidth &&
+              phdr->phy_info.info_11n.has_short_gi) {
             bandwidth_40 =
               (phdr->phy_info.info_11n.bandwidth == PHDR_802_11_BANDWIDTH_40_MHZ) ?
                1 : 0;
@@ -799,17 +796,17 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
           guint bandwidth = 0;
           guint i;
 
-          if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_STBC) {
+          if (phdr->phy_info.info_11ac.has_stbc) {
             proto_tree_add_boolean(radio_tree, hf_wlan_radio_11ac_stbc, tvb, 0, 0,
                      phdr->phy_info.info_11ac.stbc);
           }
 
-          if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_TXOP_PS_NOT_ALLOWED) {
+          if (phdr->phy_info.info_11ac.has_txop_ps_not_allowed) {
             proto_tree_add_boolean(radio_tree, hf_wlan_radio_11ac_txop_ps_not_allowed, tvb, 0, 0,
                      phdr->phy_info.info_11ac.txop_ps_not_allowed);
           }
 
-          if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_SHORT_GI) {
+          if (phdr->phy_info.info_11ac.has_short_gi) {
             can_calculate_rate = TRUE;  /* well, if we also have the bandwidth */
             proto_tree_add_boolean(radio_tree, hf_wlan_radio_11ac_short_gi, tvb, 0, 0,
                      phdr->phy_info.info_11ac.short_gi);
@@ -817,22 +814,22 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
             can_calculate_rate = FALSE; /* unknown GI length */
           }
 
-          if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_SHORT_GI_NSYM_DISAMBIG) {
+          if (phdr->phy_info.info_11ac.has_short_gi_nsym_disambig) {
             proto_tree_add_boolean(radio_tree, hf_wlan_radio_11ac_short_gi_nsym_disambig, tvb, 0, 0,
                      phdr->phy_info.info_11ac.short_gi_nsym_disambig);
           }
 
-          if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_LDPC_EXTRA_OFDM_SYMBOL) {
+          if (phdr->phy_info.info_11ac.has_ldpc_extra_ofdm_symbol) {
             proto_tree_add_boolean(radio_tree, hf_wlan_radio_11ac_ldpc_extra_ofdm_symbol, tvb, 0, 0,
                      phdr->phy_info.info_11ac.ldpc_extra_ofdm_symbol);
           }
 
-          if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_BEAMFORMED) {
+          if (phdr->phy_info.info_11ac.has_beamformed) {
             proto_tree_add_boolean(radio_tree, hf_wlan_radio_11ac_beamformed, tvb, 0, 0,
                      phdr->phy_info.info_11ac.beamformed);
           }
 
-          if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_BANDWIDTH) {
+          if (phdr->phy_info.info_11ac.has_bandwidth) {
             if (phdr->phy_info.info_11ac.bandwidth < G_N_ELEMENTS(ieee80211_vht_bw2rate_index))
               bandwidth = ieee80211_vht_bw2rate_index[phdr->phy_info.info_11ac.bandwidth];
             else
@@ -869,7 +866,7 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
                * If we don't know whether space-time block coding is being
                * used, we don't know the number of space-time streams.
                */
-              if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_STBC) {
+              if (phdr->phy_info.info_11ac.has_stbc) {
                 guint nsts;
 
                 if (phdr->phy_info.info_11ac.stbc)
@@ -879,7 +876,7 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
                 proto_tree_add_uint(user_tree, hf_wlan_radio_11ac_nsts, tvb, 0, 0,
                        nsts);
               }
-              if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_FEC) {
+              if (phdr->phy_info.info_11ac.has_fec) {
                   proto_tree_add_uint(user_tree, hf_wlan_radio_11ac_fec, tvb, 0, 0,
                            (phdr->phy_info.info_11ac.fec >> i) & 0x01);
               }
@@ -899,12 +896,12 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
             }
           }
 
-          if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_GROUP_ID) {
+          if (phdr->phy_info.info_11ac.has_group_id) {
             proto_tree_add_uint(radio_tree, hf_wlan_radio_11ac_gid, tvb, 0, 0,
                      phdr->phy_info.info_11ac.group_id);
           }
 
-          if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_PARTIAL_AID) {
+          if (phdr->phy_info.info_11ac.has_partial_aid) {
             proto_tree_add_uint(radio_tree, hf_wlan_radio_11ac_p_aid, tvb, 0, 0,
                      phdr->phy_info.info_11ac.partial_aid);
           }
@@ -921,13 +918,13 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
                data_rate);
     }
 
-    if (phdr->presence_flags & PHDR_802_11_HAS_CHANNEL) {
+    if (phdr->has_channel) {
       col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u", phdr->channel);
       proto_tree_add_uint(radio_tree, hf_wlan_radio_channel, tvb, 0, 0,
               phdr->channel);
     }
 
-    if (phdr->presence_flags & PHDR_802_11_HAS_FREQUENCY) {
+    if (phdr->has_frequency) {
       col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u MHz", phdr->frequency);
       proto_tree_add_uint_format_value(radio_tree, hf_wlan_radio_frequency, tvb, 0, 0,
               phdr->frequency,
@@ -935,7 +932,7 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
               phdr->frequency);
     }
 
-    if (phdr->presence_flags & PHDR_802_11_HAS_SIGNAL_PERCENT) {
+    if (phdr->has_signal_percent) {
       col_add_fstr(pinfo->cinfo, COL_RSSI, "%u%%", phdr->signal_percent);
       proto_tree_add_uint_format_value(radio_tree, hf_wlan_radio_signal_percent, tvb, 0, 0,
               phdr->signal_percent,
@@ -943,7 +940,7 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
               phdr->signal_percent);
     }
 
-    if (phdr->presence_flags & PHDR_802_11_HAS_SIGNAL_DBM) {
+    if (phdr->has_signal_dbm) {
       col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", phdr->signal_dbm);
       proto_tree_add_int_format_value(radio_tree, hf_wlan_radio_signal_dbm, tvb, 0, 0,
               phdr->signal_dbm,
@@ -951,21 +948,21 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
               phdr->signal_dbm);
     }
 
-    if (phdr->presence_flags & PHDR_802_11_HAS_NOISE_PERCENT) {
+    if (phdr->has_noise_percent) {
       proto_tree_add_uint_format_value(radio_tree, hf_wlan_radio_noise_percent, tvb, 0, 0,
               phdr->noise_percent,
               "%u%%",
               phdr->noise_percent);
     }
 
-    if (phdr->presence_flags & PHDR_802_11_HAS_NOISE_DBM) {
+    if (phdr->has_noise_dbm) {
       proto_tree_add_int_format_value(radio_tree, hf_wlan_radio_noise_dbm, tvb, 0, 0,
               phdr->noise_dbm,
               "%d dBm",
               phdr->noise_dbm);
     }
 
-    if (phdr->presence_flags & PHDR_802_11_HAS_TSF_TIMESTAMP) {
+    if (phdr->has_tsf_timestamp) {
       proto_tree_add_uint64(radio_tree, hf_wlan_radio_timestamp, tvb, 0, 0,
               phdr->tsf_timestamp);
     }
index 2246ba7b781b92f13d7f9c552646212699c7bb87..82b242eb531be529ff8080fe6d05a88dfa1cce50 100644 (file)
@@ -589,11 +589,11 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
        radiotap_info = &rtp_info_arr;
 
        /* We don't have any 802.11 metadata yet. */
+       memset(&phdr, 0, sizeof(phdr));
        phdr.fcs_len = -1;
        phdr.decrypted = FALSE;
        phdr.datapad = FALSE;
        phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-       phdr.presence_flags = 0;
 
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");
        col_clear(pinfo->cinfo, COL_INFO);
@@ -810,7 +810,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                case IEEE80211_RADIOTAP_TSFT:
                        radiotap_info->tsft = tvb_get_letoh64(tvb, offset);
                        phdr.tsf_timestamp = radiotap_info->tsft;
-                       phdr.presence_flags |= PHDR_802_11_HAS_TSF_TIMESTAMP;
+                       phdr.has_tsf_timestamp = TRUE;
                        if (tree) {
                                proto_tree_add_uint64(radiotap_tree,
                                                      hf_radiotap_mactime, tvb,
@@ -916,7 +916,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                                                                    (float)rate / 2);
                                }
                                radiotap_info->rate = rate;
-                               phdr.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
+                               phdr.has_data_rate = TRUE;
                                phdr.data_rate = rate;
                        }
                        break;
@@ -931,20 +931,20 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                                 */
                                gint calc_channel;
 
-                               phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+                               phdr.has_frequency = TRUE;
                                phdr.frequency = freq;
                                calc_channel = ieee80211_mhz_to_chan(freq);
                                if (calc_channel != -1) {
-                                       phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+                                       phdr.has_channel = TRUE;
                                        phdr.channel = calc_channel;
                                }
                        }
+                       memset(&phdr.phy_info, 0, sizeof(phdr.phy_info));
                        cflags = tvb_get_letohs(tvb, offset + 2);
                        switch (cflags & IEEE80211_CHAN_ALLTURBO) {
 
                        case IEEE80211_CHAN_FHSS:
                                phdr.phy = PHDR_802_11_PHY_11_FHSS;
-                               phdr.phy_info.info_11_fhss.presence_flags = 0;
                                break;
 
                        case IEEE80211_CHAN_DSSS:
@@ -953,52 +953,51 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
 
                        case IEEE80211_CHAN_A:
                                phdr.phy = PHDR_802_11_PHY_11A;
-                               phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+                               phdr.phy_info.info_11a.has_turbo_type = TRUE;
                                phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_NORMAL;
                                break;
 
                        case IEEE80211_CHAN_B:
                                phdr.phy = PHDR_802_11_PHY_11B;
-                               phdr.phy_info.info_11b.presence_flags = 0;
                                if (have_rflags) {
-                                       phdr.phy_info.info_11b.presence_flags |= PHDR_802_11B_HAS_SHORT_PREAMBLE;
+                                       phdr.phy_info.info_11b.has_short_preamble = TRUE;
                                        phdr.phy_info.info_11b.short_preamble = (rflags & IEEE80211_RADIOTAP_F_SHORTPRE) != 0;
                                }
                                break;
 
                        case IEEE80211_CHAN_PUREG:
                                phdr.phy = PHDR_802_11_PHY_11G;
-                               phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+                               phdr.phy_info.info_11g.has_mode = TRUE;
                                phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
                                if (have_rflags) {
-                                       phdr.phy_info.info_11g.presence_flags |= PHDR_802_11G_HAS_SHORT_PREAMBLE;
+                                       phdr.phy_info.info_11g.has_short_preamble = TRUE;
                                        phdr.phy_info.info_11g.short_preamble = (rflags & IEEE80211_RADIOTAP_F_SHORTPRE) != 0;
                                }
                                break;
 
                        case IEEE80211_CHAN_G:
                                phdr.phy = PHDR_802_11_PHY_11G;
-                               phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+                               phdr.phy_info.info_11g.has_mode = TRUE;
                                phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
                                if (have_rflags) {
-                                       phdr.phy_info.info_11g.presence_flags |= PHDR_802_11G_HAS_SHORT_PREAMBLE;
+                                       phdr.phy_info.info_11g.has_short_preamble = TRUE;
                                        phdr.phy_info.info_11g.short_preamble = (rflags & IEEE80211_RADIOTAP_F_SHORTPRE) != 0;
                                }
                                break;
 
                        case IEEE80211_CHAN_108A:
                                phdr.phy = PHDR_802_11_PHY_11A;
-                               phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+                               phdr.phy_info.info_11a.has_turbo_type = TRUE;
                                /* We assume non-STURBO is dynamic turbo */
                                phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO;
                                break;
 
                        case IEEE80211_CHAN_108PUREG:
                                phdr.phy = PHDR_802_11_PHY_11G;
-                               phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+                               phdr.phy_info.info_11g.has_mode = TRUE;
                                phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_SUPER_G;
                                if (have_rflags) {
-                                       phdr.phy_info.info_11g.presence_flags |= PHDR_802_11G_HAS_SHORT_PREAMBLE;
+                                       phdr.phy_info.info_11g.has_short_preamble = TRUE;
                                        phdr.phy_info.info_11g.short_preamble = (rflags & IEEE80211_RADIOTAP_F_SHORTPRE) != 0;
                                }
                                break;
@@ -1046,10 +1045,9 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                         * FHSS.
                         */
                        phdr.phy = PHDR_802_11_PHY_11_FHSS;
-                       phdr.phy_info.info_11_fhss.presence_flags =
-                           PHDR_802_11_FHSS_HAS_HOP_SET |
-                           PHDR_802_11_FHSS_HAS_HOP_PATTERN;
+                       phdr.phy_info.info_11_fhss.has_hop_set = TRUE;
                        phdr.phy_info.info_11_fhss.hop_set = tvb_get_guint8(tvb, offset);
+                       phdr.phy_info.info_11_fhss.has_hop_pattern = TRUE;
                        phdr.phy_info.info_11_fhss.hop_pattern = tvb_get_guint8(tvb, offset + 1);
                        proto_tree_add_item(radiotap_tree,
                                            hf_radiotap_fhss_hopset, tvb,
@@ -1061,7 +1059,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
 
                case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
                        dbm = (gint8)tvb_get_guint8(tvb, offset);
-                       phdr.presence_flags |= PHDR_802_11_HAS_SIGNAL_DBM;
+                       phdr.has_signal_dbm = TRUE;
                        phdr.signal_dbm = dbm;
                        col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm);
                        proto_tree_add_int_format_value(radiotap_tree,
@@ -1074,7 +1072,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
 
                case IEEE80211_RADIOTAP_DBM_ANTNOISE:
                        dbm = (gint8) tvb_get_guint8(tvb, offset);
-                       phdr.presence_flags |= PHDR_802_11_HAS_NOISE_DBM;
+                       phdr.has_noise_dbm = TRUE;
                        phdr.noise_dbm = dbm;
                        if (tree) {
                                proto_tree_add_int_format_value(radiotap_tree,
@@ -1181,7 +1179,6 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                                 */
                                if (phdr.phy != PHDR_802_11_PHY_11_FHSS) {
                                        phdr.phy = PHDR_802_11_PHY_11_FHSS;
-                                       phdr.phy_info.info_11_fhss.presence_flags = 0;
                                }
                                break;
 
@@ -1191,59 +1188,58 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
 
                        case IEEE80211_CHAN_A:
                                phdr.phy = PHDR_802_11_PHY_11A;
-                               phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+                               phdr.phy_info.info_11a.has_turbo_type = TRUE;
                                phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_NORMAL;
                                break;
 
                        case IEEE80211_CHAN_B:
                                phdr.phy = PHDR_802_11_PHY_11B;
-                               phdr.phy_info.info_11b.presence_flags = 0;
                                if (have_rflags) {
-                                       phdr.phy_info.info_11b.presence_flags |= PHDR_802_11B_HAS_SHORT_PREAMBLE;
+                                       phdr.phy_info.info_11b.has_short_preamble = TRUE;
                                        phdr.phy_info.info_11b.short_preamble = (rflags & IEEE80211_RADIOTAP_F_SHORTPRE) != 0;
                                }
                                break;
 
                        case IEEE80211_CHAN_PUREG:
                                phdr.phy = PHDR_802_11_PHY_11G;
-                               phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+                               phdr.phy_info.info_11g.has_mode = TRUE;
                                phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
                                if (have_rflags) {
-                                       phdr.phy_info.info_11g.presence_flags |= PHDR_802_11G_HAS_SHORT_PREAMBLE;
+                                       phdr.phy_info.info_11g.has_short_preamble = TRUE;
                                        phdr.phy_info.info_11g.short_preamble = (rflags & IEEE80211_RADIOTAP_F_SHORTPRE) != 0;
                                }
                                break;
 
                        case IEEE80211_CHAN_G:
                                phdr.phy = PHDR_802_11_PHY_11G;
-                               phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+                               phdr.phy_info.info_11g.has_mode = TRUE;
                                phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
                                if (have_rflags) {
-                                       phdr.phy_info.info_11g.presence_flags |= PHDR_802_11G_HAS_SHORT_PREAMBLE;
+                                       phdr.phy_info.info_11g.has_short_preamble = TRUE;
                                        phdr.phy_info.info_11g.short_preamble = (rflags & IEEE80211_RADIOTAP_F_SHORTPRE) != 0;
                                }
                                break;
 
                        case IEEE80211_CHAN_108A:
                                phdr.phy = PHDR_802_11_PHY_11A;
-                               phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+                               phdr.phy_info.info_11a.has_turbo_type = TRUE;
                                /* We assume non-STURBO is dynamic turbo */
                                phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO;
                                break;
 
                        case IEEE80211_CHAN_108PUREG:
                                phdr.phy = PHDR_802_11_PHY_11G;
-                               phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+                               phdr.phy_info.info_11g.has_mode = TRUE;
                                phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_SUPER_G;
                                if (have_rflags) {
-                                       phdr.phy_info.info_11g.presence_flags |= PHDR_802_11G_HAS_SHORT_PREAMBLE;
+                                       phdr.phy_info.info_11g.has_short_preamble = TRUE;
                                        phdr.phy_info.info_11g.short_preamble = (rflags & IEEE80211_RADIOTAP_F_SHORTPRE) != 0;
                                }
                                break;
 
                        case IEEE80211_CHAN_ST:
                                phdr.phy = PHDR_802_11_PHY_11A;
-                               phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+                               phdr.phy_info.info_11a.has_turbo_type = TRUE;
                                phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_STATIC_TURBO;
                                break;
 
@@ -1254,7 +1250,6 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                        case IEEE80211_CHAN_G|IEEE80211_CHAN_HT40U:
                        case IEEE80211_CHAN_G|IEEE80211_CHAN_HT40D:
                                phdr.phy = PHDR_802_11_PHY_11N;
-                               phdr.phy_info.info_11n.presence_flags = 0;
 
                                /*
                                 * This doesn't supply "short GI" information,
@@ -1264,7 +1259,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                                 * the radiotap.org page for that field.
                                 */
                                if (have_rflags) {
-                                       phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_SHORT_GI;
+                                       phdr.phy_info.info_11n.has_short_gi = TRUE;
                                        if (rflags & 0x80)
                                                phdr.phy_info.info_11n.short_gi = 1;
                                        else
@@ -1278,10 +1273,10 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                                 * XXX - some captures have 0, which is
                                 * obviously bogus.
                                 */
-                               phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+                               phdr.has_frequency = TRUE;
                                phdr.frequency = freq;
                        }
-                       phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+                       phdr.has_channel = TRUE;
                        phdr.channel = tvb_get_guint8(tvb, offset + 6);
                        if (tree) {
                                static const int * xchannel_flags[] = {
@@ -1344,45 +1339,45 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                         */
                        if (mcs_known != 0) {
                                phdr.phy = PHDR_802_11_PHY_11N;
-                               phdr.phy_info.info_11n.presence_flags = 0;
+                               memset(&phdr.phy_info.info_11n, 0, sizeof(phdr.phy_info.info_11n));
                        }
 
                        mcs_flags = tvb_get_guint8(tvb, offset + 1);
                        if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS) {
                                mcs = tvb_get_guint8(tvb, offset + 2);
-                               phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_MCS_INDEX;
+                               phdr.phy_info.info_11n.has_mcs_index = TRUE;
                                phdr.phy_info.info_11n.mcs_index = mcs;
                        } else {
                                mcs = 0;
                                can_calculate_rate = FALSE;     /* no MCS index */
                        }
                        if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW) {
-                               phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_BANDWIDTH;
+                               phdr.phy_info.info_11n.has_bandwidth = TRUE;
                                phdr.phy_info.info_11n.bandwidth = (mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK);
                        }
                        if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI) {
                                gi_length = (mcs_flags & IEEE80211_RADIOTAP_MCS_SGI) ?
                                    1 : 0;
-                               phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_SHORT_GI;
+                               phdr.phy_info.info_11n.has_short_gi = TRUE;
                                phdr.phy_info.info_11n.short_gi = (gi_length == 0);
                        } else {
                                gi_length = 0;
                                can_calculate_rate = FALSE;     /* no GI width */
                        }
                        if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FMT) {
-                               phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_GREENFIELD;
+                               phdr.phy_info.info_11n.has_greenfield = TRUE;
                                phdr.phy_info.info_11n.greenfield = (mcs_flags & IEEE80211_RADIOTAP_MCS_FMT_GF) != 0;
                        }
                        if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FEC) {
-                               phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_FEC;
+                               phdr.phy_info.info_11n.has_fec = TRUE;
                                phdr.phy_info.info_11n.fec = (mcs_flags & IEEE80211_RADIOTAP_MCS_FEC_LDPC) ? 1 : 0;
                        }
                        if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
-                               phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_STBC_STREAMS;
+                               phdr.phy_info.info_11n.has_stbc_streams = TRUE;
                                phdr.phy_info.info_11n.stbc_streams = (mcs_flags & IEEE80211_RADIOTAP_MCS_STBC_MASK) >> IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
                        }
                        if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_NESS) {
-                               phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_NESS;
+                               phdr.phy_info.info_11n.has_ness = TRUE;
                                /* This is stored a bit weirdly */
                                phdr.phy_info.info_11n.ness =
                                    ((mcs_known & IEEE80211_RADIOTAP_MCS_NESS_BIT1) >> 6) |
@@ -1542,7 +1537,6 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                         */
                        if (known != 0) {
                                phdr.phy = PHDR_802_11_PHY_11AC;
-                               phdr.phy_info.info_11ac.presence_flags = 0;
                        }
                        vht_flags = tvb_get_guint8(tvb, offset + 2);
                        if (tree) {
@@ -1574,7 +1568,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                        }
 
                        if (known & IEEE80211_RADIOTAP_VHT_HAVE_STBC) {
-                               phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_STBC;
+                               phdr.phy_info.info_11ac.has_stbc = TRUE;
                                phdr.phy_info.info_11ac.stbc = (vht_flags & IEEE80211_RADIOTAP_VHT_STBC) != 0;
                                if (vht_tree)
                                        proto_tree_add_item(vht_tree, hf_radiotap_vht_stbc,
@@ -1582,7 +1576,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                        }
 
                        if (known & IEEE80211_RADIOTAP_VHT_HAVE_TXOP_PS) {
-                               phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_TXOP_PS_NOT_ALLOWED;
+                               phdr.phy_info.info_11ac.has_txop_ps_not_allowed = TRUE;
                                phdr.phy_info.info_11ac.txop_ps_not_allowed = (vht_flags & IEEE80211_RADIOTAP_VHT_TXOP_PS) != 0;
                                if (vht_tree)
                                        proto_tree_add_item(vht_tree, hf_radiotap_vht_txop_ps,
@@ -1591,7 +1585,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
 
                        if (known & IEEE80211_RADIOTAP_VHT_HAVE_GI) {
                                gi_length = (vht_flags & IEEE80211_RADIOTAP_VHT_SGI) ? 1 : 0;
-                               phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_SHORT_GI;
+                               phdr.phy_info.info_11ac.has_short_gi = TRUE;
                                phdr.phy_info.info_11ac.short_gi = gi_length;
                                if (vht_tree) {
                                        proto_tree_add_item(vht_tree, hf_radiotap_vht_gi,
@@ -1602,7 +1596,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                        }
 
                        if (known & IEEE80211_RADIOTAP_VHT_HAVE_SGI_NSYM_DA) {
-                               phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_SHORT_GI_NSYM_DISAMBIG;
+                               phdr.phy_info.info_11ac.has_short_gi_nsym_disambig = TRUE;
                                phdr.phy_info.info_11ac.short_gi_nsym_disambig = (vht_flags & IEEE80211_RADIOTAP_VHT_SGI_NSYM_DA) != 0;
                                if (vht_tree) {
                                        it = proto_tree_add_item(vht_tree, hf_radiotap_vht_sgi_nsym_da,
@@ -1615,7 +1609,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                        }
 
                        if (known & IEEE80211_RADIOTAP_VHT_HAVE_LDPC_EXTRA) {
-                               phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_LDPC_EXTRA_OFDM_SYMBOL;
+                               phdr.phy_info.info_11ac.has_ldpc_extra_ofdm_symbol = TRUE;
                                phdr.phy_info.info_11ac.ldpc_extra_ofdm_symbol = (vht_flags & IEEE80211_RADIOTAP_VHT_LDPC_EXTRA) != 0;
                                if (vht_tree) {
                                        proto_tree_add_item(vht_tree, hf_radiotap_vht_ldpc_extra,
@@ -1624,7 +1618,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                        }
 
                        if (known & IEEE80211_RADIOTAP_VHT_HAVE_BF) {
-                               phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_BEAMFORMED;
+                               phdr.phy_info.info_11ac.has_beamformed = TRUE;
                                phdr.phy_info.info_11ac.beamformed = (vht_flags & IEEE80211_RADIOTAP_VHT_BF) != 0;
                                if (vht_tree)
                                        proto_tree_add_item(vht_tree, hf_radiotap_vht_bf,
@@ -1633,7 +1627,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
 
                        if (known & IEEE80211_RADIOTAP_VHT_HAVE_BW) {
                                bw = tvb_get_guint8(tvb, offset + 3) & IEEE80211_RADIOTAP_VHT_BW_MASK;
-                               phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_BANDWIDTH;
+                               phdr.phy_info.info_11ac.has_bandwidth = TRUE;
                                phdr.phy_info.info_11ac.bandwidth = bw;
                                if (bw < sizeof(ieee80211_vht_bw2rate_index)/sizeof(ieee80211_vht_bw2rate_index[0]))
                                        bandwidth = ieee80211_vht_bw2rate_index[bw];
@@ -1662,9 +1656,8 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                                         */
                                        if (phdr.phy != PHDR_802_11_PHY_11AC) {
                                                phdr.phy = PHDR_802_11_PHY_11AC;
-                                               phdr.phy_info.info_11ac.presence_flags = 0;
                                        }
-                                       phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_FEC;
+                                       phdr.phy_info.info_11ac.has_fec = TRUE;
                                        if (vht_tree) {
                                                it = proto_tree_add_item(vht_tree, hf_radiotap_vht_user,
                                                        tvb, offset + 4, 5, ENC_NA);
@@ -1715,7 +1708,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                        phdr.phy_info.info_11ac.fec = tvb_get_guint8(tvb, offset + 8);
 
                        if (known & IEEE80211_RADIOTAP_VHT_HAVE_GID) {
-                               phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_GROUP_ID;
+                               phdr.phy_info.info_11ac.has_group_id = TRUE;
                                phdr.phy_info.info_11ac.group_id = tvb_get_guint8(tvb, offset + 9);
                                if (vht_tree)
                                        proto_tree_add_item(vht_tree, hf_radiotap_vht_gid,
@@ -1723,7 +1716,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
                        }
 
                        if (known & IEEE80211_RADIOTAP_VHT_HAVE_PAID) {
-                               phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_PARTIAL_AID;
+                               phdr.phy_info.info_11ac.has_partial_aid = TRUE;
                                phdr.phy_info.info_11ac.partial_aid = tvb_get_letohs(tvb, offset + 10);
                                if (vht_tree) {
                                        proto_tree_add_item(vht_tree, hf_radiotap_vht_p_aid,
index 5b19b813ef4d24a8b69f47dd46c438803f5dee4e..13a2f6fac4af3c793f802aa4401a1c8915b0d950 100644 (file)
@@ -364,11 +364,11 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
     struct ieee_802_11_phdr phdr;
 
     /* We don't have any 802.11 metadata yet. */
+    memset(&phdr, 0, sizeof(phdr));
     phdr.fcs_len = -1;
     phdr.decrypted = FALSE;
     phdr.datapad = FALSE;
     phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-    phdr.presence_flags = 0;
 
     col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");
     col_clear(pinfo->cinfo, COL_INFO);
@@ -395,7 +395,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
     if (tree)
       proto_tree_add_item(wlan_tree, hf_wlancap_length, tvb, offset, 4, ENC_BIG_ENDIAN);
     offset+=4;
-    phdr.presence_flags |= PHDR_802_11_HAS_TSF_TIMESTAMP;
+    phdr.has_tsf_timestamp = TRUE;
     phdr.tsf_timestamp = tvb_get_ntoh64(tvb, offset);
     if (tree)
       proto_tree_add_item(wlan_tree, hf_wlancap_mactime, tvb, offset, 8, ENC_BIG_ENDIAN);
@@ -407,7 +407,6 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
 
     case 1:
         phdr.phy = PHDR_802_11_PHY_11_FHSS;
-        phdr.phy_info.info_11_fhss.presence_flags = 0;
         break;
 
     case 2:
@@ -420,34 +419,28 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
 
     case 4:
         phdr.phy = PHDR_802_11_PHY_11B;
-        phdr.phy_info.info_11b.presence_flags = 0;
         break;
 
     case 5:
         /* 11b PBCC? */
         phdr.phy = PHDR_802_11_PHY_11B;
-        phdr.phy_info.info_11b.presence_flags = 0;
         break;
 
     case 6:
         phdr.phy = PHDR_802_11_PHY_11G; /* pure? */
-        phdr.phy_info.info_11g.presence_flags = 0;
         break;
 
     case 7:
         /* 11a PBCC? */
         phdr.phy = PHDR_802_11_PHY_11A;
-        phdr.phy_info.info_11a.presence_flags = 0;
         break;
 
     case 8:
         phdr.phy = PHDR_802_11_PHY_11A;
-        phdr.phy_info.info_11a.presence_flags = 0;
         break;
 
     case 9:
         phdr.phy = PHDR_802_11_PHY_11G; /* mixed? */
-        phdr.phy_info.info_11g.presence_flags = 0;
         break;
     }
     if (tree)
@@ -455,16 +448,15 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
     offset+=4;
 
     if (phdr.phy == PHDR_802_11_PHY_11_FHSS) {
-      phdr.phy_info.info_11_fhss.presence_flags =
-          PHDR_802_11_FHSS_HAS_HOP_SET |
-          PHDR_802_11_FHSS_HAS_HOP_PATTERN |
-          PHDR_802_11_FHSS_HAS_HOP_INDEX;
+      phdr.phy_info.info_11_fhss.has_hop_set = TRUE;
       phdr.phy_info.info_11_fhss.hop_set = tvb_get_guint8(tvb, offset);
       if (tree)
         proto_tree_add_item(wlan_tree, hf_wlancap_hop_set, tvb, offset, 1, ENC_NA);
+      phdr.phy_info.info_11_fhss.has_hop_pattern = TRUE;
       phdr.phy_info.info_11_fhss.hop_pattern = tvb_get_guint8(tvb, offset + 1);
       if (tree)
         proto_tree_add_item(wlan_tree, hf_wlancap_hop_pattern, tvb, offset + 1, 1, ENC_NA);
+      phdr.phy_info.info_11_fhss.has_hop_index = TRUE;
       phdr.phy_info.info_11_fhss.hop_index = tvb_get_guint8(tvb, offset + 2);
       if (tree)
         proto_tree_add_item(wlan_tree, hf_wlancap_hop_index, tvb, offset + 2, 1, ENC_NA);
@@ -472,25 +464,25 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
       channel = tvb_get_ntohl(tvb, offset);
       if (channel < 256) {
         col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u", channel);
-        phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+        phdr.has_channel = TRUE;
         phdr.channel = channel;
         if (tree)
           proto_tree_add_uint(wlan_tree, hf_wlancap_channel, tvb, offset, 4, channel);
         frequency = ieee80211_chan_to_mhz(channel, (phdr.phy != PHDR_802_11_PHY_11A));
         if (frequency != 0) {
-          phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+          phdr.has_frequency = TRUE;
           phdr.frequency = frequency;
         }
       } else if (channel < 10000) {
         col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u MHz", channel);
-        phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+        phdr.has_frequency = TRUE;
         phdr.frequency = channel;
         if (tree)
           proto_tree_add_uint_format(wlan_tree, hf_wlancap_channel_frequency, tvb, offset,
                                      4, channel, "Frequency: %u MHz", channel);
         calc_channel = ieee80211_mhz_to_chan(channel);
         if (calc_channel != -1) {
-          phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+          phdr.has_channel = TRUE;
           phdr.channel = calc_channel;
         }
       } else {
@@ -515,7 +507,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
       /* Can this be expressed in .5 MHz units? */
       if ((datarate % 500000) == 0) {
         /* Yes. */
-        phdr.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
+        phdr.has_data_rate = TRUE;
         phdr.data_rate = datarate / 500000;
       }
     }
@@ -554,7 +546,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
     case SSI_DBM:
       /* dBm */
       dbm = tvb_get_ntohl(tvb, offset);
-      phdr.presence_flags |= PHDR_802_11_HAS_SIGNAL_DBM;
+      phdr.has_signal_dbm = TRUE;
       phdr.signal_dbm = dbm;
       col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm);
       if (tree)
@@ -589,7 +581,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
         /* dBm */
         if (antnoise != 0) {
           /* The spec says use 0xffffffff, but some drivers appear to use 0. */
-          phdr.presence_flags |= PHDR_802_11_HAS_NOISE_DBM;
+          phdr.has_noise_dbm = TRUE;
           phdr.noise_dbm = antnoise;
         }
         if (tree)
@@ -617,12 +609,12 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
       switch (phdr.phy) {
 
       case PHDR_802_11_PHY_11B:
-        phdr.phy_info.info_11b.presence_flags |= PHDR_802_11B_HAS_SHORT_PREAMBLE;
+        phdr.phy_info.info_11b.has_short_preamble = TRUE;
         phdr.phy_info.info_11b.short_preamble = TRUE;
         break;
 
       case PHDR_802_11_PHY_11G:
-        phdr.phy_info.info_11g.presence_flags |= PHDR_802_11G_HAS_SHORT_PREAMBLE;
+        phdr.phy_info.info_11g.has_short_preamble = TRUE;
         phdr.phy_info.info_11g.short_preamble = TRUE;
         break;
       }
@@ -637,12 +629,12 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
       switch (phdr.phy) {
 
       case PHDR_802_11_PHY_11B:
-        phdr.phy_info.info_11b.presence_flags |= PHDR_802_11B_HAS_SHORT_PREAMBLE;
+        phdr.phy_info.info_11b.has_short_preamble = TRUE;
         phdr.phy_info.info_11b.short_preamble = FALSE;
         break;
 
       case PHDR_802_11_PHY_11G:
-        phdr.phy_info.info_11g.presence_flags |= PHDR_802_11G_HAS_SHORT_PREAMBLE;
+        phdr.phy_info.info_11g.has_short_preamble = TRUE;
         phdr.phy_info.info_11g.short_preamble = FALSE;
         break;
       }
index 962c61158f3359fa87b8932ed27a022e8d681fcd..1b498bbbc40f8816faf801befc491259cdddd3e4 100644 (file)
@@ -16515,7 +16515,7 @@ dissect_ieee80211_common (tvbuff_t *tvb, packet_info *pinfo,
   guint16          meshoff     = 0;
   static wlan_hdr_t whdrs[4];
   gboolean         retransmitted;
-  gboolean         isDMG = (phdr->presence_flags & PHDR_802_11_HAS_FREQUENCY ?
+  gboolean         isDMG = (phdr->has_frequency ?
                                 IS_80211AD(phdr->frequency) :
                                 FALSE);
 
@@ -18357,11 +18357,11 @@ dissect_ieee80211 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
      * Fake a pseudo-header.
      * XXX - what are we supposed to do if the FCS length is unknown?
      */
+    memset(&ourphdr, 0, sizeof(ourphdr));
     ourphdr.fcs_len = -1;
     ourphdr.decrypted = FALSE;
     ourphdr.datapad = FALSE;
     ourphdr.phy = PHDR_802_11_PHY_UNKNOWN;
-    ourphdr.presence_flags = 0;
     phdr = &ourphdr;
   }
   return dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, phdr);
@@ -18377,11 +18377,11 @@ dissect_ieee80211_withfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
   struct ieee_802_11_phdr phdr;
 
   /* Construct a pseudo-header to hand to the common code. */
+  memset(&phdr, 0, sizeof(phdr));
   phdr.fcs_len = 4;
   phdr.decrypted = FALSE;
   phdr.datapad = FALSE;
   phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-  phdr.presence_flags = 0;
   dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, &phdr);
   return tvb_captured_length(tvb);
 }
@@ -18396,11 +18396,10 @@ dissect_ieee80211_withoutfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
   struct ieee_802_11_phdr phdr;
 
   /* Construct a pseudo-header to hand to the common code. */
-  phdr.fcs_len = 0;
+  memset(&phdr, 0, sizeof(phdr));
   phdr.decrypted = FALSE;
   phdr.datapad = FALSE;
   phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-  phdr.presence_flags = 0;
   dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, &phdr);
   return tvb_captured_length(tvb);
 }
@@ -18442,11 +18441,10 @@ dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
   struct ieee_802_11_phdr phdr;
 
   /* Construct a pseudo-header to hand to the common code. */
-  phdr.fcs_len = 0;
+  memset(&phdr, 0, sizeof(phdr));
   phdr.decrypted = FALSE;
   phdr.datapad = FALSE;
   phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-  phdr.presence_flags = 0;
   dissect_ieee80211_common (tvb, pinfo, tree, FALSE, TRUE, &phdr);
   return tvb_captured_length(tvb);
 }
@@ -18462,11 +18460,10 @@ dissect_ieee80211_bsfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
   struct ieee_802_11_phdr phdr;
 
   /* Construct a pseudo-header to hand to the common code. */
-  phdr.fcs_len = 0;
+  memset(&phdr, 0, sizeof(phdr));
   phdr.decrypted = FALSE;
   phdr.datapad = FALSE;
   phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-  phdr.presence_flags = 0;
   dissect_ieee80211_common (tvb, pinfo, tree, TRUE, FALSE, &phdr);
   return tvb_captured_length(tvb);
 }
index ed151f96dafd6bcc5eaba94441758cad27cf9a4d..e8fb6ffebe9910dfb703f2105010bffcb0a6add3 100644 (file)
@@ -678,11 +678,11 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
     struct ieee_802_11_phdr phdr;
 
     /* We don't have any 802.11 metadata yet. */
+    memset(&phdr, 0, sizeof(phdr));
     phdr.fcs_len = -1;
     phdr.decrypted = FALSE;
     phdr.datapad = FALSE;
     phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-    phdr.presence_flags = 0;
 
     /* First add the IFG information, need to grab the info bit field here */
     vw_info = tvb_get_letohs(tvb, 20);
@@ -752,8 +752,7 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
     if ((vw_rflags & FLAGS_CHAN_HT) || (vw_rflags & FLAGS_CHAN_VHT)) {
         if (vw_rflags & FLAGS_CHAN_VHT) {
             phdr.phy = PHDR_802_11_PHY_11AC;
-            phdr.phy_info.info_11ac.presence_flags =
-                PHDR_802_11AC_HAS_SHORT_GI;
+            phdr.phy_info.info_11ac.has_short_gi = TRUE;
             phdr.phy_info.info_11ac.short_gi = ((vw_rflags & FLAGS_CHAN_SHORTGI) != 0);
             /*
              * XXX - this probably has only one user, so only one MCS index
@@ -769,12 +768,13 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
              * The code in wiretap/vwr.c doesn't seem to provide it.
              */
             phdr.phy = PHDR_802_11_PHY_11N;
-            phdr.phy_info.info_11n.presence_flags =
-                PHDR_802_11N_HAS_MCS_INDEX |
-                PHDR_802_11N_HAS_SHORT_GI |
-                PHDR_802_11N_HAS_GREENFIELD;
+            phdr.phy_info.info_11n.has_mcs_index = TRUE;
             phdr.phy_info.info_11n.mcs_index = mcs_index;
+
+            phdr.phy_info.info_11n.has_short_gi = TRUE;
             phdr.phy_info.info_11n.short_gi = ((vw_rflags & FLAGS_CHAN_SHORTGI) != 0);
+
+            phdr.phy_info.info_11n.has_greenfield = TRUE;
             phdr.phy_info.info_11n.greenfield = (plcp_type == PLCP_TYPE_GREENFIELD);
         }
         if (tap_tree) {
@@ -796,9 +796,8 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
          */
         if (vw_chanflags & CHAN_CCK) {
             phdr.phy = PHDR_802_11_PHY_11B;
-            phdr.phy_info.info_11b.presence_flags = 0;
         }
-        phdr.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
+        phdr.has_data_rate = TRUE;
         phdr.data_rate = tvb_get_letohs(tvb, offset-5) / 5;
         if (tap_tree) {
             proto_tree_add_uint_format_value(tap_tree, hf_radiotap_datarate,
@@ -809,7 +808,7 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
     col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%.1f", phyRate);
 
     dbm = (gint8) tvb_get_guint8(tvb, offset);
-    phdr.presence_flags |= PHDR_802_11_HAS_SIGNAL_DBM;
+    phdr.has_signal_dbm = TRUE;
     phdr.signal_dbm = dbm;
     col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm);
     if (tap_tree) {
@@ -1030,7 +1029,7 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
         vht_grp_id1 = tvb_get_guint8(tvb, offset);
         vht_grp_id2 = tvb_get_guint8(tvb, offset+1);
         vht_grp_id = ((vht_grp_id1 &0xF0) >> 4) + ((vht_grp_id2 &0x03) << 4);
-        phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_GROUP_ID;
+        phdr.phy_info.info_11ac.has_group_id = TRUE;
         phdr.phy_info.info_11ac.group_id = vht_grp_id;
         proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_grp_id,
             tvb, offset, 2, vht_grp_id, "VHT Group Id: %u ",vht_grp_id);
@@ -1046,7 +1045,7 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
             vht_su_partial_id1 = tvb_get_guint8(tvb,offset);
             vht_su_partial_id2 = tvb_get_guint8(tvb,offset+1);
             vht_su_partial_id = ((vht_su_partial_id1 &0xE0) >> 5) + ((vht_su_partial_id2 &0x3f) << 3);
-            phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_PARTIAL_AID;
+            phdr.phy_info.info_11ac.has_partial_aid = TRUE;
             phdr.phy_info.info_11ac.partial_aid = vht_su_partial_id;
             proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_su_partial_aid,
                 tvb, offset, 2, vht_su_partial_id, "VHT PARTIAL AID: %u ",vht_su_partial_id);
@@ -1176,7 +1175,7 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
         offset = offset + 1;
         vht_beamformed = tvb_get_guint8(tvb, offset);
         vht_beamformed = (vht_beamformed & 0x01);
-        phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_BEAMFORMED;
+        phdr.phy_info.info_11ac.has_beamformed = TRUE;
         phdr.phy_info.info_11ac.beamformed = vht_beamformed;
         proto_tree_add_uint_format(tap_tree, hf_radiotap_vht_beamformed,
             tvb, offset, 1, vht_beamformed, "VHT Beamformed: %u ",vht_beamformed);
index 32766d97d225f20a61a79bcbe43f0292d3c9d19d..8b343e4b221dc70a87ea4ccff53c49e7edb76ef4 100644 (file)
@@ -418,11 +418,11 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
   }
 
   /* We don't have any 802.11 metadata yet. */
+  memset(&phdr, 0, sizeof(phdr));
   phdr.fcs_len = 4; /* has an FCS */
   phdr.decrypted = FALSE;
   phdr.datapad = FALSE;
   phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-  phdr.presence_flags = 0;
 
   col_set_str(pinfo->cinfo, COL_PROTOCOL, "PEEKREMOTE");
   col_clear(pinfo->cinfo, COL_INFO);
@@ -446,24 +446,18 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
       if (header_size > 9)
         offset += (header_size - 9);
     } else {
-      phdr.presence_flags |=
-          PHDR_802_11_HAS_CHANNEL|
-          PHDR_802_11_HAS_SIGNAL_PERCENT|
-          PHDR_802_11_HAS_NOISE_PERCENT|
-          PHDR_802_11_HAS_SIGNAL_DBM|
-          PHDR_802_11_HAS_NOISE_DBM|
-          PHDR_802_11_HAS_TSF_TIMESTAMP;
       proto_tree_add_item(peekremote_tree, &hfi_peekremote_type, tvb, offset, 4, ENC_BIG_ENDIAN);
       offset += 4;
       mcs_index = tvb_get_ntohs(tvb, offset);
       proto_tree_add_item(peekremote_tree, &hfi_peekremote_mcs_index, tvb, offset, 2, ENC_BIG_ENDIAN);
       offset += 2;
+      phdr.has_channel = TRUE;
       phdr.channel = tvb_get_ntohs(tvb, offset);
       proto_tree_add_item(peekremote_tree, &hfi_peekremote_channel, tvb, offset, 2, ENC_BIG_ENDIAN);
       offset += 2;
       frequency = tvb_get_ntohl(tvb, offset);
       if (frequency != 0) {
-        phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+        phdr.has_frequency = TRUE;
         phdr.frequency = frequency;
       }
       proto_tree_add_item(peekremote_tree, &hfi_peekremote_frequency, tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -474,7 +468,6 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
       if (extflags & EXT_FLAG_802_11ac) {
         guint i;
         phdr.phy = PHDR_802_11_PHY_11AC;
-        phdr.phy_info.info_11ac.presence_flags = 0;
         /*
          * XXX - this probably has only one user, so only one MCS index
          * and only one NSS, but where's the NSS?
@@ -484,19 +477,23 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
         }
       } else {
         phdr.phy = PHDR_802_11_PHY_11N;
-        phdr.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_MCS_INDEX;
+        phdr.phy_info.info_11n.has_mcs_index = TRUE;
         phdr.phy_info.info_11n.mcs_index = mcs_index;
       }
       offset += dissect_peekremote_extflags(tvb, pinfo, peekremote_tree, offset);
+      phdr.has_signal_percent = TRUE;
       phdr.signal_percent = tvb_get_guint8(tvb, offset);
       proto_tree_add_item(peekremote_tree, &hfi_peekremote_signal_percent, tvb, offset, 1, ENC_NA);
       offset += 1;
+      phdr.has_noise_percent = TRUE;
       phdr.noise_percent = tvb_get_guint8(tvb, offset);
       proto_tree_add_item(peekremote_tree, &hfi_peekremote_noise_percent, tvb, offset, 1, ENC_NA);
       offset += 1;
+      phdr.has_signal_dbm = TRUE;
       phdr.signal_dbm = tvb_get_guint8(tvb, offset);
       proto_tree_add_item(peekremote_tree, &hfi_peekremote_signal_dbm, tvb, offset, 1, ENC_NA);
       offset += 1;
+      phdr.has_noise_dbm = TRUE;
       phdr.noise_dbm = tvb_get_guint8(tvb, offset);
       proto_tree_add_item(peekremote_tree, &hfi_peekremote_noise_dbm, tvb, offset, 1, ENC_NA);
       offset += 1;
@@ -523,6 +520,7 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
       offset += dissect_peekremote_flags(tvb, pinfo, peekremote_tree, offset);
       offset += dissect_peekremote_status(tvb, pinfo, peekremote_tree, offset);
       proto_tree_add_item(peekremote_tree, &hfi_peekremote_timestamp, tvb, offset, 8, ENC_BIG_ENDIAN);
+      phdr.has_tsf_timestamp = TRUE;
       phdr.tsf_timestamp = tvb_get_ntoh64(tvb, offset);
       offset += 8;
     }
@@ -550,6 +548,8 @@ dissect_peekremote_legacy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
   struct ieee_802_11_phdr phdr;
   guint8 signal_percent;
 
+  memset(&phdr, 0, sizeof(phdr));
+
   /*
    * Check whether this is peekremote-ng, and dissect it as such if it
    * is.
@@ -589,20 +589,19 @@ dissect_peekremote_legacy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
   }
   phdr.decrypted = FALSE;
   phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-  phdr.presence_flags =
-      PHDR_802_11_HAS_CHANNEL|
-      PHDR_802_11_HAS_DATA_RATE|
-      PHDR_802_11_HAS_SIGNAL_PERCENT|
-      PHDR_802_11_HAS_NOISE_PERCENT|
-      PHDR_802_11_HAS_SIGNAL_DBM|
-      PHDR_802_11_HAS_NOISE_DBM|
-      PHDR_802_11_HAS_TSF_TIMESTAMP;
+  phdr.has_channel = TRUE;
   phdr.channel = tvb_get_guint8(tvb, 17);
+  phdr.has_data_rate = TRUE;
   phdr.data_rate = tvb_get_guint8(tvb, 16);
+  phdr.has_signal_percent = TRUE;
   phdr.signal_percent = tvb_get_guint8(tvb, 18);
+  phdr.has_noise_percent = TRUE;
   phdr.noise_percent = tvb_get_guint8(tvb, 18);
+  phdr.has_signal_dbm = TRUE;
   phdr.signal_dbm = tvb_get_guint8(tvb, 0);
+  phdr.has_noise_dbm = TRUE;
   phdr.noise_dbm = tvb_get_guint8(tvb, 1);
+  phdr.has_tsf_timestamp = TRUE;
   phdr.tsf_timestamp = tvb_get_ntoh64(tvb, 8);
 
   return 20 + call_dissector_with_data(wlan_radio_handle, next_tvb, pinfo, tree, &phdr);
index f179b258f43f6c20af7657e196b0e2e80937ccf1..46a62b36cc2bf3f89e32b69dd31819a00da135a6 100644 (file)
@@ -477,7 +477,7 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
 
     tsft_raw = tvb_get_letoh64(tvb, offset);
     if (tsft_raw != 0) {
-        phdr->presence_flags |= PHDR_802_11_HAS_TSF_TIMESTAMP;
+        phdr->has_tsf_timestamp = TRUE;
         if (common_flags & DOT11_FLAG_TSF_TIMER_MS)
             phdr->tsf_timestamp = tsft_raw * 1000;
         else
@@ -496,7 +496,7 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
 
     rate_raw = tvb_get_letohs(tvb, ptvcursor_current_offset(csr));
     if (rate_raw != 0) {
-        phdr->presence_flags |= PHDR_802_11_HAS_DATA_RATE;
+        phdr->has_data_rate = TRUE;
         phdr->data_rate = rate_raw;
     }
     rate_kbps = rate_raw * 500;
@@ -512,11 +512,11 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
     if (common_frequency != 0) {
         gint calc_channel;
 
-        phdr->presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+        phdr->has_frequency = TRUE;
         phdr->frequency = common_frequency;
         calc_channel = ieee80211_mhz_to_chan(common_frequency);
         if (calc_channel != -1) {
-            phdr->presence_flags |= PHDR_802_11_HAS_CHANNEL;
+            phdr->has_channel = TRUE;
             phdr->channel = calc_channel;
         }
     }
@@ -527,14 +527,12 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
     g_free(chan_str);
     ptvcursor_advance(csr, 2);
 
+    memset(&phdr->phy_info, 0, sizeof(phdr->phy_info));
     chan_flags = tvb_get_letohs(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr));
     switch (chan_flags & IEEE80211_CHAN_ALLTURBO) {
 
     case IEEE80211_CHAN_FHSS:
         phdr->phy = PHDR_802_11_PHY_11_FHSS;
-        phdr->phy_info.info_11_fhss.presence_flags =
-            PHDR_802_11_FHSS_HAS_HOP_SET |
-            PHDR_802_11_FHSS_HAS_HOP_PATTERN;
         break;
 
     case IEEE80211_CHAN_DSSS:
@@ -543,37 +541,36 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
 
     case IEEE80211_CHAN_A:
         phdr->phy = PHDR_802_11_PHY_11A;
-        phdr->phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+        phdr->phy_info.info_11a.has_turbo_type = TRUE;
         phdr->phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_NORMAL;
         break;
 
     case IEEE80211_CHAN_B:
         phdr->phy = PHDR_802_11_PHY_11B;
-        phdr->phy_info.info_11b.presence_flags = 0;
         break;
 
     case IEEE80211_CHAN_PUREG:
         phdr->phy = PHDR_802_11_PHY_11G;
-        phdr->phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+        phdr->phy_info.info_11g.has_mode = TRUE;
         phdr->phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
         break;
 
     case IEEE80211_CHAN_G:
         phdr->phy = PHDR_802_11_PHY_11G;
-        phdr->phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+        phdr->phy_info.info_11g.has_mode = TRUE;
         phdr->phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
         break;
 
     case IEEE80211_CHAN_108A:
         phdr->phy = PHDR_802_11_PHY_11A;
-        phdr->phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+        phdr->phy_info.info_11a.has_turbo_type = TRUE;
         /* We assume non-STURBO is dynamic turbo */
         phdr->phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO;
         break;
 
     case IEEE80211_CHAN_108PUREG:
         phdr->phy = PHDR_802_11_PHY_11G;
-        phdr->phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+        phdr->phy_info.info_11g.has_mode = TRUE;
         phdr->phy_info.info_11g.mode = PHDR_802_11G_MODE_SUPER_G;
         break;
     }
@@ -590,11 +587,15 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
     ptvcursor_pop_subtree(csr);
 
 
-    if (phdr->phy == PHDR_802_11_PHY_11_FHSS)
+    if (phdr->phy == PHDR_802_11_PHY_11_FHSS) {
+        phdr->phy_info.info_11_fhss.has_hop_set = TRUE;
         phdr->phy_info.info_11_fhss.hop_set = tvb_get_guint8(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr));
+    }
     ptvcursor_add(csr, hf_80211_common_fhss_hopset, 1, ENC_LITTLE_ENDIAN);
-    if (phdr->phy == PHDR_802_11_PHY_11_FHSS)
+    if (phdr->phy == PHDR_802_11_PHY_11_FHSS) {
+        phdr->phy_info.info_11_fhss.has_hop_pattern = TRUE;
         phdr->phy_info.info_11_fhss.hop_pattern = tvb_get_guint8(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr));
+    }
     ptvcursor_add(csr, hf_80211_common_fhss_pattern, 1, ENC_LITTLE_ENDIAN);
 
     dbm_value = (gint8) tvb_get_guint8(tvb, ptvcursor_current_offset(csr));
@@ -606,7 +607,7 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
          * used for "don't have it", so we check for it as well.
          */
         col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm_value);
-        phdr->presence_flags |= PHDR_802_11_HAS_SIGNAL_DBM;
+        phdr->has_signal_dbm = TRUE;
         phdr->signal_dbm = dbm_value;
     }
     ptvcursor_add_invalid_check(csr, hf_80211_common_dbm_antsignal, 1, 0x80); /* -128 */
@@ -619,7 +620,7 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
          * have 0, presumably meaning it's incorrectly being used for
          * "don't have it", so we check for it as well.
          */
-        phdr->presence_flags |= PHDR_802_11_HAS_NOISE_DBM;
+        phdr->has_noise_dbm = TRUE;
         phdr->noise_dbm = dbm_value;
     }
     ptvcursor_add_invalid_check(csr, hf_80211_common_dbm_antnoise, 1, 0x80);
@@ -654,7 +655,8 @@ dissect_80211n_mac(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int
     csr = ptvcursor_new(ftree, tvb, offset);
 
     flags = tvb_get_letohl(tvb, ptvcursor_current_offset(csr));
-    phdr->phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_SHORT_GI|PHDR_802_11N_HAS_GREENFIELD;
+    phdr->phy_info.info_11n.has_short_gi = TRUE;
+    phdr->phy_info.info_11n.has_greenfield = TRUE;
     phdr->phy_info.info_11n.short_gi = ((flags & DOT11N_FLAG_SHORT_GI) != 0);
     phdr->phy_info.info_11n.greenfield = ((flags & DOT11N_FLAG_GREENFIELD) != 0);
     ptvcursor_add_with_subtree(csr, hf_80211n_mac_flags, 4, ENC_LITTLE_ENDIAN,
@@ -706,13 +708,13 @@ dissect_80211n_mac_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
 
     mcs = tvb_get_guint8(tvb, ptvcursor_current_offset(csr));
     if (mcs != 255) {
-        phdr->phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_MCS_INDEX;
+        phdr->phy_info.info_11n.has_mcs_index = TRUE;
         phdr->phy_info.info_11n.mcs_index = mcs;
     }
     ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_mcs, 1, 255);
 
     ness = tvb_get_guint8(tvb, ptvcursor_current_offset(csr));
-    phdr->phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_NESS;
+    phdr->phy_info.info_11n.has_ness = TRUE;
     phdr->phy_info.info_11n.ness = ness;
     ti = ptvcursor_add(csr, hf_80211n_mac_phy_num_streams, 1, ENC_LITTLE_ENDIAN);
     if (tvb_get_guint8(tvb, ptvcursor_current_offset(csr) - 1) == 0)
@@ -886,7 +888,6 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
     phdr.decrypted = FALSE;
     phdr.datapad = FALSE;
     phdr.phy = PHDR_802_11_PHY_UNKNOWN;
-    phdr.presence_flags = 0;
 
     while (tot_len > 0) {
         data_type = tvb_get_letohs(tvb, offset);
index 1d99fbc051f35bef5dfe0c9d65c4e4dcae9d82d5..ec89dda8347ef6cf8913685f2847e82c6476de50 100644 (file)
@@ -156,20 +156,16 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
 
        case MEDIUM_WIFI :
                phdr->pkt_encap = WTAP_ENCAP_IEEE_802_11_WITH_RADIO;
+               memset(&phdr->pseudo_header.ieee_802_11, 0, sizeof(phdr->pseudo_header.ieee_802_11));
                phdr->pseudo_header.ieee_802_11.fcs_len = -1; /* Unknown */
                phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
                phdr->pseudo_header.ieee_802_11.datapad = FALSE;
                phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
-               phdr->pseudo_header.ieee_802_11.presence_flags =
-                   PHDR_802_11_HAS_CHANNEL |
-                   PHDR_802_11_HAS_DATA_RATE |
-                   PHDR_802_11_HAS_SIGNAL_PERCENT;
                switch (cv_hdr.band) {
 
                case BAND_11A:
                        phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11A;
-                       phdr->pseudo_header.ieee_802_11.phy_info.info_11a.presence_flags =
-                           PHDR_802_11A_HAS_TURBO_TYPE;
+                       phdr->pseudo_header.ieee_802_11.phy_info.info_11a.has_turbo_type = TRUE;
                        phdr->pseudo_header.ieee_802_11.phy_info.info_11a.turbo_type =
                            PHDR_802_11A_TURBO_TYPE_NORMAL;
                        frequency = ieee80211_chan_to_mhz(cv_hdr.channel, FALSE);
@@ -177,14 +173,12 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
 
                case BAND_11B:
                        phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11B;
-                       phdr->pseudo_header.ieee_802_11.phy_info.info_11b.presence_flags = 0;
                        frequency = ieee80211_chan_to_mhz(cv_hdr.channel, TRUE);
                        break;
 
                case BAND_11G:
                        phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11G;
-                       phdr->pseudo_header.ieee_802_11.phy_info.info_11g.presence_flags =
-                           PHDR_802_11G_HAS_MODE;
+                       phdr->pseudo_header.ieee_802_11.phy_info.info_11g.has_mode = TRUE;
                        phdr->pseudo_header.ieee_802_11.phy_info.info_11g.mode =
                            PHDR_802_11G_MODE_NORMAL;
                        frequency = ieee80211_chan_to_mhz(cv_hdr.channel, TRUE);
@@ -192,8 +186,7 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
 
                case BAND_11A_TURBO:
                        phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11A;
-                       phdr->pseudo_header.ieee_802_11.phy_info.info_11a.presence_flags =
-                           PHDR_802_11A_HAS_TURBO_TYPE;
+                       phdr->pseudo_header.ieee_802_11.phy_info.info_11a.has_turbo_type = TRUE;
                        phdr->pseudo_header.ieee_802_11.phy_info.info_11a.turbo_type =
                            PHDR_802_11A_TURBO_TYPE_TURBO;
                        frequency = ieee80211_chan_to_mhz(cv_hdr.channel, FALSE);
@@ -201,8 +194,7 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
 
                case BAND_SUPERG:
                        phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11G;
-                       phdr->pseudo_header.ieee_802_11.phy_info.info_11g.presence_flags =
-                           PHDR_802_11G_HAS_MODE;
+                       phdr->pseudo_header.ieee_802_11.phy_info.info_11g.has_mode = TRUE;
                        phdr->pseudo_header.ieee_802_11.phy_info.info_11g.mode =
                            PHDR_802_11G_MODE_SUPER_G;
                        frequency = ieee80211_chan_to_mhz(cv_hdr.channel, TRUE);
@@ -210,15 +202,11 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
 
                case BAND_11N_5GHZ:
                        phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11N;
-                       phdr->pseudo_header.ieee_802_11.phy_info.info_11n.presence_flags =
-                           0;
                        frequency = ieee80211_chan_to_mhz(cv_hdr.channel, FALSE);
                        break;
 
                case BAND_11N_2_4GHZ:
                        phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11N;
-                       phdr->pseudo_header.ieee_802_11.phy_info.info_11n.presence_flags =
-                           0;
                        frequency = ieee80211_chan_to_mhz(cv_hdr.channel, TRUE);
                        break;
 
@@ -236,13 +224,17 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
                        break;
                }
                if (frequency != 0) {
-                       phdr->pseudo_header.ieee_802_11.presence_flags |=
-                           PHDR_802_11_HAS_FREQUENCY;
+                       phdr->pseudo_header.ieee_802_11.has_frequency = TRUE;
                        phdr->pseudo_header.ieee_802_11.frequency = frequency;
                }
+               phdr->pseudo_header.ieee_802_11.has_channel = TRUE;
                phdr->pseudo_header.ieee_802_11.channel = cv_hdr.channel;
+
+               phdr->pseudo_header.ieee_802_11.has_data_rate = TRUE;
                phdr->pseudo_header.ieee_802_11.data_rate =
                    cv_hdr.rate | (cv_hdr.direction << 8);
+
+               phdr->pseudo_header.ieee_802_11.has_signal_percent = TRUE;
                phdr->pseudo_header.ieee_802_11.signal_percent = cv_hdr.signal_level_percent;
 
                /*
@@ -257,13 +249,11 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
                 */
                if (cv_hdr.signal_level_dbm != 0) {
                        phdr->pseudo_header.ieee_802_11.signal_dbm = -cv_hdr.signal_level_dbm;
-                       phdr->pseudo_header.ieee_802_11.presence_flags |=
-                           PHDR_802_11_HAS_SIGNAL_DBM;
+                       phdr->pseudo_header.ieee_802_11.has_signal_dbm = TRUE;
                }
                if (cv_hdr.noise_level != 0) {
                        phdr->pseudo_header.ieee_802_11.noise_dbm = -cv_hdr.noise_level;
-                       phdr->pseudo_header.ieee_802_11.presence_flags |=
-                           PHDR_802_11_HAS_NOISE_DBM;
+                       phdr->pseudo_header.ieee_802_11.has_noise_dbm = TRUE;
                }
                break;
 
@@ -455,7 +445,7 @@ static gboolean commview_dump(wtap_dumper *wdh,
                         * If we don't know whether it's turbo, say it's
                         * not.
                         */
-                       if (!(phdr->pseudo_header.ieee_802_11.phy_info.info_11a.presence_flags & PHDR_802_11A_HAS_TURBO_TYPE) ||
+                       if (!phdr->pseudo_header.ieee_802_11.phy_info.info_11a.has_turbo_type ||
                            phdr->pseudo_header.ieee_802_11.phy_info.info_11a.turbo_type == PHDR_802_11A_TURBO_TYPE_NORMAL)
                                cv_hdr.band = BAND_11A;
                        else
@@ -471,7 +461,7 @@ static gboolean commview_dump(wtap_dumper *wdh,
                         * If we don't know whether it's Super G, say it's
                         * not.
                         */
-                       if (!(phdr->pseudo_header.ieee_802_11.phy_info.info_11g.presence_flags & PHDR_802_11G_HAS_MODE))
+                       if (!phdr->pseudo_header.ieee_802_11.phy_info.info_11g.has_mode)
                                cv_hdr.band = BAND_11G;
                        else {
                                switch (phdr->pseudo_header.ieee_802_11.phy_info.info_11g.mode) {
@@ -495,7 +485,7 @@ static gboolean commview_dump(wtap_dumper *wdh,
                        /*
                         * Pick the band based on the frequency.
                         */
-                       if (phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_802_11_HAS_FREQUENCY) {
+                       if (phdr->pseudo_header.ieee_802_11.has_frequency) {
                                if (phdr->pseudo_header.ieee_802_11.frequency > 2484) {
                                        /* 5 GHz band */
                                        cv_hdr.band = BAND_11N_5GHZ;
@@ -518,29 +508,29 @@ static gboolean commview_dump(wtap_dumper *wdh,
                        break;
                }
                cv_hdr.channel =
-                   (phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_802_11_HAS_CHANNEL) ?
-                    phdr->pseudo_header.ieee_802_11.channel :
-                    0;
+                   phdr->pseudo_header.ieee_802_11.has_channel ?
+                     phdr->pseudo_header.ieee_802_11.channel :
+                     0;
                cv_hdr.rate =
-                   (phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_802_11_HAS_DATA_RATE) ?
-                    (guint8)(phdr->pseudo_header.ieee_802_11.data_rate & 0xFF) :
-                    0;
+                   phdr->pseudo_header.ieee_802_11.has_data_rate ?
+                     (guint8)(phdr->pseudo_header.ieee_802_11.data_rate & 0xFF) :
+                     0;
                cv_hdr.direction =
-                   (phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_802_11_HAS_DATA_RATE) ?
-                    (guint8)((phdr->pseudo_header.ieee_802_11.data_rate >> 8) & 0xFF) :
-                    0;
+                   phdr->pseudo_header.ieee_802_11.has_data_rate ?
+                     (guint8)((phdr->pseudo_header.ieee_802_11.data_rate >> 8) & 0xFF) :
+                     0;
                cv_hdr.signal_level_percent =
-                   (phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_802_11_HAS_SIGNAL_PERCENT) ?
-                    phdr->pseudo_header.ieee_802_11.signal_percent :
-                    0;
+                   phdr->pseudo_header.ieee_802_11.has_signal_percent ?
+                     phdr->pseudo_header.ieee_802_11.signal_percent :
+                     0;
                cv_hdr.signal_level_dbm =
-                   (phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_802_11_HAS_SIGNAL_DBM) ?
-                    -phdr->pseudo_header.ieee_802_11.signal_dbm :
-                    0;
+                   phdr->pseudo_header.ieee_802_11.has_signal_dbm ?
+                     -phdr->pseudo_header.ieee_802_11.signal_dbm :
+                     0;
                cv_hdr.noise_level =
-                   (phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_802_11_HAS_NOISE_DBM) ?
-                    -phdr->pseudo_header.ieee_802_11.noise_dbm :
-                    0;
+                   phdr->pseudo_header.ieee_802_11.has_noise_dbm ?
+                     -phdr->pseudo_header.ieee_802_11.noise_dbm :
+                     0;
                break;
 
        case WTAP_ENCAP_TOKEN_RING :
index b792c2ddfd65e7bceeb4f42c5530592456c4a0bf..a7e2ea6eabfc9de92e0adcc4ab891d21fdf9006d 100644 (file)
@@ -428,11 +428,11 @@ netmon_set_pseudo_header_info(struct wtap_pkthdr *phdr, Buffer *buf)
                 *  do not have an FCS).
                 * An "FCS length" of -2 means "NetMon weirdness".
                 */
+               memset(&phdr->pseudo_header.ieee_802_11, 0, sizeof(phdr->pseudo_header.ieee_802_11));
                phdr->pseudo_header.ieee_802_11.fcs_len = -2;
                phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
                phdr->pseudo_header.ieee_802_11.datapad = FALSE;
                phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
-               phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* radio data is in the packet data */
                break;
        }
 }
index 93e9005728e2480f212d7e9bd6418facd1f81aea..9f2a45accbec524f80e032dfe0ff8f0af1afcbb2 100644 (file)
@@ -374,11 +374,11 @@ read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header
         pseudo_header->eth.fcs_len = 0;
         break;
     case WTAP_ENCAP_IEEE_802_11_WITH_RADIO:
+        memset(&pseudo_header->ieee_802_11, 0, sizeof(pseudo_header->ieee_802_11));
         pseudo_header->ieee_802_11.fcs_len = 0;
         pseudo_header->ieee_802_11.decrypted = FALSE;
         pseudo_header->ieee_802_11.datapad = FALSE;
         pseudo_header->ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
-        pseudo_header->ieee_802_11.presence_flags = 0;
         /* Updated below */
         break;
     }
@@ -404,16 +404,14 @@ read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header
             if (!wtap_read_bytes(fh, &wireless_header, sizeof wireless_header,
                                  err, err_info))
                 return -1;
-            /* update the pseudo header */
-            pseudo_header->ieee_802_11.presence_flags |=
-                PHDR_802_11_HAS_CHANNEL |
-                PHDR_802_11_HAS_DATA_RATE |
-                PHDR_802_11_HAS_SIGNAL_PERCENT;
             /* set decryption status */
             /* XXX - what other bits are there in conditions? */
             pseudo_header->ieee_802_11.decrypted = (wireless_header.conditions & WIRELESS_WEP_SUCCESS) != 0;
+            pseudo_header->ieee_802_11.has_channel = TRUE;
             pseudo_header->ieee_802_11.channel = wireless_header.frequency;
+            pseudo_header->ieee_802_11.has_data_rate = TRUE;
             pseudo_header->ieee_802_11.data_rate = wireless_header.rate;
+            pseudo_header->ieee_802_11.has_signal_percent = TRUE;
             pseudo_header->ieee_802_11.signal_percent = wireless_header.strengthPercent;
             offset += (int)sizeof wireless_header;
             break;
index ab23bd62c79c5d1decae939c2a7eac26f99bcf78..8d09a0e335572bcee1c903a64c53f68af4d94182 100644 (file)
@@ -1230,6 +1230,7 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
                         * Ken also says that xxx[11] is 0x5 when the
                         * packet is WEP-encrypted.
                         */
+                       memset(&phdr->pseudo_header.ieee_802_11, 0, sizeof(phdr->pseudo_header.ieee_802_11));
                        if (hdr.hdr_2_x.xxx[2] == 0xff &&
                            hdr.hdr_2_x.xxx[3] == 0xff) {
                                /*
@@ -1259,31 +1260,28 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
                         * type, frequency, 11n/11ac information,
                         * etc.?
                         */
+                       phdr->pseudo_header.ieee_802_11.has_channel = TRUE;
                        phdr->pseudo_header.ieee_802_11.channel =
                            hdr.hdr_2_x.xxx[12];
+
+                       phdr->pseudo_header.ieee_802_11.has_data_rate = TRUE;
                        phdr->pseudo_header.ieee_802_11.data_rate =
                            hdr.hdr_2_x.xxx[13];
+
+                       phdr->pseudo_header.ieee_802_11.has_signal_percent = TRUE;
                        phdr->pseudo_header.ieee_802_11.signal_percent =
                            hdr.hdr_2_x.xxx[14];
+
                        /*
                         * According to Ken Mann, at least in the captures
                         * he's seen, xxx[15] is the noise level, which
                         * is either 0xFF meaning "none reported" or a value
                         * from 0x00 to 0x7F for 0 to 100%.
                         */
-                       if (hdr.hdr_2_x.xxx[15] == 0xFF) {
-                               phdr->pseudo_header.ieee_802_11.presence_flags =
-                                   PHDR_802_11_HAS_CHANNEL |
-                                   PHDR_802_11_HAS_DATA_RATE |
-                                   PHDR_802_11_HAS_SIGNAL_PERCENT;
-                       } else {
+                       if (hdr.hdr_2_x.xxx[15] != 0xFF) {
+                               phdr->pseudo_header.ieee_802_11.has_noise_percent = TRUE;
                                phdr->pseudo_header.ieee_802_11.noise_percent =
                                    hdr.hdr_2_x.xxx[15]*100/127;
-                               phdr->pseudo_header.ieee_802_11.presence_flags =
-                                   PHDR_802_11_HAS_CHANNEL |
-                                   PHDR_802_11_HAS_DATA_RATE |
-                                   PHDR_802_11_HAS_SIGNAL_PERCENT |
-                                   PHDR_802_11_HAS_NOISE_PERCENT;
                        }
                        break;
 
@@ -1962,21 +1960,21 @@ netxray_dump_2_0(wtap_dumper *wdh,
 
        case WTAP_ENCAP_IEEE_802_11_WITH_RADIO:
                rec_hdr.xxx[12] =
-                   (pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_CHANNEL) ?
-                    pseudo_header->ieee_802_11.channel :
-                    0;
+                   pseudo_header->ieee_802_11.has_channel ?
+                     pseudo_header->ieee_802_11.channel :
+                     0;
                rec_hdr.xxx[13] =
-                   (pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_DATA_RATE) ?
-                    (guint8)pseudo_header->ieee_802_11.data_rate :
-                    0;
+                   pseudo_header->ieee_802_11.has_data_rate ?
+                     (guint8)pseudo_header->ieee_802_11.data_rate :
+                     0;
                rec_hdr.xxx[14] =
-                   (pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_SIGNAL_PERCENT) ?
-                    pseudo_header->ieee_802_11.signal_percent :
-                    0;
+                   pseudo_header->ieee_802_11.has_signal_percent ?
+                     pseudo_header->ieee_802_11.signal_percent :
+                     0;
                rec_hdr.xxx[15] =
-                   (pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_NOISE_PERCENT) ?
-                    pseudo_header->ieee_802_11.noise_percent*127/100 :
-                    0xFF;
+                   pseudo_header->ieee_802_11.has_noise_percent ?
+                     pseudo_header->ieee_802_11.noise_percent*127/100 :
+                     0xFF;
                break;
 
        case WTAP_ENCAP_PPP_WITH_PHDR:
index f9ecc8db93027d67afe7dfd410674295534ca3ac..2ae777e38004498fe3fcd6dd6282aee205d92dcb 100644 (file)
@@ -1607,10 +1607,10 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                 * XXX - in pcap-ng, there *could* be a packet option
                 * indicating the FCS length.
                 */
+               memset(&phdr->pseudo_header.ieee_802_11, 0, sizeof(phdr->pseudo_header.ieee_802_11));
                phdr->pseudo_header.ieee_802_11.fcs_len = -1;
                phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
                phdr->pseudo_header.ieee_802_11.datapad = FALSE;
-               phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* absent or supplied in the packet data */
                break;
 
        case WTAP_ENCAP_IRDA:
index bb147f1a7ae3d31215c23ffb70c2f26a69bb8465..79c294c266e0d8d5e11591745a4771e98047dd78 100644 (file)
@@ -448,14 +448,11 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh,
        switch (wth->file_encap) {
 
        case WTAP_ENCAP_IEEE_802_11_WITH_RADIO:
+               memset(&phdr->pseudo_header.ieee_802_11, 0, sizeof(phdr->pseudo_header.ieee_802_11));
                phdr->pseudo_header.ieee_802_11.fcs_len = 0;            /* no FCS */
                phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
                phdr->pseudo_header.ieee_802_11.datapad = FALSE;
                phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
-               phdr->pseudo_header.ieee_802_11.presence_flags =
-                   PHDR_802_11_HAS_DATA_RATE |
-                   PHDR_802_11_HAS_CHANNEL |
-                   PHDR_802_11_HAS_SIGNAL_PERCENT;
 
                /*
                 * Now process the radio information pseudo-header.
@@ -490,8 +487,13 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh,
                if (!wtap_read_bytes(fh, radio_info, RADIO_INFO_SIZE, err, err_info))
                        return -1;
 
+               phdr->pseudo_header.ieee_802_11.has_data_rate = TRUE;
                phdr->pseudo_header.ieee_802_11.data_rate = radio_info[0];
+
+               phdr->pseudo_header.ieee_802_11.has_channel = TRUE;
                phdr->pseudo_header.ieee_802_11.channel = radio_info[1];
+
+               phdr->pseudo_header.ieee_802_11.has_signal_percent = TRUE;
                phdr->pseudo_header.ieee_802_11.signal_percent = radio_info[2];
 
                /*
index 1c1426fcf519b7614e0e86df5ac96374e05624ae..24eaad1406076c5b3ddcff4ca545248cc4d7e041 100644 (file)
@@ -441,13 +441,11 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
 
     timestamp.upper = 0;
     timestamp.lower = 0;
-    /* Shouldn't be necessary, but squelches a compiler warning. */
     memset(&ieee_802_11, 0, sizeof ieee_802_11);
     ieee_802_11.fcs_len = -1; /* Unknown */
     ieee_802_11.decrypted = FALSE;
     ieee_802_11.datapad = FALSE;
     ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
-    ieee_802_11.presence_flags = 0;
 
     /* Extract the fields from the packet header */
     do {
@@ -503,7 +501,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
             break;
 
         case TAG_PEEKTAGGED_CHANNEL:
-            ieee_802_11.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+            ieee_802_11.has_channel = TRUE;
             ieee_802_11.channel = pletoh32(&tag_value[2]);
             break;
 
@@ -513,22 +511,22 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
             break;
 
         case TAG_PEEKTAGGED_SIGNAL_PERC:
-            ieee_802_11.presence_flags |= PHDR_802_11_HAS_SIGNAL_PERCENT;
+            ieee_802_11.has_signal_percent = TRUE;
             ieee_802_11.signal_percent = pletoh32(&tag_value[2]);
             break;
 
         case TAG_PEEKTAGGED_SIGNAL_DBM:
-            ieee_802_11.presence_flags |= PHDR_802_11_HAS_SIGNAL_DBM;
+            ieee_802_11.has_signal_dbm = TRUE;
             ieee_802_11.signal_dbm = pletoh32(&tag_value[2]);
             break;
 
         case TAG_PEEKTAGGED_NOISE_PERC:
-            ieee_802_11.presence_flags |= PHDR_802_11_HAS_NOISE_PERCENT;
+            ieee_802_11.has_noise_percent = TRUE;
             ieee_802_11.noise_percent = pletoh32(&tag_value[2]);
             break;
 
         case TAG_PEEKTAGGED_NOISE_DBM:
-            ieee_802_11.presence_flags |= PHDR_802_11_HAS_NOISE_DBM;
+            ieee_802_11.has_noise_dbm = TRUE;
             ieee_802_11.noise_dbm = pletoh32(&tag_value[2]);
             break;
 
@@ -541,7 +539,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
 
         case TAG_PEEKTAGGED_CENTER_FREQUENCY:
             /* XXX - also seen in an EtherPeek capture; value unknown */
-            ieee_802_11.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+            ieee_802_11.has_frequency = TRUE;
             ieee_802_11.frequency = pletoh32(&tag_value[2]);
             break;
 
@@ -613,7 +611,6 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
             ext_flags = pletoh32(&tag_value[2]);
             if (ext_flags & EXT_FLAG_802_11ac) {
                 ieee_802_11.phy = PHDR_802_11_PHY_11AC;
-                ieee_802_11.phy_info.info_11ac.presence_flags = 0;
                 /*
                  * XXX - this probably has only one user, so only
                  * one MCS index and only one NSS, but where's the
@@ -625,12 +622,12 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
                 switch (ext_flags & EXT_FLAGS_GI) {
 
                 case EXT_FLAG_HALF_GI:
-                    ieee_802_11.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_SHORT_GI;
+                    ieee_802_11.phy_info.info_11ac.has_short_gi = TRUE;
                     ieee_802_11.phy_info.info_11ac.short_gi = 1;
                     break;
 
                 case EXT_FLAG_FULL_GI:
-                    ieee_802_11.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_SHORT_GI;
+                    ieee_802_11.phy_info.info_11ac.has_short_gi = TRUE;
                     ieee_802_11.phy_info.info_11ac.short_gi = 0;
                     break;
 
@@ -643,40 +640,39 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
                 switch (ext_flags & EXT_FLAGS_BANDWIDTH) {
 
                 case 0:
-                    ieee_802_11.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_BANDWIDTH;
+                    ieee_802_11.phy_info.info_11n.has_bandwidth = TRUE;
                     ieee_802_11.phy_info.info_11n.bandwidth = PHDR_802_11_BANDWIDTH_20_MHZ;
                     break;
 
                 case EXT_FLAG_20_MHZ_LOWER:
-                    ieee_802_11.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_BANDWIDTH;
+                    ieee_802_11.phy_info.info_11n.has_bandwidth = TRUE;
                     ieee_802_11.phy_info.info_11n.bandwidth = PHDR_802_11_BANDWIDTH_20_20L;
                     break;
 
                 case EXT_FLAG_20_MHZ_UPPER:
-                    ieee_802_11.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_BANDWIDTH;
+                    ieee_802_11.phy_info.info_11n.has_bandwidth = TRUE;
                     ieee_802_11.phy_info.info_11n.bandwidth = PHDR_802_11_BANDWIDTH_20_20U;
                     break;
 
                 case EXT_FLAG_40_MHZ:
-                    ieee_802_11.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_BANDWIDTH;
+                    ieee_802_11.phy_info.info_11n.has_bandwidth = TRUE;
                     ieee_802_11.phy_info.info_11n.bandwidth = PHDR_802_11_BANDWIDTH_40_MHZ;
                     break;
 
                 default:
                     /* Mutually exclusive flags set */
-                    ieee_802_11.phy_info.info_11n.presence_flags = 0;
                     break;
                 }
 
                 switch (ext_flags & EXT_FLAGS_GI) {
 
                 case EXT_FLAG_HALF_GI:
-                    ieee_802_11.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_SHORT_GI;
+                    ieee_802_11.phy_info.info_11n.has_short_gi = TRUE;
                     ieee_802_11.phy_info.info_11n.short_gi = 1;
                     break;
 
                 case EXT_FLAG_FULL_GI:
-                    ieee_802_11.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_SHORT_GI;
+                    ieee_802_11.phy_info.info_11n.has_short_gi = TRUE;
                     ieee_802_11.phy_info.info_11n.short_gi = 0;
                     break;
 
@@ -753,27 +749,23 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
                  * XXX - what about 11ac?
                  */
                 if (!(ext_flags & EXT_FLAG_802_11ac)) {
-                    ieee_802_11.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_MCS_INDEX;
+                    ieee_802_11.phy_info.info_11n.has_mcs_index = TRUE;
                     ieee_802_11.phy_info.info_11n.mcs_index = data_rate_or_mcs_index;
                 }
             } else {
                 /* It's a data rate. */
-                ieee_802_11.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
+                ieee_802_11.has_data_rate = TRUE;
                 ieee_802_11.data_rate = data_rate_or_mcs_index;
             }
         }
-        switch (ieee_802_11.presence_flags & (PHDR_802_11_HAS_FREQUENCY|PHDR_802_11_HAS_CHANNEL)) {
-
-        case PHDR_802_11_HAS_FREQUENCY:
+        if (ieee_802_11.has_frequency && !ieee_802_11.has_channel) {
             /* Frequency, but no channel; try to calculate the channel. */
             channel = ieee80211_mhz_to_chan(ieee_802_11.frequency);
             if (channel != -1) {
-                ieee_802_11.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+                ieee_802_11.has_channel = TRUE;
                 ieee_802_11.channel = channel;
             }
-            break;
-
-        case PHDR_802_11_HAS_CHANNEL:
+        } else if (ieee_802_11.has_channel && !ieee_802_11.has_frequency) {
             /*
              * If it's 11 legacy DHSS, 11b, or 11g, it's 2.4 GHz,
              * so we can calculate the frequency.
@@ -799,10 +791,9 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
                 break;
             }
             if (frequency != 0) {
-                ieee_802_11.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+                ieee_802_11.has_frequency = TRUE;
                 ieee_802_11.frequency = frequency;
             }
-            break;
         }
         phdr->pseudo_header.ieee_802_11 = ieee_802_11;
         if (peektagged->has_fcs)
index 1fcfada8fe6bd96a8cb29c6472686b3599b70e30..da88bb4c51f0b24a6f28501ca74eb1eede791091 100644 (file)
@@ -738,16 +738,16 @@ snoop_read_shomiti_wireless_pseudoheader(FILE_T fh,
        if (file_seek(fh, rsize, SEEK_CUR, err) == -1)
                return FALSE;
 
+       memset(&pseudo_header->ieee_802_11, 0, sizeof(pseudo_header->ieee_802_11));
        pseudo_header->ieee_802_11.fcs_len = 4;
        pseudo_header->ieee_802_11.decrypted = FALSE;
        pseudo_header->ieee_802_11.datapad = FALSE;
        pseudo_header->ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
-       pseudo_header->ieee_802_11.presence_flags =
-           PHDR_802_11_HAS_CHANNEL |
-           PHDR_802_11_HAS_DATA_RATE |
-           PHDR_802_11_HAS_SIGNAL_PERCENT;
+       pseudo_header->ieee_802_11.has_channel = TRUE;
        pseudo_header->ieee_802_11.channel = whdr.channel;
+       pseudo_header->ieee_802_11.has_data_rate = TRUE;
        pseudo_header->ieee_802_11.data_rate = whdr.rate;
+       pseudo_header->ieee_802_11.has_signal_percent = TRUE;
        pseudo_header->ieee_802_11.signal_percent = whdr.signal;
 
        /* add back the header and don't forget the pad as well */
index fb4702a29cfe756f23ac3c1d43da7115e5ea2761..df122fd3ade067158a2b6a70e21494834b0863a6 100644 (file)
@@ -581,47 +581,37 @@ struct p2p_phdr {
  * 802.11 legacy FHSS.
  */
 struct ieee_802_11_fhss {
-    guint32  presence_flags; /* Which of this information is present? */
+    guint    has_hop_set:1;
+    guint    has_hop_pattern:1;
+    guint    has_hop_index:1;
+
     guint8   hop_set;        /* Hop set */
     guint8   hop_pattern;    /* Hop pattern */
     guint8   hop_index;      /* Hop index */
 };
 
-/*
- * Presence flags.
- */
-#define PHDR_802_11_FHSS_HAS_HOP_SET      0x0000001
-#define PHDR_802_11_FHSS_HAS_HOP_PATTERN  0x0000002
-#define PHDR_802_11_FHSS_HAS_HOP_INDEX    0x0000004
-
 /*
  * 802.11b.
  */
 struct ieee_802_11b {
-    guint32  presence_flags; /* Which of this information is present? */
+    /* Which of this information is present? */
+    guint    has_short_preamble:1;
+
     gboolean short_preamble; /* Short preamble */
 };
 
-/*
- * Presence flags.
- */
-#define PHDR_802_11B_HAS_SHORT_PREAMBLE  0x0000001  /* Short preamble */
-
 /*
  * 802.11a.
  */
 struct ieee_802_11a {
-    guint32  presence_flags; /* Which of this information is present? */
+    /* Which of this information is present? */
+    guint    has_channel_type:1;
+    guint    has_turbo_type:1;
+
     guint    channel_type:2;
     guint    turbo_type:2;
 };
 
-/*
- * Presence flags.
- */
-#define PHDR_802_11A_HAS_CHANNEL_TYPE  0x0000001  /* Normal, half-clocked, quarter-clocked */
-#define PHDR_802_11A_HAS_TURBO_TYPE    0x0000002  /* Normal, turbo, "static turbo" */
-
 /*
  * Channel type values.
  */
@@ -646,17 +636,14 @@ struct ieee_802_11a {
  * 802.11g.
  */
 struct ieee_802_11g {
-    guint32  presence_flags; /* Which of this information is present? */
+    /* Which of this information is present? */
+    guint    has_short_preamble:1;
+    guint    has_mode:1;
+
     gboolean short_preamble; /* Short preamble */
     guint32  mode;           /* Various proprietary extensions */
 };
 
-/*
- * Presence flags.
- */
-#define PHDR_802_11G_HAS_SHORT_PREAMBLE  0x0000001  /* Short preamble */
-#define PHDR_802_11G_HAS_MODE            0x0000002  /* Proprietary extensions */
-
 /*
  * Mode values.
  */
@@ -667,7 +654,15 @@ struct ieee_802_11g {
  * 802.11n.
  */
 struct ieee_802_11n {
-    guint32  presence_flags; /* Which of this information is present? */
+    /* Which of this information is present? */
+    guint    has_mcs_index:1;
+    guint    has_bandwidth:1;
+    guint    has_short_gi:1;
+    guint    has_greenfield:1;
+    guint    has_fec:1;
+    guint    has_stbc_streams:1;
+    guint    has_ness:1;
+
     guint16  mcs_index;      /* MCS index */
     guint    bandwidth;      /* Bandwidth = 20 MHz, 40 MHz, etc. */
     guint    short_gi:1;     /* True for short guard interval */
@@ -677,17 +672,6 @@ struct ieee_802_11n {
     guint    ness;           /* Number of extension spatial streams */
 };
 
-/*
- * Presence flags.
- */
-#define PHDR_802_11N_HAS_MCS_INDEX      0x00000001 /* mcs */
-#define PHDR_802_11N_HAS_BANDWIDTH      0x00000002 /* bandwidth */
-#define PHDR_802_11N_HAS_SHORT_GI       0x00000004 /* short_gi */
-#define PHDR_802_11N_HAS_GREENFIELD     0x00000008 /* greenfield */
-#define PHDR_802_11N_HAS_FEC            0x00000010 /* fec */
-#define PHDR_802_11N_HAS_STBC_STREAMS   0x00000020 /* stbc_streams */
-#define PHDR_802_11N_HAS_NESS           0x00000040 /* ness */
-
 /*
  * Bandwidth values; used for both 11n and 11ac.
  */
@@ -722,7 +706,18 @@ struct ieee_802_11n {
  * 802.11ac.
  */
 struct ieee_802_11ac {
-    guint32  presence_flags; /* Which of this information is present? */
+    /* Which of this information is present? */
+    guint    has_stbc:1;
+    guint    has_txop_ps_not_allowed:1;
+    guint    has_short_gi:1;
+    guint    has_short_gi_nsym_disambig:1;
+    guint    has_ldpc_extra_ofdm_symbol:1;
+    guint    has_beamformed:1;
+    guint    has_bandwidth:1;
+    guint    has_fec:1;
+    guint    has_group_id:1;
+    guint    has_partial_aid:1;
+
     guint    stbc:1;         /* 1 if all spatial streams have STBC */
     guint    txop_ps_not_allowed:1;
     guint    short_gi:1;     /* True for short guard interval */
@@ -737,20 +732,6 @@ struct ieee_802_11ac {
     guint16  partial_aid;
 };
 
-/*
- * 802.11ac presence flags.
- */
-#define PHDR_802_11AC_HAS_STBC                    0x00000001 /* stbc */
-#define PHDR_802_11AC_HAS_TXOP_PS_NOT_ALLOWED     0x00000002 /* txop_ps_not_allowed */
-#define PHDR_802_11AC_HAS_SHORT_GI                0x00000004 /* short_gi */
-#define PHDR_802_11AC_HAS_SHORT_GI_NSYM_DISAMBIG  0x00000008 /* short_gi_nsym_disambig */
-#define PHDR_802_11AC_HAS_LDPC_EXTRA_OFDM_SYMBOL  0x00000010 /* ldpc_extra_ofdm_symbol */
-#define PHDR_802_11AC_HAS_BEAMFORMED              0x00000020 /* beamformed */
-#define PHDR_802_11AC_HAS_BANDWIDTH               0x00000040 /* bandwidth */
-#define PHDR_802_11AC_HAS_FEC                     0x00000080 /* fec */
-#define PHDR_802_11AC_HAS_GROUP_ID                0x00000100 /* group_id */
-#define PHDR_802_11AC_HAS_PARTIAL_AID             0x00000200 /* partial_aid */
-
 /*
  * 802.11ad.
  */
@@ -766,14 +747,11 @@ struct ieee_802_11ac {
                                ((frequency) <= PHDR_802_11AD_MAX_FREQUENCY))
 
 struct ieee_802_11ad {
-    guint32 presence_flags; /* Which of this information is present? */
-    guint8  mcs;            /* MCS index */
-};
+    /* Which of this information is present? */
+    guint    has_mcs_index:1;
 
-/*
- * 802.11ad presence flags.
- */
-#define PHDR_802_11AD_HAS_MCS_INDEX               0x00000001 /* mcs */
+    guint8   mcs;            /* MCS index */
+};
 
 struct ieee_802_11_phdr {
     gint     fcs_len;        /* Number of bytes of FCS - -1 means "unknown" */
@@ -789,7 +767,17 @@ struct ieee_802_11_phdr {
         struct ieee_802_11ac info_11ac;
         struct ieee_802_11ad info_11ad;
     } phy_info;
-    guint32  presence_flags; /* Flags indicating presence of fields below */
+
+    /* Which of this information is present? */
+    guint    has_channel:1;
+    guint    has_frequency:1;
+    guint    has_data_rate:1;
+    guint    has_signal_percent:1;
+    guint    has_noise_percent:1;
+    guint    has_signal_dbm:1;
+    guint    has_noise_dbm:1;
+    guint    has_tsf_timestamp:1;
+
     guint16  channel;        /* Channel number */
     guint32  frequency;      /* Channel center frequency */
     guint16  data_rate;      /* Data rate, in .5 Mb/s units */
@@ -800,18 +788,6 @@ struct ieee_802_11_phdr {
     guint64  tsf_timestamp;
 };
 
-/*
- * Presence bits for non-PHY-specific data.
- */
-#define PHDR_802_11_HAS_CHANNEL         0x00000001 /* channel */
-#define PHDR_802_11_HAS_FREQUENCY       0x00000002 /* frequency */
-#define PHDR_802_11_HAS_DATA_RATE       0x00000004 /* data_rate */
-#define PHDR_802_11_HAS_SIGNAL_PERCENT  0x00000008 /* signal_percent */
-#define PHDR_802_11_HAS_NOISE_PERCENT   0x00000010 /* noise_percent */
-#define PHDR_802_11_HAS_SIGNAL_DBM      0x00000020 /* signal_dbm */
-#define PHDR_802_11_HAS_NOISE_DBM       0x00000040 /* noise_dbm */
-#define PHDR_802_11_HAS_TSF_TIMESTAMP   0x00000080 /* tsf_timestamp */
-
 /* Packet "pseudo-header" for the output from CoSine L2 debug output. */
 
 #define COSINE_MAX_IF_NAME_LEN  128