Commit Graph

77 Commits

Author SHA1 Message Date
Michael Mann abfb644117 Add conversation endpoint type
For the moment this mirrors the port_type enumeration (PT_XXX), but the
intent is to move away from using "port types", eliminating most (if not
all)

Added conversation_pt_to_endpoint_type() so that conversations deal with the
correct enumeration.  This is for dissector that use pinfo->ptype as input
to conversation APIs.  Explicit use of port types are converted to using
ENDPOINT_XXX type.

Change-Id: Ia0bf553a3943b702c921f185407e03ce93ebf0ef
Reviewed-on: https://code.wireshark.org/review/24166
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-29 16:53:57 +00:00
Anton Butenko e60319e54b coap: Added dissection for LWM2M JSON inside CoAP protocol
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-26 12:25:29 +00:00
Anton Butenko 5598faa342 CoAP: added new TLV code 11542 according to changes in LwM2M OMA Spec.
Bug: 13761
Change-Id: I3cd5bca6e6959aeb74bf3ae8141c3b2afa70e028
Reviewed-on: https://code.wireshark.org/review/21999
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: Michael Mann <mmann78@netscape.net>
2017-06-07 13:17:20 +00:00
Stig Bjørlykke e61189d838 coap: Add filterable payload length
Also fix payload desc abbrev.

Change-Id: I355658d7722383e5d1ef84efddf43e545bfda269
Reviewed-on: https://code.wireshark.org/review/20695
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-03-24 09:26:55 +00:00
Stig Bjørlykke 0b2eb9d242 coap: Put payload protocol in parent tree
Change-Id: I15cc9df174a42d284c55306cd43f9a86eebd93a2
Reviewed-on: https://code.wireshark.org/review/20694
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-03-24 09:26:44 +00:00
Robert Cragie f7b784c968 CoAP: Enhancements to improve conversation recording.
Conversation recording now uses a hash map instead of a tree. URI
reconstruction for responses has also been added to assist Thread CoAP
decoding.

Change-Id: I83dc0dc48534d5182cf37ba50dad67e1b095188a
Reviewed-on: https://code.wireshark.org/review/20553
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-03-16 13:21:31 +00:00
Peter Wu 4d506a0a0d coap: add support for coaps (DTLS-secured CoAP)
coaps port is defined in RFC 7252, section 12.7.

CoAP (RFC 7252) is defined only for UDP, not TCP. For TCP, the frame
format is slightly different (draft-ietf-core-coap-tcp-tls-05) and
needs more dissector changes, so remove registration for now.

Change-Id: I1fc7163086f8fe66986565aa24b579ef24f72550
Ping-Bug: 13370
Reviewed-on: https://code.wireshark.org/review/19870
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-01-31 00:12:12 +00:00
Michael Mann f4b0abc729 Dissectors don't need a journey of self discovery.
They already know who they are when they register themselves.  Saving the
handle then to avoid finding it later.
Not sure if this will increase unnecessary register_dissector functions
(instead of using create_dissector_handle in proto_reg_handoff function)
when other dissectors copy/paste, but it should make startup time
a few microseconds better.

Change-Id: I3839be791b32b84887ac51a6a65fb5733e9f1f43
Reviewed-on: https://code.wireshark.org/review/19481
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-12-31 07:31:42 +00:00
Michael Mann 2eb7b05b8c Convert most UDP dissectors to use "auto" preferences.
Similar to the "tcp.port" changes in I99604f95d426ad345f4b494598d94178b886eb67,
convert dissectors that use "udp.port".

More cleanup done on dissectors that use both TCP and UDP dissector
tables, so that less preference callbacks exist.

Change-Id: If07be9b9e850c244336a7069599cd554ce312dd3
Reviewed-on: https://code.wireshark.org/review/18120
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-10-13 02:51:18 +00:00
Michael Mann 268841f3e0 Combine Decode As and port preferences for tcp.port dissector table.
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-10-08 02:44:53 +00:00
Pascal Quantin 0a9e842649 COAP: ensure that key_token is always initialized
Even when the token length is 0.

Bug: 12771
Change-Id: I0d77f0411fe90a6702d1f23ba9cd4b61433a5995
Reviewed-on: https://code.wireshark.org/review/17194
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>
2016-08-20 22:24:14 +00:00
Michael Mann 2ab4155794 tvb_get_string_enc + proto_tree_add_item = proto_tree_add_item_ret_string
Also some other tricks to remove unnecessary tvb_get_string_enc calls.

Change-Id: I2f40d9175b6c0bb0b1364b4089bfaa287edf0914
Reviewed-on: https://code.wireshark.org/review/16158
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-27 15:20:06 +00:00
Christoph Burger-Scheidlin 53252df920 Support dissecting the TLV data format specified for Lwm2m
Lightweight M2M is a protocol on top of CoAP that is used for
device management. The specification contains a custom payload
format - a simple type, length, value binary encoding.

This patch adds support for dissecting this payload format.
While not yet officially registered, the main open source
implementation of the lwm2m protocol - eclipse's leshan - uses this
content type 1542 for its messages.

Bug: 12110
Change-Id: Ib022d1f485c706f1d69ceec7200790448d080965
Reviewed-on: https://code.wireshark.org/review/13835
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>
2016-02-29 21:07:09 +00:00
Christoph Burger-Scheidlin e6b59962e8 CoAP: Add support for tracking requests and responses
Use CoAP's token to match responses to requests in CoAP.

Change-Id: I13141e3490d54aa27aea7c94d8199dcc0166d493
Reviewed-on: https://code.wireshark.org/review/13859
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-02-11 20:35:44 +00:00
Michael Mann 31a54708f4 new_register_dissector -> register_dissector for dissector directory.
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-09 12:38:06 +00:00
Michael Mann 1949a971c8 [COAP] Add "2.31 Continue" code
Bug: 11682
Change-Id: I77c7b9cdb39f18dabe0de0f11d9132ae074e3686
Reviewed-on: https://code.wireshark.org/review/12222
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-27 13:42:14 +00:00
Balint Reczey c297df134b More spelling fixes found by lintian
Change-Id: Id218dec9e5a721d6c63fd34962ffe50b6ab8dd56
Reviewed-on: https://code.wireshark.org/review/11946
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Diederik de Groot <dkgroot@talon.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-20 05:47:29 +00:00
Michael Mann 2fe0fc5a1a Convert some TCP subdissectors to "new" style.
Change-Id: I28ce51f3c06f78b85792bce4a13ef39eb75d7890
Reviewed-on: https://code.wireshark.org/review/11648
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-09 15:59:59 +00:00
Hauke Mehrtens 37a1bb8ca4 CoAP: add media type number for application/cbor
application/cbor got the number 60 by the IANA, see
https://www.iana.org/assignments/core-parameters/core-parameters.xml#content-formats

Change-Id: I4dbfd9eff8bacb46e815140c4640359f9a951869
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/9847
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-08-02 15:20:02 +00:00
Hauke Mehrtens e8f24f319e coap: fix decoding of observe extension
The observe draft changed and now the option value does not contain the
lifetime anymore, but the value encodes if a user wants to register or
deregister.

Change-Id: I3719101c2bed87c956eb24056be40c9a79dafac8
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/9638
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: Michael Mann <mmann78@netscape.net>
2015-07-21 21:52:35 +00:00
Michael Mann 9cfe67fde6 tvb_bytes_to_ep_str_punct -> tvb_bytes_to_str_punct
Also change bytestring_to_str to match bytes_to_ep_str_punct functionality (limiting byte string size)

Change-Id: Idb958c7f0c203d103629469302b81fa922714f7e
Reviewed-on: https://code.wireshark.org/review/6369
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07 18:05:35 +00:00
Martin Mathieson 596669f921 First batch of unincludes. Last attempt...
Change-Id: I3681462aeb98ca62ed3ec5eb226b2553317391a9
Reviewed-on: https://code.wireshark.org/review/5997
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-22 21:03:13 +00:00
Bill Meier b5d7b7ab6e Cleanup use of #includes in non-generated epan/dissector/*.c
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-12-21 05:46:22 +00:00
Bill Meier bb05124da9 coap: fix a bug; do some cleanup.
Bug fix: do initial calls to col_...() *before* the dissection code so
           that proper column info is displayed even if the dissector
           exits early because of an exception, etc.

  Cleanup:
    - Use wmem_strbuf instead of static fixed length char arrays;
    - Create/use an extended value_string;
    - Use %u (not %d) when formatting unsigned values;
    - Use strchr() to search a string for a character;
    - Misc ...

Change-Id: I57ca584f989c3ab1cf141270cc50160f9fb980ae
Reviewed-on: https://code.wireshark.org/review/5153
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-11-06 06:07:10 +00:00
chrysn 5d80686f45 CoAP dissector: Update option numbers from RFC7252
* "Accept" option: The option number was changed late in the
  specification process.
* "Proxy-Scheme" / "Size1": After including those, all option numbers
  specified in the RFC can be dissected by wireshark.

Change-Id: I1b475ac6920fd021e3217cd3b44c173d264a5298
Reviewed-on: https://code.wireshark.org/review/4123
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-09-17 23:37:23 +00:00
Shoichi Sakane 009bebbf09 Fix copy-paste probem in COAP dissector
Bug:8070
Change-Id: I7a86a37f7de6b3e4e12fe1c47980a9a6604488d6
Reviewed-on: https://code.wireshark.org/review/2390
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-18 18:11:49 +00:00
Dario Lombardo 971ffd683e Fixup: tvb_get_string(z) -> tvb_get_string(z)_enc
Change-Id: I63a3704effe3fcab01a193dc39b6a22e9f1cf3fe
Reviewed-on: https://code.wireshark.org/review/2376
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:13:58 +00:00
Michael Mann 73217d9f3f tvb_new_subset -> tvb_new_subset_length when length parameters are equal.
tvb_new_subset -> tvb_new_subset_remaining it appears that's what the intention is.

Change-Id: I2334bbf3f10475b3c22391392fc8b6864454de2d
Reviewed-on: https://code.wireshark.org/review/1999
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-07 15:41:07 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(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-03-04 14:27:33 +00:00
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Bill Meier 014bbf19b3 (Minor cleanup): unneeded initializers, whitespace, long-lines, typos
svn path=/trunk/; revision=53303
2013-11-13 19:29:37 +00:00
Michael Mann 02a8391535 Require dissector_try_string to pass a data parameter to its subdissectors. There weren't that many calls, so might as well modify the function than create a need for dissector_try_string_new.
svn path=/trunk/; revision=53049
2013-11-02 15:52:25 +00:00
Bill Meier 0ad98563a2 From didier gautheron: remove redundant or use faster col_xxx functions
- when the text parameter is constant col_add_str() and col_set_str() are equivalent but col_set_str() is faster.
- same for  replace col_append_fstr and col_append_str
- remove col_clear() when it's redundant:
    + before a col_set/col_add if the dissector can't throw an exception.
- replace col_append() after a col_clear() with faster col_add... or col_set

   https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9344


svn path=/trunk/; revision=52948
2013-10-29 14:09:20 +00:00
Michael Mann 8c64c5da89 Remove iplen and iphdrlen from struct _packet_info.
Dissectors should just use (reported) tvb length and taps have other ways to get the data.

svn path=/trunk/; revision=52899
2013-10-27 20:38:42 +00:00
Bill Meier 2ac134b3c5 whitespace fixes; mostly: remove trailing blanks
svn path=/trunk/; revision=52591
2013-10-13 19:56:52 +00:00
Evan Huus 5c1eafd595 From Peter A. Bigot via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9225
Fix CoAP option decoding. It's perfectly acceptable for the Payload Marker to
appear with no preceding options. Without this check such a situation produces
an invalid diagnostic: end-of-options marker found, but option length isn't 15

svn path=/trunk/; revision=52383
2013-10-05 21:00:25 +00:00
Pascal Quantin a0c53ffaa1 emem -> wmem conversion:
- 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-22 15:50:55 +00:00
Michael Mann 9e3f9b449f expert_add_info_format_text -> expert_add_info_format
svn path=/trunk/; revision=51852
2013-09-09 00:44:09 +00:00
Michael Mann 28bb3a5591 Batch of filterable expert infos.
svn path=/trunk/; revision=50384
2013-07-05 03:10:36 +00:00
Anders Broman a51e384818 Remove blurbs not adding any value.
svn path=/trunk/; revision=49885
2013-06-11 05:41:51 +00:00
Anders Broman cd643e745e From Hauke Mehrtens:
There were some problems which prevented wireshark from showing the
payload.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8780

svn path=/trunk/; revision=49884
2013-06-11 05:37:17 +00:00
Anders Broman ed0f343d8b From Hauke Mehrtens:
In some places String and byte were mixed up which caused problems.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8780

svn path=/trunk/; revision=49883
2013-06-11 05:34:33 +00:00
Anders Broman cda44b2966 From Hauke Mehrtens:
There were some changes in how to specify the length or give a bigger
option delta. This is now implemented how it is specified in CoAP draft
17.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8780

svn path=/trunk/; revision=49882
2013-06-11 05:31:10 +00:00
Anders Broman a9933bf603 From Hauke Mehrtens:
There is no option length attribute any more there is just the end of
options marker.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8780

svn path=/trunk/; revision=49881
2013-06-11 05:27:47 +00:00
Anders Broman ae868938aa From Hauke Mehrtens:
The field named Transaction ID is named Message ID in the RFC draft
version 17
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8780

svn path=/trunk/; revision=49880
2013-06-11 05:23:52 +00:00
Anders Broman 482221763b From Hauke Mehrtens:
The token is not an option any more, but it is now in the main header.
This was done between CoAP draft 12 and 13 and still exists in CoAP
draft 17.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8780

svn path=/trunk/; revision=49879
2013-06-11 05:20:33 +00:00
Evan Huus fc6fde93b4 From Soichi Sakane via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8070
Update CoAP dissector to the latest spec from the IETF, and make several more
fields filterable.

svn path=/trunk/; revision=48471
2013-03-22 00:12:44 +00:00
Anders Broman ef249623e6 [-Wmissing-prototypes]
Use explicit casts.

svn path=/trunk/; revision=48313
2013-03-15 06:26:47 +00:00
Jeff Morriss 2552c750e5 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45017
2012-09-20 02:03:38 +00:00
Bill Meier 638d74d43f Use val_to_str_const() where appropriate;
Also (for a few files):
- create/use some extended value strings;
- remove unneeded #include files;
- remove unneeded variable initialization;
- re-order fcns slightly so prefs_reg_handoff...() at end, etc

svn path=/trunk/; revision=44438
2012-08-10 22:55:02 +00:00