[Spice-devel] [PATCH v3 45/51] Allows to specify wireshark name for enumerators

Christophe Fergeau cfergeau at redhat.com
Thu Jul 23 06:43:15 PDT 2015


On Tue, Jul 21, 2015 at 05:46:15PM +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  python_modules/dissector.py    |  2 +-
>  python_modules/ptypes.py       | 91 +++++++++++++++---------------------------
>  python_modules/spice_parser.py |  2 +-
>  3 files changed, 35 insertions(+), 60 deletions(-)
> 
> diff --git a/python_modules/dissector.py b/python_modules/dissector.py
> index 3f63341..5c6b6fc 100644
> --- a/python_modules/dissector.py
> +++ b/python_modules/dissector.py
> @@ -737,7 +737,7 @@ def write_flags_func(writer, t, ws, tree, ti):
>  
>          desc = t.descs[v] if t.descs[v] else t.names[v]
>          hf = HF(name, desc)
> -        hf.ws_name = '%s_%s' % (t.name, t.names[v].lower())
> +        hf.ws_name = '%s_%s' % (t.name, t.names[v].lower()) if not t.ws_names[v] else t.ws_names[v]
>          hf.f_type = 'FT_BOOLEAN'
>          hf.base = str(bits)
>          hf.vals = 'TFS(&tfs_set_notset)'
> diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
> index a899b6c..8c92493 100644
> --- a/python_modules/ptypes.py
> +++ b/python_modules/ptypes.py
> @@ -321,6 +321,39 @@ class TypeAlias(Type):
>          return self.name
>  
>  class EnumBaseType(Type):
> +    def __init__(self, bits, name, enums, attribute_list):
> +        Type.__init__(self)
> +        self.bits = bits
> +        self.name = name
> +
> +        last = -1
> +        names = {}
> +        values = {}
> +        descs = {}
> +        ws_names = {}
> +        for v in enums:
> +            name = v[0]
> +            desc = v[1][1]
> +            ws_name = None if len(v[1]) < 3 else v[1][2]

This change is hidden by the moving of EnumType/FlagsType constructor to
EnumBaseType, maybe split this in 2 commits?

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150723/71525c71/attachment.sig>


More information about the Spice-devel mailing list