Commit Graph

47 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
Gerald Combs 0874b8bac6 Remove popcount in favor of ws_count_ones.
Remove our popcount implementation in favor of ws_count_ones, which
is our other popcount implementation. This required updating and
running process-x11-xcb.pl.

Change-Id: I8634c55242113b338c5b0173837c35f98b148b4f
Reviewed-on: https://code.wireshark.org/review/26454
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>
2018-03-13 17:18:01 +00:00
Dario Lombardo fe71e26af2 spdx: more licenses converted.
Change-Id: I3861061ec261e63b23621799e020e811ed78a343
Reviewed-on: https://code.wireshark.org/review/26333
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07 15:56:44 +00:00
Guy Harris dbd5902e76 Add terminating NULL to lists for proto_tree_add_bitmask().
Those lists require null terminators; fix the script to add them, and
re-run the script (with the current tip of the master branch for
xcbproto and mesa).

Change-Id: I76c156521e79753f5c19cae16e9caa031abd2496
Reviewed-on: https://code.wireshark.org/review/21471
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-05-03 02:52:37 +00:00
Michael Mann 89e0bdf36d X11: Replace VALUEXX macros and handle endianness "natively."
Change-Id: I45d4557377a445c981e6b7cfc1dbe57f586252e5
Reviewed-on: https://code.wireshark.org/review/21210
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-19 14:01:26 +00:00
Michael Mann 243da1fb3c X11: Replace UNUSED macro
Change-Id: Ieed2c672fd2acb76dba0ef1c3182eb9f00a04253
Reviewed-on: https://code.wireshark.org/review/21205
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-18 23:06:41 +00:00
Michael Mann c908846625 X11: Sort mesa_enum to allow for value_string_ext
Adjust the dissector generator to put mesa_enum values in
numerical order.  Remove comments about where the specific
values came from as sorting them means the comments aren't
always going to be in the right place.

Change-Id: I3c6b8252017c8a3ec379be49b3df069ec488cd1c
Reviewed-on: https://code.wireshark.org/review/21198
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-18 21:31:07 +00:00
Michael Mann 85d08e58cc X11: Use proto_tree_add_bitmask for generated bitmasks
Change-Id: Idc95500b74452911117be8903fe0bde0c8a6fefa
Reviewed-on: https://code.wireshark.org/review/21173
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>
2017-04-18 05:11:27 +00:00
Michael Mann b1a41acb52 X11: Resolve filter differences between a "list" and its "item".
The "list" is of type FT_NONE and the "item" is not.  That can
cause type conflicts.

Change-Id: If62f7113bc120e392588724a0dd65b7ab32ccde7
Reviewed-on: https://code.wireshark.org/review/21146
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-16 18:55:10 +00:00
Michael Mann f9b8e64e15 X11: Revert mesa_enum_ext back to mesa_enum
Values aren't numerically sorted in the XML, so they aren't put
in the value_string in numerical order.  That's a problem for
value_string_ext.

Change-Id: Ie40c5ab1083cc7be140d11dc131e3588759819b7
Reviewed-on: https://code.wireshark.org/review/21128
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-16 16:19:32 +00:00
Michael Mann b88cb66604 X11: Ensure mesa_enum value_string has unique values
Also convert usage to a value_string_ext

Change-Id: Ie515591355879f8eb65faf50e7c04b30cff13519
Reviewed-on: https://code.wireshark.org/review/21124
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-16 02:30:25 +00:00
Michael Mann 731d6e504d x11: proto_tree_add_uint_format -> proto_tree_add_uint_format_value
Change-Id: Ib8b80b2c4a79941cf56d8add783c88d1078f079a
Reviewed-on: https://code.wireshark.org/review/21104
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-15 16:52:18 +00:00
Alexis La Goutte 8b94a664f6 X11: Fix last indent issue on X11 generator
and regenerate X11 dissector

Change-Id: If2c781d346713f5a2a2e97de84c0fedcfd1958af
Reviewed-on: https://code.wireshark.org/review/15944
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-16 03:08:07 +00:00
Jeff Morriss 3749e981aa Support building the X11 dissector outside the source tree.
Use relative path names for the script names and mesa/xcbproto directories so
different paths (from different users) don't cause deltas.

Also, with help from Peter Wu and Graham, get generation of the X11 dissector
working from cmake.

Change-Id: I95cd2a0f973dcbc67f457ff94c28e46a666afb74
Reviewed-on: https://code.wireshark.org/review/12213
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-11-29 11:20:39 +00:00
Alexis La Goutte 2b8caf31cc x11 generator: Fix indent (use always 4 spaces) and add modelines
Change-Id: I91739bb6f4acc4da060cf389ec288ee910965b2a
Reviewed-on: https://code.wireshark.org/review/11113
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-21 12:18:16 +00:00
Jeff Morriss 4a5977b587 X11 generator: avoid extraneous parens in conditionals.
This is to avoid complaints from clang of the form:

wireshark/epan/dissectors/x11-extension-implementation.h:17021:18: error:
equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
        if ((f_class_id == 0)) {
             ~~~~~~~~~~~^~~~

Change-Id: I91d629ad47677b71909d7da517c4a6198c276186
Reviewed-on: https://code.wireshark.org/review/11186
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-20 23:44:06 +00:00
Peter Harris 2bde91330a x11 generator: Support new XCB paramref
Change-Id: I8ae38785bd0f2f81fa2164b5bc29274bd7e940f5
Reviewed-on: https://code.wireshark.org/review/11105
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-10-19 18:24:50 +00:00
Peter Harris 4ff02903a6 x11 generator: Don't crash when a switch is in a struct
The size calculation for the struct will be wrong (too small) which looks
strange in the GUI when the children elements extend past the region
marked by their parent. But it doesn't seem to cause any actual problems,
there is only one request affected by this, and correct size calculation
(by recursing the switch) would take a fair amount of work.

Change-Id: I1847f736153daf59b8dbf3299005a772ffe9673a
Reviewed-on: https://code.wireshark.org/review/11107
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-10-19 14:52:21 +00:00
Peter Harris 0f2eb385f0 x11 generator: Fix struct size with array
my $count here shadows my $count in the outer scope, preventing the size
of constant sized arrays from being calculated correctly.

Change-Id: I89c989ee2d288d4828871ebab650807fbde747dd
Reviewed-on: https://code.wireshark.org/review/11106
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-10-19 14:52:01 +00:00
Peter Harris 31b627fc82 x11 generator: Allow perl 5.20 and newer
Despite promises from the Perl maintainers to remove or at least
drastically change given/when and smartmatch, that still hasn't happened
as of 5.22.

We can cross that bridge when we come to it. Until then, assume they're
never going to break given/when.

Change-Id: If9270bd6fd819d24c58f31f2dfe0d88e831b19fe
Reviewed-on: https://code.wireshark.org/review/11104
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-10-19 14:48:37 +00:00
Jeff Morriss a9fa699d1e x11 generator: some blacklisted structs are now used.
Also, die more gracefully than:

    Can't use string ("1") as a HASH ref while "strict refs" in use at
    ../../tools/process-x11-xcb.pl line 675.
    at ../../tools/process-x11-xcb.pl line 1859
    at ../../tools/process-x11-xcb.pl line 1859

when blacklisted (previously unused) structures start being used in the
xcbproto source.

(It's still not possible to regenerate the X11 dissector but this is a step...)

Change-Id: I1dec16a7a479d5f453c5f54e561aa8238eb21280
Reviewed-on: https://code.wireshark.org/review/10972
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-10-19 14:47:04 +00:00
Guy Harris 8b5a50e2b0 Fix some cases where we're shifting a signed 1 left.
Shift 1U instead, to make sure it's unsigned; the result of, for
example, the result of shifting a signed value left is undefined if the
value times 2^{shift count} doesn't fit in the *signed* type of the
shifted value.  That means, in particular, that the result of shifting 1
left by {number of bits in an int - 1} is undefined.  (In *practice*,
it'll probably be -2^32, with the bit you want set, but that's not
guaranteed, and GCC 5.1 seems not to like it.)

This fixes the *other* generator for the X11 header files; we manually
fix the file in question, because life's too short to spend very much of
it trying to debug Perl issues that cause a

	Can't use string ("1") as a HASH ref while "strict refs" in use at
	../../tools/process-x11-xcb.pl line 675.
	 at ../../tools/process-x11-xcb.pl line 1859
	 at ../../tools/process-x11-xcb.pl line 1859

failure.

Change-Id: I3dd46025b2ae461e63034b36ab11cdbc9380b696
Reviewed-on: https://code.wireshark.org/review/8263
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-01 02:55:29 +00:00
Guy Harris 510777cf78 Fix some cases where we're shifting a signed 1 left.
Shift 1U instead, to make sure it's unsigned; the result of, for
example, the result of shifting a signed value left is undefined if the
value times 2^{shift count} doesn't fit in the *signed* type of the
shifted value.  That means, in particular, that the result of shifting 1
left by {number of bits in an int - 1} is undefined.  (In *practice*,
it'll probably be -2^32, with the bit you want set, but that's not
guaranteed, and GCC 5.1 seems not to like it.)

This fixes the generator for the X11 header files; we manually fix the
header file in question, because life's too short to spend very much of
it trying to debug Perl issues that cause a

	Can't use string ("1") as a HASH ref while "strict refs" in use at
	../../tools/process-x11-xcb.pl line 675.
	 at ../../tools/process-x11-xcb.pl line 1859
	 at ../../tools/process-x11-xcb.pl line 1859

failure.

Change-Id: Ia903e9dacad49021bc0dfe129b9393ad426de9eb
Reviewed-on: https://code.wireshark.org/review/8261
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-01 00:53:53 +00:00
Stephen Fisher 0df4eecd55 Add parenthesis around some generated code so it compiles. This new
code only shows up when the X11 dissector is updated from the latest
xcbproto & mesa, which I will commit real soon now (RSN).

Change-Id: Ic750df3b4406f107fd850ade891ee093054c8d6d
Reviewed-on: https://code.wireshark.org/review/5882
Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-19 20:28:14 +00:00
Stephen Fisher 398c2cee9c Skip over the new 'switch' field in xproto/src/xinput.xml so we can
re-generate the x11 dissector again without the script breaking.

Change-Id: I6d24cf098f370f4c1ff191052e2ea67b7875b33a
Reviewed-on: https://code.wireshark.org/review/5878
Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-19 17:05:35 +00:00
Stephen Fisher d3a4d926d0 Put a colon after the error message and before the field the error
is referring to for clarity.

Change-Id: I7930e851647c847335b91435c7b0871c6db2defe
Reviewed-on: https://code.wireshark.org/review/5847
Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-19 04:17:19 +00:00
Stephen Fisher 23987b4ba5 Add a comment to each of these scripts to say that
epan/dissectors/README.X11 has instructions for running them.

Change-Id: Id3c1df1bf1f50b19372b9a0470822da9ca6504f7
Reviewed-on: https://code.wireshark.org/review/5846
Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-19 03:51:12 +00:00
Peter Harris 331d87e303 X11: Support xcb's new <case>
Change-Id: I32c6ab15d6dc7a67cdb50c4187e2752730315588
Reviewed-on: https://code.wireshark.org/review/3751
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-08-22 00:04:52 +00:00
Peter Harris 515b78c292 X11: Support XCB's new <pad align='n' />
Change-Id: I0a45380ffcfb3be7e3190d0875626ed0fe046c4e
Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-on: https://code.wireshark.org/review/2147
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-06-12 13:36:21 +00:00
Jeff Morriss 5a1aa01af2 Get rid of a few more Subversion remnants.
Change-Id: I35ff651017e355f92b4f9e6388e90d446f245d0a
Reviewed-on: https://code.wireshark.org/review/361
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-25 18:05:08 +00:00
Jeff Morriss 82e2865739 Remove $Id$ and other Subversion leftovers from the tools.
There are a few things in here which could still use attention.

Don't regenerate anything now.

Change-Id: I283c224d3523212144707fca3d6265916cb11792
Reviewed-on: https://code.wireshark.org/review/205
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-02-14 01:35:57 +00:00
Jeff Morriss 6762f7e0c8 Some patches from Peter Harris:
[PATCH 1/5] X11 dissector: Sort declarations
This prevents pointless changes showing up in the diff when evaluating
unrelated changes to the generator.

See http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Hash_randomization

[PATCH 2/5] X11 dissector: Silence warnings on perl 5.18, prevent 5.20
Perl 5.18 retroactively marked "given/when" experimental, with a
promise to remove or dramatically change it in 5.20.

Since there is no perl 5.20 yet, there is no way to make this script
compatible with it.

[PATCH 3/5] X11 dissector: Support variable_param (at least for glCallLists)
(This patch makes the change in r54232 unnecessary by using the previously-
unused variable.)

[PATCH 4/5] X11 dissector: Remove obsolete TODO item
This item was done in r53531 PATCH 09/11

svn path=/trunk/; revision=54242
2013-12-19 02:32:21 +00:00
Gerald Combs 5385c2d5f8 Instead of assigning a variable to itself, avoid unused warnings similar
to the Q_UNUSED macro.

svn path=/trunk/; revision=54232
2013-12-18 20:53:01 +00:00
Jeff Morriss a98072967e Fix checkAPIs: don't try to feed VALS() into FT_BOOLEANs.
Also, as per Peter Harris' request, update copyright date.

svn path=/trunk/; revision=53545
2013-11-24 14:27:52 +00:00
Jeff Morriss a434d9647e Some patches from Peter Harris to make it possible to build the X11 dissector
again (and some various other improvements):

Rebuild the dissector with the latest xcbproto and mesa.


Subject: [PATCH 01/11] X11 dissector: Support CARD64 and INT64 types
These types are used by the new Present extension.

Subject: [PATCH 02/11] X11 dissector: Un-blacklist a few structures
The xinput structs are used by the latest xcb/proto, and the xkb
struct has been removed.

Subject: [PATCH 03/11] X11 dissector: Add hack for xinput:ChangeProperty
xinput:ChangeProperty should use switch/case, but only switch/bitcase
is supported at the moment. Add (hopefully temporary) hack.

Subject: [PATCH 04/11] X11 dissector: Use namespace for types
In particular, the name of the xsync struct 'INT64' collides with a
basic type of the same name.

Subject: [PATCH 05/11] X11 dissector: Add support for "Generic" events
All new extensions are using the new "Generic" events instead of
traditional events, because there aren't enough traditional event
numbers.

Denoted by <event xge="true"> in xcb/proto.

Subject: [PATCH 06/11] X11 dissector: Blacklist unused structures

Subject: [PATCH 07/11] X11 dissector: Support multiple enumref in a bitcase
XKB is weird.

Subject: [PATCH 08/11] X11 dissector: Support sumof

Subject: [PATCH 09/11] X11 dissector: Stop generating unused-but-set variables
(This patch also reverts r53298/r53299.)

svn path=/trunk/; revision=53531
2013-11-24 01:32:20 +00:00
Jeff Morriss 38eac2f54f Wrap GCC pragma in an #ifdef to make it compile when we're not using GCC.
Again, change manually applied to the .h file.

svn path=/trunk/; revision=53299
2013-11-13 14:00:45 +00:00
Jeff Morriss 8893d3d960 Use a gcc pragma to stop the (pages of) warnings coming out of
x11-extensions-implementation.h .

This change was manually applied to the .h file as I can't currently rebuild
the X11 dissector.

svn path=/trunk/; revision=53298
2013-11-13 03:20:37 +00:00
Michael Mann da96b71c95 Add filterable expert info to generated X11 dissector. I didn't regenerate the dissector files, but did manually update the source (tools/process-x11-xcb.pl) so any future regeneration won't lose the changes.
svn path=/trunk/; revision=51834
2013-09-08 13:54:07 +00:00
Jakub Zawadzki b18e880040 Update FSF address - part II.
svn path=/trunk/; revision=43538
2012-06-28 23:18:38 +00:00
Guy Harris f354e31304 A routine that processes a struct_XXX() won't necessarily use its
encoding argument; mark it as (potentially) unused.

svn path=/trunk/; revision=42609
2012-05-12 23:00:15 +00:00
Guy Harris 3896fea6c0 Get rid of remaining Booleans-as-encoding-arguments in
proto_tree_add_item() calls.

Updated tools/process-x11-xcb.pl to support different encoding values
for different fields.  Replaced the "little_endian" Boolean value with a
"byte_order" value containing the setting of the byte-order ENC_ bit. 
Regenerated X11 fields from current x.org git.

svn path=/trunk/; revision=42601
2012-05-12 20:07:08 +00:00
Jeff Morriss 9c3bbf44c1 From Peter Harris:
An enum name collision was recently added to the upstream XCB/proto.
Avoid the collision by putting enum names into their proper namespace.


After applying that, regenerate the X11 dissector.

svn path=/trunk/; revision=41514
2012-03-13 00:07:34 +00:00
Jeff Morriss cca3ba3ce2 (Refining the regexp...) Replace blurbs that match the name (case insensitive) with NULL.
svn path=/trunk/; revision=34230
2010-09-24 02:51:40 +00:00
Jeff Morriss 584595fab3 From Peter Harris via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4820 :
Mesa moved its API description file again.

Also, while I'm here, I noticed that they stopped using signed tags, so add
--tags to "git describe" for a better description of the mesa version used to
build the X11 dissector.

svn path=/trunk/; revision=33067
2010-06-03 02:05:52 +00:00
Jeff Morriss ea25410415 From Peter Harris via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4481 :
The XKEYBOARD extension is a pain in the... so XCB had to grow new ways to
describe the protocol.

This patch adds support to the Wireshark dissector, so it can successfully
process the XCB description of the XKEYBOARD extension.

Without this patch, "make x11-dissector" chokes on the current xcbproto from
git.

Also update the script to deal with the new mesa directory structure.

svn path=/trunk/; revision=32520
2010-04-20 00:18:51 +00:00
Jeff Morriss 37aa66532a From Peter Harris via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4067 :
This patch adds enum support to x11-process-xcb.pl

svn path=/trunk/; revision=30257
2009-10-03 01:56:10 +00:00
Jeff Morriss ee8f078374 Move all of the scripts in epan/dissectors/ to tools/ .
Add a target ("x11-dissector") to build the X11 dissector.

Put the X11-related files (back) in the source distribution.

svn path=/trunk/; revision=29871
2009-09-12 23:02:34 +00:00