aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tcp.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>1999-08-18 00:57:54 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>1999-08-18 00:57:54 +0000
commit973eb23d6688f6f75caa89958d847c5e9bd0beea (patch)
treee9e831bb1b3b77de445b70cbeb126f919f01bce2 /packet-tcp.c
parent3104122f7df1c1e0814136c22de0f0487d01968f (diff)
Declare the "packet_info" structure "pi" in "packet.h", rather than in a
bunch of source files. Replace the "payload" field of a "packet_info" structure with "len" and "captured_len" fields, which contain the total packet length and total captured packet length (including all headers) at the current protocol layer (i.e., if a given layer has a length field, and that length field says its shorter than the length we got from the capture, reduce the "pi.len" and "pi.captured_len" values appropriately). Those fields can be used in the future if we add checks to make sure a field we're extracting from a packet doesn't go past the end of the packet, or past the captured part of the packet. Get rid of the additional payload argument to some dissection functions; use "pi.captured_len - offset" instead. Have the END_OF_FRAME macro use "pi.captured_len" rather than "fd->cap_len", so that "dissect the rest of the frame" becomes "dissect the rest of the packet", and doesn't dissect end-of-frame padding such as padding added to make an Ethernet frame 60 or more octets long. (We might want to rename it END_OF_PACKET; if we ever want to label the end-of-frame padding for the benefit of people curious what that extra gunk is, we could have a separate END_OF_FRAME macro that uses "fd->cap_len".) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@506 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-tcp.c')
-rw-r--r--packet-tcp.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/packet-tcp.c b/packet-tcp.c
index 9c56e92d8e..a053856d94 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.29 1999/07/31 13:55:16 deniel Exp $
+ * $Id: packet-tcp.c,v 1.30 1999/08/18 00:57:53 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -56,7 +56,6 @@
#endif
extern FILE* data_out_file;
-extern packet_info pi;
static gchar info_str[COL_MAX_LEN];
static int info_len;
@@ -335,8 +334,7 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
guint bpos;
guint hlen;
guint optlen;
- guint packet_max = pi.payload + offset;
- guint payload;
+ guint packet_max = pi.len;
/* To do: Check for {cap len,pkt len} < struct len */
/* Avoids alignment problems on many architectures. */
@@ -368,8 +366,6 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
hlen = hi_nibble(th.th_off_x2) * 4; /* TCP header length, in bytes */
- payload = pi.payload - hlen;
-
if (check_col(fd, COL_RES_SRC_PORT))
col_add_str(fd, COL_RES_SRC_PORT, get_tcp_port(th.th_sport));
if (check_col(fd, COL_UNRES_SRC_PORT))
@@ -465,19 +461,19 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
dissect_lpd(pd, offset, fd, tree);
else if (PORT_IS(TCP_PORT_TELNET)) {
pi.match_port = TCP_PORT_TELNET;
- dissect_telnet(pd, offset, fd, tree, payload);
+ dissect_telnet(pd, offset, fd, tree);
} else if (PORT_IS(TCP_PORT_FTPDATA)) {
pi.match_port = TCP_PORT_FTPDATA;
- dissect_ftpdata(pd, offset, fd, tree, payload);
+ dissect_ftpdata(pd, offset, fd, tree);
} else if (PORT_IS(TCP_PORT_FTP)) {
pi.match_port = TCP_PORT_FTP;
- dissect_ftp(pd, offset, fd, tree, payload);
+ dissect_ftp(pd, offset, fd, tree);
} else if (PORT_IS(TCP_PORT_POP)) {
pi.match_port = TCP_PORT_POP;
- dissect_pop(pd, offset, fd, tree, payload);
+ dissect_pop(pd, offset, fd, tree);
} else if (PORT_IS(TCP_PORT_NNTP)) {
pi.match_port = TCP_PORT_NNTP;
- dissect_nntp(pd, offset, fd, tree, payload);
+ dissect_nntp(pd, offset, fd, tree);
} else if (PORT_IS(TCP_PORT_PPTP)) {
pi.match_port = TCP_PORT_PPTP;
dissect_pptp(pd, offset, fd, tree);
@@ -485,7 +481,7 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
dissect_http(pd, offset, fd, tree);
else if (PORT_IS(TCP_PORT_NBSS)) {
pi.match_port = TCP_PORT_NBSS;
- dissect_nbss(pd, offset, fd, tree, payload);
+ dissect_nbss(pd, offset, fd, tree);
} else if (PORT_IS(TCP_PORT_RTSP))
dissect_rtsp(pd, offset, fd, tree);
else {