diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-10-29 13:27:52 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-10-29 20:28:25 +0000 |
commit | b6fe64017a967ee95eaafe3751ebb0738d1c5737 (patch) | |
tree | b7e2b8142d508ec5a5f95e3a7babd03a56c56d48 | |
parent | 98675916337e655caf054da22e0d945777102ec1 (diff) |
Calculate the signal/noise ratio.
If we have signal and noise in dBm, the difference between them is the
SNR, in dB.
Bug: 15243
Change-Id: Iaa17ef9ac39e18eccb7d1f75367fde24abab0180
Reviewed-on: https://code.wireshark.org/review/30408
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | epan/dissectors/packet-ieee80211-radio.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/epan/dissectors/packet-ieee80211-radio.c b/epan/dissectors/packet-ieee80211-radio.c index b22fe10c83..fdb4efdf0b 100644 --- a/epan/dissectors/packet-ieee80211-radio.c +++ b/epan/dissectors/packet-ieee80211-radio.c @@ -72,11 +72,12 @@ static int hf_wlan_radio_channel = -1; static int hf_wlan_radio_frequency = -1; static int hf_wlan_radio_short_preamble = -1; static int hf_wlan_radio_signal_percent = -1; -static int hf_wlan_radio_signal_dbm = -1; static int hf_wlan_radio_signal_db = -1; +static int hf_wlan_radio_signal_dbm = -1; static int hf_wlan_radio_noise_percent = -1; -static int hf_wlan_radio_noise_dbm = -1; static int hf_wlan_radio_noise_db = -1; +static int hf_wlan_radio_noise_dbm = -1; +static int hf_wlan_radio_snr = -1; static int hf_wlan_radio_timestamp = -1; static int hf_wlan_last_part_of_a_mpdu = -1; static int hf_wlan_a_mpdu_delim_crc_error = -1; @@ -881,6 +882,15 @@ dissect_wlan_radio_phdr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, proto_tree_add_int(radio_tree, hf_wlan_radio_noise_dbm, tvb, 0, 0, phdr->noise_dbm); } + if (phdr->has_signal_dbm && phdr->has_noise_dbm) { + proto_tree_add_int(radio_tree, hf_wlan_radio_snr, tvb, 0, 0, phdr->signal_dbm - phdr->noise_dbm); + } + /* + * XXX - are the signal and noise in dB from a fixed reference point + * guaranteed to use the *same* fixed reference point? If so, we could + * calculate the SNR if they're both present, too. + */ + if (phdr->has_tsf_timestamp) { proto_tree_add_uint64(radio_tree, hf_wlan_radio_timestamp, tvb, 0, 0, phdr->tsf_timestamp); } @@ -1422,6 +1432,10 @@ void proto_register_ieee80211_radio(void) {"Noise level (dBm)", "wlan_radio.noise_dbm", FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0, NULL, HFILL }}, + {&hf_wlan_radio_snr, + {"Signal/noise ratio (dB)", "wlan_radio.noise_db", FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_decibels, 0, + NULL, HFILL }}, + {&hf_wlan_radio_timestamp, {"TSF timestamp", "wlan_radio.timestamp", FT_UINT64, BASE_DEC, NULL, 0, "Timing Synchronization Function timestamp", HFILL }}, |