[Spice-devel] [PATCH RFC 00/33] Start implementing wireshark dissector from protocol specifications

Frediano Ziglio fziglio at redhat.com
Wed Jul 1 10:09:52 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 and VDAgent so these packet could look a bit poor.

First patches marked as "codegen:" are not really related to this
set but just minor changes.

The protocol file is mainly decorated with additional attributes
(all starting with "ws"), see patch "Allows to specify some new
attributes for wireshark".
Actually ws_txt and ws_txt_n attributes are implemented only on
some additional (still too messy) pacthes.

I would like to have some comment on implementation, the
attributes used or anothing you can think of.

Frediano Ziglio (33):
  codegen: Import six module before first use
  codegen: Simplify if/else blocks
  codegen: Fix typo in variable name
  codegen: Optimize code indentation avoiding loop
  codegen: Remove duplicate variable initialization
  codegen: Reuse code to fix attribute from prototype file
  codegen: Do some check on attributes
  codegen: Remove old ptr32 attribute
  Start adding code to generate wireshark dissector
  Allows to specify C type for index variable
  Generate some definition for dissector
  Add new_ett function to be able to create new trees
  Decorate writer class to make easier ifdef/endif handling
  Generate scheleton for messages and channels
  Allows to specify some new attributes for wireshark
  Allows to specify descriptions for enumerations
  Decorate protocol file with attributes for wireshark
  Change code generated index type
  Add code to handle destination variable
  Parse containers
  Write function to write members
  Read values from primitive fields
  Read array size
  Generate code to output parse structure
  Handle array
  Handle switch
  Implement ws_inline attribute
  Handle pointers
  Handle base fields
  Allow to override default values generated for the fields
  Allow to specify 'CHANNEL' as type
  Use a class to register wireshark fields
  Handle flags

 common/Makefile.am             |   1 +
 python_modules/Makefile.am     |   1 +
 python_modules/codegen.py      |   9 +-
 python_modules/dissector.py    | 855 +++++++++++++++++++++++++++++++++++++++++
 python_modules/marshal.py      |  29 +-
 python_modules/ptypes.py       | 142 +++++--
 python_modules/spice_parser.py |  19 +-
 spice.proto                    | 414 ++++++++++----------
 spice_codegen.py               |  17 +-
 9 files changed, 1239 insertions(+), 248 deletions(-)
 create mode 100644 python_modules/dissector.py

-- 
2.1.0



More information about the Spice-devel mailing list