Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="

statements.

Move the setting of the Protocol column in various dissectors before
anything is fetched from the packet, and also clear the Info column at
that point in those and some other dissectors, so that if an exception
is thrown, the columns don't reflect the previous protocol.

svn path=/trunk/; revision=2932
This commit is contained in:
Guy Harris 2001-01-22 08:54:08 +00:00
parent c57c848dfa
commit a4e137f630
5 changed files with 18 additions and 21 deletions

View File

@ -3,7 +3,7 @@
*
* Guy Harris <guy@alum.mit.edu>
*
* $Id: packet-http.c,v 1.36 2001/01/11 06:30:54 guy Exp $
* $Id: packet-http.c,v 1.37 2001/01/22 08:54:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -97,10 +97,6 @@ dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
http_type_t http_type;
int datalen;
CHECK_DISPLAY_AS_DATA(proto_http, tvb, pinfo, tree);
pinfo->current_proto = "HTTP";
switch (pinfo->match_port) {
case TCP_PORT_SSDP: /* TCP_PORT_SSDP = UDP_PORT_SSDP */
@ -122,6 +118,10 @@ dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* if it's an HTTP request or reply (but leave out the
* line terminator).
* Otherwise, just call it a continuation.
*
* Note that "tvb_find_line_end()" will return a value that
* is not longer than what's in the buffer, so the
* "tvb_get_ptr()" call won't throw an exception.
*/
linelen = tvb_find_line_end(tvb, offset, -1, &next_offset);
line = tvb_get_ptr(tvb, offset, linelen);

View File

@ -1,7 +1,7 @@
/* packet-icmpv6.c
* Routines for ICMPv6 packet disassembly
*
* $Id: packet-icmpv6.c,v 1.34 2001/01/09 06:31:36 guy Exp $
* $Id: packet-icmpv6.c,v 1.35 2001/01/22 08:54:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -732,8 +732,6 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
guint32 phdr[2];
guint16 cksum, computed_cksum;
OLD_CHECK_DISPLAY_AS_DATA(proto_icmpv6, pd, offset, fd, tree);
dp = (struct icmp6_hdr *)&pd[offset];
codename = typename = colcodename = coltypename = "Unknown";
len = sizeof(*dp);

View File

@ -1,7 +1,7 @@
/* packet-radius.c
* Routines for RADIUS packet disassembly
*
* $Id: packet-radius.c,v 1.23 2001/01/16 23:35:58 guy Exp $
* $Id: packet-radius.c,v 1.24 2001/01/22 08:54:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Johan Feyaerts
@ -689,8 +689,6 @@ proto_tree
return;
}
OLD_CHECK_DISPLAY_AS_DATA(proto_radius, pd, offset, fd, tree);
memcpy(&rh,&pd[offset],sizeof(e_radiushdr));

View File

@ -6,7 +6,7 @@
* In particular I have not had an opportunity to see how it
* responds to SRVLOC over TCP.
*
* $Id: packet-srvloc.c,v 1.20 2001/01/13 08:57:46 guy Exp $
* $Id: packet-srvloc.c,v 1.21 2001/01/22 08:54:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -227,10 +227,6 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 flags;
guint32 count;
CHECK_DISPLAY_AS_DATA(proto_srvloc, tvb, pinfo, tree);
pinfo->current_proto = "SRVLOC";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "SRVLOC");

View File

@ -2,7 +2,7 @@
* Routines for mgcp packet disassembly
* RFC 2705
*
* $Id: packet-mgcp.c,v 1.14 2001/01/09 06:32:10 guy Exp $
* $Id: packet-mgcp.c,v 1.15 2001/01/22 08:54:08 guy Exp $
*
* Copyright (c) 2000 by Ed Warnicke <hagbard@physics.rutgers.edu>
*
@ -195,10 +195,6 @@ dissect_mgcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gint tvb_sectionend,tvb_sectionbegin, tvb_len, tvb_current_len;
tvbuff_t *next_tvb;
CHECK_DISPLAY_AS_DATA(proto_mgcp, tvb, pinfo, tree);
pinfo->current_proto = "MGCP";
/* Initialize variables */
tvb_sectionend = 0;
@ -207,6 +203,15 @@ dissect_mgcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_len = tvb_length(tvb);
tvb_current_len = tvb_len;
/*
* Set the columns now, so that they'll be set correctly if we throw
* an exception. We can set them later as well....
*/
if (check_col(pinfo->fd, COL_PROTOCOL))
col_add_str(pinfo->fd, COL_PROTOCOL, "MGCP");
if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
/*
* Check to see whether we're really dealing with MGCP by looking
* for a valid MGCP verb or response code. This isn't infallible,