aboutsummaryrefslogtreecommitdiffstats
path: root/packet-raw.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-11-18 10:38:33 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-11-18 10:38:33 +0000
commitf4fc5ac736a773f41e683e59d4431b1fbfa43c9d (patch)
tree5e117f446c6e233d14b642596d67c985e685f328 /packet-raw.c
parent92c209a221b63e9fd8b07684cec124efc0e01597 (diff)
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors. Register the IP dissector and have dissectors that call it directly (rather than through a port table) call it through a handle. Add a routine "tvb_set_reported_length()" which a dissector can use if it was handed a tvbuff that contains more data than is actually in its part of the packet - for example, handing a padded Ethernet frame to IP; the routine sets the reported length of the tvbuff (and also adjusts the actual length, as appropriate). Then use it in IP. Given that, "ethertype()" can determine how much of the Ethernet frame was actually part of an IP datagram (and can do the same for other protocols under Ethernet that use "tvb_set_reported_length()"; have it return the actual length, and have "dissect_eth()" and "dissect_vlan()" use that to mark trailer data in Ethernet II frames as well as in 802.3 frames. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2658 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-raw.c')
-rw-r--r--packet-raw.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/packet-raw.c b/packet-raw.c
index cad834baa1..edb145565f 100644
--- a/packet-raw.c
+++ b/packet-raw.c
@@ -1,7 +1,7 @@
/* packet-raw.c
* Routines for raw packet disassembly
*
- * $Id: packet-raw.c,v 1.19 2000/11/17 21:00:35 gram Exp $
+ * $Id: packet-raw.c,v 1.20 2000/11/18 10:38:25 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -43,6 +43,8 @@ static gint ett_raw = -1;
static const char zeroes[10];
+static dissector_handle_t ip_handle;
+
void
capture_raw(const u_char *pd, packet_counts *ld)
{
@@ -82,8 +84,6 @@ dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *fh_tree;
proto_item *ti;
tvbuff_t *next_tvb;
- const guint8 *next_pd;
- int next_offset;
/* load the top pane info. This should be overwritten by
the next protocol in the stack */
@@ -132,13 +132,13 @@ dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ...and if the connection is currently down, it sends 10 bytes of zeroes
* instead of a fake MAC address and PPP header. */
else if (memcmp(tvb_get_ptr(tvb, 0, 10), zeroes, 10) == 0) {
- tvb_compat(tvb, &next_pd, &next_offset);
- dissect_ip(next_pd, next_offset + 10, pinfo->fd, tree);
+ next_tvb = tvb_new_subset(tvb, 10, -1, -1);
+ call_dissector(ip_handle, next_tvb, pinfo, tree);
return;
}
else {
- tvb_compat(tvb, &next_pd, &next_offset);
- dissect_ip(next_pd, next_offset, pinfo->fd, tree);
+ next_tvb = tvb_new_subset(tvb, 0, -1, -1);
+ call_dissector(ip_handle, next_tvb, pinfo, tree);
return;
}
g_assert_not_reached();
@@ -153,3 +153,12 @@ proto_register_raw(void)
proto_register_subtree_array(ett, array_length(ett));
}
+
+void
+proto_reg_handoff_raw(void)
+{
+ /*
+ * Get a handle for the IP dissector.
+ */
+ ip_handle = find_dissector("ip");
+}