aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/commview.c
diff options
context:
space:
mode:
authorsfisher <sfisher@f5534014-38df-0310-8fa8-9805f1628bb7>2007-11-27 05:43:29 +0000
committersfisher <sfisher@f5534014-38df-0310-8fa8-9805f1628bb7>2007-11-27 05:43:29 +0000
commite118599e9dacd88b7b48b38fa14e2f6d64031931 (patch)
treecfb3098d63b0c7b8b8c5cbdabf1092dda89ac270 /wiretap/commview.c
parent8e76bf85ddba1c4aab9baacb9fb124d74cffcb2c (diff)
Add support for showing wireless LAN info (signal strength / rate / channel)
in Wireshark when reading CommView files. Also write out these values when coming from a file format with encapsulation type 802.11 with radio. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23617 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'wiretap/commview.c')
-rw-r--r--wiretap/commview.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/wiretap/commview.c b/wiretap/commview.c
index bb48fef918..f53de70acd 100644
--- a/wiretap/commview.c
+++ b/wiretap/commview.c
@@ -127,7 +127,7 @@ int commview_open(wtap *wth, int *err, gchar **err_info _U_)
wth->data_offset = 0;
wth->file_type = WTAP_FILE_COMMVIEW;
- wth->file_encap = WTAP_ENCAP_PER_PACKET;
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1; /* Our kind of file */
@@ -154,7 +154,7 @@ commview_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset)
break;
case MEDIUM_WIFI :
- wth->phdr.pkt_encap = WTAP_ENCAP_IEEE_802_11;
+ wth->phdr.pkt_encap = WTAP_ENCAP_IEEE_802_11_WITH_RADIO;
break;
case MEDIUM_TOKEN_RING :
@@ -193,7 +193,7 @@ commview_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset)
static gboolean
commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
- *pseudo_header _U_, guchar *pd, int length, int *err,
+ *pseudo_header, guchar *pd, int length, int *err,
gchar **err_info _U_)
{
commview_header_t cv_hdr;
@@ -215,6 +215,14 @@ commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
return FALSE;
}
+ /* Pass some data to the 802.11 dissector if this is a WiFi packet */
+ if((cv_hdr.flags & FLAGS_MEDIUM) == MEDIUM_WIFI) {
+ pseudo_header->ieee_802_11.fcs_len = -1; /* Unknown */
+ pseudo_header->ieee_802_11.channel = cv_hdr.channel;
+ pseudo_header->ieee_802_11.data_rate = cv_hdr.rate;
+ pseudo_header->ieee_802_11.signal_level = cv_hdr.signal_level;
+ }
+
bytes_read = file_read(pd, 1, cv_hdr.data_len, wth->random_fh);
if(bytes_read != cv_hdr.data_len) {
*err = file_error(wth->random_fh);
@@ -275,6 +283,7 @@ int commview_dump_can_write_encap(int encap)
case WTAP_ENCAP_ETHERNET :
case WTAP_ENCAP_IEEE_802_11 :
+ case WTAP_ENCAP_IEEE_802_11_WITH_RADIO :
case WTAP_ENCAP_TOKEN_RING :
case WTAP_ENCAP_PER_PACKET :
return 0;
@@ -302,7 +311,7 @@ gboolean commview_dump_open(wtap_dumper *wdh, gboolean cant_seek _U_,
* Returns TRUE on success, FALSE on failure. */
static gboolean commview_dump(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
- const union wtap_pseudo_header *pseudo_header _U_,
+ const union wtap_pseudo_header *pseudo_header,
const guchar *pd, int *err)
{
commview_header_t cv_hdr;
@@ -345,6 +354,15 @@ static gboolean commview_dump(wtap_dumper *wdh,
cv_hdr.flags |= MEDIUM_WIFI;
break;
+ case WTAP_ENCAP_IEEE_802_11_WITH_RADIO :
+ cv_hdr.flags |= MEDIUM_WIFI;
+
+ cv_hdr.channel = pseudo_header->ieee_802_11.channel;
+ cv_hdr.rate = pseudo_header->ieee_802_11.data_rate;
+ cv_hdr.signal_level = pseudo_header->ieee_802_11.signal_level;
+
+ break;
+
case WTAP_ENCAP_TOKEN_RING :
cv_hdr.flags |= MEDIUM_TOKEN_RING;