aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-json.c
AgeCommit message (Collapse)AuthorFilesLines
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>
2015-06-16Don't assume we get passed a null data pointer for JSON files.Guy Harris1-1/+12
That assumption will cease to be valid in the future. Change-Id: I021900c7a2f18f94e24cf6d372bb0c5e6fa3fdfe Reviewed-on: https://code.wireshark.org/review/8945 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-17Added JSON native file support.Dario Lombardo1-11/+21
libjsmn has also been moved from epan/ to wsutil/ to make it visible from wiretap. Change-Id: I59abb3419acb1baa83194b38152d3651ed5c123c Bug: 10878 Reviewed-on: https://code.wireshark.org/review/6716 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-01-27Added json heuristic to Dropbox LAN sync Discovery Protocol.Dario Lombardo1-0/+1
Change-Id: I0d649ddc0f1539616eca0322ba54a7735338c738 Reviewed-on: https://code.wireshark.org/review/6817 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-01-20Bug fix in json dissector that made the heuristic fail.Dario Lombardo1-3/+5
Change-Id: Iff53cfd8fd9d760b04c638c87f8a44587b268cd7 Reviewed-on: https://code.wireshark.org/review/6674 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-19JSON dissector changed into heuristic dissector.Dario Lombardo1-4/+26
To check if a payload is json, the library libjsmn has been added to the source tree, with its licence (MIT). TODO: the libjsmn can be used to extract tokens in the standard dissection other than heurisitic part. HPFEEDS dissector has also been changed in order to leverage the new json dissector. Bug: 10834 Change-Id: Ib1df2a699982dbdd2b5418e97edbdb5cbd9c8978 Reviewed-on: https://code.wireshark.org/review/6350 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-21Cleanup use of #includes in non-generated epan/dissector/*.cBill Meier1-3/+0
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-11-25Remove support for pinfo->private_data in "data-text-lines", ↵Michael Mann1-13/+3
"data-l1-events" and "urlencoded-form" dissectors. Data must be passed from parent through dissectors data parameter. Change-Id: I24ab56ce7d99f8ed670f4a50453223d4e6a46983 Reviewed-on: https://code.wireshark.org/review/5463 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-09-30Add editor modelines; Adjust whitespace; Remove boilerplate commentsBill Meier1-0/+12
Change-Id: I1f5f83ed441f6009125cf2cbe5023af04986898a Reviewed-on: https://code.wireshark.org/review/4392 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-06-19Revert "Fixup: tvb_* -> tvb_captured"Michael Mann1-3/+3
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html This reverts commit 246fe2ca4c67d8c98caa84e2f57694f6322e2f96. Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f Reviewed-on: https://code.wireshark.org/review/2430 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-18Fixup: tvb_* -> tvb_capturedDario Lombardo1-3/+3
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f Reviewed-on: https://code.wireshark.org/review/2377 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18Fixup: tvb_get_string(z) -> tvb_get_string(z)_encDario Lombardo1-1/+1
Change-Id: I63a3704effe3fcab01a193dc39b6a22e9f1cf3fe Reviewed-on: https://code.wireshark.org/review/2376 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-19Add new proto_tree_add_format_text() functionJakub Zawadzki1-1/+1
There are lot of text dissectors which want just to add escaped (not filtrable) text, add new function proto_tree_add_format_text() which just do this in optimized way. Change-Id: Ia0e189b620cc0a5b74cfdaef1ad4571d766bb2ab Reviewed-on: https://code.wireshark.org/review/1678 Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(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-02-25Remove trailing whitespace.Bill Meier1-1/+1
Change-Id: Ia03a1cd4590aceda30ead4aa93ad413d90c6aea6 Reviewed-on: https://code.wireshark.org/review/372 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.com>
2014-01-08Move UAT xton() to wsutil libraryJakub Zawadzki1-14/+8
Use ws_xton() in few more places. svn path=/trunk/; revision=54642
2014-01-07Fix bug #9618: Invalid utf8 causes JSON dissector assertion failure ↵Jakub Zawadzki1-3/+38
"g_utf8_validate" Validate JSON UTF-8 characters, replace with '?' when invalid. svn path=/trunk/; revision=54633
2014-01-07Move defines for helping with UTF-16 surrogate pairs to wsutil/unicode-utils.hJakub Zawadzki1-15/+3
tvbuff version was moved, but with 'or' optimization from packet-json. svn path=/trunk/; revision=54632
2013-12-14Fix some trivial warnings.Jakub Zawadzki1-1/+5
svn path=/trunk/; revision=54085
2013-12-07Drop proto_tree_add_unicode_string() from IP, IPv6, JSON dissectors.Jakub Zawadzki1-2/+2
Set .display to STR_UNICODE (instead of STR_ASCII). svn path=/trunk/; revision=53827
2013-11-16Avoid calling find_dissector(), cache result of [new_]register_dissector()Jakub Zawadzki1-5/+3
svn path=/trunk/; revision=53353
2013-11-07Add infrastructure for section-initializing protocol hfis (without array).Jakub Zawadzki1-0/+2
configure implementation later. svn path=/trunk/; revision=53146
2013-11-02Allow json dissector to receive a string through dissector data and give ↵Michael Mann1-8/+16
dissector data priority over pinfo->private_data (to discourage it's use) svn path=/trunk/; revision=53042
2013-10-13whitespace fixes; mostly: remove trailing blanksBill Meier1-4/+4
svn path=/trunk/; revision=52591
2013-09-22emem -> wmem conversion:Pascal Quantin1-1/+1
- 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-15More wmem conversion (leaving uat related functions aside)Pascal Quantin1-16/+16
svn path=/trunk/; revision=52055
2013-08-17Fix few concept of new api tree:Jakub Zawadzki1-12/+17
- (for now) keep ABI, restore prototype of old proto_tree_add_item, add new proto_tree_add_item_new - add few helpers for boolean, time, string which will do ->id - don't use HFI_INIT directly, use it by another macro (MSVC has very small limit for section name) svn path=/trunk/; revision=51401
2013-08-16Convert my dissectors to new proto API.Jakub Zawadzki1-52/+53
svn path=/trunk/; revision=51397
2013-03-19From beroset:Anders Broman1-1/+1
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48426