diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-11-19 08:54:37 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-11-19 08:54:37 +0000 |
commit | 252d55d80f92fa8267758fbf4faab520d2f79273 (patch) | |
tree | b6449cf609799ebb75b91e1cd6b600b06ee3d11a /packet-vines.c | |
parent | e88bd04f9aa217173cc86d785e9206e272a832ce (diff) | |
download | wireshark-252d55d80f92fa8267758fbf4faab520d2f79273.tar.gz wireshark-252d55d80f92fa8267758fbf4faab520d2f79273.tar.bz2 wireshark-252d55d80f92fa8267758fbf4faab520d2f79273.zip |
For each column, have both a buffer into which strings for that column
can be put, and a pointer to the string for the column, which might or
might not point to that buffer.
Add a routine "col_set_str()", which sets the string for the column to
the string passed to it as an argument; it should only be handed a
static string (a string constant would be ideal). It doesn't do any
copying, so it's faster than "col_add_str()".
Make the routines that append to columns check whether the pointer to
the string for the column points to the buffer for the column and, if
not, copy the string for the column to the buffer for the column so that
you can append to it (so you can use "col_set_str()" and then use
"col_append_str()" or "col_append_fstr()").
Convert a bunch of "col_add_str()" calls that take a string constant as
an argument to "col_set_str()" calls.
Convert some "col_add_fstr()" calls that take a string constant as the
only argument - i.e., the format string doesn't have any "%" slots into
which to put strings for subsequent arguments to "col_set_str()" calls
(those calls are just like "col_add_str()" calls).
Replace an END_OF_FRAME reference in a tvbuffified dissector with a
"tvb_length(tvb)" call.
svn path=/trunk/; revision=2670
Diffstat (limited to 'packet-vines.c')
-rw-r--r-- | packet-vines.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/packet-vines.c b/packet-vines.c index 3429337805..2788fd4fa4 100644 --- a/packet-vines.c +++ b/packet-vines.c @@ -1,7 +1,7 @@ /* packet-vines.c * Routines for Banyan VINES protocol packet disassembly * - * $Id: packet-vines.c,v 1.19 2000/11/17 21:00:36 gram Exp $ + * $Id: packet-vines.c,v 1.20 2000/11/19 08:54:10 guy Exp $ * * Don Lafontaine <lafont02@cn.ca> * @@ -85,7 +85,7 @@ dissect_vines_frp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree vines_frp_seqno = pd[offset+1]; if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "Vines FRP"); + col_set_str(fd, COL_PROTOCOL, "Vines FRP"); /* * 1: first fragment of vines packet * 2: last fragment of vines packet @@ -171,37 +171,37 @@ dissect_vines(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { switch (viph.vip_proto) { case VIP_PROTO_IPC: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "Vines IPC"); + col_set_str(fd, COL_PROTOCOL, "Vines IPC"); if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "IPC (%02x)", viph.vip_proto); break; case VIP_PROTO_SPP: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "Vines SPP"); + col_set_str(fd, COL_PROTOCOL, "Vines SPP"); if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "SPP (%02x)", viph.vip_proto); break; case VIP_PROTO_ARP: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "Vines ARP"); + col_set_str(fd, COL_PROTOCOL, "Vines ARP"); if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "ARP (%02x)", viph.vip_proto); break; case VIP_PROTO_RTP: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "Vines RTP"); + col_set_str(fd, COL_PROTOCOL, "Vines RTP"); if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "RTP (%02x)", viph.vip_proto); break; case VIP_PROTO_ICP: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "Vines ICP"); + col_set_str(fd, COL_PROTOCOL, "Vines ICP"); if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "ICP (%02x)", viph.vip_proto); break; default: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "Vines IP"); + col_set_str(fd, COL_PROTOCOL, "Vines IP"); if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "Unknown VIP protocol (%02x)", viph.vip_proto); @@ -301,23 +301,23 @@ void dissect_vines_spp(const u_char *pd, int offset, frame_data *fd, proto_tree switch (viph.vspp_pkttype) { case VSPP_PKTTYPE_DATA: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "VSPP Data"); + col_set_str(fd, COL_PROTOCOL, "VSPP Data"); break; case VSPP_PKTTYPE_DISC: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "VSPP Disconnect"); + col_set_str(fd, COL_PROTOCOL, "VSPP Disconnect"); break; case VSPP_PKTTYPE_PROBE: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "VSPP Probe"); + col_set_str(fd, COL_PROTOCOL, "VSPP Probe"); break; case VSPP_PKTTYPE_ACK: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "VSPP Ack"); + col_set_str(fd, COL_PROTOCOL, "VSPP Ack"); break; default: if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "VSPP Unknown"); + col_set_str(fd, COL_PROTOCOL, "VSPP Unknown"); } if (check_col(fd, COL_INFO)) |