Type will be mapped to an enumerator containing all channel types. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- python_modules/dissector.py | 14 +++++++++----- spice.proto | 2 +- tests/Makefile.am | 1 + tests/check_dissector | 2 ++ tests/out_channel.txt | 7 +++++++ tests/test.proto | 15 +++++++++++++++ 6 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 tests/out_channel.txt diff --git a/python_modules/dissector.py b/python_modules/dissector.py index 4fb451b..e943779 100644 --- a/python_modules/dissector.py +++ b/python_modules/dissector.py @@ -277,11 +277,15 @@ def write_wireshark_field(writer, container, member, t, ws, tree, size, encoding # override type if ws.type: - f_type = 'FT_%s' % ws.type - base = 'BASE_NONE' - vals = 'NULL' - if f_type == 'FT_BOOLEAN': - vals = 'TFS(&tfs_set_notset)' + if ws.type == 'CHANNEL': + base = 'BASE_DEC' + vals = 'VALS(channel_types_vs)' + else: + f_type = 'FT_%s' % ws.type + base = 'BASE_NONE' + vals = 'NULL' + if f_type == 'FT_BOOLEAN': + vals = 'TFS(&tfs_set_notset)' # override base if ws.base: diff --git a/spice.proto b/spice.proto index 3d2b7ce..1aee85b 100644 --- a/spice.proto +++ b/spice.proto @@ -199,7 +199,7 @@ channel BaseChannel { }; struct ChannelId { - uint8 type @ws("Channel type", channel_type); + uint8 type @ws("Channel type", channel_type) @ws_type(CHANNEL); uint8 id @ws("Channel ID", channel_id); } @ws_txt_n("channels[%u]", INDEX); diff --git a/tests/Makefile.am b/tests/Makefile.am index cdacd4f..9f6141f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -63,6 +63,7 @@ EXTRA_DIST = \ out_array_primitive.txt \ out_array_raw.txt \ out_array_struct.txt \ + out_channel.txt \ $(NULL) CLEANFILES = test.c test.h enums.h dissector.c dissector.h *.trs check_dissector.txt diff --git a/tests/check_dissector b/tests/check_dissector index 20d83ff..e2d06b5 100755 --- a/tests/check_dissector +++ b/tests/check_dissector @@ -60,4 +60,6 @@ check data_u16s 1 100 out_array_primitive.txt --client check data_u16s 1 101 out_array_raw.txt --client check data_u16s 1 102 out_array_struct.txt --client +check data_base1 1 2 out_channel.txt + exit 0 diff --git a/tests/out_channel.txt b/tests/out_channel.txt new file mode 100644 index 0000000..5dac17c --- /dev/null +++ b/tests/out_channel.txt @@ -0,0 +1,7 @@ +--- tree + --- item + Text: TEST3 (130) + Name: channel + Abbrev: spice2.auto.msg_base_Channel_channel + Type: FT_UINT8 + Base: BASE_DEC diff --git a/tests/test.proto b/tests/test.proto index b28520c..0f14125 100644 --- a/tests/test.proto +++ b/tests/test.proto @@ -64,6 +64,9 @@ channel BaseChannel { F16 f16; F32 f32; } Base1 = 1; + message { + uint8 channel @ws_type(CHANNEL); + } Channel; Empty empty = 100; client: @@ -76,6 +79,18 @@ channel BaseChannel { ArrayStruct array_struct; }; +channel Test1Channel: BaseChannel { +}; + +channel Test2Channel: BaseChannel { +}; + +channel Test3Channel: Test2Channel { +}; + protocol Spice { BaseChannel base = 1; + Test1Channel test1; + Test2Channel test2; + Test3Channel test3 = 130; }; -- 2.4.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel