aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/README.dissector57
-rw-r--r--epan/dfilter/semcheck.c20
-rw-r--r--epan/ftypes/ftype-bytes.c54
-rw-r--r--epan/ftypes/ftype-double.c12
-rw-r--r--epan/ftypes/ftype-guid.c6
-rw-r--r--epan/ftypes/ftype-integer.c492
-rw-r--r--epan/ftypes/ftype-ipv4.c6
-rw-r--r--epan/ftypes/ftype-ipv6.c6
-rw-r--r--epan/ftypes/ftype-none.c6
-rw-r--r--epan/ftypes/ftype-pcre.c6
-rw-r--r--epan/ftypes/ftype-string.c24
-rw-r--r--epan/ftypes/ftype-time.c12
-rw-r--r--epan/ftypes/ftype-tvbuff.c6
-rw-r--r--epan/ftypes/ftypes-int.h12
-rw-r--r--epan/ftypes/ftypes.c40
-rw-r--r--epan/ftypes/ftypes.h25
-rw-r--r--epan/print.c11
-rw-r--r--epan/proto.c1038
-rw-r--r--epan/proto.h3
-rw-r--r--epan/to_str-int.h104
-rw-r--r--epan/to_str.c173
-rw-r--r--epan/to_str.h1
-rw-r--r--epan/wslua/wslua_field.c4
-rw-r--r--rawshark.c11
-rw-r--r--ui/cli/tap-iostat.c43
-rw-r--r--ui/io_graph_item.h18
26 files changed, 1725 insertions, 465 deletions
diff --git a/doc/README.dissector b/doc/README.dissector
index c5d2756979..10ba4e6b3f 100644
--- a/doc/README.dissector
+++ b/doc/README.dissector
@@ -101,14 +101,15 @@ PROTOABBREV A name for the protocol for use in filter expressions;
FIELDNAME The displayed name for the header field.
FIELDABBREV The abbreviated name for the header field. (NO SPACES)
FIELDTYPE FT_NONE, FT_BOOLEAN, FT_UINT8, FT_UINT16, FT_UINT24,
- FT_UINT32, FT_UINT64, FT_INT8, FT_INT16, FT_INT24, FT_INT32,
- FT_INT64, FT_FLOAT, FT_DOUBLE, FT_ABSOLUTE_TIME,
+ FT_UINT32, FT_UINT40, FT_UINT48, FT_UINT56, FT_UINT64,
+ FT_INT8, FT_INT16, FT_INT24, FT_INT32, FT_INT40, FT_INT48,
+ FT_INT56, FT_INT64, FT_FLOAT, FT_DOUBLE, FT_ABSOLUTE_TIME,
FT_RELATIVE_TIME, FT_STRING, FT_STRINGZ, FT_EUI64,
FT_UINT_STRING, FT_ETHER, FT_BYTES, FT_UINT_BYTES, FT_IPv4,
FT_IPv6, FT_IPXNET, FT_FRAMENUM, FT_PROTOCOL, FT_GUID, FT_OID,
FT_REL_OID, FT_AX25, FT_VINES, FT_SYSTEM_ID, FT_FC, FT_FCWWN
-
-FIELDDISPLAY --For FT_UINT{8,16,24,32,64} and FT_INT{8,16,24,32,64):
+FIELDDISPLAY --For FT_UINT{8,16,24,32,40,48,56,64} and
+ FT_INT{8,16,24,32,40,48,56,64):
BASE_DEC, BASE_HEX, BASE_OCT, BASE_DEC_HEX, BASE_HEX_DEC,
or BASE_CUSTOM, possibly ORed with BASE_RANGE_STRING,
@@ -696,11 +697,17 @@ The type of value this field holds. The current field types are:
FT_UINT16 A 16-bit unsigned integer.
FT_UINT24 A 24-bit unsigned integer.
FT_UINT32 A 32-bit unsigned integer.
+ FT_UINT40 A 40-bit unsigned integer.
+ FT_UINT48 A 48-bit unsigned integer.
+ FT_UINT56 A 56-bit unsigned integer.
FT_UINT64 A 64-bit unsigned integer.
FT_INT8 An 8-bit signed integer.
FT_INT16 A 16-bit signed integer.
FT_INT24 A 24-bit signed integer.
FT_INT32 A 32-bit signed integer.
+ FT_INT40 A 40-bit signed integer.
+ FT_INT48 A 48-bit signed integer.
+ FT_INT56 A 56-bit signed integer.
FT_INT64 A 64-bit signed integer.
FT_FLOAT A single-precision floating point number.
FT_DOUBLE A double-precision floating point number.
@@ -792,22 +799,31 @@ respectively. BASE_DEC_HEX and BASE_HEX_DEC display value in two bases
(the 1st representation followed by the 2nd in parenthesis).
BASE_CUSTOM allows one to specify a callback function pointer that will
-format the value. The function pointer of the same type as defined by
-custom_fmt_func_t in epan/proto.h, specifically:
+format the value.
+
+For 32-bit and smaller values, custom_fmt_func_t can be used to declare
+the callback function pointer. Specifically, this is defined as:
void func(gchar *, guint32);
+For values larger than 32-bits, custom_fmt_func_64_t can be used to declare
+the callback function pointer. Specifically, this is defined as:
+
+ void func(gchar *, guint64);
+
The first argument is a pointer to a buffer of the ITEM_LABEL_LENGTH size
and the second argument is the value to be formatted.
+Both custom_fmt_func_t and custom_fmt_func_64_t are defined in epan/proto.h.
+
For FT_BOOLEAN fields that are also bitfields (i.e., 'bitmask' is non-zero),
'display' is used specify a "field-width" (i.e., tell the proto_tree how
wide the parent bitfield is). (If the FT_BOOLEAN 'bitmask' is zero, then
'display' must be BASE_NONE).
For integer fields a "field-width" is not needed since the type of integer itself
-(FT_UINT8, FT_UINT16, FT_UINT24, FT_UINT32, etc.) tells the proto_tree how
-wide the parent bitfield is.
+(FT_UINT8, FT_UINT16, FT_UINT24, FT_UINT32, FT_UINT40, FT_UINT48, FT_UINT56,
+FT_UINT64, etc) tells the proto_tree how wide the parent bitfield is.
For FT_ABSOLUTE_TIME fields, 'display' is used to indicate whether the
time is to be displayed as a time in the time zone for the machine on
@@ -969,6 +985,7 @@ The proto_tree routines will calculate 'bitshift' automatically
from 'bitmask', by finding the rightmost set bit in the bitmask.
This shift is applied before applying string mapping functions or
filtering.
+
If the field is not a bitfield, then bitmask should be set to 0.
blurb
@@ -976,6 +993,7 @@ blurb
This is a string giving a proper description of the field. It should be
at least one grammatically complete sentence, or NULL in which case the
name field is used. (Please do not use "").
+
It is meant to provide a more detailed description of the field than the
name alone provides. This information will be used in the man page, and
in a future GUI display-filter creation tool. We might also add tooltips
@@ -1049,6 +1067,8 @@ for protocols with variable-width header fields.
Note that the formats used must all belong to the same group as defined below:
- FT_INT8, FT_INT16, FT_INT24 and FT_INT32
- FT_UINT8, FT_UINT16, FT_UINT24, and FT_UINT32
+- FT_INT40, FT_INT48, FT_INT56 and FT_INT64
+- FT_UINT40, FT_UINT48, FT_UINT56, and FT_UINT64
- FT_STRING, FT_STRINGZ and FT_UINT_STRING
- FT_FLOAT and FT_DOUBLE
- FT_BYTES and FT_UINT_BYTES
@@ -1797,7 +1817,7 @@ proto_tree_add_bitmask() et al.
These functions provide easy to use and convenient dissection of many types of common
bitmasks into individual fields.
-header is an integer type and must be of type FT_[U]INT{8|16|24|32|64} and
+header is an integer type and must be of type FT_[U]INT{8|16|24|32||40|48|56|64} and
represents the entire dissectable width of the bitmask.
'header' and 'ett' are the hf fields and ett field respectively to create an
@@ -1990,7 +2010,7 @@ to generate a COL_INFO line for a frame.
val_to_str() handles the most common case:
- gchar*
+ const gchar*
val_to_str(guint32 val, const value_string *vs, const char *fmt)
If the value 'val' is found in the 'value_string' table pointed to by
@@ -2008,7 +2028,7 @@ unmodified when 'val' isn't found.
If you need to handle the failure case in some custom way, try_val_to_str()
will return NULL if val isn't found:
- gchar*
+ const gchar*
try_val_to_str(guint32 val, const value_string *vs)
Note that, you must check whether 'try_val_to_str()' returns NULL, and arrange
@@ -2026,6 +2046,21 @@ more information.
See epan/value_string.h for detailed information on the various value_string
functions.
+To handle 64-bit values, there are an equivalent set of functions. These are:
+
+ const gchar *
+ val64_to_str(const guint64 val, const val64_string *vs, const char *fmt)
+
+ const gchar *
+ val64_to_str_const(const guint64 val, const val64_string *vs, const char *unknown_str);
+
+ const gchar *
+ try_val64_to_str(const guint64 val, const val64_string *vs);
+
+ const gchar *
+ try_val64_to_str_idx(const guint64 val, const val64_string *vs, gint *idx);
+
+
1.6.2 rval_to_str, try_rval_to_str and try_rval_to_str_idx
A dissector may need to convert a range of values to a string, using a
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c
index 2abd5a7e88..9da8e9ba2f 100644
--- a/epan/dfilter/semcheck.c
+++ b/epan/dfilter/semcheck.c
@@ -70,6 +70,12 @@ compatible_ftypes(ftenum_t a, ftenum_t b)
case FT_IPv4:
case FT_IPv6:
case FT_IPXNET:
+ case FT_INT40: /* XXX - should be able to compare with INT */
+ case FT_UINT40: /* XXX - should be able to compare with INT */
+ case FT_INT48: /* XXX - should be able to compare with INT */
+ case FT_UINT48: /* XXX - should be able to compare with INT */
+ case FT_INT56: /* XXX - should be able to compare with INT */
+ case FT_UINT56: /* XXX - should be able to compare with INT */
case FT_INT64: /* XXX - should be able to compare with INT */
case FT_UINT64: /* XXX - should be able to compare with INT */
case FT_EUI64: /* XXX - should be able to compare with INT */
@@ -175,7 +181,7 @@ mk_uint64_fvalue(guint64 val)
fvalue_t *fv;
fv = fvalue_new(FT_UINT64);
- fvalue_set_integer64(fv, val);
+ fvalue_set_uinteger64(fv, val);
return fv;
}
@@ -224,11 +230,17 @@ mk_fvalue_from_val_string(dfwork_t *dfw, header_field_info *hfinfo, char *s)
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
case FT_INT8:
case FT_INT16:
case FT_INT24:
case FT_INT32:
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
break;
@@ -352,11 +364,17 @@ is_bytes_type(enum ftenum type)
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
case FT_INT8:
case FT_INT16:
case FT_INT24:
case FT_INT32:
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
case FT_PCRE:
case FT_EUI64:
diff --git a/epan/ftypes/ftype-bytes.c b/epan/ftypes/ftype-bytes.c
index 692a38412f..e63276c336 100644
--- a/epan/ftypes/ftype-bytes.c
+++ b/epan/ftypes/ftype-bytes.c
@@ -749,13 +749,15 @@ ftype_register_bytes(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -792,13 +794,15 @@ ftype_register_bytes(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -835,13 +839,15 @@ ftype_register_bytes(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_integer */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* set_value_uinteger */
NULL, /* get_value_integer */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -878,13 +884,15 @@ ftype_register_bytes(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_integer */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* set_value_uinteger */
NULL, /* get_value_integer */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -921,13 +929,15 @@ ftype_register_bytes(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -964,13 +974,15 @@ ftype_register_bytes(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -1007,13 +1019,15 @@ ftype_register_bytes(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -1050,13 +1064,15 @@ ftype_register_bytes(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -1093,13 +1109,15 @@ ftype_register_bytes(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
diff --git a/epan/ftypes/ftype-double.c b/epan/ftypes/ftype-double.c
index d4778b55ce..bb5a2e475c 100644
--- a/epan/ftypes/ftype-double.c
+++ b/epan/ftypes/ftype-double.c
@@ -176,13 +176,15 @@ ftype_register_double(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_snteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
double_fvalue_set_floating, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
value_get_floating, /* get_value_floating */
cmp_eq,
@@ -219,13 +221,15 @@ ftype_register_double(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
double_fvalue_set_floating, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_snteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
value_get_floating, /* get_value_floating */
cmp_eq,
diff --git a/epan/ftypes/ftype-guid.c b/epan/ftypes/ftype-guid.c
index f72cb8bcac..c1f2f20c42 100644
--- a/epan/ftypes/ftype-guid.c
+++ b/epan/ftypes/ftype-guid.c
@@ -146,13 +146,15 @@ ftype_register_guid(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
diff --git a/epan/ftypes/ftype-integer.c b/epan/ftypes/ftype-integer.c
index 5d5787be21..f4463deb71 100644
--- a/epan/ftypes/ftype-integer.c
+++ b/epan/ftypes/ftype-integer.c
@@ -65,7 +65,7 @@ uint_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_
guint32 max)
{
unsigned long value;
- char *endptr;
+ char *endptr;
if (strchr (s, '-') && strtol(s, NULL, 0) < 0) {
/*
@@ -257,7 +257,7 @@ uinteger_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *
static gboolean
ipxnet_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
- guint32 val;
+ guint32 val;
gboolean known;
/*
@@ -361,26 +361,39 @@ cmp_bitwise_and(const fvalue_t *a, const fvalue_t *b)
static void
int64_fvalue_new(fvalue_t *fv)
{
- fv->value.integer64 = 0;
+ fv->value.uinteger64 = 0;
+}
+
+static void
+set_uinteger64(fvalue_t *fv, guint64 value)
+{
+ fv->value.uinteger64 = value;
}
static void
-set_integer64(fvalue_t *fv, guint64 value)
+set_sinteger64(fvalue_t *fv, gint64 value)
{
- fv->value.integer64 = value;
+ fv->value.sinteger64 = value;
}
static guint64
-get_integer64(fvalue_t *fv)
+get_uinteger64(fvalue_t *fv)
{
- return fv->value.integer64;
+ return fv->value.uinteger64;
+}
+
+static gint64
+get_sinteger64(fvalue_t *fv)
+{
+ return fv->value.sinteger64;
}
static gboolean
-uint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
+_uint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
+ guint64 max)
{
guint64 value;
- char *endptr;
+ char *endptr;
if (strchr (s, '-') && g_ascii_strtoll(s, NULL, 0) < 0) {
/*
@@ -417,12 +430,43 @@ uint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _
return FALSE;
}
- fv->value.integer64 = value;
+ if (value > max) {
+ if (err_msg != NULL)
+ *err_msg = g_strdup_printf("\"%s\" too big for this field, maximum %" G_GINT64_MODIFIER "u.", s, max);
+ return FALSE;
+ }
+
+ fv->value.uinteger64 = value;
return TRUE;
}
static gboolean
-sint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
+uint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
+{
+ return _uint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXUINT64);
+}
+
+static gboolean
+uint56_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
+{
+ return _uint64_from_unparsed (fv, s, allow_partial_value, err_msg, 0xFFFFFFFFFFFFFF);
+}
+
+static gboolean
+uint48_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
+{
+ return _uint64_from_unparsed (fv, s, allow_partial_value, err_msg, 0xFFFFFFFFFFFF);
+}
+
+static gboolean
+uint40_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
+{
+ return _uint64_from_unparsed (fv, s, allow_partial_value, err_msg, 0xFFFFFFFFFF);
+}
+
+static gboolean
+_sint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
+ gint64 max, gint64 min)
{
gint64 value;
char *endptr;
@@ -465,10 +509,44 @@ sint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _
return FALSE;
}
- fv->value.integer64 = (guint64)value;
+ if (value > max) {
+ if (err_msg != NULL)
+ *err_msg = g_strdup_printf("\"%s\" too big for this field, maximum %" G_GINT64_MODIFIER "u.", s, max);
+ return FALSE;
+ } else if (value < min) {
+ if (err_msg != NULL)
+ *err_msg = g_strdup_printf("\"%s\" too small for this field, maximum %" G_GINT64_MODIFIER "u.", s, max);
+ return FALSE;
+ }
+
+ fv->value.sinteger64 = (guint64)value;
return TRUE;
}
+static gboolean
+sint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
+{
+ return _sint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXINT64, G_MININT64);
+}
+
+static gboolean
+sint56_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
+{
+ return _sint64_from_unparsed (fv, s, allow_partial_value, err_msg, 0x7FFFFFFFFFFFFF, -0x80000000000000);
+}
+
+static gboolean
+sint48_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
+{
+ return _sint64_from_unparsed (fv, s, allow_partial_value, err_msg, 0x7FFFFFFFFFFF, -0x800000000000);
+}
+
+static gboolean
+sint40_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
+{
+ return _sint64_from_unparsed (fv, s, allow_partial_value, err_msg, 0x7FFFFFFFFF, -0x8000000000);
+}
+
static int
integer64_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_, int field_display _U_)
{
@@ -478,7 +556,15 @@ integer64_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_, int field_display _U_)
static void
integer64_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf)
{
- sprintf(buf, "%" G_GINT64_MODIFIER "d", (gint64)fv->value.integer64);
+ guint64 val;
+
+ if (fv->value.sinteger < 0) {
+ *buf++ = '-';
+ val = -fv->value.sinteger;
+ } else
+ val = fv->value.sinteger;
+
+ guint64_to_str_buf(val, buf, 20);
}
static int
@@ -490,73 +576,73 @@ uinteger64_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_, int field_display _U_)
static void
uinteger64_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf)
{
- sprintf(buf, "%" G_GINT64_MODIFIER "u", fv->value.integer64);
+ guint64_to_str_buf(fv->value.uinteger, buf, 21);
}
static gboolean
cmp_eq64(const fvalue_t *a, const fvalue_t *b)
{
- return a->value.integer64 == b->value.integer64;
+ return a->value.uinteger64 == b->value.uinteger64;
}
static gboolean
cmp_ne64(const fvalue_t *a, const fvalue_t *b)
{
- return a->value.integer64 != b->value.integer64;
+ return a->value.uinteger64 != b->value.uinteger64;
}
static gboolean
u_cmp_gt64(const fvalue_t *a, const fvalue_t *b)
{
- return a->value.integer64 > b->value.integer64;
+ return a->value.uinteger64 > b->value.uinteger64;
}
static gboolean
u_cmp_ge64(const fvalue_t *a, const fvalue_t *b)
{
- return a->value.integer64 >= b->value.integer64;
+ return a->value.uinteger64 >= b->value.uinteger64;
}
static gboolean
u_cmp_lt64(const fvalue_t *a, const fvalue_t *b)
{
- return a->value.integer64 < b->value.integer64;
+ return a->value.uinteger64 < b->value.uinteger64;
}
static gboolean
u_cmp_le64(const fvalue_t *a, const fvalue_t *b)
{
- return a->value.integer64 <= b->value.integer64;
+ return a->value.uinteger64 <= b->value.uinteger64;
}
static gboolean
s_cmp_gt64(const fvalue_t *a, const fvalue_t *b)
{
- return (gint64)a->value.integer64 > (gint64)b->value.integer64;
+ return (gint64)a->value.sinteger64 > (gint64)b->value.sinteger64;
}
static gboolean
s_cmp_ge64(const fvalue_t *a, const fvalue_t *b)
{
- return (gint64)a->value.integer64 >= (gint64)b->value.integer64;
+ return (gint64)a->value.sinteger64 >= (gint64)b->value.sinteger64;
}
static gboolean
s_cmp_lt64(const fvalue_t *a, const fvalue_t *b)
{
- return (gint64)a->value.integer64 < (gint64)b->value.integer64;
+ return (gint64)a->value.sinteger64 < (gint64)b->value.sinteger64;
}
static gboolean
s_cmp_le64(const fvalue_t *a, const fvalue_t *b)
{
- return (gint64)a->value.integer64 <= (gint64)b->value.integer64;
+ return (gint64)a->value.sinteger64 <= (gint64)b->value.sinteger64;
}
static gboolean
cmp_bitwise_and64(const fvalue_t *a, const fvalue_t *b)
{
- return ((a->value.integer64 & b->value.integer64) != 0);
+ return ((a->value.uinteger64 & b->value.uinteger64) != 0);
}
/* BOOLEAN-specific */
@@ -674,13 +760,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
set_uinteger, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
get_uinteger, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -716,13 +804,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
set_uinteger, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
get_uinteger, /* get_value_integer */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -756,15 +846,17 @@ ftype_register_integers(void)
NULL, /* set_value_time */
NULL, /* set_value_string */
NULL, /* set_value_tvbuff */
- set_uinteger, /* set_value_integer */
+ set_uinteger, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
get_uinteger, /* get_value_integer */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -800,13 +892,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
set_uinteger, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
get_uinteger, /* get_value_integer */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -822,6 +916,138 @@ ftype_register_integers(void)
NULL, /* len */
NULL, /* slice */
};
+ static ftype_t uint40_type = {
+ FT_UINT40, /* ftype */
+ "FT_UINT40", /* name */
+ "Unsigned integer, 5 bytes", /* pretty_name */
+ 5, /* wire_size */
+ int64_fvalue_new, /* new_value */
+ NULL, /* free_value */
+ uint40_from_unparsed, /* val_from_unparsed */
+ NULL, /* val_from_string */
+ uinteger64_to_repr, /* val_to_string_repr */
+ uinteger64_repr_len, /* len_string_repr */
+
+ NULL, /* set_value_byte_array */
+ NULL, /* set_value_bytes */
+ NULL, /* set_value_guid */
+ NULL, /* set_value_time */
+ NULL, /* set_value_string */
+ NULL, /* set_value_tvbuff */
+ NULL, /* set_value_uinteger */
+ NULL, /* set_value_sinteger */
+ set_uinteger64, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
+ NULL, /* set_value_floating */
+
+ NULL, /* get_value */
+ NULL, /* get_value_uinteger */
+ NULL, /* get_value_sinteger */
+ get_uinteger64, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
+ NULL, /* get_value_floating */
+
+ cmp_eq64,
+ cmp_ne64,
+ u_cmp_gt64,
+ u_cmp_ge64,
+ u_cmp_lt64,
+ u_cmp_le64,
+ cmp_bitwise_and64,
+ NULL, /* cmp_contains */
+ NULL, /* cmp_matches */
+
+ NULL,
+ NULL,
+ };
+ static ftype_t uint48_type = {
+ FT_UINT48, /* ftype */
+ "FT_UINT48", /* name */
+ "Unsigned integer, 6 bytes", /* pretty_name */
+ 6, /* wire_size */
+ int64_fvalue_new, /* new_value */
+ NULL, /* free_value */
+ uint48_from_unparsed, /* val_from_unparsed */
+ NULL, /* val_from_string */
+ uinteger64_to_repr, /* val_to_string_repr */
+ uinteger64_repr_len, /* len_string_repr */
+
+ NULL, /* set_value_byte_array */
+ NULL, /* set_value_bytes */
+ NULL, /* set_value_guid */
+ NULL, /* set_value_time */
+ NULL, /* set_value_string */
+ NULL, /* set_value_tvbuff */
+ NULL, /* set_value_uinteger */
+ NULL, /* set_value_sinteger */
+ set_uinteger64, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
+ NULL, /* set_value_floating */
+
+ NULL, /* get_value */
+ NULL, /* get_value_uinteger */
+ NULL, /* get_value_sinteger */
+ get_uinteger64, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
+ NULL, /* get_value_floating */
+
+ cmp_eq64,
+ cmp_ne64,
+ u_cmp_gt64,
+ u_cmp_ge64,
+ u_cmp_lt64,
+ u_cmp_le64,
+ cmp_bitwise_and64,
+ NULL, /* cmp_contains */
+ NULL, /* cmp_matches */
+
+ NULL,
+ NULL,
+ };
+ static ftype_t uint56_type = {
+ FT_UINT56, /* ftype */
+ "FT_UINT56", /* name */
+ "Unsigned integer, 7 bytes", /* pretty_name */
+ 7, /* wire_size */
+ int64_fvalue_new, /* new_value */
+ NULL, /* free_value */
+ uint56_from_unparsed, /* val_from_unparsed */
+ NULL, /* val_from_string */
+ uinteger64_to_repr, /* val_to_string_repr */
+ uinteger64_repr_len, /* len_string_repr */
+
+ NULL, /* set_value_byte_array */
+ NULL, /* set_value_bytes */
+ NULL, /* set_value_guid */
+ NULL, /* set_value_time */
+ NULL, /* set_value_string */
+ NULL, /* set_value_tvbuff */
+ NULL, /* set_value_uinteger */
+ NULL, /* set_value_sinteger */
+ set_uinteger64, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
+ NULL, /* set_value_floating */
+
+ NULL, /* get_value */
+ NULL, /* get_value_uinteger */
+ NULL, /* get_value_sinteger */
+ get_uinteger64, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
+ NULL, /* get_value_floating */
+
+ cmp_eq64,
+ cmp_ne64,
+ u_cmp_gt64,
+ u_cmp_ge64,
+ u_cmp_lt64,
+ u_cmp_le64,
+ cmp_bitwise_and64,
+ NULL, /* cmp_contains */
+ NULL, /* cmp_matches */
+
+ NULL,
+ NULL,
+ };
static ftype_t uint64_type = {
FT_UINT64, /* ftype */
"FT_UINT64", /* name */
@@ -842,13 +1068,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- set_integer64, /* set_value_integer64 */
+ set_uinteger64, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- get_integer64, /* get_value_integer64 */
+ get_uinteger64, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq64,
@@ -884,13 +1112,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
set_sinteger, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
get_sinteger, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -926,13 +1156,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
set_sinteger, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
get_sinteger, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -968,13 +1200,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
set_sinteger, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
get_sinteger, /* get_value_integer */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -1010,13 +1244,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
set_sinteger, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
get_sinteger, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -1032,6 +1268,138 @@ ftype_register_integers(void)
NULL, /* len */
NULL, /* slice */
};
+ static ftype_t int40_type = {
+ FT_INT40, /* ftype */
+ "FT_INT40", /* name */
+ "Signed integer, 5 bytes", /* pretty_name */
+ 5, /* wire_size */
+ int64_fvalue_new, /* new_value */
+ NULL, /* free_value */
+ sint40_from_unparsed, /* val_from_unparsed */
+ NULL, /* val_from_string */
+ integer64_to_repr, /* val_to_string_repr */
+ integer64_repr_len, /* len_string_repr */
+
+ NULL, /* set_value_byte_array */
+ NULL, /* set_value_bytes */
+ NULL, /* set_value_guid */
+ NULL, /* set_value_time */
+ NULL, /* set_value_string */
+ NULL, /* set_value_tvbuff */
+ NULL, /* set_value_uinteger */
+ NULL, /* set_value_sinteger */
+ NULL, /* set_value_uinteger64 */
+ set_sinteger64, /* set_value_sinteger64 */
+ NULL, /* set_value_floating */
+
+ NULL, /* get_value */
+ NULL, /* get_value_uinteger */
+ NULL, /* get_value_sinteger */
+ NULL, /* get_value_uinteger64 */
+ get_sinteger64, /* get_value_sinteger64 */
+ NULL, /* get_value_floating */
+
+ cmp_eq64,
+ cmp_ne64,
+ s_cmp_gt64,
+ s_cmp_ge64,
+ s_cmp_lt64,
+ s_cmp_le64,
+ cmp_bitwise_and64,
+ NULL, /* cmp_contains */
+ NULL, /* cmp_matches */
+
+ NULL,
+ NULL,
+ };
+ static ftype_t int48_type = {
+ FT_INT48, /* ftype */
+ "FT_INT48", /* name */
+ "Signed integer, 6 bytes", /* pretty_name */
+ 6, /* wire_size */
+ int64_fvalue_new, /* new_value */
+ NULL, /* free_value */
+ sint48_from_unparsed, /* val_from_unparsed */
+ NULL, /* val_from_string */
+ integer64_to_repr, /* val_to_string_repr */
+ integer64_repr_len, /* len_string_repr */
+
+ NULL, /* set_value_byte_array */
+ NULL, /* set_value_bytes */
+ NULL, /* set_value_guid */
+ NULL, /* set_value_time */
+ NULL, /* set_value_string */
+ NULL, /* set_value_tvbuff */
+ NULL, /* set_value_uinteger */
+ NULL, /* set_value_sinteger */
+ NULL, /* set_value_uinteger64 */
+ set_sinteger64, /* set_value_sinteger64 */
+ NULL, /* set_value_floating */
+
+ NULL, /* get_value */
+ NULL, /* get_value_uinteger */
+ NULL, /* get_value_sinteger */
+ NULL, /* get_value_uinteger64 */
+ get_sinteger64, /* get_value_sinteger64 */
+ NULL, /* get_value_floating */
+
+ cmp_eq64,
+ cmp_ne64,
+ s_cmp_gt64,
+ s_cmp_ge64,
+ s_cmp_lt64,
+ s_cmp_le64,
+ cmp_bitwise_and64,
+ NULL, /* cmp_contains */
+ NULL, /* cmp_matches */
+
+ NULL,
+ NULL,
+ };
+ static ftype_t int56_type = {
+ FT_INT56, /* ftype */
+ "FT_INT56", /* name */
+ "Signed integer, 7 bytes", /* pretty_name */
+ 7, /* wire_size */
+ int64_fvalue_new, /* new_value */
+ NULL, /* free_value */
+ sint56_from_unparsed, /* val_from_unparsed */
+ NULL, /* val_from_string */
+ integer64_to_repr, /* val_to_string_repr */
+ integer64_repr_len, /* len_string_repr */
+
+ NULL, /* set_value_byte_array */
+ NULL, /* set_value_bytes */
+ NULL, /* set_value_guid */
+ NULL, /* set_value_time */
+ NULL, /* set_value_string */
+ NULL, /* set_value_tvbuff */
+ NULL, /* set_value_uinteger */
+ NULL, /* set_value_sinteger */
+ NULL, /* set_value_uinteger64 */
+ set_sinteger64, /* set_value_sinteger64 */
+ NULL, /* set_value_floating */
+
+ NULL, /* get_value */
+ NULL, /* get_value_uinteger */
+ NULL, /* get_value_sinteger */
+ NULL, /* get_value_uinteger64 */
+ get_sinteger64, /* get_value_sinteger64 */
+ NULL, /* get_value_floating */
+
+ cmp_eq64,
+ cmp_ne64,
+ s_cmp_gt64,
+ s_cmp_ge64,
+ s_cmp_lt64,
+ s_cmp_le64,
+ cmp_bitwise_and64,
+ NULL, /* cmp_contains */
+ NULL, /* cmp_matches */
+
+ NULL,
+ NULL,
+ };
static ftype_t int64_type = {
FT_INT64, /* ftype */
"FT_INT64", /* name */
@@ -1052,13 +1420,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- set_integer64, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ set_sinteger64, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- get_integer64, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ get_sinteger64, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq64,
@@ -1094,13 +1464,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
set_uinteger, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- set_integer64, /* set_value_integer64 */
+ set_uinteger64, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
get_uinteger, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- get_integer64, /* get_value_integer64 */
+ get_uinteger64, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
bool_eq, /* cmp_eq */
@@ -1137,13 +1509,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
set_uinteger, /* set_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
get_uinteger, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -1180,13 +1554,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
set_uinteger, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
get_uinteger, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -1223,13 +1599,15 @@ ftype_register_integers(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- set_integer64, /* set_value_integer64 */
+ set_uinteger64, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- get_integer64, /* get_value_integer64 */
+ get_uinteger64, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq64,
@@ -1250,11 +1628,17 @@ ftype_register_integers(void)
ftype_register(FT_UINT16, &uint16_type);
ftype_register(FT_UINT24, &uint24_type);
ftype_register(FT_UINT32, &uint32_type);
+ ftype_register(FT_UINT40, &uint40_type);
+ ftype_register(FT_UINT48, &uint48_type);
+ ftype_register(FT_UINT56, &uint56_type);
ftype_register(FT_UINT64, &uint64_type);
ftype_register(FT_INT8, &int8_type);
ftype_register(FT_INT16, &int16_type);
ftype_register(FT_INT24, &int24_type);
ftype_register(FT_INT32, &int32_type);
+ ftype_register(FT_INT40, &int40_type);
+ ftype_register(FT_INT48, &int48_type);
+ ftype_register(FT_INT56, &int56_type);
ftype_register(FT_INT64, &int64_type);
ftype_register(FT_BOOLEAN, &boolean_type);
ftype_register(FT_IPXNET, &ipxnet_type);
diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c
index c582455da4..4ea6f27a5f 100644
--- a/epan/ftypes/ftype-ipv4.c
+++ b/epan/ftypes/ftype-ipv4.c
@@ -193,13 +193,15 @@ ftype_register_ipv4(void)
NULL, /* set_value_tvbuff */
set_uinteger, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
diff --git a/epan/ftypes/ftype-ipv6.c b/epan/ftypes/ftype-ipv6.c
index 80a5e02904..34f619325b 100644
--- a/epan/ftypes/ftype-ipv6.c
+++ b/epan/ftypes/ftype-ipv6.c
@@ -242,13 +242,15 @@ ftype_register_ipv6(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
diff --git a/epan/ftypes/ftype-none.c b/epan/ftypes/ftype-none.c
index 6b318452d9..351c692b7a 100644
--- a/epan/ftypes/ftype-none.c
+++ b/epan/ftypes/ftype-none.c
@@ -47,13 +47,15 @@ ftype_register_none(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
NULL, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
NULL, /* cmp_eq */
diff --git a/epan/ftypes/ftype-pcre.c b/epan/ftypes/ftype-pcre.c
index 88ecb104d4..0f4b02fb04 100644
--- a/epan/ftypes/ftype-pcre.c
+++ b/epan/ftypes/ftype-pcre.c
@@ -171,13 +171,15 @@ ftype_register_pcre(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
gregex_fvalue_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
NULL, /* cmp_eq */
diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c
index 35c3357c57..143d481958 100644
--- a/epan/ftypes/ftype-string.c
+++ b/epan/ftypes/ftype-string.c
@@ -248,13 +248,15 @@ ftype_register_string(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -290,13 +292,15 @@ ftype_register_string(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -332,13 +336,15 @@ ftype_register_string(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -374,13 +380,15 @@ ftype_register_string(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
diff --git a/epan/ftypes/ftype-time.c b/epan/ftypes/ftype-time.c
index 6ee8907142..8aaac3aebd 100644
--- a/epan/ftypes/ftype-time.c
+++ b/epan/ftypes/ftype-time.c
@@ -397,13 +397,15 @@ ftype_register_time(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
@@ -439,13 +441,15 @@ ftype_register_time(void)
NULL, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
diff --git a/epan/ftypes/ftype-tvbuff.c b/epan/ftypes/ftype-tvbuff.c
index f99132746a..a1376475bd 100644
--- a/epan/ftypes/ftype-tvbuff.c
+++ b/epan/ftypes/ftype-tvbuff.c
@@ -433,13 +433,15 @@ ftype_register_tvbuff(void)
value_set, /* set_value_tvbuff */
NULL, /* set_value_uinteger */
NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
+ NULL, /* set_value_uinteger64 */
+ NULL, /* set_value_sinteger64 */
NULL, /* set_value_floating */
value_get, /* get_value */
NULL, /* get_value_uinteger */
NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
+ NULL, /* get_value_uinteger64 */
+ NULL, /* get_value_sinteger64 */
NULL, /* get_value_floating */
cmp_eq,
diff --git a/epan/ftypes/ftypes-int.h b/epan/ftypes/ftypes-int.h
index 98cf9052b6..912a0dbdbc 100644
--- a/epan/ftypes/ftypes-int.h
+++ b/epan/ftypes/ftypes-int.h
@@ -61,13 +61,15 @@ typedef void (*FvalueSetStringFunc)(fvalue_t*, const gchar *value);
typedef void (*FvalueSetTvbuffFunc)(fvalue_t*, tvbuff_t *value);
typedef void (*FvalueSetUnsignedIntegerFunc)(fvalue_t*, guint32);
typedef void (*FvalueSetSignedIntegerFunc)(fvalue_t*, gint32);
-typedef void (*FvalueSetInteger64Func)(fvalue_t*, guint64);
+typedef void (*FvalueSetUnsignedInteger64Func)(fvalue_t*, guint64);
+typedef void (*FvalueSetSignedInteger64Func)(fvalue_t*, gint64);
typedef void (*FvalueSetFloatingFunc)(fvalue_t*, gdouble);
typedef gpointer (*FvalueGetFunc)(fvalue_t*);
typedef guint32 (*FvalueGetUnsignedIntegerFunc)(fvalue_t*);
typedef gint32 (*FvalueGetSignedIntegerFunc)(fvalue_t*);
-typedef guint64 (*FvalueGetInteger64Func)(fvalue_t*);
+typedef guint64 (*FvalueGetUnsignedInteger64Func)(fvalue_t*);
+typedef gint64 (*FvalueGetSignedInteger64Func)(fvalue_t*);
typedef double (*FvalueGetFloatingFunc)(fvalue_t*);
typedef gboolean (*FvalueCmp)(const fvalue_t*, const fvalue_t*);
@@ -96,14 +98,16 @@ struct _ftype_t {
FvalueSetTvbuffFunc set_value_tvbuff;
FvalueSetUnsignedIntegerFunc set_value_uinteger;
FvalueSetSignedIntegerFunc set_value_sinteger;
- FvalueSetInteger64Func set_value_integer64;
+ FvalueSetUnsignedInteger64Func set_value_uinteger64;
+ FvalueSetSignedInteger64Func set_value_sinteger64;
FvalueSetFloatingFunc set_value_floating;
/* could be union */
FvalueGetFunc get_value;
FvalueGetUnsignedIntegerFunc get_value_uinteger;
FvalueGetSignedIntegerFunc get_value_sinteger;
- FvalueGetInteger64Func get_value_integer64;
+ FvalueGetUnsignedInteger64Func get_value_uinteger64;
+ FvalueGetSignedInteger64Func get_value_sinteger64;
FvalueGetFloatingFunc get_value_floating;
FvalueCmp cmp_eq;
diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c
index 53e2944584..9dc8f9afe1 100644
--- a/epan/ftypes/ftypes.c
+++ b/epan/ftypes/ftypes.c
@@ -93,6 +93,18 @@ same_ftype(const enum ftenum ftype)
case FT_UINT32:
return FT_UINT32;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
+ case FT_INT64:
+ return FT_INT64;
+
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
+ case FT_UINT64:
+ return FT_UINT64;
+
case FT_STRING:
case FT_STRINGZ:
case FT_UINT_STRING:
@@ -111,8 +123,6 @@ same_ftype(const enum ftenum ftype)
return FT_OID;
/* XXX: the folowing are unqiue for now */
- case FT_INT64:
- case FT_UINT64:
case FT_IPv4:
case FT_IPv6:
@@ -540,12 +550,18 @@ fvalue_set_sinteger(fvalue_t *fv, gint32 value)
fv->ftype->set_value_sinteger(fv, value);
}
+void
+fvalue_set_uinteger64(fvalue_t *fv, guint64 value)
+{
+ g_assert(fv->ftype->set_value_uinteger64);
+ fv->ftype->set_value_uinteger64(fv, value);
+}
void
-fvalue_set_integer64(fvalue_t *fv, guint64 value)
+fvalue_set_sinteger64(fvalue_t *fv, gint64 value)
{
- g_assert(fv->ftype->set_value_integer64);
- fv->ftype->set_value_integer64(fv, value);
+ g_assert(fv->ftype->set_value_sinteger64);
+ fv->ftype->set_value_sinteger64(fv, value);
}
void
@@ -577,12 +593,18 @@ fvalue_get_sinteger(fvalue_t *fv)
return fv->ftype->get_value_sinteger(fv);
}
-
guint64
-fvalue_get_integer64(fvalue_t *fv)
+fvalue_get_uinteger64(fvalue_t *fv)
+{
+ g_assert(fv->ftype->get_value_uinteger64);
+ return fv->ftype->get_value_uinteger64(fv);
+}
+
+gint64
+fvalue_get_sinteger64(fvalue_t *fv)
{
- g_assert(fv->ftype->get_value_integer64);
- return fv->ftype->get_value_integer64(fv);
+ g_assert(fv->ftype->get_value_sinteger64);
+ return fv->ftype->get_value_sinteger64(fv);
}
double
diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h
index 33f36a4b6c..71f6e9386c 100644
--- a/epan/ftypes/ftypes.h
+++ b/epan/ftypes/ftypes.h
@@ -40,11 +40,17 @@ enum ftenum {
FT_UINT16,
FT_UINT24, /* really a UINT32, but displayed as 3 hex-digits if FD_HEX*/
FT_UINT32,
+ FT_UINT40, /* really a UINT64, but displayed as 10 hex-digits if FD_HEX*/
+ FT_UINT48, /* really a UINT64, but displayed as 12 hex-digits if FD_HEX*/
+ FT_UINT56, /* really a UINT64, but displayed as 14 hex-digits if FD_HEX*/
FT_UINT64,
FT_INT8,
FT_INT16,
FT_INT24, /* same as for UINT24 */
FT_INT32,
+ FT_INT40, /* same as for UINT40 */
+ FT_INT48, /* same as for UINT48 */
+ FT_INT56, /* same as for UINT56 */
FT_INT64,
FT_FLOAT,
FT_DOUBLE,
@@ -73,8 +79,8 @@ enum ftenum {
FT_NUM_TYPES /* last item number plus one */
};
-#define IS_FT_INT(ft) ((ft)==FT_INT8||(ft)==FT_INT16||(ft)==FT_INT24||(ft)==FT_INT32||(ft)==FT_INT64)
-#define IS_FT_UINT(ft) ((ft)==FT_UINT8||(ft)==FT_UINT16||(ft)==FT_UINT24||(ft)==FT_UINT32||(ft)==FT_UINT64||(ft)==FT_FRAMENUM)
+#define IS_FT_INT(ft) ((ft)==FT_INT8||(ft)==FT_INT16||(ft)==FT_INT24||(ft)==FT_INT32||(ft)==FT_INT40||(ft)==FT_INT48||(ft)==FT_INT56||(ft)==FT_INT64)
+#define IS_FT_UINT(ft) ((ft)==FT_UINT8||(ft)==FT_UINT16||(ft)==FT_UINT24||(ft)==FT_UINT32||(ft)==FT_UINT40||(ft)==FT_UINT48||(ft)==FT_UINT56||(ft)==FT_UINT64||(ft)==FT_FRAMENUM)
#define IS_FT_TIME(ft) ((ft)==FT_ABSOLUTE_TIME||(ft)==FT_RELATIVE_TIME)
#define IS_FT_STRING(ft) ((ft)==FT_STRING||(ft)==FT_STRINGZ||(ft)==FT_STRINGZPAD)
@@ -86,7 +92,7 @@ enum ftenum {
#define FT_IPXNET_LEN 4
#define FT_EUI64_LEN 8
#define FT_AX25_ADDR_LEN 7
-#define FT_VINES_ADDR_LEN 6
+#define FT_VINES_ADDR_LEN 6
#define FT_FCWWN_LEN 8
typedef enum ftenum ftenum_t;
@@ -185,6 +191,8 @@ typedef struct _fvalue_t {
guint32 uinteger;
gint32 sinteger;
guint64 integer64;
+ guint64 uinteger64;
+ gint64 sinteger64;
gdouble floating;
gchar *string;
guchar *ustring;
@@ -273,7 +281,10 @@ void
fvalue_set_sinteger(fvalue_t *fv, gint32 value);
void
-fvalue_set_integer64(fvalue_t *fv, guint64 value);
+fvalue_set_uinteger64(fvalue_t *fv, guint64 value);
+
+void
+fvalue_set_sinteger64(fvalue_t *fv, gint64 value);
void
fvalue_set_floating(fvalue_t *fv, gdouble value);
@@ -290,7 +301,11 @@ fvalue_get_sinteger(fvalue_t *fv);
WS_DLL_PUBLIC
guint64
-fvalue_get_integer64(fvalue_t *fv);
+fvalue_get_uinteger64(fvalue_t *fv);
+
+WS_DLL_PUBLIC
+gint64
+fvalue_get_sinteger64(fvalue_t *fv);
WS_DLL_PUBLIC double
fvalue_get_floating(fvalue_t *fv);
diff --git a/epan/print.c b/epan/print.c
index 9065ae8bcd..66946ec9da 100644
--- a/epan/print.c
+++ b/epan/print.c
@@ -419,10 +419,17 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
case FT_BOOLEAN:
fprintf(pdata->fh, "%X", fvalue_get_uinteger(&fi->value));
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
+ fprintf(pdata->fh, "%" G_GINT64_MODIFIER "X", fvalue_get_sinteger64(&fi->value));
+ break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
- fprintf(pdata->fh, "%" G_GINT64_MODIFIER "X",
- fvalue_get_integer64(&fi->value));
+ fprintf(pdata->fh, "%" G_GINT64_MODIFIER "X", fvalue_get_uinteger64(&fi->value));
break;
default:
g_assert_not_reached();
diff --git a/epan/proto.c b/epan/proto.c
index ac4e44f9c4..da59e2ecc6 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -154,19 +154,25 @@ struct ptvcursor {
}
static const char *hf_try_val_to_str(guint32 value, const header_field_info *hfinfo);
+static const char *hf_try_val64_to_str(guint64 value, const header_field_info *hfinfo);
static void label_mark_truncated(char *label_str, gsize name_pos);
#define LABEL_MARK_TRUNCATED_START(label_str) label_mark_truncated(label_str, 0)
static void fill_label_boolean(field_info *fi, gchar *label_str);
static void fill_label_bitfield(field_info *fi, gchar *label_str, gboolean is_signed);
+static void fill_label_bitfield64(field_info *fi, gchar *label_str, gboolean is_signed);
static void fill_label_number(field_info *fi, gchar *label_str, gboolean is_signed);
static void fill_label_number64(field_info *fi, gchar *label_str, gboolean is_signed);
static const char *hfinfo_number_value_format_display(const header_field_info *hfinfo, int display, char buf[32], guint32 value);
+static const char *hfinfo_number_value_format_display64(const header_field_info *hfinfo, int display, char buf[32], guint64 value);
static const char *hfinfo_number_vals_format(const header_field_info *hfinfo, char buf[32], guint32 value);
+static const char *hfinfo_number_vals_format64(const header_field_info *hfinfo, char buf[32], guint64 value);
static const char *hfinfo_number_value_format(const header_field_info *hfinfo, char buf[32], guint32 value);
+static const char *hfinfo_number_value_format64(const header_field_info *hfinfo, char buf[32], guint64 value);
static const char *hfinfo_numeric_value_format(const header_field_info *hfinfo, char buf[32], guint32 value);
+static const char *hfinfo_numeric_value_format64(const header_field_info *hfinfo, char buf[32], guint64 value);
static const char* hfinfo_uint64_format(const header_field_info *hfinfo);
static const char* hfinfo_int64_format(const header_field_info *hfinfo);
@@ -252,6 +258,8 @@ proto_tree_set_int(field_info *fi, gint32 value);
static void
proto_tree_set_uint64(field_info *fi, guint64 value);
static void
+proto_tree_set_int64(field_info *fi, gint64 value);
+static void
proto_tree_set_eui64(field_info *fi, const guint64 value);
static void
proto_tree_set_eui64_tvb(field_info *fi, tvbuff_t *tvb, gint start, const guint encoding);
@@ -1684,6 +1692,9 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree,
get_uint_value(tree, tvb, start, length, encoding));
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
/*
* Map all non-zero values to little-endian for
@@ -1710,6 +1721,9 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree,
get_int_value(tree, tvb, start, length, encoding));
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
/*
* Map all non-zero values to little-endian for
@@ -3033,30 +3047,6 @@ proto_tree_set_system_id_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint len
proto_tree_set_system_id(fi, tvb_get_ptr(tvb, start, length), length);
}
-static void
-proto_tree_set_uint64(field_info *fi, guint64 value)
-{
- header_field_info *hfinfo;
- guint64 integer;
- gint no_of_bits;
-
- hfinfo = fi->hfinfo;
- integer = value;
-
- if (hfinfo->bitmask) {
- /* Mask out irrelevant portions */
- integer &= hfinfo->bitmask;
-
- /* Shift bits */
- integer >>= hfinfo_bitshift(hfinfo);
-
- no_of_bits = ws_count_ones(hfinfo->bitmask);
- integer = ws_sign_ext64(integer, no_of_bits);
- }
-
- fvalue_set_integer64(&fi->value, integer);
-}
-
/* Add a FT_STRING, FT_STRINGZ, or FT_STRINGZPAD to a proto_tree. Creates
* own copy of string, and frees it when the proto_tree is destroyed. */
proto_item *
@@ -3559,20 +3549,29 @@ proto_tree_set_uint(field_info *fi, guint32 value)
fvalue_set_uinteger(&fi->value, integer);
}
-/* Add FT_UINT64 to a proto_tree */
+/* Add FT_UINT{40,48,56,64} to a proto_tree */
proto_item *
proto_tree_add_uint64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint64 value)
{
- proto_item *pi;
+ proto_item *pi = NULL;
header_field_info *hfinfo;
TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo);
- DISSECTOR_ASSERT_FIELD_TYPE(hfinfo, FT_UINT64);
+ switch (hfinfo->type) {
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
+ case FT_UINT64:
+ case FT_FRAMENUM:
+ pi = proto_tree_add_pi(tree, hfinfo, tvb, start, &length);
+ proto_tree_set_uint64(PNODE_FINFO(pi), value);
+ break;
- pi = proto_tree_add_pi(tree, hfinfo, tvb, start, &length);
- proto_tree_set_uint64(PNODE_FINFO(pi), value);
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ }
return pi;
}
@@ -3615,6 +3614,31 @@ proto_tree_add_uint64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb,
return pi;
}
+/* Set the FT_UINT{40,48,56,64} value */
+static void
+proto_tree_set_uint64(field_info *fi, guint64 value)
+{
+ header_field_info *hfinfo;
+ guint64 integer;
+ gint no_of_bits;
+
+ hfinfo = fi->hfinfo;
+ integer = value;
+
+ if (hfinfo->bitmask) {
+ /* Mask out irrelevant portions */
+ integer &= hfinfo->bitmask;
+
+ /* Shift bits */
+ integer >>= hfinfo_bitshift(hfinfo);
+
+ no_of_bits = ws_count_ones(hfinfo->bitmask);
+ integer = ws_sign_ext64(integer, no_of_bits);
+ }
+
+ fvalue_set_uinteger64(&fi->value, integer);
+}
+
/* Add FT_INT{8,16,24,32} to a proto_tree */
proto_item *
proto_tree_add_int(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
@@ -3704,20 +3728,28 @@ proto_tree_set_int(field_info *fi, gint32 value)
fvalue_set_sinteger(&fi->value, integer);
}
-/* Add FT_INT64 to a proto_tree */
+/* Add FT_INT{40,48,56,64} to a proto_tree */
proto_item *
proto_tree_add_int64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, gint64 value)
{
- proto_item *pi;
+ proto_item *pi = NULL;
header_field_info *hfinfo;
TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo);
- DISSECTOR_ASSERT_FIELD_TYPE(hfinfo, FT_INT64);
+ switch (hfinfo->type) {
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
+ case FT_INT64:
+ pi = proto_tree_add_pi(tree, hfinfo, tvb, start, &length);
+ proto_tree_set_int64(PNODE_FINFO(pi), value);
+ break;
- pi = proto_tree_add_pi(tree, hfinfo, tvb, start, &length);
- proto_tree_set_uint64(PNODE_FINFO(pi), (guint64)value);
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ }
return pi;
}
@@ -3740,6 +3772,31 @@ proto_tree_add_int64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
return pi;
}
+/* Set the FT_INT{40,48,56,64} value */
+static void
+proto_tree_set_int64(field_info *fi, gint64 value)
+{
+ header_field_info *hfinfo;
+ guint64 integer;
+ gint no_of_bits;
+
+ hfinfo = fi->hfinfo;
+ integer = value;
+
+ if (hfinfo->bitmask) {
+ /* Mask out irrelevant portions */
+ integer &= hfinfo->bitmask;
+
+ /* Shift bits */
+ integer >>= hfinfo_bitshift(hfinfo);
+
+ no_of_bits = ws_count_ones(hfinfo->bitmask);
+ integer = ws_sign_ext64(integer, no_of_bits);
+ }
+
+ fvalue_set_sinteger64(&fi->value, integer);
+}
+
proto_item *
proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, gint64 value,
@@ -3759,6 +3816,7 @@ proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb,
return pi;
}
+
/* Add a FT_EUI64 to a proto_tree */
proto_item *
proto_tree_add_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
@@ -3819,7 +3877,7 @@ proto_tree_add_eui64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb,
static void
proto_tree_set_eui64(field_info *fi, const guint64 value)
{
- fvalue_set_integer64(&fi->value, value);
+ fvalue_set_uinteger64(&fi->value, value);
}
static void
proto_tree_set_eui64_tvb(field_info *fi, tvbuff_t *tvb, gint start, const guint encoding)
@@ -4079,7 +4137,7 @@ proto_tree_set_representation_value(proto_item *pi, const char *format, va_list
if (IS_FT_UINT(hf->type))
val = fvalue_get_uinteger(&fi->value);
else
- val = fvalue_get_integer64(&fi->value);
+ val = fvalue_get_uinteger64(&fi->value);
val <<= hfinfo_bitshift(hf);
@@ -4173,6 +4231,7 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
gchar *result, gchar *expr, const int size)
{
guint32 number;
+ guint64 number64;
guint8 *bytes;
ipv4_addr *ipv4;
struct e_in6_addr *ipv6;
@@ -4259,276 +4318,315 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
switch (hfinfo->type) {
- case FT_NONE: /* Nothing to add */
- if (offset_r == 0) {
- result[0] = '\0';
- } else if (result[offset_r-1] == ',') {
- result[offset_r-1] = '\0';
- }
- break;
+ case FT_NONE: /* Nothing to add */
+ if (offset_r == 0) {
+ result[0] = '\0';
+ } else if (result[offset_r-1] == ',') {
+ result[offset_r-1] = '\0';
+ }
+ break;
- case FT_PROTOCOL:
- /* prevent multiple "yes" entries by setting result directly */
- g_strlcpy(result, "Yes", size);
- break;
+ case FT_PROTOCOL:
+ /* prevent multiple "yes" entries by setting result directly */
+ g_strlcpy(result, "Yes", size);
+ break;
- case FT_UINT_BYTES:
- case FT_BYTES:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- if (bytes) {
- switch(hfinfo->display)
- {
- case SEP_DOT:
- str = (char*)bytestring_to_str(NULL, bytes, fvalue_length(&finfo->value), '.');
- break;
- case SEP_DASH:
- str = (char*)bytestring_to_str(NULL, bytes, fvalue_length(&finfo->value), '-');
- break;
- case SEP_COLON:
- str = (char*)bytestring_to_str(NULL, bytes, fvalue_length(&finfo->value), ':');
- break;
- case SEP_SPACE:
- str = (char*)bytestring_to_str(NULL, bytes, fvalue_length(&finfo->value), ' ');
- break;
- case BASE_NONE:
- default:
- if (prefs.display_byte_fields_with_spaces)
+ case FT_UINT_BYTES:
+ case FT_BYTES:
+ bytes = (guint8 *)fvalue_get(&finfo->value);
+ if (bytes) {
+ switch(hfinfo->display)
{
+ case SEP_DOT:
+ str = (char*)bytestring_to_str(NULL, bytes, fvalue_length(&finfo->value), '.');
+ break;
+ case SEP_DASH:
+ str = (char*)bytestring_to_str(NULL, bytes, fvalue_length(&finfo->value), '-');
+ break;
+ case SEP_COLON:
+ str = (char*)bytestring_to_str(NULL, bytes, fvalue_length(&finfo->value), ':');
+ break;
+ case SEP_SPACE:
str = (char*)bytestring_to_str(NULL, bytes, fvalue_length(&finfo->value), ' ');
+ break;
+ case BASE_NONE:
+ default:
+ if (prefs.display_byte_fields_with_spaces)
+ {
+ str = (char*)bytestring_to_str(NULL, bytes, fvalue_length(&finfo->value), ' ');
+ }
+ else
+ {
+ str = (char*)bytes_to_str(NULL, bytes, fvalue_length(&finfo->value));
+ }
+ break;
}
- else
- {
- str = (char*)bytes_to_str(NULL, bytes, fvalue_length(&finfo->value));
- }
- break;
+ offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
+ wmem_free(NULL, str);
}
- offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
- wmem_free(NULL, str);
- }
- else {
- offset_r += protoo_strlcpy(result+offset_r, "<MISSING>", size-offset_r);
- }
- break;
+ else {
+ offset_r += protoo_strlcpy(result+offset_r, "<MISSING>", size-offset_r);
+ }
+ break;
- case FT_ABSOLUTE_TIME:
- tmpbuf = abs_time_to_str(NULL, (const nstime_t *)fvalue_get(&finfo->value), (absolute_time_display_e)hfinfo->display, TRUE);
- offset_r += protoo_strlcpy(result+offset_r,
+ case FT_ABSOLUTE_TIME:
+ tmpbuf = abs_time_to_str(NULL, (const nstime_t *)fvalue_get(&finfo->value), (absolute_time_display_e)hfinfo->display, TRUE);
+ offset_r += protoo_strlcpy(result+offset_r,
tmpbuf,
size-offset_r);
- wmem_free(NULL, tmpbuf);
- break;
+ wmem_free(NULL, tmpbuf);
+ break;
- case FT_RELATIVE_TIME:
- tmpbuf = rel_time_to_secs_str(NULL, (const nstime_t *)fvalue_get(&finfo->value));
- offset_r += protoo_strlcpy(result+offset_r,
+ case FT_RELATIVE_TIME:
+ tmpbuf = rel_time_to_secs_str(NULL, (const nstime_t *)fvalue_get(&finfo->value));
+ offset_r += protoo_strlcpy(result+offset_r,
tmpbuf,
size-offset_r);
- wmem_free(NULL, tmpbuf);
- break;
+ wmem_free(NULL, tmpbuf);
+ break;
- case FT_BOOLEAN:
- number = fvalue_get_uinteger(&finfo->value);
- tfstring = (const true_false_string *)&tfs_true_false;
- if (hfinfo->strings) {
- tfstring = (const struct true_false_string*) hfinfo->strings;
- }
- offset_r += protoo_strlcpy(result+offset_r,
+ case FT_BOOLEAN:
+ number = fvalue_get_uinteger(&finfo->value);
+ tfstring = (const true_false_string *)&tfs_true_false;
+ if (hfinfo->strings) {
+ tfstring = (const struct true_false_string*) hfinfo->strings;
+ }
+ offset_r += protoo_strlcpy(result+offset_r,
number ?
- tfstring->true_string :
- tfstring->false_string, size-offset_r);
+ tfstring->true_string :
+ tfstring->false_string, size-offset_r);
- offset_e += protoo_strlcpy(expr+offset_e,
+ offset_e += protoo_strlcpy(expr+offset_e,
number ? "1" : "0", size-offset_e);
- break;
+ break;
- /* XXX - make these just FT_NUMBER? */
- case FT_INT8:
- case FT_INT16:
- case FT_INT24:
- case FT_INT32:
- case FT_UINT8:
- case FT_UINT16:
- case FT_UINT24:
- case FT_UINT32:
- case FT_FRAMENUM:
- hf_str_val = NULL;
- number = IS_FT_INT(hfinfo->type) ?
+ /* XXX - make these just FT_NUMBER? */
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ case FT_FRAMENUM:
+ hf_str_val = NULL;
+ number = IS_FT_INT(hfinfo->type) ?
(guint32) fvalue_get_sinteger(&finfo->value) :
fvalue_get_uinteger(&finfo->value);
- if ((hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_CUSTOM) {
- gchar tmp[ITEM_LABEL_LENGTH];
- custom_fmt_func_t fmtfunc = (custom_fmt_func_t)hfinfo->strings;
+ if ((hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_CUSTOM) {
+ gchar tmp[ITEM_LABEL_LENGTH];
+ custom_fmt_func_t fmtfunc = (custom_fmt_func_t)hfinfo->strings;
- DISSECTOR_ASSERT(fmtfunc);
- fmtfunc(tmp, number);
+ DISSECTOR_ASSERT(fmtfunc);
+ fmtfunc(tmp, number);
- offset_r += protoo_strlcpy(result+offset_r, tmp, size-offset_r);
+ offset_r += protoo_strlcpy(result+offset_r, tmp, size-offset_r);
- } else if (hfinfo->strings) {
- number_out = hf_str_val = hf_try_val_to_str(number, hfinfo);
+ } else if (hfinfo->strings) {
+ number_out = hf_str_val = hf_try_val_to_str(number, hfinfo);
- if (!number_out)
- number_out = hfinfo_number_value_format_display(hfinfo, BASE_DEC, number_buf, number);
+ if (!number_out)
+ number_out = hfinfo_number_value_format_display(hfinfo, BASE_DEC, number_buf, number);
- offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
+ offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
- } else {
- number_out = hfinfo_number_value_format(hfinfo, number_buf, number);
+ } else {
+ number_out = hfinfo_number_value_format(hfinfo, number_buf, number);
- offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
- }
+ offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
+ }
- if (hf_str_val && (hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_NONE) {
- g_snprintf(expr+offset_e, size-offset_e, "\"%s\"", hf_str_val);
- } else {
- number_out = hfinfo_numeric_value_format(hfinfo, number_buf, number);
+ if (hf_str_val && (hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_NONE) {
+ g_snprintf(expr+offset_e, size-offset_e, "\"%s\"", hf_str_val);
+ } else {
+ number_out = hfinfo_numeric_value_format(hfinfo, number_buf, number);
- g_strlcpy(expr+offset_e, number_out, size-offset_e);
- }
+ g_strlcpy(expr+offset_e, number_out, size-offset_e);
+ }
- offset_e = (int)strlen(expr);
- break;
+ offset_e = (int)strlen(expr);
+ break;
- case FT_INT64:
- /* XXX: Should handle BASE_CUSTOM ? */
- g_snprintf(result+offset_r, size-offset_r,
- "%" G_GINT64_MODIFIER "d",
- fvalue_get_integer64(&finfo->value));
- offset_r = (int)strlen(result);
- break;
- case FT_UINT64:
- g_snprintf(result+offset_r, size-offset_r,
- /* XXX: Should handle BASE_CUSTOM ? */
- "%" G_GINT64_MODIFIER "u",
- fvalue_get_integer64(&finfo->value));
- offset_r = (int)strlen(result);
- break;
- case FT_EUI64:
- str = eui64_to_str(NULL, fvalue_get_integer64(&finfo->value));
- offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
- wmem_free(NULL, str);
- break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
+ case FT_INT64:
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
+ case FT_UINT64:
+ hf_str_val = NULL;
+ number64 = IS_FT_INT(hfinfo->type) ?
+ (guint64) fvalue_get_sinteger64(&finfo->value) :
+ fvalue_get_uinteger64(&finfo->value);
+
+ if ((hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_CUSTOM) {
+ gchar tmp[ITEM_LABEL_LENGTH];
+ custom_fmt_func_64_t fmtfunc64 = (custom_fmt_func_64_t)hfinfo->strings;
+
+ DISSECTOR_ASSERT(fmtfunc64);
+ fmtfunc64(tmp, number64);
+ offset_r += protoo_strlcpy(result+offset_r, tmp, size-offset_r);
+ } else if (hfinfo->strings) {
+ number_out = hf_str_val = hf_try_val64_to_str(number64, hfinfo);
+
+ if (!number_out)
+ number_out = hfinfo_number_value_format_display64(hfinfo, BASE_DEC, number_buf, number64);
+
+ offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
+
+ } else {
+ number_out = hfinfo_number_value_format64(hfinfo, number_buf, number64);
+
+ offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
+ }
- case FT_IPv4:
- ipv4 = (ipv4_addr *)fvalue_get(&finfo->value);
- n_addr = ipv4_get_net_order_addr(ipv4);
- SET_ADDRESS (&addr, AT_IPv4, 4, &n_addr);
- address_to_str_buf(&addr, result+offset_r, size-offset_r);
- offset_r = (int)strlen(result);
- break;
+ if (hf_str_val && (hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_NONE) {
+ g_snprintf(expr+offset_e, size-offset_e, "\"%s\"", hf_str_val);
+ } else {
+ number_out = hfinfo_numeric_value_format64(hfinfo, number_buf, number64);
- case FT_IPv6:
- ipv6 = (struct e_in6_addr *)fvalue_get(&finfo->value);
- SET_ADDRESS (&addr, AT_IPv6, sizeof(struct e_in6_addr), ipv6);
- address_to_str_buf(&addr, result+offset_r, size-offset_r);
- offset_r = (int)strlen(result);
- break;
+ g_strlcpy(expr+offset_e, number_out, size-offset_e);
+ }
- case FT_FCWWN:
- SET_ADDRESS (&addr, AT_FCWWN, FCWWN_ADDR_LEN, fvalue_get(&finfo->value));
- address_to_str_buf(&addr, result+offset_r, size-offset_r);
- offset_r = (int)strlen(result);
- break;
+ offset_e = (int)strlen(expr);
+ break;
- case FT_ETHER:
- SET_ADDRESS (&addr, AT_ETHER, FT_ETHER_LEN, fvalue_get(&finfo->value));
- address_to_str_buf(&addr, result+offset_r, size-offset_r);
- offset_r = (int)strlen(result);
- break;
+ case FT_EUI64:
+ str = eui64_to_str(NULL, fvalue_get_uinteger64(&finfo->value));
+ offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
+ wmem_free(NULL, str);
+ break;
- case FT_GUID:
- str = guid_to_str(NULL, (e_guid_t *)fvalue_get(&finfo->value));
- offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
- wmem_free(NULL, str);
- break;
+ case FT_IPv4:
+ ipv4 = (ipv4_addr *)fvalue_get(&finfo->value);
+ n_addr = ipv4_get_net_order_addr(ipv4);
+ SET_ADDRESS (&addr, AT_IPv4, 4, &n_addr);
+ address_to_str_buf(&addr, result+offset_r, size-offset_r);
+ offset_r = (int)strlen(result);
+ break;
- case FT_REL_OID:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- str = rel_oid_resolved_from_encoded(NULL, bytes, fvalue_length(&finfo->value));
- offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
- wmem_free(NULL, str);
-
- str = rel_oid_encoded2string(NULL, bytes, fvalue_length(&finfo->value));
- offset_e += protoo_strlcpy(expr+offset_e, str, size-offset_e);
- wmem_free(NULL, str);
- break;
+ case FT_IPv6:
+ ipv6 = (struct e_in6_addr *)fvalue_get(&finfo->value);
+ SET_ADDRESS (&addr, AT_IPv6, sizeof(struct e_in6_addr), ipv6);
+ address_to_str_buf(&addr, result+offset_r, size-offset_r);
+ offset_r = (int)strlen(result);
+ break;
- case FT_OID:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- str = oid_resolved_from_encoded(NULL, bytes, fvalue_length(&finfo->value));
- offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
- wmem_free(NULL, str);
-
- str = oid_encoded2string(NULL, bytes, fvalue_length(&finfo->value));
- offset_e += protoo_strlcpy(expr+offset_e, str, size-offset_e);
- wmem_free(NULL, str);
- break;
+ case FT_FCWWN:
+ SET_ADDRESS (&addr, AT_FCWWN, FCWWN_ADDR_LEN, fvalue_get(&finfo->value));
+ address_to_str_buf(&addr, result+offset_r, size-offset_r);
+ offset_r = (int)strlen(result);
+ break;
- case FT_SYSTEM_ID:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- str = print_system_id(NULL, bytes, fvalue_length(&finfo->value));
- offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
- offset_e += protoo_strlcpy(expr+offset_e, str, size-offset_e);
- wmem_free(NULL, str);
- break;
+ case FT_ETHER:
+ SET_ADDRESS (&addr, AT_ETHER, FT_ETHER_LEN, fvalue_get(&finfo->value));
+ address_to_str_buf(&addr, result+offset_r, size-offset_r);
+ offset_r = (int)strlen(result);
+ break;
- case FT_FLOAT:
- g_snprintf(result+offset_r, size-offset_r,
- "%." G_STRINGIFY(FLT_DIG) "g", fvalue_get_floating(&finfo->value));
- offset_r = (int)strlen(result);
- break;
+ case FT_GUID:
+ str = guid_to_str(NULL, (e_guid_t *)fvalue_get(&finfo->value));
+ offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
+ wmem_free(NULL, str);
+ break;
- case FT_DOUBLE:
- g_snprintf(result+offset_r, size-offset_r,
- "%." G_STRINGIFY(DBL_DIG) "g", fvalue_get_floating(&finfo->value));
- offset_r = (int)strlen(result);
- break;
+ case FT_REL_OID:
+ bytes = (guint8 *)fvalue_get(&finfo->value);
+ str = rel_oid_resolved_from_encoded(NULL, bytes, fvalue_length(&finfo->value));
+ offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
+ wmem_free(NULL, str);
+
+ str = rel_oid_encoded2string(NULL, bytes, fvalue_length(&finfo->value));
+ offset_e += protoo_strlcpy(expr+offset_e, str, size-offset_e);
+ wmem_free(NULL, str);
+ break;
+
+ case FT_OID:
+ bytes = (guint8 *)fvalue_get(&finfo->value);
+ str = oid_resolved_from_encoded(NULL, bytes, fvalue_length(&finfo->value));
+ offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
+ wmem_free(NULL, str);
+
+ str = oid_encoded2string(NULL, bytes, fvalue_length(&finfo->value));
+ offset_e += protoo_strlcpy(expr+offset_e, str, size-offset_e);
+ wmem_free(NULL, str);
+ break;
+
+ case FT_SYSTEM_ID:
+ bytes = (guint8 *)fvalue_get(&finfo->value);
+ str = print_system_id(NULL, bytes, fvalue_length(&finfo->value));
+ offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r);
+ offset_e += protoo_strlcpy(expr+offset_e, str, size-offset_e);
+ wmem_free(NULL, str);
+ break;
+
+ case FT_FLOAT:
+ g_snprintf(result+offset_r, size-offset_r,
+ "%." G_STRINGIFY(FLT_DIG) "g", fvalue_get_floating(&finfo->value));
+ offset_r = (int)strlen(result);
+ break;
- case FT_STRING:
- case FT_STRINGZ:
- case FT_UINT_STRING:
- case FT_STRINGZPAD:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- offset_r += protoo_strlcpy(result+offset_r,
+ case FT_DOUBLE:
+ g_snprintf(result+offset_r, size-offset_r,
+ "%." G_STRINGIFY(DBL_DIG) "g", fvalue_get_floating(&finfo->value));
+ offset_r = (int)strlen(result);
+ break;
+
+ case FT_STRING:
+ case FT_STRINGZ:
+ case FT_UINT_STRING:
+ case FT_STRINGZPAD:
+ bytes = (guint8 *)fvalue_get(&finfo->value);
+ offset_r += protoo_strlcpy(result+offset_r,
hfinfo_format_text(hfinfo, bytes),
size-offset_r);
- break;
+ break;
- case FT_IPXNET: /*XXX really No column custom ?*/
- case FT_PCRE:
- default:
- g_error("hfinfo->type %d (%s) not handled\n",
- hfinfo->type,
- ftype_name(hfinfo->type));
- DISSECTOR_ASSERT_NOT_REACHED();
- break;
+ case FT_IPXNET: /*XXX really No column custom ?*/
+ case FT_PCRE:
+ default:
+ g_error("hfinfo->type %d (%s) not handled\n",
+ hfinfo->type,
+ ftype_name(hfinfo->type));
+ DISSECTOR_ASSERT_NOT_REACHED();
+ break;
}
i++;
}
switch (hfinfo->type) {
- case FT_BOOLEAN:
- case FT_UINT8:
- case FT_UINT16:
- case FT_UINT24:
- case FT_UINT32:
- case FT_FRAMENUM:
- case FT_INT8:
- case FT_INT16:
- case FT_INT24:
- case FT_INT32:
- case FT_OID:
- case FT_REL_OID:
- case FT_SYSTEM_ID:
- /* for these types, "expr" is filled in the loop above */
- break;
+ case FT_BOOLEAN:
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
+ case FT_UINT64:
+ case FT_FRAMENUM:
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
+ case FT_INT64:
+ case FT_OID:
+ case FT_REL_OID:
+ case FT_SYSTEM_ID:
+ /* for these types, "expr" is filled in the loop above */
+ break;
- default:
- /* for all others, just copy "result" to "expr" */
- g_strlcpy(expr, result, size);
- break;
+ default:
+ /* for all others, just copy "result" to "expr" */
+ g_strlcpy(expr, result, size);
+ break;
}
if (!abbrev) {
@@ -5528,11 +5626,17 @@ tmp_fld_check_assert(header_field_info *hfinfo)
(hfinfo->type == FT_UINT16) ||
(hfinfo->type == FT_UINT24) ||
(hfinfo->type == FT_UINT32) ||
+ (hfinfo->type == FT_UINT40) ||
+ (hfinfo->type == FT_UINT48) ||
+ (hfinfo->type == FT_UINT56) ||
(hfinfo->type == FT_UINT64) ||
(hfinfo->type == FT_INT8) ||
(hfinfo->type == FT_INT16) ||
(hfinfo->type == FT_INT24) ||
(hfinfo->type == FT_INT32) ||
+ (hfinfo->type == FT_INT40) ||
+ (hfinfo->type == FT_INT48) ||
+ (hfinfo->type == FT_INT56) ||
(hfinfo->type == FT_INT64) ||
(hfinfo->type == FT_BOOLEAN) ||
(hfinfo->type == FT_PROTOCOL) ))
@@ -5600,6 +5704,9 @@ tmp_fld_check_assert(header_field_info *hfinfo)
case FT_INT16:
case FT_INT24:
case FT_INT32:
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
/* Hexadecimal and octal are, in printf() and everywhere
* else, unsigned so don't allow dissectors to register a
@@ -5622,6 +5729,9 @@ tmp_fld_check_assert(header_field_info *hfinfo)
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
/* Require integral types (other than frame number,
* which is always displayed in decimal) to have a
@@ -6110,8 +6220,15 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
fill_label_number(fi, label_str, FALSE);
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
- fill_label_number64(fi, label_str, FALSE);
+ if (hfinfo->bitmask) {
+ fill_label_bitfield64(fi, label_str, FALSE);
+ } else {
+ fill_label_number64(fi, label_str, FALSE);
+ }
break;
case FT_INT8:
@@ -6125,8 +6242,15 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
}
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
- fill_label_number64(fi, label_str, TRUE);
+ if (hfinfo->bitmask) {
+ fill_label_bitfield64(fi, label_str, TRUE);
+ } else {
+ fill_label_number64(fi, label_str, TRUE);
+ }
break;
case FT_FLOAT:
@@ -6277,7 +6401,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
break;
case FT_EUI64:
- integer64 = fvalue_get_integer64(&fi->value);
+ integer64 = fvalue_get_uinteger64(&fi->value);
addr_str = eui64_to_str(NULL, integer64);
tmp = (char*)eui64_to_display(NULL, integer64);
label_fill_descr(label_str, 0, hfinfo, tmp, addr_str);
@@ -6315,7 +6439,7 @@ fill_label_boolean(field_info *fi, gchar *label_str)
tfstring = (const struct true_false_string*) hfinfo->strings;
}
- value = fvalue_get_integer64(&fi->value);
+ value = fvalue_get_uinteger64(&fi->value);
if (hfinfo->bitmask) {
/* Figure out the bit width */
bitwidth = hfinfo_bitwidth(hfinfo);
@@ -6438,6 +6562,62 @@ fill_label_bitfield(field_info *fi, gchar *label_str, gboolean is_signed)
}
static void
+fill_label_bitfield64(field_info *fi, gchar *label_str, gboolean is_signed)
+{
+ char *p;
+ int bitfield_byte_length, bitwidth;
+ guint64 unshifted_value;
+ guint64 value;
+
+ char buf[32];
+ const char *out;
+
+ header_field_info *hfinfo = fi->hfinfo;
+
+ /* Figure out the bit width */
+ bitwidth = hfinfo_bitwidth(hfinfo);
+
+ /* Un-shift bits */
+ if (is_signed)
+ unshifted_value = fvalue_get_sinteger64(&fi->value);
+ else
+ unshifted_value = fvalue_get_uinteger64(&fi->value);
+
+ value = unshifted_value;
+ if (hfinfo->bitmask) {
+ unshifted_value <<= hfinfo_bitshift(hfinfo); /* XXX 64-bit function needed? */
+ }
+
+ /* Create the bitfield first */
+ p = decode_bitfield_value(label_str, unshifted_value, hfinfo->bitmask, bitwidth);
+ bitfield_byte_length = (int) (p - label_str);
+
+ /* Fill in the textual info using stored (shifted) value */
+ if (hfinfo->display == BASE_CUSTOM) {
+ gchar tmp[ITEM_LABEL_LENGTH];
+ const custom_fmt_func_64_t fmtfunc64 = (const custom_fmt_func_64_t)hfinfo->strings;
+
+ DISSECTOR_ASSERT(fmtfunc64);
+ fmtfunc64(tmp, value);
+ label_fill(label_str, bitfield_byte_length, hfinfo, tmp);
+ }
+ else if (hfinfo->strings) {
+ const char *val_str = hf_try_val64_to_str_const(value, hfinfo, "Unknown");
+
+ out = hfinfo_number_vals_format64(hfinfo, buf, value);
+ if (out == NULL) /* BASE_NONE so don't put integer in descr */
+ label_fill(label_str, bitfield_byte_length, hfinfo, val_str);
+ else
+ label_fill_descr(label_str, bitfield_byte_length, hfinfo, val_str, out);
+ }
+ else {
+ out = hfinfo_number_value_format64(hfinfo, buf, value);
+
+ label_fill(label_str, bitfield_byte_length, hfinfo, out);
+ }
+}
+
+static void
fill_label_number(field_info *fi, gchar *label_str, gboolean is_signed)
{
header_field_info *hfinfo = fi->hfinfo;
@@ -6490,7 +6670,7 @@ fill_label_number64(field_info *fi, gchar *label_str, gboolean is_signed)
else
format = hfinfo_uint64_format(hfinfo);
- value = fvalue_get_integer64(&fi->value);
+ value = fvalue_get_uinteger64(&fi->value);
/* Format the temporary string */
if (IS_BASE_DUAL(hfinfo->display))
@@ -6545,6 +6725,22 @@ hfinfo_bitwidth(const header_field_info *hfinfo)
case FT_INT32:
bitwidth = 32;
break;
+ case FT_UINT40:
+ case FT_INT40:
+ bitwidth = 40;
+ break;
+ case FT_UINT48:
+ case FT_INT48:
+ bitwidth = 48;
+ break;
+ case FT_UINT56:
+ case FT_INT56:
+ bitwidth = 56;
+ break;
+ case FT_UINT64:
+ case FT_INT64:
+ bitwidth = 64;
+ break;
case FT_BOOLEAN:
bitwidth = hfinfo->display; /* hacky? :) */
break;
@@ -6575,6 +6771,22 @@ _hfinfo_type_hex_octet(int type)
case FT_INT32:
return 8;
+ case FT_UINT40:
+ case FT_INT40:
+ return 10;
+
+ case FT_UINT48:
+ case FT_INT48:
+ return 12;
+
+ case FT_UINT56:
+ case FT_INT56:
+ return 14;
+
+ case FT_UINT64:
+ case FT_INT64:
+ return 16;
+
default:
DISSECTOR_ASSERT_NOT_REACHED();
;
@@ -6624,6 +6836,47 @@ hfinfo_number_value_format_display(const header_field_info *hfinfo, int display,
}
static const char *
+hfinfo_number_value_format_display64(const header_field_info *hfinfo, int display, char buf[32], guint64 value)
+{
+ char *ptr = &buf[31];
+ gboolean isint = IS_FT_INT(hfinfo->type);
+
+ *ptr = '\0';
+ /* Properly format value */
+ switch (display) {
+ case BASE_DEC:
+ return isint ? int64_to_str_back(ptr, (gint64) value) : uint64_to_str_back(ptr, value);
+
+ case BASE_DEC_HEX:
+ *(--ptr) = ')';
+ ptr = hex64_to_str_back(ptr, _hfinfo_type_hex_octet(hfinfo->type), value);
+ *(--ptr) = '(';
+ *(--ptr) = ' ';
+ ptr = isint ? int64_to_str_back(ptr, (gint64) value) : uint64_to_str_back(ptr, value);
+ return ptr;
+
+ case BASE_OCT:
+ return oct64_to_str_back(ptr, value);
+
+ case BASE_HEX:
+ return hex64_to_str_back(ptr, _hfinfo_type_hex_octet(hfinfo->type), value);
+
+ case BASE_HEX_DEC:
+ *(--ptr) = ')';
+ ptr = isint ? int64_to_str_back(ptr, (gint64) value) : uint64_to_str_back(ptr, value);
+ *(--ptr) = '(';
+ *(--ptr) = ' ';
+ ptr = hex64_to_str_back(ptr, _hfinfo_type_hex_octet(hfinfo->type), value);
+ return ptr;
+
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ ;
+ }
+ return ptr;
+}
+
+static const char *
hfinfo_number_value_format(const header_field_info *hfinfo, char buf[32], guint32 value)
{
int display = hfinfo->display;
@@ -6639,6 +6892,21 @@ hfinfo_number_value_format(const header_field_info *hfinfo, char buf[32], guint3
}
static const char *
+hfinfo_number_value_format64(const header_field_info *hfinfo, char buf[32], guint64 value)
+{
+ int display = hfinfo->display;
+
+ if (hfinfo->type == FT_FRAMENUM) {
+ /*
+ * Frame numbers are always displayed in decimal.
+ */
+ display = BASE_DEC;
+ }
+
+ return hfinfo_number_value_format_display64(hfinfo, display, buf, value);
+}
+
+static const char *
hfinfo_numeric_value_format(const header_field_info *hfinfo, char buf[32], guint32 value)
{
/* Get the underlying BASE_ value */
@@ -6670,6 +6938,37 @@ hfinfo_numeric_value_format(const header_field_info *hfinfo, char buf[32], guint
}
static const char *
+hfinfo_numeric_value_format64(const header_field_info *hfinfo, char buf[32], guint64 value)
+{
+ /* Get the underlying BASE_ value */
+ int display = hfinfo->display & FIELD_DISPLAY_E_MASK;
+
+ if (hfinfo->type == FT_FRAMENUM) {
+ /*
+ * Frame numbers are always displayed in decimal.
+ */
+ display = BASE_DEC;
+ }
+
+ switch (display) {
+ case BASE_NONE:
+ /* case BASE_DEC: */
+ case BASE_DEC_HEX:
+ case BASE_OCT: /* XXX, why we're changing BASE_OCT to BASE_DEC? */
+ case BASE_CUSTOM:
+ display = BASE_DEC;
+ break;
+
+ /* case BASE_HEX: */
+ case BASE_HEX_DEC:
+ display = BASE_HEX;
+ break;
+ }
+
+ return hfinfo_number_value_format_display64(hfinfo, display, buf, value);
+}
+
+static const char *
hfinfo_number_vals_format(const header_field_info *hfinfo, char buf[32], guint32 value)
{
/* Get the underlying BASE_ value */
@@ -6687,6 +6986,23 @@ hfinfo_number_vals_format(const header_field_info *hfinfo, char buf[32], guint32
}
static const char *
+hfinfo_number_vals_format64(const header_field_info *hfinfo, char buf[32], guint64 value)
+{
+ /* Get the underlying BASE_ value */
+ int display = hfinfo->display & FIELD_DISPLAY_E_MASK;
+
+ if (display == BASE_NONE)
+ return NULL;
+
+ if (display == BASE_DEC_HEX)
+ display = BASE_DEC;
+ if (display == BASE_HEX_DEC)
+ display = BASE_HEX;
+
+ return hfinfo_number_value_format_display64(hfinfo, display, buf, value);
+}
+
+static const char *
hfinfo_uint64_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -7116,11 +7432,17 @@ proto_registrar_dump_values(void)
hfinfo->type == FT_UINT16 ||
hfinfo->type == FT_UINT24 ||
hfinfo->type == FT_UINT32 ||
+ hfinfo->type == FT_UINT40 ||
+ hfinfo->type == FT_UINT48 ||
+ hfinfo->type == FT_UINT56 ||
hfinfo->type == FT_UINT64 ||
hfinfo->type == FT_INT8 ||
hfinfo->type == FT_INT16 ||
hfinfo->type == FT_INT24 ||
hfinfo->type == FT_INT32 ||
+ hfinfo->type == FT_INT40 ||
+ hfinfo->type == FT_INT48 ||
+ hfinfo->type == FT_INT56 ||
hfinfo->type == FT_INT64)) {
if (hfinfo->display & BASE_RANGE_STRING) {
@@ -7291,11 +7613,17 @@ proto_registrar_dump_fields(void)
hfinfo->type == FT_UINT16 ||
hfinfo->type == FT_UINT24 ||
hfinfo->type == FT_UINT32 ||
+ hfinfo->type == FT_UINT40 ||
+ hfinfo->type == FT_UINT48 ||
+ hfinfo->type == FT_UINT56 ||
hfinfo->type == FT_UINT64 ||
hfinfo->type == FT_INT8 ||
hfinfo->type == FT_INT16 ||
hfinfo->type == FT_INT24 ||
hfinfo->type == FT_INT32 ||
+ hfinfo->type == FT_INT40 ||
+ hfinfo->type == FT_INT48 ||
+ hfinfo->type == FT_INT56 ||
hfinfo->type == FT_INT64) {
switch (hfinfo->display & FIELD_DISPLAY_E_MASK) {
@@ -7363,48 +7691,6 @@ proto_registrar_dump_ftypes(void)
}
}
-static const char *
-hfinfo_numeric_format(const header_field_info *hfinfo)
-{
- const char *format = NULL;
-
- /* Get the underlying BASE_ value */
- switch (hfinfo->display & FIELD_DISPLAY_E_MASK) {
- case BASE_DEC:
- case BASE_DEC_HEX:
- case BASE_OCT: /* I'm lazy */
- case BASE_CUSTOM:
- switch (hfinfo->type) {
- case FT_UINT64:
- format = "%s == %" G_GINT64_MODIFIER "u";
- break;
- case FT_INT64:
- format = "%s == %" G_GINT64_MODIFIER "d";
- break;
- default:
- DISSECTOR_ASSERT_NOT_REACHED();
- ;
- }
- break;
- case BASE_HEX:
- case BASE_HEX_DEC:
- switch (hfinfo->type) {
- case FT_UINT64:
- case FT_INT64:
- format = "%s == 0x%016" G_GINT64_MODIFIER "x";
- break;
- default:
- DISSECTOR_ASSERT_NOT_REACHED();
- ;
- }
- break;
- default:
- DISSECTOR_ASSERT_NOT_REACHED();
- ;
- }
- return format;
-}
-
/* This function indicates whether it's possible to construct a
* "match selected" display filter string for the specified field,
* returns an indication of whether it's possible, and, if it's
@@ -7512,14 +7798,30 @@ construct_match_selected_string(field_info *finfo, epan_dissect_t *edt,
}
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
+ is_signed_num = TRUE;
+ /* FALLTHRU */
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
if (filter != NULL) {
- const char *format = hfinfo_numeric_format(hfinfo);
+ guint64 number;
+
+ char buf [64];
+ const char *out;
+
+ if (is_signed_num)
+ number = fvalue_get_sinteger64(&finfo->value);
+ else
+ number = fvalue_get_uinteger64(&finfo->value);
+
+ out = hfinfo_numeric_value_format64(hfinfo, buf, number);
- *filter = wmem_strdup_printf(NULL, format,
- hfinfo->abbrev,
- fvalue_get_integer64(&finfo->value));
+ *filter = wmem_strdup_printf(NULL, "%s == %s", hfinfo->abbrev, out);
}
break;
@@ -7704,6 +8006,21 @@ proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset,
tvb_get_ntohl(tvb, offset);
available_bits = 0xFFFFFFFF;
break;
+ case 5:
+ value = encoding ? tvb_get_letoh40(tvb, offset) :
+ tvb_get_ntoh40(tvb, offset);
+ available_bits = G_GUINT64_CONSTANT(0xFFFFFFFFFF);
+ break;
+ case 6:
+ value = encoding ? tvb_get_letoh48(tvb, offset) :
+ tvb_get_ntoh48(tvb, offset);
+ available_bits = G_GUINT64_CONSTANT(0xFFFFFFFFFFFF);
+ break;
+ case 7:
+ value = encoding ? tvb_get_letoh56(tvb, offset) :
+ tvb_get_ntoh56(tvb, offset);
+ available_bits = G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFF);
+ break;
case 8:
value = encoding ? tvb_get_letoh64(tvb, offset) :
tvb_get_ntoh64(tvb, offset);
@@ -7742,6 +8059,14 @@ proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset,
case FT_UINT24:
case FT_INT32:
case FT_UINT32:
+ case FT_INT40:
+ case FT_UINT40:
+ case FT_INT48:
+ case FT_UINT48:
+ case FT_INT56:
+ case FT_UINT56:
+ case FT_INT64:
+ case FT_UINT64:
if (hf->display == BASE_CUSTOM) {
gchar lbl[ITEM_LABEL_LENGTH];
const custom_fmt_func_t fmtfunc = (const custom_fmt_func_t)hf->strings;
@@ -8029,6 +8354,9 @@ _proto_tree_add_bits_ret_val(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
case FT_INT16:
case FT_INT24:
case FT_INT32:
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
value = ws_sign_ext64(value, no_of_bits);
break;
@@ -8074,11 +8402,17 @@ _proto_tree_add_bits_ret_val(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
fill_label_number(PITEM_FINFO(pi), lbl_str, TRUE);
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
pi = proto_tree_add_uint64(tree, hfindex, tvb, offset, length, value);
fill_label_number64(PITEM_FINFO(pi), lbl_str, FALSE);
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
pi = proto_tree_add_int64(tree, hfindex, tvb, offset, length, (gint64)value);
fill_label_number64(PITEM_FINFO(pi), lbl_str, TRUE);
@@ -8173,6 +8507,9 @@ proto_tree_add_split_bits_item_ret_val(proto_tree *tree, const int hfindex, tvbu
case FT_INT16:
case FT_INT24:
case FT_INT32:
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
value = ws_sign_ext64(value, no_of_bits);
break;
@@ -8234,11 +8571,17 @@ proto_tree_add_split_bits_item_ret_val(proto_tree *tree, const int hfindex, tvbu
fill_label_number(PITEM_FINFO(pi), lbl_str, TRUE);
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
pi = proto_tree_add_uint64(tree, hfindex, tvb, octet_offset, octet_length, value);
fill_label_number64(PITEM_FINFO(pi), lbl_str, FALSE);
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
pi = proto_tree_add_int64(tree, hfindex, tvb, octet_offset, octet_length, (gint64)value);
fill_label_number64(PITEM_FINFO(pi), lbl_str, TRUE);
@@ -8359,6 +8702,9 @@ _proto_tree_add_bits_format_value(proto_tree *tree, const int hfindex,
"%s: %s", str, value_str);
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
return proto_tree_add_uint64_format(tree, hfindex, tvb, offset, length, *(guint64 *)value_ptr,
"%s: %s", str, value_str);
@@ -8372,6 +8718,9 @@ _proto_tree_add_bits_format_value(proto_tree *tree, const int hfindex,
"%s: %s", str, value_str);
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
return proto_tree_add_int64_format(tree, hfindex, tvb, offset, length, *(gint64 *)value_ptr,
"%s: %s", str, value_str);
@@ -8442,6 +8791,36 @@ proto_tree_add_uint_bits_format_value(proto_tree *tree, const int hfindex,
}
proto_item *
+proto_tree_add_uint64_bits_format_value(proto_tree *tree, const int hfindex,
+ tvbuff_t *tvb, const guint bit_offset,
+ const gint no_of_bits, guint64 value,
+ const char *format, ...)
+{
+ va_list ap;
+ gchar *dst;
+ header_field_info *hf_field;
+
+ TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hf_field);
+
+ switch (hf_field->type) {
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
+ case FT_UINT64:
+ break;
+
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ return NULL;
+ break;
+ }
+
+ CREATE_VALUE_STRING(dst, format, ap);
+
+ return proto_tree_add_bits_format_value(tree, hfindex, tvb, bit_offset, no_of_bits, &value, dst);
+}
+
+proto_item *
proto_tree_add_float_bits_format_value(proto_tree *tree, const int hfindex,
tvbuff_t *tvb, const guint bit_offset,
const gint no_of_bits, float value,
@@ -8491,6 +8870,36 @@ proto_tree_add_int_bits_format_value(proto_tree *tree, const int hfindex,
}
proto_item *
+proto_tree_add_int64_bits_format_value(proto_tree *tree, const int hfindex,
+ tvbuff_t *tvb, const guint bit_offset,
+ const gint no_of_bits, gint64 value,
+ const char *format, ...)
+{
+ va_list ap;
+ gchar *dst;
+ header_field_info *hf_field;
+
+ TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hf_field);
+
+ switch (hf_field->type) {
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
+ case FT_INT64:
+ break;
+
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ return NULL;
+ break;
+ }
+
+ CREATE_VALUE_STRING(dst, format, ap);
+
+ return proto_tree_add_bits_format_value(tree, hfindex, tvb, bit_offset, no_of_bits, &value, dst);
+}
+
+proto_item *
proto_tree_add_boolean_bits_format_value(proto_tree *tree, const int hfindex,
tvbuff_t *tvb, const guint bit_offset,
const gint no_of_bits, guint32 value,
@@ -8510,6 +8919,25 @@ proto_tree_add_boolean_bits_format_value(proto_tree *tree, const int hfindex,
}
proto_item *
+proto_tree_add_boolean_bits_format_value64(proto_tree *tree, const int hfindex,
+ tvbuff_t *tvb, const guint bit_offset,
+ const gint no_of_bits, guint64 value,
+ const char *format, ...)
+{
+ va_list ap;
+ gchar *dst;
+ header_field_info *hf_field;
+
+ TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hf_field);
+
+ DISSECTOR_ASSERT(hf_field->type == FT_BOOLEAN);
+
+ CREATE_VALUE_STRING(dst, format, ap);
+
+ return proto_tree_add_bits_format_value(tree, hfindex, tvb, bit_offset, no_of_bits, &value, dst);
+}
+
+proto_item *
proto_tree_add_ts_23_038_7bits_item(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
const guint bit_offset, const gint no_of_chars)
{
diff --git a/epan/proto.h b/epan/proto.h
index 62514708c3..5f47b53fb0 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -82,6 +82,9 @@ struct expert_field;
#define TFS(x) (const struct true_false_string*)(x)
typedef void (*custom_fmt_func_t)(gchar *, guint32);
+
+typedef void (*custom_fmt_func_64_t)(gchar *, guint64);
+
/** Make a custom format function pointer look like a void pointer. Used to set header_field_info.strings.
*
* We cast to gsize first, which 1) is guaranteed to be wide enough to
diff --git a/epan/to_str-int.h b/epan/to_str-int.h
index 675c090c72..29dc88f65c 100644
--- a/epan/to_str-int.h
+++ b/epan/to_str-int.h
@@ -37,6 +37,18 @@
char *word_to_hex(char *out, guint16 word);
/**
+ * word_to_hex_punct()
+ *
+ * Output guint16 hex represetation to 'out', and return pointer after last character.
+ * Each byte will be separated with punct character (cannot be NUL).
+ * It always output full representation (padded with 0).
+ *
+ * String is not NUL terminated by this routine.
+ * There needs to be at least 5 bytes in the buffer.
+ */
+char *word_to_hex_punct(char *out, guint16 word, char punct);
+
+/**
* word_to_hex_npad()
*
* Output guint16 hex represetation to 'out', and return pointer after last character.
@@ -48,10 +60,21 @@ char *word_to_hex(char *out, guint16 word);
char *word_to_hex_npad(char *out, guint16 word);
/**
+ * dword_to_hex()
+ *
+ * Output guint32 hex represetation to 'out', and return pointer after last character.
+ * It always output full representation (padded with 0).
+ *
+ * String is not NUL terminated by this routine.
+ * There needs to be at least 8 bytes in the buffer.
+ */
+char *dword_to_hex(char *out, guint32 dword);
+
+/**
* dword_to_hex_punct()
*
* Output guint32 hex represetation to 'out', and return pointer after last character.
- * Each byte will be seperated with punct character (cannot be NUL).
+ * Each byte will be separated with punct character (cannot be NUL).
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
@@ -60,15 +83,27 @@ char *word_to_hex_npad(char *out, guint16 word);
char *dword_to_hex_punct(char *out, guint32 dword, char punct);
/**
- * dword_to_hex()
+ * qword_to_hex()
*
- * Output guint32 hex represetation to 'out', and return pointer after last character.
+ * Output guint64 hex represetation to 'out', and return pointer after last character.
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
- * There needs to be at least 8 bytes in the buffer.
+ * There needs to be at least 16 bytes in the buffer.
*/
-char *dword_to_hex(char *out, guint32 dword);
+char *qword_to_hex(char *out, guint64 qword);
+
+/**
+ * qword_to_hex_punct()
+ *
+ * Output guint64 hex represetation to 'out', and return pointer after last character.
+ * Each byte will be separated with punct character (cannot be NUL).
+ * It always output full representation (padded with 0).
+ *
+ * String is not NUL terminated by this routine.
+ * There needs to be at least 22 bytes in the buffer.
+ */
+char *qword_to_hex_punct(char *out, guint64 qword, char punct);
/**
* bytes_to_hexstr()
@@ -85,7 +120,7 @@ char *bytes_to_hexstr(char *out, const guint8 *ad, guint32 len);
* bytes_to_hexstr_punct()
*
* Output hex represetation of guint8 ad array, and return pointer after last character.
- * Each byte will be seperated with punct character (cannot be NUL).
+ * Each byte will be separated with punct character (cannot be NUL).
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
@@ -105,6 +140,17 @@ char *bytes_to_hexstr_punct(char *out, const guint8 *ad, guint32 len, char punct
char *oct_to_str_back(char *ptr, guint32 value);
/**
+ * oct64_to_str_back()
+ *
+ * Output guint64 octal representation backward (last character will be written on ptr - 1),
+ * and return pointer to first character.
+ *
+ * String is not NUL terminated by this routine.
+ * There needs to be at least 12 bytes in the buffer.
+ */
+char *oct64_to_str_back(char *ptr, guint64 value);
+
+/**
* hex_to_str_back()
*
* Output guint32 hex representation backward (last character will be written on ptr - 1),
@@ -117,6 +163,18 @@ char *oct_to_str_back(char *ptr, guint32 value);
char *hex_to_str_back(char *ptr, int len, guint32 value);
/**
+ * hex64_to_str_back()
+ *
+ * Output guint64 hex representation backward (last character will be written on ptr - 1),
+ * and return pointer to first character.
+ * This routine will output for sure (can output more) 'len' decimal characters (number padded with '0').
+ *
+ * String is not NUL terminated by this routine.
+ * There needs to be at least 2 + MAX(16, len) bytes in the buffer.
+ */
+char *hex64_to_str_back(char *ptr, int len, guint64 value);
+
+/**
* uint_to_str_back()
*
* Output guint32 decimal representation backward (last character will be written on ptr - 1),
@@ -128,6 +186,17 @@ char *hex_to_str_back(char *ptr, int len, guint32 value);
char *uint_to_str_back(char *ptr, guint32 value);
/**
+ * uint64_str_back()
+ *
+ * Output guint64 decimal representation backward (last character will be written on ptr - 1),
+ * and return pointer to first character.
+ *
+ * String is not NUL terminated by this routine.
+ * There needs to be at least 20 bytes in the buffer.
+ */
+char *uint64_to_str_back(char *ptr, guint64 value);
+
+/**
* uint_to_str_back_len()
*
* Output guint32 decimal representation backward (last character will be written on ptr - 1),
@@ -140,6 +209,18 @@ char *uint_to_str_back(char *ptr, guint32 value);
char *uint_to_str_back_len(char *ptr, guint32 value, int len);
/**
+ * uint64_to_str_back_len()
+ *
+ * Output guint64 decimal representation backward (last character will be written on ptr - 1),
+ * and return pointer to first character.
+ * This routine will output for sure (can output more) 'len' decimal characters (number padded with '0').
+ *
+ * String is not NUL terminated by this routine.
+ * There needs to be at least MAX(20, len) bytes in the buffer.
+ */
+char *uint64_to_str_back_len(char *ptr, guint64 value, int len);
+
+/**
* int_to_str_back()
*
* Output gint32 decimal representation backward (last character will be written on ptr - 1),
@@ -150,4 +231,15 @@ char *uint_to_str_back_len(char *ptr, guint32 value, int len);
*/
char *int_to_str_back(char *ptr, gint32 value);
+/**
+ * int64_to_str_back()
+ *
+ * Output gint64 decimal representation backward (last character will be written on ptr - 1),
+ * and return pointer to first character.
+ *
+ * String is not NUL terminated by this routine.
+ * There needs to be at least 21 bytes in the buffer.
+ */
+char *int64_to_str_back(char *ptr, gint64 value);
+
#endif /* __TO_STR_INT_H__ */
diff --git a/epan/to_str.c b/epan/to_str.c
index 923f5e3f44..45c9ebef80 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -75,6 +75,15 @@ word_to_hex(char *out, guint16 word)
}
char *
+word_to_hex_punct(char *out, guint16 word, char punct)
+{
+ out = byte_to_hex(out, word >> 8);
+ *out++ = punct;
+ out = byte_to_hex(out, word);
+ return out;
+}
+
+char *
word_to_hex_npad(char *out, guint16 word)
{
if (word >= 0x1000)
@@ -90,23 +99,34 @@ word_to_hex_npad(char *out, guint16 word)
char *
dword_to_hex(char *out, guint32 dword)
{
- out = byte_to_hex(out, dword >> 24);
- out = byte_to_hex(out, dword >> 16);
- out = byte_to_hex(out, dword >> 8);
- out = byte_to_hex(out, dword);
+ out = word_to_hex(out, dword >> 16);
+ out = word_to_hex(out, dword);
return out;
}
char *
dword_to_hex_punct(char *out, guint32 dword, char punct)
{
- out = byte_to_hex(out, dword >> 24);
+ out = word_to_hex_punct(out, dword >> 16, punct);
*out++ = punct;
- out = byte_to_hex(out, dword >> 16);
- *out++ = punct;
- out = byte_to_hex(out, dword >> 8);
+ out = word_to_hex_punct(out, dword, punct);
+ return out;
+}
+
+char *
+qword_to_hex(char *out, guint64 qword)
+{
+ out = dword_to_hex(out, qword >> 32);
+ out = dword_to_hex(out, qword & 0xffffffff);
+ return out;
+}
+
+char *
+qword_to_hex_punct(char *out, guint64 qword, char punct)
+{
+ out = dword_to_hex_punct(out, qword >> 32, punct);
*out++ = punct;
- out = byte_to_hex(out, dword);
+ out = dword_to_hex_punct(out, qword & 0xffffffff, punct);
return out;
}
@@ -229,6 +249,7 @@ bytes_to_str(wmem_allocator_t *scope, const guint8 *bd, int bd_len)
static int
guint32_to_str_buf_len(const guint32 u)
{
+ /* ((2^32)-1) == 2147483647 */
if (u >= 1000000000)return 10;
if (u >= 100000000) return 9;
if (u >= 10000000) return 8;
@@ -242,6 +263,33 @@ guint32_to_str_buf_len(const guint32 u)
return 1;
}
+static int
+guint64_to_str_buf_len(const guint64 u)
+{
+ /* ((2^64)-1) == 18446744073709551615 */
+
+ if (u >= 1000000000000000000) return 19;
+ if (u >= 100000000000000000) return 18;
+ if (u >= 10000000000000000) return 17;
+ if (u >= 1000000000000000) return 16;
+ if (u >= 100000000000000) return 15;
+ if (u >= 10000000000000) return 14;
+ if (u >= 1000000000000) return 13;
+ if (u >= 100000000000) return 12;
+ if (u >= 10000000000) return 11;
+ if (u >= 1000000000) return 10;
+ if (u >= 100000000) return 9;
+ if (u >= 10000000) return 8;
+ if (u >= 1000000) return 7;
+ if (u >= 100000) return 6;
+ if (u >= 10000) return 5;
+ if (u >= 1000) return 4;
+ if (u >= 100) return 3;
+ if (u >= 10) return 2;
+
+ return 1;
+}
+
static const char fast_strings[][4] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
@@ -294,6 +342,23 @@ guint32_to_str_buf(guint32 u, gchar *buf, int buf_len)
uint_to_str_back(bp, u);
}
+void
+guint64_to_str_buf(guint64 u, gchar *buf, int buf_len)
+{
+ int str_len = guint64_to_str_buf_len(u)+1;
+
+ gchar *bp = &buf[str_len];
+
+ if (buf_len < str_len) {
+ g_strlcpy(buf, BUF_TOO_SMALL_ERR, buf_len); /* Let the unexpected value alert user */
+ return;
+ }
+
+ *--bp = '\0';
+
+ uint64_to_str_back(bp, u);
+}
+
#define PLURALIZE(n) (((n) > 1) ? "s" : "")
#define COMMA(do_it) ((do_it) ? ", " : "")
@@ -1111,6 +1176,18 @@ oct_to_str_back(char *ptr, guint32 value)
}
char *
+oct64_to_str_back(char *ptr, guint64 value)
+{
+ while (value) {
+ *(--ptr) = '0' + (value & 0x7);
+ value >>= 3;
+ }
+
+ *(--ptr) = '0';
+ return ptr;
+}
+
+char *
hex_to_str_back(char *ptr, int len, guint32 value)
{
do {
@@ -1132,6 +1209,27 @@ hex_to_str_back(char *ptr, int len, guint32 value)
}
char *
+hex64_to_str_back(char *ptr, int len, guint64 value)
+{
+ do {
+ *(--ptr) = low_nibble_of_octet_to_hex(value & 0xF);
+ value >>= 4;
+ len--;
+ } while (value);
+
+ /* pad */
+ while (len > 0) {
+ *(--ptr) = '0';
+ len--;
+ }
+
+ *(--ptr) = 'x';
+ *(--ptr) = '0';
+
+ return ptr;
+}
+
+char *
uint_to_str_back(char *ptr, guint32 value)
{
char const *p;
@@ -1156,6 +1254,31 @@ uint_to_str_back(char *ptr, guint32 value)
}
char *
+uint64_to_str_back(char *ptr, guint64 value)
+{
+ char const *p;
+
+ /* special case */
+ if (value == 0)
+ *(--ptr) = '0';
+
+ while (value >= 10) {
+ p = fast_strings[100 + (value % 100)];
+
+ value /= 100;
+
+ *(--ptr) = p[2];
+ *(--ptr) = p[1];
+ }
+
+ /* value will be 0..9, so using '& 0xF' is safe, and faster than '% 10' */
+ if (value)
+ *(--ptr) = (value & 0xF) | '0';
+
+ return ptr;
+}
+
+char *
uint_to_str_back_len(char *ptr, guint32 value, int len)
{
char *new_ptr;
@@ -1176,6 +1299,26 @@ uint_to_str_back_len(char *ptr, guint32 value, int len)
}
char *
+uint64_to_str_back_len(char *ptr, guint64 value, int len)
+{
+ char *new_ptr;
+
+ new_ptr = uint64_to_str_back(ptr, value);
+
+ /* substract from len number of generated characters */
+ len -= (int)(ptr - new_ptr);
+
+ /* pad remaining with '0' */
+ while (len > 0)
+ {
+ *(--new_ptr) = '0';
+ len--;
+ }
+
+ return new_ptr;
+}
+
+char *
int_to_str_back(char *ptr, gint32 value)
{
if (value < 0) {
@@ -1187,6 +1330,18 @@ int_to_str_back(char *ptr, gint32 value)
return ptr;
}
+char *
+int64_to_str_back(char *ptr, gint64 value)
+{
+ if (value < 0) {
+ ptr = uint64_to_str_back(ptr, -value);
+ *(--ptr) = '-';
+ } else
+ ptr = uint64_to_str_back(ptr, value);
+
+ return ptr;
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
diff --git a/epan/to_str.h b/epan/to_str.h
index 9557eaeedb..706b855047 100644
--- a/epan/to_str.h
+++ b/epan/to_str.h
@@ -80,6 +80,7 @@ WS_DLL_PUBLIC void display_signed_time(gchar *, int, const gint32, gint32, const
WS_DLL_PUBLIC void display_epoch_time(gchar *, int, const time_t, gint32, const to_str_time_res_t);
extern void guint32_to_str_buf(guint32 u, gchar *buf, int buf_len);
+extern void guint64_to_str_buf(guint64 u, gchar *buf, int buf_len);
WS_DLL_PUBLIC gchar* rel_time_to_str(wmem_allocator_t *scope, const nstime_t*);
WS_DLL_PUBLIC gchar* rel_time_to_secs_str(wmem_allocator_t *scope, const nstime_t*);
diff --git a/epan/wslua/wslua_field.c b/epan/wslua/wslua_field.c
index 5e96f25c83..3bbdde3a1e 100644
--- a/epan/wslua/wslua_field.c
+++ b/epan/wslua/wslua_field.c
@@ -109,11 +109,11 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
lua_pushnumber(L,(lua_Number)(fvalue_get_floating(&(fi->ws_fi->value))));
return 1;
case FT_INT64: {
- pushInt64(L,(Int64)(fvalue_get_integer64(&(fi->ws_fi->value))));
+ pushInt64(L,(Int64)(fvalue_get_sinteger64(&(fi->ws_fi->value))));
return 1;
}
case FT_UINT64: {
- pushUInt64(L,fvalue_get_integer64(&(fi->ws_fi->value)));
+ pushUInt64(L,fvalue_get_uinteger64(&(fi->ws_fi->value)));
return 1;
}
case FT_ETHER: {
diff --git a/rawshark.c b/rawshark.c
index 6c901fcb57..52cc79f022 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -1348,9 +1348,12 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
g_string_append(label_s, val_to_str_const(svalue, cVALS(hfinfo->strings), "Unknown"));
}
break;
+ case FT_INT40: /* XXX: Shouldn't these be as smart as FT_INT{8,16,24,32}? */
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
DISSECTOR_ASSERT(!hfinfo->bitmask);
- svalue64 = (gint64)fvalue_get_integer64(&finfo->value);
+ svalue64 = (gint64)fvalue_get_sinteger64(&finfo->value);
if (hfinfo->display & BASE_VAL64_STRING) {
g_string_append(label_s, val64_to_str_const(svalue64, (const val64_string *)(hfinfo->strings), "Unknown"));
}
@@ -1359,6 +1362,7 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
+ DISSECTOR_ASSERT(!hfinfo->bitmask);
uvalue = fvalue_get_uinteger(&finfo->value);
if (!hfinfo->bitmask && hfinfo->display & BASE_RANGE_STRING) {
g_string_append(label_s, rval_to_str_const(uvalue, RVALS(hfinfo->strings), "Unknown"));
@@ -1368,9 +1372,12 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
g_string_append(label_s, val_to_str_const(uvalue, cVALS(hfinfo->strings), "Unknown"));
}
break;
+ case FT_UINT40: /* XXX: Shouldn't these be as smart as FT_INT{8,16,24,32}? */
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
DISSECTOR_ASSERT(!hfinfo->bitmask);
- uvalue64 = fvalue_get_integer64(&finfo->value);
+ uvalue64 = fvalue_get_uinteger64(&finfo->value);
if (hfinfo->display & BASE_VAL64_STRING) {
g_string_append(label_s, val64_to_str_const(uvalue64, (const val64_string *)(hfinfo->strings), "Unknown"));
}
diff --git a/ui/cli/tap-iostat.c b/ui/cli/tap-iostat.c
index e175a9be6a..2191973991 100644
--- a/ui/cli/tap-iostat.c
+++ b/ui/cli/tap-iostat.c
@@ -172,8 +172,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case FT_UINT32:
it->counter += fvalue_get_uinteger(&((field_info *)gp->pdata[i])->value);
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
- it->counter += fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
+ it->counter += fvalue_get_uinteger64(&((field_info *)gp->pdata[i])->value);
break;
case FT_INT8:
case FT_INT16:
@@ -181,8 +184,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case FT_INT32:
it->counter += fvalue_get_sinteger(&((field_info *)gp->pdata[i])->value);
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
- it->counter += (gint64)fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
+ it->counter += (gint64)fvalue_get_sinteger64(&((field_info *)gp->pdata[i])->value);
break;
case FT_FLOAT:
it->float_counter +=
@@ -226,8 +232,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
it->counter = val;
}
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
- val = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
+ val = fvalue_get_uinteger64(&((field_info *)gp->pdata[i])->value);
if ((it->frames == 1 && i == 0) || (val < it->counter)) {
it->counter = val;
}
@@ -241,8 +250,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
it->counter = val;
}
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
- val = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
+ val = fvalue_get_sinteger64(&((field_info *)gp->pdata[i])->value);
if ((it->frames == 1 && i == 0) || ((gint64)val < (gint64)it->counter)) {
it->counter = val;
}
@@ -295,8 +307,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
if (val > it->counter)
it->counter = val;
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
- val = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
+ val = fvalue_get_uinteger64(&((field_info *)gp->pdata[i])->value);
if (val > it->counter)
it->counter = val;
break;
@@ -308,8 +323,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
if ((gint32)val > (gint32)it->counter)
it->counter = val;
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
- val = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
+ val = fvalue_get_sinteger64(&((field_info *)gp->pdata[i])->value);
if ((gint64)val > (gint64)it->counter)
it->counter = val;
break;
@@ -356,9 +374,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
val = fvalue_get_uinteger(&((field_info *)gp->pdata[i])->value);
it->counter += val;
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
- case FT_INT64:
- val = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
+ val = fvalue_get_uinteger64(&((field_info *)gp->pdata[i])->value);
it->counter += val;
break;
case FT_INT8:
@@ -368,6 +388,13 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
val = fvalue_get_sinteger(&((field_info *)gp->pdata[i])->value);
it->counter += val;
break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
+ case FT_INT64:
+ val = fvalue_get_sinteger64(&((field_info *)gp->pdata[i])->value);
+ it->counter += val;
+ break;
case FT_FLOAT:
it->float_counter += (gfloat)fvalue_get_floating(&((field_info *)gp->pdata[i])->value);
break;
diff --git a/ui/io_graph_item.h b/ui/io_graph_item.h
index 7ef15173cf..bfb581a955 100644
--- a/ui/io_graph_item.h
+++ b/ui/io_graph_item.h
@@ -194,9 +194,25 @@ update_io_graph_item(io_graph_item_t *items, int idx, packet_info *pinfo, epan_d
item->int_tot += new_int;
item->fields++;
break;
+ case FT_UINT40:
+ case FT_UINT48:
+ case FT_UINT56:
case FT_UINT64:
+ new_int64 = fvalue_get_uinteger64(&((field_info *)gp->pdata[i])->value);
+ if ((new_int64 > item->int_max) || (item->fields == 0)) {
+ item->int_max = new_int64;
+ }
+ if ((new_int64 < item->int_min) || (item->fields == 0)) {
+ item->int_min = new_int64;
+ }
+ item->int_tot += new_int64;
+ item->fields++;
+ break;
+ case FT_INT40:
+ case FT_INT48:
+ case FT_INT56:
case FT_INT64:
- new_int64 = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
+ new_int64 = fvalue_get_sinteger64(&((field_info *)gp->pdata[i])->value);
if ((new_int64 > item->int_max) || (item->fields == 0)) {
item->int_max = new_int64;
}