diff options
-rw-r--r-- | packet-aim.c | 10 | ||||
-rw-r--r-- | packet-bootp.c | 6 | ||||
-rw-r--r-- | packet-bxxp.c | 10 | ||||
-rw-r--r-- | packet-clnp.c | 8 | ||||
-rw-r--r-- | packet-cops.c | 7 | ||||
-rw-r--r-- | packet-ddtp.c | 79 | ||||
-rw-r--r-- | packet-dns.c | 6 | ||||
-rw-r--r-- | packet-esis.c | 8 | ||||
-rw-r--r-- | packet-ftp.c | 18 | ||||
-rw-r--r-- | packet-giop.c | 22 | ||||
-rw-r--r-- | packet-h1.c | 12 | ||||
-rw-r--r-- | packet-icp.c | 10 | ||||
-rw-r--r-- | packet-imap.c | 10 | ||||
-rw-r--r-- | packet-lpd.c | 6 | ||||
-rw-r--r-- | packet-nbns.c | 24 | ||||
-rw-r--r-- | packet-nntp.c | 14 | ||||
-rw-r--r-- | packet-ntp.c | 6 | ||||
-rw-r--r-- | packet-pop.c | 10 | ||||
-rw-r--r-- | packet-pptp.c | 6 | ||||
-rw-r--r-- | packet-quake.c | 14 | ||||
-rw-r--r-- | packet-rip.c | 9 | ||||
-rw-r--r-- | packet-ripng.c | 35 | ||||
-rw-r--r-- | packet-rlogin.c | 5 | ||||
-rw-r--r-- | packet-rpc.c | 16 | ||||
-rw-r--r-- | packet-rpc.h | 3 | ||||
-rw-r--r-- | packet-rsh.c | 19 | ||||
-rw-r--r-- | packet-rsvp.c | 18 | ||||
-rw-r--r-- | packet-wccp.c | 9 | ||||
-rw-r--r-- | packet-who.c | 6 | ||||
-rw-r--r-- | packet-wsp.c | 16 | ||||
-rw-r--r-- | packet-wtp.c | 24 | ||||
-rw-r--r-- | packet-x11.c | 17 | ||||
-rw-r--r-- | packet-xot.c | 9 | ||||
-rw-r--r-- | packet-zebra.c | 8 |
34 files changed, 216 insertions, 264 deletions
diff --git a/packet-aim.c b/packet-aim.c index 7954e552ae..4d9b0edd23 100644 --- a/packet-aim.c +++ b/packet-aim.c @@ -2,7 +2,7 @@ * Routines for AIM Instant Messenger (OSCAR) dissection * Copyright 2000, Ralf Hoelzer <ralf@well.com> * - * $Id: packet-aim.c,v 1.6 2001/01/09 06:31:33 guy Exp $ + * $Id: packet-aim.c,v 1.7 2001/01/22 08:03:44 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -107,7 +107,6 @@ static void dissect_aim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) unsigned short hdr_sequence_no; /* Internal frame sequence number, not needed */ unsigned short hdr_data_field_length; /* length of data within frame */ - guint16 family; guint16 subtype; guint8 buddyname_length = 0; @@ -120,13 +119,6 @@ static void dissect_aim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *aim_tree = NULL; proto_tree *aim_tree_fnac = NULL; -/* Check if protocol decoding is enabled else decode as data and return */ - - CHECK_DISPLAY_AS_DATA(proto_aim, tvb, pinfo, tree); - -/* load the display labels */ - pinfo->current_proto = "AIM"; - /* check, if this is really an AIM packet, they start with 0x2a */ if(!(tvb_get_guint8(tvb, 0) == 0x2a)) { diff --git a/packet-bootp.c b/packet-bootp.c index 3ce1823193..12218c791b 100644 --- a/packet-bootp.c +++ b/packet-bootp.c @@ -2,7 +2,7 @@ * Routines for BOOTP/DHCP packet disassembly * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-bootp.c,v 1.45 2001/01/09 06:31:34 guy Exp $ + * $Id: packet-bootp.c,v 1.46 2001/01/22 08:03:44 guy Exp $ * * The information used comes from: * RFC 951: Bootstrap Protocol @@ -654,10 +654,6 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gboolean is_dhcp = FALSE; const char *dhcp_type; - CHECK_DISPLAY_AS_DATA(proto_bootp, tvb, pinfo, tree); - - pinfo->current_proto = "BOOTP/DHCP"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "BOOTP"); if (check_col(pinfo->fd, COL_INFO)) { diff --git a/packet-bxxp.c b/packet-bxxp.c index 7d3e012673..60bcf27e83 100644 --- a/packet-bxxp.c +++ b/packet-bxxp.c @@ -1,7 +1,7 @@ /* packet-bxxp.c * Routines for BXXP packet disassembly * - * $Id: packet-bxxp.c,v 1.15 2001/01/09 06:31:34 guy Exp $ + * $Id: packet-bxxp.c,v 1.16 2001/01/22 08:03:44 guy Exp $ * * Copyright (c) 2000 by Richard Sharpe <rsharpe@ns.aus.com> * @@ -986,10 +986,6 @@ dissect_bxxp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) struct bxxp_request_key request_key, *new_request_key; struct bxxp_request_val *request_val = NULL; - CHECK_DISPLAY_AS_DATA(proto_bxxp, tvb, pinfo, tree); - - pinfo->current_proto = "BXXP"; - offset = 0; /* If we have per frame data, use that, else, we must have lost the per- @@ -1053,7 +1049,9 @@ dissect_bxxp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->fd, COL_INFO)) { /* Check the type ... */ - col_add_fstr(pinfo->fd, COL_INFO, "%s", tvb_format_text(tvb, offset, tvb_length_remaining(tvb, offset))); + /* "tvb_format_text()" is passed a value that won't go past the end + * of the packet, so it won't throw an exception. */ + col_add_str(pinfo->fd, COL_INFO, tvb_format_text(tvb, offset, tvb_length_remaining(tvb, offset))); } diff --git a/packet-clnp.c b/packet-clnp.c index 6a65b639a9..8e38581350 100644 --- a/packet-clnp.c +++ b/packet-clnp.c @@ -1,7 +1,7 @@ /* packet-clnp.c * Routines for ISO/OSI network and transport protocol packet disassembly * - * $Id: packet-clnp.c,v 1.23 2001/01/10 09:07:35 guy Exp $ + * $Id: packet-clnp.c,v 1.24 2001/01/22 08:03:44 guy Exp $ * Laurent Deniel <deniel@worldnet.fr> * Ralf Schneider <Ralf.Schneider@t-online.de> * @@ -1571,12 +1571,10 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *discpdu_tree; tvbuff_t *next_tvb; - CHECK_DISPLAY_AS_DATA(proto_clnp, tvb, pinfo, tree); - - pinfo->current_proto = "CLNP"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "CLNP"); + if (check_col(pinfo->fd, COL_INFO)) + col_clear(pinfo->fd, COL_INFO); cnf_proto_id = tvb_get_guint8(tvb, P_CLNP_PROTO_ID); if (cnf_proto_id == NLPID_NULL) { diff --git a/packet-cops.c b/packet-cops.c index 675e3f2897..66dbf29c03 100644 --- a/packet-cops.c +++ b/packet-cops.c @@ -4,7 +4,7 @@ * * Copyright 2000, Heikki Vatiainen <hessu@cs.tut.fi> * - * $Id: packet-cops.c,v 1.10 2001/01/09 06:31:34 guy Exp $ + * $Id: packet-cops.c,v 1.11 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -266,11 +266,10 @@ static void dissect_cops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 op_code; - CHECK_DISPLAY_AS_DATA(proto_cops, tvb, pinfo, tree); - - pinfo->current_proto = "COPS"; if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "COPS"); + if (check_col(pinfo->fd, COL_INFO)) + col_clear(pinfo->fd, COL_INFO); op_code = tvb_get_guint8(tvb, 1); if (check_col(pinfo->fd, COL_INFO)) diff --git a/packet-ddtp.c b/packet-ddtp.c index aea730cfa9..d63b0520b8 100644 --- a/packet-ddtp.c +++ b/packet-ddtp.c @@ -3,7 +3,7 @@ * see http://ddt.sourceforge.net/ * Olivier Abad <oabad@cybercable.fr> * - * $Id: packet-ddtp.c,v 1.14 2001/01/09 06:31:34 guy Exp $ + * $Id: packet-ddtp.c,v 1.15 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -99,16 +99,17 @@ static const value_string vals_ddtp_status[] = { static void dissect_ddtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *ddtp_tree; + proto_tree *ddtp_tree = NULL; proto_item *ti; - CHECK_DISPLAY_AS_DATA(proto_ddtp, tvb, pinfo, tree); - - pinfo->current_proto = "DDTP"; if (check_col(pinfo->fd, COL_PROTOCOL)) { /* Indicate what kind of message this is. */ col_set_str (pinfo->fd, COL_PROTOCOL, "DDTP"); } + if (check_col(pinfo->fd, COL_INFO)) { + /* In case we throw an exception below. */ + col_clear (pinfo->fd, COL_INFO); + } if (tree) { ti = proto_tree_add_item(tree, proto_ddtp, tvb, 0, tvb_length(tvb), FALSE); @@ -117,47 +118,61 @@ dissect_ddtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(ddtp_tree, hf_ddtp_version, tvb, 0, 4, FALSE); proto_tree_add_item(ddtp_tree, hf_ddtp_encrypt, tvb, 4, 4, FALSE); proto_tree_add_item(ddtp_tree, hf_ddtp_hostid, tvb, 8, 4, FALSE); - if (tvb_get_ntohl(tvb, 4) == DDTP_ENCRYPT_PLAINTEXT) { + } + if (tvb_get_ntohl(tvb, 4) == DDTP_ENCRYPT_PLAINTEXT) { + if (tree) proto_tree_add_item(ddtp_tree, hf_ddtp_msgtype, tvb, 12, 4, FALSE); - switch (tvb_get_ntohl(tvb, 12)) { - case DDTP_MESSAGE_ERROR : - if (check_col(pinfo->fd, COL_INFO)) - col_set_str (pinfo->fd, COL_INFO, "Message Error"); - break; - case DDTP_UPDATE_QUERY : - if (check_col(pinfo->fd, COL_INFO)) - col_set_str (pinfo->fd, COL_INFO, "Update Query"); + switch (tvb_get_ntohl(tvb, 12)) { + case DDTP_MESSAGE_ERROR : + if (check_col(pinfo->fd, COL_INFO)) + col_set_str (pinfo->fd, COL_INFO, "Message Error"); + break; + case DDTP_UPDATE_QUERY : + if (check_col(pinfo->fd, COL_INFO)) + col_set_str (pinfo->fd, COL_INFO, "Update Query"); + if (tree) { proto_tree_add_item(ddtp_tree, hf_ddtp_opcode, tvb, 16, 4, FALSE); proto_tree_add_item(ddtp_tree, hf_ddtp_ipaddr, tvb, 20, 4, FALSE); - break; - case DDTP_UPDATE_REPLY : - if (check_col(pinfo->fd, COL_INFO)) - col_set_str (pinfo->fd, COL_INFO, "Update Reply"); + } + break; + case DDTP_UPDATE_REPLY : + if (check_col(pinfo->fd, COL_INFO)) + col_set_str (pinfo->fd, COL_INFO, "Update Reply"); + if (tree) { proto_tree_add_item(ddtp_tree, hf_ddtp_status, tvb, 16, 4, FALSE); - break; - case DDTP_ALIVE_QUERY : - if (check_col(pinfo->fd, COL_INFO)) - col_set_str (pinfo->fd, COL_INFO, "Alive Query"); + } + break; + case DDTP_ALIVE_QUERY : + if (check_col(pinfo->fd, COL_INFO)) + col_set_str (pinfo->fd, COL_INFO, "Alive Query"); + if (tree) { proto_tree_add_text(ddtp_tree, tvb, 16, 4, "Dummy : %u", tvb_get_ntohl(tvb, 16)); - break; - case DDTP_ALIVE_REPLY : - if (check_col(pinfo->fd, COL_INFO)) - col_set_str (pinfo->fd, COL_INFO, "Alive Reply"); + } + break; + case DDTP_ALIVE_REPLY : + if (check_col(pinfo->fd, COL_INFO)) + col_set_str (pinfo->fd, COL_INFO, "Alive Reply"); + if (tree) { proto_tree_add_text(ddtp_tree, tvb, 16, 4, "Dummy : %u", tvb_get_ntohl(tvb, 16)); - break; - default : - if (check_col(pinfo->fd, COL_INFO)) - col_set_str (pinfo->fd, COL_INFO, "Unknwon type"); + } + break; + default : + if (check_col(pinfo->fd, COL_INFO)) + col_set_str (pinfo->fd, COL_INFO, "Unknown type"); + if (tree) { proto_tree_add_text(ddtp_tree, tvb, 12, 4, "Unknown type : %u", tvb_get_ntohl(tvb, 12)); } } - } + } else { + if (check_col(pinfo->fd, COL_INFO)) + col_set_str (pinfo->fd, COL_INFO, "Encrypted payload"); + } } void @@ -180,7 +195,7 @@ proto_register_ddtp(void) { "Opcode", "ddtp.opcode", FT_UINT32, BASE_DEC, VALS(vals_ddtp_opcode), 0x0, "Update query opcode" } }, { &hf_ddtp_ipaddr, - { "IP addres", "ddtp.ipaddr", FT_IPv4, BASE_NONE, NULL, 0x0, + { "IP address", "ddtp.ipaddr", FT_IPv4, BASE_NONE, NULL, 0x0, "IP address" } }, { &hf_ddtp_status, { "Status", "ddtp.status", FT_UINT32, BASE_DEC, VALS(vals_ddtp_status), 0x0, diff --git a/packet-dns.c b/packet-dns.c index ec0667e2f4..90770b9fb3 100644 --- a/packet-dns.c +++ b/packet-dns.c @@ -1,7 +1,7 @@ /* packet-dns.c * Routines for DNS packet disassembly * - * $Id: packet-dns.c,v 1.61 2001/01/09 06:31:35 guy Exp $ + * $Id: packet-dns.c,v 1.62 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -2249,12 +2249,12 @@ dissect_dns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { OPCODE_UPDATE, "Dynamic update" }, { 0, NULL } }; - OLD_CHECK_DISPLAY_AS_DATA(proto_dns, pd, offset, fd, tree); - dns_data_offset = offset; if (check_col(fd, COL_PROTOCOL)) col_set_str(fd, COL_PROTOCOL, "DNS"); + if (check_col(fd, COL_INFO)) + col_clear(fd, COL_INFO); if (!BYTES_ARE_IN_FRAME(offset, DNS_HDRLEN)) { if (check_col(fd, COL_INFO)) { diff --git a/packet-esis.c b/packet-esis.c index 41e2c436ab..225b9de403 100644 --- a/packet-esis.c +++ b/packet-esis.c @@ -2,7 +2,7 @@ * Routines for ISO/OSI End System to Intermediate System * Routeing Exchange Protocol ISO 9542. * - * $Id: packet-esis.c,v 1.12 2001/01/10 09:07:35 guy Exp $ + * $Id: packet-esis.c,v 1.13 2001/01/22 08:03:45 guy Exp $ * Ralf Schneider <Ralf.Schneider@t-online.de> * * Ethereal - Network traffic analyzer @@ -293,12 +293,10 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int variable_len = 0; u_int tmp_uint = 0; - CHECK_DISPLAY_AS_DATA(proto_esis, tvb, pinfo, tree); - - pinfo->current_proto = "ESIS"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "ESIS"); + if (check_col(pinfo->fd, COL_INFO)) + col_clear(pinfo->fd, COL_INFO); tvb_memcpy(tvb, (guint8 *)&ehdr, 0, sizeof ehdr); diff --git a/packet-ftp.c b/packet-ftp.c index d583d1679d..9a36869c67 100644 --- a/packet-ftp.c +++ b/packet-ftp.c @@ -2,7 +2,7 @@ * Routines for ftp packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-ftp.c,v 1.26 2001/01/09 06:31:35 guy Exp $ + * $Id: packet-ftp.c,v 1.27 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -73,27 +73,27 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int tokenlen; const u_char *next_token; - CHECK_DISPLAY_AS_DATA(proto_ftp, tvb, pinfo, tree); - if (pinfo->match_port == pinfo->destport) is_request = TRUE; else is_request = FALSE; - pinfo->current_proto = "FTP"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "FTP"); /* * Find the end of the first line. + * + * 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); if (check_col(pinfo->fd, COL_INFO)) { /* - * Put the first line from the buffer into the summary. + * Put the first line from the buffer into the summary * (but leave out the line terminator). */ col_add_fstr(pinfo->fd, COL_INFO, "%s: %s", @@ -187,10 +187,6 @@ dissect_ftpdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *ti, *ftp_data_tree; int data_length; - CHECK_DISPLAY_AS_DATA(proto_ftp_data, tvb, pinfo, tree); - - pinfo->current_proto = "FTP-DATA"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "FTP-DATA"); @@ -264,6 +260,6 @@ proto_register_ftp(void) void proto_reg_handoff_ftp(void) { - dissector_add("tcp.port", TCP_PORT_FTPDATA, &dissect_ftpdata, proto_ftp); + dissector_add("tcp.port", TCP_PORT_FTPDATA, &dissect_ftpdata, proto_ftp_data); dissector_add("tcp.port", TCP_PORT_FTP, &dissect_ftp, proto_ftp_data); } diff --git a/packet-giop.c b/packet-giop.c index 6e7bbc9440..56e3f62d6d 100644 --- a/packet-giop.c +++ b/packet-giop.c @@ -4,7 +4,7 @@ * Laurent Deniel <deniel@worldnet.fr> * Craig Rodrigues <rodrigc@mediaone.net> * - * $Id: packet-giop.c,v 1.29 2001/01/16 23:35:58 guy Exp $ + * $Id: packet-giop.c,v 1.30 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1226,11 +1226,6 @@ dissect_giop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) u_int minor_version; gboolean stream_is_big_endian; - if( !proto_is_protocol_enabled( proto_giop )) - return FALSE; /* GIOP has been disabled */ - - pinfo->current_proto = "GIOP"; - /* check magic number and version */ @@ -1290,6 +1285,14 @@ dissect_giop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) return TRUE; } + if (check_col (pinfo->fd, COL_INFO)) + { + col_add_fstr (pinfo->fd, COL_INFO, "GIOP %u.%u %s", + header.GIOP_version.major, header.GIOP_version.minor, + val_to_str(header.message_type, giop_message_types, + "Unknown message type (0x%02x)")); + } + stream_is_big_endian = is_big_endian (&header); if (stream_is_big_endian) @@ -1338,13 +1341,6 @@ dissect_giop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) } /* tree */ - if (check_col (pinfo->fd, COL_INFO)) - { - col_add_fstr (pinfo->fd, COL_INFO, "GIOP %u.%u %s", - header.GIOP_version.major, header.GIOP_version.minor, - match_strval(header.message_type, giop_message_types)); - } - switch (header.message_type) { diff --git a/packet-h1.c b/packet-h1.c index c4c5c9846d..8fe308f18e 100644 --- a/packet-h1.c +++ b/packet-h1.c @@ -2,7 +2,7 @@ * Routines for Sinec H1 packet disassembly * Gerrit Gehnen <G.Gehnen@atrie.de> * - * $Id: packet-h1.c,v 1.17 2001/01/09 06:31:36 guy Exp $ + * $Id: packet-h1.c,v 1.18 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -114,16 +114,18 @@ static gboolean dissect_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) unsigned int position = 3; unsigned int offset=0; - if (!proto_is_protocol_enabled(proto_h1)) - return FALSE; + if (tvb_length_remaining(tvb, 0) < 2) + { + /* Not enough data captured to hold the "S5" header; don't try + to interpret it as H1. */ + return FALSE; + } if (!(tvb_get_guint8(tvb,offset) == 'S' && tvb_get_guint8(tvb,offset+1) == '5')) { return FALSE; } - pinfo->current_proto = "H1"; - if (check_col (pinfo->fd, COL_PROTOCOL)) col_set_str (pinfo->fd, COL_PROTOCOL, "H1"); if (check_col (pinfo->fd, COL_INFO)) diff --git a/packet-icp.c b/packet-icp.c index f9b13f89bd..0275325666 100644 --- a/packet-icp.c +++ b/packet-icp.c @@ -2,7 +2,7 @@ * Routines for ICP (internet cache protocol) packet disassembly * RFC 2186 && RFC 2187 * - * $Id: packet-icp.c,v 1.15 2001/01/09 06:31:36 guy Exp $ + * $Id: packet-icp.c,v 1.16 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Peter Torvals @@ -182,7 +182,10 @@ static void dissect_icp(const u_char *pd, int offset, frame_data *fd, gchar *opcodestrval; - OLD_CHECK_DISPLAY_AS_DATA(proto_icp, pd, offset, fd, tree); + if (check_col(fd, COL_PROTOCOL)) + col_set_str(fd, COL_PROTOCOL, "ICP"); + if (check_col(fd, COL_INFO)) + col_clear(fd, COL_INFO); /* TBD: check if this is the first fragment of a fragmented UDP datagram? Or just wait for IP fragment reassembly to be implemented? */ @@ -202,9 +205,6 @@ static void dissect_icp(const u_char *pd, int offset, frame_data *fd, sprintf(textbuf,"opc: %s(%u), Req Nr: %u", opcodestrval, (guint16)icph.opcode,icph.request_number); - if (check_col(fd, COL_PROTOCOL)) - col_set_str(fd, COL_PROTOCOL, "ICP"); - if (check_col(fd, COL_INFO)) { col_add_fstr(fd,COL_INFO,textbuf); diff --git a/packet-imap.c b/packet-imap.c index bef3bb98f9..e595586e63 100644 --- a/packet-imap.c +++ b/packet-imap.c @@ -2,7 +2,7 @@ * Routines for imap packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-imap.c,v 1.13 2001/01/09 06:31:36 guy Exp $ + * $Id: packet-imap.c,v 1.14 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -64,15 +64,15 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int tokenlen; const u_char *next_token; - CHECK_DISPLAY_AS_DATA(proto_imap, tvb, pinfo, tree); - - pinfo->current_proto = "IMAP"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "IMAP"); /* * Find the end of the first line. + * + * 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); diff --git a/packet-lpd.c b/packet-lpd.c index 97b123c7e3..5d06fd9c7c 100644 --- a/packet-lpd.c +++ b/packet-lpd.c @@ -2,7 +2,7 @@ * Routines for LPR and LPRng packet disassembly * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-lpd.c,v 1.26 2001/01/09 06:31:38 guy Exp $ + * $Id: packet-lpd.c,v 1.27 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -79,10 +79,6 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "Bad job format, do not retry" }; - CHECK_DISPLAY_AS_DATA(proto_lpd, tvb, pinfo, tree); - - pinfo->current_proto = "LPD"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "LPD"); if (check_col(pinfo->fd, COL_INFO)) diff --git a/packet-nbns.c b/packet-nbns.c index 89e8ceff8d..6a6084b274 100644 --- a/packet-nbns.c +++ b/packet-nbns.c @@ -4,7 +4,7 @@ * Gilbert Ramirez <gram@xiexie.org> * Much stuff added by Guy Harris <guy@alum.mit.edu> * - * $Id: packet-nbns.c,v 1.50 2001/01/09 06:31:38 guy Exp $ + * $Id: packet-nbns.c,v 1.51 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1135,12 +1135,12 @@ dissect_nbns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) guint16 id, flags, quest, ans, auth, add; int cur_off; - OLD_CHECK_DISPLAY_AS_DATA(proto_nbns, pd, offset, fd, tree); - nbns_data_offset = offset; if (check_col(fd, COL_PROTOCOL)) col_set_str(fd, COL_PROTOCOL, "NBNS"); + if (check_col(fd, COL_INFO)) + col_clear(fd, COL_INFO); if (pi.captured_len < NBNS_HDRLEN) { if (check_col(fd, COL_INFO)) { @@ -1299,7 +1299,10 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) int name_type; int len; - OLD_CHECK_DISPLAY_AS_DATA(proto_nbdgm, pd, offset, fd, tree); + if (check_col(fd, COL_PROTOCOL)) + col_set_str(fd, COL_PROTOCOL, "NBDS"); + if (check_col(fd, COL_INFO)) + col_clear(fd, COL_INFO); header.msg_type = pd[offset]; @@ -1326,10 +1329,8 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) message_index = 0; } - if (check_col(fd, COL_PROTOCOL)) - col_set_str(fd, COL_PROTOCOL, "NBDS"); if (check_col(fd, COL_INFO)) { - col_add_fstr(fd, COL_INFO, "%s", message[message_index]); + col_set_str(fd, COL_INFO, message[message_index]); } if (tree) { @@ -1594,7 +1595,10 @@ dissect_nbss(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) int max_data; int is_cifs; - OLD_CHECK_DISPLAY_AS_DATA(proto_nbss, pd, offset, fd, tree); + if (check_col(fd, COL_PROTOCOL)) + col_set_str(fd, COL_PROTOCOL, "NBSS"); + if (check_col(fd, COL_INFO)) + col_clear(fd, COL_INFO); msg_type = pd[offset]; @@ -1636,8 +1640,6 @@ dissect_nbss(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ((msg_type == SESSION_MESSAGE) && (memcmp(pd + offset + 4, "\377SMB", 4) != 0))) { - if (check_col(fd, COL_PROTOCOL)) - col_set_str(fd, COL_PROTOCOL, "NBSS"); if (check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, "NBSS Continuation Message"); } @@ -1649,8 +1651,6 @@ dissect_nbss(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } #endif - if (check_col(fd, COL_PROTOCOL)) - col_set_str(fd, COL_PROTOCOL, "NBSS"); if (check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, val_to_str(msg_type, message_types, "Unknown (%x)")); diff --git a/packet-nntp.c b/packet-nntp.c index 17d6e0f26d..3036d1ae2f 100644 --- a/packet-nntp.c +++ b/packet-nntp.c @@ -2,7 +2,7 @@ * Routines for nntp packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-nntp.c,v 1.18 2001/01/09 06:31:39 guy Exp $ + * $Id: packet-nntp.c,v 1.19 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -57,19 +57,14 @@ dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *nntp_tree; proto_item *ti; gint offset = 0; - const u_char *line; gint next_offset; int linelen; - CHECK_DISPLAY_AS_DATA(proto_nntp, tvb, pinfo, tree); - if (pinfo->match_port == pinfo->destport) type = "Request"; else type = "Response"; - pinfo->current_proto = "NNTP"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "NNTP"); @@ -77,11 +72,14 @@ dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Put the first line from the buffer into the summary * (but leave out the line terminator). + * + * 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); col_add_fstr(pinfo->fd, COL_INFO, "%s: %s", type, - format_text(line, linelen)); + tvb_format_text(tvb, offset, linelen)); } if (tree) { diff --git a/packet-ntp.c b/packet-ntp.c index 31a39dfb4a..387cc938cd 100644 --- a/packet-ntp.c +++ b/packet-ntp.c @@ -2,7 +2,7 @@ * Routines for NTP packet dissection * Copyright 1999, Nathan Neulinger <nneul@umr.edu> * - * $Id: packet-ntp.c,v 1.24 2001/01/09 06:31:39 guy Exp $ + * $Id: packet-ntp.c,v 1.25 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -268,10 +268,6 @@ dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gchar buff[NTP_TS_SIZE]; int i; - CHECK_DISPLAY_AS_DATA(proto_ntp, tvb, pinfo, tree); - - pinfo->current_proto = "NTP"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "NTP"); diff --git a/packet-pop.c b/packet-pop.c index ad73038174..bf07f700e2 100644 --- a/packet-pop.c +++ b/packet-pop.c @@ -2,7 +2,7 @@ * Routines for pop packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-pop.c,v 1.23 2001/01/09 06:31:40 guy Exp $ + * $Id: packet-pop.c,v 1.24 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -68,15 +68,15 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int tokenlen; const u_char *next_token; - CHECK_DISPLAY_AS_DATA(proto_pop, tvb, pinfo, tree); - - pinfo->current_proto = "POP"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "POP"); /* * Find the end of the first line. + * + * 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); diff --git a/packet-pptp.c b/packet-pptp.c index c90565cb6e..2caa3b7ff0 100644 --- a/packet-pptp.c +++ b/packet-pptp.c @@ -2,7 +2,7 @@ * Routines for the Point-to-Point Tunnelling Protocol (PPTP) (RFC 2637) * Brad Robel-Forrest <brad.robel-forrest@watchguard.com> * - * $Id: packet-pptp.c,v 1.17 2001/01/09 06:31:40 guy Exp $ + * $Id: packet-pptp.c,v 1.18 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -242,10 +242,6 @@ dissect_pptp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 len; guint16 cntrl_type; - CHECK_DISPLAY_AS_DATA(proto_pptp, tvb, pinfo, tree); - - pinfo->current_proto = "PPTP"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "PPTP"); if (check_col(pinfo->fd, COL_INFO)) diff --git a/packet-quake.c b/packet-quake.c index 867a2b41dc..0e7ec25b18 100644 --- a/packet-quake.c +++ b/packet-quake.c @@ -4,7 +4,7 @@ * Uwe Girlich <uwe@planetquake.com> * http://www.idsoftware.com/q1source/q1source.zip * - * $Id: packet-quake.c,v 1.12 2001/01/09 06:31:40 guy Exp $ + * $Id: packet-quake.c,v 1.13 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -516,19 +516,15 @@ dissect_quake(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint rest_length; tvbuff_t *next_tvb; - CHECK_DISPLAY_AS_DATA(proto_quake, tvb, pinfo, tree); - - pinfo->current_proto = "QUAKE"; - - if (!tvb_bytes_exist(tvb, 0, 4)) return; + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "QUAKE"); + if (check_col(pinfo->fd, COL_INFO)) + col_clear(pinfo->fd, COL_INFO); length = tvb_get_ntohl(tvb, 0); flags = length & (~NETFLAG_LENGTH_MASK); length &= NETFLAG_LENGTH_MASK; - if (check_col(pinfo->fd, COL_PROTOCOL)) - col_set_str(pinfo->fd, COL_PROTOCOL, "QUAKE"); - if (tree) { quake_item = proto_tree_add_item(tree, proto_quake, tvb, 0, tvb_length(tvb), FALSE); diff --git a/packet-rip.c b/packet-rip.c index 95aea43745..38ce10a988 100644 --- a/packet-rip.c +++ b/packet-rip.c @@ -2,7 +2,7 @@ * Routines for RIPv1 and RIPv2 packet disassembly * (c) Copyright Hannes R. Boehm <hannes@boehm.org> * - * $Id: packet-rip.c,v 1.22 2001/01/09 06:31:40 guy Exp $ + * $Id: packet-rip.c,v 1.23 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -82,9 +82,10 @@ dissect_rip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 family; guint reported_length; - CHECK_DISPLAY_AS_DATA(proto_rip, tvb, pinfo, tree); - - pinfo->current_proto = "RIP"; + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "RIP"); + if (check_col(pinfo->fd, COL_INFO)) + col_clear(pinfo->fd, COL_INFO); command = tvb_get_guint8(tvb, 0); version = tvb_get_guint8(tvb, 1); diff --git a/packet-ripng.c b/packet-ripng.c index 747a7b81f3..5b34393050 100644 --- a/packet-ripng.c +++ b/packet-ripng.c @@ -3,7 +3,7 @@ * (c) Copyright Jun-ichiro itojun Hagino <itojun@itojun.org> * derived from packet-rip.c * - * $Id: packet-ripng.c,v 1.17 2001/01/09 06:31:40 guy Exp $ + * $Id: packet-ripng.c,v 1.18 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -54,6 +54,12 @@ static gint ett_ripng_addr = -1; #define UDP_PORT_RIPNG 521 +static const value_string cmdvals[] = { + { RIP6_REQUEST, "Request" }, + { RIP6_RESPONSE, "Response" }, + { 0, NULL }, +}; + static void dissect_ripng(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { struct rip6 rip6; @@ -61,32 +67,27 @@ dissect_ripng(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree *ripng_tree = NULL; proto_tree *subtree = NULL; proto_item *ti; - static const value_string cmdvals[] = { - { RIP6_REQUEST, "Request" }, - { RIP6_RESPONSE, "Response" }, - { 0, NULL }, - }; - const char *cmd; - OLD_CHECK_DISPLAY_AS_DATA(proto_ripng, pd, offset, fd, tree); + if (check_col(fd, COL_PROTOCOL)) + col_set_str(fd, COL_PROTOCOL, "RIPng"); + if (check_col(fd, COL_INFO)) + col_clear(fd, COL_INFO); /* avoid alignment problem */ memcpy(&rip6, &pd[offset], sizeof(rip6)); - cmd = val_to_str(rip6.rip6_cmd, cmdvals, "Unknown"); - if (check_col(fd, COL_PROTOCOL)) col_add_fstr(fd, COL_PROTOCOL, "RIPng version %u", rip6.rip6_vers); if (check_col(fd, COL_INFO)) - col_add_fstr(fd, COL_INFO, "%s", cmd); + col_add_str(fd, COL_INFO, + val_to_str(rip6.rip6_cmd, cmdvals, "Unknown command (%u)")); if (tree) { ti = proto_tree_add_item(tree, proto_ripng, NullTVB, offset, END_OF_FRAME, FALSE); ripng_tree = proto_item_add_subtree(ti, ett_ripng); - proto_tree_add_uint_format(ripng_tree, hf_ripng_cmd, NullTVB, offset, 1, - rip6.rip6_cmd, - "Command: %s (%u)", cmd, rip6.rip6_cmd); + proto_tree_add_uint(ripng_tree, hf_ripng_cmd, NullTVB, offset, 1, + rip6.rip6_cmd); proto_tree_add_uint(ripng_tree, hf_ripng_version, NullTVB, offset + 1, 1, rip6.rip6_vers); @@ -141,10 +142,12 @@ proto_register_ripng(void) static hf_register_info hf[] = { { &hf_ripng_cmd, { "Command", "ripng.cmd", - FT_UINT8, BASE_DEC, NULL, 0x0, "" }}, + FT_UINT8, BASE_DEC, VALS(cmdvals), + 0x0, "" }}, { &hf_ripng_version, { "Version", "ripng.version", - FT_UINT8, BASE_DEC, NULL, 0x0, "" }}, + FT_UINT8, BASE_DEC, NULL, + 0x0, "" }}, }; static gint *ett[] = { &ett_ripng, diff --git a/packet-rlogin.c b/packet-rlogin.c index 3d9ee25a8f..c30cdab99d 100644 --- a/packet-rlogin.c +++ b/packet-rlogin.c @@ -2,7 +2,7 @@ * Routines for unix rlogin packet dissection * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet-rlogin.c,v 1.13 2001/01/09 06:31:41 guy Exp $ + * $Id: packet-rlogin.c,v 1.14 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -365,8 +365,6 @@ dissect_rlogin(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { rlogin_hash_entry_t *hash_info = 0; conversation_t *conversation; - OLD_CHECK_DISPLAY_AS_DATA(proto_rlogin, pd, offset, fd, tree); - /* Lookup this connection*/ conversation = find_conversation( &pi.src, &pi.dst, pi.ptype, pi.srcport, pi.destport, 0); @@ -392,6 +390,7 @@ dissect_rlogin(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { char temp[1000]; + col_clear(fd, COL_INFO); if ( hash_info->name[0]) { strcpy( temp, "User name: "); strcat( temp, hash_info->name); diff --git a/packet-rpc.c b/packet-rpc.c index f8559889d2..585d802ad9 100644 --- a/packet-rpc.c +++ b/packet-rpc.c @@ -2,7 +2,7 @@ * Routines for rpc dissection * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de> * - * $Id: packet-rpc.c,v 1.49 2001/01/18 06:33:23 guy Exp $ + * $Id: packet-rpc.c,v 1.50 2001/01/22 08:03:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1034,7 +1034,7 @@ dissect_rpc_authgss_priv_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } -gboolean +static gboolean dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; @@ -1087,11 +1087,6 @@ dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_function_t *dissect_function = NULL; - if (!proto_is_protocol_enabled(proto_rpc)) - return FALSE; - - pinfo->current_proto = "RPC"; - /* TCP uses record marking */ use_rm = (pinfo->ptype == PT_TCP); @@ -1175,6 +1170,8 @@ dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "RPC"); + if (check_col(pinfo->fd, COL_INFO)) + col_clear(pinfo->fd, COL_INFO); if (tree) { rpc_item = proto_tree_add_item(tree, proto_rpc, tvb, 0, @@ -1231,7 +1228,7 @@ dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->fd, COL_PROTOCOL)) { /* Set the protocol name to the underlying program name. */ - col_add_fstr(pinfo->fd, COL_PROTOCOL, "%s", progname); + col_set_str(pinfo->fd, COL_PROTOCOL, progname); } if (!tvb_bytes_exist(tvb, offset+8,4)) @@ -1403,8 +1400,7 @@ dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->fd, COL_PROTOCOL)) { /* Set the protocol name to the underlying program name. */ - col_add_fstr(pinfo->fd, COL_PROTOCOL, "%s", - progname); + col_set_str(pinfo->fd, COL_PROTOCOL, progname); } } diff --git a/packet-rpc.h b/packet-rpc.h index b486426484..4e33eeeb0f 100644 --- a/packet-rpc.h +++ b/packet-rpc.h @@ -1,6 +1,6 @@ /* packet-rpc.h * - * $Id: packet-rpc.h,v 1.21 2000/11/22 00:34:15 guy Exp $ + * $Id: packet-rpc.h,v 1.22 2001/01/22 08:03:46 guy Exp $ * * (c) 1999 Uwe Girlich * @@ -109,7 +109,6 @@ extern void rpc_init_prog(int proto, guint32 prog, int ett); extern char *rpc_prog_name(guint32 prog); extern unsigned int rpc_roundup(unsigned int a); -extern gboolean dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); extern int dissect_rpc_bool(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hfindex); extern int dissect_rpc_bool_tvb(tvbuff_t *tvb, packet_info *pinfo, diff --git a/packet-rsh.c b/packet-rsh.c index 78e1680faa..2a549fdf8f 100644 --- a/packet-rsh.c +++ b/packet-rsh.c @@ -4,7 +4,7 @@ * Robert Tsai <rtsai@netapp.com> * Liberally copied from packet-http.c, by Guy Harris <guy@alum.mit.edu> * - * $Id: packet-rsh.c,v 1.9 2001/01/09 06:31:41 guy Exp $ + * $Id: packet-rsh.c,v 1.10 2001/01/22 08:03:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -53,22 +53,25 @@ dissect_rsh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *rsh_tree; proto_item *ti; gint offset = 0; - const u_char *line; gint next_offset; int linelen; - CHECK_DISPLAY_AS_DATA(proto_rsh, tvb, pinfo, tree); - - pinfo->current_proto = "RSH"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "RSH"); if (check_col(pinfo->fd, COL_INFO)) { /* Put the first line from the buffer into the summary. */ tvb_find_line_end(tvb, offset, -1, &next_offset); linelen = next_offset - offset; /* include the line terminator */ - line = tvb_get_ptr(tvb, offset, linelen); - col_add_str(pinfo->fd, COL_INFO, format_text(line, linelen)); + + /* + * Make sure the line terminator isn't past the end of + * the captured data in the packet, so we don't throw + * an exception in the "tvb_get_ptr()" call. + */ + if (linelen > tvb_length(tvb)) + linelen = tvb_length(tvb); + col_add_str(pinfo->fd, COL_INFO, + tvb_format_text(tvb, offset, linelen)); } if (tree) { ti = proto_tree_add_item(tree, proto_rsh, tvb, offset, diff --git a/packet-rsvp.c b/packet-rsvp.c index 214a6f720d..f3e745128d 100644 --- a/packet-rsvp.c +++ b/packet-rsvp.c @@ -3,7 +3,7 @@ * * (c) Copyright Ashok Narayanan <ashokn@cisco.com> * - * $Id: packet-rsvp.c,v 1.32 2001/01/10 23:30:41 guy Exp $ + * $Id: packet-rsvp.c,v 1.33 2001/01/22 08:03:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -845,7 +845,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree *rsvp_object_tree; proto_tree *rsvp_sa_flags_tree; proto_tree *rsvp_ero_subtree; - char *packet_type, *object_type; + char *object_type; rsvp_header *hdr; rsvp_object *obj; int i, j, k, l, len, mylen; @@ -855,17 +855,15 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) struct e_in6_addr *ip6a; guint32 ip_addr; - OLD_CHECK_DISPLAY_AS_DATA(proto_rsvp, pd, offset, fd, tree); - - hdr = (rsvp_header *)&pd[offset]; - packet_type = match_strval(hdr->message_type, message_type_vals); if (check_col(fd, COL_PROTOCOL)) col_set_str(fd, COL_PROTOCOL, "RSVP"); + if (check_col(fd, COL_INFO)) + col_clear(fd, COL_INFO); + + hdr = (rsvp_header *)&pd[offset]; if (check_col(fd, COL_INFO)) { - if (packet_type != NULL) - col_add_str(fd, COL_INFO, packet_type); - else - col_add_fstr(fd, COL_INFO, "Unknown (%u)", hdr->message_type); + col_add_str(fd, COL_INFO, + val_to_str(hdr->message_type, message_type_vals, "Unknown (%u)")); } if (tree) { diff --git a/packet-wccp.c b/packet-wccp.c index b745f20897..98fca3ba76 100644 --- a/packet-wccp.c +++ b/packet-wccp.c @@ -2,7 +2,7 @@ * Routines for Web Cache Coordination Protocol dissection * Jerry Talkington <jerryt@netapp.com> * - * $Id: packet-wccp.c,v 1.16 2001/01/09 06:31:44 guy Exp $ + * $Id: packet-wccp.c,v 1.17 2001/01/22 08:03:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -188,13 +188,12 @@ dissect_wccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 cache_count; int i; - CHECK_DISPLAY_AS_DATA(proto_wccp, tvb, pinfo, tree); - - pinfo->current_proto = "WCCP"; - if(check_col(pinfo->fd, COL_PROTOCOL)) { col_set_str(pinfo->fd, COL_PROTOCOL, "WCCP"); } + if(check_col(pinfo->fd, COL_INFO)) { + col_clear(pinfo->fd, COL_INFO); + } wccp_message_type = tvb_get_ntohl(tvb, offset); diff --git a/packet-who.c b/packet-who.c index 1880066e77..e008613b3d 100644 --- a/packet-who.c +++ b/packet-who.c @@ -2,7 +2,7 @@ * Routines for who protocol (see man rwhod) * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-who.c,v 1.14 2001/01/09 06:31:45 guy Exp $ + * $Id: packet-who.c,v 1.15 2001/01/22 08:03:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -104,10 +104,6 @@ dissect_who(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) double loadav_5 = 0.0, loadav_10 = 0.0, loadav_15 = 0.0; struct timeval tv; - CHECK_DISPLAY_AS_DATA(proto_who, tvb, pinfo, tree); - - pinfo->current_proto = "WHO"; - /* Summary information */ if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "WHO"); diff --git a/packet-wsp.c b/packet-wsp.c index 48f67372ba..dbce4a3a57 100644 --- a/packet-wsp.c +++ b/packet-wsp.c @@ -3,7 +3,7 @@ * * Routines to dissect WSP component of WAP traffic. * - * $Id: packet-wsp.c,v 1.11 2001/01/16 23:10:24 guy Exp $ + * $Id: packet-wsp.c,v 1.12 2001/01/22 08:03:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -383,8 +383,6 @@ dissect_wsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) frame_data *fdata = pinfo->fd; int offset = 0; - char szInfo[ 50 ]; - int cchInfo; guint8 pdut; guint count = 0; guint value = 0; @@ -406,10 +404,6 @@ dissect_wsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* proto_tree *wsp_header_fixed; */ proto_tree *wsp_capabilities; - CHECK_DISPLAY_AS_DATA(proto_wsp, tvb, pinfo, tree); - - pinfo->current_proto = "WSP"; - /* This field shows up as the "Info" column in the display; you should make it, if possible, summarize what's in the packet, so that a user looking at the list of packets can tell what type of packet it is. */ @@ -427,6 +421,9 @@ dissect_wsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } } + if (check_col(fdata, COL_INFO)) { + col_clear(fdata, COL_INFO); + }; /* Connection-less mode has a TID first */ if ((pinfo->match_port == UDP_PORT_WSP) || (pinfo->match_port == UDP_PORT_WTLS_WSP)) @@ -438,10 +435,9 @@ dissect_wsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pdut = tvb_get_guint8 (tvb, offset); /* Develop the string to put in the Info column */ - cchInfo = snprintf( szInfo, sizeof( szInfo ), "WSP %s", - val_to_str (pdut, vals_pdu_type, "Unknown PDU type (0x%02x)")); if (check_col(fdata, COL_INFO)) { - col_add_str(fdata, COL_INFO, szInfo ); + col_add_fstr(fdata, COL_INFO, "WSP %s", + val_to_str (pdut, vals_pdu_type, "Unknown PDU type (0x%02x)")); }; /* In the interest of speed, if "tree" is NULL, don't do any work not diff --git a/packet-wtp.c b/packet-wtp.c index e066b5b7d2..84f404635b 100644 --- a/packet-wtp.c +++ b/packet-wtp.c @@ -3,7 +3,7 @@ * * Routines to dissect WTP component of WAP traffic. * - * $Id: packet-wtp.c,v 1.9 2001/01/09 06:31:45 guy Exp $ + * $Id: packet-wtp.c,v 1.10 2001/01/22 08:03:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -188,11 +188,11 @@ dissect_wtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) unsigned char b0 = pd[offset + 0]; unsigned char b3 = pd[offset + 3]; */ - unsigned char b0 = tvb_get_guint8 (tvb, offCur + 0); + unsigned char b0; /* continuation flag */ - unsigned char fCon = b0 & 0x80; - unsigned char fRID = retransmission_indicator( b0 ); + unsigned char fCon; + unsigned char fRID; int cbHeader = 0; int abortType = 0; @@ -201,17 +201,13 @@ dissect_wtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *wtp_tree; proto_tree *wtp_header_fixed; - char pdut = pdu_type( b0 ); + char pdut; char clsTransaction = ' '; int cchInfo; int numMissing = 0; /* Number of missing packets in a negative ack */ int i; tvbuff_t *wsp_tvb = NULL; - CHECK_DISPLAY_AS_DATA(proto_wtp, tvb, pinfo, tree); - - pinfo->current_proto = "WTP"; - /* Make entries in Protocol column and Info column of summary display */ #ifdef DEBUG @@ -233,7 +229,15 @@ dissect_wtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } } + if (check_col(fdata, COL_INFO)) { + col_clear(fdata, COL_INFO); + }; + b0 = tvb_get_guint8 (tvb, offCur + 0); + fCon = b0 & 0x80; + fRID = retransmission_indicator( b0 ); + pdut = pdu_type( b0 ); + /* Develop the string to put in the Info column */ cchInfo = snprintf( szInfo, sizeof( szInfo ), "WTP %s", vals_pdu_type[ ( int )pdut ].strptr ); @@ -630,5 +634,5 @@ proto_reg_handoff_wtp(void) wsp_handle = find_dissector("wsp"); dissector_add("udp.port", UDP_PORT_WTP_WSP, dissect_wtp, proto_wtp); - /* dissector_add("udp.port", UDP_PORT_WTLS_WTP_WSP, dissect_wsp, proto_wsp); */ + /* dissector_add("udp.port", UDP_PORT_WTLS_WTP_WSP, dissect_wtp, proto_wtp); */ } diff --git a/packet-x11.c b/packet-x11.c index 74ba12056b..9b2f897c2a 100644 --- a/packet-x11.c +++ b/packet-x11.c @@ -2,7 +2,7 @@ * Routines for X11 dissection * Copyright 2000, Christophe Tronche <ch.tronche@computer.org> * - * $Id: packet-x11.c,v 1.15 2001/01/09 06:31:45 guy Exp $ + * $Id: packet-x11.c,v 1.16 2001/01/22 08:03:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -2842,10 +2842,6 @@ dissect_x11_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *x11_tree; int left; -/* Make entries in Protocol column and Info column on summary display */ - if (check_col(pinfo->fd, COL_PROTOCOL)) - col_set_str(pinfo->fd, COL_PROTOCOL, "X11"); - /* This field shows up as the "Info" column in the display; you should make it, if possible, summarize what's in the packet, so that a user looking at the list of packets can tell what type of packet it is. */ @@ -2873,10 +2869,6 @@ dissect_x11_event(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *ti; proto_tree *x11_tree; -/* Make entries in Protocol column and Info column on summary display */ - if (check_col(pinfo->fd, COL_PROTOCOL)) - col_set_str(pinfo->fd, COL_PROTOCOL, "X11"); - /* This field shows up as the "Info" column in the display; you should make it, if possible, summarize what's in the packet, so that a user looking at the list of packets can tell what type of packet it is. */ @@ -2899,10 +2891,9 @@ dissect_x11_event(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_x11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - - CHECK_DISPLAY_AS_DATA(proto_x11, tvb, pinfo, tree); - - pinfo->current_proto = "X11"; + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "X11"); + if (pinfo->match_port == pinfo->destport) dissect_x11_request(tvb, pinfo, tree); else diff --git a/packet-xot.c b/packet-xot.c index be5299ba9f..290a381e4c 100644 --- a/packet-xot.c +++ b/packet-xot.c @@ -3,7 +3,7 @@ * * Copyright 2000, Paul Ionescu <paul@acorp.ro> * - * $Id: packet-xot.c,v 1.3 2001/01/09 06:31:45 guy Exp $ + * $Id: packet-xot.c,v 1.4 2001/01/22 08:03:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -50,11 +50,10 @@ static void dissect_xot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 version,len; tvbuff_t *next_tvb; - CHECK_DISPLAY_AS_DATA(proto_xot, tvb, pinfo, tree); - - pinfo->current_proto = "XOT"; - if (check_col(pinfo->fd, COL_PROTOCOL)) + if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "XOT"); + if (check_col(pinfo->fd, COL_INFO)) + col_clear(pinfo->fd, COL_INFO); version = tvb_get_ntohs(tvb,0); len = tvb_get_ntohs(tvb,2); diff --git a/packet-zebra.c b/packet-zebra.c index 7a8f88634d..424e761c68 100644 --- a/packet-zebra.c +++ b/packet-zebra.c @@ -3,7 +3,7 @@ * * Jochen Friedrich <jochen@scram.de> * - * $Id: packet-zebra.c,v 1.8 2001/01/09 06:31:45 guy Exp $ + * $Id: packet-zebra.c,v 1.9 2001/01/22 08:03:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -476,14 +476,10 @@ dissect_zebra(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gboolean request; int left, offset; - CHECK_DISPLAY_AS_DATA(proto_zebra, tvb, pinfo, tree); - - pinfo->current_proto = "ZEBRA"; - if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "ZEBRA"); - request = (pi.destport == TCP_PORT_ZEBRA); + request = (pinfo->destport == pinfo->match_port); left = tvb_reported_length(tvb); offset = 0; |