[Spice-devel] [PATCH v6 00/42] Implements partial wireshark dissector from protocol specifications

Frediano Ziglio fziglio at redhat.com
Thu Aug 13 06:11:39 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.

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 v5:
- renamed codegen directory to tests;
- use @ifdef(DISSECTOR) to avoid collisions;
- make easier to change dissector short name
  using a global variable;
- small fix for dissector short name;
- do not change base type (uint32 -> mouse_mode32)
  in spice.proto but use @ws_as instead.

Changes since v4:
- rebased on spice-protocol and updated according;
- some comments update.

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 (42):
  Supports ifdef attribute on enumerations
  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 enumerator 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 +-
 configure.ac                   |   10 +
 python_modules/Makefile.am     |    1 +
 python_modules/dissector.py    | 1096 ++++++++++++++++++++++++++++++++++++++++
 python_modules/ptypes.py       |  124 ++---
 python_modules/spice_parser.py |   37 +-
 spice.proto                    |  565 +++++++++++++--------
 spice_codegen.py               |   23 +-
 tests/Makefile.am              |   73 +++
 tests/check_dissector          |   71 +++
 tests/check_strings            |   33 ++
 tests/data_base1               |  Bin 0 -> 44 bytes
 tests/data_empty               |    0
 tests/data_struct2             |  Bin 0 -> 9 bytes
 tests/data_u16s                |  Bin 0 -> 2000 bytes
 tests/dissector_test.c         |  660 ++++++++++++++++++++++++
 tests/out_array2.txt           |   28 +
 tests/out_array_primitive.txt  |  110 ++++
 tests/out_array_raw.txt        |   13 +
 tests/out_array_struct.txt     |  158 ++++++
 tests/out_base1.txt            |  148 ++++++
 tests/out_channel.txt          |    7 +
 tests/out_empty.txt            |    1 +
 tests/out_flags1.txt           |  107 ++++
 tests/out_struct1.txt          |   10 +
 tests/out_struct2.txt          |   28 +
 tests/test.proto               |  132 +++++
 27 files changed, 3160 insertions(+), 277 deletions(-)
 create mode 100644 python_modules/dissector.py
 create mode 100644 tests/Makefile.am
 create mode 100755 tests/check_dissector
 create mode 100755 tests/check_strings
 create mode 100644 tests/data_base1
 create mode 100644 tests/data_empty
 create mode 100644 tests/data_struct2
 create mode 100755 tests/data_u16s
 create mode 100644 tests/dissector_test.c
 create mode 100644 tests/out_array2.txt
 create mode 100644 tests/out_array_primitive.txt
 create mode 100644 tests/out_array_raw.txt
 create mode 100644 tests/out_array_struct.txt
 create mode 100644 tests/out_base1.txt
 create mode 100644 tests/out_channel.txt
 create mode 100644 tests/out_empty.txt
 create mode 100644 tests/out_flags1.txt
 create mode 100644 tests/out_struct1.txt
 create mode 100644 tests/out_struct2.txt
 create mode 100644 tests/test.proto

-- 
2.4.3



More information about the Spice-devel mailing list