Age | Commit message (Collapse) | Author | Files | Lines |
|
If the quote character appears in a field value, then escape
it by printing the character twice. When escaping whitespace
with the backslash character, also escape the backslash
character itself.
Add a ws_escape_csv function to wsutil and use it for tshark.
Adopt the existing static escape_string_len function so that
ws_escape_csv can use it while maintaining the same output
for the other ws_escape_ functions.
Fix #10284
|
|
inet_netw.c -> inet_cidr.c
inet_netw.h -> inet_cidr.h
|
|
|
|
Consolidate code to handle CIDR network addresses in inet_netw.[ch].
|
|
ip_to_str() forces the caller to cast the argument and it's not
obvious at all that the input should be in network-byte order
for IPv4 addresses.
Deprecated the function and add endian-explicit substitutes (number
vs address).
|
|
Do not allow "fvalue_set_uinteger" and "fvalue_get_uinteger"
with FT_IPv4. Use "fvalue_set_ipv4" and "fvalue_get_ipv4"
intead.
Fix incorrect usage of fvalue_*_uinteger with FT_IPv4,
hopefully I caught all of them.
|
|
For the benefit of plugins.
|
|
|
|
Remove name static storage and use a switch to map enums to
names. This allows mapping names all names, even those that
are not instantiated as objects.
Rewrite some assertions using ws_error() for detailed error
messages.
|
|
Extend the time arithmetic to support multiplication and division
with floating point numbers.
In this case the multiplier/divisor is parsed according to its
lexical number type.
Fixes #19150.
|
|
Add a lexical type for numbers, consisting of integers and floats.
Because the float is represented internally as an IEEE 754 double
and that is a lossy representation, we still need to parse numbers
from strings sometimes.
One sematic change instroduced is that integers on the RHS of a
relation with bytes are interpreted as decimals instead of
hexadecimals without a 0x prefix in the representation.
This is a net win, in line with the goal of being explicit
writing literal values in display filter expressions.
|
|
The multiplication of two time values is not well-defined,
because time is represented internally as a vector.
Add a scalar multiplication/division for time values
using integer numbers. The scalar multiplier must appear
on the RHS of the operation. (This limitation mat be
removed in the future.)
This is useful to compare relative time values. The
operation is also allowed for absolute date and time values
because it is mathematically consistent but that is
probably less useful in practice.
Related to #19150.
|
|
Rename a typedef and use an address and mask as the method
interface.
|
|
|
|
Remove code duplication for 32-bit and 64-bit integers.
Use 64-bit for everything and cast to 32-bit to implement
getters for 32-bit numbers.
|
|
Add conversions from G_GINT64_CONSTANT to INT64_C and G_GUINT64_CONSTANT
to UINT64_C to convert-glib-types. Convert instances in epan/ftypes and
wsutil.
|
|
We should represent JSON values in JSON,
such as booleans using true/false.
The changes in cdc8e2f5119a20e905b60d2afab66114a86b45c9
didn't actually fix anything for JSON output in that
regard, they just replace one string representation with
a different incorrect representation, so revert the part
affecting JSON to avoid inconveniencing users without
sufficient justification.
|
|
|
|
Ping #19116
|
|
|
|
Instead of adding a TFS(&tfs_true_false) to every boolean
field, make it the default if "strings" is NULL.
This seems to match the already existing documentation:
If the Boolean field is to be displayed as "False" or "True", the
'strings' field would be set to NULL.
|
|
Instead of rturning an 8-bit(!) integer giving the number of characters
parsed, have them return a pointer to the first character *after* the
string that was parsed, similarly to what strto*() (and Wireshark's
wrappers for them in wsutil) and strptime() return.
This cleans up some code that uses those routines.
For the 3GPP 32.423 trace files, we also reject files where there isn't
an ISO 8601-format time where we expect there to be one. (Having the
string-format date/time routines return NULL on an error means you have
to think about what to do on failure.)
|
|
Extends the dfilter syntax with more the timezones supported
by ws_strptime().
We remove the handling of tm_gmtoff and tm_zone in struct tm,
because it is more trouble than it is worth due to platform
incompatibilites, and instead use an extra arguments to pass
these two non-standard fields.
Remove a test that is no longer relevant (we do not need to
assert that WET in particular is not supported).
|
|
The code is incorrectly also omitting zeros that are significant
from the representation of fractional values of absolute time
in display filters (with FTREPR_DFILTER).
Instead of fixing the representation just remove the buggy code and
include all 9 digits of fractional seconds, including trailing zeros
to the right of the decimal point, which in this case can be inferred
to indicate the precision (to the nanosecond).
|
|
This reverts commit 8c113b9db93b1da7804a7890249975b8a161476b.
The behaviour of the new code is not exactly the same as the
old and that is apparently causing some failures in the test
suite.
|
|
|
|
|
|
Before:
Filter:
frame.time <= "2002-12-31 13:56:31.3 UTC"
Error: Unexpected data after time value.
frame.time <= "2002-12-31 13:56:31.3 UTC"
After:
Filter:
frame.time <= "2002-12-31 13:56:31.3 UTC"
Instructions:
0000 READ_TREE frame.time -> R0
0001 IF_FALSE_GOTO 3
0002 ANY_LE R0 <= "2002-12-31 13:56:31.3+0000"
0003 RETURN
|
|
Replace our strptime code, which is from gnulib,
with the simpler and better NetBSD implementation.
This changes the ws_strptime() stub to unconditionally use
the internal implementation. Previously it would use the
system implementation of available. This is still possible
but is opt-in, i.e., code should add the necessary #ifdefs
and assume responsability for handling non-portable formats
or providing limited functionality on some platforms.
Text import allows the user to specify the strptime()
format freely, so in that case it makes sense to use the
system's implementation, and pass the responsability
for understanding the implementation and the supported
specifiers to the user.
Only fall back to our implementation if the system libc
lacks a strptime().
|
|
When parsing an expression such as
Filter:
_ws.ftypes.boolean == true
Instructions:
0000 READ_TREE _ws.ftypes.boolean <FT_BOOLEAN> -> R0
0001 IF_FALSE_GOTO 3
0002 ANY_EQ R0 == 1 <FT_UINT64>
0003 RETURN
it gives the wrong type. Conceptually there is no reason a boolean
should be a value string.
This commit also fixes the error message to avoid calling invalid
boolean tokens "invalid numbers" when parsing booleans.
The code now use g_ascii_strcasecmp() to accept true, True, trUE, etc.
Initially the intention was to require non-numeric literals to
start with an upper-case letter, to reserve lower-case for protocol
names, but since "true" and "false" have been accepted as integers
for a long time via value strings, that intention is dropped.
As a consequence true/false are added to reserved keywords.
After this change:
Filter:
_ws.ftypes.boolean == true
Instructions:
0000 READ_TREE _ws.ftypes.boolean <FT_BOOLEAN> -> R0
0001 IF_FALSE_GOTO 3
0002 ANY_EQ R0 == 1 <FT_BOOLEAN>
0003 RETURN
|
|
Add ABSOLUTE_TIME_UNIX absolute time type, to allow
date and time values to be represented in Unix time,
besides other existing formats.
|
|
FT_ABSOLUTE_TIME Hhas the same arithmetic properties as
FT_RELATIVE_TIME. Give it the same methods.
|
|
|
|
|
|
Allow string slices (indexing) to work with internationalized
strings. The old behavior of indexing on byte boundaries can
be obtained using raw slices.
|
|
Modularize the code to allow re-use.
|
|
Do not mix wire size, a protocol property, with fvalue
length, a property of certain types of objects (sequences).
Rename ftype_length() to ftype_wire_size(). Do not return
wire_size with fvalue_length() (use ftype_wire_size()
instead).
Make the semantic check reject taking the len() of objects
that are not arrays or lists. If the (fixed) len() of a number
is somehow useful we can add a different function for that.
|
|
Rename IS_FT_*() to FT_IS_*(). I find it to be more natural and
a better namespace for a public interface.
|
|
|
|
Need to decrement reference counter after calling fvalue_get_bytes().
|
|
|
|
Fixes #19012.
|
|
Add methods to make fvalues hashable with GHashTable.
|
|
Exposing the fvalue_t implementation is exposing internal
details of the implementation. Fix that by making the fvalue_t
internal to the ftypes implementation and using setters/getters
where necessary.
|
|
Fvalues are immutable objects. This isn't strictly true in
the case of FT_BYTES because of widespread use of
proto_item_set_len() but that can be worked around and using
GBytes should be more convenient for callers and make some
aspects of the implementation simplers (others not).
|
|
|
|
Develpment headers are a sizeable part of the binary installation
and most users won't ever require them. It's recommended to package
them separately in a devel package or SDK.
Create a CMake installation component for development headers
and add the EXCLUDE_FROM_ALL property.
Headers can be installed using the invocation:
cmake --install <dir> --component Development
|
|
|
|
Make dfilter byte representation always use ':' for consistency.
Make 1 byte be represented as "XX:" with the colon suffix to
make it nonambiguous that is is a byte and not other type,
like a protocol.
The difference is can be seen in the following programs. In the
before representation it is not obvious at all that the second
"fc" value is a literal bytes value and not the value of the
protocol "fc", although it can be inferred from the lack of
a READ_TREE instruction. In the After we know that "fc:" must
be bytes and not a protocol.
Note that a leading colon is a syntactical expedient to say
"this value with any type is a literal value and not a protocol
field." A terminating colon is just a part of the dfilter
literal bytes syntax.
Before:
Filter: fc == :fc
Syntax tree:
0 TEST_ANY_EQ:
1 FIELD(fc <FT_PROTOCOL>)
1 FVALUE(fc <FT_PROTOCOL>)
Instructions:
00000 READ_TREE fc <FT_PROTOCOL> -> reg#0
00001 IF_FALSE_GOTO 3
00002 ANY_EQ reg#0 == fc <FT_PROTOCOL>
After:
Filter: fc == :fc
Syntax tree:
0 TEST_ANY_EQ:
1 FIELD(fc <FT_PROTOCOL>)
1 FVALUE(fc: <FT_PROTOCOL>)
Instructions:
00000 READ_TREE fc <FT_PROTOCOL> -> reg#0
00001 IF_FALSE_GOTO 3
00002 ANY_EQ reg#0 == fc: <FT_PROTOCOL>
|
|
The ftype itself is encoding agnostic. In the case of literal
display filter strings it is possible and legal to contain
invalid UTF-8.
Maybe it shouldn't be but that requires a user-friendly diagnostic
message, not silently sanitizing the string as is done currently
(only a debug message is printed in that case).
Do the debug checks in proto_tree_set_string() instead. That
still detects dissector code that might need fixing, which was
the purpose for this check.
Improve documentation and add admonition for proto_tree_add_string().
Ping #18521.
|