[Spice-devel] [PATCH v4 00/41] Implements partial wireshark dissector from protocol specifications

Frediano Ziglio fziglio at redhat.com
Thu Jul 23 08:54:17 PDT 2015


As we have a file to specify the protocol and as is hard to align
wireshark dissector for each change we made I'm trying to do
part of this job to a code generator.

The idea is to have the dissector split in two part, one hand
written and the other automatic.

I tested that changing the code and protocol file the generated
code for marshalling/unmarshalling is still the same.
I have a small network capture to check that output is similar
to current dissector. I tried to copy wireshark field names,
formatting and descriptions.
A known issue is that the protocol did not contains some details
for images so these packet could look a bit poor.

The protocol file is mainly decorated with additional attributes
(all starting with "ws"), see patch "Allows to specify some new
attributes for wireshark".

Changes since v3:
- rebased on new version;
- comments improvements and fixes (Christophe);
- make code compile even if wireshark headers are not available;
- remove ws_name attributes, not used;
- compatibility with Python 3.

Changes since v2:
Patches changes:
- generate packet-spice.h automatically from spice.proto;
- additional checks for flags and arrays;
- use proper index using ws_txt_n attribute;
- do not override text to wrong tree if there are nested level;
- support ws_txt and ws_txt_n attribute on flags;
- updated some comment on attributes (Christophe);
- replace some tabs with spaces as all code is indented with spaces (Christophe);
- updated some description (similar to old dissector).
Patches added:
- check that we used all strings (ws_desc and so on) in spice.proto;
- allow to specify a field name for enumerators;
- allow to specify ws_as attribute for messages;
- additional tests;
- agent dissecting;
- initial image (now Quic) dissecting.

Changes from v1:
- better generation of header file;
- full support for ws_txt and ws_txt_n attributes;
- generate tree, not only flat list of endless items;
- automated tests during patches.


Frediano Ziglio (41):
  dissector: Start adding code to generate wireshark dissector
  dissector: Generate some definition for dissector
  dissector: Add new_ett function to be able to create new trees
  dissector: Decorate writer class to make easier ifdef/endif handling
  dissector: Generate skeleton for messages and channels
  codegen: Allows to specify some new attributes for wireshark
  codegen: Allows to specify descriptions for enumerations
  codegen: Allows to specify attributes for array items and pointers
  proto: Decorate protocol file with attributes for wireshark
  dissector: Change code generated index type
  dissector: Add code to handle destination variable
  dissector: Parse containers
  dissector: Write function to write members
  dissector: Read values from primitive fields
  dissector: Allows to write items to tree and dump saved tree
  dissector: Add code to read input from a file (or stdin)
  dissector: Handle base fields
  dissector: Read array size
  dissector: Handle structures
  dissector: Handle arrays
  dissector: Handle switches
  dissector: Implement ws_inline attribute
  dissector: Handle pointers
  dissector: Introduce a class to handle wireshark attributes
  dissector: Allows to override default values generated for the fields
  dissector: Allows to specify 'CHANNEL' as type
  dissector: Use a class to register wireshark fields
  dissector: Allows to have two type with different size to point to
    same field name
  dissector: Handle flags
  dissector: Handle text formatting of different elements
  dissector: Test decorated array
  dissector: Add some format checks with arrays
  dissector: Add check on output strings
  codegen: Reuse enumarators constructor
  codegen: Allows to specify wireshark name for enumerators
  codegen: Allows to specify ws_as attribute for messages
  proto: Improve agent dissectors
  dissector: Test we don't override text handling other fields
  dissector: Allows ws_as attribute on switch members
  dissector: Allows to use bytes_count and bytes array length in
    dissector
  proto: Describe Quic image format from dissector

 Makefile.am                     |    2 +-
 codegen/Makefile.am             |   72 +++
 codegen/check_dissector         |   71 +++
 codegen/check_strings           |   33 ++
 codegen/data_base1              |  Bin 0 -> 44 bytes
 codegen/data_empty              |    0
 codegen/data_struct2            |  Bin 0 -> 9 bytes
 codegen/data_u16s               |  Bin 0 -> 2000 bytes
 codegen/dissector_test.c        |  660 +++++++++++++++++++++++
 codegen/out_array2.txt          |   28 +
 codegen/out_array_primitive.txt |  110 ++++
 codegen/out_array_raw.txt       |   13 +
 codegen/out_array_struct.txt    |  158 ++++++
 codegen/out_base1.txt           |  148 ++++++
 codegen/out_channel.txt         |    7 +
 codegen/out_empty.txt           |    1 +
 codegen/out_flags1.txt          |  107 ++++
 codegen/out_struct1.txt         |   10 +
 codegen/out_struct2.txt         |   28 +
 codegen/test.proto              |  132 +++++
 common/Makefile.am              |    1 +
 configure.ac                    |    5 +
 python_modules/Makefile.am      |    1 +
 python_modules/dissector.py     | 1094 +++++++++++++++++++++++++++++++++++++++
 python_modules/ptypes.py        |  122 +++--
 python_modules/spice_parser.py  |   37 +-
 spice.proto                     |  563 ++++++++++++--------
 spice_codegen.py                |   17 +-
 28 files changed, 3146 insertions(+), 274 deletions(-)
 create mode 100644 codegen/Makefile.am
 create mode 100755 codegen/check_dissector
 create mode 100755 codegen/check_strings
 create mode 100644 codegen/data_base1
 create mode 100644 codegen/data_empty
 create mode 100644 codegen/data_struct2
 create mode 100755 codegen/data_u16s
 create mode 100644 codegen/dissector_test.c
 create mode 100644 codegen/out_array2.txt
 create mode 100644 codegen/out_array_primitive.txt
 create mode 100644 codegen/out_array_raw.txt
 create mode 100644 codegen/out_array_struct.txt
 create mode 100644 codegen/out_base1.txt
 create mode 100644 codegen/out_channel.txt
 create mode 100644 codegen/out_empty.txt
 create mode 100644 codegen/out_flags1.txt
 create mode 100644 codegen/out_struct1.txt
 create mode 100644 codegen/out_struct2.txt
 create mode 100644 codegen/test.proto
 create mode 100644 python_modules/dissector.py

-- 
2.1.0



More information about the Spice-devel mailing list