Commit Graph

102 Commits

Author SHA1 Message Date
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int,
not arrays of non-const pointers to const int.

Fixing that means some bugs (scribbling on what's *supposed* to be a
const array) will be caught (see packet-ieee80211-radiotap.c for
examples, the first of which inspired this change and the second of
which was discovered while testing compiles with this change), and
removes the need for some annoying casts.

Also make some of those arrays static while we're at it.

Update documentation and dissector-generator tools.

Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
Reviewed-on: https://code.wireshark.org/review/37517
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19 11:32:26 +00:00
Anders Broman 7edadf9ce3 asn2wrs: Improve filtername of named bits.
Change-Id: Ie22137e95c8752a0783e3e9ff99b45c0b79b0d4a
Reviewed-on: https://code.wireshark.org/review/32714
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-04 13:26:33 +00:00
Anders Broman c2ac157ac0 ASN.1: Use proto_tree_add_bitmask... () for named bits.
Change-Id: Ied0c91ea070ee76603e7ecb29d874e0c1a65892e
Reviewed-on: https://code.wireshark.org/review/32684
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-03 14:53:08 +00:00
Pascal Quantin d9d6106044 ASN.1: update auto generated dissectors
Change-Id: Ic73e72b3d2e7590eaed07f6eb30f74f4303e7a65
Reviewed-on: https://code.wireshark.org/review/25880
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2018-02-18 17:47:40 +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
Stig Bjørlykke d99112d393 Use col_append_str() for fixed strings
Change from col_append_fstr() to col_append_str() when
appending strings without formatting.

Change-Id: I8975704c246f2b9a1301ed5f96273aa9d61c6f44
Reviewed-on: https://code.wireshark.org/review/20857
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-04-03 05:32:17 +00:00
Guy Harris a4c8ebc18b Don't do any Decode As stuff for dissector tables not used with Decode As.
Have all dissector tables have a "supports Decode As" flag, which
defaults to FALSE, and which is set to TRUE if a register_decode_as()
refers to it.

When adding a dissector to a dissector table with a given key, only add
it for Decode As if the dissector table supports it.

For non-FT_STRING dissector tables, always check for multiple entries
for the same protocol with different dissectors, and report an error if
we found them.

This means there's no need for the creator of a dissector table to
specify whether duplicates of that sort should be allowed - we always do
the check when registering something for "Decode As" (in a non-FT_STRING
dissector table), and just don't bother registering anything for "Decode
As" if the dissector table doesn't support "Decode As", so there's no
check done for those dissector tables.

Change-Id: I4a1fdea3bddc2af27a65cfbca23edc99b26c0eed
Reviewed-on: https://code.wireshark.org/review/17402
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-31 00:08:01 +00:00
Michael Mann a062c80236 ASN.1 dissectors - don't try to find yourself.
If an ASN.1 dissector is calling register_dissector for itself in its proto_register_xxx
function and then calling find_dissector for itself in its proto_reg_handoff_xxx
function then just create a static handle for that dissector and use the return
value of register_dissector, so the find isn't necessary.

Change-Id: I911bdadc2fb4259601c141b955e741a2369cc447
Reviewed-on: https://code.wireshark.org/review/16233
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-01 14:26:20 +00:00
Michael Mann e37275bfde Associate dissector tables and heuristic subdissector lists with a protocol.
This will make it easier to determine protocol dependencies.

Some LLC OUI dissector tables didn't have an associated protocol, so they were left without one (-1 used)

Change-Id: I6339f16476510ef3f393d6fb5d8946419bfb4b7d
Reviewed-on: https://code.wireshark.org/review/14446
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-17 00:05:17 +00:00
João Valverde 54a520d4a1 Move /asn1 to /epan/dissectors
Change-Id: I1208fe3c2ba428995526f561e8f792b8d871e9a9
Reviewed-on: https://code.wireshark.org/review/14388
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: João Valverde <j@v6e.pt>
2016-03-13 21:30:24 +00:00
moshekaplan cd7026951b Fix a lot of typos and misspellings
Change-Id: I8512cfa1d424f82a873a0e0e1d22c7b075fdd7f3
Reviewed-on: https://code.wireshark.org/review/13069
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-08 20:04:56 +00:00
Michael Mann a33209d69e Convert ASN.1 dissectors to remove "new" from "new-style" dissector function names that were generated from asn2wrs.py
This includes:
1. new_create_dissector_handle -> create_dissector_handle
2. new_register_dissector -> register_dissector
3. new_register_ber_oid_dissector -> register_ber_oid_dissector
4. new_register_ber_syntax_dissector -> register_ber_syntax_dissector

Also remove PDU_NEW, SYNTAX_NEW and REGISTER_NEW as there is no need for the distinction anymore.

Change-Id: I82c7de7c8ffeeab3259d1b55bb4afc5f6a1e0329
Reviewed-on: https://code.wireshark.org/review/12491
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-10 17:06:02 +00:00
Michael Mann a391a70b3b "new" dissector API -> dissector API for ASN.1 dissectors.
Change-Id: I7b794cba2feda2cae40411e2b1cb9fb091d08220
Reviewed-on: https://code.wireshark.org/review/12480
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 03:12:23 +00:00
Michael Mann 74541a9596 Don't allow multiple registrations of a protocol in dissector tables.
The target here is the Decode As dialog where protocols have multiple registrations into a dissector table and that shows up as multiple entries in the Decode As dialog list with the same name so users are unsure which "dissector" they are choosing.

The "default" behavior (done in this commit) is to not allow duplicates for a dissector table, whether its part of Decode As or not.  It's just ENFORCED for Decode As.

Bug: 3949
Change-Id: Ibe14fa61aaeca0881f9cc39b78799e314b5e8127
Reviewed-on: https://code.wireshark.org/review/11405
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-04 12:39:40 +00:00
AndersBroman 5fa267e870 REplace deprecated API tvb_length -> tvb_reported_length
Change-Id: I6090055a9c31f6787626b810de655d1cc71b99de
Reviewed-on: https://code.wireshark.org/review/8002
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-09 12:03:23 +00:00
Pascal Quantin fd870e34e8 CMIP: get rid of some evil global variables
Fixes an ASAN failure reported by Alexis
Note that some global variables remain as I do not know enough on this protocol to safely remove them

Change-Id: If392a8f09ef2fc2f2d46871a71149e29fe5e292c
Reviewed-on: https://code.wireshark.org/review/7099
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-02-17 20:28:45 +00:00
Bill Meier dd859eada4 asn1 generated dissectors: cleanup #include usage
Change-Id: I36b2731d67f9345d2fd0c23800bba7d2be94c387
Reviewed-on: https://code.wireshark.org/review/6008
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-23 05:39:00 +00:00
Stig Bjørlykke 4e1b5ea866 ASN1: Register PDU-dissectors as NEW
Change-Id: I1a317b19d8076588c9305dae6287bb80cc14da64
Reviewed-on: https://code.wireshark.org/review/4494
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-13 11:24:07 +00:00
Michael Mann cd02af56a1 Eliminate (almost all) proto_tree_add_text calls from ASN.1 dissectors.
This mostly involved adding expert info capabilities to many of the dissectors so that they could correctly flag error conditions.

Only remaining proto_tree_add_text calls are in H248.cnf, which has a convoluted way of using hf_ data to make its tree.

Change-Id: I6412150c2ec1977d7fa38f3f0ed416680bdfb141
Reviewed-on: https://code.wireshark.org/review/3500
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-09 01:57:08 +00:00
Evan Huus 5ed05dd747 batch of manual tvb_length conversions
Change-Id: Ib3a1ddc4342a7a8648d6ed8bfcb35aa229c56a27
Reviewed-on: https://code.wireshark.org/review/2445
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 19:55:31 +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
Pascal Quantin d6548f9301 Remove unused const variables errors seen with recent Clang version
Fixes bug 9886

Change-Id: I8624ef1c5874aea5521d21c998510fc29c838936
Reviewed-on: https://code.wireshark.org/review/657
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-03-15 17:52:16 +00:00
Bill Meier 1dff4e309d Remove trailing whitespace from asn1 .cnf & template.[hc] files. Regenerate dissectors.
Change-Id: I0e779b2ac2f608356649c5bbfca438141070dea4
Reviewed-on: https://code.wireshark.org/review/412
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-26 19:38:21 +00:00
Jeff Morriss 8c608e6e82 Remove $Id$ from the ASN.1 dissectors and regenerate them.
Change-Id: Ie476c6f82f318188b41ed922b92c6fec119ea954
Reviewed-on: https://code.wireshark.org/review/244
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-02-18 03:05:28 +00:00
Chris Maynard 231e52a9ea Reject the packet if data is NULL without doing anything else.
svn path=/trunk/; revision=53737
2013-12-02 21:52:46 +00:00
Michael Mann b6b78d69db In an effort to reduce the use of pinfo->private_data (and some true global variables), I converted the ASN.1 dissectors that use pinfo->private_data to exchange a SESSION_DATA_STRUCTURE to instead only exchange it in the context of ASN.1. This meant converting dissectors to the "new" style to pass the SESSION_DATA_STRUCTURE as well as providing a pointer to it in asn1_ctx_t.private_data. Yes, it's still "private data", but it's not used by all dissectors like pinfo->private data is.
svn path=/trunk/; revision=53090
2013-11-05 18:47:26 +00:00
Michael Mann c0fcebb07a Add a data parameter to call_ber_oid_callback to be able to pass data to subdissectors found with dissector_try_string_new.
The intention is to aid in the removal of pinfo->private_data use as well as static global variables in a dissector.  For now, all calls to call_ber_oid_callback have the data parameter set to NULL.

svn path=/trunk/; revision=52994
2013-10-31 00:57:03 +00:00
Pascal Quantin 0ee4d0a00a Postfix FT_NONE fields with "_element" string to reduce number of incompatible filters in ASN.1 dissectors
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2402

svn path=/trunk/; revision=49599
2013-05-27 20:26:49 +00:00
Pascal Quantin a37c044203 Update the ASN.1 based dissectors following the changes done in r48812
svn path=/trunk/; revision=48820
2013-04-11 18:14:53 +00:00
Anders Broman 20c17246d4 svn path=/trunk/; revision=48440 2013-03-20 06:50:56 +00:00
Jakub Zawadzki 7a9d27c33f Regenerate asn.1 dissectors.
svn path=/trunk/; revision=45110
2012-09-24 19:38:46 +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
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +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 24cf0aad06 Update generated ASN1 *.[hc] files after recent work done by Jeff Morriss;
The only change in each file is in a comment showing the asn2wrs cmd used to build that file.

svn path=/trunk/; revision=39427
2011-10-15 19:27:27 +00:00
Stig Bjørlykke a7c5d642d5 Regenerate ASN.1 dissectors to update the #line directive.
svn path=/trunk/; revision=37118
2011-05-13 08:12:27 +00:00
Stig Bjørlykke 1ba57f4c04 Added a dissector table for AttributeId localForm.
Use correct object identifier in ModificationList.

svn path=/trunk/; revision=35894
2011-02-10 10:11:38 +00:00
Jeff Morriss a0c858efcd Add a little more code to avoid not-very-useful blurbs:
- Change spaces in the name to underscores before comparing it to the blurb.
  - Check if the type simply as T_ prepended to the name.
  - Don't put in a blurb of "NULL".

and regenerate the dissectors.

svn path=/trunk/; revision=32748
2010-05-11 03:53:31 +00:00
Jeff Morriss 8f210cf4e0 Regenerate a few of the ASN.1 dissectors
svn path=/trunk/; revision=32742
2010-05-11 02:13:26 +00:00
Bill Meier 9ade30a7b1 #include <string.h> and/or #include <stdio.h> not needed.
svn path=/trunk/; revision=32417
2010-04-07 16:54:29 +00:00
Bill Meier f8b92f8d0b #include <stdio.h> not needed.
svn path=/trunk/; revision=32405
2010-04-06 17:01:14 +00:00
Stig Bjørlykke 8b42b795e8 Use correct opcode table for error values and regular values.
Removed check_col().

svn path=/trunk/; revision=30950
2009-11-13 12:33:33 +00:00
Stig Bjørlykke 6d1dae6f28 Make all proto_* values static.
svn path=/trunk/; revision=30516
2009-10-11 16:24:29 +00:00
Kovarththanan Rajaratnam 9490d1b74c Regenerate asn1 dissectors (no change, only some line offset changes)
svn path=/trunk/; revision=30454
2009-10-09 21:34:49 +00:00
Stig Bjørlykke 8fce84f9e2 Fix a possible dereference of null pointer when having no tree.
svn path=/trunk/; revision=30174
2009-09-27 21:18:18 +00:00
Kovarththanan Rajaratnam 65c53fedb6 Don't guard col_append_str with check_col
svn path=/trunk/; revision=30125
2009-09-24 20:00:21 +00:00
Kovarththanan Rajaratnam 0a5b014cec Don't guard col_clear with col_check
svn path=/trunk/; revision=29344
2009-08-09 07:36:13 +00:00
Kovarththanan Rajaratnam e971354a54 Don't guard col_set_str (COL_PROTOCOL) with col_check
svn path=/trunk/; revision=29340
2009-08-09 06:26:46 +00:00
Gerald Combs 87c095780a Rework an assignment to keep static analyzers from complaining.
svn path=/trunk/; revision=29287
2009-08-03 23:51:13 +00:00