Commit Graph

55 Commits

Author SHA1 Message Date
Dmitry Lazurkin ced54aeb06 kafka: add expert info about unsupported api key and version
Change-Id: I622e6f06529377e089cbeeb83d926135f983d3f3
Reviewed-on: https://code.wireshark.org/review/19194
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-12-17 22:54:55 +00:00
Martin Mathieson 74bc8f8bc6 Add a preference to control whether string and byte lengths appear in protocol tree
Change-Id: I6be13d9adb8871cbbf4604155e8e7175a74ddaa3
Reviewed-on: https://code.wireshark.org/review/19188
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dmitry Lazurkin <dilaz03@gmail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-12-10 23:33:17 +00:00
Dmitry Lazurkin 548b9febb3 kafka: add dissection for rest of api keys
- support rest of api keys
- dissect kafka.required_acks with constants
- dissect kafka.message_timestamp_type
- add expert info about missing request

Change-Id: I3d18936adac6702a61f545385bdec1b75b564bd9
Reviewed-on: https://code.wireshark.org/review/18954
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-12-05 21:45:18 +00:00
Michael Mann fb9a356e46 Add prefs_get_uint_value and prefs_get_range_value
This allows dissectors to not need to know about the internal preference structure.

Change-Id: I1ae67248cd0b0132aefc225ea0a9befaf9afdde2
Reviewed-on: https://code.wireshark.org/review/18864
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-11-22 16:47:47 +00:00
Martin Mathieson bb4ecec2d0 Kafka: show API versions in root, and don't show bogus size for GZIP messages.
Change-Id: Ib8182537a791ed24bcc417594713dd6c206ce0ce
Reviewed-on: https://code.wireshark.org/review/18885
Reviewed-by: Dmitry Lazurkin <dilaz03@gmail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-11-21 20:04:58 +00:00
Martin Mathieson 7ecbad89a9 kafka: fix mac build breakage by adding int cast
Change-Id: Ic57d49f7408f041b60b719a3da4971c499122930
Reviewed-on: https://code.wireshark.org/review/18888
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-11-20 11:41:32 +00:00
Dmitry Lazurkin 4eb61deedc kafka: Update supported api keys to latest spec
Details:
- update supported api keys
- add api key ApiVersions
- change api key names according to documentation
- add pcapng files for supported api keys
- add new documentation link
- add declaration of lz4 message codec

Change-Id: I943dc31144890dcd3dd333981a86754668c2bec4
Reviewed-on: https://code.wireshark.org/review/18861
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-11-19 22:11:03 +00:00
Pascal Quantin dbb391a646 Kafka: add Snappy decompression support
Change-Id: Ida8d941809a4e0f2fd4d9f142363187a757d0278
Reviewed-on: https://code.wireshark.org/review/18288
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-10-19 12:55:17 +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
Dario Lombardo 6b4e9707f0 kafka: remove unused assignment.
Found by valgrind:

==21035== 12 bytes in 1 blocks are definitely lost in loss record 279 of 2,696
==21035==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==21035==    by 0xAAA2728: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
==21035==    by 0x72A361F: range_convert_str_work.part.0 (range.c:109)
==21035==    by 0x6AACBEC: proto_register_kafka (packet-kafka.c:1459)
==21035==    by 0x71BA055: register_all_protocols (register.c:2769)
==21035==    by 0x7296E67: proto_init (proto.c:529)
==21035==    by 0x7272A76: epan_init (epan.c:128)
==21035==    by 0x1160F2: main (tshark.c:804)
==21035==

Change-Id: I3249925acd3ed26d40be992fd228447d1b381b66
Reviewed-on: https://code.wireshark.org/review/16880
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2016-08-04 20:56:29 +00:00
Martin Mathieson fec1061ce0 Kafka: pass api_version to response and start to use it
Change-Id: Idc43e37d113e5b598cd5b1a8875ede335f9534de
Reviewed-on: https://code.wireshark.org/review/15776
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2016-06-08 13:33:06 +00:00
Martin Mathieson 75731e68e5 Kafka: add more error codes
Change-Id: Idcbe44bfe0730e42a30107414a7912a6aa50f411
Reviewed-on: https://code.wireshark.org/review/15757
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-06 21:58:52 +00:00
Martin Mathieson d37734256c Kafka: several minor improvements
Use a range preference for TCP ports rather than single value.
Show interesting values in tree roots and/or the Info column.
Use common functions to dissect some protocol fields.

Change-Id: I9f5ca2565f47fc84d9c82a31511fae813542482e
Reviewed-on: https://code.wireshark.org/review/14949
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-04-20 20:16:22 +00:00
Guy Harris 099698445b Move the proto data stuff out of frame_data.[ch].
It's not tied to the frame_data structure any more, so it belongs by
itself.

Clean up some #includes while we're at it; in particular, frame_data.h
doesn't use anything related to tvbuffs, so don't have it gratuitiously
include tvbuff.h.

Change-Id: Ic32922d4a3840bac47007c5d4c546b8842245e0c
Reviewed-on: https://code.wireshark.org/review/13518
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-25 02:24:34 +00:00
Guy Harris bc5a0374bf Add the packet number to the packet_info structure, and use it.
That removes most of the uses of the frame number field in the
frame_data structure.

Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22
Reviewed-on: https://code.wireshark.org/review/13509
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-24 03:41:28 +00:00
Michael Mann 443a7ed259 new_create_dissector_handle -> create_dissector_handle for dissector directory.
Some of the ASN.1 dissectors still generate a new_create_dissector_handle from the tool itself, so leave those for now.

Change-Id: Ic6e5803b1444d7ac24070949f5fd557909a5641f
Reviewed-on: https://code.wireshark.org/review/12484
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 12:37:36 +00:00
Evan Huus 1bc4091898 kafka: misc minor tweaks
Use the new request/response framenum hints. Replace some deprecated APIs.

Change-Id: Ia58c49da7e12d01477dadfc7f5a42b152730dc71
Reviewed-on: https://code.wireshark.org/review/7547
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-03-05 21:34:29 +00:00
Evan Huus cc66f68c75 kafka: fill in some expert info
Change-Id: I94e655fc56fd1534d57f6917d9e5f4189e08838a
Reviewed-on: https://code.wireshark.org/review/6858
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-01-30 18:55:44 +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
Martin Mathieson 86ed26f0b8 Deleting unnecessary #includes from dissectors.
Third batch (packet-icmpv6.c -> packet-mac-lte.c).

Will look at cleaning up and committing script afterwards.

Change-Id: Ib91e36ad200db01c3000605f6a7a21125b96a640
Reviewed-on: https://code.wireshark.org/review/6018
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-23 14:44:28 +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
Evan Huus 43a21c810a kafka: summarize number of messages in a set
Change-Id: I62873a147426079aa4890289320c43ef7f1b26dc
Reviewed-on: https://code.wireshark.org/review/4877
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-10-20 21:49:25 +00:00
Evan Huus d86b308fd4 kafka: compression codec is unsigned
Change-Id: I238e93dd035caa359fed768aa2aac4df5a0ef47e
Reviewed-on: https://code.wireshark.org/review/4875
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-10-20 15:04:30 +00:00
Michael Mann d68d0e88b4 Eliminate proto_tree_add_text from some dissectors.
Other minor cleanup while in the neighborhood.

Change-Id: If73a029f564219782c313d4154c24c7ce7458b52
Reviewed-on: https://code.wireshark.org/review/3574
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>
2014-08-14 04:21:05 +00:00
Evan Huus a3bac6d0ce kafka: fully dissect offset request/response messages
Change-Id: I641a3dbece6f822144f6740dde6801b1be202db5
Reviewed-on: https://code.wireshark.org/review/2777
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-02 17:29:55 +00:00
Michael Mann dd63ae2b8c proto_tree_add_subtree[_format]
Change-Id: Id00f456479415adf0a219af6c9a2108d4b3642d0
Reviewed-on: https://code.wireshark.org/review/2702
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-29 21:18:04 +00:00
Evan Huus 2a1e3d16aa Fix two bugs in kafka dissection
- Respect the length field when dissecting message sets
 - Don't "wrap around" in capture when doing request/response matches

Also convert one instance to proto_tree_add_subtree, as an experiment.

Change-Id: Id161687865afa7ca83e6943a643bc54582f65554
Reviewed-on: https://code.wireshark.org/review/2624
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-24 21:59:41 +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
Michael Mann 73217d9f3f tvb_new_subset -> tvb_new_subset_length when length parameters are equal.
tvb_new_subset -> tvb_new_subset_remaining it appears that's what the intention is.

Change-Id: I2334bbf3f10475b3c22391392fc8b6864454de2d
Reviewed-on: https://code.wireshark.org/review/1999
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-07 15:41:07 +00:00
Evan Huus 83528805ad Recognize kafka's ConsumerMetadata message type
actual dissection still TODO

Change-Id: I58e54ca117a9ccd5d6af34d18f9277afd009aa95
Reviewed-on: https://code.wireshark.org/review/1547
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-08 02:15:40 +00:00
Evan Huus c0fbe0d832 Update kafka dissector closer to latest spec
Some new error values, some message types that have been "undocumented" as
internal-only, etc.

Change-Id: Iff15dd67b188c9e2745964d4916b22e0bea4243d
Reviewed-on: https://code.wireshark.org/review/1533
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-06 19:25:36 +00:00
Evan Huus b3350ed946 Update kafka OffsetFetchResponse dissection
Per https://github.com/Shopify/sarama/pull/77 the spec is out of date, there is
no longer a clientID field in certain messages.

Change-Id: Ieeb7b8f1dd32b326b3d9507e3d5897574a1b09fd
Reviewed-on: https://code.wireshark.org/review/1043
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-09 22:42:14 +00:00
Evan Huus 8d9c45d965 Update some Kafka API constants per lastest spec
Change-Id: Icef981f50e81e5059916e3bde5fa8a1e1fcd92ae
Reviewed-on: https://code.wireshark.org/review/1033
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-04-09 07:53:35 +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 82112c8ea3 The payload of a compressed Kafka message is supposed to be itself a
message-set, so dissect it as such. I don't have a capture demonstrating this
at the moment, but it ought to work.

svn path=/trunk/; revision=54303
2013-12-20 15:14:52 +00:00
Evan Huus 1feb5f00c1 Simplify dissect_kafka_metadata_request() to not add an unnecessary tree and
match the rest of the protocol dissection in style.

svn path=/trunk/; revision=54301
2013-12-20 15:03:08 +00:00
Jeff Morriss c3de9c6311 As pointed out in http://ask.wireshark.org/questions/28304/questions-on-packet-kafkac :
ett_kafka_metadata_topics is defined (and registered) but not used.  Use it.

svn path=/trunk/; revision=54294
2013-12-20 14:28:16 +00:00
Jakub Zawadzki c45475ab45 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54135
2013-12-15 23:44:12 +00:00
Bill Meier ebaeed5a1f (Trivial)
- Fix indentation to match editor modelines (tabs-->spaces);
 - Rework/add some whitespace;

svn path=/trunk/; revision=53978
2013-12-12 20:16:30 +00:00
Michael Mann 9b7fb8a811 Create the ability to have packet scoped "proto" data. Bug 9470 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9470)
I'm not sold on the name or module the proto_data functions live in, but I believe the function arguments are solid and gives us the most flexibility for the future.  And search/replace of a function name is easy enough to do.

The big driving force for getting this in sooner rather than later is the saved memory on ethernet packets (and IP packets soon), that used to have file_scope() proto data when all it needed was packet_scope() data (technically packet_info->pool scoped), strictly for Decode As.

All dissectors that use p_add_proto_data() only for Decode As functionality have been converted to using packet_scope().  All other dissectors were converted to using file_scope() which was the original scope for "proto" data.

svn path=/trunk/; revision=53520
2013-11-23 02:20:13 +00:00
Evan Huus b13c1b7093 The kafka compression codec is only 2 bits, not 3.
svn path=/trunk/; revision=53309
2013-11-13 23:47:57 +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
Evan Huus 233c409184 Dissect Kafka "fetch" requests and responses.
svn path=/trunk/; revision=52909
2013-10-27 23:08:01 +00:00
Jeff Morriss 4cfc0f27cb Kafka's CRC is 4 bytes long and is added with ENC_BIG_ENDIAN. Make the hf
FT_UINT32 instead of FT_BYTES to match.

svn path=/trunk/; revision=52845
2013-10-25 14:41:12 +00:00
Jeff Morriss 3440dd73f2 Fix CID 1080758: be prepared for tvb_child_uncompress() failing (and returning
NULL).

svn path=/trunk/; revision=52844
2013-10-25 14:38:39 +00:00
Evan Huus feb39701c5 Decompress gzipped Kafka messages.
svn path=/trunk/; revision=51726
2013-09-03 16:43:08 +00:00
Alexis La Goutte ca31e9d76a Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=51660
2013-09-02 23:11:50 +00:00
Evan Huus acfbd6d680 Dissect all the fields in kafka produce request/response pairs. All of the
helpers should be in place for the other message types now.

svn path=/trunk/; revision=51648
2013-09-02 17:46:47 +00:00
Evan Huus c4befc8a7a Decode Kafka metadata requests and responses.
svn path=/trunk/; revision=51239
2013-08-09 15:37:07 +00:00