Make FT_{U}INT64 behave more like FT_{U}INT32, add support for FT_{U}INT{40,48,56}

Change-Id: I57354c309ecf3a0c8f0c7cff485638027f30bb19
Reviewed-on: https://code.wireshark.org/review/5813
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
JC Wren 2014-12-17 15:19:20 -05:00 committed by Anders Broman
parent 13531d36fb
commit e2bcee6ac4
26 changed files with 1735 additions and 475 deletions

View File

@ -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

View File

@ -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:

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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_integer64(fvalue_t *fv, guint64 value)
set_uinteger64(fvalue_t *fv, guint64 value)
{
fv->value.integer64 = value;
fv->value.uinteger64 = value;
}
static void
set_sinteger64(fvalue_t *fv, gint64 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);

View File

@ -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,

View File

@ -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,

View File

@ -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 */

View File

@ -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 */

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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;

View File

@ -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_integer64);
return fv->ftype->get_value_integer64(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_sinteger64);
return fv->ftype->get_value_sinteger64(fv);
}
double

View File

@ -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);

View File

@ -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();

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -36,6 +36,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()
*
@ -47,18 +59,6 @@ char *word_to_hex(char *out, guint16 word);
*/
char *word_to_hex_npad(char *out, guint16 word);
/**
* 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).
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
* There needs to be at least 11 bytes in the buffer.
*/
char *dword_to_hex_punct(char *out, guint32 dword, char punct);
/**
* dword_to_hex()
*
@ -70,6 +70,41 @@ char *dword_to_hex_punct(char *out, guint32 dword, char punct);
*/
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 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 11 bytes in the buffer.
*/
char *dword_to_hex_punct(char *out, guint32 dword, char punct);
/**
* qword_to_hex()
*
* 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 16 bytes in the buffer.
*/
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.
@ -104,6 +139,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()
*
@ -116,6 +162,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()
*
@ -127,6 +185,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()
*
@ -139,6 +208,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()
*
@ -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__ */

View File

@ -74,6 +74,15 @@ word_to_hex(char *out, guint16 word)
return out;
}
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)
{
@ -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 = 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 >> 8);
*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) ? ", " : "")
@ -1110,6 +1175,18 @@ oct_to_str_back(char *ptr, guint32 value)
return ptr;
}
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)
{
@ -1131,6 +1208,27 @@ hex_to_str_back(char *ptr, int len, guint32 value)
return ptr;
}
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)
{
@ -1155,6 +1253,31 @@ uint_to_str_back(char *ptr, guint32 value)
return ptr;
}
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)
{
@ -1175,6 +1298,26 @@ uint_to_str_back_len(char *ptr, guint32 value, int len)
return new_ptr;
}
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)
{
@ -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
*

View File

@ -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*);

View File

@ -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: {

View File

@ -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"));
}

View File

@ -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;

View File

@ -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;
}