aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2003-02-08 04:22:37 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2003-02-08 04:22:37 +0000
commit9615c4ef25937edc242ff81a9ee7ec7a35aa7698 (patch)
treef03877f03d3e572f98e4e87d046f3a9017c00742 /epan/proto.c
parent086e99dff9584dc837b1bb1be8611468bc05d324 (diff)
downloadwireshark-9615c4ef25937edc242ff81a9ee7ec7a35aa7698.tar.gz
wireshark-9615c4ef25937edc242ff81a9ee7ec7a35aa7698.tar.bz2
wireshark-9615c4ef25937edc242ff81a9ee7ec7a35aa7698.zip
Provide a way for ftype modules to provide a string representation
of their value. Provide such a method for FT_BYTES, FT_UINT_BYTES, and FT_ETHER. Have proto_alloc_dfilter_string() use the new methods. This is part of a movement of ftype-related code out of proto.c and into the ftype code. The immediate effect is that generated display filters for long byte sequences don't incorrectly have trailing periods ("...") to indicate continuation. svn path=/trunk/; revision=7100
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 3eb3ed441a..874d929130 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.81 2003/01/31 03:17:52 guy Exp $
+ * $Id: proto.c,v 1.82 2003/02/08 04:22:30 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -3505,18 +3505,6 @@ proto_alloc_dfilter_string(field_info *finfo, guint8 *pd)
fvalue_get_floating(finfo->value));
break;
- case FT_ETHER:
- /*
- * 4 bytes for " == ".
- * 17 bytes for "NN:NN:NN:NN:NN:NN".
- * 1 byte for the trailing '\0'.
- */
- dfilter_len = abbrev_len + 4 + 17 + 1;
- buf = g_malloc0(dfilter_len);
- snprintf(buf, dfilter_len, "%s == %s",
- hfinfo->abbrev,
- ether_to_str(fvalue_get(finfo->value)));
- break;
case FT_ABSOLUTE_TIME:
/*
@@ -3561,24 +3549,21 @@ proto_alloc_dfilter_string(field_info *finfo, guint8 *pd)
hfinfo->abbrev, value_str);
break;
+ case FT_ETHER:
case FT_BYTES:
case FT_UINT_BYTES:
/*
* 4 bytes for " == ".
- * 3 bytes for each byte of the byte string, as
- * "NN:", minus 1 byte as there's no trailing ":".
* 1 byte for the trailing '\0'.
*
- * XXX - what are the other 2 bytes for?
*/
- dfilter_len = fvalue_length(finfo->value)*3 - 1;
- dfilter_len += abbrev_len + 4 + 2 + 1;
+ dfilter_len = fvalue_string_repr_len(finfo->value);
+ dfilter_len += abbrev_len + 4 + 1;
buf = g_malloc0(dfilter_len);
- snprintf(buf, dfilter_len, "%s == %s",
- hfinfo->abbrev,
- /* XXX - bytes_to_str_punct() will truncate long strings with '...' */
- bytes_to_str_punct(fvalue_get(finfo->value),
- fvalue_length(finfo->value),':'));
+ snprintf(buf, dfilter_len, "%s == ", hfinfo->abbrev);
+ stringified = fvalue_to_string_repr(finfo->value);
+ strcat(buf, stringified);
+ g_free(stringified);
break;
default: