aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-protobuf.c
AgeCommit message (Collapse)AuthorFilesLines
2021-12-19Replace g_strdup_printf() with ws_strdup_printf()João Valverde1-2/+2
Use macros from inttypes.h.
2021-12-19Replace g_snprintf() with snprintf() (dissectors)João Valverde1-11/+11
Use macros from inttypes.h with format strings.
2021-07-21First pass pinfo->pool conversionEvan Huus1-7/+7
Automated find/replace of wmem_packet_scope() with pinfo->pool in all files where it didn't cause a build failure. I also tweaked a few of the docs which got caught up.
2021-05-24Add ws_debug() and use itJoão Valverde1-1/+1
Replace most instances of ws_debug_printf() except in epan/dissectors and dissector plugins. Some replacements use printf(), some use ws_debug(), and some were removed because they were dead or judged to be temporary.
2021-05-21protobuf: close another leak.Guy Harris1-0/+2
Close the directory handle we've opened before returning a failure indication if pbw_load_proto_file() or load_all_files_in_dir() reports a failure.
2021-05-21protobuf: close a leak when file loading fails.Guy Harris1-1/+3
Free the path we've constructed before returning a failure indication if pbw_load_proto_file() or load_all_files_in_dir() reports a failure. Also, explicitly compare pbw_load_proto_file()'s return value against 0, to make it a little clearer that it's *not* a Boolean, it's a return code (with 0 meaning success and different non-zero values meaning failure; if it matters *which* failure it is, we should probably have otherwise we should just make it a Boolean).
2021-04-11protobuf: Load .proto files from standard locationsGraham Bloice1-8/+17
Modify the protobuf dissector to load .proto files from the global config and personal config protobuf directories
2021-03-24Protobuf: Allow all protobuf fields to have a plugin dissectorRanjeet Kumar Singh1-11/+2
2021-03-24Protobuf: Provide an option to add plugin subdissectore for fields of all typesranjetsih1-1/+1
As of now a plugin subdissector can register itself for byte or string type only. This change adds an option to allow a plugin to register a subdissector for any protbuf field. this subdissector will be able to dissect a protobuf field on top of the existing dissector for that field.
2021-03-24Protobuf: Provide an option to add plugin subdissectore for fields of all typesranjetsih1-1/+9
As of now a plugin subdissector can register itself for byte or string type only. This change adds an option to allow a plugin to register a subdissector for any protbuf field. this subdissector will be able to dissect a protobuf field on top of the existing dissector for that field.
2020-11-26Protobuf: add 'preload_protos' preferenceHuang Qiangxiong1-0/+10
If check the 'preload_protos' on, the .proto files will be loaded on startup. That make tshark can use 'protobuf fields as wireshark fields' feature by providing protobuf field name in display filter (-Y option). close #17036
2020-11-12Protobuf: feature of adding missing fields with default valuesHuang Qiangxiong1-2/+336
Make Protobuf fields that are not serialized on the wire (missing in capture files) to be displayed with default values by setting the new 'add_default_value' preference. The default values might be explicitly declared in 'proto2' files, or false for bools, first value for enums, zero for numeric types. Default values are generated in epan/protobuf_lang_tree.c during the nodes of fields are created. The default_value_xxx() methods of field descriptor are added into epan/protobuf-helper.c/h and epan/protobuf_lang_tree.c/h files. close #17000
2020-10-28Protobuf: fix bugs about field subdissectorHuang Qiangxiong1-6/+21
Don't try to dissect bytes as string and show its value item if the bytes field has a subdissector. And add field subdissector under field item instead of value item. close #16956
2020-10-19Protobuf: dissect a google.protobuf.Timestamp as absolute time fieldHuang Qiangxiong1-12/+97
The google.protobuf.Timestamp is a standard protobuf message type and consists of seconds and nanos fields. We dissect protobuf field in google.protobuf.Timestamp type as wireshark FT_ABSOLUTE_TIME field. And add tvb_get_protobuf_field_uint() to make it easy to get a Protobuf field of varint type from the tvb. close #16927
2020-08-31More spelling fixes, part 2 of 2nd pass of dissectors.Martin Mathieson1-1/+1
There will likely be one for for this pass. Further improvements to the script are possible, i.e. filtering out (usually filter) strings such as 'onetwothree' - may not be worth it though.
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>