aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-raw.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-raw.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-raw.c')
-rw-r--r--epan/dissectors/packet-raw.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/epan/dissectors/packet-raw.c b/epan/dissectors/packet-raw.c
index 3601a19217..c6e64d755d 100644
--- a/epan/dissectors/packet-raw.c
+++ b/epan/dissectors/packet-raw.c
@@ -25,8 +25,8 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wiretap/wtap.h>
-#include "packet-raw.h"
#include "packet-ip.h"
#include "packet-ppp.h"
@@ -43,8 +43,8 @@ static dissector_handle_t ipv6_handle;
static dissector_handle_t data_handle;
static dissector_handle_t ppp_hdlc_handle;
-void
-capture_raw(const guchar *pd, int len, packet_counts *ld)
+static void
+capture_raw(const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
/* So far, the only time we get raw connection types are with Linux and
* Irix PPP connections. We can't tell what type of data is coming down
@@ -55,16 +55,16 @@ capture_raw(const guchar *pd, int len, packet_counts *ld)
* sometimes. This check should be removed when 2.2 is out.
*/
if (BYTES_ARE_IN_FRAME(0,len,2) && pd[0] == 0xff && pd[1] == 0x03) {
- capture_ppp_hdlc(pd, 0, len, ld);
+ capture_ppp_hdlc(pd, 0, len, ld, pseudo_header);
}
/* The Linux ISDN driver sends a fake MAC address before the PPP header
* on its ippp interfaces... */
else if (BYTES_ARE_IN_FRAME(0,len,8) && pd[6] == 0xff && pd[7] == 0x03) {
- capture_ppp_hdlc(pd, 6, len, ld);
+ capture_ppp_hdlc(pd, 6, len, ld, pseudo_header);
}
/* ...except when it just puts out one byte before the PPP header... */
else if (BYTES_ARE_IN_FRAME(0,len,3) && pd[1] == 0xff && pd[2] == 0x03) {
- capture_ppp_hdlc(pd, 1, len, ld);
+ capture_ppp_hdlc(pd, 1, len, ld, pseudo_header);
}
/* ...and if the connection is currently down, it sends 10 bytes of zeroes
* instead of a fake MAC address and PPP header. */
@@ -172,6 +172,8 @@ proto_register_raw(void)
proto_raw = proto_register_protocol("Raw packet data", "Raw", "raw");
proto_register_subtree_array(ett, array_length(ett));
+
+ register_capture_dissector(WTAP_ENCAP_RAW_IP, capture_raw, proto_raw);
}
void