summaryrefslogtreecommitdiff
path: root/wiretap/commview.c
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 /wiretap/commview.c
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>
Diffstat (limited to 'wiretap/commview.c')
-rw-r--r--wiretap/commview.c59
1 files changed, 52 insertions, 7 deletions
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 :