wireshark: use type-specific constructors for ProtoFields

This is apparently the more commonly used API. The generic constructor broke
compatibility between Wireshark releases 1.6 and 1.10.
diff --git a/wireshark_gen/__init__.py b/wireshark_gen/__init__.py
index 316de21..b4135ea 100644
--- a/wireshark_gen/__init__.py
+++ b/wireshark_gen/__init__.py
@@ -50,18 +50,18 @@
     Returns (type, base)
     """
     if oftype.startswith("list"):
-        return "BYTES", "NONE"
+        return "bytes", "NONE"
 
     ofproto = of_g.ir[version]
     enum = ofproto.enum_by_name(oftype)
 
     if enum:
-        field_type = "UINT32"
+        field_type = "uint32"
     elif oftype in field_info.oftype_to_wireshark_type:
         field_type = field_info.oftype_to_wireshark_type[oftype]
     else:
         print "WARN missing oftype_to_wireshark_type for", oftype
-        field_type = "BYTES"
+        field_type = "bytes"
 
     if enum:
         if enum.is_bitmask:
diff --git a/wireshark_gen/field_info.py b/wireshark_gen/field_info.py
index 09011c7..2e9231f 100644
--- a/wireshark_gen/field_info.py
+++ b/wireshark_gen/field_info.py
@@ -27,29 +27,29 @@
 
 # Map from LOXI types to Wireshark types
 oftype_to_wireshark_type = {
-    "char": "INT8",
-    "uint8_t": "UINT8",
-    "uint16_t": "UINT16",
-    "uint32_t": "UINT32",
-    "uint64_t": "UINT64",
-    "of_mac_addr_t": "ETHER",
-    "of_ipv4_t": "IPv4",
-    "of_ipv6_t": "IPv6",
-    "of_port_name_t": "STRINGZ",
-    "of_table_name_t": "STRINGZ",
-    "of_desc_str_t": "STRINGZ",
-    "of_serial_num_t": "STRINGZ",
-    "of_octets_t": "BYTES",
-    "of_port_no_t": "UINT32",
-    "of_port_desc_t": "STRINGZ",
-    "of_bsn_vport_t": "BYTES",
-    "of_bsn_vport_q_in_q_t": "BYTES",
-    "of_fm_cmd_t": "UINT16",
-    "of_wc_bmap_t": "UINT64",
-    "of_match_bmap_t": "UINT64",
-    "of_match_t": "BYTES",
-    "of_oxm_t": "BYTES",
-    "of_meter_features_t": "BYTES",
+    "char": "int8",
+    "uint8_t": "uint8",
+    "uint16_t": "uint16",
+    "uint32_t": "uint32",
+    "uint64_t": "uint64",
+    "of_mac_addr_t": "ether",
+    "of_ipv4_t": "ipv4",
+    "of_ipv6_t": "ipv6",
+    "of_port_name_t": "stringz",
+    "of_table_name_t": "stringz",
+    "of_desc_str_t": "stringz",
+    "of_serial_num_t": "stringz",
+    "of_octets_t": "bytes",
+    "of_port_no_t": "uint32",
+    "of_port_desc_t": "stringz",
+    "of_bsn_vport_t": "bytes",
+    "of_bsn_vport_q_in_q_t": "bytes",
+    "of_fm_cmd_t": "uint16",
+    "of_wc_bmap_t": "uint64",
+    "of_match_bmap_t": "uint64",
+    "of_match_t": "bytes",
+    "of_oxm_t": "bytes",
+    "of_meter_features_t": "bytes",
 }
 
 # Map from LOXI type to Wireshark base
diff --git a/wireshark_gen/templates/openflow.lua b/wireshark_gen/templates/openflow.lua
index 94b9153..1b1bc8a 100644
--- a/wireshark_gen/templates/openflow.lua
+++ b/wireshark_gen/templates/openflow.lua
@@ -55,7 +55,13 @@
 
 fields = {}
 :: for field in fields:
-fields[${repr(field.fullname)}] = ProtoField.new("${field.name}", "${field.fullname}", "FT_${field.type}", nil, "BASE_${field.base}")
+:: if field.type in ["uint8", "uint16", "uint32", "uint64"]:
+fields[${repr(field.fullname)}] = ProtoField.${field.type}("${field.fullname}", "${field.name}", base.${field.base})
+:: elif field.type in ["ipv4", "ipv6", "ether", "bytes", "stringz"]:
+fields[${repr(field.fullname)}] = ProtoField.${field.type}("${field.fullname}", "${field.name}")
+:: else:
+:: raise NotImplementedError("unknown Wireshark type " + field.type)
+:: #endif
 :: #endfor
 
 p_of.fields = {