Commit Graph

43 Commits

Author SHA1 Message Date
John Thacker 3a57dd522b Use WS_ROUNDUP_4 in more dissectors
Several more dissectors define their own "round up the length
to a 4 byte word boundary" macros. Use the new common macro
in wsutil/ws_roundup.h instead.
2022-07-20 13:59:56 +00:00
Roland Knall 2cf938cfa8 tap: Adding flags for tap_packet
This allows flags to be passed by the registering listener
to the collection of information
2022-06-10 05:46:15 +00:00
João Valverde 8efad466c4 Tools: Fix fix-encoding-args.pl ASCII string validation
Do not require a useless ENC_NA parameter for string encodings.
FT_STRING and FT_STRINGZ types don't have any ndianness.

Follow-up to 6ec429622c.
2022-02-15 11:38:16 +00:00
Evan Huus 8ee8808876 First pass pinfo->pool conversion, part 2
Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.
2021-07-21 09:54:57 -04:00
Evan Huus f54493278f Delete various unused fields
Discovered during the build failure of
https://gitlab.com/wireshark/wireshark/-/merge_requests/3695
2021-07-17 16:35:41 -04:00
Martin Mathieson d70a4a9321 Standardise IETF RFC and Draft URLs in dissectors.
Prefer:
- html (rather than txt)
- https

Also includes the script check_dissector_urls.py,
that can be used to find links in code and test them.

Change-Id: Iafd8bb8948674a38ad5232bf5b5432ffb2b1251b
Reviewed-on: https://code.wireshark.org/review/36821
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-04-13 14:58:48 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Guy Harris 2d41b15495 Add a "failed" return for tap packet routines.
This allows taps that can fail to report an error and fail; a failed
tap's packet routine won't be called again, so they don't have to keep
track of whether they've failed themselves.

We make the return value from the packet routine an enum.

Don't have a separate type for the per-packet routine for "follow" taps;
they're expected to act like tap packet routines, so just use the type
for tap packet routines.

One tap packet routine returned -1; that's not a valid return value, and
wasn't one before this change (the return value was a boolean), so
presume the intent was "don't redraw".

Another tap routine's early return, without doing any work, returned
TRUE; this is presumably an error (no work done, no need to redraw), so
presumably it should be "don't redraw".

Clean up some white space while we're at it.

Change-Id: Ia7d2b717b2cace4b13c2b886e699aa4d79cc82c8
Reviewed-on: https://code.wireshark.org/review/31283
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-01 05:03:42 +00:00
Michael Mann c10c7737cc Allow floating point values for stats_tree
Bug: 4234
Change-Id: Ibd59809b2dd9890a7851eb57ef7af384e280a74b
Reviewed-on: https://code.wireshark.org/review/31222
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-12-28 14:50:45 +00:00
Dario Lombardo fe219637a6 dissectors: use SPDX identifiers.
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a
Reviewed-on: https://code.wireshark.org/review/25756
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-12 16:49:58 +00:00
João Valverde 299bd4628a Fix unitialized variable warnings that popped up with -Og
Using GCC version 7.1.1.

Change-Id: I7447a48fc97efb1eb15a016a29165f69d37f40a6
Reviewed-on: https://code.wireshark.org/review/23399
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-05 22:31:01 +00:00
Uli Heilmeier 6d204e5152 ANCP: Update to RFC6320
Updates ANCP dissector to final RFC6320.
Additional updates types and codes to current IANA registry values:
https://www.iana.org/assignments/ancp/ancp.xhtml

Bug: 13532
Change-Id: I15d3e66e049d425350a528d04d4a5ff24d9b26bd
Reviewed-on: https://code.wireshark.org/review/20964
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-08 14:33:12 +00:00
Michael Mann 9f71c86880 A few more BASE_UNIT_STRING cases.
Change-Id: Ic443f773d19e63aad59292bfb540f58bda565241
Reviewed-on: https://code.wireshark.org/review/20917
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2017-04-05 07:13:17 +00:00
Michael Mann 268841f3e0 Combine Decode As and port preferences for tcp.port dissector table.
This patch introduces new APIs to allow dissectors to have a preference for
a (TCP) port, but the underlying data is actually part of Decode As functionality.
For now the APIs are intentionally separate from the regular APIs that register a
dissector within a dissector table.  It may be possible to eventually combine the
two so that all dissectors that register with a dissector table have an opportunity
to "automatically" have a preference to adjust the "table value" through the
preferences dialog.

The tcp.port dissector table was used as the guinea pig.  This will eventually be
expanded to other dissector tables as well (most notably UDP ports).  Some
dissectors that "shared" a TCP/UDP port preference were also converted. It also
removed the need for some preference callback functions (mostly when the callback
function was the proto_reg_handoff function) so there is cleanup around that.

Dissectors that has a port preference whose default was 0 were switched to using
the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference

Also added comments for TCP ports used that aren't IANA registered.

Change-Id: I99604f95d426ad345f4b494598d94178b886eb67
Reviewed-on: https://code.wireshark.org/review/17724
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08 02:44:53 +00:00
Michael Mann 443a7ed259 new_create_dissector_handle -> create_dissector_handle for dissector directory.
Some of the ASN.1 dissectors still generate a new_create_dissector_handle from the tool itself, so leave those for now.

Change-Id: Ic6e5803b1444d7ac24070949f5fd557909a5641f
Reviewed-on: https://code.wireshark.org/review/12484
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 12:37:36 +00:00
AndersBroman 870d223b69 Change deprecated API tvb_length -> tvb_reported_length
Change-Id: I14577dccaed5aa5ed85e94b6810a94b4c8b2e437
Reviewed-on: https://code.wireshark.org/review/8059
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-14 06:58:40 +00:00
Hadriel Kaplan ceb8d954d2 Lua: Expose tcp_dissect_pdus() to Lua
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus()
to make TCP-based dissection easier.

Bug: 9851
Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3
Reviewed-on: https://code.wireshark.org/review/6778
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-27 15:14:12 +00:00
Martin Mathieson 596669f921 First batch of unincludes. Last attempt...
Change-Id: I3681462aeb98ca62ed3ec5eb226b2553317391a9
Reviewed-on: https://code.wireshark.org/review/5997
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-22 21:03:13 +00:00
Bill Meier b5d7b7ab6e Cleanup use of #includes in non-generated epan/dissector/*.c
Specifically:
- Set packet.h to be the first wireshark #include after
   config.h and "system" #includes.
   packet.h added as an #include in some cases when missing.
- Remove some #includes included (directly/indirectly) in
   packet.h. E.g., glib.h.
   (Done only for those files including packet.h).
- As needed, move "system" #includes to be after config.h and
   before wireshark #includes.
- Rework various #include file specifications for consistency.
- Misc.

Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95
Reviewed-on: https://code.wireshark.org/review/5923
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21 05:46:22 +00:00
Bill Meier 10406870f5 Add editor modelines; fix indentation as needed.
Change-Id: I1ad94654343e5a018a0b3159481d45ffb3a91263
Reviewed-on: https://code.wireshark.org/review/4363
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-29 13:47:02 +00:00
Bill Meier b14bf98c06 Fix spelling: cant-->can't, wont-->won't, etc
Change-Id: I4497f1b8b6eab0e576d9dd31b732965f9a6679c6
Reviewed-on: https://code.wireshark.org/review/4124
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-16 13:51:51 +00:00
Michael Mann 14824e6adf Revert "Fixup: tvb_* -> tvb_captured"
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html

This reverts commit 246fe2ca4c.

Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f
Reviewed-on: https://code.wireshark.org/review/2430
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 18:25:59 +00:00
Dario Lombardo 246fe2ca4c Fixup: tvb_* -> tvb_captured
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f
Reviewed-on: https://code.wireshark.org/review/2377
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:14:58 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Guy Harris 7b32b5c14a Don't cast away constness.
svn path=/trunk/; revision=54753
2014-01-14 02:25:20 +00:00
Michael Mann 8081cf1d90 Add data parameter to tcp_dissect_pdus() as well as convert it to using "new" style dissectors.
Now that "bytes consumed" can be determined, should tcp_dissect_pdus() take advantage of that?

Should tcp_dissect_pdus return length (bytes consumed)?  There are many dissectors that just call tcp_dissect_pdus() then return tvb_length(tvb).  Seems like that could all be rolled into one.

svn path=/trunk/; revision=53198
2013-11-09 17:46:28 +00:00
Pascal Quantin efe18f199c Convert a few dissectors from emem to wmem API
svn path=/trunk/; revision=51983
2013-09-12 20:37:30 +00:00
Anders Broman 6bde918078 From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48426
2013-03-19 20:00:52 +00:00
Anders Broman 04766017df - [-Wmissing-prototypes]
- explicit casts.

svn path=/trunk/; revision=48282
2013-03-13 21:14:20 +00:00
Bill Meier e2956a39a2 Cleanup:
- Revmove 'if (tree...)'; col_...() shouldn't be called under same;
- Add an XXX comment;
- Remove not req'd #include <epan/prefs.h>;
- Address cppcheck msg: "Clarify calculation precedence for >> and ?";
- Localize certain variables & remove unneeded initializers;
- Do some whitespace changes.

svn path=/trunk/; revision=45617
2012-10-17 17:16:56 +00:00
Jeff Morriss 2552c750e5 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45017
2012-09-20 02:03:38 +00:00
Michael Tüxen 401a7109a8 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7137
svn path=/trunk/; revision=42128
2012-04-18 10:11:33 +00:00
Bill Meier 794757ae8f For proto_tree_add_item(..., proto_xxx, ...)use ENC_NA as the encoding arg.
Also: remove trailing whitespace for a number of files.

svn path=/trunk/; revision=39503
2011-10-21 02:10:19 +00:00
Bill Meier d65261d344 Use ENC_NA as proto_tree_add_item() encoding arg for FT_ETHER hf[] field type.
(Some minor whitespace cleanup).

svn path=/trunk/; revision=39488
2011-10-20 14:07:54 +00:00
Bill Meier 293049dfba Do some conversions of proto_tree_add_item() 'encoding' arg.
(previously missed).

    57   FT_BOOLEAN:       FALSE-->ENC_BIG_ENDIAN
    31   FT_BOOLEAN:       TRUE-->ENC_LITTLE_ENDIAN

    10   FT_BYTES:         ENC_BIG_ENDIAN-->ENC_NA
     1   FT_BYTES:         ENC_LITTLE_ENDIAN-->ENC_NA
    21   FT_BYTES:         FALSE-->ENC_NA
     2   FT_BYTES:         TRUE-->ENC_NA

     2   FT_IPXNET:        ENC_BIG_ENDIAN-->ENC_NA

     6   FT_IPv6:          ENC_BIG_ENDIAN-->ENC_NA
     1   FT_IPv6:          FALSE-->ENC_NA

     6   FT_NONE:          ENC_BIG_ENDIAN-->ENC_NA
    19   FT_NONE:          FALSE-->ENC_NA
     3   FT_NONE:          TRUE-->ENC_NA

     1   FT_STRING:        ENC_BIG_ENDIAN-->ENC_ASCII|ENC_NA
     1   FT_STRING:        ENC_LITTLE_ENDIAN-->ENC_ASCII|ENC_NA
     5   FT_STRING:        FALSE-->ENC_ASCII|ENC_NA
     1   FT_STRING:        TRUE-->ENC_ASCII|ENC_NA

     4   FT_STRINGZ:       ENC_NA-->ENC_ASCII|ENC_NA
     8   FT_STRINGZ:       FALSE-->ENC_ASCII|ENC_NA

     1   FT_INT32:         FALSE-->ENC_BIG_ENDIAN
     1   FT_INT32:         TRUE-->ENC_LITTLE_ENDIAN

    11   FT_UINT8:         0-->ENC_BIG_ENDIAN
   111   FT_UINT8:         FALSE-->ENC_BIG_ENDIAN
    17   FT_UINT8:         TRUE-->ENC_LITTLE_ENDIAN
     1   FT_UINT16:        0-->ENC_BIG_ENDIAN
    68   FT_UINT16:        FALSE-->ENC_BIG_ENDIAN
    18   FT_UINT16:        TRUE-->ENC_LITTLE_ENDIAN
     4   FT_UINT24:        FALSE-->ENC_BIG_ENDIAN
    70   FT_UINT32:        FALSE-->ENC_BIG_ENDIAN
     1   FT_UINT32:        TRUE-->ENC_LITTLE_ENDIAN
     4   FT_UINT64:        FALSE-->ENC_BIG_ENDIAN
     1   FT_UINT64:        TRUE-->ENC_LITTLE_ENDIAN

     1   FT_UINT_STRING:   FALSE-->ENC_ASCII|ENC_BIG_ENDIAN


svn path=/trunk/; revision=39442
2011-10-16 23:38:49 +00:00
Bill Meier 126aa85393 Convert proto_tree_add_item() 'encoding' arg for field types FT_STRING, FT_STRINGZ, FT_UINT_STRING as follows:
1. If there's no character encoding (ENC_ASCII, ...) specified
    then use ENC_ASCII.
 2. For all but FT_UINT_STRING, always use ENC_NA
    (replacing any existing True/1/FALSE/0
    /ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN).



svn path=/trunk/; revision=39426
2011-10-15 18:46:26 +00:00
Bill Meier 67ee5049d4 Convert 'encoding' parameter of certain proto_tree_add_item() calls in non-autogenerated epan/dissectors:
Specifically:  Replace FALSE|0 and TRUE|1 by ENC_BIG_ENDIAN|ENC_LITTLE_ENDIAN as
  the encoding parameter for proto_tree_add_item() calls which directly reference
  an item in hf[] which has a type of:
     FT_BOOLEAN
     FT_IPv4
     FT_EUI64
     FT_GUID
     FT_UINT_STRING

Also: For type FT_ITv6 use ENC_NA. (This was missed in SVN #39260)

svn path=/trunk/; revision=39328
2011-10-10 00:39:31 +00:00
Bill Meier 4e57694d4a Convert 'encoding' parameter of certain proto_tree_add_item() calls in non-autogenerated epan/dissectors:
Specifically:  Replace FALSE|0 and TRUE|1 by ENC_BIG_ENDIAN|ENC_LITTLE_ENDIAN as
 the encoding parameter for proto_tree_add_item() calls which directly reference
 an item in hf[] which has a type of:
    FT_UINT8
    FT_UINT16
    FT_UINT24
    FT_UINT32
    FT_UINT64
    FT_INT8
    FT_INT16
    FT_INT24
    FT_INT32
    FT_INT64
    FT_FLOAT
    FT_DOUBLE


svn path=/trunk/; revision=39288
2011-10-06 03:35:44 +00:00
Alexis La Goutte af85ec17a2 Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=36707
2011-04-18 18:36:23 +00:00
Bill Meier 07e325bf63 Don't assign to a proto_item * if the value won't be used: Coverity 832-834.
Also: white space cleanup.

svn path=/trunk/; revision=36459
2011-04-04 18:13:22 +00:00
Guy Harris a8bc4a0d13 Rename the routines that handle dissector tables with unsigned integer
keys to have _uint in their names, to match the routines that handle
dissector tables with string keys.  (Using _port can confuse people into
thinking they're intended solely for use with TCP/UDP/etc. ports when,
in fact, they work better for things such as Ethernet types, where the
binding of particular values to particular protocols are a lot
stronger.)

svn path=/trunk/; revision=35224
2010-12-20 05:35:29 +00:00
Jaap Keuter 1009be2c17 Skip reserved word in ANCP OAM-Loopback-Test-Parameters TLV.
svn path=/trunk/; revision=34879
2010-11-15 18:28:36 +00:00
Bill Meier 7728979e61 From Aniruddha A: ANCP (Access Node Control Protocol) Dissector.
see: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4590

From me: A few minor changes:
- Make ancp_info a local variable rather than a static global variable;
- Use Stats ! ANCP   rather than Stats ! ANCP ! Packet Types.

svn path=/trunk/; revision=32353
2010-04-01 17:49:26 +00:00