[Spice-devel] [PATCH v6 13/42] dissector: Parse containers
Frediano Ziglio
fziglio at redhat.com
Thu Aug 13 06:11:52 PDT 2015
Parse all members of the containers
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
python_modules/dissector.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/python_modules/dissector.py b/python_modules/dissector.py
index f44a3c5..09a4dad 100644
--- a/python_modules/dissector.py
+++ b/python_modules/dissector.py
@@ -169,6 +169,24 @@ class SubDestination(Destination):
return self.parent_dest.get_ref(self.member + "." + member, writer)
+def write_member_parser(writer, container, member, dest, scope):
+ pass
+
+def write_container_parser(writer, container, dest):
+ if container.has_attr('ws_as'):
+ type_name = container.attributes['ws_as'][0]
+ assert(ptypes.type_exists(type_name))
+ container = ptypes.lookup_type(type_name)
+
+ with dest.declare(writer) as scope:
+ for m in container.members:
+ if m.has_minor_attr():
+ writer.begin_block("if (minor >= %s)" % m.get_minor_attr())
+ write_member_parser(writer, container, m, dest, scope)
+ if m.has_minor_attr():
+ writer.end_block()
+
+
def write_msg_parser(writer, message, server):
msg_name = message.c_name()
function_name = "dissect_spice_%s_%s" % ('server' if server else 'client', msg_name)
@@ -186,6 +204,7 @@ def write_msg_parser(writer, message, server):
"GlobalInfo *glb _U_, proto_tree *tree _U_, guint32 offset", True)
dest = RootDestination(parent_scope)
+ write_container_parser(writer, message, dest)
writer.statement("return offset")
writer.end_block()
--
2.4.3
More information about the Spice-devel
mailing list