summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--epan/packet.c20
-rw-r--r--epan/packet.h3
-rw-r--r--packet-ip.c18
-rw-r--r--packet-ip.h7
-rw-r--r--packet-ppp.c76
-rw-r--r--packet-tcp.c69
6 files changed, 109 insertions, 84 deletions
diff --git a/epan/packet.c b/epan/packet.c
index e3691c908e..27e0ce7c52 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.10 2000/12/03 22:32:10 guy Exp $
+ * $Id: packet.c,v 1.11 2000/12/04 06:37:46 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -538,6 +538,24 @@ check_col(frame_data *fd, gint el) {
return FALSE;
}
+/* Use this to clear out a column, especially if you're going to be
+ appending to it later; at least on some platforms, it's more
+ efficient than using "col_add_str()" with a null string, and
+ more efficient than "col_set_str()" with a null string if you
+ later append to it, as the later append will cause a string
+ copy to be done. */
+void
+col_clear(frame_data *fd, gint el) {
+ int i;
+
+ for (i = 0; i < fd->cinfo->num_cols; i++) {
+ if (fd->cinfo->fmt_matx[i][el]) {
+ fd->cinfo->col_buf[i][0] = 0;
+ fd->cinfo->col_data[i] = fd->cinfo->col_buf[i];
+ }
+ }
+}
+
/* Use this if "str" points to something that will stay around (and thus
needn't be copied). */
void
diff --git a/epan/packet.h b/epan/packet.h
index 679bfdc65b..745b4a3cdf 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.13 2000/12/03 22:53:09 guy Exp $
+ * $Id: packet.h,v 1.14 2000/12/04 06:37:46 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -291,6 +291,7 @@ const char *decode_numeric_bitfield(guint32 val, guint32 mask, int width,
void col_set_writable(frame_data *fd, gboolean writable);
gint check_col(frame_data *, gint);
+void col_clear(frame_data *, gint);
void col_set_str(frame_data *, gint, gchar *);
#if __GNUC__ == 2
void col_add_fstr(frame_data *, gint, gchar *, ...)
diff --git a/packet-ip.c b/packet-ip.c
index 3279f4d160..25d1accd50 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
- * $Id: packet-ip.c,v 1.107 2000/11/19 08:53:58 guy Exp $
+ * $Id: packet-ip.c,v 1.108 2000/12/04 06:37:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -339,7 +339,7 @@ capture_ip(const u_char *pd, int offset, packet_counts *ld) {
static void
dissect_ipopt_security(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
- guint optlen, proto_tree *opt_tree)
+ guint optlen, frame_data *fd, proto_tree *opt_tree)
{
proto_tree *field_tree = NULL;
proto_item *tf;
@@ -391,7 +391,7 @@ dissect_ipopt_security(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
static void
dissect_ipopt_route(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
- guint optlen, proto_tree *opt_tree)
+ guint optlen, frame_data *fd, proto_tree *opt_tree)
{
proto_tree *field_tree = NULL;
proto_item *tf;
@@ -436,7 +436,7 @@ dissect_ipopt_route(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
static void
dissect_ipopt_sid(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
- guint optlen, proto_tree *opt_tree)
+ guint optlen, frame_data *fd, proto_tree *opt_tree)
{
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: %u", optp->name, tvb_get_ntohs(tvb, offset + 2));
@@ -445,7 +445,7 @@ dissect_ipopt_sid(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
static void
dissect_ipopt_timestamp(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint optlen, proto_tree *opt_tree)
+ int offset, guint optlen, frame_data *fd, proto_tree *opt_tree)
{
proto_tree *field_tree = NULL;
proto_item *tf;
@@ -587,7 +587,7 @@ static const ip_tcp_opt ipopts[] = {
void
dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
const ip_tcp_opt *opttab, int nopts, int eol,
- proto_tree *opt_tree)
+ frame_data *fd, proto_tree *opt_tree)
{
u_char opt;
const ip_tcp_opt *optp;
@@ -596,7 +596,7 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
char *name;
char name_str[7+1+1+2+2+1+1]; /* "Unknown (0x%02x)" */
void (*dissect)(const struct ip_tcp_opt *, tvbuff_t *,
- int, guint, proto_tree *);
+ int, guint, frame_data *, proto_tree *);
guint len;
while (length > 0) {
@@ -668,7 +668,7 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
} else {
if (dissect != NULL) {
/* Option has a dissector. */
- (*dissect)(optp, tvb, offset, len, opt_tree);
+ (*dissect)(optp, tvb, offset, len, fd, opt_tree);
} else {
/* Option has no data, hence no dissector. */
proto_tree_add_text(opt_tree, tvb, offset, len, "%s", name);
@@ -919,7 +919,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
"Options: (%u bytes)", optlen);
field_tree = proto_item_add_subtree(tf, ett_ip_options);
dissect_ip_tcp_options(tvb, offset + 20, optlen,
- ipopts, N_IP_OPTS, IPOPT_END, field_tree);
+ ipopts, N_IP_OPTS, IPOPT_END, pinfo->fd, field_tree);
}
}
diff --git a/packet-ip.h b/packet-ip.h
index aa6324d055..2a1f22492b 100644
--- a/packet-ip.h
+++ b/packet-ip.h
@@ -1,7 +1,7 @@
/* packet-ip.h
* Definitions for IP packet disassembly structures and routines
*
- * $Id: packet-ip.h,v 1.15 2000/11/18 10:38:24 guy Exp $
+ * $Id: packet-ip.h,v 1.16 2000/12/04 06:37:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -76,13 +76,14 @@ typedef struct ip_tcp_opt {
int *subtree_index; /* pointer to subtree index for option */
opt_len_type len_type; /* type of option length field */
int optlen; /* value length should be (minimum if VARIABLE) */
- void (*dissect)(const struct ip_tcp_opt *, tvbuff_t *, int, guint, proto_tree *);
+ void (*dissect)(const struct ip_tcp_opt *, tvbuff_t *, int, guint,
+ frame_data *, proto_tree *);
/* routine to dissect option */
} ip_tcp_opt;
/* Routine to dissect IP or TCP options. */
void dissect_ip_tcp_options(tvbuff_t *, int, guint,
- const ip_tcp_opt *, int, int, proto_tree *);
+ const ip_tcp_opt *, int, int, frame_data *, proto_tree *);
/* Dissector table for "ip.proto"; used by IPv6 as well as IPv4 */
extern dissector_table_t ip_dissector_table;
diff --git a/packet-ppp.c b/packet-ppp.c
index 2fc828d7dd..8572308122 100644
--- a/packet-ppp.c
+++ b/packet-ppp.c
@@ -1,7 +1,7 @@
/* packet-ppp.c
* Routines for ppp packet disassembly
*
- * $Id: packet-ppp.c,v 1.46 2000/12/03 09:59:49 guy Exp $
+ * $Id: packet-ppp.c,v 1.47 2000/12/04 06:37:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -185,37 +185,41 @@ static const value_string lcp_vals[] = {
#define CI_SDL_ON_SONET_SDH 29 /* Simple Data Link on SONET/SDH */
static void dissect_lcp_mru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree);
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree);
static void dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree);
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree);
static void dissect_lcp_protocol_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree);
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree);
static void dissect_lcp_magicnumber_opt(const ip_tcp_opt *optp,
tvbuff_t *tvb, int offset, guint length,
- proto_tree *tree);
+ frame_data *fd, proto_tree *tree);
static void dissect_lcp_fcs_alternatives_opt(const ip_tcp_opt *optp,
tvbuff_t *tvb, int offset, guint length,
- proto_tree *tree);
+ frame_data *fd, proto_tree *tree);
static void dissect_lcp_numbered_mode_opt(const ip_tcp_opt *optp,
tvbuff_t *tvb, int offset, guint length,
- proto_tree *tree);
+ frame_data *fd, proto_tree *tree);
static void dissect_lcp_self_describing_pad_opt(const ip_tcp_opt *optp,
tvbuff_t *tvb, int offset, guint length,
- proto_tree *tree);
+ frame_data *fd, proto_tree *tree);
static void dissect_lcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree);
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree);
static void dissect_lcp_multilink_mrru_opt(const ip_tcp_opt *optp,
tvbuff_t *tvb, int offset, guint length,
- proto_tree *tree);
+ frame_data *fd, proto_tree *tree);
static void dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp,
tvbuff_t *tvb, int offset, guint length,
- proto_tree *tree);
+ frame_data *fd, proto_tree *tree);
static void dissect_lcp_bap_link_discriminator_opt(const ip_tcp_opt *optp,
tvbuff_t *tvb, int offset, guint length,
- proto_tree *tree);
+ frame_data *fd, proto_tree *tree);
static void dissect_lcp_internationalization_opt(const ip_tcp_opt *optp,
tvbuff_t *tvb, int offset, guint length,
- proto_tree *tree);
+ frame_data *fd, proto_tree *tree);
static void dissect_mp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
static const ip_tcp_opt lcp_opts[] = {
@@ -428,9 +432,11 @@ static const ip_tcp_opt lcp_opts[] = {
#define CI_MS_WINS2 132 /* Secondary WINS value (RFC 1877) */
static void dissect_ipcp_addrs_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree);
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree);
static void dissect_ipcp_addr_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree);
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree);
static const ip_tcp_opt ipcp_opts[] = {
{
@@ -521,7 +527,7 @@ capture_ppp( const u_char *pd, int offset, packet_counts *ld ) {
static void
dissect_lcp_mru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
- guint length, proto_tree *tree)
+ guint length, frame_data *fd, proto_tree *tree)
{
proto_tree_add_text(tree, tvb, offset, length, "MRU: %u",
tvb_get_ntohs(tvb, offset + 2));
@@ -529,7 +535,7 @@ dissect_lcp_mru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
static void
dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
- guint length, proto_tree *tree)
+ guint length, frame_data *fd, proto_tree *tree)
{
proto_tree_add_text(tree, tvb, offset, length, "Async characters to map: 0x%08x",
tvb_get_ntohl(tvb, offset + 2));
@@ -537,7 +543,7 @@ dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
static void
dissect_lcp_protocol_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
- guint length, proto_tree *tree)
+ guint length, frame_data *fd, proto_tree *tree)
{
guint16 protocol;
proto_item *tf;
@@ -560,7 +566,8 @@ dissect_lcp_protocol_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
static void
dissect_lcp_magicnumber_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_tree_add_text(tree, tvb, offset, length, "Magic number: 0x%08x",
tvb_get_ntohl(tvb, offset + 2));
@@ -568,7 +575,8 @@ dissect_lcp_magicnumber_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static void
dissect_lcp_fcs_alternatives_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_item *tf;
proto_tree *field_tree = NULL;
@@ -592,7 +600,8 @@ dissect_lcp_fcs_alternatives_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static void
dissect_lcp_self_describing_pad_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_tree_add_text(tree, tvb, offset, length,
"Maximum octets of self-describing padding: %u",
@@ -601,7 +610,8 @@ dissect_lcp_self_describing_pad_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static void
dissect_lcp_numbered_mode_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_item *tf;
proto_tree *field_tree = NULL;
@@ -631,7 +641,7 @@ static const value_string callback_op_vals[] = {
static void
dissect_lcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
- guint length, proto_tree *tree)
+ guint length, frame_data *fd, proto_tree *tree)
{
proto_item *tf;
proto_tree *field_tree = NULL;
@@ -655,7 +665,8 @@ dissect_lcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
static void
dissect_lcp_multilink_mrru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_tree_add_text(tree, tvb, offset, length, "Multilink MRRU: %u",
tvb_get_ntohs(tvb, offset + 2));
@@ -680,7 +691,8 @@ static const value_string multilink_ep_disc_class_vals[] = {
static void
dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_item *tf;
proto_tree *field_tree = NULL;
@@ -776,7 +788,8 @@ dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static void
dissect_lcp_bap_link_discriminator_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_tree_add_text(tree, tvb, offset, length,
"Link discriminator for BAP: 0x%04x",
@@ -791,7 +804,8 @@ static const value_string charset_num_vals[] = {
static void
dissect_lcp_internationalization_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_item *tf;
proto_tree *field_tree = NULL;
@@ -817,7 +831,8 @@ dissect_lcp_internationalization_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static void
dissect_ipcp_addrs_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_item *tf;
proto_tree *field_tree = NULL;
@@ -838,7 +853,8 @@ dissect_ipcp_addrs_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
}
static void dissect_ipcp_addr_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint length, proto_tree *tree)
+ int offset, guint length, frame_data *fd,
+ proto_tree *tree)
{
proto_tree_add_text(tree, tvb, offset, length, "%s: %s", optp->name,
ip_to_str(tvb_get_ptr(tvb, offset + 2, 4)));
@@ -892,7 +908,7 @@ dissect_cp( tvbuff_t *tvb, const char *proto_short_name,
"Options: (%d byte%s)", length, plurality(length, "", "s"));
field_tree = proto_item_add_subtree(tf, options_subtree_index);
dissect_ip_tcp_options(tvb, offset, length, opts, nopts, -1,
- field_tree);
+ pinfo->fd, field_tree);
}
}
break;
diff --git a/packet-tcp.c b/packet-tcp.c
index 3a74586d6c..fde9dd3ac1 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.90 2000/11/20 16:17:43 gram Exp $
+ * $Id: packet-tcp.c,v 1.91 2000/12/04 06:37:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -60,9 +60,6 @@ extern FILE* data_out_file;
guint16 tcp_urgent_pointer;
-static gchar info_str[COL_MAX_LEN];
-static int info_len;
-
static int proto_tcp = -1;
static int hf_tcp_srcport = -1;
static int hf_tcp_dstport = -1;
@@ -151,44 +148,39 @@ typedef struct _e_tcphdr {
#define TCPOLEN_CCECHO 6
static void
-tcp_info_append_uint(const char *abbrev, guint32 val) {
- int add_len = 0;
-
- if (info_len > 0)
- if(info_len > 0)
- add_len = snprintf(&info_str[info_len], COL_MAX_LEN - info_len, " %s=%u",
- abbrev, val);
- if (add_len > 0)
- info_len += add_len;
+tcp_info_append_uint(frame_data *fd, const char *abbrev, guint32 val)
+{
+ if (check_col(fd, COL_INFO))
+ col_append_fstr(fd, COL_INFO, " %s=%u", abbrev, val);
}
static void
dissect_tcpopt_maxseg(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint optlen, proto_tree *opt_tree)
+ int offset, guint optlen, frame_data *fd, proto_tree *opt_tree)
{
guint16 mss;
mss = tvb_get_ntohs(tvb, offset + 2);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: %u bytes", optp->name, mss);
- tcp_info_append_uint("MSS", mss);
+ tcp_info_append_uint(fd, "MSS", mss);
}
static void
dissect_tcpopt_wscale(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint optlen, proto_tree *opt_tree)
+ int offset, guint optlen, frame_data *fd, proto_tree *opt_tree)
{
guint8 ws;
ws = tvb_get_guint8(tvb, offset + 2);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: %u bytes", optp->name, ws);
- tcp_info_append_uint("WS", ws);
+ tcp_info_append_uint(fd, "WS", ws);
}
static void
dissect_tcpopt_sack(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint optlen, proto_tree *opt_tree)
+ int offset, guint optlen, frame_data *fd, proto_tree *opt_tree)
{
proto_tree *field_tree = NULL;
proto_item *tf;
@@ -219,27 +211,27 @@ dissect_tcpopt_sack(const ip_tcp_opt *optp, tvbuff_t *tvb,
optlen -= 4;
proto_tree_add_text(field_tree, tvb, offset, 8,
"left edge = %u, right edge = %u", leftedge, rightedge);
- tcp_info_append_uint("SLE", leftedge);
- tcp_info_append_uint("SRE", rightedge);
+ tcp_info_append_uint(fd, "SLE", leftedge);
+ tcp_info_append_uint(fd, "SRE", rightedge);
offset += 8;
}
}
static void
dissect_tcpopt_echo(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint optlen, proto_tree *opt_tree)
+ int offset, guint optlen, frame_data *fd, proto_tree *opt_tree)
{
guint32 echo;
echo = tvb_get_ntohl(tvb, offset + 2);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: %u", optp->name, echo);
- tcp_info_append_uint("ECHO", echo);
+ tcp_info_append_uint(fd, "ECHO", echo);
}
static void
dissect_tcpopt_timestamp(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint optlen, proto_tree *opt_tree)
+ int offset, guint optlen, frame_data *fd, proto_tree *opt_tree)
{
guint32 tsv, tser;
@@ -247,20 +239,20 @@ dissect_tcpopt_timestamp(const ip_tcp_opt *optp, tvbuff_t *tvb,
tser = tvb_get_ntohl(tvb, offset + 6);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: tsval %u, tsecr %u", optp->name, tsv, tser);
- tcp_info_append_uint("TSV", tsv);
- tcp_info_append_uint("TSER", tser);
+ tcp_info_append_uint(fd, "TSV", tsv);
+ tcp_info_append_uint(fd, "TSER", tser);
}
static void
dissect_tcpopt_cc(const ip_tcp_opt *optp, tvbuff_t *tvb,
- int offset, guint optlen, proto_tree *opt_tree)
+ int offset, guint optlen, frame_data *fd, proto_tree *opt_tree)
{
guint32 cc;
cc = tvb_get_ntohl(tvb, offset + 2);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: %u", optp->name, cc);
- tcp_info_append_uint("CC", cc);
+ tcp_info_append_uint(fd, "CC", cc);
}
static const ip_tcp_opt tcpopts[] = {
@@ -448,6 +440,13 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pinfo->current_proto = "TCP";
+ if (check_col(pinfo->fd, COL_PROTOCOL))
+ col_set_str(pinfo->fd, COL_PROTOCOL, "TCP");
+
+ /* Clear out the Info column. */
+ if (check_col(pinfo->fd, COL_INFO))
+ col_clear(pinfo->fd, COL_INFO);
+
/* Avoids alignment problems on many architectures. */
tvb_memcpy(tvb, (guint8 *)&th, offset, sizeof(e_tcphdr));
th.th_sport = ntohs(th.th_sport);
@@ -462,8 +461,6 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
rlogin. */
tcp_urgent_pointer = th.th_urp;
- info_len = 0;
-
if (check_col(pinfo->fd, COL_INFO) || tree) {
for (i = 0; i < 8; i++) {
bpos = 1 << i;
@@ -487,20 +484,15 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Compute the sequence number of next octet after this segment. */
nxtseq = th.th_seq + seglen;
- if (check_col(pinfo->fd, COL_PROTOCOL))
- col_set_str(pinfo->fd, COL_PROTOCOL, "TCP");
if (check_col(pinfo->fd, COL_INFO)) {
- /* Copy the data into info_str in case one of the option handling
- routines needs to append to it. */
if (th.th_flags & TH_URG)
- info_len = snprintf(info_str, COL_MAX_LEN, "%s > %s [%s] Seq=%u Ack=%u Win=%u Urg=%u Len=%d",
+ col_append_fstr(pinfo->fd, COL_INFO, "%s > %s [%s] Seq=%u Ack=%u Win=%u Urg=%u Len=%d",
get_tcp_port(th.th_sport), get_tcp_port(th.th_dport), flags,
th.th_seq, th.th_ack, th.th_win, th.th_urp, seglen);
else
- info_len = snprintf(info_str, COL_MAX_LEN, "%s > %s [%s] Seq=%u Ack=%u Win=%u Len=%d",
+ col_append_fstr(pinfo->fd, COL_INFO, "%s > %s [%s] Seq=%u Ack=%u Win=%u Len=%d",
get_tcp_port(th.th_sport), get_tcp_port(th.th_dport), flags,
th.th_seq, th.th_ack, th.th_win, seglen);
- /* The info column is actually written after the options are decoded */
}
if (tree) {
@@ -550,12 +542,9 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
"Options: (%d bytes)", optlen);
field_tree = proto_item_add_subtree(tf, ett_tcp_options);
dissect_ip_tcp_options(tvb, offset + 20, optlen,
- tcpopts, N_TCP_OPTS, TCPOPT_EOL, field_tree);
+ tcpopts, N_TCP_OPTS, TCPOPT_EOL, pinfo->fd, field_tree);
}
- if (check_col(pinfo->fd, COL_INFO))
- col_add_str(pinfo->fd, COL_INFO, info_str);
-
/* Skip over header + options */
offset += hlen;