[PATCH v6 13/42] dissector: Parse containers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Parse all members of the containers

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]