In "packet-ieee80211.c", use the same scheme for displaying the data

rate used elsewhere, rather than using floating point.

In "packet-prism.c", show the data rate correctly in the column display,
and show it as Mb/s in the protocol tree, and show it as "Data Rate", as
it is in "packet-ieee80211.c".

In "packet-radiotap.c" and "packet-wlancap.c", show it as "Data Rate"
rather than as "Datarate".

Show the units uniformly as "Mb/s", rather than "mb/s" (it's mega, not
milli) or "Mbps", except for the AVS header, where it's Kb/s.

svn path=/trunk/; revision=11323
This commit is contained in:
Guy Harris 2004-07-06 19:22:45 +00:00
parent 1020c9bd40
commit e378012ed4
4 changed files with 26 additions and 14 deletions

View File

@ -3,7 +3,7 @@
* Copyright 2000, Axis Communications AB
* Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com
*
* $Id: packet-ieee80211.c,v 1.113 2004/07/05 09:29:04 guy Exp $
* $Id: packet-ieee80211.c,v 1.114 2004/07/06 19:22:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1453,8 +1453,9 @@ dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
/* Add the radio information, if present, to the column information */
if (has_radio_information) {
if (check_col(pinfo->cinfo, COL_TX_RATE)) {
col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%g",
.5*pinfo->pseudo_header->ieee_802_11.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 (check_col(pinfo->cinfo, COL_RSSI)) {
/* XX - this is a percentage, not a dBm or normalized or raw RSSI */
@ -1493,8 +1494,9 @@ dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
proto_tree_add_uint_format(hdr_tree, hf_data_rate,
tvb, 0, 0,
pinfo->pseudo_header->ieee_802_11.data_rate,
"Data Rate: %g mb/s",
.5*pinfo->pseudo_header->ieee_802_11.data_rate);
"Data Rate: %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(hdr_tree, hf_channel,
tvb, 0, 0,

View File

@ -9,7 +9,7 @@
*
* By Tim Newsham
*
* $Id: packet-prism.c,v 1.12 2004/07/05 09:29:04 guy Exp $
* $Id: packet-prism.c,v 1.13 2004/07/06 19:22:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -196,9 +196,16 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
VALFIELD(signal, "Signal");
VALFIELD(noise, "Noise");
if (check_col(pinfo->cinfo, COL_TX_RATE)) {
col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%d.%d",
hdr.rate.data / 10, hdr.rate.data % 10);
col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u",
hdr.rate.data / 2, hdr.rate.data & 1 ? 5 : 0);
}
if (tree) {
proto_tree_add_uint_format(prism_tree, hf_prism_rate_data,
tvb, offset, 12, hdr.rate.data,
"Data Rate: %u.%u Mb/s",
hdr.rate.data / 2, hdr.rate.data & 1 ? 5 : 0);
}
offset += 12;
VALFIELD(rate, "Rate");
VALFIELD(istx, "IsTX");
VALFIELD(frmlen, "Frame Length");

View File

@ -2,7 +2,7 @@
* packet-radiotap.c
* Decode packets with a Radiotap header
*
* $Id: packet-radiotap.c,v 1.4 2004/07/05 09:29:04 guy Exp $
* $Id: packet-radiotap.c,v 1.5 2004/07/06 19:22:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -356,7 +356,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tree) {
proto_tree_add_uint_format(radiotap_tree, hf_radiotap_datarate,
tvb, offset, 1, tvb_get_guint8(tvb, offset),
"Datarate: %d.%d Mbps", rate / 2, rate & 1 ? 5 : 0);
"Data Rate: %d.%d Mb/s", rate / 2, rate & 1 ? 5 : 0);
}
offset++;
break;

View File

@ -14,7 +14,7 @@
*
* By Solomon Peachy
*
* $Id: packet-wlancap.c,v 1.5 2004/07/05 09:29:05 guy Exp $
* $Id: packet-wlancap.c,v 1.6 2004/07/06 19:22:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -197,6 +197,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int offset;
guint32 version;
guint32 length;
guint32 datarate;
if(check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");
@ -247,10 +248,12 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4, tvb_get_ntohl(tvb, offset));
offset+=4;
/* XXX - all other 802.11 pseudo-headers use 500Kb/s, not 100Kb/s,
as the units. */
datarate = tvb_get_ntohl(tvb, offset);
proto_tree_add_uint_format(wlan_tree, hf_wlan_datarate, tvb, offset,
4, tvb_get_ntohl(tvb, offset) * 100,
"Datarate: %d kbps",
tvb_get_ntohl(tvb, offset) * 100);
4, datarate * 100,
"Data Rate: %u Kb/s", datarate * 100);
offset+=4;
proto_tree_add_uint(wlan_tree, hf_wlan_antenna, tvb, offset,
4, tvb_get_ntohl(tvb, offset));