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
conflating PROTOABBREV with PROTOFILTERNAME.

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:

hi2operations
HI2Operations.IRIsContent
HI2Operations.UUS1_Content_element
HI2Operations.iRIContent
HI2Operations.iRISequence
HI2Operations.IRIContent
HI2Operations.iRI_Begin_record_element
HI2Operations.iRI_End_record_element
HI2Operations.iRI_Continue_record_element
HI2Operations.iRI_Report_record_element
(...)

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-on: https://code.wireshark.org/review/35062
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
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 https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
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-on: https://code.wireshark.org/review/24902
Reviewed-by: Michael Mann <mmann78@netscape.net>
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
packet-PROTOABBREV.c.

Remove dfilter2pod.pl and dfilter2xml.pl. We haven't used them since
2010.

Change-Id: I4adec02a9a4bc3e71e32bdf89f2754edaf696938
Reviewed-on: https://code.wireshark.org/review/24343
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
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-on: https://code.wireshark.org/review/17724
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08 02:44:53 +00:00
Michael Mann 12f6311b20 "new" dissector API -> dissector API for docs/examples
Change-Id: If862aadbd483933782d5979a3c0be2cb3c08a480
Reviewed-on: https://code.wireshark.org/review/12481
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 03:12:44 +00:00
Alexis La Goutte 3d3c854215 Doc (packet-PROTOABBREV): fix quote for config include
Following https://code.wireshark.org/review/#/c/8204/

Change-Id: I7850c10d9d3ca9ad63a85c9c6ef98d70bf4201b8
Reviewed-on: https://code.wireshark.org/review/8647
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2015-05-26 12:46:35 +00:00
Joerg Mayer 58c890d93f Fix a small typo
Change-Id: I1c5464a0344d46d01eee140723d179a7adacd0f6
Reviewed-on: https://code.wireshark.org/review/8243
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
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-on: https://code.wireshark.org/review/5939
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21 07:18:28 +00:00
Gerald Combs 175039128a Update the doc directory to use https://www.wireshark.org.
Change-Id: I9bfc57cb6b6ab6962b80ff58d98eb351d6f69829
Reviewed-on: https://code.wireshark.org/review/4140
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-09-17 00:12:26 +00:00
Alexis La Goutte 021351f422 PROTOABBREV: minor fix
Fix typo PROTO_ABBREV -> PROTOABBREV
Uncomment FIELDCONVERT

Change-Id: I7b64c09ecf0c22a38042156d958e1c6c850c839a
Reviewed-on: https://code.wireshark.org/review/3914
Reviewed-by: Anders Broman <a.broman58@gmail.com>
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-on: https://code.wireshark.org/review/3724
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
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:
https://www.wireshark.org/lists/wireshark-dev/201402/msg00198.html

Change-Id: I3d54cb49e2f0027ee79f68a633f57382101241b5
Reviewed-on: https://code.wireshark.org/review/350
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-25 13:38:18 +00:00
Evan Huus 83fc346853 Documentation updates
Change-Id: I6bd7fa40726fe7ffd68b9341c640874f2a0f1c7c
Reviewed-on: https://code.wireshark.org/review/314
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Christopher Maynard <Christopher.Maynard@gtech.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
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-on: https://code.wireshark.org/review/311
Reviewed-by: Evan Huus <eapache@gmail.com>
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-on: https://code.wireshark.org/review/204
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
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