aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-json.c
AgeCommit message (Collapse)AuthorFilesLines
2022-02-15Tools: Fix fix-encoding-args.pl ASCII string validationJoão Valverde1-1/+1
Do not require a useless ENC_NA parameter for string encodings. FT_STRING and FT_STRINGZ types don't have any ndianness. Follow-up to 6ec429622c9258eefd388caf21ce92ab5b9f54b4.
2022-02-07json: Handle application/senml+jsonStig Bjørlykke1-0/+2
Add handling of application/senml+json and application/sensml+json.
2022-01-13JSON: add 3GPP Supported Features handlingJoakim Karlsson1-7/+693
Format defined in TS29.571, ch5.2.2. First API (NPCF) filled from TS29.512, ch5.8
2021-12-15JSON: Remove unnecessary hfindex lookupJoão Valverde1-6/+3
2021-12-15JSON: add handling of 3GPP NAS-5G IEsJoakim Karlsson1-8/+62
2021-12-09JSON: Convert to old proto tree APIJoão Valverde1-115/+142
Related with #17774.
2021-12-03epan: Remove STR_ASCII and STR_UNICODEJoão Valverde1-7/+7
These display bases work to replace unprintable characters so the name is a misnomer. In addition they are the same option and this display behaviour is not something that is configurable. This does not affect encodings because all our internal text strings need to be valid UTF-8 and the source encoding is specified using ENC_*. Remove the assertion for valid UTF-8 in proto.c because tvb_get_*_string() must return a valid UTF-8 string, always, and we don't need to assert that, it is expensive.
2021-09-29JSON: enable Binary data lookup on ArrayJoakim Karlsson1-0/+3
2021-09-28JSON: enable Binary data also for non-compactJoakim Karlsson1-13/+24
2021-09-16tvbparse: explicitly memory-scope parserEvan Huus1-1/+1
Avoids the use of the global memory pool in favour of one the compiler actually knows must be in scope. Also delete a few-hundred lines of if-0ed code that hadn't been active in 15+ years.
2021-09-06json: Fix Dead Store found by Clang AnalyzerAlexis La Goutte1-4/+0
packet-json.c:365:7: warning: Value stored to 'is_valid_unicode_character' is never read [deadcode.DeadStores] packet-json.c:371:7: warning: Value stored to 'is_valid_unicode_character' is never read [deadcode.DeadStores] packet-json.c:383:8: warning: Value stored to 'is_valid_unicode_character' is never read [deadcode.DeadStores] packet-json.c:389:8: warning: Value stored to 'is_valid_unicode_character' is never read [deadcode.DeadStores]
2021-08-24JSON: adding more 3GPP EPS IEsJoakim Karlsson1-11/+82
2021-07-21JSON: correction of 3gpp ueEpsPdnConnectionJoakim Karlsson1-2/+2
2021-07-18json: fix buffer overflow in string_unescape()Developer Alexander1-151/+287
Fixes a potential buffer overflow issue in string_unescape() with a redesign to be more robust against invalid input. It makes use of wmem_strbuf API now. Closes #17475
2021-07-07Fix compiler warning in packet-json.cDavid Perry1-5/+0
Clang gives a fatal warning about "explicitly assigning value of variable of type 'int' to itself". The statement (and the `if` around it) are redundant, so this removes both.
2021-07-06json: improved path based filteringDeveloper Alexander1-220/+390
It is the intention to enable more precise filtering for json. 6 changes were made for this: - 'json.member' becomes filterable as a string field with the key of the member. Before the key was only appended as text but was not filterable. - Every item gets a field 'path' which allows to filter for elments which are at a specific position within the json. To make anonymous arrays visible (no member key) they appear as '[]' in the path. (For example arrays in arrays) - Every string, number, true, false, true or null item gets a field 'path_with_value' which combines the path of this element with its value. This allows a filtering for values of elements at a specific position within the json. - Every string, number, true, false, true or null item gets a field 'member_with_value' which combines the key of this element with its value. This allows a filtering for specific key-values-pairs independently of the position within the json. -It is possible to hide 'path', 'path_with_value', 'member_with_value' by a preference called 'Hide extended path based filtering'. - If the provided buffer does not start with the json object but has some leading bytes which does not belong to the json object there is a new option to ignore these bytes. This behaviour can be enabled by the newly introduced preference 'Ignore leading non JSON bytes'.
2021-05-03JSON NaN value supportedTomas Kukosa1-0/+10
Change-Id: I0096d047fb6eab882ad943090f5c4a6c1864671a
2021-03-20json: add application/x-ndjson to the media types handled.Roman-Koshelev1-0/+1
2021-02-06Added support for application/json-patch+json (RFC 6902)Josip Medved1-0/+1
2020-11-26JSON: fix a typo introduced in g2baaab6cPascal Quantin1-18/+18
2020-11-26json: Make it possible to filter and sub dissect json keys and data.Anders Broman1-5/+122
2020-04-13Standardise IETF RFC and Draft URLs in dissectors.Martin Mathieson1-1/+1
Prefer: - html (rather than txt) - https Also includes the script check_dissector_urls.py, that can be used to find links in code and test them. Change-Id: Iafd8bb8948674a38ad5232bf5b5432ffb2b1251b Reviewed-on: https://code.wireshark.org/review/36821 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-02-13Introduce AudioCodes Debug Recording (ACDR) dissectorOrgad Shaneh1-2/+20
ACDR is a protocol over UDP that is used by AudioCodes devices for recording traffic to and from the device. It adds a header to each packet that contains extra data about the packet. For some packet types (like SIP), it also appends the IP and UDP/TCP headers of the sent/received packet. The dissector unwraps the ACDR header, and displays the packets with the original type (and when available, with the original addresses). Bug: 16275 Change-Id: I19ad90053a2ef73da80881dc5e94aa362de23ea3 Reviewed-on: https://code.wireshark.org/review/35417 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-01-14json: append in Protocol column when call by another dissectorJoakim Karlsson1-3/+5
ex HTTP2/JSON Change-Id: I1947a0d4739e41e03096a5b032656ebe858d2768 Reviewed-on: https://code.wireshark.org/review/35749 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-11-04json: add application/merge-patch+json to the media types handled.Joakim Karlsson1-0/+1
Change-Id: I09db950c4da59aa24da50715194be59f385b7032 Reviewed-on: https://code.wireshark.org/review/34952 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-13json: add application/problem+json to the media types handled.Anders Broman1-0/+1
Change-Id: I33a7d92f92dde154a567c92b69748fe9c556cebf Reviewed-on: https://code.wireshark.org/review/34270 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-06-12NGAP: Dissect N2 SM InformationAnders Broman1-0/+3
Change-Id: I05c334a7ba69986e9dee63e9b71839c6ae0d994f Reviewed-on: https://code.wireshark.org/review/33568 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20wsutil: rename some wsjson functionsPeter Wu1-1/+1
Rename wsjson_unescape_json_string to json_decode_string_inplace (inspired by the g_base64_decode_inplace name). Rename wsjson_is_valid_json to json_validate (inspired by g_unichar_validate). Ideally json_parse is inlined with its user (sharkd_session.c), but that requires exporting the jsmn_init and jsmn_parse functions... Hence the dependency on jsmn.h remains in wsjson.h. Change-Id: I7ecfe3565f15516e9115cbd7e025362df2da5416 Reviewed-on: https://code.wireshark.org/review/30731 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-04When using the NEW_PROTO_TREE_API, the proto_tree_add... functions areJoerg Mayer1-3/+3
"redefined" to handle the same way as before. In dissectors using the new API, add all currently used proto_tree_add_xxx functions to the list of functions that take care of NEW_PROTO_TREE_API changes. Modify the dissectors that worked around the missing change. Change-Id: Ib6d6ec2c225d96c98c2a8f507648d7ad4bfb6c68 Reviewed-on: https://code.wireshark.org/review/28002 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2018-04-21wsutil: convert one leftover function in wsjson.Dario Lombardo1-2/+2
Change-Id: I8d65389dfd6bf373e751e3373d9f22d733d9b5e9 Reviewed-on: https://code.wireshark.org/review/27069 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-21wsutil: rename wsjsmn to wsjson.Dario Lombardo1-1/+1
This puts more distance between the caller and the underlying library. At the moment we're using libjsmn, but other libraries (like json-glib) could be used. Change-Id: I1431424a998fc8188ad47b71d6d95afdc92a3f9e Reviewed-on: https://code.wireshark.org/review/27055 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-04Dissect JSON-RPC over TCP or UDPMichail Koreshkov1-0/+2
Dissect protocols like OVSDB which transfer JSON over TCP or UDP Change-Id: I7c918b6a5fbef9568fc4258fd57bad39ff2d9203 Reviewed-on: https://code.wireshark.org/review/26726 Petri-Dish: Anders Broman <a.broman58@gmail.com> 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-02-08json: Add for decode-as udp.portStig Bjørlykke1-0/+2
Change-Id: Ibd03cd64aa8de7fee8ad3cc7b7cc61e0370399ff Reviewed-on: https://code.wireshark.org/review/25681 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-02-01json: Adjust whitespaceStig Bjørlykke1-11/+9
Change-Id: Ifa10ca415d291ab6b0cb06c475ac8697b5fc96da Reviewed-on: https://code.wireshark.org/review/25548 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-01-29Display JSON in compact formMichail Koreshkov1-2/+178
JSON will be display like in browswer developer tool (Firefox or Chrome). Change-Id: Ib504f4828d9fd8d25d9564b93717007ac021713c Reviewed-on: https://code.wireshark.org/review/25474 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-09-26coap: Added dissection for LWM2M JSON inside CoAP protocolAnton Butenko1-0/+1
Change-Id: I29429f731b7e2f25568d44de455816ac70e079b6 Reviewed-on: https://code.wireshark.org/review/23740 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-09-26Add GRPC dissectorHuang Qiangxiong1-0/+1
GRPC dissector register it self to media_type dissector table using patterns "application/grpc", "application/grpc+proto" and "application/grpc+json". GRPC stack (at least in grpc-java) can send JSON over GRPC using content-type = "application/grpc" which normally means default protobuf format. A preference is added to detect the message body, if it starts with '{', and ends with '}', will force to use JSON subdissector instead of searching in 'grpc_message_type' table. Ping-Bug: 13932 Change-Id: I910961ca06370e678d19b78cac533ca566d87628 Reviewed-on: https://code.wireshark.org/review/22891 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-06-16Fix JSON UTF-8 character validation and dissectionVasil Velichckov1-1/+1
In abda30e9e validation of JSON UTF-8 characters was implemented but it doesn't handle well the valid characters Bug: 13806 Change-Id: Id8777065cfff9deae94f457dee08017d03b50f20 Reviewed-on: https://code.wireshark.org/review/22169 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-09-30wsutil: split libjsmn.Dario Lombardo1-1/+1
The libjsmn was imported into the tree and enhanced with a new function. This change splits it into the "original" libjsmn and an addictional module wsjsmn that contains the new function. This will make easier to port within the tree future versions of the library. Change-Id: I3f1caa91bee462e0767e5e18d0b6a10f0b1cad32 Reviewed-on: https://code.wireshark.org/review/17963 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-08-22Pass an HTTP message type to all HTTP subdissectors.Guy Harris1-2/+13
This gets complicated, because those subdissectors might be called by other dissectors as well. We need a better way of passing that sort of out-of-bound information. Pull some routines used for processing Content-Type parameters into common code; we can't guarantee that the media parameters passed in would be writable (passing it as *the* data hid that; passing a structure with that *and* the HTTP message type revealed it), so don't convert it to lower-case in place. Use that information, if available, to determine whether an IPP message is a requet or a response. Change-Id: I4bccc9f05cd0b14ad445be7ab37b3d884d841325 Reviewed-on: https://code.wireshark.org/review/17216 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-01Rename json.member.key -> json.key to keep it on the same layer as json.valueMichael Mann1-4/+4
Bug: 12300 Change-Id: I636c086d2dd9c950c35724d3e6b8dbf712e9e147 Reviewed-on: https://code.wireshark.org/review/14744 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>
2016-03-26Add json.member.keyJakub Zawadzki1-7/+5
Bug: 12287 Change-Id: I9aecf83ef6f166fc30c275d1e50e0268b1b59ad5 Reviewed-on: https://code.wireshark.org/review/14618 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> 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>
2016-03-20Manually add protocol dependencies derived from find_dissector.Michael Mann1-1/+1
Started by grepping call_dissector_with_data, call_dissector_only and call_dissector and traced the handles passed into them to a find_dissector within the dissector. Then replaced find_dissector with find_dissector_add_dependency and added the protocol id from the dissector. "data" dissector was not considered to be a dependency. Change-Id: I15d0d77301306587ef8e7af5876e74231816890d Reviewed-on: https://code.wireshark.org/review/14509 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-17XML, JSON: Added DDS Web Integration ServiceJuanjo Martin1-0/+1
Change-Id: I18e272d060cee063c32be4eadd1643f080bbee22 Reviewed-on: https://code.wireshark.org/review/12701 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-09new_register_dissector -> register_dissector for dissector directory.Michael Mann1-1/+1
Change-Id: Ie39ef054a4a942687bd079f3a4d8c2cc55d5f22c Reviewed-on: https://code.wireshark.org/review/12485 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09new_create_dissector_handle -> create_dissector_handle for dissector directory.Michael Mann1-1/+1
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-07-17Remove all preferences related to enabling/disabling heuristic dissectors.Michael Mann1-2/+2
The preferences are still supported for backwards compatibility, but the heuristic_protos file has final say on the "preference" to enable/disable a heuristic dissector. Also add parameter to heur_dissector_add() for the "default" enable/disable of a heuristic dissector. With this parameter, a few more (presumably weak) heuristic dissectors have been "registered" but of course default to being disabled. Change-Id: I51bebb2146ef3fbb8418d4f5c7f2cb2b58003a22 Reviewed-on: https://code.wireshark.org/review/9610 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-12Add "user presentable" and "unique string ids" to heuristic table entries.Michael Mann1-2/+2
This allows better presentation of heuristic dissectors to the end user. Change-Id: I2ff3985ab914e83c2989880cc0c7b9904045b3f6 Reviewed-on: https://code.wireshark.org/review/9602 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>