pyloxi: support of_checksum_128_t
diff --git a/py_gen/oftype.py b/py_gen/oftype.py
index 40bcb40..7e28a0c 100644
--- a/py_gen/oftype.py
+++ b/py_gen/oftype.py
@@ -111,6 +111,11 @@
init='None',
pack='%s.pack()',
unpack='oxm.oxm.unpack(%s)'),
+
+ 'of_checksum_128_t': OFTypeData(
+ init='0',
+ pack='util.pack_checksum_128(%s)',
+ unpack="util.unpack_checksum_128(%s)"),
}
## Fixed length strings
diff --git a/py_gen/templates/util.py b/py_gen/templates/util.py
index ed2698a..d690939 100644
--- a/py_gen/templates/util.py
+++ b/py_gen/templates/util.py
@@ -182,3 +182,10 @@
except loxi.ProtocolError:
return None
return [x for x in loxi.generic_util.unpack_list(reader, deserializer) if x != None]
+
+def pack_checksum_128(value):
+ return struct.pack("!QQ", (value >> 64) & MASK64, value & MASK64)
+
+def unpack_checksum_128(reader):
+ hi, lo = reader.read("!QQ")
+ return (hi << 64) | lo