summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-10-29 16:03:08 -0700
committerGuy Harris <guy@alum.mit.edu>2014-10-29 23:04:05 +0000
commit8165448504749c0a0554e2eef1964f6c88bad15d (patch)
tree14c6d3e8bc73052fe818519de7260e3bb672a4e6
parent4acf4955f54c1fba30fdf2dc0dd4e11f6a3595b5 (diff)
downloadwireshark-8165448504749c0a0554e2eef1964f6c88bad15d.tar.gz
Expand the 802.11 pseudo-header and support new radio metadata.
Add a set of presence bits, so we can indicate which bits of radio metadata we do and don't have. Fill in more radio metadata from capture files, and display it. (More to come.) Change-Id: Idea2c05442c74af17c14c4d5a8d8025ab27fbd15 Reviewed-on: https://code.wireshark.org/review/4987 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--epan/dissectors/packet-ieee80211-radio.c130
-rw-r--r--wiretap/commview.c59
-rw-r--r--wiretap/netmon.c1
-rw-r--r--wiretap/network_instruments.c6
-rw-r--r--wiretap/netxray.c35
-rw-r--r--wiretap/pcap-common.c13
-rw-r--r--wiretap/peekclassic.c1
-rw-r--r--wiretap/peektagged.c15
-rw-r--r--wiretap/snoop.c6
-rw-r--r--wiretap/wtap.h32
10 files changed, 234 insertions, 64 deletions
diff --git a/epan/dissectors/packet-ieee80211-radio.c b/epan/dissectors/packet-ieee80211-radio.c
index 9f8fe77cb9..b04c3ff32a 100644
--- a/epan/dissectors/packet-ieee80211-radio.c
+++ b/epan/dissectors/packet-ieee80211-radio.c
@@ -41,7 +41,11 @@ static int proto_radio = -1;
/* ************************************************************************* */
static int hf_data_rate = -1;
static int hf_channel = -1;
-static int hf_signal_strength = -1;
+static int hf_frequency = -1;
+static int hf_signal_percent = -1;
+static int hf_signal_dbm = -1;
+static int hf_noise_percent = -1;
+static int hf_noise_dbm = -1;
static gint ett_radio = -1;
@@ -59,42 +63,82 @@ dissect_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
col_clear(pinfo->cinfo, COL_INFO);
/* Add the radio information to the column information */
- col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u",
- pinfo->pseudo_header->ieee_802_11.data_rate / 2,
- pinfo->pseudo_header->ieee_802_11.data_rate & 1 ? 5 : 0);
- /*
- * For tagged Peek files, this is presumably signal strength as a
- * percentage of the maximum, as it is for classic Peek files,
- * i.e. (RXVECTOR RSSI/RXVECTOR RSSI_Max)*100, or, at least, that's
- * what I infer it is, given what the WildPackets note "Converting
- * Signal Strength Percentage to dBm Values" says.
- *
- * It also says that the conversion the percentage to a dBm value is
- * an adapter-dependent process, so, as we don't know what type of
- * adapter was used to do the capture, we can't do the conversion.
- *
- * It's *probably* something similar for other capture file formats.
- */
- col_add_fstr(pinfo->cinfo, COL_RSSI, "%u%%",
- pinfo->pseudo_header->ieee_802_11.signal_level);
+
+ if (pinfo->pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_DATA_RATE) {
+ col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u",
+ pinfo->pseudo_header->ieee_802_11.data_rate / 2,
+ pinfo->pseudo_header->ieee_802_11.data_rate & 1 ? 5 : 0);
+ }
+
+ if (pinfo->pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_SIGNAL_PERCENT) {
+ /*
+ * For tagged Peek files, this is presumably signal strength as a
+ * percentage of the maximum, as it is for classic Peek files,
+ * i.e. (RXVECTOR RSSI/RXVECTOR RSSI_Max)*100, or, at least, that's
+ * what I infer it is, given what the WildPackets note "Converting
+ * Signal Strength Percentage to dBm Values" says.
+ *
+ * It also says that the conversion the percentage to a dBm value is
+ * an adapter-dependent process, so, as we don't know what type of
+ * adapter was used to do the capture, we can't do the conversion.
+ *
+ * It's *probably* something similar for other capture file formats.
+ */
+ col_add_fstr(pinfo->cinfo, COL_RSSI, "%u%%",
+ pinfo->pseudo_header->ieee_802_11.signal_percent);
+ }
if (tree) {
ti = proto_tree_add_item(tree, proto_radio, tvb, 0, 0, ENC_NA);
radio_tree = proto_item_add_subtree (ti, ett_radio);
- proto_tree_add_uint64_format_value(radio_tree, hf_data_rate, tvb, 0, 0,
- (guint64)pinfo->pseudo_header->ieee_802_11.data_rate * 500000,
- "%u.%u Mb/s",
- pinfo->pseudo_header->ieee_802_11.data_rate / 2,
- pinfo->pseudo_header->ieee_802_11.data_rate & 1 ? 5 : 0);
-
- proto_tree_add_uint(radio_tree, hf_channel, tvb, 0, 0,
- pinfo->pseudo_header->ieee_802_11.channel);
-
- proto_tree_add_uint_format_value(radio_tree, hf_signal_strength, tvb, 0, 0,
- pinfo->pseudo_header->ieee_802_11.signal_level,
- "%u%%",
- pinfo->pseudo_header->ieee_802_11.signal_level);
+ if (pinfo->pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_DATA_RATE) {
+ proto_tree_add_uint64_format_value(radio_tree, hf_data_rate, tvb, 0, 0,
+ (guint64)pinfo->pseudo_header->ieee_802_11.data_rate * 500000,
+ "%u.%u Mb/s",
+ pinfo->pseudo_header->ieee_802_11.data_rate / 2,
+ pinfo->pseudo_header->ieee_802_11.data_rate & 1 ? 5 : 0);
+ }
+
+ if (pinfo->pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_CHANNEL) {
+ proto_tree_add_uint(radio_tree, hf_channel, tvb, 0, 0,
+ pinfo->pseudo_header->ieee_802_11.channel);
+ }
+
+ if (pinfo->pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_FREQUENCY) {
+ proto_tree_add_uint_format_value(radio_tree, hf_frequency, tvb, 0, 0,
+ pinfo->pseudo_header->ieee_802_11.frequency,
+ "%u MHz",
+ pinfo->pseudo_header->ieee_802_11.frequency);
+ }
+
+ if (pinfo->pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_SIGNAL_PERCENT) {
+ proto_tree_add_uint_format_value(radio_tree, hf_signal_percent, tvb, 0, 0,
+ pinfo->pseudo_header->ieee_802_11.signal_percent,
+ "%u%%",
+ pinfo->pseudo_header->ieee_802_11.signal_percent);
+ }
+
+ if (pinfo->pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_SIGNAL_DBM) {
+ proto_tree_add_int_format_value(radio_tree, hf_signal_dbm, tvb, 0, 0,
+ pinfo->pseudo_header->ieee_802_11.signal_dbm,
+ "%d dBm",
+ pinfo->pseudo_header->ieee_802_11.signal_dbm);
+ }
+
+ if (pinfo->pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_NOISE_PERCENT) {
+ proto_tree_add_uint_format_value(radio_tree, hf_noise_percent, tvb, 0, 0,
+ pinfo->pseudo_header->ieee_802_11.noise_percent,
+ "%u%%",
+ pinfo->pseudo_header->ieee_802_11.noise_percent);
+ }
+
+ if (pinfo->pseudo_header->ieee_802_11.presence_flags & PHDR_802_11_HAS_NOISE_DBM) {
+ proto_tree_add_int_format_value(radio_tree, hf_noise_dbm, tvb, 0, 0,
+ pinfo->pseudo_header->ieee_802_11.noise_dbm,
+ "%d dBm",
+ pinfo->pseudo_header->ieee_802_11.noise_dbm);
+ }
}
/* dissect the 802.11 header next */
@@ -111,9 +155,25 @@ static hf_register_info hf_radio[] = {
{"Channel", "wlan.channel", FT_UINT8, BASE_DEC, NULL, 0,
"802.11 channel number that this frame was sent/received on", HFILL }},
- {&hf_signal_strength,
- {"Signal Strength", "wlan.signal_strength", FT_UINT8, BASE_DEC, NULL, 0,
- "Signal strength (Percentage)", HFILL }}
+ {&hf_frequency,
+ {"Frequency", "wlan.frequency", FT_UINT16, BASE_DEC, NULL, 0,
+ "Center frequency of the 802.11 channel that this frame was sent/received on", HFILL }},
+
+ {&hf_signal_percent,
+ {"Signal Strength (Percentage)", "wlan.signal_dbm", FT_UINT8, BASE_DEC, NULL, 0,
+ "Signal strength (Percentage)", HFILL }},
+
+ {&hf_signal_dbm,
+ {"Signal Strength (dBm)", "wlan.signal_dbm", FT_INT8, BASE_DEC, NULL, 0,
+ "Signal strength (dBm)", HFILL }},
+
+ {&hf_noise_percent,
+ {"Noise Level (Percentage)", "wlan.noise_percentage", FT_UINT8, BASE_DEC, NULL, 0,
+ "Noise Level (Percentage)", HFILL }},
+
+ {&hf_noise_dbm,
+ {"Noise Level (dBm)", "wlan.noise_dbm", FT_INT8, BASE_DEC, NULL, 0,
+ "Noise Level (dBm)", HFILL }},
};
static gint *tree_array[] = {
diff --git a/wiretap/commview.c b/wiretap/commview.c
index a504a383c4..0e85cbe347 100644
--- a/wiretap/commview.c
+++ b/wiretap/commview.c
@@ -60,8 +60,8 @@ typedef struct commview_header {
guint8 channel;
guint8 direction; /* Or for WiFi, high order byte of
* packet rate. */
- guint8 signal_level_dbm;
- guint8 noise_level; /* In dBm (WiFi only) */
+ gint8 signal_level_dbm;
+ gint8 noise_level; /* In dBm (WiFi only) */
} commview_header_t;
#define COMMVIEW_HEADER_SIZE 24
@@ -147,11 +147,36 @@ 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;
+ 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->pseudo_header.ieee_802_11.fcs_len = -1; /* Unknown */
phdr->pseudo_header.ieee_802_11.channel = cv_hdr.channel;
phdr->pseudo_header.ieee_802_11.data_rate =
cv_hdr.rate | (cv_hdr.direction << 8);
- phdr->pseudo_header.ieee_802_11.signal_level = cv_hdr.signal_level_percent;
+ phdr->pseudo_header.ieee_802_11.signal_percent = cv_hdr.signal_level_percent;
+
+ /*
+ * XXX - these are positive in captures I've seen; does
+ * that mean that they are the negative of the actual
+ * dBm value? (80 dBm is a bit more power than most
+ * countries' regulatory agencies are likely to allow
+ * any individual to have in their home. :-))
+ *
+ * XXX - sometimes these are 0; assume that means that no
+ * value is provided.
+ */
+ 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;
+ }
+ 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;
+ }
break;
case MEDIUM_TOKEN_RING :
@@ -336,10 +361,30 @@ static gboolean commview_dump(wtap_dumper *wdh,
case WTAP_ENCAP_IEEE_802_11_WITH_RADIO :
cv_hdr.flags |= MEDIUM_WIFI;
- cv_hdr.channel = phdr->pseudo_header.ieee_802_11.channel;
- cv_hdr.rate = (guint8)(phdr->pseudo_header.ieee_802_11.data_rate & 0xFF);
- cv_hdr.direction = (guint8)((phdr->pseudo_header.ieee_802_11.data_rate >> 8) & 0xFF);
- cv_hdr.signal_level_percent = phdr->pseudo_header.ieee_802_11.signal_level;
+ cv_hdr.channel =
+ (phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_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;
+ 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;
+ 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;
+ 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;
+ 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;
break;
case WTAP_ENCAP_TOKEN_RING :
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index 35e1044319..8a0725ad08 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -424,6 +424,7 @@ netmon_set_pseudo_header_info(struct wtap_pkthdr *phdr, Buffer *buf)
* I'm not sure about control frames. An
* "FCS length" of -2 means "NetMon weirdness".
*/
+ phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* radio data is in the packet data */
phdr->pseudo_header.ieee_802_11.fcs_len = -2;
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
break;
diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c
index 1e2b6d4386..36d3100a0d 100644
--- a/wiretap/network_instruments.c
+++ b/wiretap/network_instruments.c
@@ -390,12 +390,16 @@ read_packet_header(FILE_T fh, union wtap_pseudo_header *pseudo_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;
pseudo_header->ieee_802_11.fcs_len = 0;
/* set decryption status */
pseudo_header->ieee_802_11.decrypted = (wireless_header.conditions & WIRELESS_WEP_SUCCESS) != 0;
pseudo_header->ieee_802_11.channel = wireless_header.frequency;
pseudo_header->ieee_802_11.data_rate = wireless_header.rate;
- pseudo_header->ieee_802_11.signal_level = wireless_header.strengthPercent;
+ pseudo_header->ieee_802_11.signal_percent = wireless_header.strengthPercent;
offset += (int)sizeof wireless_header;
break;
default:
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 4061a6ee61..bb795fe362 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1257,7 +1257,7 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
hdr.hdr_2_x.xxx[12];
phdr->pseudo_header.ieee_802_11.data_rate =
hdr.hdr_2_x.xxx[13];
- phdr->pseudo_header.ieee_802_11.signal_level =
+ phdr->pseudo_header.ieee_802_11.signal_percent =
hdr.hdr_2_x.xxx[14];
/*
* According to Ken Mann, at least in the captures
@@ -1265,6 +1265,20 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
* 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 {
+ 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;
case WTAP_ENCAP_ISDN:
@@ -1941,9 +1955,22 @@ netxray_dump_2_0(wtap_dumper *wdh,
switch (phdr->pkt_encap) {
case WTAP_ENCAP_IEEE_802_11_WITH_RADIO:
- rec_hdr.xxx[12] = pseudo_header->ieee_802_11.channel;
- rec_hdr.xxx[13] = (guint8)pseudo_header->ieee_802_11.data_rate;
- rec_hdr.xxx[14] = pseudo_header->ieee_802_11.signal_level;
+ rec_hdr.xxx[12] =
+ (pseudo_header->ieee_802_11.presence_flags & PHDR_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;
+ 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;
+ 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;
break;
case WTAP_ENCAP_PPP_WITH_PHDR:
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c
index a28c3248fc..c71ba76f57 100644
--- a/wiretap/pcap-common.c
+++ b/wiretap/pcap-common.c
@@ -1576,15 +1576,16 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
case WTAP_ENCAP_IEEE_802_11_RADIOTAP:
case WTAP_ENCAP_IEEE_802_11_AVS:
/*
- * We don't know whether there's an FCS in this frame or not.
- * XXX - are there any OSes where the capture mechanism
- * supplies an FCS?
+ * We don't know whether there's an FCS in this frame or not,
+ * at least in pcap files. For radiotap, that's indicated in
+ * the radiotap header.
+ *
+ * XXX - in pcap-ng, there *could* be a packet option
+ * indicating the FCS length.
*/
+ phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* absent or supplied in the packet data */
phdr->pseudo_header.ieee_802_11.fcs_len = -1;
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
- phdr->pseudo_header.ieee_802_11.channel = 0;
- phdr->pseudo_header.ieee_802_11.data_rate = 0;
- phdr->pseudo_header.ieee_802_11.signal_level = 0;
break;
case WTAP_ENCAP_IRDA:
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c
index a1c4ade563..1802a7781d 100644
--- a/wiretap/peekclassic.c
+++ b/wiretap/peekclassic.c
@@ -448,6 +448,7 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh,
switch (wth->file_encap) {
case WTAP_ENCAP_IEEE_802_11_AIROPEEK:
+ phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* not present */
phdr->pseudo_header.ieee_802_11.fcs_len = 0; /* no FCS */
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c
index c45a4382f3..4c9e66363e 100644
--- a/wiretap/peektagged.c
+++ b/wiretap/peektagged.c
@@ -556,27 +556,34 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
break;
case TAG_PEEKTAGGED_CHANNEL:
+ hdr_info.ieee_802_11.presence_flags |= PHDR_802_11_HAS_CHANNEL;
hdr_info.ieee_802_11.channel = pletoh32(&tag_value[2]);
break;
case TAG_PEEKTAGGED_RATE:
+ /* XXX - what if it's the MCS? */
+ hdr_info.ieee_802_11.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
hdr_info.ieee_802_11.data_rate = pletoh32(&tag_value[2]);
break;
case TAG_PEEKTAGGED_SIGNAL_PERC:
- hdr_info.ieee_802_11.signal_level = pletoh32(&tag_value[2]);
+ hdr_info.ieee_802_11.presence_flags |= PHDR_802_11_HAS_SIGNAL_PERCENT;
+ hdr_info.ieee_802_11.signal_percent = pletoh32(&tag_value[2]);
break;
case TAG_PEEKTAGGED_SIGNAL_DBM:
- /* XXX - not used yet */
+ hdr_info.ieee_802_11.presence_flags |= PHDR_802_11_HAS_SIGNAL_DBM;
+ hdr_info.ieee_802_11.signal_dbm = pletoh32(&tag_value[2]);
break;
case TAG_PEEKTAGGED_NOISE_PERC:
- /* XXX - not used yet */
+ hdr_info.ieee_802_11.presence_flags |= PHDR_802_11_HAS_NOISE_PERCENT;
+ hdr_info.ieee_802_11.noise_percent = pletoh32(&tag_value[2]);
break;
case TAG_PEEKTAGGED_NOISE_DBM:
- /* XXX - not used yet */
+ hdr_info.ieee_802_11.presence_flags |= PHDR_802_11_HAS_NOISE_DBM;
+ hdr_info.ieee_802_11.noise_dbm = pletoh32(&tag_value[2]);
break;
case TAG_PEEKTAGGED_UNKNOWN_0x000A:
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index a3de7aa17f..ad3886ec7c 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -739,10 +739,14 @@ snoop_read_shomiti_wireless_pseudoheader(FILE_T fh,
if (file_seek(fh, rsize, SEEK_CUR, err) == -1)
return FALSE;
+ 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.fcs_len = 4;
pseudo_header->ieee_802_11.channel = whdr.channel;
pseudo_header->ieee_802_11.data_rate = whdr.rate;
- pseudo_header->ieee_802_11.signal_level = whdr.signal;
+ pseudo_header->ieee_802_11.signal_percent = whdr.signal;
/* add back the header and don't forget the pad as well */
*header_size = rsize + 8 + 4;
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 4aeb806858..2de3363ecd 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -561,7 +561,10 @@ struct p2p_phdr {
/*
* Packet "pseudo-header" information for 802.11.
- * Radio information is only present for WTAP_ENCAP_IEEE_802_11_WITH_RADIO.
+ * Radio information is only present in this form for
+ * WTAP_ENCAP_IEEE_802_11_WITH_RADIO. This is used for file formats in
+ * which the radio information isn't provided as a pseudo-header in the
+ * packet data.
*
* Signal strength, etc. information:
*
@@ -578,13 +581,30 @@ struct p2p_phdr {
* times the ratio of the RSSI and the maximum RSSI.
*/
struct ieee_802_11_phdr {
- gint fcs_len; /* Number of bytes of FCS - -1 means "unknown" */
- gboolean decrypted; /* TRUE if frame is decrypted even if "protected" bit is set */
- guint8 channel; /* Channel number */
- guint16 data_rate; /* in .5 Mb/s units */
- guint8 signal_level; /* percentage */
+ guint32 presence_flags; /* flags indicating presence of certain fields */
+ gint fcs_len; /* Number of bytes of FCS - -1 means "unknown" */
+ gboolean decrypted; /* TRUE if frame is decrypted even if "protected" bit is set */
+ guint16 channel; /* Channel number */
+ guint16 data_rate; /* Data rate, in .5 Mb/s units */
+ guint16 mcs; /* MCS index */
+ guint32 frequency; /* Channel center frequency */
+ guint8 signal_percent; /* Signal level, as a percentage */
+ guint8 noise_percent; /* Noise level, as a percentage */
+ gint8 signal_dbm; /* Signal level, in dBm */
+ gint8 noise_dbm; /* Noise level, in dBm */
+ guint64 tsf_timestamp;
};
+#define PHDR_802_11_HAS_CHANNEL 0x00000001 /* channel */
+#define PHDR_802_11_HAS_DATA_RATE 0x00000002 /* data_rate */
+#define PHDR_802_11_HAS_MCS 0x00000004 /* mcs_index */
+#define PHDR_802_11_HAS_FREQUENCY 0x00000008 /* frequency */
+#define PHDR_802_11_HAS_SIGNAL_PERCENT 0x00000010 /* signal_percent */
+#define PHDR_802_11_HAS_NOISE_PERCENT 0x00000020 /* noise_percent */
+#define PHDR_802_11_HAS_SIGNAL_DBM 0x00000040 /* signal_dbm */
+#define PHDR_802_11_HAS_NOISE_DBM 0x00000080 /* noise_dbm */
+#define PHDR_802_11_HAS_TSF_TIMESTAMP 0x00000100 /* tsf_timestamp */
+
/* Packet "pseudo-header" for the output from CoSine L2 debug output. */
#define COSINE_MAX_IF_NAME_LEN 128