Commit Graph

21 Commits

Author SHA1 Message Date
Michael Mann 9d10be54c7 Some CANopen frame types can have zero size, so use tvb_reported_length instead of -1.
Bug: 11083
Change-Id: Ib17649fbbc4f79705e3ad18903b5c8847cb09054
Reviewed-on: https://code.wireshark.org/review/7881
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-04-04 13:01:27 +00:00
Michael Mann f7b1678b12 Replace enumerated preference for choosing subdissector with a subdissector table and Decode As functionality.
This makes it much easier for other subdissectors (and plugins) to associate themselves with CAN.

Change-Id: I49dd832af51651d0c91f9850c100e544d178b8c4
Reviewed-on: https://code.wireshark.org/review/7734
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-03-19 12:49:10 +00:00
Enrico Jorns 29d02a3134 canopen: Verbosity for INFO column
Display basic information about what is going on in the INFO column to
ease protocol debugging.

Change-Id: I2a3aba8008bf65ab9e236a3d81335cf723b2edd0
Reviewed-on: https://code.wireshark.org/review/5521
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-24 14:57:49 +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 94d7e8d838 Use ENC_LITTLE_ENDIAN when fetching FT_U?INT8 fields ...
(for some dissectors which fetch all other integral fields using
   ENC_LITTLE_ENDIAN).

Change-Id: Ica72a68ac560f2920d61e0769de83130557c46fd
Reviewed-on: https://code.wireshark.org/review/5752
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-13 21:58:59 +00:00
Enrico Jorns b4b6a5d5c6 canopen: LSS dissection
Dissection of Layer setting services (LSS) sub-protocol
according to CiA 305.

Change-Id: I24ca1827b25c30a672fb31cad390b3c1486102f4
Reviewed-on: https://code.wireshark.org/review/5516
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>
2014-11-27 15:22:10 +00:00
Enrico Jorns c2913d25a9 canopen: Enhanced SDO decoding
* Move sdo dissection to separate function

  Added dissect_sdo() function to handle the more complex SDO dissection.

* SDO command specifier decoding

  Decoding of both client and server command specifier for SDO transfers
  according to CiA 301 Chaper 7.2.4.3.

  Note: Fully decoding block transfer frames is more complex and not supported
  yet.

* basic SDO abort code decoding

  SDO abort codes as specified in CiA 301 Chapter 7.2.4.3.17 (Table 22).

* Basic value ranges for object dict index parameter

  Object dict ranges as specified in CiA 301 7.4.1 (Table 41)

* cs-based multiplexer and data decoding

  A data width of 4 byte is valid only for expedited transfer and a
  multiplex value is present only in initialisation messages.

  This patch now handles also normal sdo segment data.

  Reference: CiA 301, Chapter 7.2.4.3.3 and 7.2.4.3.6

Change-Id: I37005894082d62eed1ddd85e09e3676aa3af8222
Reviewed-on: https://code.wireshark.org/review/5504
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>
2014-11-26 19:15:04 +00:00
Enrico Jorns 5464bc69ae canopen: Improve NMT error control and SYNC message dissection
1.  Also show Reserved/Toggle bit of NMT error control

  In case of the node guarding protocol this bit is used as a toggle bit.
  In case of the hearbeat protocol this bit is reserved.

  Reference: CiA 301 (rev 4.2.0), Chap. 7.2.8.3.2

2. Show optional 'counter' parameter of SYNC messages if available

  Reference: CiA 301 (rev 4.2.0), Chap. 7.2.5.3.1

Change-Id: I5dc0ab65e95fec4846a9c8bd8972ef2eba664ee2
Reviewed-on: https://code.wireshark.org/review/5484
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-11-26 05:17:59 +00:00
Enrico Jorns b01ff09eb9 canopen: Fixed tree expansion
Previously the COB-ID and Type subtree also used the main ett_canopen
variable. This made control of subtree expansion impossible as both
parent and subtree nodes shared the same state.

Change-Id: I3dabf7f399e83bfcfbf78bc0e633e3696776c043
Reviewed-on: https://code.wireshark.org/review/5480
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-11-25 11:19:15 +00:00
Michael Mann d7e277aa08 CANopen bugfixes
1. Fixed endianess in CANopen dissector.
According to CiA 301, 7.1.1. (p. 26):
"For numerical data types the encoding is little endian style."

2. Fixed NMT type string in CANopen dissector
NMT function code should not display 'EMERGENCY'

3. Fixed time stamp decoding

* Offset increment was too low for data type size
* Decoding of time_stamp_days must equal time_stamp_msec and thus be letohs instead of ntohs. CANopen data is little-endian encoded.

4. Fix: Use correct description string for NMT error control state bits
canopen.nmt_guard.state was faulty named "Node-ID". This was changed to "State".

5. Fix nmt_guard_state value_string array
CiA 301 desribes only 4 valid values. All other were deleted.
0x00 was renamed from 'Initalisation' to 'Boot-up' following CiA301.

6. Shortened EMERGENCY to EMCY

The term EMCY is the standard abbreviation used in CiA standard for Emergency service.

7. Fix: Allow SYNC and NMT error frames without any payload
NMT node guard remote requests do note have a payload,
SYNC frames only have an optional payload (counter)

If item length is set to -1, decode will cause a 'Malformed Packet' error.

8.  Rename MT_NMT_GUARD to MT_NMT_ERR_CTRL which better reflects its scope

Change-Id: I676f9b5f2e4efd8e7c9528fe289e7510c4d43235
Reviewed-on: https://code.wireshark.org/review/5425
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-11-21 21:51:10 +00:00
Bill Meier ff5a77256c Add editor modelines and adjust indentation as needed.
Change-Id: Id57d264299f2026d703c5b08bace4b24b32f184c
Reviewed-on: https://code.wireshark.org/review/4371
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-29 18:21:50 +00:00
Michael Mann 29ecd114bf convert to proto_tree_add_subtree[_format]
Change-Id: I5f573dffabb8685a8e5a334ff2bfb24d9838daa6
Reviewed-on: https://code.wireshark.org/review/2601
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-24 23:42:13 +00:00
Michael Mann 14824e6adf Revert "Fixup: tvb_* -> tvb_captured"
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html

This reverts commit 246fe2ca4c.

Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f
Reviewed-on: https://code.wireshark.org/review/2430
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 18:25:59 +00:00
Dario Lombardo 246fe2ca4c Fixup: tvb_* -> tvb_captured
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f
Reviewed-on: https://code.wireshark.org/review/2377
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:14:58 +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
Michael Mann 8d0dc9f935 CAN protocols have a CAN ID and up to 8 bytes of data. How the CAN ID and data are presented is the responsibility of the previous layer. Make the interface be passing the CAN ID in dissector data and have the (up to) 8 bytes be the tvb. CAN protocols should treat the CAN ID as "generated" data.
svn path=/trunk/; revision=53792
2013-12-05 03:36:49 +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 82ff1fd754 General cleanup:
- Setup COL_PROTO & COL_INFO before fetching from the tvb;
- Improve byte pane highlighing: Use proper length in proto_tree_add_item() calls;
- Remove unneeded include;
- Use VALS macro when referencing a value_string in hf[];
- Simplify/rework code slightly;
- Whitespace.

svn path=/trunk/; revision=42464
2012-05-07 13:35:45 +00:00
Anders Broman 93d9658e93 From Yegor Yefremov: Add dissector for CANopen protocol https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6651 with some modifications
svn path=/trunk/; revision=41394
2012-03-07 14:28:29 +00:00