Commit Graph

27 Commits

Author SHA1 Message Date
Gerald Combs 5084857eed WSUG: Document the layer operator.
Copy over the "layer operator" section from the wireshark-filter man
page.

Fix the "at operator" level in the wireshark-filter man page.
2022-11-03 14:23:12 +00:00
João Valverde 0853ddd1cb dfilter: Add support for raw (bytes) addressing mode
This adds new syntax to read a field from the tree as bytes, instead
of the actual type. This is a useful extension for example to match
matformed strings that contain unicode replacement characters. In
this case it is not possible to match the raw value of the malformed
string field. This extension fills this need and is generic enough
that it should be useful in many other situations.

The syntax used is to prefix the field name with "@". The following
artificial example tests if the HTTP user agent contains a particular
invalid UTF-8 sequence:

    @http.user_agent == "Mozill\xAA"

Where simply using "http.user_agent" won't work because the invalid byte
sequence will have been replaced with U+FFFD.

Considering the following programs:

    $ dftest '_ws.ftypes.string == "ABC"'
    Filter: _ws.ftypes.string == "ABC"

    Syntax tree:
     0 TEST_ANY_EQ:
       1 FIELD(_ws.ftypes.string <FT_STRING>)
       1 FVALUE("ABC" <FT_STRING>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.string <FT_STRING> -> reg#0
    00001 IF_FALSE_GOTO	3
    00002 ANY_EQ		reg#0 == "ABC" <FT_STRING>
    00003 RETURN

    $ dftest '@_ws.ftypes.string == "ABC"'
    Filter: @_ws.ftypes.string == "ABC"

    Syntax tree:
     0 TEST_ANY_EQ:
       1 FIELD(_ws.ftypes.string <RAW>)
       1 FVALUE(41:42:43 <FT_BYTES>)

    Instructions:
    00000 READ_TREE		@_ws.ftypes.string <FT_BYTES> -> reg#0
    00001 IF_FALSE_GOTO	3
    00002 ANY_EQ		reg#0 == 41:42:43 <FT_BYTES>
    00003 RETURN

In the second case the field has a "raw" type, that equates directly to
FT_BYTES, and the field value is read from the protocol raw data.
2022-10-31 21:02:39 +00:00
João Valverde e9e6431d7b dfilter: Change boolean string representation
Use "True" or "TRUE" instead of "true" and remove case insensivity.
Same for false. This should serve to differentiate booleans a bit
more from protocol names, which should be using lower-case.
2022-06-25 13:02:34 +01:00
Gerald Combs 3b0d9194bc Docs: Update the ftype description list in wireshark-filter(4).
Update a couple of ftype descriptions and update the list in the
wireshark-filter man page.
2022-06-21 14:33:45 -07:00
João Valverde fe25d701ba Docs: Updates to wireshark-filter manpage 2022-06-21 16:56:06 +01:00
Gerald Combs 8fa64a4773 Docs: Note that display filter layer numbers start at 1. 2022-06-08 17:21:58 +00:00
João Valverde 4015522162 Docs: Another display filter regex update 2022-06-08 16:40:09 +00:00
João Valverde bd0f0cbbed Docs: Update display filter manual page to PCRE2 2022-06-08 12:12:25 +01:00
Chuck Craft 609c0d3881 docs: adoc migration bolding typos; Windows pipe name syntax 2022-05-12 16:43:44 +00:00
João Valverde b602911b31 dfilter: Add support for universal quantifiers
Adds the keywords "any" and "all" to implement the quantification
to any existing relational operator.

Filter: all tcp.port in {100, 2000..3000}

Syntax tree:
 0 ALL TEST_IN:
   1 FIELD(tcp.port)
   1 SET(#2):
     2 FVALUE(100 <FT_UINT16>)
     2 FVALUE(2000 <FT_UINT16>) .. FVALUE(3000 <FT_UINT16>)

Instructions:
00000 READ_TREE		tcp.port -> reg#0
00001 IF_FALSE_GOTO	5
00002 ALL_EQ		reg#0 === 100 <FT_UINT16>
00003 IF_TRUE_GOTO	5
00004 ALL_IN_RANGE	reg#0 in { 2000 <FT_UINT16> .. 3000 <FT_UINT16> }
00005 RETURN
2022-05-12 14:26:54 +01:00
João Valverde 4f3f507eee dfilter: Add syntax to match specific layers in the protocol stack
Add support to display filters for matching a specific layer within a frame.
Layers are counted sequentially up the protocol stack. Each protocol
(dissector) that appears in the stack is one layer.

LINK-LAYER#1 <-> IP#1 <-> TCP#1 <-> IP#2 <-> TCP#2 <-> etc.

The syntax allows for negative indexes and ranges with the usual semantics
for slices (but note that counting starts at one):

    tcp.port#[2-4] == 1024

Matches layers 2 to 4 inclusive.

Fixes #3791.
2022-04-26 16:50:59 +00:00
João Valverde eb2a9889c3 dfilter: Add abs() function
Add an absolute value function for ftypes.
2022-04-18 17:09:00 +01:00
João Valverde cef02cc3a0 dfilter: Add max()/min() tests and documentation 2022-04-14 13:07:41 +00:00
João Valverde fb9a176587 dfilter: Allow grouping arithmetical expressions with { }
This removes the limitation of having only two terms in an
arithmetic expression and allows setting the precedence using
curly braces (like any basic calculator).

Our grammar currently does not allow grouping arithmetic expressions
using parenthesis, because boolean expressions and arithmetic
expressions are different and parenthesis are used with the former.
2022-04-08 23:12:04 +01:00
João Valverde 34ad6bb478 dfilter: Make logical AND higher precedence than logical OR
In most, if not all, programming languages logical AND has
higher precedence than logical OR. Apply the principle of
least surprise and do the same for Wireshark display
filters.

Before: ip and tcp or udp => ip and (tcp or udp)

    Filter: ip and tcp or udp

    Instructions:
    00000 CHECK_EXISTS	ip
    00001 IF_FALSE_GOTO	5
    00002 CHECK_EXISTS	tcp
    00003 IF_TRUE_GOTO	5
    00004 CHECK_EXISTS	udp
    00005 RETURN

After: ip and tcp or udp => (ip and tcp) or udp

    Filter: ip and tcp or udp

    Instructions:
    00000 CHECK_EXISTS	ip
    00001 IF_FALSE_GOTO	4
    00002 CHECK_EXISTS	tcp
    00003 IF_TRUE_GOTO	5
    00004 CHECK_EXISTS	udp
    00005 RETURN
2022-04-04 19:51:38 +00:00
João Valverde 7b4ec1bd88 Docs: Add new display filter syntax to the manpage. 2022-04-01 07:22:22 +01:00
João Valverde 16729be2c1 dfilter: Add bitwise masking of bits
Add support for masking of bits. Before the bitwise operator
could only test bits, it did not support clearing bits.

This allows testing if any combination of bits are set/unset
more naturally with a single test. Previously this was only
possible by combining several bitwise predicates.

Bitwise is implemented as a test node, even though it is not.
Maybe the test node should be renamed to something else.

Fixes #17246.
2022-03-22 12:58:04 +00:00
João Valverde 8983dda8f2 dfilter: Deprecate "~=" (any_ne)
The representation "~= has been superseded by "!==" with the same
meaning, making it superfluous and somewhat confusing. Deprecate
"~=" and recommend "!==" instead.
2022-03-09 11:28:39 +00:00
João Valverde 9cc3e7e1bb dfilter: Add support for binary literal constants
Example: 0b1001, 0B111000, etc.
2022-02-23 22:27:59 +00:00
João Valverde 019bb06268 Docs: Add some content about different equality operators
Add information about the different kind of comparisons with
multiple fields to the wireshark-filter man page.

Add some minimal information to the user guide. It would be
nice to have a section dedicated to this with some examples.
2021-12-31 15:33:32 +00:00
Gerald Combs e2703507c2 Update a bunch of GLib documentation links.
Change our developer.gnome.org/glib URLs to
developer-old.gnome.org/glib. The official documentation for GLib
appears to be at https://docs.gtk.org/glib/, but it has a different
layout than the gnome.org content (and is surprisingly resistant to
exploration IMHO). We can switch to developer-old.gnome.org using a
simple substitution and it still seems to be updated, so do that for
now.
2021-11-20 21:33:17 +00:00
Martin Mathieson 263189e23d Fix some spelling errors. 2021-11-18 04:43:51 +00:00
John Thacker 6d52bf07a7 docs: Update wireshark-filter.adoc for recent filter changes.
Commas in sets, changes to != and ~=, changes to contains and matches,
changes to implicit conversions/comparisons to unquoted values.
Also fix #15392.
2021-10-31 08:56:48 +00:00
João Valverde c9abbde287 docs: Update wireshark-filter man page about "!="
Update man page to remove obsolete information about "!=".
2021-10-26 14:53:20 +00:00
Gerald Combs 01b0d9e077 Docs: Move includes to the top of our man pages.
Move our attributes.adoc includes to the very top of each man page.
Older versions of Asciidoctor complain if it's not at the top. and
additionally generate <file>.man instead of <file>.<section> if we don't
explictly supply an output file.
2021-10-19 16:26:37 -07:00
Gerald Combs 84ab55cf75 Docs+Packaging: Convert our man pages to Asciidoctor.
Convert doc/*.pod to Asciidoctor. This:

* Means we use the same markup for our man pages, the guides, and
  release notes.
* Lets us add versions to our man pages.
* Gives us more formatting options, e.g. AsciiDoc supports `commands`,
  nested lists and makes it easy to include version information. The
  manpage backend doesn't seem to support tables very well,
  unfortunately.

Convert our CMake configuration to produce *roff and html man pages
using Asciidoctor. Add a "manarg" block macro which makes our synopses
wrap correctly.

Similar to the release notes, guides, and FAQ, if Asciidoctor isn't
found the man pages won't be generated or installed.

Move Asciidoctor to the list of package build dependencies in various
places.

This commit includes the conversion script (pod2adoc.py), which will be
removed later.

Line count sanity check:

Man page         .pod .adoc
androiddump       260  280
asn2deb            93  105
capinfos          401  471
captype            54   55
ciscodump         241  269
dftest             42   42
dpauxmon          153  169
dumpcap           464  534
editcap           528  583
etwdump           136  156
extcap            157  181
idl2deb            91  103
idl2wrs           120  100
mergecap          206  207
mmdbresolve        75   75
randpkt           107  111
randpktdump       158  184
rawshark          558  610
reordercap         76   78
sdjournal         145  157
sshdump           272  302
text2pcap         274  312
tshark           2135 2360
udpdump           133  151
wireshark-filter  486  479
wireshark        2967 3420
2021-10-01 16:42:34 +00:00
Gerald Combs 9f1607ab47 Docs: Prep for POD to Asciidoctor conversion.
[skip ci]

Rename each of our .pod files to .adoc. Add pod2adoc.py, which converts
POD markup to Asciidoctor, along with customizations specific to us.
2021-10-01 16:42:34 +00:00