Commit Graph

103 Commits

Author SHA1 Message Date
Petr Gotthard b0eee2e4fc AMQP 0-9-1: More expert information
A little usability improvement: Warn user on connection and channel
errors and when a message is undeliverable.

Change-Id: I6106a63472b1fb5cbbabcf82a90af0f489030458
Reviewed-on: https://code.wireshark.org/review/10573
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>
2015-09-19 08:18:40 +00:00
Guy Harris 2ba0ea3722 Fix the conversion of milliseconds to seconds and nanoseconds.
1 millisecond = 1000000 nanoseconds, not 1000 nanoseconds, and
nstime->nsecs is nanoseconds, not microseconds.

Change-Id: I6925ff80f6443015f83ca00bad2a347d10eadd7c
Reviewed-on: https://code.wireshark.org/review/10060
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-08-16 19:34:50 +00:00
Petr Gotthard 8b8d37801c AMQP 1.0: Fix OSX build errors
packet-amqp.c:10660: warning: implicit conversion shortens 64-bit value into a 32-bit value
packet-amqp.c:10661: warning: implicit conversion shortens 64-bit value into a 32-bit value

Change-Id: Ic1c19edf10432dccb5fc4f3ea07defd45b9eef17
Reviewed-on: https://code.wireshark.org/review/10054
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-08-16 17:57:28 +00:00
Petr Gotthard b1d33db258 AMQP 1.0: Refactor to fix parsing of timestamps
Timestamps are currently dissected as integer numbers; two aspects need to
be recatored to correctly dissect timestamps:
 - the add_1_0_proto_item() function
 - protocol fields (hf_xxx) and the get_amqp_1_0_value_formatter()

(1)
The AMQP 1.0 dissector rely on the proto_tree_add_item. There is only one
invocation common for all datatypes (in add_1_0_proto_item), which cannot
pass any type-specific ENC_xxx specifiers and it cannot handle custom
datatypes like AMQP timestamp.

I propose to replace the add_1_0_proto_item() by type-specific dissectors that
will correctly set the ENC_xxx specifiers and handle exceptional cases like
the AMQP timestamp or the zero-length true/false datatypes.

(2)
The get_amqp_1_0_value_formatter implements a table-driven magic to select
alternate hf_xxx field based on the actual datatype. This however
 - defines alternate fields where the standard permits only one datatype
 - does not support fields that can contain any datatype ("*")
 - does not support FT_TIMESTAMP

I propose to make this mechanism less table-driven (more explicit and more
flexible) and allow all alternates permitted by the standard.

Change-Id: Ib2cbda632d4c81ec3e6b81f539fe77bb913afc1c
Reviewed-on: https://code.wireshark.org/review/9528
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-08-16 13:00:41 +00:00
Petr Gotthard a7f2b7f1de AMQP 1.0: Fix dissection of UUID datatypes
Set a correct data length: 16-bytes, not 1-byte. And use the
standard function to print the uuid.

Change-Id: Ic4cc8d8de3f469e43664fbd7f6eb89083dc83be6
Reviewed-on: https://code.wireshark.org/review/8905
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-12 13:18:50 +00:00
Petr Gotthard 70fa77f1a3 AMQP 1.0: Don't treat decimal[32|64|128] as packet errors
Packets with a decimal datatype should be correctly dissected.
Yet, we still cannot display the decimal floating-point numbers as
there is no support in printf and glib.

Change-Id: I48a6dafd1e12ab55f660fad37a759dd16a9cf4b1
Reviewed-on: https://code.wireshark.org/review/8902
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-12 13:16:38 +00:00
Petr Gotthard 7a927d60d4 AMQP 1.0: float/double should be in network byte order
The standard says that (unless otherwise specified) AMQP uses
network byte order for all numeric values.

Change-Id: I3ca154a6fb882d9194a9af891f92f760aae776eb
Reviewed-on: https://code.wireshark.org/review/8889
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-11 17:37:10 +00:00
Petr Gotthard 74421b35c2 AMQP 1.0: 'char' should be 4-bytes UTF32
Change-Id: I219b65fd989e1811eda9e2b7197148e6b22ef97a
Reviewed-on: https://code.wireshark.org/review/8887
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-11 17:35:06 +00:00
Alexis La Goutte a36ec5a0bb AMQP: fix The 'format_name' variable is assigned to itself found by PVS Studio (V570)
Change-Id: I97cdfc20cc635bccea5c96db33f46cdd970e933a
Reviewed-on: https://code.wireshark.org/review/8785
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Petr Gotthard <petr.gotthard@centrum.cz>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-08 17:33:58 +00:00
Petr Gotthard 4e32899f6c AMQP: Introduce support for AMQP over TLS/SSL (AMQPS).
Modified dissect_amqp to the new-style dissector.
Added amqp.ssl.port to protocol preferences.
Registered the AMQP dissector with SSL.

Fixed an error in dissect_amqp that appeared when the first segment was smaller
than the minimum header size required to determine the protocol version (8b).

...plus enhanced the AMQP 0-9-1 to display also the protocol id,
so the packets list shows "0-9-1" instead "9-1".

Change-Id: Ia44e0791b6ee78ad594de342c4f2401bad9beb4e
Reviewed-on: https://code.wireshark.org/review/7044
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Petr Gotthard <petr.gotthard@centrum.cz>
Tested-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-03-03 12:34:08 +00:00
Petr Gotthard 55eb35adc0 AMQP: Fix one warning from Clang Code Analysis
Since 'values' is always 'length/4', we can have it as 'gint' and avoid
the Clang warning concerning the while cycle.
>> cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations]

Change-Id: I4342f9e3fcd5df7779f41414ab6f789fe402e3af
Reviewed-on: https://code.wireshark.org/review/6979
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-02-06 12:32:07 +00:00
Petr Gotthard eb855554b6 AMQP: Add more COL_INFO description for some packets/frames.
Change-Id: If70dc3972d99d34d8e37dd26045076e515fd4d2c
Reviewed-on: https://code.wireshark.org/review/6968
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-02-06 12:30:02 +00:00
Alexis La Goutte 383caa72cf AMQP: Fix Dead Store (Dead assignement/Dead increment) warning found by Clang
Change-Id: Ie55dd06b6c4d6f77012e8e13079279ded2997907
Reviewed-on: https://code.wireshark.org/review/6920
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-03 01:12:22 +00:00
Alexis La Goutte 37a2cd0e84 AMQP: fix declaration of 'index' shadows a global declaration
St*** Mac OS X buildbot...

Part 2 (Oups...)

Change-Id: I082d73d4581365d7152aca764e4dfe599ce12c64
Reviewed-on: https://code.wireshark.org/review/6923
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-02-02 22:00:03 +00:00
Alexis La Goutte 0b2c8b044c AMQP: fix declaration of 'index' shadows a global declaration
St*** Mac OS X buildbot...

Change-Id: I5efff34ce818f52fb6414191c58b5cabb388ba26
Reviewed-on: https://code.wireshark.org/review/6922
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-02-02 21:46:50 +00:00
Petr Gotthard c96b3ac999 AMQP 0-9-1: Fix dissection of field types.
This patch resolves review comments I received from the AMQP 0-9-1 community.
Some field types were not implemented, other field types (introduced by my
earlier patch) were incorrectly parsed.
https://groups.google.com/forum/#!topic/rabbitmq-users/PR7P1bgonwo

I had to split the dissect_amqp_0_9_field_table() function into two parts
and put the field value dissectors in a separate function:
dissect_amqp_0_9_field_value().

Change-Id: I9aa7d73e426a790830ad260ca6892a7650791e6c
Reviewed-on: https://code.wireshark.org/review/6882
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-02-02 20:59:37 +00:00
Petr Gotthard a30022784a AMQP 0-9-1: Add missing methods connection.block and connection.unblock.
Change-Id: I11b32b876ec0f43b1faa2ab40ab66e7f18d981c2
Reviewed-on: https://code.wireshark.org/review/6857
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-02-01 07:25:13 +00:00
Guy Harris 25f1df4459 "%l[doux]" doesn't mean "64-bit integer".
Use G_GINT64_MODIFIER as the format modifier to indicate that the value
being printed is 64-bit; there is no guarantee that long is 64-bit (it's
not 64-bit on ILP32 platforms such as 32-bit Windows and 32-bit UN*X, or
even on LLP64 platforms such as 64-bit Windows).

Change-Id: I0444f7f396969824f1040c06a67753718c32881b
Reviewed-on: https://code.wireshark.org/review/6838
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-28 21:06:02 +00:00
Petr Gotthard 9e647a96b6 Extended AMQP 0-9 dissector to support AMQP 0-9-1 methods and datatypes. Backward compatibility to AMQP 0-9 is maintained.
Change-Id: Ie39cb40dca3d9f778ef2c04cbef24c968a91ec6c
Reviewed-on: https://code.wireshark.org/review/6791
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>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-01-28 20:01:17 +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
Petr Gotthard cce3ad281e Correctly dissect the AMQP 0-9 heartbeat frames. The heartbeat frames were
incorrectly highlighted as erroneous.

Change-Id: I94f8ef73e2432543ae3965da3789f27e872951ea
Reviewed-on: https://code.wireshark.org/review/6685
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-23 13:15:56 +00:00
Michael Mann 64a7bac641 tvb_bytes_to_ep_str -> tvb_bytes_to_str
Change-Id: I79c613cbdd8dc939dd4c29ebc477fb6eefd5bfc4
Reviewed-on: https://code.wireshark.org/review/6371
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07 18:16:23 +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 c44ff776c4 amqp: Misc changes;
- amqp_1_0_dissectiom: Use MIN(32-bit-length, 0xFFFF) as the length to dissect;
  The original code just used the low-order 16 bits of the 32-bit length
  field  as the length to dissect.
  Add an expert warning if the actual PDU length is > 65K.

- tvb_length() --> tvb_reported_length()

Change-Id: I3230600f460a8bd495eeec17fa6e704bf24de1a2
Reviewed-on: https://code.wireshark.org/review/5225
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-11-10 20:15:51 +00:00
Guy Harris 3428e809dd Don't forward-declare amqp_0_10_get_size_field(), as it no longer exists.
Change-Id: I796826bafd0768b610c9afbde8407fd9d3cc775e
Reviewed-on: https://code.wireshark.org/review/5180
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-07 23:17:26 +00:00
Bill Meier 8f62bb7cce amqp: handle potential overflows when dissecting amqp_0_10 PDUs;
Bug: 10582
Change-Id: I2fbb16b9d641dfe872aed468f8b944f7ef274261
Reviewed-on: https://code.wireshark.org/review/5176
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-11-07 21:53:58 +00:00
Bill Meier 9ac261f205 amqp: Fix a number of bugs in dissect_amqp_0_10_map().
(Among other things: "2 ^ xxx" is *not* 2 to the xxx'th power).

Change-Id: I893b72e853ecbb5d7e6259e950fb347e89eed6c2
Reviewed-on: https://code.wireshark.org/review/5109
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-11-04 16:22:37 +00:00
Bill Meier 8def8ef9c4 packet-amqp.c: Temporary/preliminary fix for Bug #10582 (crash)
This is a temporary/preliminary fix to prevent the buildbot fuzz-test
 failures seen when testing the capture file attached to Bug #10582.

As noted in the bug, a complete fix will require some reworking of
  the amqp dissector.

Change-Id: I2571f1eeb46a7eede04b8d809e87b95f1ff529df
Reviewed-on: https://code.wireshark.org/review/4835
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-19 14:14: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
Michael Mann 3fa5625ea0 Eliminate proto_tree_add_text from some dissectors.
Change-Id: Ib6024307e85d6c23decf40e9759f549c19ffe136
Reviewed-on: https://code.wireshark.org/review/3318
Petri-Dish: Michael Mann <mmann78@netscape.net>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-03 16:29:16 +00:00
Michael Mann 188aa9a80e convert to proto_tree_add_subtree[_format]
Change-Id: Ib60ca75b7da8cfa21cfe2999c9b9448a02c332df
Reviewed-on: https://code.wireshark.org/review/2560
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-22 21:07:16 +00:00
Michael Mann b98dc77cde Cleanup filter fields that checkdisplayfilter.pl was complaining about.
Cleaned up filter names that were shared, but had different types (which can cause problems in a display filter compare)

Also cleaned up many [FIELDDESCR] that effectively mimicked the field name.  Even more could probably be done (and/or rename field name to be more descriptive), but I was being conservative.

Change-Id: I2e072b4f411c390b9430a0a0d903133d6decae5e
Reviewed-on: https://code.wireshark.org/review/2448
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-19 22:18:35 +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
Pavel Moravec d84b683bac Add AMQP listening port option to preferences
Change-Id: Ief46b7b53ddecd649e54d3c23a3504c4165c812f
Reviewed-on: https://code.wireshark.org/review/1855
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-30 20:01:00 +00:00
Pascal Quantin bc15fad105 AMQP: always display its name in protocol column, whatever the protocol version
Bug: 10101
Change-Id: I41105b250384bd44c37c0707ad41c9d76700bc75
Reviewed-on: https://code.wireshark.org/review/1641
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-05-14 18:53:03 +00:00
AndersBroman ce527ba58d Try to fix trivial varnings
Change-Id: I7b09999fe34ffded73f0b26c3e561b39d2120643
Reviewed-on: https://code.wireshark.org/review/714
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-17 15:57:55 +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
Evan Huus dab27680cd From Pavel Moravec via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9612
Fix possibly-uninitialized variable caught by valgrind fuzzing in AMQP.

svn path=/trunk/; revision=54981
2014-01-27 13:42:34 +00:00
Evan Huus 893b1aa3cd Remove duplicate #include.
svn path=/trunk/; revision=54928
2014-01-23 13:39:39 +00:00
Guy Harris 222296999b Use tvb_get_string_enc() with appropriate encodings rather than
tvb_get_string().  (Some versions of the spec speak of ISO 8859-15
strings as well as UTF-8 strings, but we don't appear to try to handle
those.)

Update spec URL.

svn path=/trunk/; revision=54910
2014-01-22 20:51:56 +00:00
Alexis La Goutte a3fee176d4 Fix Dead Store (Dead assignement/Dead increment) warning found by Clang
svn path=/trunk/; revision=54902
2014-01-22 07:49:48 +00:00
Guy Harris 1d27123ab1 Longs are not guaranteed to be 64-bit. Use G_GINT64_MODIFIER to format
64-bit quantities.

svn path=/trunk/; revision=54863
2014-01-20 21:37:32 +00:00
Evan Huus 77e4a2f09c Fix 32/64 casting and add a note where the loss of precision might actually be a
problem for 32-bit platforms.

svn path=/trunk/; revision=54858
2014-01-20 19:32:43 +00:00
Evan Huus f5931c7559 From Pavel Moravec via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9612
AMQP 1.0 Dissector

svn path=/trunk/; revision=54857
2014-01-20 19:13:42 +00:00
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Jakub Zawadzki c45475ab45 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54135
2013-12-15 23:44:12 +00:00
Jakub Zawadzki ae59b09443 Add missing includes in order to remove exceptions.h from proto.h (next commit).
svn path=/trunk/; revision=53230
2013-11-10 15:59:37 +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 a0c53ffaa1 emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly

svn path=/trunk/; revision=52172
2013-09-22 15:50:55 +00:00