aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ieee80211-radiotap.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-12-12 23:38:21 -0500
committerMichael Mann <mmann78@netscape.net>2015-12-13 14:34:13 +0000
commit56aa05227f6bc18211d9ddec669af77ba5cd78e9 (patch)
treefa21cc83f52889681b3461e1f511521a6d43275d /epan/dissectors/packet-ieee80211-radiotap.c
parent23379ae3624df82c170f48e5bb3250a97ec61c13 (diff)
Create a way to register "capture" dissectors.
Capture dissectors could be architected like dissection dissectors, with tables and subtables and possibly using tvbs to pass there data instead of raw byte arrays. This is a first step towards that by refactoring capture_info_packet() to work off of a "capture dissector table" Registering the capture dissection functions instead of calling them directly also clears up a bunch of dissector header files who sole purpose was providing the capture dissection function definition. Change-Id: I10e9b79e061f32d2572f009823601d4f048d37aa Reviewed-on: https://code.wireshark.org/review/12581 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-ieee80211-radiotap.c')
-rw-r--r--epan/dissectors/packet-ieee80211-radiotap.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/epan/dissectors/packet-ieee80211-radiotap.c b/epan/dissectors/packet-ieee80211-radiotap.c
index dd10179893..2831e43081 100644
--- a/epan/dissectors/packet-ieee80211-radiotap.c
+++ b/epan/dissectors/packet-ieee80211-radiotap.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wsutil/pint.h>
#include <epan/crc32-tvb.h>
#include <wsutil/frequency-utils.h>
@@ -36,9 +37,10 @@
#include <epan/addr_resolv.h>
#include <epan/expert.h>
#include "packet-ieee80211.h"
-#include "packet-ieee80211-radiotap.h"
#include "packet-ieee80211-radiotap-iter.h"
+void proto_register_radiotap(void);
+void proto_reg_handoff_radiotap(void);
/* protocol */
static int proto_radiotap = -1;
@@ -222,6 +224,16 @@ static int radiotap_tap = -1;
/* Settings */
static gboolean radiotap_bit14_fcs = FALSE;
+struct _radiotap_info {
+ guint radiotap_length;
+ guint32 rate;
+ gint8 dbm_antsignal;
+ gint8 dbm_antnoise;
+ guint32 freq;
+ guint32 flags;
+ guint64 tsft;
+};
+
#define BITNO_32(x) (((x) >> 16) ? 16 + BITNO_16((x) >> 16) : BITNO_16((x)))
#define BITNO_16(x) (((x) >> 8) ? 8 + BITNO_8((x) >> 8) : BITNO_8((x)))
#define BITNO_8(x) (((x) >> 4) ? 4 + BITNO_4((x) >> 4) : BITNO_4((x)))
@@ -443,8 +455,8 @@ static const true_false_string preamble_type = {
* dissectors, such as tcpdump(8), expect the padding.
*/
-void
-capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld)
+static void
+capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint16 it_len;
guint32 present, xpresent;
@@ -536,7 +548,7 @@ capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld)
if (rflags & IEEE80211_RADIOTAP_F_DATAPAD)
capture_ieee80211_datapad(pd, offset + it_len, len, ld);
else
- capture_ieee80211(pd, offset + it_len, len, ld);
+ capture_ieee80211(pd, offset + it_len, len, ld, pseudo_header);
}
static int
@@ -2650,6 +2662,7 @@ void proto_register_radiotap(void)
expert_radiotap = expert_register_protocol(proto_radiotap);
expert_register_field_array(expert_radiotap, ei, array_length(ei));
register_dissector("radiotap", dissect_radiotap, proto_radiotap);
+ register_capture_dissector(WTAP_ENCAP_IEEE_802_11_RADIOTAP, capture_radiotap, proto_radiotap);
radiotap_tap = register_tap("radiotap");