aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2006-02-09 04:18:23 +0000
committerGuy Harris <guy@alum.mit.edu>2006-02-09 04:18:23 +0000
commit55c64cec5e7daca74e95523a1cb9a3622aeb1720 (patch)
tree233e6eb10b6e99a02fbce2318214cfdc909210b3
parent9fd26b71eff056fa2aab6bd7200328c0f7072edc (diff)
Add "proto_tree_add_XXX_format_value()" routines, which are like the
"proto_tree_add_XXX_format()" routines except that the format doesn't have to include the field name - the field name, followed by ": ", are put into the representation string, followed by the result of the formatting, so you just format the value with the format string, not the entire representation. svn path=/trunk/; revision=17221
-rw-r--r--epan/libethereal.def15
-rw-r--r--epan/proto.c334
-rw-r--r--epan/proto.h327
3 files changed, 655 insertions, 21 deletions
diff --git a/epan/libethereal.def b/epan/libethereal.def
index 4afb145542..121b5b48d0 100644
--- a/epan/libethereal.def
+++ b/epan/libethereal.def
@@ -461,36 +461,47 @@ proto_set_cant_toggle
proto_set_decoding
proto_tree_add_boolean
proto_tree_add_boolean_format
+proto_tree_add_boolean_format_value
proto_tree_add_boolean_hidden
proto_tree_add_bytes
proto_tree_add_bytes_format
+proto_tree_add_bytes_format_value
proto_tree_add_bytes_hidden
proto_tree_add_debug_text
proto_tree_add_double
proto_tree_add_double_format
+proto_tree_add_double_format_value
proto_tree_add_double_hidden
proto_tree_add_ether
proto_tree_add_ether_format
+proto_tree_add_ether_format_value
proto_tree_add_ether_hidden
proto_tree_add_float
proto_tree_add_float_format
+proto_tree_add_float_format_value
proto_tree_add_float_hidden
proto_tree_add_guid
proto_tree_add_guid_format
+proto_tree_add_guid_format_value
proto_tree_add_guid_hidden
proto_tree_add_int
proto_tree_add_int_format
proto_tree_add_int_hidden
+proto_tree_add_int_hidden_value
proto_tree_add_int64
proto_tree_add_int64_format
+proto_tree_add_int64_format_value
proto_tree_add_ipv4
proto_tree_add_ipv4_format
+proto_tree_add_ipv4_format_value
proto_tree_add_ipv4_hidden
proto_tree_add_ipv6
proto_tree_add_ipv6_format
+proto_tree_add_ipv6_format_value
proto_tree_add_ipv6_hidden
proto_tree_add_ipxnet
proto_tree_add_ipxnet_format
+proto_tree_add_ipxnet_format_value
proto_tree_add_ipxnet_hidden
proto_tree_add_item
proto_tree_add_item_hidden
@@ -498,16 +509,20 @@ proto_tree_add_none_format
proto_tree_add_protocol_format
proto_tree_add_string
proto_tree_add_string_format
+proto_tree_add_string_format_value
proto_tree_add_string_hidden
proto_tree_add_text
proto_tree_add_time
proto_tree_add_time_format
+proto_tree_add_time_format_value
proto_tree_add_time_hidden
proto_tree_add_uint
proto_tree_add_uint_format
+proto_tree_add_uint_format_value
proto_tree_add_uint_hidden
proto_tree_add_uint64
proto_tree_add_uint64_format
+proto_tree_add_uint64_format_value
proto_tree_children_foreach
proto_tree_get_parent
proto_tree_move_item
diff --git a/epan/proto.c b/epan/proto.c
index 93246efc3d..5b7ce02fc4 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -122,6 +122,8 @@ proto_tree_add_pi(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint *length, field_info **pfi);
static void
+proto_tree_set_representation_value(proto_item *pi, const char *format, va_list ap);
+static void
proto_tree_set_representation(proto_item *pi, const char *format, va_list ap);
static void
@@ -1242,6 +1244,25 @@ proto_tree_add_bytes_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
}
proto_item *
+proto_tree_add_bytes_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8 *start_ptr,
+ const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_bytes(tree, hfindex, tvb, start, length, start_ptr);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_bytes_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8 *start_ptr, const char *format, ...)
{
@@ -1318,6 +1339,25 @@ proto_tree_add_time_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
}
proto_item *
+proto_tree_add_time_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, nstime_t *value_ptr,
+ const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_time(tree, hfindex, tvb, start, length, value_ptr);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
nstime_t *value_ptr, const char *format, ...)
{
@@ -1382,6 +1422,24 @@ proto_tree_add_ipxnet_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
}
proto_item *
+proto_tree_add_ipxnet_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, guint32 value, const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_ipxnet(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
guint32 value, const char *format, ...)
{
@@ -1445,6 +1503,24 @@ proto_tree_add_ipv4_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
}
proto_item *
+proto_tree_add_ipv4_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, guint32 value, const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_ipv4(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
guint32 value, const char *format, ...)
{
@@ -1508,6 +1584,25 @@ proto_tree_add_ipv6_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
}
proto_item *
+proto_tree_add_ipv6_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8* value_ptr,
+ const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_ipv6(tree, hfindex, tvb, start, length, value_ptr);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
const guint8* value_ptr, const char *format, ...)
{
@@ -1578,6 +1673,25 @@ proto_tree_add_guid_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
}
proto_item *
+proto_tree_add_guid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8* value_ptr,
+ const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_guid(tree, hfindex, tvb, start, length, value_ptr);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_guid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
const guint8* value_ptr, const char *format, ...)
{
@@ -1648,6 +1762,25 @@ proto_tree_add_oid_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint sta
}
proto_item *
+proto_tree_add_oid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8* value_ptr,
+ const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_oid(tree, hfindex, tvb, start, length, value_ptr);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_oid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
const guint8* value_ptr, const char *format, ...)
{
@@ -1744,6 +1877,25 @@ proto_tree_add_string_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
}
proto_item *
+proto_tree_add_string_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const char* value, const char *format,
+ ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_string(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_string_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const char* value, const char *format, ...)
{
@@ -1865,6 +2017,25 @@ proto_tree_add_ether_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
}
proto_item *
+proto_tree_add_ether_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8* value,
+ const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_ether(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_ether_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
const guint8* value, const char *format, ...)
{
@@ -1934,6 +2105,25 @@ proto_tree_add_boolean_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
}
proto_item *
+proto_tree_add_boolean_format_value(proto_tree *tree, int hfindex,
+ tvbuff_t *tvb, gint start, gint length, guint32 value,
+ const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_boolean(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_boolean_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
guint32 value, const char *format, ...)
{
@@ -1997,6 +2187,24 @@ proto_tree_add_float_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
}
proto_item *
+proto_tree_add_float_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, float value, const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_float(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_float_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
float value, const char *format, ...)
{
@@ -2060,6 +2268,24 @@ proto_tree_add_double_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
}
proto_item *
+proto_tree_add_double_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, double value, const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_double(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_double_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
double value, const char *format, ...)
{
@@ -2133,6 +2359,24 @@ proto_tree_add_uint_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
}
proto_item *
+proto_tree_add_uint_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, guint32 value, const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_uint(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_uint_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
guint32 value, const char *format, ...)
{
@@ -2196,6 +2440,24 @@ proto_tree_add_uint64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
}
proto_item *
+proto_tree_add_uint64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, guint64 value, const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_uint64(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_uint64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
guint64 value, const char *format, ...)
{
@@ -2261,6 +2523,24 @@ proto_tree_add_int_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint sta
}
proto_item *
+proto_tree_add_int_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, gint32 value, const char *format, ...)
+{
+ proto_item *pi = NULL;
+ va_list ap;
+
+ pi = proto_tree_add_int(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_int_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
gint32 value, const char *format, ...)
{
@@ -2324,6 +2604,24 @@ proto_tree_add_int64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, g
}
proto_item *
+proto_tree_add_int64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, gint64 value, const char *format, ...)
+{
+ proto_item *pi;
+ va_list ap;
+
+ pi = proto_tree_add_int64(tree, hfindex, tvb, start, length, value);
+ if (pi == NULL)
+ return (NULL);
+
+ va_start(ap, format);
+ proto_tree_set_representation_value(pi, format, ap);
+ va_end(ap);
+
+ return pi;
+}
+
+proto_item *
proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
gint64 value, const char *format, ...)
{
@@ -2593,8 +2891,38 @@ alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
return new_field_info(tree, hfinfo, tvb, start, item_length);
}
-/* Set representation of a proto_tree entry, if the protocol tree is to
- be visible. */
+/* If the protocol tree is to be visible, set the representation of a
+ proto_tree entry with the name of the field for the item and with
+ the value formatted with the supplied printf-style format and
+ argument list. */
+static void
+proto_tree_set_representation_value(proto_item *pi, const char *format, va_list ap)
+{
+ int ret; /*tmp return value */
+ int replen;
+ field_info *fi = PITEM_FINFO(pi);
+
+ if (!PROTO_ITEM_IS_HIDDEN(pi)) {
+ ITEM_LABEL_NEW(fi->rep);
+ replen = 0;
+ ret = g_snprintf(fi->rep->representation, ITEM_LABEL_LENGTH,
+ "%s: ", fi->hfinfo->name);
+ if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH)) {
+ /* That's all we can put in the representation. */
+ fi->rep->representation[ITEM_LABEL_LENGTH - 1] = '\0';
+ return;
+ }
+ replen = ret;
+ ret = g_vsnprintf(fi->rep->representation + replen,
+ ITEM_LABEL_LENGTH - replen, format, ap);
+ if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH - replen))
+ fi->rep->representation[ITEM_LABEL_LENGTH - 1] = '\0';
+ }
+}
+
+/* If the protocol tree is to be visible, set the representation of a
+ proto_tree entry with the representation formatted with the supplied
+ printf-style format and argument list. */
static void
proto_tree_set_representation(proto_item *pi, const char *format, va_list ap)
{
@@ -2646,7 +2974,7 @@ proto_item_append_text(proto_item *pi, const char *format, ...)
fi = PITEM_FINFO(pi);
- if (!PROTO_ITEM_IS_HIDDEN(pi)) {
+ if (!PROTO_ITEM_IS_HIDDEN(pi)) {
va_start(ap, format);
/*
diff --git a/epan/proto.h b/epan/proto.h
index 56536b6fa5..27c9e1bf4d 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -524,7 +524,25 @@ extern proto_item *
proto_tree_add_bytes_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* start_ptr);
-/** Add a formatted FT_BYTES to a proto_tree.
+/** Add a formatted FT_BYTES to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param start_ptr pointer to the data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_bytes_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8* start_ptr, const char *format,
+ ...) GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_BYTES to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -556,7 +574,26 @@ extern proto_item *
proto_tree_add_time_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, nstime_t* value_ptr);
-/** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree.
+/** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
+ the format generating the string for the value and with the field name
+ being included automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value_ptr pointer to the data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_time_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, nstime_t* value_ptr, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
+ the format generating the entire string for the entry, including any field
+ name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -588,7 +625,25 @@ extern proto_item *
proto_tree_add_ipxnet_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value);
-/** Add a formatted FT_IPXNET to a proto_tree.
+/** Add a formatted FT_IPXNET to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_ipxnet_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, guint32 value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_IPXNET to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -620,7 +675,25 @@ extern proto_item *
proto_tree_add_ipv4_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value);
-/** Add a formatted FT_IPv4 to a proto_tree.
+/** Add a formatted FT_IPv4 to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_ipv4_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, guint32 value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_IPv4 to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -652,7 +725,25 @@ extern proto_item *
proto_tree_add_ipv6_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* value_ptr);
-/** Add a formatted FT_IPv6 to a proto_tree.
+/** Add a formatted FT_IPv6 to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value_ptr data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_ipv6_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8* value_ptr, const char *format,
+ ...) GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_IPv6 to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -684,7 +775,25 @@ extern proto_item *
proto_tree_add_ether_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* value);
-/** Add a formatted FT_ETHER to a proto_tree.
+/** Add a formatted FT_ETHER to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_ether_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8* value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_ETHER to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -716,7 +825,25 @@ extern proto_item *
proto_tree_add_guid_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* value_ptr);
-/** Add a formatted FT_GUID to a proto_tree.
+/** Add a formatted FT_GUID to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value_ptr data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_guid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8* value_ptr, const char *format,
+ ...) GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_GUID to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -748,7 +875,25 @@ extern proto_item *
proto_tree_add_oid_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* value_ptr);
-/** Add a formatted FT_OID to a proto_tree.
+/** Add a formatted FT_OID to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value_ptr data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_oid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const guint8* value_ptr, const char *format,
+ ...) GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_OID to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -780,7 +925,25 @@ extern proto_item *
proto_tree_add_string_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const char* value);
-/** Add a formatted FT_STRING to a proto_tree.
+/** Add a formatted FT_STRING to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_string_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, const char* value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_STRING to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -812,7 +975,25 @@ extern proto_item *
proto_tree_add_boolean_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value);
-/** Add a formatted FT_BOOLEAN to a proto_tree.
+/** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_boolean_format_value(proto_tree *tree, int hfindex,
+ tvbuff_t *tvb, gint start, gint length, guint32 value,
+ const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -844,7 +1025,25 @@ extern proto_item *
proto_tree_add_float_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, float value);
-/** Add a formatted FT_FLOAT to a proto_tree.
+/** Add a formatted FT_FLOAT to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_float_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, float value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_FLOAT to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -876,7 +1075,25 @@ extern proto_item *
proto_tree_add_double_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, double value);
-/** Add a formatted FT_DOUBLE to a proto_tree.
+/** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_double_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, double value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -902,13 +1119,32 @@ extern proto_item *
proto_tree_add_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value);
-/** Add a hidden of one of FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree.
+/** Add a hidden FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree.
@deprecated use proto_tree_add_uint() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
extern proto_item *
proto_tree_add_uint_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value);
-/** Add a formatted of one of FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree.
+/** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
+ with the format generating the string for the value and with the field
+ name being included automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_uint_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, guint32 value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
+ with the format generating the entire string for the entry, including any
+ field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -934,7 +1170,25 @@ extern proto_item *
proto_tree_add_uint64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint64 value);
-/** Add a formatted FT_UINT64 to a proto_tree.
+/** Add a formatted FT_UINT64 to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_uint64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, guint64 value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_UINT64 to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -960,13 +1214,32 @@ extern proto_item *
proto_tree_add_int(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, gint32 value);
-/** Add a hidden of one of FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree.
+/** Add a hidden FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree.
@deprecated use proto_tree_add_int() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
extern proto_item *
proto_tree_add_int_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, gint32 value);
-/** Add a formatted of one of FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree.
+/** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
+ with the format generating the string for the value and with the field
+ name being included automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_int_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, gint32 value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
+ with the format generating the entire string for the entry, including
+ any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@@ -992,7 +1265,25 @@ extern proto_item *
proto_tree_add_int64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, gint64 value);
-/** Add a formatted FT_INT64 to a proto_tree.
+/** Add a formatted FT_INT64 to a proto_tree, with the format generating
+ the string for the value and with the field name being included
+ automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_int64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+ gint start, gint length, gint64 value, const char *format, ...)
+ GNUC_FORMAT_CHECK(printf,7,8);
+
+/** Add a formatted FT_INT64 to a proto_tree, with the format generating
+ the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data