aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.h
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2019-08-28 15:04:32 -0400
committerAnders Broman <a.broman58@gmail.com>2019-08-29 13:31:48 +0000
commit01d7793976cca50519c6609dc2a4ba391946f07b (patch)
treebbe7e8a2c863904dcac33459226b24882e7828f1 /epan/proto.h
parent862e2acdd94ca38e9310f4ec9509a1108346f2bc (diff)
Add proto_tree_add_item_ret_time_string
A few dissectors need the functionality of adding a time field to a proto_tree while also needing the "time to string" value (typically to show on a tree above). The functionality to do "get value from tvb and convert to string" was being done in packet-ntp.c. Instead proto_tree_add_item_ret_time_string can be used with various encoding to get the necessary functionality with less code duplication. ENC_TIME_MIP6 was added as a result of the refactoring. ABSOLUTE_TIME_NTP_UTC was added as another potential "base" type for time fields. Change-Id: Ie460c33370b0af59ef60bdab893ce9d6eb23b94f Reviewed-on: https://code.wireshark.org/review/34390 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/proto.h')
-rw-r--r--epan/proto.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/epan/proto.h b/epan/proto.h
index 787348b5fb..b6f5ef37b0 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -413,6 +413,7 @@ void proto_report_dissector_bug(const char *format, ...)
#define ENC_TIME_SECS_NTP 0x00000018
#define ENC_TIME_RFC_3971 0x00000020
#define ENC_TIME_MSEC_NTP 0x00000022
+#define ENC_TIME_MIP6 0x00000024
/*
* This is a modifier for FT_UINT_STRING and FT_UINT_BYTES values;
@@ -1307,13 +1308,13 @@ text label registered to that item.
This provides a string that is a display representation of the value,
similar to what proto_tree_add_item_ret_string() does.
-@param scope the wmem scope to use to allocate the string
@param tree the tree to append this item to
@param hfindex field
@param tvb the tv buffer of the current data
@param start start of data in tvb (cannot be negative)
@param length length of data in tvb (for strings can be -1 for remaining)
@param encoding data encoding (e.g, ENC_ASCII, ENC_UTF_8, etc.)
+@param scope the wmem scope to use to allocate the string
@param[out] retval points to a guint8 * that will be set to point to the
string value
@return the newly created item, *retval is set to the display string
@@ -1324,6 +1325,27 @@ proto_tree_add_item_ret_display_string(proto_tree *tree, int hfindex,
const gint start, gint length, const guint encoding,
wmem_allocator_t *scope, char **retval);
+/** Add a time item to a proto_tree, using thetext label registered to that item.
+
+This provides a string that is a display representation of the time value
+
+@param tree the tree to append this item to
+@param hfindex field
+@param tvb the tv buffer of the current data
+@param start start of data in tvb (cannot be negative)
+@param length length of data in tvb (for strings can be -1 for remaining)
+@param encoding data encoding (e.g, ENC_ASCII, ENC_UTF_8, etc.)
+@param scope the wmem scope to use to allocate the string
+@param[out] retval points to a guint8 * that will be set to point to the
+string value
+@return the newly created item, *retval is set to the display string
+*/
+WS_DLL_PUBLIC proto_item *
+proto_tree_add_item_ret_time_string(proto_tree *tree, int hfindex,
+ tvbuff_t *tvb,
+ const gint start, gint length, const guint encoding,
+ wmem_allocator_t *scope, char **retval);
+
/** (INTERNAL USE ONLY) Add a text-only node to a proto_tree.
@param tree the tree to append this item to
@param tvb the tv buffer of the current data