aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-logcat.c
AgeCommit message (Collapse)AuthorFilesLines
2022-09-10Dissector names are not protocol names.Guy Harris1-1/+1
A given protocol's packet format may depend, for example, on which lower-level protocol is transporting the protocol in question. For example, protocols that run atop both byte-stream protocols such as TCP and TLS, and packet-oriented protocols such as UDP or DTLS, might begin the packet with a length when running atop a byte-stream protocol, to indicate where this packet ends and the next packet begins in the byte stream, but not do so when running atop a packet-oriented protocol. Dissectors can handle this in various ways: For example, the dissector could attempt to determine the protocol over which the packet was transported. Unfortunately, many of those mechanisms do so by fetching data from the packet_info structure, and many items in that structure act as global variables, so that, for example, if there are two two PDUs for protocol A inside a TCP segment, and the first protocol for PDU A contains a PDU for protocol B, and protocol B's dissector, or a dissector it calls, modifies the information in the packet_info structure so that it no longer indicates that the parent protocol is TCP, the second PDU for protocol A might not be correctly dissected. Another such mechanism is to query the previous element in the layers structure of the packet_info structure, which is a list of protocol IDs. Unfortunately, that is not a list of earlier protocols in the protocol stack, it's a list of earlier protocols in the dissection, which means that, in the above example, when the second PDU for protocol A is dissected, the list is {...,TCP,A,B,...,A}, which means that the previous element in the list is not TCP, so, again, the second PDU for protocol A will not be correctly dissected. An alternative is to have multiple dissectors for the same protocol, with the part of the protocol that's independent of the protocol transporting the PDU being dissected by common code. Protocol B might have an "over a byte-stream transport" dissector and an "over a packet transport" dissector, with the first dissector being registered for use over TCP and TLS and the other dissector being registered for use over packet protocols. This mechanism, unlike the other mechanisms, is not dependent on information in the packet_info structure that might be affected by dissectors other than the one for the protocol that transports protocol B. Furthermore, in a LINKTYPE_WIRESHARK_UPPER_PDU pcap or pcapng packet for protocol B, there might not be any information to indicate the protocol that transports protocol B, so there would have to be separate dissectors for protocol B, with separate names, so that a tag giving the protocol name would differ for B-over-byte-stream and B-over-packets. So: We rename EXP_PDU_TAG_PROTO_NAME and EXP_PDU_TAG_HEUR_PROTO_NAME to EXP_PDU_TAG_DISSECTOR_NAME and EXP_PDU_TAG_HEUR_DISSECTOR_NAME, to emphasize that they are *not* protocol names, they are dissector names (which has always been the case - if there's a protocol with that name, but no dissector with that name, Wireshark will not be able to handle the packet, as it will try to look up a dissector given that name and fail). We fix that exported PDU dissector to refer to those tags as dissector names, not protocol names. We update documentation to refer to them as DISSECTOR_NAME tags, not PROTO_NAME tags. (If there is any documentation for this outside the Wireshark source, it should be updated as well.) We add comments for calls to dissector_handle_get_dissector_name() where the dissector name is shown to the user, to indicate that it might be that the protocol name should be used. We update the TLS and DTLS dissectors to show the encapsulated protocol as the string returned by dissector_handle_get_long_name(); as the default is "Application Data", it appeaers that a descriptive name, rather than a short API name, should be used. (We continue to use the dissector name in debugging messages, to indicate which dissector was called.)
2021-12-03epan: Remove STR_ASCII and STR_UNICODEJoão Valverde1-2/+2
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-07-21First pass pinfo->pool conversionEvan Huus1-1/+1
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.
2020-08-18logcat: fix indentation.Guy Harris1-4/+4
Change-Id: Ia23acfdaf78af20760f18169c57ae770b399e0d2 Reviewed-on: https://code.wireshark.org/review/38193 Reviewed-by: Guy Harris <gharris@sonic.net>
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-04-04epan: Convert our PROTO_ITEM_ macros to inline functions.Gerald Combs1-1/+1
Convert our various PROTO_ITEM_ macros to inline functions and document them. Change-Id: I070b15d4f70d2189217a177ee8ba2740be36327c Reviewed-on: https://code.wireshark.org/review/32706 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> 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>
2016-10-08Combine Decode As and port preferences for tcp.port dissector table.Michael Mann1-1/+1
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-06-29Provide new interface for Export PDU.Michael Mann1-2/+2
Rather than have a bitmask for each desired field, have a dissector provide a list of structures that represent data that goes into the PDU. Change-Id: I125190cbaee489ebffb7d9f5d8bc6f3be2d06353 Reviewed-on: https://code.wireshark.org/review/16122 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-09Logcat: Unicodize textsMichal Labedzki1-5/+5
Text over Logcat is in real in Unicode. ASCII does not display it correctly. Change-Id: I998dad1ee50c4b00b874a1f197f6e465fadd3e38 Reviewed-on: https://code.wireshark.org/review/15791 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
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-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-11-30adb service/logcat : fix Consider inspecting this expression. The expression ↵Alexis La Goutte1-1/+1
is excessive or contains a misprint found by PVS Studio (V590) Change-Id: I59cf9c8b2aab347023dea323602dd6ff85ac7ab6 Reviewed-on: https://code.wireshark.org/review/12309 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-03Remaining ADDRESS macro to address function conversionsJoão Valverde1-1/+1
Change-Id: I8bc9af431e70243b05f4f0ce8c2b8ee451383788 Reviewed-on: https://code.wireshark.org/review/11463 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>
2015-10-22Use address functions instead of ADDRESS macros in asn1 and epanGerald Combs1-1/+1
Replace CMP_ADDRESS, COPY_ADDRESS, et al with their lower-case equivalents in the asn1 and epan directories. Change-Id: I4043b0931d4353d60cffbd829e30269eb8d08cf4 Reviewed-on: https://code.wireshark.org/review/11200 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.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>
2015-06-25Add ability to export PDUs for heuristic dissectors alsoPascal Quantin1-1/+1
Change-Id: I1bf1aa9794f9b4f106edffd4986fc0b1014522fa Reviewed-on: https://code.wireshark.org/review/9099 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-03-05Logcat: Fix typoMichal Labedzki1-1/+1
Fix funny "...replace all new characters by spaces" to "replace all new line characters by spaces" Change-Id: I8322ccd9f01220d300a0ba2982b2a61252b51242 Reviewed-on: https://code.wireshark.org/review/7540 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2015-03-04Logcat: Add preference for oneline info columnMichal Labedzki1-0/+12
In fact user may want to disable oneline info column what changes view to multiple lines of log then increases readability. Change-Id: I8aeb1af10abfe8cd56e441d4ebf17cd1526efc89 Reviewed-on: https://code.wireshark.org/review/7524 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-08-06Add support for android logcat text filesMichał Orynicz1-1/+1
Wireshark already supports reading and writing logcat logs saved in binary files. Binary format, although better, is used less often than saving those logs to text files. This patch extends wireshark's support for android logcat logs to reading and writing logcat logs in text files. Features: * support for tag, brief, process, thread, time, threadtime and long formats * saving in original format * it's generally awesome Change-Id: I013d6ac2da876d9a2b39b740219eb398d03830f6 Reviewed-on: https://code.wireshark.org/review/1802 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-08-05Various minor dissector fixes/changesBill Meier1-3/+3
- Fix a few minor bugs; - Remove unneeded #includes; - Do some whitespace/long_lines formatting changes. Change-Id: I97239fa20727498604682239cda0e1b87b10f4bc Reviewed-on: https://code.wireshark.org/review/3434 Petri-Dish: Bill Meier <wmeier@newsguy.com> Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-06-22Logcat: Set data-text-lines dissectors for logMichal Labedzki1-2/+12
Some binary logcat packets has more then one line, show them in a convenient form. Change-Id: I008aac6fe5589f2b10db51f7221853f9d79bbc7a Reviewed-on: https://code.wireshark.org/review/2549 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-06-20Rename dissector_add_handle() to dissector_add_for_decode_as().Guy Harris1-1/+1
Hopefully that name makes it clear what the routiner's purpose is, and will encourage people to use it rather than using dissector_add_uint() with a bogus integer value. Change-Id: Ic5be456d0ad40b176aab01712ab7b13aed5de2a8 Reviewed-on: https://code.wireshark.org/review/2483 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-19Revert "Fixup: tvb_* -> tvb_captured"Michael Mann1-1/+1
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-19Add the ability to dynamically add a new protocol to export PDU dialog boxPascal Quantin1-2/+2
Change-Id: I83012cc963d514982e40010e837e11a6fcf1bc3e Reviewed-on: https://code.wireshark.org/review/2423 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18Fixup: tvb_* -> tvb_capturedDario Lombardo1-1/+1
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f Reviewed-on: https://code.wireshark.org/review/2377 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-18Exported PDU: add support for more than 32 tagsPascal Quantin1-1/+1
Change-Id: Idc9f105164919827a8a81c88b5a56de4fa25df0b Reviewed-on: https://code.wireshark.org/review/1197 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19Wiretap: Add support for Android LogcatMichal Labedzki1-0/+3
Now Androit Logcat (Logger) binary logs are supported. Try "adb logcat -Bf /sdcard/log.logcat; adb pull /sdcard/log.logcat". Also there is possibility to save logs to text format like by "adb". Change-Id: If7bfc53d3fbd549a0978d1dbf96f3fff671fd601 Reviewed-on: https://code.wireshark.org/review/235 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19Exported PDU: add support for data length on the wirePascal Quantin1-1/+2
Change-Id: Iff14ec4d0297ec85f3597b33871fb0ab5256a597 Reviewed-on: https://code.wireshark.org/review/728 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-18Add Logcat to Exported PDUMichal Labedzki1-0/+15
Logcat can be exported from ADB over USB or ADB over TCP where can occur multiple Logcat PDUs in one frame. Change-Id: I290fa131e5600c62357e5be4e76096ea5c35364b Reviewed-on: https://code.wireshark.org/review/234 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-18Android: Add support for Logcat dissectorMichal Labedzki1-0/+285
Supported is Binary Logcat/Logger, aka adb logcat -Bf /sdcard/log.logcat Change-Id: I883c6d746ec4fe67ef4ce15ca4227adce407fb76 Reviewed-on: https://code.wireshark.org/review/232 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>