wireshark: add OFReader class

Based on the pyloxi implementation.
diff --git a/wireshark_gen/templates/_ofreader.lua b/wireshark_gen/templates/_ofreader.lua
new file mode 100644
index 0000000..c88f271
--- /dev/null
+++ b/wireshark_gen/templates/_ofreader.lua
@@ -0,0 +1,37 @@
+OFReader = {}
+OFReader.new = function(buf, offset)
+    local self = {}
+    offset = offset or 0
+
+    self.read = function(len)
+        local r = buf(offset, len)
+        offset = offset + len
+        return r
+    end
+
+    self.read_all = function()
+        local r = buf(offset, buf.len() - offset)
+        offset = buf.len()
+        return r
+    end
+
+    self.peek = function(off, len)
+        return buf(offset + off, len)
+    end
+
+    self.skip = function(len)
+        offset = offset + len
+    end
+
+    self.is_empty = function()
+        return offset == buf:len()
+    end
+
+    self.slice = function(len)
+        r = OFReader.new(buf(offset, len))
+        offset = offset + len
+        return r
+    end
+    
+    return self
+end
diff --git a/wireshark_gen/templates/openflow.lua b/wireshark_gen/templates/openflow.lua
index c098f56..16abec0 100644
--- a/wireshark_gen/templates/openflow.lua
+++ b/wireshark_gen/templates/openflow.lua
@@ -2,6 +2,8 @@
 :: ir = of_g.ir
 -- TODO copyright (GPL)
 
+:: include('_ofreader.lua')
+
 p_of = Proto ("of", "OpenFlow")
 
 local openflow_versions = {