aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-protobuf.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-19Protobuf: add dissecting protobuf fields as wireshark fields preferences, etc.Huang Qiangxiong1-7/+334
Two enhancements and one fixed bug: 1. Add dissecting protobuf fields as wireshark (header) fields preferences. User can input the full names of protobuf fields or messages in Filter toolbar for searching. 2. Add 'protobuf_field' dissector table. Dissector based on protobuf can register itself to 'protobuf_field' keyed with the full names of fields of BYETS or STRING types. 3. A bug about search MESSAGE or ENUM type in context is fixed. 4. Another small enhancement is adding prefs_set_preference_effect_fields() which can mark a preference that affects fields change (triggering FieldsChanged event). See the linked bug for sample capture file and .proto files. Ping-Bug: 16209 Change-Id: Ibc3c45a6d596a8bb983b0d847dd6a22801af7e04 Reviewed-on: https://code.wireshark.org/review/35111 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-22Protobuf: for UDP frames, show top-level summary in columns.Martin Mathieson1-13/+64
Will show PB(<message_name>) in Protocol column, and details of top-level message elements in the Info column. Change-Id: Ia00fb90bb7ec990300a990555a0ab6fbddf01ef9 Reviewed-on: https://code.wireshark.org/review/34822 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Huang Qiangxiong <qiangxiong.huang@qq.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-14Protobuf: Add show_details preferences. Fix two bugs.Huang Qiangxiong1-51/+143
1. Add show_details preferences. Disable it will hidden names of message/field/enum, field number, and other details. 2. Have only one popup message with all the errors listed, that are found during parsing .proto files. (Buffer errors and print once) Loading .proto files and checking message types of UDP port will be done only when protobuf dissector has been called. 3. Support parsing .proto files in legacy MAC file format (that newline is '\r') or mixed newline (\r + \n) file format. Change-Id: I97bcde000957e4cd1cce98a7f61120d03027423e Reviewed-on: https://code.wireshark.org/review/34736 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-07protobuf: add support for Protocol Buffers Language (*.proto) filesHuang Qiangxiong1-159/+654
1. A C-style Protocol Buffers Language (PBL) parser for *.proto file is added. It contains protobuf_lang_scanner.l (lex scanner), epan/protobuf_lang.y (grammar parser), and protobuf_lang_tree.h/c (grammar tree implementation). 2. The protobuf-helper.h/cpp is an interface wrapper layer. If one day C++ is allowed, we can create a protobuf-helper.cpp file, which using offical protobuf C++ library, to replace protobuf-helper.c. That keeps packet-protobuf.c unchanged. 3. User can specify protobuf search paths, and the UDP ports to protobuf message type maps at the Protobuf protocol preferences. 4. Other dissectors can pass the message type to Protobuf dissector by data parameter or pinfo->private_table["pb_msg_type"] (pinfo.private["pb_msg_type"] in lua). Some Sample of GRPC with Protobuf captures can be found in Bug: 13932. Bug: 13932 Change-Id: Ife16c2f7b381296f8db4740dabe5f8362a456f48 Reviewed-on: https://code.wireshark.org/review/22892 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
Change all wireshark.org URLs to use https. Fix some broken links while we're at it. Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c Reviewed-on: https://code.wireshark.org/review/34089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-19Use proto_tree_add_item_ret_display_string() to add string items.Guy Harris1-4/+2
It does all the work done by the calls it replaces, *and* it takes an encoding argument, so the string data is converted, if necessary, to UTF-8. (Not necessary in this case, at least as I read the protocol spec, but it's the right thing to do in any case.) Plus, as we're using proto_tree_add_item_ret_display_string(), the string we're displaying will be in a displayable format. Change-Id: I7f5e46dcdbb8f3d3749ef539a31f6208371b72cd Reviewed-on: https://code.wireshark.org/review/34022 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-20protobuf: fix typo reponse => responseAlexis La Goutte1-1/+1
Change-Id: Idca4c721d2f6f33ac5be5cc2637303c937d639e3 Reviewed-on: https://code.wireshark.org/review/27044 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-25protobuf: allow config of UDP portsMartin Mathieson1-1/+3
Make it easier to check if traffic over UDP ports is protobuf-based. Change-Id: Ib88c4a7a6d2996f53249da6707f35e06b38c7b2d Reviewed-on: https://code.wireshark.org/review/26625 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-12dissectors: use SPDX identifiers.Dario Lombardo1-13/+1
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-01-02Add ENC_VARINT_QUICAlexis La Goutte1-4/+4
Used to support variable length in QUIC protocol Bug: 13881 Change-Id: Ia274b1530152376c5fb4e364fc4cf5ab246be1b3 Reviewed-on: https://code.wireshark.org/review/24990 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Craig Jackson <cejackson51@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-17Protobuf: Fix format errorUli Heilmeier1-1/+1
Fixes error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'guint64' Change-Id: I431ab2e1920b7856ff686bd79bc881dee494706f Reviewed-on: https://code.wireshark.org/review/23965 Reviewed-by: Anders Broman <a.broman58@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-16protobuf: no previous prototype for ‘sint64_decode/sint32_decode’ ↵Alexis La Goutte1-2/+2
[-Wmissing-prototypes] Change-Id: I85be2eb645ab00d711f525d711ebf90f200595cc Reviewed-on: https://code.wireshark.org/review/23943 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>
2017-10-11ProtoBuf: Remove an unused variable.Gerald Combs1-9/+1
Remove protobuf_message_direction_type: ../epan/dissectors/packet-protobuf.c:125:20: error: unused variable 'protobuf_message_direction_type' [-Werror,-Wunused-const-variable] VALUE_STRING_ARRAY(protobuf_message_direction_type); ^ Have dissect_one_protobuf_field return a gboolean while we're here. Change-Id: I5d9d2e3414b5668ca26d5c0a450225c3cdf5da56 Reviewed-on: https://code.wireshark.org/review/23887 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-10-10Start of adding Protobuf (Protocol Buffers) dissector.Huang Qiangxiong1-0/+700
1. Protobuf dissector supports the almost all basic protobuf types of varint, sint, string, and so on. 2. Protobuf messages are not self-described protocol, for example, varint in protobuf may be int32, int64, uint32, uint64, sint32, sint64, bool or enum. Currently dissector will dissect field without detail definition in common way, for numeric field it show uint32 or uint64, for length-delimited field it just show as bytes. But user turn the try_dissect_all_length_delimited_field_as_string or show_all_possible_field_types options on, that dissect will show all possible value for each field according to wire type. (for example, a numeric field will parsed in int32, uint32, sint32, sint64 and so on). Ping-Bug: 13932 Change-Id: Idfe49307b1c84fe461603756f75daeb3e410a905 Reviewed-on: https://code.wireshark.org/review/23814 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>