Commit Graph

25 Commits

Author SHA1 Message Date
João Valverde a2bc5bd012 doc: Update header preamble for dissector skeleton 2023-02-22 07:09:36 +00:00
John Thacker e33bc8d5bf docs: Update the sample dissector
Update the sample dissector for some best practices,
and avoid some deprecated behavior.

Use register_protocol instead of creating an anonymous
dissector handle, so that Lua, Export PDU, custom
User DLT disection, etc. can find it. (See #5612)

Use auto preferences and prefer port ranges when possible
(See #14319)
2022-08-15 04:53:58 +00:00
Moshe Kaplan 69d54d6f8e Corrects repeated words throughout the code.
Repeated words were found with:
egrep "(\b[a-zA-Z]+) +\1\b" . -Ir
and then manually reviewed.
Non-displayed strings (e.g., in comments)
were also corrected, to ease future review.
2021-12-22 11:01:11 +00:00
João Valverde 070aeddf76 Lift restriction on upper case protocol display filter names
Unlike other header fields in filter expressions protocol names
cannot contain upper-case letters. Remove that restriction. This
should make start-up slightly faster as it remove an extra loop
for each protocol filter name.

This was added in 9ead15a6eb but
I don't see a reason to have different rules for protocols and
fields, it seems the README.developer was just being vague and

The recommendation for lower case is a style recommendation,
and it's a good one, but it should be applied uniformly. As
long as we are not enforcing this for all field filter values
there is no point in enforcing it just for protocol names and
actually it is detrimental, e.g:


It's weird and unexpected to have this difference and there is
no technical reason to require it. What we should probably do
is not include the protocol name in the FIELDFILTERNAME and
have the registration mechanism append it to the PROTOFILTERNAME.

Also disallow leading '-' everywhere in filter names, not just
protocol filter names. It's a universal requirement.
2021-11-02 08:35:24 +00:00
Jeff Widman 46c9f2579d typo: is require --> is required 2020-10-07 17:32:54 -07:00
Dario Lombardo 40d822ed61 tools: add automatic C skeleton dissector generator.
Generate a dissector based on doc/packet-PROTOABBREV.c.

Change-Id: I9233c1212acb30f7166ba91e39d98bc3fb123731
Reviewed-by: Graham Bloice <>
Reviewed-by: Dario Lombardo <>
2019-11-14 12:33:10 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Petri-Dish: Anders Broman <>
Petri-Dish: Dario Lombardo <>
Reviewed-by: Anders Broman <>
2018-02-08 14:57:36 +00:00
D. W. Poon 6ff295af01 Swapped expert item fields in sample dissector
The sample dissector was inconsistent with the definition of
expert_field_info in epan/expert.h.

Change-Id: I533537e52bbcfa7f0cd7ff42e4233f17f40f8bab
Reviewed-by: Michael Mann <>
2017-12-20 13:49:09 +00:00
Gerald Combs 4ec8ebcebb SPDX: Convert doc and docbook.
Replace the GPLv2+ blurbs in the doc and docbook directories with SPDX
headers as appropriate. This includes example code such as

Remove and We haven't used them since

Change-Id: I4adec02a9a4bc3e71e32bdf89f2754edaf696938
Reviewed-by: Gerald Combs <>
Petri-Dish: Gerald Combs <>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <>
2017-11-11 15:45:31 +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-by: Michael Mann <>
2016-10-08 02:44:53 +00:00
Michael Mann 12f6311b20 "new" dissector API -> dissector API for docs/examples
Change-Id: If862aadbd483933782d5979a3c0be2cb3c08a480
Reviewed-by: Michael Mann <>
2015-12-09 03:12:44 +00:00
Alexis La Goutte 3d3c854215 Doc (packet-PROTOABBREV): fix quote for config include

Change-Id: I7850c10d9d3ca9ad63a85c9c6ef98d70bf4201b8
Reviewed-by: Graham Bloice <>
2015-05-26 12:46:35 +00:00
Joerg Mayer 58c890d93f Fix a small typo
Change-Id: I1c5464a0344d46d01eee140723d179a7adacd0f6
Reviewed-by: Jörg Mayer <>
2015-04-30 08:28:49 +00:00
Bill Meier 806ebca6a5 packet-PROTOABBREV.c: Update re #includeusage
- packet.h should be first Wireshark #include
  after config.h and "system" includes.
- '#include <glib.h>' not needed.

Change-Id: Ibec076818f3f509aabb4d240e939ef719f3798d6
Reviewed-by: Bill Meier <>
2014-12-21 07:18:28 +00:00
Gerald Combs 175039128a Update the doc directory to use
Change-Id: I9bfc57cb6b6ab6962b80ff58d98eb351d6f69829
Reviewed-by: Gerald Combs <>
2014-09-17 00:12:26 +00:00
Alexis La Goutte 021351f422 PROTOABBREV: minor fix

Change-Id: I7b64c09ecf0c22a38042156d958e1c6c850c839a
Reviewed-by: Anders Broman <>
2014-08-30 09:51:36 +00:00
Bill Meier 2e3bc5790f packet-PROTOABBREV.c: various minor changes:
- Specify that proto_register...() and proto_reg_handoff...() prototypes are required;
- Indicate that certain #includes should be used only as needed;
- Don't use CamelCase (or CAPS) in variable names;
- Do some reformatting of certain lines;
- Futz hf[] array entry so checkAPIs and checkhf tests don't fail.

Change-Id: Ie03846f4bebd2a9bece464c85cc3c2ef46dd4fe5
Reviewed-by: Bill Meier <>
Reviewed-by: Evan Huus <>
2014-08-19 18:30:17 +00:00
Evan Huus 2f239772e6 More explanation of example heuristic code.
Approach suggested by Jeff seems right to me:

Change-Id: I3d54cb49e2f0027ee79f68a633f57382101241b5
Reviewed-by: Evan Huus <>
2014-02-25 13:38:18 +00:00
Evan Huus 83fc346853 Documentation updates
Change-Id: I6bd7fa40726fe7ffd68b9341c640874f2a0f1c7c
Reviewed-by: Alexis La Goutte <>
Reviewed-by: Christopher Maynard <>
Reviewed-by: Evan Huus <>
2014-02-23 15:30:35 +00:00
Evan Huus 22149c5523 TVB API deprecations and cleanup
- rename tvb_length and similar to tvb_captured_length and similar; leave
  #defines in place for backwards-compat, but mark them clearly as deprecated in
  code comments and in checkAPI
- remove tvb_get_string as C code and just leave a #define in place for
  backwards-compat; mark it clearly as deprecated in code comment and checkAPI
- update READMEs and sample dissector for all of the above
- while in the neighbourhood, make checkAPI skip (and warn) for missing files
  instead of bailing on the whole check, so subsequent files still get checked

Change-Id: I32fc437896ca86ca73e9b49d5f50400adf8ec5ad
Reviewed-by: Evan Huus <>
2014-02-22 15:02:01 +00:00
Jeff Morriss b6a9b8494c Remove $Id$ and other Subversion leftovers from the doc files.
Change-Id: I28a376f7e0fd90971f65ae9c1105a3ec85221470
Reviewed-by: Jeff Morriss <>
2014-02-14 01:33:14 +00:00
Jörg Mayer 0d479ec37f make it possible to compile the sample dissector.
Fix one trivial error found.
Add a missing forward declaration.

svn path=/trunk/; revision=54323
2013-12-21 09:43:02 +00:00
Michael Mann e4025f4aba Add an example of filterable expert info.
Also cleanup references to README.developer that are now README.dissector.

svn path=/trunk/; revision=51858
2013-09-09 03:43:45 +00:00
Evan Huus 4e3c836273 Major cleanup of skeleton dissector and related bits of README.developer.
Changes of note:
- Removed the 'Copied from' notice, it's only relevant if they're *not* using
  the skeleton code. Added a paragraph to README.developer instead.
- Exorcised all references to if (tree) and placed them in their own section
  at the bottom as an optimization. Hopefully this will be less confusing.

svn path=/trunk/; revision=48861
2013-04-15 21:43:40 +00:00
Evan Huus bb2820deb0 Put the skeleton sample code from README.developer into its own file - it's
much easier to edit/maintain that way as well as much easier to copy for a
new dissector. Explicitly don't set the SVN id tag since this is a template.

svn path=/trunk/; revision=48860
2013-04-15 20:56:55 +00:00