Minor: reformatting, unneeded #includes, whitespace cleanup;
authorBill Meier <wmeier@newsguy.com>
Thu, 26 Apr 2012 16:47:37 +0000 (16:47 -0000)
committerBill Meier <wmeier@newsguy.com>
Thu, 26 Apr 2012 16:47:37 +0000 (16:47 -0000)
Also: use val_to_str_const(0 instead of val_to_str() in a few cases.

svn path=/trunk/; revision=42271

18 files changed:
epan/dissectors/packet-dcerpc-conv.c
epan/dissectors/packet-dcom-sysact.c
epan/dissectors/packet-dhcpv6.c
epan/dissectors/packet-distcc.c
epan/dissectors/packet-dlsw.c
epan/dissectors/packet-dns.c
epan/dissectors/packet-dpnss-link.c
epan/dissectors/packet-dpnss.c
epan/dissectors/packet-drda.c
epan/dissectors/packet-dtpt.c
epan/dissectors/packet-dua.c
epan/dissectors/packet-eapol.c
epan/dissectors/packet-echo.c
epan/dissectors/packet-enc.c
epan/dissectors/packet-enip.c
epan/dissectors/packet-epmd.c
epan/dissectors/packet-esis.c
epan/dissectors/packet-fcip.c

index 72b23be301673d2c4737e2879a32eaad33be6036..8f9d5a2b059c5e4ee403f39c2a1ee3afb265f993 100644 (file)
@@ -58,23 +58,24 @@ static guint16  ver_conv = 3;
 
 static int
 conv_dissect_who_are_you_rqst (tvbuff_t *tvb, int offset,
-                                packet_info *pinfo, proto_tree *tree,
-                                guint8 *drep)
+                              packet_info *pinfo, proto_tree *tree,
+                              guint8 *drep)
 {
        /*
         *         [in]    uuid_t          *actuid,
         *         [in]    unsigned32      boot_time,
         */
-       e_uuid_t actuid;
+       e_uuid_t actuid;
 
-       offset = dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you_rqst_actuid, &actuid);
-       offset = dissect_ndr_time_t (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you_rqst_boot_time, NULL);
+       offset = dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you_rqst_actuid, &actuid);
+       offset = dissect_ndr_time_t (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you_rqst_boot_time, NULL);
 
-       if (check_col(pinfo->cinfo, COL_INFO)) {
-         col_add_fstr(pinfo->cinfo, COL_INFO,
-             "conv_who_are_you request actuid: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-              actuid.Data1, actuid.Data2, actuid.Data3, actuid.Data4[0], actuid.Data4[1],
-              actuid.Data4[2], actuid.Data4[3], actuid.Data4[4], actuid.Data4[5], actuid.Data4[6], actuid.Data4[7]);
+       if (check_col(pinfo->cinfo, COL_INFO)) {
+               col_add_fstr(pinfo->cinfo, COL_INFO,
+                            "conv_who_are_you request actuid: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+                            actuid.Data1, actuid.Data2, actuid.Data3,
+                            actuid.Data4[0], actuid.Data4[1], actuid.Data4[2], actuid.Data4[3],
+                            actuid.Data4[4], actuid.Data4[5], actuid.Data4[6], actuid.Data4[7]);
         }
 
        return offset;
@@ -82,33 +83,33 @@ conv_dissect_who_are_you_rqst (tvbuff_t *tvb, int offset,
 
 static int
 conv_dissect_who_are_you_resp (tvbuff_t *tvb, int offset,
-                                packet_info *pinfo, proto_tree *tree,
-                                guint8 *drep)
+                              packet_info *pinfo, proto_tree *tree,
+                              guint8 *drep)
 {
        /*
         *         [out]   unsigned32      *seq,
         *         [out]   unsigned32      *st
         */
-       guint32 seq, st;
+       guint32 seq, st;
 
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you_resp_seq, &seq);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_conv_rc, &st);
+       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you_resp_seq, &seq);
+       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_conv_rc, &st);
 
 
-       if (check_col(pinfo->cinfo, COL_INFO)) {
-         col_add_fstr(pinfo->cinfo, COL_INFO, "conv_who_are_you response seq:%u st:%s",
-               seq, val_to_str_ext(st, &dce_error_vals_ext, "%u"));
-       }
+       if (check_col(pinfo->cinfo, COL_INFO)) {
+               col_add_fstr(pinfo->cinfo, COL_INFO, "conv_who_are_you response seq:%u st:%s",
+                            seq, val_to_str_ext(st, &dce_error_vals_ext, "%u"));
+       }
 
-       return offset;
+       return offset;
 }
 
 
 
 static int
 conv_dissect_who_are_you2_rqst (tvbuff_t *tvb, int offset,
-                                packet_info *pinfo, proto_tree *tree,
-                                guint8 *drep)
+                               packet_info *pinfo, proto_tree *tree,
+                               guint8 *drep)
 {
        /*
         *         [in]    uuid_t          *actuid,
@@ -120,18 +121,19 @@ conv_dissect_who_are_you2_rqst (tvbuff_t *tvb, int offset,
         offset = dissect_ndr_time_t (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you2_rqst_boot_time, NULL);
 
         if (check_col(pinfo->cinfo, COL_INFO)) {
-           col_add_fstr(pinfo->cinfo, COL_INFO,
-                "conv_who_are_you2 request actuid: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-                 actuid.Data1, actuid.Data2, actuid.Data3, actuid.Data4[0], actuid.Data4[1],
-                 actuid.Data4[2], actuid.Data4[3], actuid.Data4[4], actuid.Data4[5], actuid.Data4[6], actuid.Data4[7]);
+               col_add_fstr(pinfo->cinfo, COL_INFO,
+                            "conv_who_are_you2 request actuid: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+                            actuid.Data1, actuid.Data2, actuid.Data3,
+                            actuid.Data4[0], actuid.Data4[1], actuid.Data4[2], actuid.Data4[3],
+                            actuid.Data4[4], actuid.Data4[5], actuid.Data4[6], actuid.Data4[7]);
         }
 
        return offset;
 }
 static int
 conv_dissect_who_are_you2_resp (tvbuff_t *tvb, int offset,
-                                packet_info *pinfo, proto_tree *tree,
-                                guint8 *drep)
+                               packet_info *pinfo, proto_tree *tree,
+                               guint8 *drep)
 {
        /*
         *         [out]   unsigned32      *seq,
@@ -139,19 +141,20 @@ conv_dissect_who_are_you2_resp (tvbuff_t *tvb, int offset,
         *
         *         [out]   unsigned32      *st
         */
-       guint32 seq, st;
-       e_uuid_t cas_uuid;
-
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you2_resp_seq, &seq);
-       offset = dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you2_resp_casuuid, &cas_uuid);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_conv_rc, &st);
-
-       if (check_col(pinfo->cinfo, COL_INFO)) {
-         col_add_fstr(pinfo->cinfo, COL_INFO,
-               "conv_who_are_you2 response seq:%u st:%s cas:%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-                seq, val_to_str_ext(st, &dce_error_vals_ext, "%u"),
-                cas_uuid.Data1, cas_uuid.Data2, cas_uuid.Data3, cas_uuid.Data4[0], cas_uuid.Data4[1],
-                cas_uuid.Data4[2], cas_uuid.Data4[3], cas_uuid.Data4[4], cas_uuid.Data4[5], cas_uuid.Data4[6], cas_uuid.Data4[7]);
+       guint32 seq, st;
+       e_uuid_t cas_uuid;
+
+       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you2_resp_seq, &seq);
+       offset = dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep, hf_conv_who_are_you2_resp_casuuid, &cas_uuid);
+       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_conv_rc, &st);
+
+       if (check_col(pinfo->cinfo, COL_INFO)) {
+               col_add_fstr(pinfo->cinfo, COL_INFO,
+                            "conv_who_are_you2 response seq:%u st:%s cas:%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+                            seq, val_to_str_ext(st, &dce_error_vals_ext, "%u"),
+                            cas_uuid.Data1, cas_uuid.Data2, cas_uuid.Data3,
+                            cas_uuid.Data4[0], cas_uuid.Data4[1], cas_uuid.Data4[2], cas_uuid.Data4[3],
+                            cas_uuid.Data4[4], cas_uuid.Data4[5], cas_uuid.Data4[6], cas_uuid.Data4[7]);
         }
 
        return offset;
@@ -163,9 +166,12 @@ static dcerpc_sub_dissector conv_dissectors[] = {
           conv_dissect_who_are_you_rqst, conv_dissect_who_are_you_resp },
     { 1, "who_are_you2",
           conv_dissect_who_are_you2_rqst, conv_dissect_who_are_you2_resp },
-    { 2, "are_you_there", NULL, NULL },
-    { 3, "who_are_you_auth", NULL, NULL },
-    { 4, "who_are_you_auth_more", NULL, NULL },
+    { 2, "are_you_there",
+          NULL, NULL },
+    { 3, "who_are_you_auth",
+          NULL, NULL },
+    { 4, "who_are_you_auth_more",
+          NULL, NULL },
     { 0, NULL, NULL, NULL }
 };
 
index 1c771d4b0c2a94f4298787faea0c73bc26b71ed8..d4a223a492e00a540057d92c9e38c1a17aa2ef4b 100644 (file)
@@ -46,36 +46,35 @@ static guint16  ver_ISystemActivator = 0;
 
 static int
 dissect_remsysact_remotecreateinstance_rqst(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, guint8 *drep)
+    packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
 
     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
 
     /* XXX - what is this? */
-    offset = dissect_dcom_nospec_data(tvb, offset, pinfo, tree, drep, 
-        4);
+    offset = dissect_dcom_nospec_data(tvb, offset, pinfo, tree, drep, 4);
 
-       offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, drep, 
-                                               hf_sysact_unknown, NULL /* XXX */);
+    offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, drep,
+                        hf_sysact_unknown, NULL /* XXX */);
 
-       return offset;
+    return offset;
 }
 
 
 static int
 dissect_remsysact_remotecreateinstance_resp(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, guint8 *drep)
+    packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
 
     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
 
-       offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, drep, 
-                                               hf_sysact_unknown, NULL /* XXX */);
+    offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, drep,
+                        hf_sysact_unknown, NULL /* XXX */);
 
-    offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, 
-                                        NULL /* pu32HResult */);
+    offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
+                     NULL /* pu32HResult */);
 
-       return offset;
+    return offset;
 }
 
 
@@ -93,23 +92,27 @@ static dcerpc_sub_dissector ISystemActivator_dissectors[] = {
 void
 proto_register_ISystemActivator (void)
 {
-       static hf_register_info hf[] = {
-               { &hf_opnum,
-                 { "Operation", "isystemactivator.opnum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
-               { &hf_sysact_unknown,
-               { "IUnknown", "isystemactivator.unknown", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
-       };
-       static gint *ett[] = {
-               &ett_ISystemActivator
-       };
-       proto_ISystemActivator = proto_register_protocol ("ISystemActivator ISystemActivator Resolver", "ISystemActivator", "isystemactivator");
-       proto_register_field_array (proto_ISystemActivator, hf, array_length (hf));
-       proto_register_subtree_array (ett, array_length (ett));
+    static hf_register_info hf[] = {
+        { &hf_opnum,
+          { "Operation", "isystemactivator.opnum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+        { &hf_sysact_unknown,
+        { "IUnknown", "isystemactivator.unknown", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+    };
+    static gint *ett[] = {
+        &ett_ISystemActivator
+    };
+    proto_ISystemActivator = proto_register_protocol ("ISystemActivator ISystemActivator Resolver",
+                                                      "ISystemActivator",
+                                                      "isystemactivator");
+    proto_register_field_array (proto_ISystemActivator, hf, array_length (hf));
+    proto_register_subtree_array (ett, array_length (ett));
 }
 
 void
 proto_reg_handoff_ISystemActivator (void)
 {
-       /* Register the protocol as dcerpc */
-       dcerpc_init_uuid (proto_ISystemActivator, ett_ISystemActivator, &uuid_ISystemActivator, ver_ISystemActivator, ISystemActivator_dissectors, hf_opnum);
+    /* Register the protocol as dcerpc */
+    dcerpc_init_uuid (proto_ISystemActivator, ett_ISystemActivator,
+                      &uuid_ISystemActivator, ver_ISystemActivator,
+                      ISystemActivator_dissectors, hf_opnum);
 }
index 8bebe7d1ce6f7a45c78f8dcbcb6eaa11e2a2ecf8..89bc9ebf446a01f2fd98155696fb7e60347ad6d1 100644 (file)
@@ -54,7 +54,7 @@
 #include <epan/strutil.h>
 #include <epan/arptypes.h>
 #include "packet-arp.h"
-#include "packet-dns.h"                                /* for get_dns_name() */
+#include "packet-dns.h"                         /* for get_dns_name() */
 
 static int proto_dhcpv6 = -1;
 static int hf_dhcpv6_msgtype = -1;
@@ -80,86 +80,86 @@ static gint ett_dhcpv6_option_vsoption = -1;
 static gint ett_dhcpv6_vendor_option = -1;
 static gint ett_dhcpv6_pkt_option = -1;
 
-#define UDP_PORT_DHCPV6_DOWNSTREAM     546
-#define UDP_PORT_DHCPV6_UPSTREAM       547
-
-#define DHCPV6_LEASEDURATION_INFINITY  0xffffffff
-
-#define        SOLICIT                  1
-#define        ADVERTISE                2
-#define        REQUEST                  3
-#define        CONFIRM                  4
-#define        RENEW                    5
-#define        REBIND                   6
-#define        REPLY                    7
-#define        RELEASE                  8
-#define        DECLINE                  9
-#define        RECONFIGURE             10
-#define        INFORMATION_REQUEST     11
-#define        RELAY_FORW              12
-#define        RELAY_REPLY             13
-#define        LEASEQUERY              14
-#define        LEASEQUERY_REPLY        15
-
-#define        OPTION_CLIENTID          1
-#define        OPTION_SERVERID          2
-#define        OPTION_IA_NA             3
-#define        OPTION_IA_TA             4
-#define        OPTION_IAADDR            5
-#define        OPTION_ORO               6
-#define        OPTION_PREFERENCE        7
-#define        OPTION_ELAPSED_TIME      8
-#define        OPTION_RELAY_MSG         9
-/* #define     OPTION_SERVER_MSG       10 */
-#define        OPTION_AUTH             11
-#define        OPTION_UNICAST          12
-#define        OPTION_STATUS_CODE      13
-#define        OPTION_RAPID_COMMIT     14
-#define        OPTION_USER_CLASS       15
-#define        OPTION_VENDOR_CLASS     16
-#define        OPTION_VENDOR_OPTS      17
-#define        OPTION_INTERFACE_ID     18
-#define        OPTION_RECONF_MSG       19
-#define        OPTION_RECONF_ACCEPT    20
-#define        OPTION_SIP_SERVER_D     21
-#define        OPTION_SIP_SERVER_A     22
-#define        OPTION_DNS_SERVERS      23
-#define        OPTION_DOMAIN_LIST      24
-#define        OPTION_IA_PD            25
-#define        OPTION_IAPREFIX         26
-#define        OPTION_NIS_SERVERS      27
-#define        OPTION_NISP_SERVERS     28
-#define        OPTION_NIS_DOMAIN_NAME  29
-#define        OPTION_NISP_DOMAIN_NAME 30
-#define        OPTION_SNTP_SERVERS     31
-#define        OPTION_LIFETIME         32
-#define        OPTION_BCMCS_SERVER_D   33
-#define        OPTION_BCMCS_SERVER_A   34
-#define        OPTION_GEOCONF_CIVIC    36
-#define        OPTION_REMOTE_ID        37
-#define        OPTION_SUBSCRIBER_ID    38
-#define        OPTION_CLIENT_FQDN      39
-#define        OPTION_PANA_AGENT       40
-#define        OPTION_TIME_ZONE        41
-#define        OPTION_TZDB             42
-#define        OPTION_ERO              43
-#define        OPTION_LQ_QUERY         44
-#define        OPTION_CLIENT_DATA      45
-#define        OPTION_CLT_TIME         46
-#define        OPTION_LQ_RELAY_DATA    47
-#define        OPTION_LQ_CLIENT_LINK   48
-#define        OPTION_CAPWAP_AC_V6     52
-#define        OPTION_AFTR_NAME        64
+#define UDP_PORT_DHCPV6_DOWNSTREAM      546
+#define UDP_PORT_DHCPV6_UPSTREAM        547
+
+#define DHCPV6_LEASEDURATION_INFINITY   0xffffffff
+
+#define SOLICIT                  1
+#define ADVERTISE                2
+#define REQUEST                  3
+#define CONFIRM                  4
+#define RENEW                    5
+#define REBIND                   6
+#define REPLY                    7
+#define RELEASE                  8
+#define DECLINE                  9
+#define RECONFIGURE             10
+#define INFORMATION_REQUEST     11
+#define RELAY_FORW              12
+#define RELAY_REPLY             13
+#define LEASEQUERY              14
+#define LEASEQUERY_REPLY        15
+
+#define OPTION_CLIENTID          1
+#define OPTION_SERVERID          2
+#define OPTION_IA_NA             3
+#define OPTION_IA_TA             4
+#define OPTION_IAADDR            5
+#define OPTION_ORO               6
+#define OPTION_PREFERENCE        7
+#define OPTION_ELAPSED_TIME      8
+#define OPTION_RELAY_MSG         9
+/* #define      OPTION_SERVER_MSG       10 */
+#define OPTION_AUTH             11
+#define OPTION_UNICAST          12
+#define OPTION_STATUS_CODE      13
+#define OPTION_RAPID_COMMIT     14
+#define OPTION_USER_CLASS       15
+#define OPTION_VENDOR_CLASS     16
+#define OPTION_VENDOR_OPTS      17
+#define OPTION_INTERFACE_ID     18
+#define OPTION_RECONF_MSG       19
+#define OPTION_RECONF_ACCEPT    20
+#define OPTION_SIP_SERVER_D     21
+#define OPTION_SIP_SERVER_A     22
+#define OPTION_DNS_SERVERS      23
+#define OPTION_DOMAIN_LIST      24
+#define OPTION_IA_PD            25
+#define OPTION_IAPREFIX         26
+#define OPTION_NIS_SERVERS      27
+#define OPTION_NISP_SERVERS     28
+#define OPTION_NIS_DOMAIN_NAME  29
+#define OPTION_NISP_DOMAIN_NAME 30
+#define OPTION_SNTP_SERVERS     31
+#define OPTION_LIFETIME         32
+#define OPTION_BCMCS_SERVER_D   33
+#define OPTION_BCMCS_SERVER_A   34
+#define OPTION_GEOCONF_CIVIC    36
+#define OPTION_REMOTE_ID        37
+#define OPTION_SUBSCRIBER_ID    38
+#define OPTION_CLIENT_FQDN      39
+#define OPTION_PANA_AGENT       40
+#define OPTION_TIME_ZONE        41
+#define OPTION_TZDB             42
+#define OPTION_ERO              43
+#define OPTION_LQ_QUERY         44
+#define OPTION_CLIENT_DATA      45
+#define OPTION_CLT_TIME         46
+#define OPTION_LQ_RELAY_DATA    47
+#define OPTION_LQ_CLIENT_LINK   48
+#define OPTION_CAPWAP_AC_V6     52
+#define OPTION_AFTR_NAME        64
 
 /* temporary value until defined by IETF */
-#define OPTION_MIP6_HA         165
-#define OPTION_MIP6_HOA                166
-#define OPTION_NAI             167
+#define OPTION_MIP6_HA          165
+#define OPTION_MIP6_HOA         166
+#define OPTION_NAI              167
 
-#define        DUID_LLT                1
-#define        DUID_EN                 2
-#define        DUID_LL                 3
-#define        DUID_LL_OLD             4
+#define DUID_LLT                1
+#define DUID_EN                 2
+#define DUID_LL                 3
+#define DUID_LL_OLD             4
 
 static const value_string msgtype_vals[] = {
     { SOLICIT,                 "Solicit" },
@@ -262,18 +262,18 @@ static const value_string duidtype_vals[] =
 };
 
 static const true_false_string fqdn_n = {
-  "Server should not perform DNS updates",
-  "Server should perform DNS updates"
+    "Server should not perform DNS updates",
+    "Server should perform DNS updates"
 };
 
 static const true_false_string fqdn_o = {
-  "Server has overridden client's S bit preference",
-  "Server has not overridden client's S bit preference"
+    "Server has overridden client's S bit preference",
+    "Server has not overridden client's S bit preference"
 };
 
 static const true_false_string fqdn_s = {
-  "Server should perform forward DNS updates",
-  "Server should not perform forward DNS updates"
+    "Server should perform forward DNS updates",
+    "Server should not perform forward DNS updates"
 };
 
 /* CableLabs Common Vendor Specific Options */
@@ -395,11 +395,11 @@ static const value_string sec_tcm_vals[] = {
 /* May be called recursively */
 static void
 dissect_dhcpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
-              gboolean downstream, int off, int eoff);
+               gboolean downstream, int off, int eoff);
 
 static int
 dissect_packetcable_ccc_option(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
-                              int optend)
+                               int optend)
 {
     /** THE ENCODING OF THIS SUBOPTION HAS CHANGED FROM DHCPv4
         the code and length fields have grown from a single octet to
@@ -437,7 +437,7 @@ dissect_packetcable_ccc_option(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
                               val_to_str(subopt, pkt_ccc_opt_vals, "unknown/reserved") );
 
     switch (subopt) {
-    case PKT_CCC_PRI_DHCP:     /* IPv4 address values */
+    case PKT_CCC_PRI_DHCP:      /* IPv4 address values */
     case PKT_CCC_SEC_DHCP:
         if (subopt_len == 4) {
             ipv4_address = tvb_get_ipv4(tvb, suboptoff);
@@ -1035,7 +1035,7 @@ dhcpv6_domain(proto_tree * subtree, tvbuff_t *tvb, int offset, guint16 optlen)
 
         /* read length of the next substring */
         len = tvb_get_guint8(tvb, offset);
-        /* Microsoft dhcpv6 clients aren't currently RFC 4704 conform: They send an
+        /* Microsoft dhcpv6 clients aren't currently RFC 4704 conformant: They send an
          * ASCII string instead of a DNS record encoded domain name. Catch that case
          * to allow us to continue after such a malformed record.
          */
@@ -1083,13 +1083,13 @@ dhcpv6_domain(proto_tree * subtree, tvbuff_t *tvb, int offset, guint16 optlen)
 /* Returns the number of bytes consumed by this option. */
 static int
 dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
-             gboolean downstream, int off, int eoff, gboolean *at_end)
+              gboolean downstream, int off, int eoff, gboolean *at_end)
 {
     guint8 *buf;
-    guint16    opttype;
-    guint16    optlen;
-    guint16    hwtype;
-    guint16    temp_optlen = 0;
+    guint16     opttype;
+    guint16     optlen;
+    guint16     hwtype;
+    guint16     temp_optlen = 0;
     proto_item *ti;
     proto_tree *subtree;
     proto_tree *subtree_2;
@@ -1858,7 +1858,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
 
 static void
 dissect_dhcpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
-              gboolean downstream, int off, int eoff)
+               gboolean downstream, int off, int eoff)
 {
     proto_tree *bp_tree = NULL;
     proto_item *ti;
index 9a0182d5be0ae3a9a69eaf8fc80bc309a51e1443..c46a85f39e95a027e664d17ee7bba0fa0730752c 100644 (file)
 #endif
 
 #include <stdio.h>
-#include <stdlib.h>
-
 #include <string.h>
 #include <time.h>
+
 #include <glib.h>
 
 #include <epan/packet.h>
@@ -61,32 +60,32 @@ static dissector_handle_t data_handle;
 static gboolean distcc_desegment = TRUE;
 
 
-#define TCP_PORT_DISTCC        3632
+#define TCP_PORT_DISTCC 3632
 
 static guint glb_distcc_tcp_port = TCP_PORT_DISTCC;
 
 extern void proto_reg_handoff_distcc(void);
 
 #define CHECK_PDU_LEN(x) \
-       if(parameter>tvb_length_remaining(tvb, offset) || parameter < 1){\
-               len=tvb_length_remaining(tvb, offset);\
-               col_append_str(pinfo->cinfo, COL_INFO, "[Short" x " PDU]");\
-       } \
-       tvb_ensure_bytes_exist(tvb, offset, len);
+    if(parameter>tvb_length_remaining(tvb, offset) || parameter < 1){\
+        len=tvb_length_remaining(tvb, offset);\
+        col_append_str(pinfo->cinfo, COL_INFO, "[Short" x " PDU]");\
+    } \
+    tvb_ensure_bytes_exist(tvb, offset, len);
 
 
 #define DESEGMENT_TCP(x) \
-       if(distcc_desegment && pinfo->can_desegment){\
-               /* only attempt reassembly if whe have the full segment */\
-               if(tvb_length_remaining(tvb, offset)==tvb_reported_length_remaining(tvb, offset)){\
-                       if(parameter>tvb_length_remaining(tvb, offset)){\
-                               proto_tree_add_text(tree, tvb, offset-12, -1, "[Short " x " PDU]");\
-                               pinfo->desegment_offset=offset-12;\
-                               pinfo->desegment_len=parameter-tvb_length_remaining(tvb, offset);\
-                               return offset+len;\
-                       }\
-               }\
-       }
+    if(distcc_desegment && pinfo->can_desegment){\
+        /* only attempt reassembly if whe have the full segment */\
+        if(tvb_length_remaining(tvb, offset)==tvb_reported_length_remaining(tvb, offset)){\
+            if(parameter>tvb_length_remaining(tvb, offset)){\
+                proto_tree_add_text(tree, tvb, offset-12, -1, "[Short " x " PDU]");\
+                pinfo->desegment_offset=offset-12;\
+                pinfo->desegment_len=parameter-tvb_length_remaining(tvb, offset);\
+                return offset+len;\
+            }\
+        }\
+    }
 
 
 
@@ -95,169 +94,169 @@ extern void proto_reg_handoff_distcc(void);
 static int
 dissect_distcc_dist(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint32 parameter)
 {
-       proto_tree_add_uint_format(tree, hf_distcc_version, tvb, offset-12, 12, parameter, "DIST: %d", parameter);
+    proto_tree_add_uint_format(tree, hf_distcc_version, tvb, offset-12, 12, parameter, "DIST: %d", parameter);
 
-       col_append_fstr(pinfo->cinfo, COL_INFO, "DIST:%d ", parameter);
+    col_append_fstr(pinfo->cinfo, COL_INFO, "DIST:%d ", parameter);
 
-       return offset;
+    return offset;
 }
 
 static int
 dissect_distcc_done(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint32 parameter)
 {
-       proto_tree_add_uint_format(tree, hf_distcc_version, tvb, offset-12, 12, parameter, "DONE: %d", parameter);
+    proto_tree_add_uint_format(tree, hf_distcc_version, tvb, offset-12, 12, parameter, "DONE: %d", parameter);
 
-       col_append_fstr(pinfo->cinfo, COL_INFO, "DONE:%d ", parameter);
+    col_append_fstr(pinfo->cinfo, COL_INFO, "DONE:%d ", parameter);
 
-       return offset;
+    return offset;
 }
 
 static int
 dissect_distcc_stat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint32 parameter)
 {
-       proto_tree_add_uint_format(tree, hf_distcc_stat, tvb, offset-12, 12, parameter, "STAT: %d", parameter);
+    proto_tree_add_uint_format(tree, hf_distcc_stat, tvb, offset-12, 12, parameter, "STAT: %d", parameter);
 
-       col_append_fstr(pinfo->cinfo, COL_INFO, "STAT:%d ", parameter);
+    col_append_fstr(pinfo->cinfo, COL_INFO, "STAT:%d ", parameter);
 
-       return offset;
+    return offset;
 }
 
 static int
 dissect_distcc_argc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint32 parameter)
 {
-       proto_tree_add_uint_format(tree, hf_distcc_argc, tvb, offset-12, 12, parameter, "ARGC: %d", parameter);
+    proto_tree_add_uint_format(tree, hf_distcc_argc, tvb, offset-12, 12, parameter, "ARGC: %d", parameter);
 
-       col_append_fstr(pinfo->cinfo, COL_INFO, "ARGC:%d ", parameter);
+    col_append_fstr(pinfo->cinfo, COL_INFO, "ARGC:%d ", parameter);
 
-       return offset;
+    return offset;
 }
 
 static int
 dissect_distcc_argv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gint parameter)
 {
-       char argv[256];
-       int argv_len;
-       gint len=parameter;
+    char argv[256];
+    int argv_len;
+    gint len=parameter;
 
 
-       CHECK_PDU_LEN("ARGV");
+    CHECK_PDU_LEN("ARGV");
 
-       /* see if we need to desegment the PDU */
-       DESEGMENT_TCP("ARGV");
+    /* see if we need to desegment the PDU */
+    DESEGMENT_TCP("ARGV");
 
 
 
-       argv_len=len>255?255:len;
-       tvb_memcpy(tvb, argv, offset, argv_len);
-       argv[argv_len]=0;
+    argv_len=len>255?255:len;
+    tvb_memcpy(tvb, argv, offset, argv_len);
+    argv[argv_len]=0;
 
-       proto_tree_add_item(tree, hf_distcc_argv, tvb, offset, len, ENC_ASCII|ENC_NA);
+    proto_tree_add_item(tree, hf_distcc_argv, tvb, offset, len, ENC_ASCII|ENC_NA);
 
-       col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", argv);
+    col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", argv);
 
-       if(len!=parameter){
-               proto_tree_add_text(tree, tvb, 0, 0, "[Short ARGV PDU]");
-       }
-       return offset+len;
+    if(len!=parameter){
+        proto_tree_add_text(tree, tvb, 0, 0, "[Short ARGV PDU]");
+    }
+    return offset+len;
 }
 
 static int
 dissect_distcc_serr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gint parameter)
 {
-       char argv[256];
-       int argv_len;
-       gint len=parameter;
+    char argv[256];
+    int argv_len;
+    gint len=parameter;
 
 
-       CHECK_PDU_LEN("SERR");
+    CHECK_PDU_LEN("SERR");
 
-       /* see if we need to desegment the PDU */
-       DESEGMENT_TCP("SERR");
+    /* see if we need to desegment the PDU */
+    DESEGMENT_TCP("SERR");
 
 
 
-       argv_len=len>255?255:len;
-       tvb_memcpy(tvb, argv, offset, argv_len);
-       argv[argv_len]=0;
+    argv_len=len>255?255:len;
+    tvb_memcpy(tvb, argv, offset, argv_len);
+    argv[argv_len]=0;
 
-       proto_tree_add_item(tree, hf_distcc_serr, tvb, offset, len, ENC_ASCII|ENC_NA);
+    proto_tree_add_item(tree, hf_distcc_serr, tvb, offset, len, ENC_ASCII|ENC_NA);
 
-       col_append_fstr(pinfo->cinfo, COL_INFO, "SERR:%s ", argv);
+    col_append_fstr(pinfo->cinfo, COL_INFO, "SERR:%s ", argv);
 
-       if(len!=parameter){
-               proto_tree_add_text(tree, tvb, 0, 0, "[Short SERR PDU]");
-       }
-       return offset+len;
+    if(len!=parameter){
+        proto_tree_add_text(tree, tvb, 0, 0, "[Short SERR PDU]");
+    }
+    return offset+len;
 }
 
 static int
 dissect_distcc_sout(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gint parameter)
 {
-       char argv[256];
-       int argv_len;
-       gint len=parameter;
+    char argv[256];
+    int argv_len;
+    gint len=parameter;
 
 
-       CHECK_PDU_LEN("SOUT");
+    CHECK_PDU_LEN("SOUT");
 
-       /* see if we need to desegment the PDU */
-       DESEGMENT_TCP("SOUT");
+    /* see if we need to desegment the PDU */
+    DESEGMENT_TCP("SOUT");
 
 
 
-       argv_len=len>255?255:len;
-       tvb_memcpy(tvb, argv, offset, argv_len);
-       argv[argv_len]=0;
+    argv_len=len>255?255:len;
+    tvb_memcpy(tvb, argv, offset, argv_len);
+    argv[argv_len]=0;
 
-       proto_tree_add_item(tree, hf_distcc_sout, tvb, offset, len, ENC_ASCII|ENC_NA);
+    proto_tree_add_item(tree, hf_distcc_sout, tvb, offset, len, ENC_ASCII|ENC_NA);
 
-       col_append_fstr(pinfo->cinfo, COL_INFO, "SOUT:%s ", argv);
+    col_append_fstr(pinfo->cinfo, COL_INFO, "SOUT:%s ", argv);
 
-       if(len!=parameter){
-               proto_tree_add_text(tree, tvb, 0, 0, "[Short SOUT PDU]");
-       }
-       return offset+len;
+    if(len!=parameter){
+        proto_tree_add_text(tree, tvb, 0, 0, "[Short SOUT PDU]");
+    }
+    return offset+len;
 }
 
 
 static int
 dissect_distcc_doti(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gint parameter)
 {
-       gint len=parameter;
+    gint len=parameter;
 
 
-       CHECK_PDU_LEN("DOTI");
+    CHECK_PDU_LEN("DOTI");
 
-       /* see if we need to desegment the PDU */
-       DESEGMENT_TCP("DOTI");
+    /* see if we need to desegment the PDU */
+    DESEGMENT_TCP("DOTI");
 
-       col_append_str(pinfo->cinfo, COL_INFO, "DOTI source ");
+    col_append_str(pinfo->cinfo, COL_INFO, "DOTI source ");
 
-       proto_tree_add_item(tree, hf_distcc_doti_source, tvb, offset, len, ENC_ASCII|ENC_NA);
-       if(len!=parameter){
-               proto_tree_add_text(tree, tvb, 0, 0, "[Short DOTI PDU]");
-       }
-       return offset+len;
+    proto_tree_add_item(tree, hf_distcc_doti_source, tvb, offset, len, ENC_ASCII|ENC_NA);
+    if(len!=parameter){
+        proto_tree_add_text(tree, tvb, 0, 0, "[Short DOTI PDU]");
+    }
+    return offset+len;
 }
 
 static int
 dissect_distcc_doto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gint parameter)
 {
-       gint len=parameter;
+    gint len=parameter;
 
 
-       CHECK_PDU_LEN("DOTO");
+    CHECK_PDU_LEN("DOTO");
 
-       /* see if we need to desegment the PDU */
-       DESEGMENT_TCP("DOTO");
+    /* see if we need to desegment the PDU */
+    DESEGMENT_TCP("DOTO");
 
-       col_append_str(pinfo->cinfo, COL_INFO, "DOTO object ");
+    col_append_str(pinfo->cinfo, COL_INFO, "DOTO object ");
 
-       proto_tree_add_item(tree, hf_distcc_doto_object, tvb, offset, len, ENC_NA);
-       if(len!=parameter){
-               proto_tree_add_text(tree, tvb, 0, 0, "[Short DOTO PDU]");
-       }
-       return offset+len;
+    proto_tree_add_item(tree, hf_distcc_doto_object, tvb, offset, len, ENC_NA);
+    if(len!=parameter){
+        proto_tree_add_text(tree, tvb, 0, 0, "[Short DOTO PDU]");
+    }
+    return offset+len;
 }
 
 
@@ -266,62 +265,62 @@ dissect_distcc_doto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int off
 static void
 dissect_distcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
 {
-       int offset=0;
-       proto_tree *tree=NULL;
-       proto_item *item=NULL;
-       char token[4];
-       guint32 parameter;
-
-
-       col_set_str(pinfo->cinfo, COL_PROTOCOL, "DISTCC ");
-
-       col_clear(pinfo->cinfo, COL_INFO);
-
-       if (parent_tree) {
-               item = proto_tree_add_item(parent_tree, proto_distcc, tvb, offset,
-                       -1, ENC_NA);
-               tree = proto_item_add_subtree(item, ett_distcc);
-       }
-
-       while(1){
-               /* we must have at least 12 bytes so we can read the
-                  token and the parameter */
-               if(tvb_length_remaining(tvb, offset)<12){
-                       return;
-               }
-
-               /* read the token */
-               tvb_memcpy(tvb, token, offset, 4);
-               offset+=4;
-
-               /* read the parameter */
-               if (sscanf(tvb_get_ptr(tvb, offset, 8), "%08x", &parameter) != 1)
-                       return;
-               offset+=8;
-
-               if(!strncmp(token, "DIST", 4)){
-                       offset=dissect_distcc_dist(tvb, pinfo, tree, offset, parameter);
-               } else if(!strncmp(token, "ARGC", 4)){
-                       offset=dissect_distcc_argc(tvb, pinfo, tree, offset, parameter);
-               } else if(!strncmp(token, "ARGV", 4)){
-                       offset=dissect_distcc_argv(tvb, pinfo, tree, offset, parameter);
-               } else if(!strncmp(token, "DOTI", 4)){
-                       offset=dissect_distcc_doti(tvb, pinfo, tree, offset, parameter);
-               } else if(!strncmp(token, "DONE", 4)){
-                       offset=dissect_distcc_done(tvb, pinfo, tree, offset, parameter);
-               } else if(!strncmp(token, "STAT", 4)){
-                       offset=dissect_distcc_stat(tvb, pinfo, tree, offset, parameter);
-               } else if(!strncmp(token, "SERR", 4)){
-                       offset=dissect_distcc_serr(tvb, pinfo, tree, offset, parameter);
-               } else if(!strncmp(token, "SOUT", 4)){
-                       offset=dissect_distcc_sout(tvb, pinfo, tree, offset, parameter);
-               } else if(!strncmp(token, "DOTO", 4)){
-                       offset=dissect_distcc_doto(tvb, pinfo, tree, offset, parameter);
-               } else {
-                       call_dissector(data_handle, tvb, pinfo, tree);
-                       return;
-               }
-       }
+    int offset=0;
+    proto_tree *tree=NULL;
+    proto_item *item=NULL;
+    char token[4];
+    guint32 parameter;
+
+
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "DISTCC ");
+
+    col_clear(pinfo->cinfo, COL_INFO);
+
+    if (parent_tree) {
+        item = proto_tree_add_item(parent_tree, proto_distcc, tvb, offset,
+            -1, ENC_NA);
+        tree = proto_item_add_subtree(item, ett_distcc);
+    }
+
+    while(1){
+        /* we must have at least 12 bytes so we can read the
+           token and the parameter */
+        if(tvb_length_remaining(tvb, offset)<12){
+            return;
+        }
+
+        /* read the token */
+        tvb_memcpy(tvb, token, offset, 4);
+        offset+=4;
+
+        /* read the parameter */
+        if (sscanf(tvb_get_ptr(tvb, offset, 8), "%08x", &parameter) != 1)
+            return;
+        offset+=8;
+
+        if(!strncmp(token, "DIST", 4)){
+            offset=dissect_distcc_dist(tvb, pinfo, tree, offset, parameter);
+        } else if(!strncmp(token, "ARGC", 4)){
+            offset=dissect_distcc_argc(tvb, pinfo, tree, offset, parameter);
+        } else if(!strncmp(token, "ARGV", 4)){
+            offset=dissect_distcc_argv(tvb, pinfo, tree, offset, parameter);
+        } else if(!strncmp(token, "DOTI", 4)){
+            offset=dissect_distcc_doti(tvb, pinfo, tree, offset, parameter);
+        } else if(!strncmp(token, "DONE", 4)){
+            offset=dissect_distcc_done(tvb, pinfo, tree, offset, parameter);
+        } else if(!strncmp(token, "STAT", 4)){
+            offset=dissect_distcc_stat(tvb, pinfo, tree, offset, parameter);
+        } else if(!strncmp(token, "SERR", 4)){
+            offset=dissect_distcc_serr(tvb, pinfo, tree, offset, parameter);
+        } else if(!strncmp(token, "SOUT", 4)){
+            offset=dissect_distcc_sout(tvb, pinfo, tree, offset, parameter);
+        } else if(!strncmp(token, "DOTO", 4)){
+            offset=dissect_distcc_doto(tvb, pinfo, tree, offset, parameter);
+        } else {
+            call_dissector(data_handle, tvb, pinfo, tree);
+            return;
+        }
+    }
 
 
 }
@@ -331,90 +330,90 @@ void
 proto_register_distcc(void)
 {
     static hf_register_info hf[] = {
-       {&hf_distcc_version,
-        {"DISTCC Version", "distcc.version",
-         FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
-       },
-       {&hf_distcc_argc,
-        {"ARGC", "distcc.argc",
-         FT_UINT32, BASE_DEC, NULL, 0x0, "Number of arguments", HFILL }
-       },
-       {&hf_distcc_argv,
-        {"ARGV", "distcc.argv",
-         FT_STRING, BASE_NONE, NULL, 0x0, "ARGV argument", HFILL }
-       },
-       {&hf_distcc_doti_source,
-        {"Source", "distcc.doti_source",
-         FT_STRING, BASE_NONE, NULL, 0x0, "DOTI Preprocessed Source File (.i)", HFILL }
-       },
-       {&hf_distcc_stat,
-        {"Status", "distcc.status",
-         FT_UINT32, BASE_DEC, NULL, 0x0, "Unix wait status for command completion", HFILL }
-       },
-       {&hf_distcc_serr,
-        {"SERR", "distcc.serr",
-         FT_STRING, BASE_NONE, NULL, 0x0, "STDERR output", HFILL }
-       },
-       {&hf_distcc_sout,
-        {"SOUT", "distcc.sout",
-         FT_STRING, BASE_NONE, NULL, 0x0, "STDOUT output", HFILL }
-       },
-       {&hf_distcc_doto_object,
-        {"Object", "distcc.doto_object",
-         FT_BYTES, BASE_NONE, NULL, 0x0, "DOTO Compiled object file (.o)", HFILL }
-       }
-
-       };
-
-       static gint *ett[] = {
-               &ett_distcc,
-       };
-
-       module_t *distcc_module;
-
-       proto_distcc = proto_register_protocol("Distcc Distributed Compiler",
-                                          "DISTCC", "distcc");
-       proto_register_field_array(proto_distcc, hf, array_length(hf));
-       proto_register_subtree_array(ett, array_length(ett));
-
-       distcc_module = prefs_register_protocol(proto_distcc,
-           proto_reg_handoff_distcc);
-       prefs_register_uint_preference(distcc_module, "tcp.port",
-                                  "DISTCC TCP Port",
-                                  "Set the TCP port for DISTCC messages",
-                                  10,
-                                  &glb_distcc_tcp_port);
-       prefs_register_bool_preference(distcc_module, "desegment_distcc_over_tcp",
+    {&hf_distcc_version,
+     {"DISTCC Version", "distcc.version",
+      FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+    },
+    {&hf_distcc_argc,
+     {"ARGC", "distcc.argc",
+      FT_UINT32, BASE_DEC, NULL, 0x0, "Number of arguments", HFILL }
+    },
+    {&hf_distcc_argv,
+     {"ARGV", "distcc.argv",
+      FT_STRING, BASE_NONE, NULL, 0x0, "ARGV argument", HFILL }
+    },
+    {&hf_distcc_doti_source,
+     {"Source", "distcc.doti_source",
+      FT_STRING, BASE_NONE, NULL, 0x0, "DOTI Preprocessed Source File (.i)", HFILL }
+    },
+    {&hf_distcc_stat,
+     {"Status", "distcc.status",
+      FT_UINT32, BASE_DEC, NULL, 0x0, "Unix wait status for command completion", HFILL }
+    },
+    {&hf_distcc_serr,
+     {"SERR", "distcc.serr",
+      FT_STRING, BASE_NONE, NULL, 0x0, "STDERR output", HFILL }
+    },
+    {&hf_distcc_sout,
+     {"SOUT", "distcc.sout",
+      FT_STRING, BASE_NONE, NULL, 0x0, "STDOUT output", HFILL }
+    },
+    {&hf_distcc_doto_object,
+     {"Object", "distcc.doto_object",
+      FT_BYTES, BASE_NONE, NULL, 0x0, "DOTO Compiled object file (.o)", HFILL }
+    }
+
+    };
+
+    static gint *ett[] = {
+        &ett_distcc,
+    };
+
+    module_t *distcc_module;
+
+    proto_distcc = proto_register_protocol("Distcc Distributed Compiler",
+                       "DISTCC", "distcc");
+    proto_register_field_array(proto_distcc, hf, array_length(hf));
+    proto_register_subtree_array(ett, array_length(ett));
+
+    distcc_module = prefs_register_protocol(proto_distcc,
+        proto_reg_handoff_distcc);
+    prefs_register_uint_preference(distcc_module, "tcp.port",
+                   "DISTCC TCP Port",
+                   "Set the TCP port for DISTCC messages",
+                   10,
+                   &glb_distcc_tcp_port);
+    prefs_register_bool_preference(distcc_module, "desegment_distcc_over_tcp",
         "Reassemble DISTCC-over-TCP messages\nspanning multiple TCP segments",
-               "Whether the DISTCC dissector should reassemble messages spanning multiple TCP segments."
-               " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
-               &distcc_desegment);
+        "Whether the DISTCC dissector should reassemble messages spanning multiple TCP segments."
+        " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
+        &distcc_desegment);
 }
 
 void
 proto_reg_handoff_distcc(void)
 {
-       static gboolean registered_dissector = FALSE;
-       static int distcc_tcp_port;
-       static dissector_handle_t distcc_handle;
-
-       if (!registered_dissector) {
-               /*
-                * We haven't registered the dissector yet; get a handle
-                * for it.
-                */
-               distcc_handle = create_dissector_handle(dissect_distcc,
-                   proto_distcc);
-               data_handle = find_dissector("data");
-               registered_dissector = TRUE;
-       } else {
-               /*
-                * We've registered the dissector with a TCP port number
-                * of "distcc_tcp_port"; we might be changing the TCP port
-                * number, so remove that registration.
-                */
-               dissector_delete_uint("tcp.port", distcc_tcp_port, distcc_handle);
-       }
-       distcc_tcp_port = glb_distcc_tcp_port;
-       dissector_add_uint("tcp.port", distcc_tcp_port, distcc_handle);
+    static gboolean registered_dissector = FALSE;
+    static int distcc_tcp_port;
+    static dissector_handle_t distcc_handle;
+
+    if (!registered_dissector) {
+        /*
+         * We haven't registered the dissector yet; get a handle
+         * for it.
+         */
+        distcc_handle = create_dissector_handle(dissect_distcc,
+            proto_distcc);
+        data_handle = find_dissector("data");
+        registered_dissector = TRUE;
+    } else {
+        /*
+         * We've registered the dissector with a TCP port number
+         * of "distcc_tcp_port"; we might be changing the TCP port
+         * number, so remove that registration.
+         */
+        dissector_delete_uint("tcp.port", distcc_tcp_port, distcc_handle);
+    }
+    distcc_tcp_port = glb_distcc_tcp_port;
+    dissector_add_uint("tcp.port", distcc_tcp_port, distcc_handle);
 }
index 7e61d1c92eddb15698ba63df0025534e51cdcfe4..807e542eef3af0a5960c2abd748ce3521892b5ba 100644 (file)
@@ -69,147 +69,147 @@ static gint ett_dlsw_vector = -1;
 #define  TEST_CIRCUIT_RSP        0x7B
 
 static const value_string dlsw_type_vals[] = {
-       { CANUREACH        , "Can U Reach Station-circuit start" },
-       { ICANREACH        , "I Can Reach Station-circuit start" },
-       { REACH_ACK        , "Reach Acknowledgment" },
-       { DGRMFRAME        , "Datagram Frame" },
-       { XIDFRAME         , "XID Frame" },
-       { CONTACT          , "Contact Remote Station" },
-       { CONTACTED        , "Remote Station Contacted" },
-       { RESTART_DL       , "Restart Data Link" },
-       { DL_RESTARTED     , "Data Link Restarted" },
-       { ENTER_BUSY       , "Enter Busy" },
-       { EXIT_BUSY        , "Exit Busy" },
-       { INFOFRAME        , "Information (I) Frame" },
-       { HALT_DL          , "Halt Data Link" },
-       { DL_HALTED        , "Data Link Halted" },
-       { NETBIOS_NQ       , "NETBIOS Name Query-circuit setup" },
-       { NETBIOS_NR       , "NETBIOS Name Recog-circuit setup" },
-       { DATAFRAME        , "Data Frame" },
-       { HALT_DL_NOACK    , "Halt Data Link with no Ack" },
-       { NETBIOS_ANQ      , "NETBIOS Add Name Query" },
-       { NETBIOS_ANR      , "NETBIOS Add Name Response" },
-       { KEEPALIVE        , "Transport Keepalive Message" },
-       { CAP_EXCHANGE     , "Capabilities Exchange" },
-       { IFCM             , "Independent Flow Control Message" },
-       { TEST_CIRCUIT_REQ , "Test Circuit Request" },
-       { TEST_CIRCUIT_RSP , "Test Circuit Response" },
-       { 0 , NULL }
+  { CANUREACH        , "Can U Reach Station-circuit start" },
+  { ICANREACH        , "I Can Reach Station-circuit start" },
+  { REACH_ACK        , "Reach Acknowledgment" },
+  { DGRMFRAME        , "Datagram Frame" },
+  { XIDFRAME         , "XID Frame" },
+  { CONTACT          , "Contact Remote Station" },
+  { CONTACTED        , "Remote Station Contacted" },
+  { RESTART_DL       , "Restart Data Link" },
+  { DL_RESTARTED     , "Data Link Restarted" },
+  { ENTER_BUSY       , "Enter Busy" },
+  { EXIT_BUSY        , "Exit Busy" },
+  { INFOFRAME        , "Information (I) Frame" },
+  { HALT_DL          , "Halt Data Link" },
+  { DL_HALTED        , "Data Link Halted" },
+  { NETBIOS_NQ       , "NETBIOS Name Query-circuit setup" },
+  { NETBIOS_NR       , "NETBIOS Name Recog-circuit setup" },
+  { DATAFRAME        , "Data Frame" },
+  { HALT_DL_NOACK    , "Halt Data Link with no Ack" },
+  { NETBIOS_ANQ      , "NETBIOS Add Name Query" },
+  { NETBIOS_ANR      , "NETBIOS Add Name Response" },
+  { KEEPALIVE        , "Transport Keepalive Message" },
+  { CAP_EXCHANGE     , "Capabilities Exchange" },
+  { IFCM             , "Independent Flow Control Message" },
+  { TEST_CIRCUIT_REQ , "Test Circuit Request" },
+  { TEST_CIRCUIT_RSP , "Test Circuit Response" },
+  { 0 , NULL }
 };
 static const value_string dlsw_version_vals[] = {
-        { 0x31        , "Version 1 (RFC 1795)" },
-        { 0x32        , "Version 2 (RFC 2166)" },
-        { 0x33        , "Vendor Specific" },
-        { 0x34        , "Vendor Specific" },
-        { 0x35        , "Vendor Specific" },
-        { 0x36        , "Vendor Specific" },
-        { 0x37        , "Vendor Specific" },
-        { 0x38        , "Vendor Specific" },
-        { 0x39        , "Vendor Specific" },
-        { 0x3A        , "Vendor Specific" },
-        { 0x3B        , "Vendor Specific" },
-        { 0x3C        , "Vendor Specific" },
-        { 0x3D        , "Vendor Specific" },
-        { 0x3E        , "Vendor Specific" },
-        { 0x3F        , "Vendor Specific" },
-        { 0x4B        , "Pre 1 (RFC 1434)" },
-        { 0x00        , NULL }
+  { 0x31        , "Version 1 (RFC 1795)" },
+  { 0x32        , "Version 2 (RFC 2166)" },
+  { 0x33        , "Vendor Specific" },
+  { 0x34        , "Vendor Specific" },
+  { 0x35        , "Vendor Specific" },
+  { 0x36        , "Vendor Specific" },
+  { 0x37        , "Vendor Specific" },
+  { 0x38        , "Vendor Specific" },
+  { 0x39        , "Vendor Specific" },
+  { 0x3A        , "Vendor Specific" },
+  { 0x3B        , "Vendor Specific" },
+  { 0x3C        , "Vendor Specific" },
+  { 0x3D        , "Vendor Specific" },
+  { 0x3E        , "Vendor Specific" },
+  { 0x3F        , "Vendor Specific" },
+  { 0x4B        , "Pre 1 (RFC 1434)" },
+  { 0x00        , NULL }
 };
 
 static const value_string dlsw_fc_cmd_vals[] = {
-       { 0x00        , "Repeat Window" },
-       { 0x01        , "Increment Window" },
-       { 0x02        , "Decrement Window" },
-       { 0x03        , "Reset Window" },
-       { 0x04        , "Halve Window" },
-       { 0x00        , NULL }
+  { 0x00        , "Repeat Window" },
+  { 0x01        , "Increment Window" },
+  { 0x02        , "Decrement Window" },
+  { 0x03        , "Reset Window" },
+  { 0x04        , "Halve Window" },
+  { 0x00        , NULL }
 };
 
 static const value_string dlsw_capex_type_vals[] = {
-       { 0x01        , "Capabilities request" },
-       { 0x02        , "Capabilities response" },
-       { 0x00        , NULL }
+  { 0x01        , "Capabilities request" },
+  { 0x02        , "Capabilities response" },
+  { 0x00        , NULL }
 };
 
 static const value_string dlsw_frame_direction_vals[] = {
-       { 0x01        , "Origin DLSw to target DLSw" },
-       { 0x02        , "Target DLSw to origin DLSw" },
-       { 0x00        , NULL }
+  { 0x01        , "Origin DLSw to target DLSw" },
+  { 0x02        , "Target DLSw to origin DLSw" },
+  { 0x00        , NULL }
 };
 
 static const value_string dlsw_vector_vals[] = {
-        { 0x81        , "Vendor ID Control Vector" },
-        { 0x82        , "DLSw Version Control Vector" },
-        { 0x83        , "Initial Pacing Window Control Vector" },
-        { 0x84        , "Version String Control Vector" },
-        { 0x85        , "Mac Address Exclusivity Control Vector" },
-        { 0x86        , "Supported SAP List Control Vector" },
-        { 0x87        , "TCP Connections Control Vector" },
-        { 0x88        , "NetBIOS Name Exclusivity Control Vector" },
-        { 0x89        , "MAC Address List Control Vector" },
-        { 0x8a        , "NetBIOS Name List Control Vector" },
-        { 0x8b        , "Vendor Context Control Vector" },
-        { 0x8c        , "Multicast Capabilities Control Vector" },
-        { 0x8d        , "Reserved for future use" },
-        { 0x8e        , "Reserved for future use" },
-        { 0x8f        , "Reserved for future use" },
-        { 0x90        , "Reserved for future use" },
-        { 0x91        , " Control Vector" },
-        { 0x92        , " Control Vector" },
-        { 0x93        , " Control Vector" },
-        { 0x94        , " Control Vector" },
-        { 0x95        , " Control Vector" },
-        { 0x96        , " Control Vector" },
-        { 0x00        , NULL }
+  { 0x81        , "Vendor ID Control Vector" },
+  { 0x82        , "DLSw Version Control Vector" },
+  { 0x83        , "Initial Pacing Window Control Vector" },
+  { 0x84        , "Version String Control Vector" },
+  { 0x85        , "Mac Address Exclusivity Control Vector" },
+  { 0x86        , "Supported SAP List Control Vector" },
+  { 0x87        , "TCP Connections Control Vector" },
+  { 0x88        , "NetBIOS Name Exclusivity Control Vector" },
+  { 0x89        , "MAC Address List Control Vector" },
+  { 0x8a        , "NetBIOS Name List Control Vector" },
+  { 0x8b        , "Vendor Context Control Vector" },
+  { 0x8c        , "Multicast Capabilities Control Vector" },
+  { 0x8d        , "Reserved for future use" },
+  { 0x8e        , "Reserved for future use" },
+  { 0x8f        , "Reserved for future use" },
+  { 0x90        , "Reserved for future use" },
+  { 0x91        , " Control Vector" },
+  { 0x92        , " Control Vector" },
+  { 0x93        , " Control Vector" },
+  { 0x94        , " Control Vector" },
+  { 0x95        , " Control Vector" },
+  { 0x96        , " Control Vector" },
+  { 0x00        , NULL }
 };
 
 static const value_string dlsw_pri_vals[] = {
-        { 0        , "Unsupported" },
-        { 1        , "Low Priority" },
-        { 2        , "Medium Priority" },
-        { 3        , "High Priority" },
-        { 4        , "Highest Priority" },
-        { 5        , "Reserved" },
-        { 6        , "Reserved" },
-        { 7        , "Reserved" },
-       { 0, NULL }
+  { 0        , "Unsupported" },
+  { 1        , "Low Priority" },
+  { 2        , "Medium Priority" },
+  { 3        , "High Priority" },
+  { 4        , "Highest Priority" },
+  { 5        , "Reserved" },
+  { 6        , "Reserved" },
+  { 7        , "Reserved" },
+  { 0, NULL }
 };
 
 
 
 
-#define DLSW_GDSID_SEND                0x1520
-#define DLSW_GDSID_ACK         0x1521
-#define DLSW_GDSID_REF         0x1522
+#define DLSW_GDSID_SEND         0x1520
+#define DLSW_GDSID_ACK          0x1521
+#define DLSW_GDSID_REF          0x1522
 
 static const value_string dlsw_gds_vals[] = {
-        { DLSW_GDSID_SEND , "Request Capabilities GDS" },
-        { DLSW_GDSID_ACK  , "Response Capabilities GDS" },
-        { DLSW_GDSID_REF  , "Refuse Capabilities GDS" },
-        { 0               , NULL }
+  { DLSW_GDSID_SEND , "Request Capabilities GDS" },
+  { DLSW_GDSID_ACK  , "Response Capabilities GDS" },
+  { DLSW_GDSID_REF  , "Refuse Capabilities GDS" },
+  { 0               , NULL }
 };
 
 static const value_string dlsw_refuse_vals[] = {
-       { 0x1   , "invalid GDS length for a DLWs Capabilities Exchange Request"},
-       { 0x2   , "invalid GDS id for a DLSw Capabilities Exchange Request"},
-       { 0x3   , "vendor Id control vector is missing"},
-       { 0x4   , "DLSw Version control vector is missing"},
-       { 0x5   , "initial Pacing Window control vector is missing"},
-       { 0x6   , "length of control vectors doesn't correlate to the length of the GDS variable"},
-       { 0x7   , "invalid control vector id"},
-       { 0x8   , "length of control vector invalid"},
-       { 0x9   , "invalid control vector data value"},
-       { 0xa   , "duplicate control vector"},
-       { 0xb   , "out-of-sequence control vector"},
-       { 0xc   , "DLSw Supported SAP List control vector is missing"},
-       { 0xd   , "inconsistent DLSw Version, Multicast Capabilities, and TCP Connections CV received on the inbound Capabilities exchange"},
-       { 0x0   , NULL }
+  { 0x1 , "invalid GDS length for a DLWs Capabilities Exchange Request"},
+  { 0x2 , "invalid GDS id for a DLSw Capabilities Exchange Request"},
+  { 0x3 , "vendor Id control vector is missing"},
+  { 0x4 , "DLSw Version control vector is missing"},
+  { 0x5 , "initial Pacing Window control vector is missing"},
+  { 0x6 , "length of control vectors doesn't correlate to the length of the GDS variable"},
+  { 0x7 , "invalid control vector id"},
+  { 0x8 , "length of control vector invalid"},
+  { 0x9 , "invalid control vector data value"},
+  { 0xa , "duplicate control vector"},
+  { 0xb , "out-of-sequence control vector"},
+  { 0xc , "DLSw Supported SAP List control vector is missing"},
+  { 0xd , "inconsistent DLSw Version, Multicast Capabilities, and TCP Connections CV received on the inbound Capabilities exchange"},
+  { 0x0 , NULL }
 };
 
-#define UDP_PORT_DLSW          2067
-#define TCP_PORT_DLSW          2065
-#define DLSW_INFO_HEADER       16
-#define DLSW_CMD_HEADER                72
+#define UDP_PORT_DLSW           2067
+#define TCP_PORT_DLSW           2065
+#define DLSW_INFO_HEADER          16
+#define DLSW_CMD_HEADER           72
 
 static void
 dissect_dlsw_capex(tvbuff_t *tvb, proto_tree *tree, proto_tree *ti);
@@ -217,126 +217,127 @@ dissect_dlsw_capex(tvbuff_t *tvb, proto_tree *tree, proto_tree *ti);
 static void
 dissect_dlsw_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
- guint version,hlen = 0,mlen = 0,mtype,dlchlen = 0,direction,flags;
- proto_tree      *dlsw_tree = NULL, *ti,*ti2, *dlsw_header_tree = NULL;
- proto_tree      *dlsw_flags_tree,*dlsw_data_tree;
 guint version,hlen = 0,mlen = 0,mtype,dlchlen = 0,direction,flags;
 proto_tree      *dlsw_tree = NULL, *ti,*ti2, *dlsw_header_tree = NULL;
 proto_tree      *dlsw_flags_tree,*dlsw_data_tree;
 
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "DLSw");
 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DLSw");
 
- version=tvb_get_guint8(tvb,0);
 version=tvb_get_guint8(tvb,0);
 
col_add_fstr(pinfo->cinfo, COL_INFO, "DLSw %s",val_to_str(version , dlsw_version_vals, "Unknown Version"));
 col_add_fstr(pinfo->cinfo, COL_INFO, "DLSw %s",val_to_str_const(version , dlsw_version_vals, "Unknown Version"));
 
- if (tree)
- {
-   ti = proto_tree_add_item(tree, proto_dlsw, tvb, 0, -1, ENC_NA);
-   dlsw_tree = proto_item_add_subtree(ti, ett_dlsw);
-
-   hlen=tvb_get_guint8(tvb,1);
-
-   ti2 = proto_tree_add_text (dlsw_tree, tvb, 0, hlen,"DLSw header, %s",
-     val_to_str(version , dlsw_version_vals, "Unknown Version"));
-
-   dlsw_header_tree = proto_item_add_subtree(ti2, ett_dlsw_header);
-   proto_tree_add_text (dlsw_header_tree,tvb,0 ,1,"Version        = %s",
-    val_to_str(version , dlsw_version_vals, "Unknown Version, dissection may be inaccurate"));
-   proto_tree_add_text (dlsw_header_tree,tvb,1 ,1,"Header Length  = %u",hlen) ;
-   mlen=tvb_get_ntohs(tvb,2);
-   proto_tree_add_text (dlsw_header_tree,tvb,2 ,2,"Message Length = %u",mlen);
-   proto_tree_add_text (dlsw_header_tree,tvb,4 ,4,"Remote DLC     = %u",tvb_get_ntohl(tvb,4)) ;
-   proto_tree_add_text (dlsw_header_tree,tvb,8 ,4,"Remote DLC PID = %u",tvb_get_ntohl(tvb,8)) ;
-   proto_tree_add_text (dlsw_header_tree,tvb,12,2,"Reserved") ;
 if (tree)
 {
+    ti = proto_tree_add_item(tree, proto_dlsw, tvb, 0, -1, ENC_NA);
+    dlsw_tree = proto_item_add_subtree(ti, ett_dlsw);
+
+    hlen=tvb_get_guint8(tvb,1);
+
+    ti2 = proto_tree_add_text (dlsw_tree, tvb, 0, hlen,"DLSw header, %s",
+                               val_to_str_const(version , dlsw_version_vals, "Unknown Version"));
+
+    dlsw_header_tree = proto_item_add_subtree(ti2, ett_dlsw_header);
+    proto_tree_add_text (dlsw_header_tree,tvb,0 ,1,"Version        = %s",
+                         val_to_str_const(version , dlsw_version_vals, "Unknown Version, dissection may be inaccurate"));
+    proto_tree_add_text (dlsw_header_tree,tvb,1 ,1,"Header Length  = %u",hlen) ;
+    mlen=tvb_get_ntohs(tvb,2);
+    proto_tree_add_text (dlsw_header_tree,tvb,2 ,2,"Message Length = %u",mlen);
+    proto_tree_add_text (dlsw_header_tree,tvb,4 ,4,"Remote DLC     = %u",tvb_get_ntohl(tvb,4)) ;
+    proto_tree_add_text (dlsw_header_tree,tvb,8 ,4,"Remote DLC PID = %u",tvb_get_ntohl(tvb,8)) ;
+    proto_tree_add_text (dlsw_header_tree,tvb,12,2,"Reserved") ;
   } ;
 
   mtype=tvb_get_guint8(tvb,14);
-  col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",val_to_str(mtype , dlsw_type_vals, "Unknown message Type"));
+  col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",val_to_str_const(mtype , dlsw_type_vals, "Unknown message Type"));
   if (tree)
   {
-   proto_tree_add_text (dlsw_header_tree,tvb,14,1,"Message Type   = %s (0x%02x)",
-    val_to_str(mtype , dlsw_type_vals, "Unknown Type"),mtype);
-   if (mtype==CAP_EXCHANGE)
+    proto_tree_add_text (dlsw_header_tree,tvb,14,1,"Message Type   = %s (0x%02x)",
+                         val_to_str_const(mtype , dlsw_type_vals, "Unknown Type"),mtype);
+    if (mtype==CAP_EXCHANGE)
     {
-     proto_tree_add_text (dlsw_header_tree,tvb, 15,1,"Not used for CapEx") ;
+      proto_tree_add_text (dlsw_header_tree,tvb, 15,1,"Not used for CapEx") ;
     }
-   else
+    else
     {
-    flags = tvb_get_guint8(tvb,15);
-    ti2 = proto_tree_add_text (dlsw_header_tree, tvb, 15,1,"Flow ctrl byte = 0x%02x",flags);
-    dlsw_flags_tree = proto_item_add_subtree(ti2, ett_dlsw_fc);
-    proto_tree_add_text (dlsw_flags_tree, tvb, 15, 1, "%s",
-       decode_boolean_bitfield(flags, 0x80, 8,
-                               "Flow Control Indication: yes",
-                               "Flow Control Indication: no"));
-    if (flags & 0x80)
-     {
-     proto_tree_add_text (dlsw_flags_tree, tvb, 15, 1, "%s",
-       decode_boolean_bitfield(flags, 0x40, 8,
-                               "Flow Control Acknowledgment: yes",
-                               "Flow Control Acknowledgment: no"));
-     proto_tree_add_text (dlsw_flags_tree, tvb, 15, 1, "%s",
-       decode_enumerated_bitfield(flags, 0x07, 8,
-           dlsw_fc_cmd_vals, "Flow Control Operator: %s"));
-     }
+      flags = tvb_get_guint8(tvb,15);
+      ti2 = proto_tree_add_text (dlsw_header_tree, tvb, 15,1,"Flow ctrl byte = 0x%02x",flags);
+      dlsw_flags_tree = proto_item_add_subtree(ti2, ett_dlsw_fc);
+      proto_tree_add_text (dlsw_flags_tree, tvb, 15, 1, "%s",
+                           decode_boolean_bitfield(flags, 0x80, 8,
+                                                   "Flow Control Indication: yes",
+                                                   "Flow Control Indication: no"));
+      if (flags & 0x80)
+      {
+        proto_tree_add_text (dlsw_flags_tree, tvb, 15, 1, "%s",
+                             decode_boolean_bitfield(flags, 0x40, 8,
+                                                     "Flow Control Acknowledgment: yes",
+                                                     "Flow Control Acknowledgment: no"));
+        proto_tree_add_text (dlsw_flags_tree, tvb, 15, 1, "%s",
+                             decode_enumerated_bitfield(flags, 0x07, 8,
+                                                        dlsw_fc_cmd_vals,
+                                                        "Flow Control Operator: %s"));
+      }
     }
-   if (hlen != DLSW_INFO_HEADER)
+    if (hlen != DLSW_INFO_HEADER)
     {
-    if (mtype==CAP_EXCHANGE)
-     {
-     proto_tree_add_text (dlsw_header_tree,tvb, 16,1,"Protocol ID    = 0x%02x",tvb_get_guint8(tvb,16)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 17,1,"Header Number  = 0x%02x",tvb_get_guint8(tvb,17)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 18,5,"Not used for CapEx") ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 23,1,"Old message type = %s (0x%02x)",
-     val_to_str(tvb_get_guint8(tvb,23) , dlsw_type_vals, "Unknown Type"),
-     tvb_get_guint8(tvb,23));
-     direction=tvb_get_guint8(tvb,38);
-     proto_tree_add_text (dlsw_header_tree,tvb, 24,14,"Not used for CapEx") ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 38,1,"Frame direction   =  %s (0x%02x)",
-      val_to_str(direction , dlsw_capex_type_vals, "Unknown Direction"),
-      direction);
-     proto_tree_add_text (dlsw_header_tree,tvb, 39,33,"Not used for CapEx") ;
-     }
-    else
-     {
-     proto_tree_add_text (dlsw_header_tree,tvb, 16,1,"Protocol ID    = 0x%02x",tvb_get_guint8(tvb,16)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 17,1,"Header Number  = 0x%02x",tvb_get_guint8(tvb,17)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 18,2,"Reserved") ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 20,1,"Largest Frame size  = %u",tvb_get_guint8(tvb,20)) ;
-     flags = tvb_get_guint8(tvb,21);
-     ti2 = proto_tree_add_text (dlsw_header_tree,tvb, 21,1,"SSP Flags      = 0x%02x",flags) ;
-     dlsw_flags_tree = proto_item_add_subtree(ti2, ett_dlsw_sspflags);
-     proto_tree_add_text (dlsw_flags_tree, tvb, 21, 1, "%s",
-       decode_boolean_bitfield(flags, 0x80, 8,
-                               "Explorer message: yes",
-                               "Explorer message: no"));
-     proto_tree_add_text (dlsw_header_tree,tvb, 22,1,"Circuit priority = %s",
-                         val_to_str((tvb_get_guint8(tvb,22)&7),dlsw_pri_vals, "Unknown (%d)")) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 23,1,"Old message type = %s (0x%02x)",
-                         val_to_str(tvb_get_guint8(tvb,23) , dlsw_type_vals, "Unknown Type"),
-     tvb_get_guint8(tvb,23));
-     proto_tree_add_text (dlsw_header_tree,tvb, 24,6,"Target MAC Address  = %s",tvb_bytes_to_str(tvb,24,6)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 30,6,"Origin MAC Address  = %s",tvb_bytes_to_str(tvb,30,6)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 36,1,"Origin Link SAP     = 0x%02x",tvb_get_guint8(tvb,36)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 37,1,"Target Link SAP     = 0x%02x",tvb_get_guint8(tvb,37)) ;
-     direction=tvb_get_guint8(tvb,38);
-     proto_tree_add_text (dlsw_header_tree,tvb, 38,1,"Frame direction   =  %s (0x%02x)",
-      val_to_str(direction , dlsw_frame_direction_vals, "Unknown Direction"),
-      direction);
-     proto_tree_add_text (dlsw_header_tree,tvb, 39,3,"Reserved") ;
-     dlchlen=tvb_get_ntohs(tvb,42);
-     if ( dlchlen > mlen )
+      if (mtype==CAP_EXCHANGE)
+      {
+        proto_tree_add_text (dlsw_header_tree,tvb, 16,1,"Protocol ID    = 0x%02x",tvb_get_guint8(tvb,16)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 17,1,"Header Number  = 0x%02x",tvb_get_guint8(tvb,17)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 18,5,"Not used for CapEx") ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 23,1,"Old message type = %s (0x%02x)",
+                             val_to_str_const(tvb_get_guint8(tvb,23) , dlsw_type_vals, "Unknown Type"),
+                             tvb_get_guint8(tvb,23));
+        direction=tvb_get_guint8(tvb,38);
+        proto_tree_add_text (dlsw_header_tree,tvb, 24,14,"Not used for CapEx") ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 38,1,"Frame direction   =  %s (0x%02x)",
+                             val_to_str_const(direction , dlsw_capex_type_vals, "Unknown Direction"),
+                             direction);
+        proto_tree_add_text (dlsw_header_tree,tvb, 39,33,"Not used for CapEx") ;
+      }
+      else
       {
-      proto_tree_add_text (dlsw_header_tree,tvb, 42,2,"DLC Header Length = %u (bogus, must be <= message length %u)",dlchlen, mlen) ;
-      return;
+        proto_tree_add_text (dlsw_header_tree,tvb, 16,1,"Protocol ID    = 0x%02x",tvb_get_guint8(tvb,16)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 17,1,"Header Number  = 0x%02x",tvb_get_guint8(tvb,17)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 18,2,"Reserved") ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 20,1,"Largest Frame size  = %u",tvb_get_guint8(tvb,20)) ;
+        flags = tvb_get_guint8(tvb,21);
+        ti2 = proto_tree_add_text (dlsw_header_tree,tvb, 21,1,"SSP Flags      = 0x%02x",flags) ;
+        dlsw_flags_tree = proto_item_add_subtree(ti2, ett_dlsw_sspflags);
+        proto_tree_add_text (dlsw_flags_tree, tvb, 21, 1, "%s",
+                             decode_boolean_bitfield(flags, 0x80, 8,
+                                                     "Explorer message: yes",
+                                                     "Explorer message: no"));
+        proto_tree_add_text (dlsw_header_tree,tvb, 22,1,"Circuit priority = %s",
+                             val_to_str((tvb_get_guint8(tvb,22)&7),dlsw_pri_vals, "Unknown (%d)")) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 23,1,"Old message type = %s (0x%02x)",
+                             val_to_str_const(tvb_get_guint8(tvb,23) , dlsw_type_vals, "Unknown Type"),
+                             tvb_get_guint8(tvb,23));
+        proto_tree_add_text (dlsw_header_tree,tvb, 24,6,"Target MAC Address  = %s",tvb_bytes_to_str(tvb,24,6)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 30,6,"Origin MAC Address  = %s",tvb_bytes_to_str(tvb,30,6)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 36,1,"Origin Link SAP     = 0x%02x",tvb_get_guint8(tvb,36)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 37,1,"Target Link SAP     = 0x%02x",tvb_get_guint8(tvb,37)) ;
+        direction=tvb_get_guint8(tvb,38);
+        proto_tree_add_text (dlsw_header_tree,tvb, 38,1,"Frame direction   =  %s (0x%02x)",
+                             val_to_str_const(direction , dlsw_frame_direction_vals, "Unknown Direction"),
+                             direction);
+        proto_tree_add_text (dlsw_header_tree,tvb, 39,3,"Reserved") ;
+        dlchlen=tvb_get_ntohs(tvb,42);
+        if ( dlchlen > mlen )
+        {
+          proto_tree_add_text (dlsw_header_tree,tvb, 42,2,"DLC Header Length = %u (bogus, must be <= message length %u)",dlchlen, mlen) ;
+          return;
+        }
+        proto_tree_add_text (dlsw_header_tree,tvb, 42,2,"DLC Header Length = %u",dlchlen) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 44,4,"Origin DLC Port ID     = %u",tvb_get_ntohl(tvb,44)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 48,4,"Origin DLC             = %u",tvb_get_ntohl(tvb,48)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 52,4,"Origin Transport ID    = %u",tvb_get_ntohl(tvb,52)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 56,4,"Target DLC Port ID     = %u",tvb_get_ntohl(tvb,56)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 60,4,"Target DLC             = %u",tvb_get_ntohl(tvb,60)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 64,4,"Target Transport ID    = %u",tvb_get_ntohl(tvb,64)) ;
+        proto_tree_add_text (dlsw_header_tree,tvb, 68,4,"Reserved") ;
       }
-     proto_tree_add_text (dlsw_header_tree,tvb, 42,2,"DLC Header Length = %u",dlchlen) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 44,4,"Origin DLC Port ID     = %u",tvb_get_ntohl(tvb,44)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 48,4,"Origin DLC             = %u",tvb_get_ntohl(tvb,48)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 52,4,"Origin Transport ID    = %u",tvb_get_ntohl(tvb,52)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 56,4,"Target DLC Port ID     = %u",tvb_get_ntohl(tvb,56)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 60,4,"Target DLC             = %u",tvb_get_ntohl(tvb,60)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 64,4,"Target Transport ID    = %u",tvb_get_ntohl(tvb,64)) ;
-     proto_tree_add_text (dlsw_header_tree,tvb, 68,4,"Reserved") ;
-     }
     }
 
 /* end of header dissector */
@@ -345,7 +346,7 @@ dissect_dlsw_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     dlsw_data_tree = proto_item_add_subtree(ti2, ett_dlsw_data);
 
     switch (mtype)
-      {
+    {
       case CAP_EXCHANGE:
         dissect_dlsw_capex(tvb_new_subset(tvb, hlen, mlen, -1), dlsw_data_tree,ti2);
         break;
@@ -357,117 +358,117 @@ dissect_dlsw_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
       default:
         if (dlchlen!=0)
-         {
-         proto_tree_add_text (dlsw_data_tree,tvb,hlen,1,"DLC Header - AC byte : 0x%02x",tvb_get_guint8(tvb,hlen)) ;
-         proto_tree_add_text (dlsw_data_tree,tvb,hlen+1,1,"DLC Header - FC byte : 0x%02x",tvb_get_guint8(tvb,hlen+1)) ;
-         proto_tree_add_text (dlsw_data_tree,tvb,hlen+2,6,"DLC Header - DA : %s",tvb_bytes_to_str(tvb,hlen+2,6)) ;
-         proto_tree_add_text (dlsw_data_tree,tvb,hlen+8,6,"DLC Header - SA : %s",tvb_bytes_to_str(tvb,hlen+8,6)) ;
-         proto_tree_add_text (dlsw_data_tree,tvb,hlen+14,18,"DLC Header - RIF : %s",tvb_bytes_to_str(tvb,hlen+14,18)) ;
-         proto_tree_add_text (dlsw_data_tree,tvb,hlen+32,1,"DLC Header - DSAP : 0x%02x",tvb_get_guint8(tvb,hlen+32)) ;
-         proto_tree_add_text (dlsw_data_tree,tvb,hlen+33,1,"DLC Header - SSAP : 0x%02x",tvb_get_guint8(tvb,hlen+33)) ;
-         proto_tree_add_text (dlsw_data_tree,tvb,hlen+34,1,"DLC Header - Ctrl : 0x%02x",tvb_get_guint8(tvb,hlen+34)) ;
-         }
-       proto_tree_add_text (dlsw_data_tree,tvb,hlen+dlchlen,mlen-dlchlen,"Data") ;
-      }
+        {
+          proto_tree_add_text (dlsw_data_tree,tvb,hlen,1,"DLC Header - AC byte : 0x%02x",tvb_get_guint8(tvb,hlen)) ;
+          proto_tree_add_text (dlsw_data_tree,tvb,hlen+1,1,"DLC Header - FC byte : 0x%02x",tvb_get_guint8(tvb,hlen+1)) ;
+          proto_tree_add_text (dlsw_data_tree,tvb,hlen+2,6,"DLC Header - DA : %s",tvb_bytes_to_str(tvb,hlen+2,6)) ;
+          proto_tree_add_text (dlsw_data_tree,tvb,hlen+8,6,"DLC Header - SA : %s",tvb_bytes_to_str(tvb,hlen+8,6)) ;
+          proto_tree_add_text (dlsw_data_tree,tvb,hlen+14,18,"DLC Header - RIF : %s",tvb_bytes_to_str(tvb,hlen+14,18)) ;
+          proto_tree_add_text (dlsw_data_tree,tvb,hlen+32,1,"DLC Header - DSAP : 0x%02x",tvb_get_guint8(tvb,hlen+32)) ;
+          proto_tree_add_text (dlsw_data_tree,tvb,hlen+33,1,"DLC Header - SSAP : 0x%02x",tvb_get_guint8(tvb,hlen+33)) ;
+          proto_tree_add_text (dlsw_data_tree,tvb,hlen+34,1,"DLC Header - Ctrl : 0x%02x",tvb_get_guint8(tvb,hlen+34)) ;
+        }
+        proto_tree_add_text (dlsw_data_tree,tvb,hlen+dlchlen,mlen-dlchlen,"Data") ;
+    }
 
-   }
+  }
 }
 
 static void
 dissect_dlsw_capex(tvbuff_t *tvb, proto_tree *tree, proto_tree *ti2)
 {
- int mlen,vlen,vtype,offset=4,gdsid,sap,i=0;
- proto_tree *ti,*dlsw_vector_tree;
- mlen=tvb_get_ntohs(tvb,0);
- gdsid=tvb_get_ntohs(tvb,2);
- proto_tree_add_text (tree,tvb,0,2,"Capabilities Length =  %d",mlen) ;
proto_tree_add_text (tree,tvb,2,2,"%s",val_to_str( gdsid, dlsw_gds_vals, "Invalid GDS ID"));
proto_item_append_text(ti2," - %s",val_to_str( gdsid, dlsw_gds_vals, "Invalid GDS ID"));
- switch (gdsid) {
-  case DLSW_GDSID_ACK:
-    break;
-  case DLSW_GDSID_REF:
-    proto_tree_add_text (tree,tvb,4,2,"Error pointer =  %d",tvb_get_ntohs(tvb,4));
-    proto_tree_add_text (tree,tvb,6,2,"Error cause = %s",
-     val_to_str(tvb_get_ntohs(tvb,6), dlsw_refuse_vals, "Unknown refuse cause"));
-    break;
-  case DLSW_GDSID_SEND:
-    while (offset < mlen){
-      vlen=tvb_get_guint8(tvb,offset);
-      if (vlen < 3) THROW(ReportedBoundsError);
-      vtype=tvb_get_guint8(tvb,offset+1);
-      ti=proto_tree_add_text (tree,tvb,offset,vlen,"%s",
-         val_to_str(vtype,dlsw_vector_vals,"Unknown vector type"));
-      dlsw_vector_tree = proto_item_add_subtree(ti, ett_dlsw_vector);
-      proto_tree_add_text (dlsw_vector_tree,tvb,offset,1,  "Vector Length = %d",vlen);
-      proto_tree_add_text (dlsw_vector_tree,tvb,offset+1,1,"Vector Type   = %s (0x%02x)",
-       val_to_str(vtype,dlsw_vector_vals,"Unknown vector type"),vtype);
-      switch (vtype){
-        case 0x81:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "OUI = 0x%06x",tvb_get_ntoh24(tvb,offset+2));
-          break;
-        case 0x82:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "DLSw Version = %d.%d",tvb_get_guint8(tvb,offset+2),tvb_get_guint8(tvb,offset+3));
-          break;
-        case 0x83:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "Initial Pacing Window = %d",tvb_get_ntohs(tvb,offset+2));
-          break;
-        case 0x84:
-           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "Version String = %s",tvb_format_text(tvb,offset+2,vlen-2));
-          break;
-        case 0x85:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "MAC Address Exclusivity = %s",tvb_get_guint8(tvb,offset+2)==1?"On":"Off");
-          break;
-        case 0x86:
-          while (i<vlen-2)
-           {
-           sap=tvb_get_guint8(tvb,offset+2+i);
-           proto_tree_add_text (dlsw_vector_tree,tvb,offset+2+i,1,
-            "SAP List Support = 0x%x0=%s 0x%x2=%s 0x%x4=%s 0x%x6=%s 0x%x8=%s 0x%xa=%s 0x%xc=%s 0x%xe=%s",
-            i,sap&0x80?"on ":"off",i,sap&0x40?"on ":"off",i,sap&0x20?"on ":"off",i,sap&0x10?"on ":"off",
-            i,sap&0x08?"on ":"off",i,sap&0x04?"on ":"off",i,sap&0x02?"on ":"off",i,sap&0x01?"on ":"off");
-           i++;
-           }
-          break;
-        case 0x87:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "TCP connections  = %d",tvb_get_guint8(tvb,offset+2));
-          break;
-        case 0x88:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "NetBIOS Name Exclusivity = %s",tvb_get_guint8(tvb,offset+2)==1?"On":"Off");
-          break;
-        case 0x89:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "MAC Address List = %s / %s",tvb_bytes_to_str(tvb,offset+2,6)
-           ,tvb_bytes_to_str(tvb,offset+8,6));
-          break;
-        case 0x8a:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-/* %s */           "NetBIOS name = %s",/* tvb_get_guint8(tvb,offset+2)==0?"Individual":"Group",*/
-           tvb_format_text(tvb,offset+2,vlen-2));
-          break;
-        case 0x8b:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "Vendor OUI = 0x%06x",tvb_get_ntoh24(tvb,offset+2));
-          break;
-        case 0x8c:
-          proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
-           "Multicast Version Number = %d",tvb_get_guint8(tvb,offset+2));
-          break;
-       default:
-        proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,"Vector Data = ???");
 int mlen,vlen,vtype,offset=4,gdsid,sap,i=0;
 proto_tree *ti,*dlsw_vector_tree;
 mlen=tvb_get_ntohs(tvb,0);
 gdsid=tvb_get_ntohs(tvb,2);
 proto_tree_add_text (tree,tvb,0,2,"Capabilities Length =  %d",mlen) ;
 proto_tree_add_text (tree,tvb,2,2,"%s",val_to_str_const( gdsid, dlsw_gds_vals, "Invalid GDS ID"));
 proto_item_append_text(ti2," - %s",val_to_str_const( gdsid, dlsw_gds_vals, "Invalid GDS ID"));
 switch (gdsid) {
+    case DLSW_GDSID_ACK:
+      break;
+    case DLSW_GDSID_REF:
+      proto_tree_add_text (tree,tvb,4,2,"Error pointer =  %d",tvb_get_ntohs(tvb,4));
+      proto_tree_add_text (tree,tvb,6,2,"Error cause = %s",
+                           val_to_str_const(tvb_get_ntohs(tvb,6), dlsw_refuse_vals, "Unknown refuse cause"));
+      break;
+    case DLSW_GDSID_SEND:
+      while (offset < mlen){
+        vlen=tvb_get_guint8(tvb,offset);
+        if (vlen < 3) THROW(ReportedBoundsError);
+        vtype=tvb_get_guint8(tvb,offset+1);
+        ti=proto_tree_add_text (tree,tvb,offset,vlen,"%s",
+                                val_to_str_const(vtype,dlsw_vector_vals,"Unknown vector type"));
+        dlsw_vector_tree = proto_item_add_subtree(ti, ett_dlsw_vector);
+        proto_tree_add_text (dlsw_vector_tree,tvb,offset,1,  "Vector Length = %d",vlen);
+        proto_tree_add_text (dlsw_vector_tree,tvb,offset+1,1,"Vector Type   = %s (0x%02x)",
+                             val_to_str_const(vtype,dlsw_vector_vals,"Unknown vector type"), vtype);
+        switch (vtype){
+          case 0x81:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "OUI = 0x%06x",tvb_get_ntoh24(tvb,offset+2));
+            break;
+          case 0x82:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "DLSw Version = %d.%d",tvb_get_guint8(tvb,offset+2),tvb_get_guint8(tvb,offset+3));
+            break;
+          case 0x83:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "Initial Pacing Window = %d",tvb_get_ntohs(tvb,offset+2));
+            break;
+          case 0x84:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "Version String = %s",tvb_format_text(tvb,offset+2,vlen-2));
+            break;
+          case 0x85:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "MAC Address Exclusivity = %s",tvb_get_guint8(tvb,offset+2)==1?"On":"Off");
+            break;
+          case 0x86:
+            while (i<vlen-2)
+            {
+              sap=tvb_get_guint8(tvb,offset+2+i);
+              proto_tree_add_text (dlsw_vector_tree,tvb,offset+2+i,1,
+                                   "SAP List Support = 0x%x0=%s 0x%x2=%s 0x%x4=%s 0x%x6=%s 0x%x8=%s 0x%xa=%s 0x%xc=%s 0x%xe=%s",
+                                   i,sap&0x80?"on ":"off",i,sap&0x40?"on ":"off",i,sap&0x20?"on ":"off",i,sap&0x10?"on ":"off",
+                                   i,sap&0x08?"on ":"off",i,sap&0x04?"on ":"off",i,sap&0x02?"on ":"off",i,sap&0x01?"on ":"off");
+              i++;
+            }
+            break;
+          case 0x87:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "TCP connections  = %d",tvb_get_guint8(tvb,offset+2));
+            break;
+          case 0x88:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "NetBIOS Name Exclusivity = %s",tvb_get_guint8(tvb,offset+2)==1?"On":"Off");
+            break;
+          case 0x89:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "MAC Address List = %s / %s",tvb_bytes_to_str(tvb,offset+2,6)
+                                 ,tvb_bytes_to_str(tvb,offset+8,6));
+            break;
+          case 0x8a:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 /* %s */           "NetBIOS name = %s",/* tvb_get_guint8(tvb,offset+2)==0?"Individual":"Group",*/
+                                 tvb_format_text(tvb,offset+2,vlen-2));
+            break;
+          case 0x8b:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "Vendor OUI = 0x%06x",tvb_get_ntoh24(tvb,offset+2));
+            break;
+          case 0x8c:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,
+                                 "Multicast Version Number = %d",tvb_get_guint8(tvb,offset+2));
+            break;
+          default:
+            proto_tree_add_text (dlsw_vector_tree,tvb,offset+2,vlen-2,"Vector Data = ???");
         }
-      offset+=vlen;
+        offset+=vlen;
       };
-    break;
-  default:
-    proto_tree_add_text (tree,tvb,4,mlen - 4,"Unknown data");
+      break;
+    default:
+      proto_tree_add_text (tree,tvb,4,mlen - 4,"Unknown data");
   }
 
 }
@@ -475,14 +476,14 @@ dissect_dlsw_capex(tvbuff_t *tvb, proto_tree *tree, proto_tree *ti2)
 static int
 dissect_dlsw_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
- if (match_strval(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
- {
-   /* Probably not a DLSw packet. */
-   return 0;
- }
-
- dissect_dlsw_pdu(tvb, pinfo, tree);
- return tvb_length(tvb);
 if (match_strval(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
 {
+    /* Probably not a DLSw packet. */
+    return 0;
 }
+
 dissect_dlsw_pdu(tvb, pinfo, tree);
 return tvb_length(tvb);
 }
 
 static guint
@@ -509,15 +510,14 @@ get_dlsw_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
 static int
 dissect_dlsw_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
- if (match_strval(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
- {
-   /* Probably not a DLSw packet. */
-   return 0;
- }
-
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, get_dlsw_pdu_len,
-       dissect_dlsw_pdu);
- return tvb_length(tvb);
+  if (match_strval(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
+  {
+    /* Probably not a DLSw packet. */
+    return 0;
+  }
+
+  tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, get_dlsw_pdu_len, dissect_dlsw_pdu);
+  return tvb_length(tvb);
 }
 
 void
index 8e50337714c3d5b32377e8da9420798471f433f5..76b9d15d0eb2ef970b940fa9b9c3a02f718db12a 100644 (file)
@@ -141,22 +141,22 @@ static dissector_handle_t ntlmssp_handle;
 
 /* Structure containing transaction specific information */
 typedef struct _dns_transaction_t {
-        guint32 req_frame;
-        guint32 rep_frame;
-        nstime_t req_time;
+  guint32 req_frame;
+  guint32 rep_frame;
+  nstime_t req_time;
 } dns_transaction_t;
 
 /* Structure containing conversation specific information */
 typedef struct _dns_conv_info_t {
-        emem_tree_t *pdus;
+  emem_tree_t *pdus;
 } dns_conv_info_t;
 
 /* DNS structs and definitions */
 
 /* Ports used for DNS. */
-#define UDP_PORT_DNS            53
-#define TCP_PORT_DNS            53
-#define SCTP_PORT_DNS           53
+#define UDP_PORT_DNS              53
+#define TCP_PORT_DNS              53
+#define SCTP_PORT_DNS             53
 #define UDP_PORT_MDNS           5353
 #define TCP_PORT_MDNS           5353
 #define UDP_PORT_LLMNR          5355
@@ -166,26 +166,26 @@ typedef struct _dns_conv_info_t {
 #endif
 
 /* Offsets of fields in the DNS header. */
-#define        DNS_ID          0
-#define        DNS_FLAGS       2
-#define        DNS_QUEST       4
-#define        DNS_ANS         6
-#define        DNS_AUTH        8
-#define        DNS_ADD         10
+#define DNS_ID           0
+#define DNS_FLAGS        2
+#define DNS_QUEST        4
+#define DNS_ANS          6
+#define DNS_AUTH         8
+#define DNS_ADD         10
 
 /* Length of DNS header. */
-#define        DNS_HDRLEN      12
+#define DNS_HDRLEN      12
 
 /* type values  */
-#define T_A                           /* host address */
-#define T_NS                          /* authoritative name server */
-#define T_MD                          /* mail destination (obsolete) */
-#define T_MF                          /* mail forwarder (obsolete) */
-#define T_CNAME                       /* canonical name */
-#define T_SOA                         /* start of authority zone */
-#define T_MB                          /* mailbox domain name (experimental) */
-#define T_MG                          /* mail group member (experimental) */
-#define T_MR                          /* mail rename domain name (experimental) */
+#define T_A              1              /* host address */
+#define T_NS             2              /* authoritative name server */
+#define T_MD             3              /* mail destination (obsolete) */
+#define T_MF             4              /* mail forwarder (obsolete) */
+#define T_CNAME          5              /* canonical name */
+#define T_SOA            6              /* start of authority zone */
+#define T_MB             7              /* mailbox domain name (experimental) */
+#define T_MG             8              /* mail group member (experimental) */
+#define T_MR             9              /* mail rename domain name (experimental) */
 #define T_NULL          10              /* null RR (experimental) */
 #define T_WKS           11              /* well known service */
 #define T_PTR           12              /* domain name pointer */
@@ -212,13 +212,13 @@ typedef struct _dns_conv_info_t {
 #define T_SRV           33              /* service location (RFC 2052) */
 #define T_ATMA          34              /* ??? */
 #define T_NAPTR         35              /* naming authority pointer (RFC 3403) */
-#define        T_KX            36              /* Key Exchange (RFC 2230) */
-#define        T_CERT          37              /* Certificate (RFC 4398) */
-#define T_A6           38              /* IPv6 address with indirection (RFC 2874) */
+#define T_KX            36              /* Key Exchange (RFC 2230) */
+#define T_CERT          37              /* Certificate (RFC 4398) */
+#define T_A6            38              /* IPv6 address with indirection (RFC 2874) */
 #define T_DNAME         39              /* Non-terminal DNS name redirection (RFC 2672) */
-#define T_OPT          41              /* OPT pseudo-RR (RFC 2671) */
+#define T_OPT           41              /* OPT pseudo-RR (RFC 2671) */
 #define T_APL           42              /* Lists of Address Prefixes (APL RR) (RFC 3123) */
-#define T_DS            43             /* Delegation Signature(RFC 3658) */
+#define T_DS            43              /* Delegation Signature(RFC 3658) */
 #define T_SSHFP         44              /* Using DNS to Securely Publish SSH Key Fingerprints (RFC 4255) */
 #define T_IPSECKEY      45              /* draft-ietf-ipseckey-rr */
 #define T_RRSIG         46              /* future RFC 2535bis */
@@ -229,27 +229,27 @@ typedef struct _dns_conv_info_t {
 #define T_NSEC3PARAM    51              /* NSEC3 parameters (RFC 5155) */
 #define T_HIP           55              /* Host Identity Protocol (HIP) RR (RFC 5205) */
 #define T_SPF           99              /* SPF RR (RFC 4408) section 3 */
-#define T_TKEY         249             /* Transaction Key (RFC 2930) */
-#define T_TSIG         250             /* Transaction Signature (RFC 2845) */
-#define T_WINS         65281           /* Microsoft's WINS RR */
-#define T_WINS_R       65282           /* Microsoft's WINS-R RR */
-#define T_DLV          32769           /* DNSSEC Lookaside Validation (DLV) DNS Resource Record (RFC 4431) */
+#define T_TKEY         249              /* Transaction Key (RFC 2930) */
+#define T_TSIG         250              /* Transaction Signature (RFC 2845) */
+#define T_WINS       65281              /* Microsoft's WINS RR */
+#define T_WINS_R     65282              /* Microsoft's WINS-R RR */
+#define T_DLV        32769              /* DNSSEC Lookaside Validation (DLV) DNS Resource Record (RFC 4431) */
 
 /* Class values */
-#define C_IN                         /* the Internet */
-#define C_CS                         /* CSNET (obsolete) */
-#define C_CH                         /* CHAOS */
-#define C_HS                         /* Hesiod */
-#define        C_NONE          254             /* none */
-#define        C_ANY           255             /* any */
-
-#define C_QU           (1<<15)         /* High bit is set in queries for unicast queries */
+#define C_IN             1              /* the Internet */
+#define C_CS             2              /* CSNET (obsolete) */
+#define C_CH             3              /* CHAOS */
+#define C_HS             4              /* Hesiod */
+#define C_NONE         254              /* none */
+#define C_ANY          255              /* any */
+
+#define C_QU            (1<<15)         /* High bit is set in queries for unicast queries */
 #define C_FLUSH         (1<<15)         /* High bit is set for MDNS cache flush */
 
 /* Bit fields in the flags */
 #define F_RESPONSE      (1<<15)         /* packet is response */
 #define F_OPCODE        (0xF<<11)       /* query opcode */
-#define OPCODE_SHIFT   11
+#define OPCODE_SHIFT    11
 #define F_AUTHORITATIVE (1<<10)         /* response is authoritative */
 #define F_CONFLICT      (1<<10)         /* conflict detected */
 #define F_TRUNCATED     (1<<9)          /* response is truncated */
@@ -262,58 +262,58 @@ typedef struct _dns_conv_info_t {
 #define F_RCODE         (0xF<<0)        /* reply code */
 
 static const true_false_string tfs_flags_response = {
-       "Message is a response",
-       "Message is a query"
+  "Message is a response",
+  "Message is a query"
 };
 
 static const true_false_string tfs_flags_authoritative = {
-       "Server is an authority for domain",
-       "Server is not an authority for domain"
+  "Server is an authority for domain",
+  "Server is not an authority for domain"
 };
 
 static const true_false_string tfs_flags_conflict_query = {
-       "The sender received multiple responses",
-       "None"
+  "The sender received multiple responses",
+  "None"
 };
 
 static const true_false_string tfs_flags_conflict_response = {
-       "The name is not considered unique",
-       "The name is considered unique"
+  "The name is not considered unique",
+  "The name is considered unique"
 };
 
 static const true_false_string tfs_flags_truncated = {
-       "Message is truncated",
-       "Message is not truncated"
+  "Message is truncated",
+  "Message is not truncated"
 };
 
 static const true_false_string tfs_flags_recdesired = {
-       "Do query recursively",
-       "Don't do query recursively"
+  "Do query recursively",
+  "Don't do query recursively"
 };
 
 static const true_false_string tfs_flags_tentative = {
-       "Tentative",
-       "Not tentative"
+  "Tentative",
+  "Not tentative"
 };
 
 static const true_false_string tfs_flags_recavail = {
-       "Server can do recursive queries",
-       "Server can't do recursive queries"
+  "Server can do recursive queries",
+  "Server can't do recursive queries"
 };
 
 static const true_false_string tfs_flags_z = {
-       "reserved - incorrect!",
-       "reserved (0)"
+  "reserved - incorrect!",
+  "reserved (0)"
 };
 
 static const true_false_string tfs_flags_authenticated = {
-       "Answer/authority portion was authenticated by the server",
-       "Answer/authority portion was not authenticated by the server"
+  "Answer/authority portion was authenticated by the server",
+  "Answer/authority portion was not authenticated by the server"
 };
 
 static const true_false_string tfs_flags_checkdisable = {
-       "Acceptable",
-       "Unacceptable"
+  "Acceptable",
+  "Unacceptable"
 };
 
 /* Opcodes */
@@ -324,53 +324,53 @@ static const true_false_string tfs_flags_checkdisable = {
 #define OPCODE_UPDATE   5         /* dynamic update */
 
 static const value_string opcode_vals[] = {
-         { OPCODE_QUERY,  "Standard query"           },
-         { OPCODE_IQUERY, "Inverse query"            },
-         { OPCODE_STATUS, "Server status request"    },
-         { OPCODE_NOTIFY, "Zone change notification" },
-         { OPCODE_UPDATE, "Dynamic update"           },
-         { 0,              NULL                      } };
+  { OPCODE_QUERY,  "Standard query"           },
+  { OPCODE_IQUERY, "Inverse query"            },
+  { OPCODE_STATUS, "Server status request"    },
+  { OPCODE_NOTIFY, "Zone change notification" },
+  { OPCODE_UPDATE, "Dynamic update"           },
+  { 0,              NULL                      } };
 
 /* Reply codes */
-#define RCODE_NOERROR   0
-#define RCODE_FORMERR   1
-#define RCODE_SERVFAIL  2
-#define RCODE_NXDOMAIN  3
-#define RCODE_NOTIMPL   4
-#define RCODE_REFUSED   5
-#define RCODE_YXDOMAIN  6
-#define RCODE_YXRRSET   7
-#define RCODE_NXRRSET   8
-#define RCODE_NOTAUTH   9
+#define RCODE_NOERROR    0
+#define RCODE_FORMERR    1
+#define RCODE_SERVFAIL   2
+#define RCODE_NXDOMAIN   3
+#define RCODE_NOTIMPL    4
+#define RCODE_REFUSED    5
+#define RCODE_YXDOMAIN   6
+#define RCODE_YXRRSET    7
+#define RCODE_NXRRSET    8
+#define RCODE_NOTAUTH    9
 #define RCODE_NOTZONE   10
 
 static const value_string rcode_vals[] = {
-         { RCODE_NOERROR,   "No error"             },
-         { RCODE_FORMERR,   "Format error"         },
-         { RCODE_SERVFAIL,  "Server failure"       },
-         { RCODE_NXDOMAIN,  "No such name"         },
-         { RCODE_NOTIMPL,   "Not implemented"      },
-         { RCODE_REFUSED,   "Refused"              },
-         { RCODE_YXDOMAIN,  "Name exists"          },
-         { RCODE_YXRRSET,   "RRset exists"         },
-         { RCODE_NXRRSET,   "RRset does not exist" },
-         { RCODE_NOTAUTH,   "Not authoritative"    },
-         { RCODE_NOTZONE,   "Name out of zone"     },
-         { 0,               NULL                   } };
-
-#define NSEC3_HASH_RESERVED 0
-#define NSEC3_HASH_SHA1     1
+  { RCODE_NOERROR,   "No error"             },
+  { RCODE_FORMERR,   "Format error"         },
+  { RCODE_SERVFAIL,  "Server failure"       },
+  { RCODE_NXDOMAIN,  "No such name"         },
+  { RCODE_NOTIMPL,   "Not implemented"      },
+  { RCODE_REFUSED,   "Refused"              },
+  { RCODE_YXDOMAIN,  "Name exists"          },
+  { RCODE_YXRRSET,   "RRset exists"         },
+  { RCODE_NXRRSET,   "RRset does not exist" },
+  { RCODE_NOTAUTH,   "Not authoritative"    },
+  { RCODE_NOTZONE,   "Name out of zone"     },
+  { 0,               NULL                   } };
+
+#define NSEC3_HASH_RESERVED  0
+#define NSEC3_HASH_SHA1      1
 
 #define NSEC3_FLAG_OPTOUT    1
 
 static const value_string hash_algorithms[] = {
-         { NSEC3_HASH_RESERVED,  "Reserved"        },
-         { NSEC3_HASH_SHA1,      "SHA-1"           },
-         { 0,                    NULL              } };
+  { NSEC3_HASH_RESERVED,  "Reserved"        },
+  { NSEC3_HASH_SHA1,      "SHA-1"           },
+  { 0,                    NULL              } };
 
 static const true_false_string tfs_flags_nsec3_optout = {
-       "Additional insecure delegations allowed",
-       "Additional insecure delegations forbidden"
+  "Additional insecure delegations allowed",
+  "Additional insecure delegations forbidden"
 };
 
 /* TSIG/TKEY extended errors */
@@ -382,13 +382,13 @@ static const true_false_string tfs_flags_nsec3_optout = {
 #define TSIGERROR_BADALG   (21)
 
 static const value_string tsigerror_vals[] = {
-         { TSIGERROR_BADSIG,   "Bad signature"        },
-         { TSIGERROR_BADKEY,   "Bad key"              },
-         { TSIGERROR_BADTIME,  "Bad time failure"     },
-         { TSIGERROR_BADMODE,  "Bad mode such name"   },
-         { TSIGERROR_BADNAME,  "Bad name implemented" },
-         { TSIGERROR_BADALG,   "Bad algorithm"        },
-         { 0,                  NULL                   } };
+  { TSIGERROR_BADSIG,   "Bad signature"        },
+  { TSIGERROR_BADKEY,   "Bad key"              },
+  { TSIGERROR_BADTIME,  "Bad time failure"     },
+  { TSIGERROR_BADMODE,  "Bad mode such name"   },
+  { TSIGERROR_BADNAME,  "Bad name implemented" },
+  { TSIGERROR_BADALG,   "Bad algorithm"        },
+  { 0,                  NULL                   } };
 
 #define TKEYMODE_SERVERASSIGNED             (1)
 #define TKEYMODE_DIFFIEHELLMAN              (2)
@@ -422,8 +422,8 @@ static const value_string tsigerror_vals[] = {
 #define DNS_APL_AFDLENGTH      (0x7F<<0)
 
 static const true_false_string tfs_dns_apl_negation = {
-       "Yes (!)",
-       "No (0)"
+  "Yes (!)",
+  "No (0)"
 };
 
 /* See RFC 1035 for all RR types for which no RFC is listed, except for
@@ -440,84 +440,84 @@ http://www.microsoft.com/windows2000/library/resources/reskit/samplechapters/cnc
 /* http://www.iana.org/assignments/dns-parameters */
 
 static const value_string dns_types[] = {
-       { 0,            "Unused" },
-       { T_A,          "A" },
-       { T_NS,         "NS" },
-       { T_MD,         "MD" },
-       { T_MF,         "MF" },
-       { T_CNAME,      "CNAME" },
-       { T_SOA,        "SOA" },
-       { T_MB,         "MB" },
-       { T_MG,         "MG" },
-       { T_MR,         "MR" },
-       { T_NULL,       "NULL" },
-       { T_WKS,        "WKS" },
-       { T_PTR,        "PTR" },
-       { T_HINFO,      "HINFO" },
-       { T_MINFO,      "MINFO" },
-       { T_MX,         "MX" },
-       { T_TXT,        "TXT" },
-       { T_RP,         "RP" }, /* RFC 1183 */
-       { T_AFSDB,      "AFSDB" }, /* RFC 1183 */
-       { T_X25,        "X25" }, /* RFC 1183 */
-       { T_ISDN,       "ISDN" }, /* RFC 1183 */
-       { T_RT,         "RT" }, /* RFC 1183 */
-       { T_NSAP,       "NSAP" }, /* RFC 1706 */
-       { T_NSAP_PTR,   "NSAP-PTR" }, /* RFC 1348 */
-       { T_SIG,        "SIG" }, /* RFC 2535 */
-       { T_KEY,        "KEY" }, /* RFC 2535 */
-       { T_PX,         "PX" }, /* RFC 1664 */
-       { T_GPOS,       "GPOS" }, /* RFC 1712 */
-       { T_AAAA,       "AAAA" }, /* RFC 1886 */
-       { T_LOC,        "LOC" }, /* RFC 1886 */
-       { T_NXT,        "NXT" }, /* RFC 1876 */
-       { T_EID,        "EID" },
-       { T_NIMLOC,     "NIMLOC" },
-       { T_SRV,        "SRV" }, /* RFC 2052 */
-       { T_ATMA,       "ATMA" },
-       { T_NAPTR,      "NAPTR" }, /* RFC 3403 */
-       { T_KX,         "KX" }, /* RFC 2230 */
-       { T_CERT,       "CERT" }, /* RFC 4398 */
-       { T_A6,         "A6" }, /* RFC 2874 */
-       { T_DNAME,      "DNAME" }, /* RFC 2672 */
-
-       { T_OPT,        "OPT" }, /* RFC 2671 */
-       { T_APL,        "APL" }, /* RFC 3123 */
-       { T_DS,         "DS" }, /* RFC 3658 */
-       { T_SSHFP,      "SSHFP" }, /* Using DNS to Securely Publish SSH Key Fingerprints (RFC 4255) */
-       { T_IPSECKEY,   "IPSECKEY" }, /* draft-ietf-ipseckey-rr */
-       { T_RRSIG,      "RRSIG" }, /* future RFC 2535bis */
-       { T_NSEC,       "NSEC" }, /* future RFC 2535bis */
-       { T_DNSKEY,     "DNSKEY" }, /* future RFC 2535bis */
-       { T_DHCID,      "DHCID" }, /* DHCID RR (RFC 4701) */
-       { T_NSEC3,      "NSEC3" }, /* Next secure hash (RFC 5155) */
-       { T_NSEC3PARAM, "NSEC3PARAM" }, /* Next secure hash (RFC 5155) */
-
-       { T_HIP,        "HIP" }, /* Host Identity Protocol (HIP) RR (RFC 5205) */
-
-
-
-       { T_SPF,        "SPF" }, /* SPF RR (RFC 4408) section 3 */
-       { 100,          "UINFO" },
-       { 101,          "UID" },
-       { 102,          "GID" },
-       { 103,          "UNSPEC" },
-
-       { T_TKEY,       "TKEY"},
-       { T_TSIG,       "TSIG"},
-
-       { T_WINS,       "WINS"},
-       { T_WINS_R,     "WINS-R"},
-
-       { 251,          "IXFR"},
-       { 252,          "AXFR"},
-       { 253,          "MAILB"},
-       { 254,          "MAILA"},
-       { 255,          "ANY"},
-
-
-       { T_DLV,        "DLV" }, /* Domain Lookaside Validation DNS Resource Record (RFC 4431) */
-       {0,             NULL}
+  { 0,            "Unused"     },
+  { T_A,          "A"          },
+  { T_NS,         "NS"         },
+  { T_MD,         "MD"         },
+  { T_MF,         "MF"         },
+  { T_CNAME,      "CNAME"      },
+  { T_SOA,        "SOA"        },
+  { T_MB,         "MB"         },
+  { T_MG,         "MG"         },
+  { T_MR,         "MR"         },
+  { T_NULL,       "NULL"       },
+  { T_WKS,        "WKS"        },
+  { T_PTR,        "PTR"        },
+  { T_HINFO,      "HINFO"      },
+  { T_MINFO,      "MINFO"      },
+  { T_MX,         "MX"         },
+  { T_TXT,        "TXT"        },
+  { T_RP,         "RP"         }, /* RFC 1183 */
+  { T_AFSDB,      "AFSDB"      }, /* RFC 1183 */
+  { T_X25,        "X25"        }, /* RFC 1183 */
+  { T_ISDN,       "ISDN"       }, /* RFC 1183 */
+  { T_RT,         "RT"         }, /* RFC 1183 */
+  { T_NSAP,       "NSAP"       }, /* RFC 1706 */
+  { T_NSAP_PTR,   "NSAP-PTR"   }, /* RFC 1348 */
+  { T_SIG,        "SIG"        }, /* RFC 2535 */
+  { T_KEY,        "KEY"        }, /* RFC 2535 */
+  { T_PX,         "PX"         }, /* RFC 1664 */
+  { T_GPOS,       "GPOS"       }, /* RFC 1712 */
+  { T_AAAA,       "AAAA"       }, /* RFC 1886 */
+  { T_LOC,        "LOC"        }, /* RFC 1886 */
+  { T_NXT,        "NXT"        }, /* RFC 1876 */
+  { T_EID,        "EID"        },
+  { T_NIMLOC,     "NIMLOC"     },
+  { T_SRV,        "SRV"        }, /* RFC 2052 */
+  { T_ATMA,       "ATMA"       },
+  { T_NAPTR,      "NAPTR"      }, /* RFC 3403 */
+  { T_KX,         "KX"         }, /* RFC 2230 */
+  { T_CERT,       "CERT"       }, /* RFC 4398 */
+  { T_A6,         "A6"         }, /* RFC 2874 */
+  { T_DNAME,      "DNAME"      }, /* RFC 2672 */
+
+  { T_OPT,        "OPT"        }, /* RFC 2671 */
+  { T_APL,        "APL"        }, /* RFC 3123 */
+  { T_DS,         "DS"         }, /* RFC 3658 */
+  { T_SSHFP,      "SSHFP"      }, /* Using DNS to Securely Publish SSH Key Fingerprints (RFC 4255) */
+  { T_IPSECKEY,   "IPSECKEY"   }, /* draft-ietf-ipseckey-rr */
+  { T_RRSIG,      "RRSIG"      }, /* future RFC 2535bis */
+  { T_NSEC,       "NSEC"       }, /* future RFC 2535bis */
+  { T_DNSKEY,     "DNSKEY"     }, /* future RFC 2535bis */
+  { T_DHCID,      "DHCID"      }, /* DHCID RR (RFC 4701) */
+  { T_NSEC3,      "NSEC3"      }, /* Next secure hash (RFC 5155) */
+  { T_NSEC3PARAM, "NSEC3PARAM" }, /* Next secure hash (RFC 5155) */
+
+  { T_HIP,        "HIP"        }, /* Host Identity Protocol (HIP) RR (RFC 5205) */
+
+
+
+  { T_SPF,        "SPF"        }, /* SPF RR (RFC 4408) section 3 */
+  { 100,          "UINFO"      },
+  { 101,          "UID"        },
+  { 102,          "GID"        },
+  { 103,          "UNSPEC"     },
+
+  { T_TKEY,       "TKEY"       },
+  { T_TSIG,       "TSIG"       },
+
+  { T_WINS,       "WINS"       },
+  { T_WINS_R,     "WINS-R"     },
+
+  { 251,          "IXFR"       },
+  { 252,          "AXFR"       },
+  { 253,          "MAILB"      },
+  { 254,          "MAILA"      },
+  { 255,          "ANY"        },
+
+
+  { T_DLV,        "DLV"        }, /* Domain Lookaside Validation DNS Resource Record (RFC 4431) */
+  {0,             NULL}
 };
 
 static const char *
@@ -547,41 +547,41 @@ dns_type_description (guint type)
     "Mailbox or mail list information",
     "Mail exchange",
     "Text strings",
-    "Responsible person",              /* RFC 1183 */
-    "AFS data base location",          /* RFC 1183 */
-    "X.25 address",                    /* RFC 1183 */
-    "ISDN number",                     /* RFC 1183 */
-    "Route through",                   /* RFC 1183 */
-    "OSI NSAP",                                /* RFC 1706 */
-    "OSI NSAP name pointer",           /* RFC 1348 */
-    "Signature",                       /* RFC 2535 */
-    "Public key",                      /* RFC 2535 */
+    "Responsible person",                   /* RFC 1183 */
+    "AFS data base location",               /* RFC 1183 */
+    "X.25 address",                         /* RFC 1183 */
+    "ISDN number",                          /* RFC 1183 */
+    "Route through",                        /* RFC 1183 */
+    "OSI NSAP",                             /* RFC 1706 */
+    "OSI NSAP name pointer",                /* RFC 1348 */
+    "Signature",                            /* RFC 2535 */
+    "Public key",                           /* RFC 2535 */
     "Pointer to X.400/RFC822 mapping info", /* RFC 1664 */
-    "Geographical position",           /* RFC 1712 */
-    "IPv6 address",                    /* RFC 1886 */
-    "Location",                                /* RFC 1876 */
-    "Next",                            /* RFC 2535 */
+    "Geographical position",                /* RFC 1712 */
+    "IPv6 address",                         /* RFC 1886 */
+    "Location",                             /* RFC 1876 */
+    "Next",                                 /* RFC 2535 */
     "EID",
     "NIMLOC",
-    "Service location",                        /* RFC 2052 */
+    "Service location",                     /* RFC 2052 */
     "ATMA",
-    "Naming authority pointer",                /* RFC 2168 */
-    "Key Exchange",                    /* RFC 2230 */
-    "Certificate",                     /* RFC 4398 */
-    "IPv6 address with indirection",   /* RFC 2874 */
-    "Non-terminal DNS name redirection", /* RFC 2672 */
+    "Naming authority pointer",             /* RFC 2168 */
+    "Key Exchange",                         /* RFC 2230 */
+    "Certificate",                          /* RFC 4398 */
+    "IPv6 address with indirection",        /* RFC 2874 */
+    "Non-terminal DNS name redirection",    /* RFC 2672 */
     NULL,
-    "EDNS0 option",                    /* RFC 2671 */
-    "Lists of Address Prefixes",       /* RFC 3123 */
-    "Delegation Signer",                /* RFC 3658 */
-    "SSH public host key fingerprint",   /* RFC 4255 */
-    "key to use with IPSEC",            /* draft-ietf-ipseckey-rr */
-    "RR signature",                     /* future RFC 2535bis */
-    "Next secured",                     /* future RFC 2535bis */
-    "DNS public key",                   /* future RFC 2535bis */
-    "DHCP Information",                 /* RFC 4701 */
-    "Next secured hash",                /* RFC 5155 */
-    "NSEC3 parameters",                 /* RFC 5155 */
+    "EDNS0 option",                         /* RFC 2671 */
+    "Lists of Address Prefixes",            /* RFC 3123 */
+    "Delegation Signer",                    /* RFC 3658 */
+    "SSH public host key fingerprint",      /* RFC 4255 */
+    "key to use with IPSEC",                /* draft-ietf-ipseckey-rr */
+    "RR signature",                         /* future RFC 2535bis */
+    "Next secured",                         /* future RFC 2535bis */
+    "DNS public key",                       /* future RFC 2535bis */
+    "DHCP Information",                     /* RFC 4701 */
+    "Next secured hash",                    /* RFC 5155 */
+    "NSEC3 parameters",                     /* RFC 5155 */
     NULL,
     NULL,
     NULL,
@@ -594,9 +594,9 @@ dns_type_description (guint type)
   if (short_name == NULL) {
     return ep_strdup_printf("Unknown (%u)", type);
   }
-  if (type < array_length(type_names))
+  if (type < array_length(type_names)) {
     long_name = type_names[type];
-  else {
+  else {
     /* special cases */
     switch (type) {
         /* meta */
@@ -609,7 +609,7 @@ dns_type_description (guint type)
 
         /* queries  */
       case 251:
-        long_name = "Request for incremental zone transfer";   /* RFC 1995 */
+        long_name = "Request for incremental zone transfer";   /* RFC 1995 */
         break;
       case 252:
         long_name = "Request for full zone transfer";
@@ -629,20 +629,21 @@ dns_type_description (guint type)
       }
   }
 
-  if (long_name != NULL)
+  if (long_name != NULL) {
     return ep_strdup_printf("%s (%s)", short_name, long_name);
-  else
+  } else {
     return ep_strdup(short_name);
+  }
 }
 
 static const value_string dns_classes[] = {
-       {C_IN, "IN"},
-       {C_CS, "CS"},
-       {C_CH, "CH"},
-       {C_HS, "HS"},
-       {C_NONE, "NONE"},
-       {C_ANY, "ANY"},
-       {0,NULL}
+  {C_IN,   "IN"},
+  {C_CS,   "CS"},
+  {C_CH,   "CH"},
+  {C_HS,   "HS"},
+  {C_NONE, "NONE"},
+  {C_ANY,  "ANY"},
+  {0,NULL}
 };
 
 const char *
@@ -660,167 +661,174 @@ int
 expand_dns_name(tvbuff_t *tvb, int offset, int max_len, int dns_data_offset,
     const guchar **name)
 {
-  int start_offset = offset;
+  int     start_offset    = offset;
   guchar *np;
-  int len = -1;
-  int chars_processed = 0;
-  int data_size = tvb_reported_length_remaining(tvb, dns_data_offset);
-  int component_len;
-  int indir_offset;
-  int maxname;
-
-  const int min_len = 1;       /* Minimum length of encoded name (for root) */
-       /* If we're about to return a value (probably negative) which is less
-        * than the minimum length, we're looking at bad data and we're liable
-        * to put the dissector into a loop.  Instead we throw an exception */
+  int     len             = -1;
+  int     chars_processed = 0;
+  int     data_size       = tvb_reported_length_remaining(tvb, dns_data_offset);
+  int     component_len;
+  int     indir_offset;
+  int     maxname;
+
+  const int min_len = 1;        /* Minimum length of encoded name (for root) */
+        /* If we're about to return a value (probably negative) which is less
+         * than the minimum length, we're looking at bad data and we're liable
+         * to put the dissector into a loop.  Instead we throw an exception */
 
   maxname=MAXDNAME;
   np=ep_alloc(maxname);
   *name=np;
 
-  maxname--;   /* reserve space for the trailing '\0' */
+  maxname--;   /* reserve space for the trailing '\0' */
   for (;;) {
-    if (max_len && offset - start_offset > max_len - 1)
+    if (max_len && offset - start_offset > max_len - 1) {
       break;
+    }
     component_len = tvb_get_guint8(tvb, offset);
     offset++;
-    if (component_len == 0)
+    if (component_len == 0) {
       break;
+    }
     chars_processed++;
     switch (component_len & 0xc0) {
 
-    case 0x00:
-      /* Label */
-      if (np != *name) {
-       /* Not the first component - put in a '.'. */
-        if (maxname > 0) {
-          *np++ = '.';
-          maxname--;
+      case 0x00:
+        /* Label */
+        if (np != *name) {
+          /* Not the first component - put in a '.'. */
+          if (maxname > 0) {
+            *np++ = '.';
+            maxname--;
+          }
         }
-      }
-      while (component_len > 0) {
-        if (max_len && offset - start_offset > max_len - 1)
-          THROW(ReportedBoundsError);
-        if (maxname > 0) {
-          *np++ = tvb_get_guint8(tvb, offset);
-          maxname--;
+        while (component_len > 0) {
+          if (max_len && offset - start_offset > max_len - 1) {
+            THROW(ReportedBoundsError);
+          }
+          if (maxname > 0) {
+            *np++ = tvb_get_guint8(tvb, offset);
+            maxname--;
+          }
+          component_len--;
+          offset++;
+          chars_processed++;
         }
-       component_len--;
-       offset++;
-        chars_processed++;
-      }
-      break;
-
-    case 0x40:
-      /* Extended label (RFC 2673) */
-      switch (component_len & 0x3f) {
-
-      case 0x01:
-       /* Bitstring label */
-       {
-         int bit_count;
-         int label_len;
-         int print_len;
-
-         bit_count = tvb_get_guint8(tvb, offset);
-         offset++;
-         label_len = (bit_count - 1) / 8 + 1;
-
-         if (maxname > 0) {
-           print_len = g_snprintf(np, maxname + 1, "\\[x");
-           if (print_len != -1 && print_len <= maxname) {
-             /* Some versions of g_snprintf return -1 if they'd truncate
-                the output.  Others return <buf_size> or greater. */
-             np += print_len;
-             maxname -= print_len;
-           } else {
-             /* Nothing printed, as there's no room.
-                Suppress all subsequent printing. */
-             maxname = 0;
-           }
-         }
-         while(label_len--) {
-           if (maxname > 0) {
-             print_len = g_snprintf(np, maxname + 1, "%02x",
-               tvb_get_guint8(tvb, offset));
-             if (print_len != -1 && print_len <= maxname) {
-               /* Some versions of g_snprintf return -1 if they'd truncate
-                the output.  Others return <buf_size> or greater. */
-               np += print_len;
-               maxname -= print_len;
-             } else {
-               /* Nothing printed, as there's no room.
-                  Suppress all subsequent printing. */
-               maxname = 0;
-             }
-           }
-           offset++;
-         }
-         if (maxname > 0) {
-           print_len = g_snprintf(np, maxname + 1, "/%d]", bit_count);
-           if (print_len != -1 && print_len <= maxname) {
-             /* Some versions of g_snprintf return -1 if they'd truncate
-                the output.  Others return <buf_size> or greater. */
-             np += print_len;
-             maxname -= print_len;
-           } else {
-             /* Nothing printed, as there's no room.
-                Suppress all subsequent printing. */
-             maxname = 0;
-           }
-         }
-       }
-       break;
+        break;
 
-      default:
-       *name="<Unknown extended label>";
-       /* Parsing will probably fail from here on, since the */
-       /* label length is unknown... */
-       len = offset - start_offset;
-        if (len < min_len)
-          THROW(ReportedBoundsError);
-        return len;
-      }
-      break;
+      case 0x40:
+        /* Extended label (RFC 2673) */
+        switch (component_len & 0x3f) {
+
+          case 0x01:
+            /* Bitstring label */
+          {
+            int bit_count;
+            int label_len;
+            int print_len;
+
+            bit_count = tvb_get_guint8(tvb, offset);
+            offset++;
+            label_len = (bit_count - 1) / 8 + 1;
+
+            if (maxname > 0) {
+              print_len = g_snprintf(np, maxname + 1, "\\[x");
+              if (print_len != -1 && print_len <= maxname) {
+                /* Some versions of g_snprintf return -1 if they'd truncate
+                   the output.  Others return <buf_size> or greater. */
+                np      += print_len;
+                maxname -= print_len;
+              } else {
+                /* Nothing printed, as there's no room.
+                   Suppress all subsequent printing. */
+                maxname = 0;
+              }
+            }
+            while (label_len--) {
+              if (maxname > 0) {
+                print_len = g_snprintf(np, maxname + 1, "%02x",
+                                       tvb_get_guint8(tvb, offset));
+                if (print_len != -1 && print_len <= maxname) {
+                  /* Some versions of g_snprintf return -1 if they'd truncate
+                     the output.  Others return <buf_size> or greater. */
+                  np      += print_len;
+                  maxname -= print_len;
+                } else {
+                  /* Nothing printed, as there's no room.
+                     Suppress all subsequent printing. */
+                  maxname = 0;
+                }
+              }
+              offset++;
+            }
+            if (maxname > 0) {
+              print_len = g_snprintf(np, maxname + 1, "/%d]", bit_count);
+              if (print_len != -1 && print_len <= maxname) {
+                /* Some versions of g_snprintf return -1 if they'd truncate
+                   the output.  Others return <buf_size> or greater. */
+                np      += print_len;
+                maxname -= print_len;
+              } else {
+                /* Nothing printed, as there's no room.
+                   Suppress all subsequent printing. */
+                maxname = 0;
+              }
+            }
+          }
+          break;
+
+          default:
+            *name="<Unknown extended label>";
+            /* Parsing will probably fail from here on, since the */
+            /* label length is unknown... */
+            len = offset - start_offset;
+            if (len < min_len) {
+              THROW(ReportedBoundsError);
+            }
+            return len;
+        }
+        break;
 
-    case 0x80:
-      THROW(ReportedBoundsError);
+      case 0x80:
+        THROW(ReportedBoundsError);
 
-    case 0xc0:
-      /* Pointer. */
-      indir_offset = dns_data_offset +
+      case 0xc0:
+        /* Pointer. */
+        indir_offset = dns_data_offset +
           (((component_len & ~0xc0) << 8) | tvb_get_guint8(tvb, offset));
-      offset++;
-      chars_processed++;
-
-      /* If "len" is negative, we are still working on the original name,
-         not something pointed to by a pointer, and so we should set "len"
-         to the length of the original name. */
-      if (len < 0)
-        len = offset - start_offset;
+        offset++;
+        chars_processed++;
 
-      /* If we've looked at every character in the message, this pointer
-         will make us look at some character again, which means we're
-        looping. */
-      if (chars_processed >= data_size) {
-        *name="<Name contains a pointer that loops>";
-        if (len < min_len)
-          THROW(ReportedBoundsError);
-        return len;
-      }
+        /* If "len" is negative, we are still working on the original name,
+           not something pointed to by a pointer, and so we should set "len"
+           to the length of the original name. */
+        if (len < 0) {
+          len = offset - start_offset;
+        }
+        /* If we've looked at every character in the message, this pointer
+           will make us look at some character again, which means we're
+           looping. */
+        if (chars_processed >= data_size) {
+          *name="<Name contains a pointer that loops>";
+          if (len < min_len) {
+            THROW(ReportedBoundsError);
+          }
+          return len;
+        }
 
-      offset = indir_offset;
-      break;   /* now continue processing from there */
+        offset = indir_offset;
+        break;   /* now continue processing from there */
     }
   }
 
   *np = '\0';
   /* If "len" is negative, we haven't seen a pointer, and thus haven't
      set the length, so set it. */
-  if (len < 0)
+  if (len < 0) {
     len = offset - start_offset;
-  if (len < min_len)
+  }
+  if (len < min_len) {
     THROW(ReportedBoundsError);
+  }
   return len;
 }
 
@@ -833,8 +841,9 @@ get_dns_name(tvbuff_t *tvb, int offset, int max_len, int dns_data_offset,
   len = expand_dns_name(tvb, offset, max_len, dns_data_offset, name);
 
   /* Zero-length name means "root server" */
-  if (**name == '\0')
+  if (**name == '\0') {
     *name="<Root>";
+  }
 
   return len;
 }
@@ -870,8 +879,8 @@ get_dns_name_type_class(tvbuff_t *tvb, int offset, int dns_data_offset,
 static double
 rfc1867_size(tvbuff_t *tvb, int offset)
 {
-  guint8 val;
-  double size;
+  guint8  val;
+  double  size;
   guint32 exponent;
 
   val = tvb_get_guint8(tvb, offset);
@@ -881,16 +890,16 @@ rfc1867_size(tvbuff_t *tvb, int offset)
     size *= 10;
     exponent--;
   }
-  return size / 100;   /* return size in meters, not cm */
+  return size / 100;  /* return size in meters, not cm */
 }
 
 static char *
 rfc1867_angle(tvbuff_t *tvb, int offset, const char *nsew)
 {
-  guint32 angle;
-  char direction;
-  guint32 degrees, minutes, secs, tsecs;
-      /* "%u deg %u min %u.%03u sec %c" */
+  guint32     angle;
+  char        direction;
+  guint32     degrees, minutes, secs, tsecs;
+              /* "%u deg %u min %u.%03u sec %c" */
   static char buf[10+1+3+1 + 2+1+3+1 + 2+1+3+1+3+1 + 1 + 1];
 
   angle = tvb_get_ntohl(tvb, offset);
@@ -909,7 +918,7 @@ rfc1867_angle(tvbuff_t *tvb, int offset, const char *nsew)
   minutes = angle % 60;
   degrees = angle / 60;
   g_snprintf(buf, sizeof(buf), "%u deg %u min %u.%03u sec %c", degrees, minutes, secs,
-               tsecs, direction);
+             tsecs, direction);
   return buf;
 }
 
@@ -917,17 +926,17 @@ static int
 dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset,
   column_info *cinfo, proto_tree *dns_tree, gboolean is_mdns)
 {
-  int len;
+  int           len;
   const guchar *name;
-  gchar *name_out;
-  int name_len;
-  int type;
-  int dns_class;
-  int qu;
-  const char *type_name;
-  int data_start;
-  proto_tree *q_tree;
-  proto_item *tq;
+  gchar        *name_out;
+  int           name_len;
+  int           type;
+  int           dns_class;
+  int           qu;
+  const char   *type_name;
+  int           data_start;
+  proto_tree   *q_tree;
+  proto_item   *tq;
 
   data_start = offset;
 
@@ -937,8 +946,9 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset,
     /* Split the QU flag and the class */
     qu = dns_class & C_QU;
     dns_class &= ~C_QU;
-  } else
+  } else {
     qu = 0;
+  }
 
   type_name = dns_type_name(type);
 
@@ -950,33 +960,36 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset,
 
   if (cinfo != NULL) {
     col_append_fstr(cinfo, COL_INFO, " %s %s", type_name, name_out);
-    if (is_mdns)
+    if (is_mdns) {
       col_append_fstr(cinfo, COL_INFO, ", \"%s\" question", qu ? "QU" : "QM");
+    }
   }
   if (dns_tree != NULL) {
     tq = proto_tree_add_text(dns_tree, tvb, offset, len, "%s: type %s, class %s",
-                  name_out, type_name, dns_class_name(dns_class));
-    if (is_mdns)
+                             name_out, type_name, dns_class_name(dns_class));
+    if (is_mdns) {
       proto_item_append_text(tq, ", \"%s\" question", qu ? "QU" : "QM");
+    }
     q_tree = proto_item_add_subtree(tq, ett_dns_qd);
 
     proto_tree_add_string(q_tree, hf_dns_qry_name, tvb, offset, name_len, name);
     offset += name_len;
 
     proto_tree_add_uint_format(q_tree, hf_dns_qry_type, tvb, offset, 2, type,
-               "Type: %s", dns_type_description(type));
+                               "Type: %s", dns_type_description(type));
     offset += 2;
 
     if (is_mdns) {
       proto_tree_add_uint(q_tree, hf_dns_qry_class_mdns, tvb, offset, 2, dns_class);
       proto_tree_add_boolean(q_tree, hf_dns_qry_qu, tvb, offset, 2, qu);
-    } else
+    } else {
       proto_tree_add_uint(q_tree, hf_dns_qry_class, tvb, offset, 2, dns_class);
+    }
 
     offset += 2;
   }
 
-  if(data_start + len != offset) {
+  if (data_start + len != offset) {
     /* Add expert info ? (about incorrect len...)*/
   }
   return len;
@@ -988,26 +1001,27 @@ add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
   const guchar *name, int namelen, int type, int dns_class, int flush,
   guint ttl, gushort data_len, gboolean is_mdns)
 {
-  proto_tree *rr_tree;
-  gchar **srv_rr_info;
+  proto_tree  *rr_tree;
+  gchar      **srv_rr_info;
 
   rr_tree = proto_item_add_subtree(trr, rr_type);
 
-  if(type == T_SRV) {
+  if (type == T_SRV) {
     srv_rr_info = g_strsplit(name, ".", 3);
 
     /* The + 1 on the strings is to skip the leading '_' */
 
     proto_tree_add_string(rr_tree, hf_dns_srv_service, tvb, offset,
-                         namelen, srv_rr_info[0]+1);
+                          namelen, srv_rr_info[0]+1);
 
     if (srv_rr_info[1]) {
       proto_tree_add_string(rr_tree, hf_dns_srv_proto, tvb, offset,
-                           namelen, srv_rr_info[1]+1);
+                            namelen, srv_rr_info[1]+1);
 
-      if (srv_rr_info[2])
-       proto_tree_add_string(rr_tree, hf_dns_srv_name, tvb, offset,
-                             namelen, srv_rr_info[2]);
+      if (srv_rr_info[2]) {
+        proto_tree_add_string(rr_tree, hf_dns_srv_name, tvb, offset,
+                              namelen, srv_rr_info[2]);
+      }
     }
 
     g_strfreev(srv_rr_info);
@@ -1018,16 +1032,17 @@ add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
   offset += namelen;
 
   proto_tree_add_uint_format(rr_tree, hf_dns_rr_type, tvb, offset, 2, type,
-               "Type: %s", dns_type_description(type));
+                             "Type: %s", dns_type_description(type));
   offset += 2;
   if (is_mdns) {
     proto_tree_add_uint(rr_tree, hf_dns_rr_class_mdns, tvb, offset, 2, dns_class);
     proto_tree_add_boolean(rr_tree, hf_dns_rr_cache_flush, tvb, offset, 2, flush);
-  } else
+  } else {
     proto_tree_add_uint(rr_tree, hf_dns_rr_class, tvb, offset, 2, dns_class);
+  }
   offset += 2;
   proto_tree_add_uint_format(rr_tree, hf_dns_rr_ttl, tvb, offset, 4, ttl,
-               "Time to live: %s", time_secs_to_str(ttl));
+                             "Time to live: %s", time_secs_to_str(ttl));
   offset += 4;
   proto_tree_add_uint(rr_tree, hf_dns_rr_len, tvb, offset, 2, data_len);
   return rr_tree;
@@ -1046,7 +1061,7 @@ add_opt_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
   proto_tree_add_string(rr_tree, hf_dns_rr_name, tvb, offset, namelen, name);
   offset += namelen;
   proto_tree_add_uint_format(rr_tree, hf_dns_rr_type, tvb, offset, 2, type,
-               "Type: %s", dns_type_description(type));
+                             "Type: %s", dns_type_description(type));
   offset += 2;
   if (is_mdns) {
     proto_tree_add_text(rr_tree, tvb, offset, 2, "%s",
@@ -1055,8 +1070,7 @@ add_opt_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
     proto_tree_add_boolean(rr_tree, hf_dns_rr_cache_flush, tvb, offset, 2,
        flush);
   } else {
-    proto_tree_add_text(rr_tree, tvb, offset, 2, "UDP payload size: %u",
-      dns_class & 0xffff);
+    proto_tree_add_text(rr_tree, tvb, offset, 2, "UDP payload size: %u", dns_class & 0xffff);
   }
   offset += 2;
   proto_tree_add_text(rr_tree, tvb, offset, 1, "Higher bits in extended RCODE: 0x%x",
@@ -1079,8 +1093,8 @@ add_opt_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
 static int
 dissect_type_bitmap(proto_tree *rr_tree, tvbuff_t *tvb, int cur_offset, int rr_len)
 {
-  int mask, blockbase, blocksize;
-  int i, initial_offset, rr_type;
+  int    mask, blockbase, blocksize;
+  int    i, initial_offset, rr_type;
   guint8 bits;
 
   initial_offset = cur_offset;
@@ -1088,7 +1102,7 @@ dissect_type_bitmap(proto_tree *rr_tree, tvbuff_t *tvb, int cur_offset, int rr_l
     blockbase = tvb_get_guint8(tvb, cur_offset);
     blocksize = tvb_get_guint8(tvb, cur_offset + 1);
     cur_offset += 2;
-    rr_len -= 2;
+    rr_len     -= 2;
     rr_type = blockbase * 256;
     for( ; blocksize; blocksize-- ) {
       bits = tvb_get_guint8(tvb, cur_offset);
@@ -1103,7 +1117,7 @@ dissect_type_bitmap(proto_tree *rr_tree, tvbuff_t *tvb, int cur_offset, int rr_l
         rr_type++;
       }
       cur_offset += 1;
-      rr_len -= 1;
+      rr_len     -= 1;
     }
   }
   return(initial_offset - cur_offset);
@@ -1113,67 +1127,67 @@ dissect_type_bitmap(proto_tree *rr_tree, tvbuff_t *tvb, int cur_offset, int rr_l
  * SIG, KEY, and CERT RR algorithms.
  * http://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.txt (last updated 2012-04-13)
  */
-#define DNS_ALGO_RSAMD5              /* RSA/MD5 */
-#define DNS_ALGO_DH                  /* Diffie-Hellman */
-#define DNS_ALGO_DSA                 /* DSA */
-#define DNS_ALGO_ECC                 /* Elliptic curve crypto */
-#define DNS_ALGO_RSASHA1             /* RSA/SHA1 */
-#define DNS_ALGO_DSA_NSEC3_SHA1      /* DSA + NSEC3/SHA1 */
-#define DNS_ALGO_RSASHA1_NSEC3_SHA1  /* RSA/SHA1 + NSEC3/SHA1 */
-#define DNS_ALGO_RSASHA256           /* RSA/SHA-256 */
-#define DNS_ALGO_RSASHA512          10 /* RSA/SHA-512 */
-#define DNS_ALGO_ECCGOST            12 /* GOST R 34.10-2001 */
-#define DNS_ALGO_ECDSAP256SHA256    13 /* ECDSA Curve P-256 with SHA-256 */
-#define DNS_ALGO_ECDSAP386SHA386    14 /* ECDSA Curve P-386 with SHA-386 */
-#define DNS_ALGO_HMACMD5            157        /* HMAC/MD5 */
-#define DNS_ALGO_INDIRECT           252        /* Indirect key */
-#define DNS_ALGO_PRIVATEDNS         253        /* Private, domain name  */
-#define DNS_ALGO_PRIVATEOID         254        /* Private, OID */
+#define DNS_ALGO_RSAMD5               1 /* RSA/MD5 */
+#define DNS_ALGO_DH                   2 /* Diffie-Hellman */
+#define DNS_ALGO_DSA                  3 /* DSA */
+#define DNS_ALGO_ECC                  4 /* Elliptic curve crypto */
+#define DNS_ALGO_RSASHA1              5 /* RSA/SHA1 */
+#define DNS_ALGO_DSA_NSEC3_SHA1       6 /* DSA + NSEC3/SHA1 */
+#define DNS_ALGO_RSASHA1_NSEC3_SHA1   7 /* RSA/SHA1 + NSEC3/SHA1 */
+#define DNS_ALGO_RSASHA256            8 /* RSA/SHA-256 */
+#define DNS_ALGO_RSASHA512           10 /* RSA/SHA-512 */
+#define DNS_ALGO_ECCGOST             12 /* GOST R 34.10-2001 */
+#define DNS_ALGO_ECDSAP256SHA256     13 /* ECDSA Curve P-256 with SHA-256 */
+#define DNS_ALGO_ECDSAP386SHA386     14 /* ECDSA Curve P-386 with SHA-386 */
+#define DNS_ALGO_HMACMD5            157 /* HMAC/MD5 */
+#define DNS_ALGO_INDIRECT           252 /* Indirect key */
+#define DNS_ALGO_PRIVATEDNS         253 /* Private, domain name  */
+#define DNS_ALGO_PRIVATEOID         254 /* Private, OID */
 
 static const value_string algo_vals[] = {
-         { DNS_ALGO_RSAMD5,            "RSA/MD5" },
-         { DNS_ALGO_DH,                "Diffie-Hellman" },
-         { DNS_ALGO_DSA,               "DSA" },
-         { DNS_ALGO_ECC,               "Elliptic curve crypto" },
-         { DNS_ALGO_RSASHA1,           "RSA/SHA1" },
-         { DNS_ALGO_DSA_NSEC3_SHA1,    "DSA + NSEC3/SHA1" },
-         { DNS_ALGO_RSASHA1_NSEC3_SHA1,"RSA/SHA1 + NSEC3/SHA1" },
-         { DNS_ALGO_RSASHA256,         "RSA/SHA-256" },
-         { DNS_ALGO_RSASHA512,         "RSA/SHA-512" },
-         { DNS_ALGO_ECCGOST,           "GOST R 34.10-2001" },
-         { DNS_ALGO_ECDSAP256SHA256,   "ECDSA Curve P-256 with SHA-256" },
-         { DNS_ALGO_ECDSAP386SHA386,   "ECDSA Curve P-386 with SHA-386" },
-         { DNS_ALGO_HMACMD5,           "HMAC/MD5" },
-         { DNS_ALGO_INDIRECT,          "Indirect key" },
-         { DNS_ALGO_PRIVATEDNS,        "Private, domain name" },
-         { DNS_ALGO_PRIVATEOID,        "Private, OID" },
-         { 0,                          NULL }
+  { DNS_ALGO_RSAMD5,            "RSA/MD5" },
+  { DNS_ALGO_DH,                "Diffie-Hellman" },
+  { DNS_ALGO_DSA,               "DSA" },
+  { DNS_ALGO_ECC,               "Elliptic curve crypto" },
+  { DNS_ALGO_RSASHA1,           "RSA/SHA1" },
+  { DNS_ALGO_DSA_NSEC3_SHA1,    "DSA + NSEC3/SHA1" },
+  { DNS_ALGO_RSASHA1_NSEC3_SHA1,"RSA/SHA1 + NSEC3/SHA1" },
+  { DNS_ALGO_RSASHA256,         "RSA/SHA-256" },
+  { DNS_ALGO_RSASHA512,         "RSA/SHA-512" },
+  { DNS_ALGO_ECCGOST,           "GOST R 34.10-2001" },
+  { DNS_ALGO_ECDSAP256SHA256,   "ECDSA Curve P-256 with SHA-256" },
+  { DNS_ALGO_ECDSAP386SHA386,   "ECDSA Curve P-386 with SHA-386" },
+  { DNS_ALGO_HMACMD5,           "HMAC/MD5" },
+  { DNS_ALGO_INDIRECT,          "Indirect key" },
+  { DNS_ALGO_PRIVATEDNS,        "Private, domain name" },
+  { DNS_ALGO_PRIVATEOID,        "Private, OID" },
+  { 0,                          NULL }
 };
 
 /* See RFC 4398 */
-#define DNS_CERT_PKIX          1       /* X509 certificate */
-#define DNS_CERT_SPKI          2       /* Simple public key certificate */
-#define DNS_CERT_PGP           3       /* OpenPGP packet */
-#define DNS_CERT_IPKIX         4       /* Indirect PKIX */
-#define DNS_CERT_ISPKI         5       /* Indirect SPKI */
-#define DNS_CERT_IPGP          6       /* Indirect PGP */
-#define DNS_CERT_ACPKIX                7       /* Attribute certificate */
-#define DNS_CERT_IACPKIX       8       /* Indirect ACPKIX */
-#define DNS_CERT_PRIVATEURI    253     /* Private, URI */
-#define DNS_CERT_PRIVATEOID    254     /* Private, OID */
+#define DNS_CERT_PKIX             1     /* X509 certificate */
+#define DNS_CERT_SPKI             2     /* Simple public key certificate */
+#define DNS_CERT_PGP              3     /* OpenPGP packet */
+#define DNS_CERT_IPKIX            4     /* Indirect PKIX */
+#define DNS_CERT_ISPKI            5     /* Indirect SPKI */
+#define DNS_CERT_IPGP             6     /* Indirect PGP */
+#define DNS_CERT_ACPKIX           7     /* Attribute certificate */
+#define DNS_CERT_IACPKIX          8     /* Indirect ACPKIX */
+#define DNS_CERT_PRIVATEURI     253     /* Private, URI */
+#define DNS_CERT_PRIVATEOID     254     /* Private, OID */
 
 static const value_string cert_vals[] = {
-         { DNS_CERT_PKIX,       "PKIX" },
-         { DNS_CERT_SPKI,       "SPKI" },
-         { DNS_CERT_PGP,        "PGP" },
-         { DNS_CERT_IPKIX,      "IPKIX" },
-         { DNS_CERT_ISPKI,      "ISPKI" },
-         { DNS_CERT_IPGP,       "IPGP" },
-         { DNS_CERT_ACPKIX,     "ACPKIX" },
-         { DNS_CERT_IACPKIX,    "IACPKIX" },
-         { DNS_CERT_PRIVATEURI, "Private, URI" },
-         { DNS_CERT_PRIVATEOID, "Private, OID" },
-         { 0,                   NULL }
+  { DNS_CERT_PKIX,       "PKIX" },
+  { DNS_CERT_SPKI,       "SPKI" },
+  { DNS_CERT_PGP,        "PGP" },
+  { DNS_CERT_IPKIX,      "IPKIX" },
+  { DNS_CERT_ISPKI,      "ISPKI" },
+  { DNS_CERT_IPGP,       "IPGP" },
+  { DNS_CERT_ACPKIX,     "ACPKIX" },
+  { DNS_CERT_IACPKIX,    "IACPKIX" },
+  { DNS_CERT_PRIVATEURI, "Private, URI" },
+  { DNS_CERT_PRIVATEOID, "Private, OID" },
+  { 0,                   NULL }
 };
 
 /**
@@ -1183,7 +1197,7 @@ static guint16
 compute_key_id(tvbuff_t *tvb, int offset, int size, guint8 algo)
 {
   guint32 ac;
-  guint8 c1, c2;
+  guint8  c1, c2;
 
   DISSECTOR_ASSERT(size >= 4);
 
@@ -1192,13 +1206,13 @@ compute_key_id(tvbuff_t *tvb, int offset, int size, guint8 algo)
        return (guint16)(tvb_get_guint8(tvb, offset + size - 3) << 8) + tvb_get_guint8( tvb, offset + size - 2 );
      default:
        for (ac = 0; size > 1; size -= 2, offset += 2) {
-        c1 = tvb_get_guint8( tvb, offset );
-        c2 = tvb_get_guint8( tvb, offset + 1 );
-        ac +=  (c1 << 8) + c2 ;
+         c1 = tvb_get_guint8( tvb, offset );
+         c2 = tvb_get_guint8( tvb, offset + 1 );
+         ac +=  (c1 << 8) + c2 ;
        }
        if (size > 0) {
-        c1 = tvb_get_guint8( tvb, offset );
-        ac += c1 << 8;
+         c1 = tvb_get_guint8( tvb, offset );
+         ac += c1 << 8;
        }
        ac += (ac >> 16) & 0xffff;
        return (guint16)(ac & 0xffff);
@@ -1211,37 +1225,37 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
   column_info *cinfo, proto_tree *dns_tree, packet_info *pinfo,
   gboolean is_mdns)
 {
-  int len;
+  int           len;
   const guchar *name;
-  gchar *name_out;
-  int name_len;
-  int type;
-  int dns_class;
-  int flush;
-  const char *class_name;
-  const char *type_name;
-  int data_offset;
-  int cur_offset;
-  int data_start;
-  guint ttl;
-  gushort data_len;
-  proto_tree *rr_tree = NULL;
-  proto_item *trr = NULL;
+  gchar        *name_out;
+  int           name_len;
+  int           type;
+  int           dns_class;
+  int           flush;
+  const char   *class_name;
+  const char   *type_name;
+  int           data_offset;
+  int           cur_offset;
+  int           data_start;
+  guint         ttl;
+  gushort       data_len;
+  proto_tree   *rr_tree = NULL;
+  proto_item   *trr     = NULL;
 
   data_start = data_offset = offsetx;
   cur_offset = offsetx;
 
   len = get_dns_name_type_class(tvb, offsetx, dns_data_offset, &name, &name_len,
-    &type, &dns_class);
+                                &type, &dns_class);
   data_offset += len;
   cur_offset += len;
   if (is_mdns) {
     /* Split the FLUSH flag and the class */
     flush = dns_class & C_FLUSH;
     dns_class &= ~C_FLUSH;
-  } else
+  } else {
     flush = 0;
-
+  }
   type_name = dns_type_name(type);
   class_name = dns_class_name(dns_class);
 
@@ -1251,12 +1265,13 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
 
   data_len = tvb_get_ntohs(tvb, data_offset);
   data_offset += 2;
-  cur_offset += 2;
+  cur_offset  += 2;
 
   if (cinfo != NULL) {
     col_append_fstr(cinfo, COL_INFO, " %s", type_name);
-    if (is_mdns && flush)
+    if (is_mdns && flush) {
       col_append_str(cinfo, COL_INFO, ", cache flush");
+    }
   }
   if (dns_tree != NULL) {
     /*
@@ -1266,230 +1281,236 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
     name_out = format_text(name, strlen(name));
     if (type != T_OPT) {
       trr = proto_tree_add_text(dns_tree, tvb, offsetx,
-                   (data_offset - data_start) + data_len,
-                   "%s: type %s, class %s",
-                   name_out, type_name, class_name);
+                                (data_offset - data_start) + data_len,
+                                "%s: type %s, class %s",
+                                name_out, type_name, class_name);
       rr_tree = add_rr_to_tree(trr, ett_dns_rr, tvb, offsetx, name, name_len,
-                    type, dns_class, flush, ttl, data_len, is_mdns);
+                               type, dns_class, flush, ttl, data_len, is_mdns);
     } else  {
       trr = proto_tree_add_text(dns_tree, tvb, offsetx,
-                   (data_offset - data_start) + data_len,
-                   "%s: type %s", name_out, type_name);
+                                (data_offset - data_start) + data_len,
+                                "%s: type %s", name_out, type_name);
       rr_tree = add_opt_rr_to_tree(trr, ett_dns_rr, tvb, offsetx, name, name_len,
-                    type, dns_class, flush, ttl, data_len, is_mdns);
+                                   type, dns_class, flush, ttl, data_len, is_mdns);
     }
-    if (is_mdns && flush)
+    if (is_mdns && flush) {
       proto_item_append_text(trr, ", cache flush");
+    }
   }
 
-  if (data_len == 0)
+  if (data_len == 0) {
     return data_offset - data_start;
+  }
 
   switch (type) {
 
-  case T_A:
+    case T_A:
     {
       const char *addr;
       guint32 addr_int;
 
       addr = tvb_ip_to_str(tvb, cur_offset);
-      if (cinfo != NULL)
-       col_append_fstr(cinfo, COL_INFO, " %s", addr);
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", addr);
+      }
 
-       proto_item_append_text(trr, ", addr %s", addr);
-       proto_tree_add_item(rr_tree, hf_dns_rr_addr, tvb, cur_offset, 4, ENC_BIG_ENDIAN);
+      proto_item_append_text(trr, ", addr %s", addr);
+      proto_tree_add_item(rr_tree, hf_dns_rr_addr, tvb, cur_offset, 4, ENC_BIG_ENDIAN);
 
       if ((dns_class & 0x7f) == C_IN) {
-       tvb_memcpy(tvb, &addr_int, cur_offset, sizeof(addr_int));
+        tvb_memcpy(tvb, &addr_int, cur_offset, sizeof(addr_int));
        add_ipv4_name(addr_int, name);
       }
     }
     break;
 
-  case T_NS:
+    case T_NS:
     {
       const guchar *ns_name;
       int ns_name_len;
 
       ns_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &ns_name);
       name_out = format_text(ns_name, strlen(ns_name));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", name_out);
-
-       proto_item_append_text(trr, ", ns %s", name_out);
-       proto_tree_add_string(rr_tree, hf_dns_rr_ns, tvb, cur_offset, ns_name_len, name_out);
+      }
+      proto_item_append_text(trr, ", ns %s", name_out);
+      proto_tree_add_string(rr_tree, hf_dns_rr_ns, tvb, cur_offset, ns_name_len, name_out);
 
     }
     break;
 
-  case T_CNAME:
+    case T_CNAME:
     {
       const guchar *cname;
       int cname_len;
 
       cname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &cname);
       name_out = format_text(cname, strlen(cname));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", name_out);
-
-       proto_item_append_text(trr, ", cname %s", name_out);
-       proto_tree_add_string(rr_tree, hf_dns_rr_primaryname, tvb, cur_offset, cname_len, name_out);
+      }
+      proto_item_append_text(trr, ", cname %s", name_out);
+      proto_tree_add_string(rr_tree, hf_dns_rr_primaryname, tvb, cur_offset, cname_len, name_out);
 
     }
     break;
 
-  case T_SOA:
+    case T_SOA:
     {
       const guchar *mname;
-      int mname_len;
+      int           mname_len;
       const guchar *rname;
-      int rname_len;
-      guint32 serial;
-      guint32 refresh;
-      guint32 retry;
-      guint32 expire;
-      guint32 minimum;
+      int           rname_len;
+      guint32       serial;
+      guint32       refresh;
+      guint32       retry;
+      guint32       expire;
+      guint32       minimum;
 
       /* XXX Fix data length */
       mname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &mname);
       name_out = format_text(mname, strlen(mname));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", name_out);
+      }
+      proto_item_append_text(trr, ", mname %s", name_out);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, mname_len, "Primary name server: %s",
+                          name_out);
+      cur_offset += mname_len;
 
-       proto_item_append_text(trr, ", mname %s", name_out);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, mname_len, "Primary name server: %s",
-                      name_out);
-       cur_offset += mname_len;
-
-        /* XXX Fix data length */
-       rname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &rname);
-        name_out = format_text(rname, strlen(rname));
-       proto_tree_add_text(rr_tree, tvb, cur_offset, rname_len, "Responsible authority's mailbox: %s",
-                      name_out);
-       cur_offset += rname_len;
-
-       serial = tvb_get_ntohl(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Serial number: %u",
-                      serial);
-       cur_offset += 4;
+      /* XXX Fix data length */
+      rname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &rname);
+      name_out = format_text(rname, strlen(rname));
+      proto_tree_add_text(rr_tree, tvb, cur_offset, rname_len, "Responsible authority's mailbox: %s",
+                          name_out);
+      cur_offset += rname_len;
+
+      serial = tvb_get_ntohl(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Serial number: %u",
+                          serial);
+      cur_offset += 4;
 
-       refresh = tvb_get_ntohl(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Refresh interval: %s",
-                      time_secs_to_str(refresh));
-       cur_offset += 4;
+      refresh = tvb_get_ntohl(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Refresh interval: %s",
+                          time_secs_to_str(refresh));
+      cur_offset += 4;
 
-       retry = tvb_get_ntohl(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Retry interval: %s",
-                      time_secs_to_str(retry));
-       cur_offset += 4;
+      retry = tvb_get_ntohl(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Retry interval: %s",
+                          time_secs_to_str(retry));
+      cur_offset += 4;
 
-       expire = tvb_get_ntohl(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Expiration limit: %s",
-                      time_secs_to_str(expire));
-       cur_offset += 4;
+      expire = tvb_get_ntohl(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Expiration limit: %s",
+                          time_secs_to_str(expire));
+      cur_offset += 4;
 
-       minimum = tvb_get_ntohl(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Minimum TTL: %s",
-                      time_secs_to_str(minimum));
+      minimum = tvb_get_ntohl(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Minimum TTL: %s",
+                          time_secs_to_str(minimum));
 
     }
     break;
 
-  case T_PTR:
+    case T_PTR:
     {
       const guchar *pname;
-      int pname_len;
+      int           pname_len;
 
       /* XXX Fix data length */
       pname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &pname);
       name_out = format_text(pname, strlen(pname));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", name_out);
-
-       proto_item_append_text(trr, ", %s", name_out);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, pname_len, "Domain name: %s",
-                       name_out);
+      }
+      proto_item_append_text(trr, ", %s", name_out);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, pname_len, "Domain name: %s",
+                          name_out);
 
     }
     break;
 
-  case T_WKS:
+    case T_WKS:
     {
-      int rr_len = data_len;
-      const char *wks_addr;
-      guint8 protocol;
-      guint8 bits;
-      int mask;
-      int port_num;
-      int i;
+      int            rr_len   = data_len;
+      const char    *wks_addr;
+      guint8         protocol;
+      guint8         bits;
+      int            mask;
+      int            port_num;
+      int            i;
       emem_strbuf_t *bitnames = ep_strbuf_new_label(NULL);
 
-      if (rr_len < 4)
-         goto bad_rr;
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
       wks_addr = tvb_ip_to_str(tvb, cur_offset);
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", wks_addr);
+      }
+      proto_item_append_text(trr, ", addr %s", wks_addr);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Addr: %s", wks_addr);
+      cur_offset += 4;
+      rr_len     -= 4;
 
-       proto_item_append_text(trr, ", addr %s", wks_addr);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Addr: %s", wks_addr);
-       cur_offset += 4;
-       rr_len -= 4;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       protocol = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Protocol: %s",
-                    ipprotostr(protocol));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       port_num = 0;
-       while (rr_len != 0) {
-         bits = tvb_get_guint8(tvb, cur_offset);
-         if (bits != 0) {
-           mask = 1<<7;
-            ep_strbuf_truncate(bitnames, 0);
-           for (i = 0; i < 8; i++) {
-             if (bits & mask) {
-               if (bitnames->len > 0) {
-                 ep_strbuf_append(bitnames, ", ");
-               }
-               switch (protocol) {
-
-               case IP_PROTO_TCP:
-                 ep_strbuf_append(bitnames, get_tcp_port(port_num));
-                 break;
-
-               case IP_PROTO_UDP:
-                 ep_strbuf_append(bitnames, get_udp_port(port_num));
-                 break;
-
-               default:
-                 ep_strbuf_append_printf(bitnames, "%u", port_num);
-                 break;
-               }
-             }
-             mask >>= 1;
-             port_num++;
-           }
-           proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
-               "Bits: 0x%02x (%s)", bits, bitnames->str);
-         } else
-           port_num += 8;
-         cur_offset += 1;
-         rr_len -= 1;
-       }
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      protocol = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Protocol: %s",
+                          ipprotostr(protocol));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      port_num = 0;
+      while (rr_len != 0) {
+        bits = tvb_get_guint8(tvb, cur_offset);
+        if (bits != 0) {
+          mask = 1<<7;
+          ep_strbuf_truncate(bitnames, 0);
+          for (i = 0; i < 8; i++) {
+            if (bits & mask) {
+              if (bitnames->len > 0) {
+                ep_strbuf_append(bitnames, ", ");
+              }
+              switch (protocol) {
+
+                case IP_PROTO_TCP:
+                  ep_strbuf_append(bitnames, get_tcp_port(port_num));
+                  break;
+
+                case IP_PROTO_UDP:
+                  ep_strbuf_append(bitnames, get_udp_port(port_num));
+                  break;
+
+                default:
+                  ep_strbuf_append_printf(bitnames, "%u", port_num);
+                  break;
+              }
+            }
+            mask >>= 1;
+            port_num++;
+          }
+          proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
+                              "Bits: 0x%02x (%s)", bits, bitnames->str);
+        } else {
+          port_num += 8;
+        }
+        cur_offset += 1;
+        rr_len     -= 1;
+      }
 
     }
     break;
 
-  case T_HINFO:
+    case T_HINFO:
     {
-      int cpu_offset;
-      int cpu_len;
+      int         cpu_offset;
+      int         cpu_len;
       const char *cpu;
-      int os_offset;
-      int os_len;
+      int         os_offset;
+      int         os_len;
       const char *os;
 
       cpu_offset = cur_offset;
@@ -1498,353 +1519,368 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
       os_offset = cpu_offset + 1 + cpu_len;
       os_len = tvb_get_guint8(tvb, os_offset);
       os = tvb_get_ephemeral_string(tvb, os_offset + 1, os_len);
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %.*s %.*s", cpu_len, cpu,
-           os_len, os);
-
-       proto_item_append_text(trr, ", CPU %.*s, OS %.*s",
-                    cpu_len, cpu, os_len, os);
-       proto_tree_add_text(rr_tree, tvb, cpu_offset, 1 + cpu_len, "CPU: %.*s",
-                       cpu_len, cpu);
-       proto_tree_add_text(rr_tree, tvb, os_offset, 1 + os_len, "OS: %.*s",
-                       os_len, os);
+                        os_len, os);
+      }
+      proto_item_append_text(trr, ", CPU %.*s, OS %.*s",
+                             cpu_len, cpu, os_len, os);
+      proto_tree_add_text(rr_tree, tvb, cpu_offset, 1 + cpu_len, "CPU: %.*s",
+                          cpu_len, cpu);
+      proto_tree_add_text(rr_tree, tvb, os_offset, 1 + os_len, "OS: %.*s",
+                          os_len, os);
 
     }
     break;
 
-  case T_MX:
+    case T_MX:
     {
-      guint16 preference = 0;
+      guint16       preference = 0;
       const guchar *mx_name;
-      int mx_name_len;
+      int           mx_name_len;
 
       preference = tvb_get_ntohs(tvb, cur_offset);
       /* XXX Fix data length */
       mx_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &mx_name);
       name_out = format_text(mx_name, strlen(mx_name));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %u %s", preference, name_out);
-
-       proto_item_append_text(trr, ", preference %u, mx %s",
-                      preference, name_out);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Preference: %u", preference);
-       proto_tree_add_text(rr_tree, tvb, cur_offset + 2, mx_name_len, "Mail exchange: %s",
-                       name_out);
+      }
+      proto_item_append_text(trr, ", preference %u, mx %s",
+                             preference, name_out);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Preference: %u", preference);
+      proto_tree_add_text(rr_tree, tvb, cur_offset + 2, mx_name_len, "Mail exchange: %s",
+                          name_out);
 
     }
     break;
 
-  case T_TXT:
-  case T_SPF:
+    case T_TXT:
+    case T_SPF:
     {
       int rr_len = data_len;
       int txt_offset;
       int txt_len;
 
 
-       txt_offset = cur_offset;
-       while (rr_len != 0) {
-         txt_len = tvb_get_guint8(tvb, txt_offset);
-         proto_tree_add_text(rr_tree, tvb, txt_offset, 1 + txt_len,
-          "Text: %.*s", txt_len, tvb_get_ephemeral_string(tvb, txt_offset + 1, txt_len));
-         txt_offset += 1 + txt_len;
-         rr_len -= 1 + txt_len;
-       }
+      txt_offset = cur_offset;
+      while (rr_len != 0) {
+        txt_len = tvb_get_guint8(tvb, txt_offset);
+        proto_tree_add_text(rr_tree, tvb, txt_offset, 1 + txt_len,
+                            "Text: %.*s", txt_len, tvb_get_ephemeral_string(tvb, txt_offset + 1, txt_len));
+        txt_offset += 1 + txt_len;
+        rr_len     -= 1 + txt_len;
+      }
 
     }
     break;
 
-  case T_RRSIG:
-  case T_SIG:
+    case T_RRSIG:
+    case T_SIG:
     {
-      int rr_len = data_len;
-      guint16 type_covered;
-      nstime_t nstime;
+      int           rr_len = data_len;
+      guint16       type_covered;
+      nstime_t      nstime;
       const guchar *signer_name;
-      int signer_name_len;
-
-
-       if (rr_len < 2)
-         goto bad_rr;
-       type_covered = tvb_get_ntohs(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Type covered: %s",
-               dns_type_description(type_covered));
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
-               val_to_str(tvb_get_guint8(tvb, cur_offset), algo_vals,
-                   "Unknown (0x%02X)"));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Labels: %u",
-               tvb_get_guint8(tvb, cur_offset));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       if (rr_len < 4)
-         goto bad_rr;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Original TTL: %s",
-               time_secs_to_str(tvb_get_ntohl(tvb, cur_offset)));
-       cur_offset += 4;
-       rr_len -= 4;
-
-       if (rr_len < 4)
-         goto bad_rr;
-       nstime.secs = tvb_get_ntohl(tvb, cur_offset);
-       nstime.nsecs = 0;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s",
-               abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE));
-       cur_offset += 4;
-       rr_len -= 4;
-
-       if (rr_len < 4)
-         goto bad_rr;
-       nstime.secs = tvb_get_ntohl(tvb, cur_offset);
-       nstime.nsecs = 0;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Time signed: %s",
-               abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE));
-       cur_offset += 4;
-       rr_len -= 4;
-
-       if (rr_len < 2)
-         goto bad_rr;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Id of signing key(footprint): %u",
-               tvb_get_ntohs(tvb, cur_offset));
-       cur_offset += 2;
-       rr_len -= 2;
+      int           signer_name_len;
 
-        /* XXX Fix data length */
-       signer_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &signer_name);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, signer_name_len,
-               "Signer's name: %s",
-               format_text(signer_name, strlen(signer_name)));
-       cur_offset += signer_name_len;
-       rr_len -= signer_name_len;
 
-       if (rr_len != 0)
-         proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Signature");
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      type_covered = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Type covered: %s",
+                          dns_type_description(type_covered));
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
+                          val_to_str(tvb_get_guint8(tvb, cur_offset), algo_vals,
+                                     "Unknown (0x%02X)"));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Labels: %u",
+                          tvb_get_guint8(tvb, cur_offset));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Original TTL: %s",
+                          time_secs_to_str(tvb_get_ntohl(tvb, cur_offset)));
+      cur_offset += 4;
+      rr_len     -= 4;
+
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
+      nstime.secs = tvb_get_ntohl(tvb, cur_offset);
+      nstime.nsecs = 0;
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s",
+                          abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE));
+      cur_offset += 4;
+      rr_len     -= 4;
 
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
+      nstime.secs = tvb_get_ntohl(tvb, cur_offset);
+      nstime.nsecs = 0;
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Time signed: %s",
+                          abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE));
+      cur_offset += 4;
+      rr_len     -= 4;
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Id of signing key(footprint): %u",
+                          tvb_get_ntohs(tvb, cur_offset));
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      /* XXX Fix data length */
+      signer_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &signer_name);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, signer_name_len,
+                          "Signer's name: %s",
+                          format_text(signer_name, strlen(signer_name)));
+      cur_offset += signer_name_len;
+      rr_len     -= signer_name_len;
+
+      if (rr_len != 0) {
+        proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Signature");
+      }
     }
     break;
 
-  case T_DNSKEY:
+    case T_DNSKEY:
     {
-      int rr_len = data_len;
-      guint16 flags;
+      int         rr_len = data_len;
+      guint16     flags;
       proto_item *tf, *ti_gen;
       proto_tree *flags_tree;
-      guint8 algo;
-      guint16 key_id;
-
-
-       if (rr_len < 2)
-         goto bad_rr;
-        flags = tvb_get_ntohs(tvb, cur_offset);
-       tf = proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Flags: 0x%04X", flags);
-       flags_tree = proto_item_add_subtree(tf, ett_t_key_flags);
-       proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x0100,
-                 2*8, "This is the zone key for the specified zone",
-                      "This is not a zone key"));
-       proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x0080,
-                 2*8, "Key is revoked",
-                      "Key is not revoked"));
-       proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x0001,
-                 2*8, "Key is a Key Signing Key",
-                      "Key is a Zone Signing Key"));
-
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Protocol: %u",
-               tvb_get_guint8(tvb, cur_offset));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       algo = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
-               val_to_str(algo, algo_vals, "Unknown (0x%02X)"));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       key_id = compute_key_id(tvb, cur_offset-4, rr_len+4, algo);
-       ti_gen = proto_tree_add_text(rr_tree, tvb, 0, 0, "Key id: %u", key_id);
-       PROTO_ITEM_SET_GENERATED(ti_gen);
-
-       if (rr_len != 0)
-         proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Public key");
+      guint8      algo;
+      guint16     key_id;
 
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      flags = tvb_get_ntohs(tvb, cur_offset);
+      tf = proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Flags: 0x%04X", flags);
+      flags_tree = proto_item_add_subtree(tf, ett_t_key_flags);
+      proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                          decode_boolean_bitfield(flags, 0x0100,
+                                                  2*8, "This is the zone key for the specified zone",
+                                                  "This is not a zone key"));
+      proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                          decode_boolean_bitfield(flags, 0x0080,
+                                                  2*8, "Key is revoked",
+                                                  "Key is not revoked"));
+      proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                          decode_boolean_bitfield(flags, 0x0001,
+                                                  2*8, "Key is a Key Signing Key",
+                                                  "Key is a Zone Signing Key"));
+
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Protocol: %u",
+                          tvb_get_guint8(tvb, cur_offset));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      algo = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
+                          val_to_str(algo, algo_vals, "Unknown (0x%02X)"));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      key_id = compute_key_id(tvb, cur_offset-4, rr_len+4, algo);
+      ti_gen = proto_tree_add_text(rr_tree, tvb, 0, 0, "Key id: %u", key_id);
+      PROTO_ITEM_SET_GENERATED(ti_gen);
+
+      if (rr_len != 0) {
+        proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Public key");
+      }
     }
     break;
 
-  case T_KEY:
+    case T_KEY:
     {
-      int rr_len = data_len;
-      guint16 flags;
+      int         rr_len = data_len;
+      guint16     flags;
       proto_item *tf, *ti_gen;
       proto_tree *flags_tree;
-      guint8 algo;
-      guint16 key_id;
-
-
-       if (rr_len < 2)
-         goto bad_rr;
-        flags = tvb_get_ntohs(tvb, cur_offset);
-       tf = proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Flags: 0x%04X", flags);
-       flags_tree = proto_item_add_subtree(tf, ett_t_key_flags);
-       proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x8000,
-                 2*8, "Key prohibited for authentication",
-                      "Key allowed for authentication"));
-       proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x4000,
-                 2*8, "Key prohibited for confidentiality",
-                      "Key allowed for confidentiality"));
-       if ((flags & 0xC000) != 0xC000) {
-         /* We have a key */
-         proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x2000,
-                 2*8, "Key is experimental or optional",
-                      "Key is required"));
-         proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x0400,
-                 2*8, "Key is associated with a user",
-                      "Key is not associated with a user"));
-         proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x0200,
-                 2*8, "Key is associated with the named entity",
-                      "Key is not associated with the named entity"));
-         proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x0080,
-                 2*8, "Key is valid for use with IPSEC",
-                      "Key is not valid for use with IPSEC"));
-         proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_boolean_bitfield(flags, 0x0040,
-                 2*8, "Key is valid for use with MIME security multiparts",
-                      "Key is not valid for use with MIME security multiparts"));
-         proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
-               decode_numeric_bitfield(flags, 0x000F,
-                 2*8, "Signatory = %u"));
-       }
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Protocol: %u",
-               tvb_get_guint8(tvb, cur_offset));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       algo = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
-               val_to_str(algo, algo_vals, "Unknown (0x%02X)"));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       key_id = compute_key_id(tvb, cur_offset-4, rr_len+4, algo);
-       ti_gen = proto_tree_add_text(rr_tree, tvb, 0, 0, "Key id: %u", key_id);
-       PROTO_ITEM_SET_GENERATED(ti_gen);
-
-       if (rr_len != 0)
-         proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Public key");
+      guint8      algo;
+      guint16     key_id;
+
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      flags = tvb_get_ntohs(tvb, cur_offset);
+      tf = proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Flags: 0x%04X", flags);
+      flags_tree = proto_item_add_subtree(tf, ett_t_key_flags);
+      proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                          decode_boolean_bitfield(flags, 0x8000,
+                                                  2*8, "Key prohibited for authentication",
+                                                  "Key allowed for authentication"));
+      proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                          decode_boolean_bitfield(flags, 0x4000,
+                                                  2*8, "Key prohibited for confidentiality",
+                                                  "Key allowed for confidentiality"));
+      if ((flags & 0xC000) != 0xC000) {
+        /* We have a key */
+        proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                            decode_boolean_bitfield(flags, 0x2000,
+                                                    2*8, "Key is experimental or optional",
+                                                    "Key is required"));
+        proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                            decode_boolean_bitfield(flags, 0x0400,
+                                                    2*8, "Key is associated with a user",
+                                                    "Key is not associated with a user"));
+        proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                            decode_boolean_bitfield(flags, 0x0200,
+                                                    2*8, "Key is associated with the named entity",
+                                                    "Key is not associated with the named entity"));
+        proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                            decode_boolean_bitfield(flags, 0x0080,
+                                                    2*8, "Key is valid for use with IPSEC",
+                                                    "Key is not valid for use with IPSEC"));
+        proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                            decode_boolean_bitfield(flags, 0x0040,
+                                                    2*8, "Key is valid for use with MIME security multiparts",
+                                                    "Key is not valid for use with MIME security multiparts"));
+        proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s",
+                            decode_numeric_bitfield(flags, 0x000F,
+                                                    2*8, "Signatory = %u"));
+      }
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Protocol: %u",
+                          tvb_get_guint8(tvb, cur_offset));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      algo = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
+                          val_to_str(algo, algo_vals, "Unknown (0x%02X)"));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      key_id = compute_key_id(tvb, cur_offset-4, rr_len+4, algo);
+      ti_gen = proto_tree_add_text(rr_tree, tvb, 0, 0, "Key id: %u", key_id);
+      PROTO_ITEM_SET_GENERATED(ti_gen);
+
+      if (rr_len != 0) {
+        proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Public key");
+      }
 
     }
     break;
-  case T_IPSECKEY:
+    case T_IPSECKEY:
     {
-      int rr_len = data_len;
-      guint8 gw_type, algo;
+      int           rr_len = data_len;
+      guint8        gw_type, algo;
       const guchar *gw;
-      int gw_name_len;
+      int           gw_name_len;
+
       static const value_string gw_algo[] = {
-         { 1,     "DSA" },
-         { 2,     "RSA" },
-         { 0,      NULL }
+        { 1,     "DSA" },
+        { 2,     "RSA" },
+        { 0,      NULL }
       };
 
 
 
-       if(rr_len < 3)
-         goto bad_rr;
-
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Gateway precedence: %u",
-               tvb_get_guint8(tvb, cur_offset));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       gw_type = tvb_get_guint8(tvb, cur_offset);
-       cur_offset += 1;
-       rr_len -= 1;
-
-       algo = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
-               val_to_str(algo, gw_algo, "Unknown (0x%02X)"));
-       cur_offset += 1;
-       rr_len -= 1;
-       switch( gw_type ) {
-          case 0:
-            proto_tree_add_text(rr_tree, tvb, cur_offset, 0, "Gateway: no gateway");
-            break;
-          case 1:
-            proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Gateway: %s",
-                                tvb_ip_to_str(tvb, cur_offset) );
-
-            cur_offset += 4;
-            rr_len -= 4;
-            break;
-          case 2:
-            proto_tree_add_text(rr_tree, tvb, cur_offset, 16, "Gateway: %s",
-                                tvb_ip6_to_str(tvb, cur_offset));
-
-            cur_offset += 16;
-            rr_len -= 16;
-            break;
-          case 3:
-             /* XXX Fix data length */
-            gw_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &gw);
-            proto_tree_add_text(rr_tree, tvb, cur_offset, gw_name_len,
-                                "Gateway: %s", format_text(gw, strlen(gw)));
-
-            cur_offset += gw_name_len;
-            rr_len -= gw_name_len;
-            break;
-          default:
-            proto_tree_add_text(rr_tree, tvb, cur_offset, 0, "Gateway: Unknown gateway type(%u)", gw_type);
-            break;
-       }
-       if (rr_len != 0)
-         proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Public key");
+      if (rr_len < 3) {
+        goto bad_rr;
+      }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Gateway precedence: %u",
+                          tvb_get_guint8(tvb, cur_offset));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      gw_type = tvb_get_guint8(tvb, cur_offset);
+      cur_offset += 1;
+      rr_len     -= 1;
 
+      algo = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
+                          val_to_str(algo, gw_algo, "Unknown (0x%02X)"));
+      cur_offset += 1;
+      rr_len     -= 1;
+      switch( gw_type ) {
+        case 0:
+          proto_tree_add_text(rr_tree, tvb, cur_offset, 0, "Gateway: no gateway");
+          break;
+        case 1:
+          proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Gateway: %s",
+                              tvb_ip_to_str(tvb, cur_offset) );
+
+          cur_offset += 4;
+          rr_len     -= 4;
+          break;
+        case 2:
+          proto_tree_add_text(rr_tree, tvb, cur_offset, 16, "Gateway: %s",
+                              tvb_ip6_to_str(tvb, cur_offset));
+
+          cur_offset += 16;
+          rr_len     -= 16;
+          break;
+        case 3:
+          /* XXX Fix data length */
+          gw_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &gw);
+          proto_tree_add_text(rr_tree, tvb, cur_offset, gw_name_len,
+                              "Gateway: %s", format_text(gw, strlen(gw)));
+
+          cur_offset += gw_name_len;
+          rr_len     -= gw_name_len;
+          break;
+        default:
+          proto_tree_add_text(rr_tree, tvb, cur_offset, 0, "Gateway: Unknown gateway type(%u)", gw_type);
+          break;
+      }
+      if (rr_len != 0) {
+        proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Public key");
+      }
     }
     break;
 
-  case T_AAAA:
+    case T_AAAA:
     {
-      const char *addr6;
-      struct e_in6_addr addr_in6;
+      const char        *addr6;
+      struct e_in6_addr  addr_in6;
 
       addr6 = tvb_ip6_to_str(tvb, cur_offset);
       if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", addr6);
       }
 
-       proto_item_append_text(trr, ", addr %s", addr6);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 16, "Addr: %s", addr6);
+      proto_item_append_text(trr, ", addr %s", addr6);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 16, "Addr: %s", addr6);
 
       if ((dns_class & 0x7f) == C_IN) {
        tvb_memcpy(tvb, &addr_in6, cur_offset, sizeof(addr_in6));
@@ -1853,16 +1889,16 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
     }
     break;
 
-  case T_A6:
+    case T_A6:
     {
-      unsigned short pre_len;
-      unsigned short suf_len;
-      unsigned short suf_octet_count;
-      const guchar *pname;
-      int pname_len;
-      int a6_offset;
-      int suf_offset;
-      struct e_in6_addr suffix;
+      unsigned short     pre_len;
+      unsigned short     suf_len;
+      unsigned short     suf_octet_count;
+      const guchar      *pname;
+      int                pname_len;
+      int                a6_offset;
+      int                suf_offset;
+      struct e_in6_addr  suffix;
 
       a6_offset = cur_offset;
       pre_len = tvb_get_guint8(tvb, cur_offset);
@@ -1895,271 +1931,275 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
                         name_out);
       }
 
-        proto_tree_add_text(rr_tree, tvb, a6_offset, 1,
-                            "Prefix len: %u", pre_len);
-        a6_offset++;
-        if (suf_len) {
-          proto_tree_add_text(rr_tree, tvb, a6_offset, suf_octet_count,
-                              "Address suffix: %s",
-                              ip6_to_str(&suffix));
-          a6_offset += suf_octet_count;
-        }
-        if (pre_len > 0) {
-          proto_tree_add_text(rr_tree, tvb, a6_offset, pname_len,
-                              "Prefix name: %s", name_out);
-        }
-        proto_item_append_text(trr, ", addr %d %s %s",
-                            pre_len,
-                            ip6_to_str(&suffix),
-                            name_out);
+      proto_tree_add_text(rr_tree, tvb, a6_offset, 1,
+                          "Prefix len: %u", pre_len);
+      a6_offset++;
+      if (suf_len) {
+        proto_tree_add_text(rr_tree, tvb, a6_offset, suf_octet_count,
+                            "Address suffix: %s",
+                            ip6_to_str(&suffix));
+        a6_offset += suf_octet_count;
+      }
+      if (pre_len > 0) {
+        proto_tree_add_text(rr_tree, tvb, a6_offset, pname_len,
+                            "Prefix name: %s", name_out);
+      }
+      proto_item_append_text(trr, ", addr %d %s %s",
+                             pre_len,
+                             ip6_to_str(&suffix),
+                             name_out);
 
     }
     break;
 
-  case T_DNAME:
+    case T_DNAME:
     {
       const guchar *dname;
-      int dname_len;
+      int           dname_len;
 
       /* XXX Fix data length */
       dname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset,
-                              &dname);
+                               &dname);
       name_out = format_text(dname, strlen(dname));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", name_out);
-
-       proto_item_append_text(trr, ", dname %s", name_out);
-       proto_tree_add_text(rr_tree, tvb, cur_offset,
-                           dname_len, "Target name: %s", name_out);
+      }
+      proto_item_append_text(trr, ", dname %s", name_out);
+      proto_tree_add_text(rr_tree, tvb, cur_offset,
+                          dname_len, "Target name: %s", name_out);
 
     }
     break;
 
-  case T_LOC:
+    case T_LOC:
     {
       guint8 version;
 
 
-       version = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Version: %u", version);
-       if (version == 0) {
-         /* Version 0, the only version RFC 1876 discusses. */
-         cur_offset++;
-
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Size: %g m",
-                               rfc1867_size(tvb, cur_offset));
-         cur_offset++;
+      version = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Version: %u", version);
+      if (version == 0) {
+        /* Version 0, the only version RFC 1876 discusses. */
+        cur_offset++;
 
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Horizontal precision: %g m",
-                               rfc1867_size(tvb, cur_offset));
-         cur_offset++;
+        proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Size: %g m",
+                            rfc1867_size(tvb, cur_offset));
+        cur_offset++;
 
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Vertical precision: %g m",
-                               rfc1867_size(tvb, cur_offset));
-         cur_offset++;
+        proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Horizontal precision: %g m",
+                            rfc1867_size(tvb, cur_offset));
+        cur_offset++;
 
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Latitude: %s",
-                               rfc1867_angle(tvb, cur_offset, "NS"));
-         cur_offset += 4;
+        proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Vertical precision: %g m",
+                            rfc1867_size(tvb, cur_offset));
+        cur_offset++;
 
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Longitude: %s",
-                               rfc1867_angle(tvb, cur_offset, "EW"));
-         cur_offset += 4;
+        proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Latitude: %s",
+                            rfc1867_angle(tvb, cur_offset, "NS"));
+        cur_offset += 4;
 
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Altitude: %g m",
-                               ((gint32)tvb_get_ntohl(tvb, cur_offset) - 10000000)/100.0);
-       } else
-         proto_tree_add_text(rr_tree, tvb, cur_offset, data_len, "Data");
+        proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Longitude: %s",
+                            rfc1867_angle(tvb, cur_offset, "EW"));
+        cur_offset += 4;
 
+        proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Altitude: %g m",
+                            ((gint32)tvb_get_ntohl(tvb, cur_offset) - 10000000)/100.0);
+      } else {
+        proto_tree_add_text(rr_tree, tvb, cur_offset, data_len, "Data");
+      }
     }
     break;
 
-  case T_NSEC:
+    case T_NSEC:
     {
-      int rr_len = data_len;
+      int           rr_len = data_len;
       const guchar *next_domain_name;
-      int next_domain_name_len;
+      int           next_domain_name_len;
 
       /* XXX Fix data length */
       next_domain_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset,
-                       &next_domain_name);
+                                          &next_domain_name);
       name_out = format_text(next_domain_name, strlen(next_domain_name));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", name_out);
-
-       proto_item_append_text(trr, ", next domain name %s", name_out);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, next_domain_name_len,
-                       "Next domain name: %s", name_out);
-       cur_offset += next_domain_name_len;
-       rr_len -= next_domain_name_len;
-        dissect_type_bitmap(rr_tree, tvb, cur_offset, rr_len);
+      }
+      proto_item_append_text(trr, ", next domain name %s", name_out);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, next_domain_name_len,
+                          "Next domain name: %s", name_out);
+      cur_offset += next_domain_name_len;
+      rr_len     -= next_domain_name_len;
+      dissect_type_bitmap(rr_tree, tvb, cur_offset, rr_len);
 
     }
     break;
 
-  case T_NSEC3:
+    case T_NSEC3:
     {
-      int rr_len, initial_offset = cur_offset;
-      guint8 salt_len, hash_len;
+      int         rr_len, initial_offset = cur_offset;
+      guint8      salt_len, hash_len;
       proto_item *flags_item;
       proto_tree *flags_tree;
 
 
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_algo, tvb, cur_offset++, 1, ENC_BIG_ENDIAN);
-        flags_item = proto_tree_add_item(rr_tree, hf_dns_nsec3_flags, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
-        flags_tree = proto_item_add_subtree(flags_item, ett_nsec3_flags);
-        proto_tree_add_item(flags_tree, hf_dns_nsec3_flag_optout, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
-        cur_offset++;
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_iterations, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
-        cur_offset += 2;
-        salt_len = tvb_get_guint8(tvb, cur_offset);
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_salt_length, tvb, cur_offset++, 1, ENC_BIG_ENDIAN);
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_salt_value, tvb, cur_offset, salt_len, ENC_NA);
-        cur_offset += salt_len;
-        hash_len = tvb_get_guint8(tvb, cur_offset);
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_hash_length, tvb, cur_offset++, 1, ENC_BIG_ENDIAN);
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_hash_value, tvb, cur_offset, hash_len, ENC_NA);
-        cur_offset += hash_len;
-        rr_len = data_len - (cur_offset - initial_offset);
-        dissect_type_bitmap(rr_tree, tvb, cur_offset, rr_len);
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_algo, tvb, cur_offset++, 1, ENC_BIG_ENDIAN);
+      flags_item = proto_tree_add_item(rr_tree, hf_dns_nsec3_flags, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
+      flags_tree = proto_item_add_subtree(flags_item, ett_nsec3_flags);
+      proto_tree_add_item(flags_tree, hf_dns_nsec3_flag_optout, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
+      cur_offset++;
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_iterations, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
+      cur_offset += 2;
+      salt_len = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_salt_length, tvb, cur_offset++, 1, ENC_BIG_ENDIAN);
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_salt_value, tvb, cur_offset, salt_len, ENC_NA);
+      cur_offset += salt_len;
+      hash_len = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_hash_length, tvb, cur_offset++, 1, ENC_BIG_ENDIAN);
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_hash_value, tvb, cur_offset, hash_len, ENC_NA);
+      cur_offset += hash_len;
+      rr_len = data_len - (cur_offset - initial_offset);
+      dissect_type_bitmap(rr_tree, tvb, cur_offset, rr_len);
 
     }
     break;
 
-  case T_NSEC3PARAM:
+    case T_NSEC3PARAM:
     {
-    int salt_len;
-      if (cinfo != NULL)
+      int salt_len;
+      if (cinfo != NULL) {
         col_append_fstr(cinfo, COL_INFO, " %s", name);
+      }
 
-
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_algo, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
-        cur_offset ++;
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_flags, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
-        cur_offset ++;
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_iterations, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
-        cur_offset += 2;
-        salt_len = tvb_get_guint8(tvb, cur_offset);
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_salt_length, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
-        cur_offset ++;
-        proto_tree_add_item(rr_tree, hf_dns_nsec3_salt_value, tvb, cur_offset, salt_len, ENC_NA);
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_algo, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
+      cur_offset ++;
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_flags, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
+      cur_offset ++;
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_iterations, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
+      cur_offset += 2;
+      salt_len = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_salt_length, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
+      cur_offset ++;
+      proto_tree_add_item(rr_tree, hf_dns_nsec3_salt_value, tvb, cur_offset, salt_len, ENC_NA);
 
     }
     break;
 
-  case T_NXT:
+    case T_NXT:
     {
-      int rr_len = data_len;
+      int           rr_len = data_len;
       const guchar *next_domain_name;
-      int next_domain_name_len;
-      int rr_type;
-      guint8 bits;
-      int mask;
-      int i;
+      int           next_domain_name_len;
+      int           rr_type;
+      guint8        bits;
+      int           mask;
+      int           i;
 
       /* XXX Fix data length */
       next_domain_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset,
-                       &next_domain_name);
+                                          &next_domain_name);
       name_out = format_text(next_domain_name, strlen(next_domain_name));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", name_out);
-
-       proto_item_append_text(trr, ", next domain name %s", name_out);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, next_domain_name_len,
-                       "Next domain name: %s", name_out);
-       cur_offset += next_domain_name_len;
-       rr_len -= next_domain_name_len;
-       rr_type = 0;
-       while (rr_len != 0) {
-         bits = tvb_get_guint8(tvb, cur_offset);
-         mask = 1<<7;
-         for (i = 0; i < 8; i++) {
-           if (bits & mask) {
-             proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
-                       "RR type in bit map: %s",
-                       dns_type_description(rr_type));
-           }
-           mask >>= 1;
-           rr_type++;
-         }
-         cur_offset += 1;
-         rr_len -= 1;
-       }
+      }
+      proto_item_append_text(trr, ", next domain name %s", name_out);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, next_domain_name_len,
+                          "Next domain name: %s", name_out);
+      cur_offset += next_domain_name_len;
+      rr_len     -= next_domain_name_len;
+      rr_type = 0;
+      while (rr_len != 0) {
+        bits = tvb_get_guint8(tvb, cur_offset);
+        mask = 1<<7;
+        for (i = 0; i < 8; i++) {
+          if (bits & mask) {
+            proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
+                                "RR type in bit map: %s",
+                                dns_type_description(rr_type));
+          }
+          mask >>= 1;
+          rr_type++;
+        }
+        cur_offset += 1;
+        rr_len     -= 1;
+      }
 
     }
     break;
 
-  case T_KX:
+    case T_KX:
     {
-      guint16 preference = 0;
+      guint16       preference = 0;
       const guchar *kx_name;
-      int kx_name_len;
+      int           kx_name_len;
 
       /* XXX Fix data length */
       kx_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &kx_name);
       name_out = format_text(kx_name, strlen(kx_name));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %u %s", preference, name_out);
-
-       proto_item_append_text(trr, ", preference %u, kx %s",
-                      preference, name_out);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Preference: %u", preference);
-       proto_tree_add_text(rr_tree, tvb, cur_offset + 2, kx_name_len, "Key exchange: %s",
-                       name_out);
+      }
+      proto_item_append_text(trr, ", preference %u, kx %s",
+                             preference, name_out);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Preference: %u", preference);
+      proto_tree_add_text(rr_tree, tvb, cur_offset + 2, kx_name_len, "Key exchange: %s",
+                          name_out);
 
     }
     break;
 
-  case T_CERT:
+    case T_CERT:
     {
       guint16 cert_type, cert_keytag;
-      guint8 cert_keyalg;
-      int rr_len = data_len;
+      guint8  cert_keyalg;
+      int     rr_len = data_len;
+
 
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      cert_type = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Type: %s",
+                          val_to_str(cert_type, cert_vals,
+                                     "Unknown (0x%02X)"));
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      cert_keytag = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Key tag: 0x%04x",
+                          cert_keytag);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      cert_keyalg = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
+                          val_to_str(cert_keyalg, algo_vals,
+                                     "Unknown (0x%02X)"));
+      cur_offset += 1;
+      rr_len     -= 1;
 
-       if (rr_len < 2)
-         goto bad_rr;
-       cert_type = tvb_get_ntohs(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Type: %s",
-               val_to_str(cert_type, cert_vals,
-                   "Unknown (0x%02X)"));
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 2)
-         goto bad_rr;
-       cert_keytag = tvb_get_ntohs(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Key tag: 0x%04x",
-               cert_keytag);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       cert_keyalg = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
-               val_to_str(cert_keyalg, algo_vals,
-                   "Unknown (0x%02X)"));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       if (rr_len != 0)
-         proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Certificate or CRL");
+      if (rr_len != 0) {
+        proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Certificate or CRL");
       }
+    }
 
     break;
 
-  case T_OPT:
+    case T_OPT:
 
       proto_tree_add_text(rr_tree, tvb, cur_offset, data_len, "Data");
-    break;
+      break;
 
-  case T_DS:
-  case T_DLV:
+    case T_DS:
+    case T_DLV:
     {
       guint16 keytag, digest_data_size;
       guint8  ds_algorithm, ds_digest;
-      int rr_len = data_len;
+      int     rr_len = data_len;
 
       static const value_string tds_digests[] = {
        { TDSDIGEST_RESERVED, "Reserved digest" },
@@ -2171,406 +2211,437 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
       };
 
 
-       if (rr_len < 2)
-         goto bad_rr;
-       keytag = tvb_get_ntohs(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Key id: %04u", keytag);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       ds_algorithm = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s", val_to_str(ds_algorithm, algo_vals,"Unknown (0x%02X)") );
-       cur_offset += 1;
-       rr_len -= 1;
-
-       if (rr_len < 1)
-         goto bad_rr;
-       ds_digest = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Digest type: %s", val_to_str(ds_digest, tds_digests, "Unknown (0x%02X)"));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       if (ds_digest == TDSDIGEST_SHA1) {
-         digest_data_size = 20; /* SHA1 key is always 20 bytes long */
-         if (rr_len < digest_data_size)
-           goto bad_rr;
-         proto_tree_add_text(rr_tree, tvb, cur_offset, digest_data_size, "Public key");
-       }
-
-       if (ds_digest == TDSDIGEST_SHA256) {
-         digest_data_size = 32; /* SHA256 key is always 32 bytes long */
-         if (rr_len < digest_data_size)
-           goto bad_rr;
-         proto_tree_add_text(rr_tree, tvb, cur_offset, digest_data_size, "Public key");
-       }
-
-       if (ds_digest == TDSDIGEST_GOST) {
-         digest_data_size = 64; /* GOST key is always 64 bytes long */
-         if (rr_len < digest_data_size)
-           goto bad_rr;
-         proto_tree_add_text(rr_tree, tvb, cur_offset, digest_data_size, "Public key");
-       }
-
-       if (ds_digest == TDSDIGEST_SHA384) {
-         digest_data_size = 48; /* SHA384 key is always 48 bytes long */
-         if (rr_len < digest_data_size)
-           goto bad_rr;
-         proto_tree_add_text(rr_tree, tvb, cur_offset, digest_data_size, "Public key");
-       }
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      keytag = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Key id: %04u", keytag);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      ds_algorithm = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
+                          "Algorithm: %s", val_to_str(ds_algorithm, algo_vals,"Unknown (0x%02X)") );
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      ds_digest = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
+                          "Digest type: %s", val_to_str(ds_digest, tds_digests, "Unknown (0x%02X)"));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      if (ds_digest == TDSDIGEST_SHA1) {
+        digest_data_size = 20; /* SHA1 key is always 20 bytes long */
+        if (rr_len < digest_data_size) {
+          goto bad_rr;
+        }
+        proto_tree_add_text(rr_tree, tvb, cur_offset, digest_data_size, "Public key");
+      }
+
+      if (ds_digest == TDSDIGEST_SHA256) {
+        digest_data_size = 32; /* SHA256 key is always 32 bytes long */
+        if (rr_len < digest_data_size) {
+          goto bad_rr;
+        }
+        proto_tree_add_text(rr_tree, tvb, cur_offset, digest_data_size, "Public key");
+      }
+
+      if (ds_digest == TDSDIGEST_GOST) {
+        digest_data_size = 64; /* GOST key is always 64 bytes long */
+        if (rr_len < digest_data_size) {
+          goto bad_rr;
+        }
+        proto_tree_add_text(rr_tree, tvb, cur_offset, digest_data_size, "Public key");
+      }
+
+      if (ds_digest == TDSDIGEST_SHA384) {
+        digest_data_size = 48; /* SHA384 key is always 48 bytes long */
+        if (rr_len < digest_data_size) {
+          goto bad_rr;
+        }
+        proto_tree_add_text(rr_tree, tvb, cur_offset, digest_data_size, "Public key");
+      }
     }
     break;
 
-  case T_TKEY:
+    case T_TKEY:
     {
       const guchar *tkey_algname;
-      int tkey_algname_len;
-      guint16 tkey_mode, tkey_error, tkey_keylen, tkey_otherlen;
-      int rr_len = data_len;
-      nstime_t nstime;
+      int           tkey_algname_len;
+      guint16       tkey_mode, tkey_error, tkey_keylen, tkey_otherlen;
+      int           rr_len = data_len;
+      nstime_t      nstime;
+
       static const value_string tkey_modes[] = {
-                 { TKEYMODE_SERVERASSIGNED,   "Server assigned"   },
-                 { TKEYMODE_DIFFIEHELLMAN,    "Diffie Hellman"    },
-                 { TKEYMODE_GSSAPI,           "GSSAPI"            },
-                 { TKEYMODE_RESOLVERASSIGNED, "Resolver assigned" },
-                 { TKEYMODE_DELETE,           "Delete"            },
-                 { 0,                         NULL                } };
+        { TKEYMODE_SERVERASSIGNED,   "Server assigned"   },
+        { TKEYMODE_DIFFIEHELLMAN,    "Diffie Hellman"    },
+        { TKEYMODE_GSSAPI,           "GSSAPI"            },
+        { TKEYMODE_RESOLVERASSIGNED, "Resolver assigned" },
+        { TKEYMODE_DELETE,           "Delete"            },
+        { 0,                         NULL                } };
 
 
-       proto_tree *key_tree;
-       proto_item *key_item;
+      proto_tree *key_tree;
+      proto_item *key_item;
 
-        /* XXX Fix data length */
-       tkey_algname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &tkey_algname);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, tkey_algname_len,
-               "Algorithm name: %s",
-               format_text(tkey_algname, strlen(tkey_algname)));
-       cur_offset += tkey_algname_len;
-       rr_len -= tkey_algname_len;
-
-       if (rr_len < 4)
-         goto bad_rr;
-       nstime.secs = tvb_get_ntohl(tvb, cur_offset);
-       nstime.nsecs = 0;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature inception: %s",
-               abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE));
-       cur_offset += 4;
-       rr_len -= 4;
-
-       if (rr_len < 4)
-         goto bad_rr;
-       nstime.secs = tvb_get_ntohl(tvb, cur_offset);
-       nstime.nsecs = 0;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s",
-               abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE));
-       cur_offset += 4;
-       rr_len -= 4;
-
-       if (rr_len < 2)
-         goto bad_rr;
-       tkey_mode = tvb_get_ntohs(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Mode: %s",
-               val_to_str(tkey_mode, tkey_modes,
-                   "Unknown (0x%04X)"));
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 2)
-         goto bad_rr;
-       tkey_error = tvb_get_ntohs(tvb, cur_offset);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Error: %s",
-               val_to_str(tkey_error, rcode_vals,
-               val_to_str(tkey_error, tsigerror_vals, "Unknown error (%x)")));
-       cur_offset += 2;
-       rr_len -= 2;
-
-       tkey_keylen = tvb_get_ntohs(tvb, cur_offset);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Key Size: %u",
-            tkey_keylen);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (tkey_keylen != 0) {
-               key_item = proto_tree_add_text(
-                       rr_tree, tvb, cur_offset, tkey_keylen, "Key Data");
-
-               key_tree = proto_item_add_subtree(key_item, ett_t_key);
-
-               switch(tkey_mode) {
-               case TKEYMODE_GSSAPI: {
-                       tvbuff_t *gssapi_tvb;
-
-                       /*
-                        * XXX - in at least one capture, this appears to
-                        * be an NTLMSSP blob, with no ASN.1 in it, in
-                        * a query.
-                        *
-                        * See RFC 3645 which might indicate what's going
-                        * on here.  (The key is an output_token from
-                        * GSS_Init_sec_context.)
-                        *
-                        * How the heck do we know what method is being
-                        * used, so we know how to decode the key?  Do we
-                        * have to look at the algorithm name, e.g.
-                        * "gss.microsoft.com"?  We currently do as the
-                        * the SMB dissector does in some cases, and check
-                        * whether the security blob begins with "NTLMSSP".
-                        */
-                       gssapi_tvb = tvb_new_subset(
-                               tvb, cur_offset, tkey_keylen, tkey_keylen);
-                       if(tvb_strneql(gssapi_tvb, 0, "NTLMSSP", 7) == 0)
-                               call_dissector(ntlmssp_handle, gssapi_tvb, pinfo, key_tree);
-                       else
-                               call_dissector(gssapi_handle, gssapi_tvb, pinfo,
-                               key_tree);
-
-                       break;
-               }
-               default:
-
-                       /* No dissector for this key mode */
-
-                       break;
-               }
-
-               cur_offset += tkey_keylen;
-               rr_len -= tkey_keylen;
-       }
-
-       if (rr_len < 2)
-         goto bad_rr;
-       tkey_otherlen = tvb_get_ntohs(tvb, cur_offset);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Other Size: %u",
-            tkey_otherlen);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (tkey_otherlen != 0) {
-         if (rr_len < tkey_otherlen)
-           goto bad_rr;
-         proto_tree_add_text(rr_tree, tvb, cur_offset, tkey_otherlen, "Other Data");
-       }
+      /* XXX Fix data length */
+      tkey_algname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &tkey_algname);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, tkey_algname_len,
+                          "Algorithm name: %s",
+                          format_text(tkey_algname, strlen(tkey_algname)));
+      cur_offset += tkey_algname_len;
+      rr_len     -= tkey_algname_len;
+
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
+      nstime.secs = tvb_get_ntohl(tvb, cur_offset);
+      nstime.nsecs = 0;
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature inception: %s",
+                          abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE));
+      cur_offset += 4;
+      rr_len     -= 4;
+
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
+      nstime.secs = tvb_get_ntohl(tvb, cur_offset);
+      nstime.nsecs = 0;
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s",
+                          abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE));
+      cur_offset += 4;
+      rr_len     -= 4;
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      tkey_mode = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Mode: %s",
+                          val_to_str(tkey_mode, tkey_modes,
+                                     "Unknown (0x%04X)"));
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      tkey_error = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Error: %s",
+                          val_to_str(tkey_error, rcode_vals,
+                                     val_to_str(tkey_error, tsigerror_vals, "Unknown error (%x)")));
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      tkey_keylen = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Key Size: %u",
+                          tkey_keylen);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (tkey_keylen != 0) {
+        key_item = proto_tree_add_text(
+          rr_tree, tvb, cur_offset, tkey_keylen, "Key Data");
+
+        key_tree = proto_item_add_subtree(key_item, ett_t_key);
+
+        switch(tkey_mode) {
+          case TKEYMODE_GSSAPI: {
+            tvbuff_t *gssapi_tvb;
+
+            /*
+             * XXX - in at least one capture, this appears to
+             * be an NTLMSSP blob, with no ASN.1 in it, in
+             * a query.
+             *
+             * See RFC 3645 which might indicate what's going
+             * on here.  (The key is an output_token from
+             * GSS_Init_sec_context.)
+             *
+             * How the heck do we know what method is being
+             * used, so we know how to decode the key?  Do we
+             * have to look at the algorithm name, e.g.
+             * "gss.microsoft.com"?  We currently do as the
+             * the SMB dissector does in some cases, and check
+             * whether the security blob begins with "NTLMSSP".
+             */
+            gssapi_tvb = tvb_new_subset(
+              tvb, cur_offset, tkey_keylen, tkey_keylen);
+            if (tvb_strneql(gssapi_tvb, 0, "NTLMSSP", 7) == 0) {
+              call_dissector(ntlmssp_handle, gssapi_tvb, pinfo, key_tree);
+            } else {
+              call_dissector(gssapi_handle, gssapi_tvb, pinfo, key_tree);
+            }
+            break;
+          }
+          default:
+
+            /* No dissector for this key mode */
+
+            break;
+        }
+
+        cur_offset += tkey_keylen;
+        rr_len     -= tkey_keylen;
+      }
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      tkey_otherlen = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Other Size: %u",
+                          tkey_otherlen);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (tkey_otherlen != 0) {
+        if (rr_len < tkey_otherlen) {
+          goto bad_rr;
+          }
+        proto_tree_add_text(rr_tree, tvb, cur_offset, tkey_otherlen, "Other Data");
+      }
 
     }
     break;
 
-  case T_TSIG:
+    case T_TSIG:
     {
-      guint16 tsig_error, tsig_timehi, tsig_siglen, tsig_otherlen;
-      guint32 tsig_timelo;
+      guint16       tsig_error, tsig_timehi, tsig_siglen, tsig_otherlen;
+      guint32       tsig_timelo;
       const guchar *tsig_raw_algname;
-      char *tsig_algname;
-      int tsig_algname_len;
-      nstime_t nstime;
-      int rr_len = data_len;
+      char         *tsig_algname;
+      int           tsig_algname_len;
+      nstime_t      nstime;
+      int           rr_len = data_len;
 
-        /* XXX Fix data length */
-       tsig_algname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &tsig_raw_algname);
-       tsig_algname=format_text(tsig_raw_algname, strlen(tsig_raw_algname));
-       proto_tree_add_string(rr_tree, hf_dns_tsig_algorithm_name, tvb, cur_offset, tsig_algname_len, tsig_algname);
-       cur_offset += tsig_algname_len;
-       rr_len -= tsig_algname_len;
-
-       if (rr_len < 6)
-         goto bad_rr;
-       tsig_timehi = tvb_get_ntohs(tvb, cur_offset);
-       tsig_timelo = tvb_get_ntohl(tvb, cur_offset + 2);
-       nstime.secs = tsig_timelo;
-       nstime.nsecs = 0;
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 6, "Time signed: %s%s",
-               abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE),
-               tsig_timehi == 0 ? "" : "(high bits set)");
-       cur_offset += 6;
-       rr_len -= 6;
-
-       if (rr_len < 2)
-         goto bad_rr;
-
-       proto_tree_add_item(rr_tree, hf_dns_tsig_fudge, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 2)
-         goto bad_rr;
-       tsig_siglen = tvb_get_ntohs(tvb, cur_offset);
-       proto_tree_add_item(rr_tree, hf_dns_tsig_mac_size, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (tsig_siglen != 0) {
-         proto_item *mac_item;
-         proto_tree *mac_tree;
-         tvbuff_t *sub_tvb;
-
-         if (rr_len < tsig_siglen)
-           goto bad_rr;
-
-         mac_item = proto_tree_add_item(rr_tree, hf_dns_tsig_mac, tvb, cur_offset, tsig_siglen, ENC_NA);
-         mac_tree = proto_item_add_subtree(mac_item, ett_dns_mac);
-
-         sub_tvb=tvb_new_subset(tvb, cur_offset, tsig_siglen, tsig_siglen);
-
-         if(!dissector_try_string(dns_tsig_dissector_table, tsig_algname, sub_tvb, pinfo, mac_tree)){
-               proto_tree_add_text(mac_tree, sub_tvb, 0, tvb_length(sub_tvb), "No dissector for algorithm:%s", tsig_algname);
-         }
-
-         cur_offset += tsig_siglen;
-         rr_len -= tsig_siglen;
-       }
-
-       if (rr_len < 2)
-         goto bad_rr;
-       proto_tree_add_item(rr_tree, hf_dns_tsig_original_id, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 2)
-         goto bad_rr;
-       tsig_error = tvb_get_ntohs(tvb, cur_offset);
-       proto_tree_add_uint_format(rr_tree, hf_dns_tsig_error, tvb, cur_offset, 2, tsig_error, "Error: %s (%d)",
-               val_to_str(tsig_error, rcode_vals,val_to_str(tsig_error, tsigerror_vals, "Unknown error")),
-               tsig_error);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 2)
-         goto bad_rr;
-       tsig_otherlen = tvb_get_ntohs(tvb, cur_offset);
-       proto_tree_add_item(rr_tree, hf_dns_tsig_other_len, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (tsig_otherlen != 0) {
-         if (rr_len < tsig_otherlen)
-           goto bad_rr;
-         proto_tree_add_item(rr_tree, hf_dns_tsig_other_data, tvb, cur_offset, tsig_otherlen, ENC_NA);
-       }
+      /* XXX Fix data length */
+      tsig_algname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &tsig_raw_algname);
+      tsig_algname=format_text(tsig_raw_algname, strlen(tsig_raw_algname));
+      proto_tree_add_string(rr_tree, hf_dns_tsig_algorithm_name, tvb, cur_offset, tsig_algname_len, tsig_algname);
+      cur_offset += tsig_algname_len;
+      rr_len     -= tsig_algname_len;
+
+      if (rr_len < 6) {
+        goto bad_rr;
+      }
+      tsig_timehi = tvb_get_ntohs(tvb, cur_offset);
+      tsig_timelo = tvb_get_ntohl(tvb, cur_offset + 2);
+      nstime.secs = tsig_timelo;
+      nstime.nsecs = 0;
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 6, "Time signed: %s%s",
+                          abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE),
+                          tsig_timehi == 0 ? "" : "(high bits set)");
+      cur_offset += 6;
+      rr_len     -= 6;
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      proto_tree_add_item(rr_tree, hf_dns_tsig_fudge, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      tsig_siglen = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_item(rr_tree, hf_dns_tsig_mac_size, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (tsig_siglen != 0) {
+        proto_item *mac_item;
+        proto_tree *mac_tree;
+        tvbuff_t   *sub_tvb;
+
+        if (rr_len < tsig_siglen) {
+          goto bad_rr;
+        }
+        mac_item = proto_tree_add_item(rr_tree, hf_dns_tsig_mac, tvb, cur_offset, tsig_siglen, ENC_NA);
+        mac_tree = proto_item_add_subtree(mac_item, ett_dns_mac);
+
+        sub_tvb=tvb_new_subset(tvb, cur_offset, tsig_siglen, tsig_siglen);
+
+        if (!dissector_try_string(dns_tsig_dissector_table, tsig_algname, sub_tvb, pinfo, mac_tree)) {
+          proto_tree_add_text(mac_tree, sub_tvb, 0, tvb_length(sub_tvb),
+                              "No dissector for algorithm:%s", tsig_algname);
+        }
+
+        cur_offset += tsig_siglen;
+        rr_len     -= tsig_siglen;
+      }
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      proto_tree_add_item(rr_tree, hf_dns_tsig_original_id, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      tsig_error = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_uint_format(rr_tree, hf_dns_tsig_error, tvb, cur_offset, 2, tsig_error, "Error: %s (%d)",
+                                 val_to_str_const(tsig_error, rcode_vals,
+                                            val_to_str_const(tsig_error, tsigerror_vals, "Unknown error")),
+                                 tsig_error);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 2) {
+        goto bad_rr;
+      }
+      tsig_otherlen = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_item(rr_tree, hf_dns_tsig_other_len, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (tsig_otherlen != 0) {
+        if (rr_len < tsig_otherlen) {
+          goto bad_rr;
+        }
+        proto_tree_add_item(rr_tree, hf_dns_tsig_other_data, tvb, cur_offset, tsig_otherlen, ENC_NA);
+      }
 
     }
     break;
 
-  case T_WINS:
+    case T_WINS:
     {
-      int rr_len = data_len;
+      int     rr_len = data_len;
       guint32 local_flag;
       guint32 lookup_timeout;
       guint32 cache_timeout;
       guint32 nservers;
 
 
-       if (rr_len < 4)
-         goto bad_rr;
-       local_flag = tvb_get_ntohl(tvb, cur_offset);
-
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Local flag: %s",
-                      local_flag ? "true" : "false");
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
+      local_flag = tvb_get_ntohl(tvb, cur_offset);
 
-       cur_offset += 4;
-       rr_len -= 4;
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Local flag: %s",
+                          local_flag ? "true" : "false");
 
-       if (rr_len < 4)
-         goto bad_rr;
-       lookup_timeout = tvb_get_ntohl(tvb, cur_offset);
+      cur_offset += 4;
+      rr_len     -= 4;
 
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Lookup timeout: %u seconds",
-                      lookup_timeout);
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
+      lookup_timeout = tvb_get_ntohl(tvb, cur_offset);
 
-       cur_offset += 4;
-       rr_len -= 4;
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Lookup timeout: %u seconds",
+                          lookup_timeout);
 
-       if (rr_len < 4)
-         goto bad_rr;
-       cache_timeout = tvb_get_ntohl(tvb, cur_offset);
+      cur_offset += 4;
+      rr_len     -= 4;
 
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Cache timeout: %u seconds",
-                      cache_timeout);
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
+      cache_timeout = tvb_get_ntohl(tvb, cur_offset);
 
-       cur_offset += 4;
-       rr_len -= 4;
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Cache timeout: %u seconds",
+                          cache_timeout);
 
-       if (rr_len < 4)
-         goto bad_rr;
-       nservers = tvb_get_ntohl(tvb, cur_offset);
+      cur_offset += 4;
+      rr_len     -= 4;
 
-         proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Number of WINS servers: %u",
-                      nservers);
+      if (rr_len < 4) {
+        goto bad_rr;
+      }
+      nservers = tvb_get_ntohl(tvb, cur_offset);
 
-       cur_offset += 4;
-       rr_len -= 4;
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Number of WINS servers: %u",
+                          nservers);
 
-       while (rr_len != 0 && nservers != 0) {
-         if (rr_len < 4)
-           goto bad_rr;
+      cur_offset += 4;
+      rr_len     -= 4;
 
-           proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "WINS server address: %s",
-                    tvb_ip_to_str(tvb, cur_offset));
+      while (rr_len != 0 && nservers != 0) {
+        if (rr_len < 4) {
+          goto bad_rr;
+        }
+        proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "WINS server address: %s",
+                            tvb_ip_to_str(tvb, cur_offset));
 
-         cur_offset += 4;
-         rr_len -= 4;
-         nservers--;
-       }
+        cur_offset += 4;
+        rr_len     -= 4;
+        nservers--;
+      }
 
     }
     break;
 
-  case T_WINS_R:
+    case T_WINS_R:
     {
-      int rr_len = data_len;
-      guint32 local_flag;
-      guint32 lookup_timeout;
-      guint32 cache_timeout;
+      int           rr_len = data_len;
+      guint32       local_flag;
+      guint32       lookup_timeout;
+      guint32       cache_timeout;
       const guchar *dname;
-      int dname_len;
+      int           dname_len;
 
-      if (rr_len < 4)
+      if (rr_len < 4) {
        goto bad_rr;
+      }
       local_flag = tvb_get_ntohl(tvb, cur_offset);
 
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Local flag: %s",
-                      local_flag ? "true" : "false");
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Local flag: %s",
+                          local_flag ? "true" : "false");
 
       cur_offset += 4;
-      rr_len -= 4;
+      rr_len     -= 4;
 
-      if (rr_len < 4)
+      if (rr_len < 4) {
        goto bad_rr;
+      }
       lookup_timeout = tvb_get_ntohl(tvb, cur_offset);
 
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Lookup timeout: %u seconds",
-                      lookup_timeout);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Lookup timeout: %u seconds",
+                          lookup_timeout);
 
       cur_offset += 4;
-      rr_len -= 4;
+      rr_len     -= 4;
 
-      if (rr_len < 4)
+      if (rr_len < 4) {
        goto bad_rr;
+      }
       cache_timeout = tvb_get_ntohl(tvb, cur_offset);
 
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Cache timeout: %u seconds",
-                      cache_timeout);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Cache timeout: %u seconds",
+                          cache_timeout);
 
       cur_offset += 4;
-      /* rr_len -= 4; */
+      /* rr_len     -= 4; */
 
       /* XXX Fix data length */
       dname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &dname);
       name_out = format_text(dname, strlen(dname));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %s", name_out);
-       proto_item_append_text(trr, ", name result domain %s", name_out);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, dname_len, "Name result domain: %s",
-                       name_out);
+      }
+      proto_item_append_text(trr, ", name result domain %s", name_out);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, dname_len, "Name result domain: %s",
+                          name_out);
     }
     break;
 
-  case T_SRV:
+    case T_SRV:
     {
-      guint16 priority = 0;
-      guint16 weight = 0;
-      guint16 port = 0;
+      guint16       priority = 0;
+      guint16       weight   = 0;
+      guint16       port     = 0;
       const guchar *target;
-      int target_len;
+      int           target_len;
 
       priority = tvb_get_ntohs(tvb, cur_offset);
       weight = tvb_get_ntohs(tvb, cur_offset+2);
@@ -2579,34 +2650,34 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
       /* XXX Fix data length */
       target_len = get_dns_name(tvb, cur_offset + 6, 0, dns_data_offset, &target);
       name_out = format_text(target, strlen(target));
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %u %u %u %s", priority, weight, port, name_out);
-
-       proto_item_append_text(trr,
-                      ", priority %u, weight %u, port %u, target %s",
-                      priority, weight, port, name_out);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Priority: %u", priority);
-       proto_tree_add_text(rr_tree, tvb, cur_offset + 2, 2, "Weight: %u", weight);
-       proto_tree_add_text(rr_tree, tvb, cur_offset + 4, 2, "Port: %u", port);
-       proto_tree_add_text(rr_tree, tvb, cur_offset + 6, target_len, "Target: %s",
-                       name_out);
+      }
+      proto_item_append_text(trr,
+                             ", priority %u, weight %u, port %u, target %s",
+                             priority, weight, port, name_out);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Priority: %u", priority);
+      proto_tree_add_text(rr_tree, tvb, cur_offset + 2, 2, "Weight: %u", weight);
+      proto_tree_add_text(rr_tree, tvb, cur_offset + 4, 2, "Port: %u", port);
+      proto_tree_add_text(rr_tree, tvb, cur_offset + 6, target_len, "Target: %s",
+                          name_out);
 
     }
     break;
 
     case T_NAPTR:
     {
-      int offset = cur_offset;
-      guint16 order;
-      guint16 preference;
-      gchar *flags;
-      guint8 flags_len;
-      guchar *service;
-      guint8 service_len;
-      guchar *regex;
-      guint8 regex_len;
+      int           offset = cur_offset;
+      guint16       order;
+      guint16       preference;
+      gchar        *flags;
+      guint8        flags_len;
+      guchar       *service;
+      guint8        service_len;
+      guchar       *regex;
+      guint8        regex_len;
       const guchar *replacement;
-      int replacement_len;
+      int           replacement_len;
 
       order = tvb_get_ntohs(tvb, offset);
       offset += 2;
@@ -2627,32 +2698,32 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
       replacement_len = get_dns_name(tvb, offset, 0, dns_data_offset, &replacement);
       name_out = format_text(replacement, strlen(replacement));
 
-      if (cinfo != NULL)
+      if (cinfo != NULL) {
        col_append_fstr(cinfo, COL_INFO, " %u %u %s", order, preference, flags);
+      }
 
-
-       proto_item_append_text(trr, ", order %u, preference %u, flags %s",
-               order, preference, flags);
-       offset = cur_offset;
-       proto_tree_add_text(rr_tree, tvb, offset, 2, "Order: %u", order);
-       offset += 2;
-       proto_tree_add_text(rr_tree, tvb, offset, 2, "Preference: %u", preference);
-       offset += 2;
-       proto_tree_add_text(rr_tree, tvb, offset, 1, "Flags length: %u", flags_len);
-       offset++;
-       proto_tree_add_text(rr_tree, tvb, offset, flags_len, "Flags: \"%s\"", flags);
-       offset += flags_len;
-       proto_tree_add_text(rr_tree, tvb, offset, 1, "Service length: %u", service_len);
-       offset++;
-       proto_tree_add_text(rr_tree, tvb, offset, service_len, "Service: \"%s\"", service);
-       offset += service_len;
-       proto_tree_add_text(rr_tree, tvb, offset, 1, "Regex length: %u", regex_len);
-       offset++;
-       proto_tree_add_text(rr_tree, tvb, offset, regex_len, "Regex: \"%s\"", regex);
-       offset += regex_len;
-       proto_tree_add_text(rr_tree, tvb, offset, 1, "Replacement length: %u", replacement_len);
-       offset++;
-       proto_tree_add_text(rr_tree, tvb, offset, replacement_len, "Replacement: %s", name_out);
+      proto_item_append_text(trr, ", order %u, preference %u, flags %s",
+                             order, preference, flags);
+      offset = cur_offset;
+      proto_tree_add_text(rr_tree, tvb, offset, 2, "Order: %u", order);
+      offset += 2;
+      proto_tree_add_text(rr_tree, tvb, offset, 2, "Preference: %u", preference);
+      offset += 2;
+      proto_tree_add_text(rr_tree, tvb, offset, 1, "Flags length: %u", flags_len);
+      offset++;
+      proto_tree_add_text(rr_tree, tvb, offset, flags_len, "Flags: \"%s\"", flags);
+      offset += flags_len;
+      proto_tree_add_text(rr_tree, tvb, offset, 1, "Service length: %u", service_len);
+      offset++;
+      proto_tree_add_text(rr_tree, tvb, offset, service_len, "Service: \"%s\"", service);
+      offset += service_len;
+      proto_tree_add_text(rr_tree, tvb, offset, 1, "Regex length: %u", regex_len);
+      offset++;
+      proto_tree_add_text(rr_tree, tvb, offset, regex_len, "Regex: \"%s\"", regex);
+      offset += regex_len;
+      proto_tree_add_text(rr_tree, tvb, offset, 1, "Replacement length: %u", replacement_len);
+      offset++;
+      proto_tree_add_text(rr_tree, tvb, offset, replacement_len, "Replacement: %s", name_out);
 
     }
     break;
@@ -2660,7 +2731,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
     case T_SSHFP:
     {
       guint8 sshfp_algorithm, sshfp_type;
-      int rr_len = data_len;
+      int    rr_len = data_len;
 
       static const value_string sshfp_algo[] = {
        { TSSHFP_ALGO_RESERVED, "Reserved" },
@@ -2676,34 +2747,39 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
       };
 
 
-       if (rr_len < 1)
-         goto bad_rr;
-       sshfp_algorithm = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s", val_to_str(sshfp_algorithm, sshfp_algo, "Unknown (0x%02X)"));
-       cur_offset += 1;
-       rr_len -= 1;
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      sshfp_algorithm = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
+                          "Algorithm: %s", val_to_str(sshfp_algorithm, sshfp_algo, "Unknown (0x%02X)"));
+      cur_offset += 1;
+      rr_len     -= 1;
 
-       if (rr_len < 1)
-         goto bad_rr;
-       sshfp_type = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Fingerprint type: %s", val_to_str(sshfp_type, sshfp_fingertype, "Unknown (0x%02X)"));
-       cur_offset += 1;
-       rr_len -= 1;
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      sshfp_type = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
+                          "Fingerprint type: %s", val_to_str(sshfp_type, sshfp_fingertype, "Unknown (0x%02X)"));
+      cur_offset += 1;
+      rr_len     -= 1;
 
-       if (rr_len < 1)
-         goto bad_rr;
-       if (rr_len != 0)
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      if (rr_len != 0) {
        proto_tree_add_item(rr_tree, hf_dns_sshfp_fingerprint, tvb, cur_offset, rr_len, ENC_NA);
-
+      }
     }
     break;
 
     case T_HIP:
     {
-      guint8 hit_len, algo;
-      guint16 pk_len;
-      int rr_len = data_len;
-      int rendezvous_len;
+      guint8        hit_len, algo;
+      guint16       pk_len;
+      int           rr_len = data_len;
+      int           rendezvous_len;
       const guchar *rend_server_dns_name;
 
       static const value_string hip_algo_vals[] = {
@@ -2713,264 +2789,310 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
         { 0,                   NULL }
       };
 
-      if (cinfo != NULL)
-         col_append_fstr(cinfo, COL_INFO, " %s", name);
-
-
-       if (rr_len < 1)
-           goto bad_rr;
-       hit_len = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "HIT length: %u", hit_len);
-       cur_offset += 1;
-       rr_len -= 1;
-
-       if (rr_len < 1)
-           goto bad_rr;
-       algo = tvb_get_guint8(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "PK algorithm: %s", val_to_str(algo, hip_algo_vals, "Unknown (0x%02X)"));
-       cur_offset += 1;
-       rr_len -= 1;
-
-       if (rr_len < 1)
-           goto bad_rr;
-       pk_len = tvb_get_ntohs(tvb, cur_offset);
-       proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "PK length: %u", pk_len);
-       cur_offset += 2;
-       rr_len -= 2;
-
-       if (rr_len < 1)
-           goto bad_rr;
-       proto_tree_add_item(rr_tree, hf_dns_hip_hit, tvb, cur_offset, hit_len, ENC_NA);
-       cur_offset += hit_len;
-       rr_len -= hit_len;
-
-       if (rr_len < 1)
-           goto bad_rr;
-       proto_tree_add_item(rr_tree, hf_dns_hip_pk, tvb, cur_offset, pk_len, ENC_NA);
-       cur_offset += pk_len;
-       rr_len -= pk_len;
-
-       if (rr_len < 1)
-          goto bad_rr;
-
-       while (rr_len > 1) {
-          rendezvous_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &rend_server_dns_name);
-          proto_tree_add_text(rr_tree, tvb, cur_offset, rendezvous_len, "Rendezvous Server: %s",
-                               format_text(rend_server_dns_name, strlen(rend_server_dns_name)));
-          cur_offset += rendezvous_len;
-          rr_len -= rendezvous_len;
-       }
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
+      }
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      hit_len = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "HIT length: %u", hit_len);
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      algo = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
+                          "PK algorithm: %s", val_to_str(algo, hip_algo_vals, "Unknown (0x%02X)"));
+      cur_offset += 1;
+      rr_len     -= 1;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      pk_len = tvb_get_ntohs(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "PK length: %u", pk_len);
+      cur_offset += 2;
+      rr_len     -= 2;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      proto_tree_add_item(rr_tree, hf_dns_hip_hit, tvb, cur_offset, hit_len, ENC_NA);
+      cur_offset += hit_len;
+      rr_len     -= hit_len;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      proto_tree_add_item(rr_tree, hf_dns_hip_pk, tvb, cur_offset, pk_len, ENC_NA);
+      cur_offset += pk_len;
+      rr_len     -= pk_len;
+
+      if (rr_len < 1) {
+        goto bad_rr;
+      }
+      while (rr_len > 1) {
+        rendezvous_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &rend_server_dns_name);
+        proto_tree_add_text(rr_tree, tvb, cur_offset, rendezvous_len, "Rendezvous Server: %s",
+                            format_text(rend_server_dns_name, strlen(rend_server_dns_name)));
+        cur_offset += rendezvous_len;
+        rr_len     -= rendezvous_len;
+      }
 
     }
     break;
 
     case T_DHCID:
     {
-      if (cinfo != NULL)
-         col_append_fstr(cinfo, COL_INFO, " %s", name);
-
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
+      }
 
-       if (data_len < 1)
-           goto bad_rr;
-       proto_tree_add_item(rr_tree, hf_dns_dhcid_rdata, tvb, cur_offset, data_len, ENC_NA);
+      if (data_len < 1) {
+        goto bad_rr;
+      }
+      proto_tree_add_item(rr_tree, hf_dns_dhcid_rdata, tvb, cur_offset, data_len, ENC_NA);
 
 
     }
     break;
 
     case T_APL:
-      {
-        int rr_len = data_len;
-        guint16 afamily;
-        guint8 afdpart_len;
-        guint8 *addr_copy;
+    {
+      int      rr_len = data_len;
+      guint16  afamily;
+      guint8   afdpart_len;
+      guint8  *addr_copy;
 
-        static const value_string apl_afamily_vals[] = {
+      static const value_string apl_afamily_vals[] = {
         { TAPL_ADDR_FAMILY_IPV4,      "IPv4" },
         { TAPL_ADDR_FAMILY_IPV6,      "IPv6" },
         { 0,                          NULL  }};
 
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-
-           while (rr_len > 1) {
-
-            if (rr_len < 1)
-                goto bad_rr;
-            afamily = tvb_get_ntohs(tvb, cur_offset);
-            proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Address Family: %s", val_to_str(afamily, apl_afamily_vals, "Unknown (0x%02X)"));
-            cur_offset += 2;
-            rr_len -= 2;
-
-            if (rr_len < 1)
-                goto bad_rr;
-            proto_tree_add_item(rr_tree, hf_dns_apl_coded_prefix, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
-            cur_offset += 1;
-            rr_len -= 1;
-
-            if (rr_len < 1)
-                goto bad_rr;
-            afdpart_len = tvb_get_guint8(tvb, cur_offset) & DNS_APL_AFDLENGTH;
-            proto_tree_add_item(rr_tree, hf_dns_apl_negation, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
-            proto_tree_add_item(rr_tree, hf_dns_apl_afdlength, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
-            cur_offset += 1;
-            rr_len -= 1;
-
-            if (rr_len < 1)
-                goto bad_rr;
-             if (afamily == 1 && afdpart_len <= 4) {
-                addr_copy = se_alloc0(4);
-            } else if (afamily == 2 && afdpart_len <= 16) {
-                addr_copy = se_alloc0(16);
-             } else {
-                goto bad_rr;
-             }
-            tvb_memcpy(tvb, (guint8 *)addr_copy, cur_offset, afdpart_len);
-            proto_tree_add_text(rr_tree, tvb, cur_offset, afdpart_len, "%s address: %s", val_to_str(afamily, apl_afamily_vals, "Unknown"),
-                                                    (afamily == 0x02) ? ip6_to_str((const struct e_in6_addr *)addr_copy)
-                                                    : ip_to_str(addr_copy) );
-            cur_offset += afdpart_len;
-            rr_len -= afdpart_len;
-           }
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
       }
-    break;
 
-    case T_GPOS:
-      {
-        guint8 long_len, lat_len, alt_len;
+      while (rr_len > 1) {
 
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        if (data_len < 1)
-           goto bad_rr;
-        long_len = tvb_get_guint8(tvb, cur_offset);
-        proto_tree_add_text(rr_tree, tvb, cur_offset + 1, long_len, "Longitude: %.*s", long_len, tvb_get_ephemeral_string(tvb, cur_offset +1 , long_len));
-        cur_offset += 1 + long_len;
+        if (rr_len < 1) {
+          goto bad_rr;
+        }
+        afamily = tvb_get_ntohs(tvb, cur_offset);
+        proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
+                            "Address Family: %s", val_to_str(afamily, apl_afamily_vals, "Unknown (0x%02X)"));
+        cur_offset += 2;
+        rr_len     -= 2;
 
-        lat_len = tvb_get_guint8(tvb, cur_offset);
-        proto_tree_add_text(rr_tree, tvb, cur_offset + 1, lat_len, "Latitude: %.*s", lat_len, tvb_get_ephemeral_string(tvb, cur_offset + 1, lat_len));
-        cur_offset += 1 + lat_len;
+        if (rr_len < 1) {
+          goto bad_rr;
+        }
+        proto_tree_add_item(rr_tree, hf_dns_apl_coded_prefix, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
+        cur_offset += 1;
+        rr_len     -= 1;
 
-        alt_len = tvb_get_guint8(tvb, cur_offset);
-        proto_tree_add_text(rr_tree, tvb, cur_offset + 1, alt_len, "Altitude: %.*s", alt_len, tvb_get_ephemeral_string(tvb, cur_offset + 1, alt_len));
+        if (rr_len < 1) {
+          goto bad_rr;
+        }
+        afdpart_len = tvb_get_guint8(tvb, cur_offset) & DNS_APL_AFDLENGTH;
+        proto_tree_add_item(rr_tree, hf_dns_apl_negation, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
+        proto_tree_add_item(rr_tree, hf_dns_apl_afdlength, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
+        cur_offset += 1;
+        rr_len     -= 1;
+
+        if (rr_len < 1) {
+          goto bad_rr;
+        }
+        if (afamily == 1 && afdpart_len <= 4) {
+          addr_copy = se_alloc0(4);
+        } else if (afamily == 2 && afdpart_len <= 16) {
+          addr_copy = se_alloc0(16);
+        } else {
+          goto bad_rr;
+        }
+        tvb_memcpy(tvb, (guint8 *)addr_copy, cur_offset, afdpart_len);
+        proto_tree_add_text(rr_tree, tvb, cur_offset, afdpart_len,
+                            "%s address: %s", val_to_str_const(afamily, apl_afamily_vals, "Unknown"),
+                            (afamily == 0x02) ? ip6_to_str((const struct e_in6_addr *)addr_copy)
+                            : ip_to_str(addr_copy) );
+        cur_offset += afdpart_len;
+        rr_len     -= afdpart_len;
       }
+    }
     break;
 
-    case T_RP:
-      {
-        int mbox_dname_len, txt_dname_len;
-        const guchar *mbox_dname, *txt_dname;
+    case T_GPOS:
+    {
+      guint8 long_len, lat_len, alt_len;
+
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
+      }
+      if (data_len < 1) {
+        goto bad_rr;
+      }
+      long_len = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset + 1, long_len,
+                          "Longitude: %.*s", long_len, tvb_get_ephemeral_string(tvb, cur_offset +1 , long_len));
+      cur_offset += 1 + long_len;
+
+      lat_len = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset + 1, lat_len,
+                          "Latitude: %.*s", lat_len, tvb_get_ephemeral_string(tvb, cur_offset + 1, lat_len));
+      cur_offset += 1 + lat_len;
+
+      alt_len = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset + 1, alt_len,
+                          "Altitude: %.*s", alt_len, tvb_get_ephemeral_string(tvb, cur_offset + 1, alt_len));
+    }
+    break;
 
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
+    case T_RP:
+    {
+      int           mbox_dname_len, txt_dname_len;
+      const guchar *mbox_dname, *txt_dname;
 
-        if (data_len < 1)
-           goto bad_rr;
-        mbox_dname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &mbox_dname);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, mbox_dname_len, "Mailbox: %s", format_text(mbox_dname, strlen(mbox_dname)));
-        cur_offset += mbox_dname_len;
-        txt_dname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &txt_dname);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, txt_dname_len, "TXT RR: %s", format_text(txt_dname, strlen(txt_dname)));
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
       }
+      if (data_len < 1) {
+        goto bad_rr;
+      }
+      mbox_dname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &mbox_dname);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, mbox_dname_len,
+                          "Mailbox: %s", format_text(mbox_dname, strlen(mbox_dname)));
+      cur_offset += mbox_dname_len;
+      txt_dname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &txt_dname);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, txt_dname_len,
+                          "TXT RR: %s", format_text(txt_dname, strlen(txt_dname)));
+    }
     break;
 
     case T_AFSDB:
     case T_RT:
-      {
-        guint16 subtype = 0;
-        const guchar *host_name;
-        int host_name_len;
+    {
+      guint16       subtype = 0;
+      const guchar *host_name;
+      int           host_name_len;
 
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        subtype = tvb_get_ntohs(tvb, cur_offset);
-        host_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &host_name);
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
+      }
+      subtype = tvb_get_ntohs(tvb, cur_offset);
+      host_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &host_name);
 
-        if (data_len < 1)
-           goto bad_rr;
-        proto_tree_add_text(rr_tree, tvb, cur_offset, 2, (type == T_AFSDB) ? "Subtype: %u" : "Preference: %u", subtype);
-        proto_tree_add_text(rr_tree, tvb, cur_offset + 2, host_name_len, (type == T_AFSDB) ? "Hostname: %s" : "Intermediate-Host: %s",format_text(host_name, strlen(host_name)));
+      if (data_len < 1) {
+        goto bad_rr;
+      }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
+                          (type == T_AFSDB) ? "Subtype: %u" : "Preference: %u", subtype);
+      proto_tree_add_text(rr_tree, tvb, cur_offset + 2, host_name_len,
+                          (type == T_AFSDB) ? "Hostname: %s" : "Intermediate-Host: %s",
+                          format_text(host_name, strlen(host_name)));
 
 
-      }
+    }
     break;
 
     case T_X25:
-      {
-        guint8 x25_len;
+    {
+      guint8 x25_len;
 
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        if (data_len < 1)
-           goto bad_rr;
-        x25_len = tvb_get_guint8(tvb, cur_offset);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, x25_len + 1, "PSDN-Address: %.*s", x25_len, tvb_get_ephemeral_string(tvb, cur_offset +1, x25_len));
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
       }
+      if (data_len < 1) {
+        goto bad_rr;
+      }
+      x25_len = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, x25_len + 1,
+                          "PSDN-Address: %.*s", x25_len,
+                          tvb_get_ephemeral_string(tvb, cur_offset +1, x25_len));
+    }
     break;
 
     case T_ISDN:
-      {
-        guint8 isdn_address_len, isdn_sa_len;
-        int rr_len = data_len;
-
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        if (rr_len < 1)
-           goto bad_rr;
-        isdn_address_len = tvb_get_guint8(tvb, cur_offset);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, isdn_address_len + 1, "ISDN Address: %.*s", isdn_address_len, tvb_get_ephemeral_string(tvb, cur_offset +1, isdn_address_len));
-        cur_offset += 1 + isdn_address_len;
-        rr_len -= 1 + isdn_address_len;
-
-        if (rr_len > 1)   /* ISDN SA is optional */ {
-           isdn_sa_len = tvb_get_guint8(tvb, cur_offset);
-           proto_tree_add_text(rr_tree, tvb, cur_offset, isdn_sa_len + 1, "Subaddress: %.*s", isdn_sa_len, tvb_get_ephemeral_string(tvb, cur_offset +1, isdn_sa_len));
-        }
+    {
+      guint8 isdn_address_len, isdn_sa_len;
+      int    rr_len = data_len;
+
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
+      }
+      if (rr_len < 1) {
+        goto bad_rr;
       }
+      isdn_address_len = tvb_get_guint8(tvb, cur_offset);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, isdn_address_len + 1,
+                          "ISDN Address: %.*s", isdn_address_len,
+                          tvb_get_ephemeral_string(tvb, cur_offset +1, isdn_address_len));
+      cur_offset += 1 + isdn_address_len;
+      rr_len     -= 1 + isdn_address_len;
+
+      if (rr_len > 1)   /* ISDN SA is optional */ {
+        isdn_sa_len = tvb_get_guint8(tvb, cur_offset);
+        proto_tree_add_text(rr_tree, tvb, cur_offset, isdn_sa_len + 1,
+                            "Subaddress: %.*s", isdn_sa_len,
+                            tvb_get_ephemeral_string(tvb, cur_offset +1, isdn_sa_len));
+      }
+    }
     break;
 
     case T_PX:
-      {
-        int px_map822_len, px_mapx400_len;
-        const guchar *px_map822_dnsname, *px_mapx400_dnsname;
-
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        if (data_len < 1)
-           goto bad_rr;
-        proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Preference: %u", tvb_get_ntohs(tvb, cur_offset));
-        cur_offset += 2;
-        px_map822_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &px_map822_dnsname);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, px_map822_len, "MAP822: %s", format_text(px_map822_dnsname, strlen(px_map822_dnsname)));
-        cur_offset += px_map822_len;
-        px_mapx400_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &px_mapx400_dnsname);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, px_mapx400_len, "MAPX400: %s", format_text(px_mapx400_dnsname, strlen(px_mapx400_dnsname)) );
-        /*cur_offset += px_mapx400_len;*/
+    {
+      int           px_map822_len, px_mapx400_len;
+      const guchar *px_map822_dnsname, *px_mapx400_dnsname;
+
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
+      }
+      if (data_len < 1) {
+        goto bad_rr;
       }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Preference: %u", tvb_get_ntohs(tvb, cur_offset));
+      cur_offset += 2;
+      px_map822_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &px_map822_dnsname);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, px_map822_len,
+                          "MAP822: %s", format_text(px_map822_dnsname, strlen(px_map822_dnsname)));
+      cur_offset += px_map822_len;
+      px_mapx400_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &px_mapx400_dnsname);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, px_mapx400_len,
+                          "MAPX400: %s", format_text(px_mapx400_dnsname, strlen(px_mapx400_dnsname)) );
+      /*cur_offset += px_mapx400_len;*/
+    }
     break;
 
     case T_NSAP:
-      {
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        if (data_len < 1)
-           goto bad_rr;
-        proto_tree_add_item(rr_tree, hf_dns_nsap_rdata, tvb, cur_offset, data_len, ENC_NA);
+    {
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
       }
+      if (data_len < 1) {
+        goto bad_rr;
+      }
+      proto_tree_add_item(rr_tree, hf_dns_nsap_rdata, tvb, cur_offset, data_len, ENC_NA);
+    }
     break;
 
     case T_NSAP_PTR:
-      {
-        int nsap_ptr_owner_len;
-        const guchar *nsap_ptr_owner;
+    {
+      int           nsap_ptr_owner_len;
+      const guchar *nsap_ptr_owner;
 
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        if (data_len < 1)
-           goto bad_rr;
-        nsap_ptr_owner_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &nsap_ptr_owner);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, nsap_ptr_owner_len, "Owner: %s", format_text(nsap_ptr_owner, strlen(nsap_ptr_owner)) );
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
+      }
+      if (data_len < 1) {
+        goto bad_rr;
       }
+      nsap_ptr_owner_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &nsap_ptr_owner);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, nsap_ptr_owner_len,
+                          "Owner: %s", format_text(nsap_ptr_owner, strlen(nsap_ptr_owner)) );
+    }
     break;
 
     case T_MB:
@@ -2978,50 +3100,57 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
     case T_MD:
     case T_MG:
     case T_MR:
-      {
-        int hostname_len;
-        const guchar *hostname_str;
+    {
+      int           hostname_len;
+      const guchar *hostname_str;
 
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        if (data_len < 1)
-           goto bad_rr;
-        hostname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &hostname_str);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, hostname_len, "Host: %s", format_text(hostname_str, strlen(hostname_str)));
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
       }
+      if (data_len < 1) {
+        goto bad_rr;
+      }
+      hostname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &hostname_str);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, hostname_len, "Host: %s", format_text(hostname_str, strlen(hostname_str)));
+    }
     break;
 
     case T_MINFO:
-      {
-        int rmailbx_len, emailbx_len;
-        const guchar *rmailbx_str, *emailbx_str;
-
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        if (data_len < 1)
-           goto bad_rr;
-        rmailbx_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &rmailbx_str);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, rmailbx_len, "Responsible Mailbox: %s", format_text(rmailbx_str, strlen(rmailbx_str)));
-        cur_offset += rmailbx_len;
-        emailbx_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &emailbx_str);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, emailbx_len, "Error Mailbox: %s", format_text(emailbx_str, strlen(emailbx_str)));
+    {
+      int rmailbx_len, emailbx_len;
+      const guchar *rmailbx_str, *emailbx_str;
+
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
       }
+      if (data_len < 1) {
+        goto bad_rr;
+      }
+      rmailbx_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &rmailbx_str);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, rmailbx_len,
+                          "Responsible Mailbox: %s", format_text(rmailbx_str, strlen(rmailbx_str)));
+      cur_offset += rmailbx_len;
+      emailbx_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &emailbx_str);
+      proto_tree_add_text(rr_tree, tvb, cur_offset, emailbx_len,
+                          "Error Mailbox: %s", format_text(emailbx_str, strlen(emailbx_str)));
+    }
     break;
 
     case T_NULL:
-      {
-        if (cinfo != NULL)
-           col_append_fstr(cinfo, COL_INFO, " %s", name);
-        proto_tree_add_text(rr_tree, tvb, cur_offset, data_len, "Data");
+    {
+      if (cinfo != NULL) {
+        col_append_fstr(cinfo, COL_INFO, " %s", name);
       }
+      proto_tree_add_text(rr_tree, tvb, cur_offset, data_len, "Data");
+    }
     break;
 
     /* TODO: parse more record types */
 
-  default:
+    default:
 
       proto_tree_add_text(rr_tree, tvb, cur_offset, data_len, "Data");
-    break;
+      break;
   }
 
   data_offset += data_len;
@@ -3030,8 +3159,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
 
 bad_rr:
 
-    proto_item_append_text(trr, ", bad RR length %d, too short",
-                       data_len);
+  proto_item_append_text(trr, ", bad RR length %d, too short",
+                         data_len);
 
 
   data_offset += data_len;
@@ -3044,9 +3173,9 @@ dissect_query_records(tvbuff_t *tvb, int cur_off, int dns_data_offset,
     int count, column_info *cinfo, proto_tree *dns_tree, gboolean isupdate,
     gboolean is_mdns)
 {
-  int start_off, add_off;
+  int         start_off, add_off;
   proto_tree *qatree = NULL;
-  proto_item *ti = NULL;
+  proto_item *ti     = NULL;
 
   start_off = cur_off;
   if (dns_tree) {
@@ -3059,9 +3188,9 @@ dissect_query_records(tvbuff_t *tvb, int cur_off, int dns_data_offset,
                                 is_mdns);
     cur_off += add_off;
   }
-  if (ti)
+  if (ti) {
     proto_item_set_len(ti, cur_off - start_off);
-
+  }
   return cur_off - start_off;
 }
 
@@ -3070,9 +3199,9 @@ dissect_answer_records(tvbuff_t *tvb, int cur_off, int dns_data_offset,
     int count, column_info *cinfo, proto_tree *dns_tree, const char *name,
     packet_info *pinfo, gboolean is_mdns)
 {
-  int start_off, add_off;
+  int         start_off, add_off;
   proto_tree *qatree = NULL;
-  proto_item *ti = NULL;
+  proto_item *ti     = NULL;
 
   start_off = cur_off;
   if (dns_tree) {
@@ -3081,12 +3210,12 @@ dissect_answer_records(tvbuff_t *tvb, int cur_off, int dns_data_offset,
   }
   while (count-- > 0) {
     add_off = dissect_dns_answer(
-           tvb, cur_off, dns_data_offset, cinfo, qatree, pinfo, is_mdns);
+      tvb, cur_off, dns_data_offset, cinfo, qatree, pinfo, is_mdns);
     cur_off += add_off;
   }
-  if (ti)
+  if (ti) {
     proto_item_set_len(ti, cur_off - start_off);
-
+  }
   return cur_off - start_off;
 }
 
@@ -3094,16 +3223,16 @@ static void
 dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     gboolean is_tcp, gboolean is_mdns, gboolean is_llmnr)
 {
-  int offset = is_tcp ? 2 : 0;
-  int dns_data_offset;
-  column_info *cinfo;
-  proto_tree *dns_tree = NULL, *field_tree;
-  proto_item *ti, *tf;
-  guint16    id, flags, opcode, rcode, quest, ans, auth, add;
-  int cur_off;
-  gboolean isupdate;
-  conversation_t *conversation;
-  dns_conv_info_t *dns_info;
+  int                offset   = is_tcp ? 2 : 0;
+  int                dns_data_offset;
+  column_info       *cinfo;
+  proto_tree        *dns_tree = NULL, *field_tree;
+  proto_item        *ti, *tf;
+  guint16            id, flags, opcode, rcode, quest, ans, auth, add;
+  int                cur_off;
+  gboolean           isupdate;
+  conversation_t    *conversation;
+  dns_conv_info_t   *dns_info;
   dns_transaction_t *dns_trans;
 
   dns_data_offset = offset;
@@ -3118,7 +3247,7 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
   rcode  = (guint16)  (flags & F_RCODE);
 
   if (check_col(pinfo->cinfo, COL_INFO)) {
-    col_add_fstr(pinfo->cinfo, COL_INFO, "%s%s 0x%04x ", 
+    col_add_fstr(pinfo->cinfo, COL_INFO, "%s%s 0x%04x ",
                 val_to_str(opcode, opcode_vals, "Unknown operation (%u)"),
                 (flags&F_RESPONSE)?" response":"", id);
 
@@ -3136,11 +3265,11 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
        is more expensive than a check that a pointer isn't NULL). */
     cinfo = NULL;
   }
-  if (opcode == OPCODE_UPDATE)
+  if (opcode == OPCODE_UPDATE) {
     isupdate = TRUE;
-  else
+  } else {
     isupdate = FALSE;
-
+  }
   if (tree) {
     if (is_llmnr) {
       ti = proto_tree_add_protocol_format(tree, proto_dns, tvb, 0, -1,
@@ -3170,8 +3299,8 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     dns_info->pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "dns_pdus");
     conversation_add_proto_data(conversation, proto_dns, dns_info);
   }
-  if(!pinfo->fd->flags.visited){
-    if(!(flags&F_RESPONSE)){
+  if (!pinfo->fd->flags.visited) {
+    if (!(flags&F_RESPONSE)) {
       /* This is a request */
       dns_trans=se_new(dns_transaction_t);
       dns_trans->req_frame=pinfo->fd->num;
@@ -3180,14 +3309,14 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
       se_tree_insert32(dns_info->pdus, id, (void *)dns_trans);
     } else {
       dns_trans=(dns_transaction_t *)se_tree_lookup32(dns_info->pdus, id);
-      if(dns_trans){
+      if (dns_trans) {
         dns_trans->rep_frame=pinfo->fd->num;
       }
     }
   } else {
     dns_trans=(dns_transaction_t *)se_tree_lookup32(dns_info->pdus, id);
   }
-  if(!dns_trans){
+  if (!dns_trans) {
     /* create a "fake" pana_trans structure */
     dns_trans=ep_new(dns_transaction_t);
     dns_trans->req_frame=0;
@@ -3196,9 +3325,9 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
   }
 
   /* print state tracking in the tree */
-  if(!(flags&F_RESPONSE)){
+  if (!(flags&F_RESPONSE)) {
     /* This is a request */
-    if(dns_trans->rep_frame){
+    if (dns_trans->rep_frame) {
       proto_item *it;
 
       it=proto_tree_add_uint(dns_tree, hf_dns_response_in, tvb, 0, 0, dns_trans->rep_frame);
@@ -3206,7 +3335,7 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     }
   } else {
     /* This is a reply */
-    if(dns_trans->req_frame){
+    if (dns_trans->req_frame) {
       proto_item *it;
       nstime_t ns;
 
@@ -3225,61 +3354,61 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
   }
 
   proto_tree_add_uint(dns_tree, hf_dns_transaction_id, tvb,
-       offset + DNS_ID, 2, id);
+                offset + DNS_ID, 2, id);
 
   tf = proto_tree_add_item(dns_tree, hf_dns_flags, tvb,
                 offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
   proto_item_append_text(tf, " %s",
-                val_to_str(opcode, opcode_vals, "Unknown operation"));
+                val_to_str_const(opcode, opcode_vals, "Unknown operation"));
   if (flags & F_RESPONSE) {
   proto_item_append_text(tf, " response, %s",
-               val_to_str(rcode, rcode_vals, "Unknown error"));
+                val_to_str_const(rcode, rcode_vals, "Unknown error"));
   }
   field_tree = proto_item_add_subtree(tf, ett_dns_flags);
   proto_tree_add_item(field_tree, hf_dns_flags_response,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
   proto_tree_add_item(field_tree, hf_dns_flags_opcode,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
   if (is_llmnr) {
     if (flags & F_RESPONSE) {
       proto_tree_add_item(field_tree, hf_dns_flags_conflict_response,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     } else {
       proto_tree_add_item(field_tree, hf_dns_flags_conflict_query,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     }
     proto_tree_add_item(field_tree, hf_dns_flags_truncated,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     proto_tree_add_item(field_tree, hf_dns_flags_tentative,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     if (flags & F_RESPONSE) {
       proto_tree_add_item(field_tree, hf_dns_flags_rcode,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     }
   } else {
     if (flags & F_RESPONSE) {
       proto_tree_add_item(field_tree, hf_dns_flags_authoritative,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     }
     proto_tree_add_item(field_tree, hf_dns_flags_truncated,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     proto_tree_add_item(field_tree, hf_dns_flags_recdesired,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     if (flags & F_RESPONSE) {
       proto_tree_add_item(field_tree, hf_dns_flags_recavail,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     }
     proto_tree_add_item(field_tree, hf_dns_flags_z,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     if (flags & F_RESPONSE) {
       proto_tree_add_item(field_tree, hf_dns_flags_authenticated,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     }
     proto_tree_add_item(field_tree, hf_dns_flags_checkdisable,
                 tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     if (flags & F_RESPONSE) {
       proto_tree_add_item(field_tree, hf_dns_flags_rcode,
-               tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
+                tvb, offset + DNS_FLAGS, 2, ENC_BIG_ENDIAN);
     }
   }
 
@@ -3287,36 +3416,36 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
   if (tree) {
     if (isupdate) {
       proto_tree_add_uint(dns_tree, hf_dns_count_zones, tvb,
-                         offset + DNS_QUEST, 2, quest);
+                          offset + DNS_QUEST, 2, quest);
     } else {
       proto_tree_add_uint(dns_tree, hf_dns_count_questions, tvb,
-                         offset + DNS_QUEST, 2, quest);
+                          offset + DNS_QUEST, 2, quest);
     }
   }
   ans = tvb_get_ntohs(tvb, offset + DNS_ANS);
   if (tree) {
     if (isupdate) {
       proto_tree_add_uint(dns_tree, hf_dns_count_prerequisites, tvb,
-                         offset + DNS_ANS, 2, ans);
+                          offset + DNS_ANS, 2, ans);
     } else {
       proto_tree_add_uint(dns_tree, hf_dns_count_answers, tvb,
-                         offset + DNS_ANS, 2, ans);
+                          offset + DNS_ANS, 2, ans);
     }
   }
   auth = tvb_get_ntohs(tvb, offset + DNS_AUTH);
   if (tree) {
     if (isupdate) {
       proto_tree_add_uint(dns_tree, hf_dns_count_updates, tvb,
-                         offset + DNS_AUTH, 2, auth);
+                          offset + DNS_AUTH, 2, auth);
     } else {
       proto_tree_add_uint(dns_tree, hf_dns_count_auth_rr, tvb,
-                         offset + DNS_AUTH, 2, auth);
+                          offset + DNS_AUTH, 2, auth);
     }
   }
   add = tvb_get_ntohs(tvb, offset + DNS_ADD);
   if (tree) {
     proto_tree_add_uint(dns_tree, hf_dns_count_add_rr, tvb,
-                       offset + DNS_ADD, 2, add);
+                        offset + DNS_ADD, 2, add);
 
   }
   cur_off = offset + DNS_HDRLEN;
@@ -3325,34 +3454,34 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     /* If this is a response, don't add information about the queries
        to the summary, just add information about the answers. */
     cur_off += dissect_query_records(tvb, cur_off, dns_data_offset, quest,
-                                    (!(flags & F_RESPONSE) ? cinfo : NULL),
-                                    dns_tree, isupdate, is_mdns);
+                                     (!(flags & F_RESPONSE) ? cinfo : NULL),
+                                     dns_tree, isupdate, is_mdns);
   }
 
   if (ans > 0) {
     /* If this is a request, don't add information about the answers
        to the summary, just add information about the queries. */
     cur_off += dissect_answer_records(tvb, cur_off, dns_data_offset, ans,
-                                     ((flags & F_RESPONSE) ? cinfo : NULL),
-                                     dns_tree, (isupdate ?
-                                                "Prerequisites" : "Answers"),
-                                     pinfo, is_mdns);
+                                      ((flags & F_RESPONSE) ? cinfo : NULL),
+                                      dns_tree, (isupdate ?
+                                                 "Prerequisites" : "Answers"),
+                                      pinfo, is_mdns);
   }
 
   /* Don't add information about the authoritative name servers, or the
      additional records, to the summary. */
   if (auth > 0) {
     cur_off += dissect_answer_records(tvb, cur_off, dns_data_offset, auth,
-                                     NULL, dns_tree,
-                                     (isupdate ? "Updates" :
-                                      "Authoritative nameservers"),
-                                     pinfo, is_mdns);
+                                      NULL, dns_tree,
+                                      (isupdate ? "Updates" :
+                                       "Authoritative nameservers"),
+                                      pinfo, is_mdns);
   }
 
   if (add > 0) {
     dissect_answer_records(tvb, cur_off, dns_data_offset, add,
-                                     NULL, dns_tree, "Additional records",
-                                     pinfo, is_mdns);
+                                      NULL, dns_tree, "Additional records",
+                                      pinfo, is_mdns);
   }
 }
 
@@ -3416,7 +3545,7 @@ static void
 dissect_dns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
   tcp_dissect_pdus(tvb, pinfo, tree, dns_desegment, 2, get_dns_pdu_len,
-       dissect_dns_tcp_pdu);
+                   dissect_dns_tcp_pdu);
 }
 
 void
@@ -3424,277 +3553,345 @@ proto_register_dns(void)
 {
   static hf_register_info hf[] = {
     { &hf_dns_length,
-      { "Length",              "dns.length",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Length of DNS-over-TCP request or response", HFILL }},
+      { "Length", "dns.length",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Length of DNS-over-TCP request or response", HFILL }},
+
     { &hf_dns_flags,
-      { "Flags",               "dns.flags",
-       FT_UINT16, BASE_HEX, NULL, 0x0,
-       NULL, HFILL }},
+      { "Flags", "dns.flags",
+        FT_UINT16, BASE_HEX, NULL, 0x0,
+        NULL, HFILL }},
+
     { &hf_dns_flags_response,
-      { "Response",            "dns.flags.response",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_response), F_RESPONSE,
-       "Is the message a response?", HFILL }},
+      { "Response", "dns.flags.response",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_response), F_RESPONSE,
+        "Is the message a response?", HFILL }},
+
     { &hf_dns_flags_opcode,
-      { "Opcode",              "dns.flags.opcode",
-       FT_UINT16, BASE_DEC, VALS(opcode_vals), F_OPCODE,
-       "Operation code", HFILL }},
+      { "Opcode", "dns.flags.opcode",
+        FT_UINT16, BASE_DEC, VALS(opcode_vals), F_OPCODE,
+        "Operation code", HFILL }},
+
     { &hf_dns_flags_authoritative,
-      { "Authoritative",       "dns.flags.authoritative",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_authoritative), F_AUTHORITATIVE,
-       "Is the server is an authority for the domain?", HFILL }},
+      { "Authoritative", "dns.flags.authoritative",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_authoritative), F_AUTHORITATIVE,
+        "Is the server is an authority for the domain?", HFILL }},
+
     { &hf_dns_flags_conflict_query,
-      { "Conflict",    "dns.flags.conflict",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_conflict_query), F_CONFLICT,
-       "Did we receive multiple responses to a query?", HFILL }},
+      { "Conflict", "dns.flags.conflict",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_conflict_query), F_CONFLICT,
+        "Did we receive multiple responses to a query?", HFILL }},
+
     { &hf_dns_flags_conflict_response,
-      { "Conflict",    "dns.flags.conflict",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_conflict_response), F_CONFLICT,
-       "Is the name considered unique?", HFILL }},
+      { "Conflict", "dns.flags.conflict",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_conflict_response), F_CONFLICT,
+        "Is the name considered unique?", HFILL }},
+
     { &hf_dns_flags_truncated,
-      { "Truncated",   "dns.flags.truncated",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_truncated), F_TRUNCATED,
-       "Is the message truncated?", HFILL }},
+      { "Truncated", "dns.flags.truncated",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_truncated), F_TRUNCATED,
+        "Is the message truncated?", HFILL }},
+
     { &hf_dns_flags_recdesired,
-      { "Recursion desired",   "dns.flags.recdesired",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_recdesired), F_RECDESIRED,
-       "Do query recursively?", HFILL }},
+      { "Recursion desired", "dns.flags.recdesired",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_recdesired), F_RECDESIRED,
+        "Do query recursively?", HFILL }},
+
     { &hf_dns_flags_tentative,
-      { "Tentative",   "dns.flags.tentative",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_tentative), F_TENTATIVE,
-       "Is the responder authoritative for the name, but not yet verified the uniqueness?", HFILL }},
+      { "Tentative", "dns.flags.tentative",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_tentative), F_TENTATIVE,
+        "Is the responder authoritative for the name, but not yet verified the uniqueness?", HFILL }},
+
     { &hf_dns_flags_recavail,
-      { "Recursion available", "dns.flags.recavail",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_recavail), F_RECAVAIL,
-       "Can the server do recursive queries?", HFILL }},
+      { "Recursion available", "dns.flags.recavail",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_recavail), F_RECAVAIL,
+        "Can the server do recursive queries?", HFILL }},
+
     { &hf_dns_flags_z,
       { "Z", "dns.flags.z",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_z), F_Z,
-       "Z flag", HFILL }},
+        FT_BOOLEAN, 16, TFS(&tfs_flags_z), F_Z,
+        "Z flag", HFILL }},
+
     { &hf_dns_flags_authenticated,
-      { "Answer authenticated",        "dns.flags.authenticated",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_authenticated), F_AUTHENTIC,
-       "Was the reply data authenticated by the server?", HFILL }},
+      { "Answer authenticated", "dns.flags.authenticated",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_authenticated), F_AUTHENTIC,
+        "Was the reply data authenticated by the server?", HFILL }},
+
     { &hf_dns_flags_checkdisable,
-      { "Non-authenticated data",      "dns.flags.checkdisable",
-       FT_BOOLEAN, 16, TFS(&tfs_flags_checkdisable), F_CHECKDISABLE,
-       "Is non-authenticated data acceptable?", HFILL }},
+      { "Non-authenticated data", "dns.flags.checkdisable",
+        FT_BOOLEAN, 16, TFS(&tfs_flags_checkdisable), F_CHECKDISABLE,
+        "Is non-authenticated data acceptable?", HFILL }},
+
     { &hf_dns_flags_rcode,
-      { "Reply code",          "dns.flags.rcode",
-       FT_UINT16, BASE_DEC, VALS(rcode_vals), F_RCODE,
-       NULL, HFILL }},
+      { "Reply code", "dns.flags.rcode",
+        FT_UINT16, BASE_DEC, VALS(rcode_vals), F_RCODE,
+        NULL, HFILL }},
+
     { &hf_dns_transaction_id,
-      { "Transaction ID",              "dns.id",
-       FT_UINT16, BASE_HEX, NULL, 0x0,
-       "Identification of transaction", HFILL }},
+      { "Transaction ID", "dns.id",
+        FT_UINT16, BASE_HEX, NULL, 0x0,
+        "Identification of transaction", HFILL }},
+
     { &hf_dns_qry_type,
-      { "Type",        "dns.qry.type",
-       FT_UINT16, BASE_HEX, VALS(dns_types), 0x0,
-       "Query Type", HFILL }},
+      { "Type", "dns.qry.type",
+        FT_UINT16, BASE_HEX, VALS(dns_types), 0x0,
+        "Query Type", HFILL }},
+
     { &hf_dns_qry_class,
-      { "Class",       "dns.qry.class",
-       FT_UINT16, BASE_HEX, VALS(dns_classes), 0x0,
-       "Query Class", HFILL }},
+      { "Class", "dns.qry.class",
+        FT_UINT16, BASE_HEX, VALS(dns_classes), 0x0,
+        "Query Class", HFILL }},
+
     { &hf_dns_qry_class_mdns,
-      { "Class",       "dns.qry.class",
-       FT_UINT16, BASE_HEX, VALS(dns_classes), 0x7FFF,
-       "Query Class", HFILL }},
+      { "Class", "dns.qry.class",
+        FT_UINT16, BASE_HEX, VALS(dns_classes), 0x7FFF,
+        "Query Class", HFILL }},
+
     { &hf_dns_qry_qu,
-      { "\"QU\" question",     "dns.qry.qu",
-       FT_BOOLEAN, 16, NULL, C_QU,
-       "QU flag", HFILL }},
+      { "\"QU\" question", "dns.qry.qu",
+        FT_BOOLEAN, 16, NULL, C_QU,
+        "QU flag", HFILL }},
+
     { &hf_dns_qry_name,
-      { "Name",        "dns.qry.name",
-       FT_STRING, BASE_NONE, NULL, 0x0,
-       "Query Name", HFILL }},
+      { "Name", "dns.qry.name",
+        FT_STRING, BASE_NONE, NULL, 0x0,
+        "Query Name", HFILL }},
+
     { &hf_dns_rr_type,
-      { "Type",        "dns.resp.type",
-       FT_UINT16, BASE_HEX, VALS(dns_types), 0x0,
-       "Response Type", HFILL }},
+      { "Type", "dns.resp.type",
+        FT_UINT16, BASE_HEX, VALS(dns_types), 0x0,
+        "Response Type", HFILL }},
+
     { &hf_dns_rr_class,
-      { "Class",       "dns.resp.class",
-       FT_UINT16, BASE_HEX, VALS(dns_classes), 0x0,
-       "Response Class", HFILL }},
+      { "Class", "dns.resp.class",
+        FT_UINT16, BASE_HEX, VALS(dns_classes), 0x0,
+        "Response Class", HFILL }},
+
     { &hf_dns_rr_class_mdns,
-      { "Class",       "dns.resp.class",
-       FT_UINT16, BASE_HEX, VALS(dns_classes), 0x7FFF,
-       "Response Class", HFILL }},
+      { "Class", "dns.resp.class",
+        FT_UINT16, BASE_HEX, VALS(dns_classes), 0x7FFF,
+        "Response Class", HFILL }},
+
     { &hf_dns_rr_cache_flush,
-      { "Cache flush",         "dns.resp.cache_flush",
-       FT_BOOLEAN, 16, NULL, C_FLUSH,
-       "Cache flush flag", HFILL }},
+      { "Cache flush", "dns.resp.cache_flush",
+        FT_BOOLEAN, 16, NULL, C_FLUSH,
+        "Cache flush flag", HFILL }},
+
     { &hf_dns_srv_service,
       { "Service", "dns.srv.service",
-       FT_STRING, BASE_NONE, NULL, 0x0,
-       "Desired service", HFILL }},
+        FT_STRING, BASE_NONE, NULL, 0x0,
+        "Desired service", HFILL }},
+
     { &hf_dns_srv_proto,
       { "Protocol", "dns.srv.proto",
-       FT_STRING, BASE_NONE, NULL, 0x0,
-       "Desired protocol", HFILL }},
+        FT_STRING, BASE_NONE, NULL, 0x0,
+        "Desired protocol", HFILL }},
+
     { &hf_dns_srv_name,
       { "Name", "dns.srv.name",
-       FT_STRING, BASE_NONE, NULL, 0x0,
-       "Domain this resource record refers to", HFILL }},
+        FT_STRING, BASE_NONE, NULL, 0x0,
+        "Domain this resource record refers to", HFILL }},
+
     { &hf_dns_rr_name,
-      { "Name",        "dns.resp.name",
-       FT_STRING, BASE_NONE, NULL, 0x0,
-       "Response Name", HFILL }},
+      { "Name", "dns.resp.name",
+        FT_STRING, BASE_NONE, NULL, 0x0,
+        "Response Name", HFILL }},
+
     { &hf_dns_rr_ttl,
       { "Time to live", "dns.resp.ttl",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "Response TTL", HFILL }},
+        FT_UINT32, BASE_DEC, NULL, 0x0,
+        "Response TTL", HFILL }},
+
     { &hf_dns_rr_len,
-      { "Data length",  "dns.resp.len",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "Response Length", HFILL }},
+      { "Data length", "dns.resp.len",
+        FT_UINT32, BASE_DEC, NULL, 0x0,
+        "Response Length", HFILL }},
+
     { &hf_dns_rr_addr,
-      { "Addr",        "dns.resp.addr",
-       FT_IPv4, BASE_NONE, NULL, 0x0,
-       "Response Address", HFILL }},
+      { "Addr", "dns.resp.addr",
+        FT_IPv4, BASE_NONE, NULL, 0x0,
+        "Response Address", HFILL }},
+
     { &hf_dns_rr_primaryname,
-      { "Primaryname",         "dns.resp.primaryname",
-       FT_STRING, BASE_NONE, NULL, 0x0,
-       "Response Primary Name", HFILL }},
+      { "Primaryname", "dns.resp.primaryname",
+        FT_STRING, BASE_NONE, NULL, 0x0,
+        "Response Primary Name", HFILL }},
+
     { &hf_dns_rr_ns,
-      { "Name Server",         "dns.resp.ns",
-       FT_STRING, BASE_NONE, NULL, 0x0,
-       NULL, HFILL }},
+      { "Name Server", "dns.resp.ns",
+        FT_STRING, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
     { &hf_dns_count_questions,
-      { "Questions",           "dns.count.queries",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Number of queries in packet", HFILL }},
+      { "Questions", "dns.count.queries",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Number of queries in packet", HFILL }},
+
     { &hf_dns_count_zones,
-      { "Zones",               "dns.count.zones",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Number of zones in packet", HFILL }},
+      { "Zones", "dns.count.zones",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Number of zones in packet", HFILL }},
+
     { &hf_dns_count_answers,
-      { "Answer RRs",          "dns.count.answers",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Number of answers in packet", HFILL }},
+      { "Answer RRs", "dns.count.answers",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Number of answers in packet", HFILL }},
+
     { &hf_dns_count_prerequisites,
-      { "Prerequisites",               "dns.count.prerequisites",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Number of prerequisites in packet", HFILL }},
+      { "Prerequisites", "dns.count.prerequisites",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Number of prerequisites in packet", HFILL }},
+
     { &hf_dns_count_auth_rr,
-      { "Authority RRs",               "dns.count.auth_rr",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Number of authoritative records in packet", HFILL }},
+      { "Authority RRs", "dns.count.auth_rr",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Number of authoritative records in packet", HFILL }},
+
     { &hf_dns_count_updates,
-      { "Updates",             "dns.count.updates",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Number of updates records in packet", HFILL }},
+      { "Updates", "dns.count.updates",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Number of updates records in packet", HFILL }},
+
     { &hf_dns_nsec3_algo,
       { "Hash algorithm", "dns.nsec3.algo",
         FT_UINT8, BASE_DEC, VALS(hash_algorithms), 0,
         NULL, HFILL }},
+
     { &hf_dns_nsec3_flags,
       { "NSEC3 flags", "dns.nsec3.flags",
         FT_UINT8, BASE_DEC, NULL, 0,
         NULL, HFILL }},
+
     { &hf_dns_nsec3_flag_optout,
       { "NSEC3 Opt-out flag", "dns.nsec3.flags.opt_out",
         FT_BOOLEAN, 8, TFS(&tfs_flags_nsec3_optout), NSEC3_FLAG_OPTOUT,
         NULL, HFILL }},
+
     { &hf_dns_nsec3_iterations,
       { "NSEC3 iterations", "dns.nsec3.iterations",
         FT_UINT16, BASE_DEC, NULL, 0,
         "Number of hashing iterations", HFILL }},
+
     { &hf_dns_nsec3_salt_length,
       { "Salt length", "dns.nsec3.salt_length",
         FT_UINT8, BASE_DEC, NULL, 0,
         "Length of salt in bytes", HFILL }},
+
     { &hf_dns_nsec3_salt_value,
       { "Salt value", "dns.nsec3.salt_value",
         FT_BYTES, BASE_NONE, NULL, 0,
         NULL, HFILL }},
+
     { &hf_dns_nsec3_hash_length,
       { "Hash length", "dns.nsec3.hash_length",
         FT_UINT8, BASE_DEC, NULL, 0,
         "Length in bytes of next hashed owner", HFILL }},
+
     { &hf_dns_nsec3_hash_value,
       { "Next hashed owner", "dns.nsec3.hash_value",
         FT_BYTES, BASE_NONE, NULL, 0,
         NULL, HFILL }},
+
     { &hf_dns_tsig_original_id,
-      { "Original Id",         "dns.tsig.original_id",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       NULL, HFILL }},
+      { "Original Id", "dns.tsig.original_id",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        NULL, HFILL }},
+
     { &hf_dns_tsig_error,
-      { "Error",               "dns.tsig.error",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Expanded RCODE for TSIG", HFILL }},
+      { "Error", "dns.tsig.error",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Expanded RCODE for TSIG", HFILL }},
+
     { &hf_dns_tsig_fudge,
-      { "Fudge",               "dns.tsig.fudge",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Number of bytes for the MAC", HFILL }},
+      { "Fudge", "dns.tsig.fudge",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Number of bytes for the MAC", HFILL }},
+
     { &hf_dns_tsig_mac_size,
-      { "MAC Size",            "dns.tsig.mac_size",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Number of bytes for the MAC", HFILL }},
+      { "MAC Size", "dns.tsig.mac_size",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Number of bytes for the MAC", HFILL }},
+
     { &hf_dns_tsig_other_len,
-      { "Other Len",           "dns.tsig.other_len",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Number of bytes for Other Data", HFILL }},
+      { "Other Len", "dns.tsig.other_len",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        "Number of bytes for Other Data", HFILL }},
+
     { &hf_dns_tsig_mac,
-      { "MAC",         "dns.tsig.mac",
-       FT_NONE, BASE_NONE, NULL, 0x0,
-       NULL, HFILL }},
+      { "MAC", "dns.tsig.mac",
+        FT_NONE, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
     { &hf_dns_tsig_other_data,
-      { "Other Data",          "dns.tsig.other_data",
-       FT_BYTES, BASE_NONE, NULL, 0x0,
-       NULL, HFILL }},
+      { "Other Data", "dns.tsig.other_data",
+        FT_BYTES, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
     { &hf_dns_tsig_algorithm_name,
-      { "Algorithm Name",              "dns.tsig.algorithm_name",
-       FT_STRING, BASE_NONE, NULL, 0x0,
-       "Name of algorithm used for the MAC", HFILL }},
+      { "Algorithm Name", "dns.tsig.algorithm_name",
+        FT_STRING, BASE_NONE, NULL, 0x0,
+        "Name of algorithm used for the MAC", HFILL }},
+
     { &hf_dns_response_in,
       { "Response In", "dns.response_in",
         FT_FRAMENUM, BASE_NONE, NULL, 0x0,
         "The response to this DNS query is in this frame", HFILL }},
+
     { &hf_dns_response_to,
       { "Request In", "dns.response_to",
         FT_FRAMENUM, BASE_NONE, NULL, 0x0,
         "This is a response to the DNS query in this frame", HFILL }},
+
     { &hf_dns_time,
       { "Time", "dns.time",
         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
         "The time between the Query and the Response", HFILL }},
+
     { &hf_dns_count_add_rr,
-      { "Additional RRs",              "dns.count.add_rr",
+      { "Additional RRs", "dns.count.add_rr",
         FT_UINT16, BASE_DEC, NULL, 0x0,
         "Number of additional records in packet", HFILL }},
+
     { &hf_dns_sshfp_fingerprint,
-      { "Fingerprint", "dns.sshfp.fingerprint",
+      { "Fingerprint", "dns.sshfp.fingerprint",
         FT_BYTES, BASE_NONE, NULL, 0,
         NULL, HFILL }},
+
     { &hf_dns_hip_hit,
-      { "Host Identity Tag",    "dns.hip.hit",
+      { "Host Identity Tag", "dns.hip.hit",
         FT_BYTES, BASE_NONE, NULL, 0,
         NULL, HFILL }},
+
     { &hf_dns_hip_pk,
       { "HIP Public Key", "dns.hip.pk",
         FT_BYTES, BASE_NONE, NULL, 0,
         NULL, HFILL }},
+
     { &hf_dns_dhcid_rdata,
       { "DHCID Data", "dns.dhcid.rdata",
         FT_BYTES, BASE_NONE, NULL, 0,
         NULL, HFILL }},
+
     { &hf_dns_apl_coded_prefix,
       { "Prefix Length", "dns.apl.coded.prefix",
         FT_UINT8, BASE_DEC, NULL, 0,
         NULL, HFILL }},
+
     { &hf_dns_apl_negation,
       { "Negation Flag", "dns.apl.negation",
         FT_BOOLEAN, 8, TFS(&tfs_dns_apl_negation), DNS_APL_NEGATION,
         NULL, HFILL }},
+
     { &hf_dns_apl_afdlength,
       { "Address Length, in octets","dns.apl.afdlength",
         FT_UINT8, BASE_DEC, NULL, DNS_APL_AFDLENGTH,
         NULL, HFILL }},
+
     { &hf_dns_nsap_rdata,
       { "NSAP Data", "dns.nsap.rdata",
         FT_BYTES, BASE_NONE, NULL, 0,
         NULL, HFILL }}
+
   };
   static gint *ett[] = {
     &ett_dns,
index afcd3a10375429d25e3fcb763cda3d175c741d75..a556403eac1c10b5ccad03b09a44d383fe5b7808 100644 (file)
@@ -50,33 +50,33 @@ static int hf_dpnss_link_address2_extension = -1;
 static int hf_dpnss_link_control_frameType = -1;
 
 static const value_string dpnss_link_framegroup_vals[] = {
- { 0x11, "Information Frame" },
- { 0x03, "Control Frame" },
- { 0, NULL }
      { 0x11, "Information Frame" },
      { 0x03, "Control Frame" },
      { 0, NULL }
 };
 
 static const value_string dpnss_link_crbit_vals[] = {
- { 0x0, "Command/Response Bit Cleared" },
- { 0x1, "Command/Response Bit Set" },
- { 0, NULL }
      { 0x0, "Command/Response Bit Cleared" },
      { 0x1, "Command/Response Bit Set" },
      { 0, NULL }
 };
 
 static const value_string dpnss_link_extend_vals[] = {
- { 0x0, "Extended to next octet" },
- { 0x1, "Final octet" },
- { 0, NULL }
      { 0x0, "Extended to next octet" },
      { 0x1, "Final octet" },
      { 0, NULL }
 };
 
 static const value_string dpnss_link_reserved_vals[] = {
- { 0x0, "Reserved" },
- { 0x1, "Reserved" },
- { 0, NULL }
      { 0x0, "Reserved" },
      { 0x1, "Reserved" },
      { 0, NULL }
 };
 
 static const value_string dpnss_link_dlcId_vals[] = {
- { 0x0, "Real Channel" },
- { 0x1, "Virtual Channel" },
- { 0, NULL }
      { 0x0, "Real Channel" },
      { 0x1, "Virtual Channel" },
      { 0, NULL }
 };
 
 #define FRAME_TYPE_UI_EVEN 0x03
@@ -85,11 +85,11 @@ static const value_string dpnss_link_dlcId_vals[] = {
 #define FRAME_TYPE_UA      0x63
 
 static const value_string dpnss_link_frameType_vals[] = {
- { FRAME_TYPE_UI_EVEN, "UI (even)" },
{ FRAME_TYPE_UI_ODD, "UI (odd)" },
{ FRAME_TYPE_SABMR, "SABMR" },
{ FRAME_TYPE_UA, "UA" },
- { 0, NULL }
      { FRAME_TYPE_UI_EVEN, "UI (even)" },
      { FRAME_TYPE_UI_ODD,  "UI (odd)" },
      { FRAME_TYPE_SABMR,   "SABMR" },
      { FRAME_TYPE_UA,      "UA" },
      { 0, NULL }
 };
 
 static int ett_dpnss_link = -1;
@@ -100,10 +100,10 @@ dissect_dpnss_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
        proto_item *item;
        proto_tree *dpnss_link_tree;
-       guint8 octet;
-       tvbuff_t *protocol_data_tvb;
-       guint16 protocol_data_length;
-       gboolean uton;
+       guint8      octet;
+       tvbuff_t   *protocol_data_tvb;
+       guint16     protocol_data_length;
+       gboolean    uton;
 
        uton = pinfo->pseudo_header->l1event.uton;
        /* Make entries in src and dst column */
@@ -111,7 +111,7 @@ dissect_dpnss_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        col_set_str(pinfo->cinfo, COL_DEF_SRC, uton?"TE":"NT");
        col_set_str(pinfo->cinfo, COL_DEF_DST, uton?"NT":"TE");
 
-/* Make entries in Protocol column and Info column on summary display */
+       /* Make entries in Protocol column and Info column on summary display */
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "DPNSS");
 
        item = proto_tree_add_item(tree, proto_dpnss_link, tvb, 0, -1, ENC_NA);
@@ -156,67 +156,63 @@ dissect_dpnss_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
 
 /* Register the protocol with Wireshark */
-/* If this dissector uses sub-dissector registration add a registration routine.
-   This format is required because a script is used to find these routines and
-   create the code that calls these routines.
-*/
-
 void
 proto_register_dpnss_link(void)
 {
-    static hf_register_info hf[] = {
-       { &hf_dpnss_link_address_framegroup,
-         { "Frame Group", "dpnss_link.framegroup",
-           FT_UINT8, BASE_DEC, VALS(dpnss_link_framegroup_vals), 0xfc,
-           NULL, HFILL }
-       },
-       { &hf_dpnss_link_address_crbit,
-         { "C/R Bit", "dpnss_link.crbit",
-           FT_UINT8, BASE_DEC, VALS(dpnss_link_crbit_vals), 0x02,
-           NULL, HFILL }
-       },
-       { &hf_dpnss_link_address_extension,
-         { "Extension", "dpnss_link.extension",
-           FT_UINT8, BASE_DEC, VALS(dpnss_link_extend_vals), 0x01,
-           NULL, HFILL }
-       },
-       { &hf_dpnss_link_address2_reserved,
-         { "Reserved", "dpnss_link.reserved",
-           FT_UINT8, BASE_DEC, VALS(dpnss_link_reserved_vals), 0x80,
-           NULL, HFILL }
-       },
-       { &hf_dpnss_link_address2_dlcId,
-         { "DLC ID", "dpnss_link.dlcId",
-           FT_UINT8, BASE_DEC, VALS(dpnss_link_dlcId_vals), 0x40,
-           NULL, HFILL }
-       },
-       { &hf_dpnss_link_address2_dlcIdNr,
-         { "DLC ID Number", "dpnss_link.dlcIdNr",
-           FT_UINT8, BASE_DEC, NULL, 0x3e,
-           NULL, HFILL }
-       },
-       { &hf_dpnss_link_address2_extension,
-         { "Extension", "dpnss_link.extension2",
-           FT_UINT8, BASE_DEC, VALS(dpnss_link_extend_vals), 0x01,
-           NULL, HFILL }
-       },
-       { &hf_dpnss_link_control_frameType,
-         { "Frame Type", "dpnss_link.frameType",
-           FT_UINT8, BASE_DEC, VALS(dpnss_link_frameType_vals), 0xff,
-           NULL, HFILL }
-       }
-    };
-
-    static gint *ett[] = { &ett_dpnss_link };
-
-
-    /* Register the protocol name and description */
-    proto_dpnss_link = proto_register_protocol("Digital Private Signalling System No 1 Link Layer", "DPNSS Link", "dpnss_link");
-    register_dissector("dpnss_link", dissect_dpnss_link, proto_dpnss_link);
-
-    /* Required function calls to register the header fields and subtrees used */
-    proto_register_field_array(proto_dpnss_link, hf, array_length(hf));
-    proto_register_subtree_array(ett, array_length(ett));
+       static hf_register_info hf[] = {
+               { &hf_dpnss_link_address_framegroup,
+                 { "Frame Group", "dpnss_link.framegroup",
+                   FT_UINT8, BASE_DEC, VALS(dpnss_link_framegroup_vals), 0xfc,
+                   NULL, HFILL }
+               },
+               { &hf_dpnss_link_address_crbit,
+                 { "C/R Bit", "dpnss_link.crbit",
+                   FT_UINT8, BASE_DEC, VALS(dpnss_link_crbit_vals), 0x02,
+                   NULL, HFILL }
+               },
+               { &hf_dpnss_link_address_extension,
+                 { "Extension", "dpnss_link.extension",
+                   FT_UINT8, BASE_DEC, VALS(dpnss_link_extend_vals), 0x01,
+                   NULL, HFILL }
+               },
+               { &hf_dpnss_link_address2_reserved,
+                 { "Reserved", "dpnss_link.reserved",
+                   FT_UINT8, BASE_DEC, VALS(dpnss_link_reserved_vals), 0x80,
+                   NULL, HFILL }
+               },
+               { &hf_dpnss_link_address2_dlcId,
+                 { "DLC ID", "dpnss_link.dlcId",
+                   FT_UINT8, BASE_DEC, VALS(dpnss_link_dlcId_vals), 0x40,
+                   NULL, HFILL }
+               },
+               { &hf_dpnss_link_address2_dlcIdNr,
+                 { "DLC ID Number", "dpnss_link.dlcIdNr",
+                   FT_UINT8, BASE_DEC, NULL, 0x3e,
+                   NULL, HFILL }
+               },
+               { &hf_dpnss_link_address2_extension,
+                 { "Extension", "dpnss_link.extension2",
+                   FT_UINT8, BASE_DEC, VALS(dpnss_link_extend_vals), 0x01,
+                   NULL, HFILL }
+               },
+               { &hf_dpnss_link_control_frameType,
+                 { "Frame Type", "dpnss_link.frameType",
+                   FT_UINT8, BASE_DEC, VALS(dpnss_link_frameType_vals), 0xff,
+                   NULL, HFILL }
+               }
+       };
+
+       static gint *ett[] = { &ett_dpnss_link };
+
+
+       /* Register the protocol name and description */
+       proto_dpnss_link = proto_register_protocol("Digital Private Signalling System No 1 Link Layer",
+                                                  "DPNSS Link", "dpnss_link");
+       register_dissector("dpnss_link", dissect_dpnss_link, proto_dpnss_link);
+
+       /* Required function calls to register the header fields and subtrees used */
+       proto_register_field_array(proto_dpnss_link, hf, array_length(hf));
+       proto_register_subtree_array(ett, array_length(ett));
 }
 
 void
index 64697791a127b4fd0c734e50a6a48e939ea99cee..b43418c12b3c24aed871b1e543c4ae4285206391 100644 (file)
@@ -1,4 +1,4 @@
-/* packet-dpnss_dass2.c
+/* packet-dpnss.c
  * Routines for DPNSS/DASS2 dissection
  * Copyright 2007, Anders Broman <anders.broman[at]ericsson.com>
  *
 #include <epan/packet.h>
 
 /* Initialize the protocol and registered fields */
-static int proto_dpnss                      = -1;
-static int hf_dpnss_msg_grp_id              = -1;
-static int hf_dpnss_cc_msg_type             = -1;
-static int hf_dpnss_e2e_msg_type            = -1;
-static int hf_dpnss_LbL_msg_type            = -1;
-static int hf_dpnss_ext_bit                 = -1;
-static int hf_dpnss_ext_bit_notall          = -1;
-static int hf_dpnss_sic_type                = -1;
-static int hf_dpnss_sic_details_for_speech  = -1;
-static int hf_dpnss_sic_details_for_data1   = -1;
-static int hf_dpnss_sic_details_for_data2   = -1;
-static int hf_dpnss_dest_addr               = -1;
-static int hf_dpnss_sic_oct2_data_type      = -1;
-static int hf_dpnss_sic_oct2_duplex         = -1;
+static int proto_dpnss                        = -1;
+static int hf_dpnss_msg_grp_id                = -1;
+static int hf_dpnss_cc_msg_type               = -1;
+static int hf_dpnss_e2e_msg_type              = -1;
+static int hf_dpnss_LbL_msg_type              = -1;
+static int hf_dpnss_ext_bit                   = -1;
+static int hf_dpnss_ext_bit_notall            = -1;
+static int hf_dpnss_sic_type                  = -1;
+static int hf_dpnss_sic_details_for_speech    = -1;
+static int hf_dpnss_sic_details_for_data1     = -1;
+static int hf_dpnss_sic_details_for_data2     = -1;
+static int hf_dpnss_dest_addr                 = -1;
+static int hf_dpnss_sic_oct2_data_type        = -1;
+static int hf_dpnss_sic_oct2_duplex           = -1;
 static int hf_dpnss_sic_oct2_sync_data_format = -1;
 static int hf_dpnss_sic_oct2_sync_byte_timing = -1;
-static int hf_dpnss_sic_oct2_net_ind_clk    = -1;
-static int hf_dpnss_sic_oct2_async_data     = -1;
-static int hf_dpnss_sic_oct2_async_flow_ctrl = -1;
-static int hf_dpnss_clearing_cause          = -1;
-static int hf_dpnss_rejection_cause         = -1;
-static int hf_dpnss_man_code                = -1;
-static int hf_dpnss_subcode                 = -1;
-static int hf_dpnss_maintenance_action      = -1;
+static int hf_dpnss_sic_oct2_net_ind_clk      = -1;
+static int hf_dpnss_sic_oct2_async_data       = -1;
+static int hf_dpnss_sic_oct2_async_flow_ctrl  = -1;
+static int hf_dpnss_clearing_cause            = -1;
+static int hf_dpnss_rejection_cause           = -1;
+static int hf_dpnss_man_code                  = -1;
+static int hf_dpnss_subcode                   = -1;
+static int hf_dpnss_maintenance_action        = -1;
 
 /* parameters */
-static int hf_dpnss_a_b_party_addr          = -1;
-static int hf_dpnss_call_idx                = -1;
-
-#define DPNNS_MESSAGE_GROUP_CC          0
-#define DPNNS_MESSAGE_GROUP_E2E         2
-#define DPNNS_MESSAGE_GROUP_LbL         4
-
-#define DPNSS_CC_MSG_ISRM_C             0
-#define DPNSS_CC_MSG_ISRM_I             1
-#define DPNSS_CC_MSG_RM_C               2
-#define DPNSS_CC_MSG_RM_I               3
-#define DPNSS_CC_MSG_CS                 4
-#define DPNSS_CC_MSG_CCM                5
-#define DPNSS_CC_MSG_NIM                6
-#define DPNSS_CC_MSG_CA                 7
-#define DPNSS_CC_MSG_CRM                8
-#define DPNSS_CC_MSG_NAM                9
+static int hf_dpnss_a_b_party_addr            = -1;
+static int hf_dpnss_call_idx                  = -1;
+
+#define DPNNS_MESSAGE_GROUP_CC           0
+#define DPNNS_MESSAGE_GROUP_E2E          2
+#define DPNNS_MESSAGE_GROUP_LbL          4
+
+#define DPNSS_CC_MSG_ISRM_C              0
+#define DPNSS_CC_MSG_ISRM_I              1
+#define DPNSS_CC_MSG_RM_C                2
+#define DPNSS_CC_MSG_RM_I                3
+#define DPNSS_CC_MSG_CS                  4
+#define DPNSS_CC_MSG_CCM                 5
+#define DPNSS_CC_MSG_NIM                 6
+#define DPNSS_CC_MSG_CA                  7
+#define DPNSS_CC_MSG_CRM                 8
+#define DPNSS_CC_MSG_NAM                 9
 #define DPNSS_CC_MSG_RRM                10
 #define DPNSS_CC_MSG_SSRM_I             11
 #define DPNSS_CC_MSG_SSRM_C             12
@@ -382,16 +382,16 @@ static const value_string dpnss_man_code_vals[] = {
 
 
 
-#define DPNSS_NONE                              0
-#define DPNSS_SERV_MAR                          1
-#define DPNSS_STATUS                            2
-#define DPNSS_ROUTE_RES_CLASS                   3
-#define DPNSS_CBR_GRP                           4
-#define DPNSS_FAC_LST_CODE                      5
-#define DPNSS_NO_OF_FUR_TRANS                   6
-#define DPNSS_NO_OF_FUR_ALT_R                   7
-#define DPNSS_INT_CAP_LEV                       8
-#define DPNSS_NESTING_LEVEL                     9
+#define DPNSS_NONE                               0
+#define DPNSS_SERV_MAR                           1
+#define DPNSS_STATUS                             2
+#define DPNSS_ROUTE_RES_CLASS                    3
+#define DPNSS_CBR_GRP                            4
+#define DPNSS_FAC_LST_CODE                       5
+#define DPNSS_NO_OF_FUR_TRANS                    6
+#define DPNSS_NO_OF_FUR_ALT_R                    7
+#define DPNSS_INT_CAP_LEV                        8
+#define DPNSS_NESTING_LEVEL                      9
 #define DPNSS_C_PARTY_ADDR                      10
 #define DPNSS_B_PARTY_ADDR                      11
 #define DPNSS_SIC                               12
@@ -469,8 +469,8 @@ static const value_string dpnss_man_code_vals[] = {
 
 typedef struct {
     gint        id_code_no;
-    const char  *compact_name;
-    const char  *name;
+    const char *compact_name;
+    const char *name;
     gint        par1_num;
     gint        par2_num;
     gint        par3_num;
@@ -744,7 +744,7 @@ dissect_dpnss_sic(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int o
     type_of_data = (octet & 0x70)>>4;
     proto_tree_add_item(tree, hf_dpnss_ext_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
     proto_tree_add_item(tree, hf_dpnss_sic_type, tvb, offset, 1, ENC_BIG_ENDIAN);
-    switch(type_of_data){
+    switch (type_of_data) {
     case 1:
         /* Type of Data (001) : Details for Speech */
         proto_tree_add_item(tree, hf_dpnss_sic_details_for_speech, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -762,14 +762,14 @@ dissect_dpnss_sic(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int o
         break;
     }
     offset++;
-    if((octet&0x80)==0x80){
+    if ((octet&0x80)==0x80) {
         /* Extension bit set
          * Synch/Asynchronous Information
          */
         octet = tvb_get_guint8(tvb,offset);
         type_of_data = octet&0x3;
         proto_tree_add_item(tree, hf_dpnss_ext_bit_notall, tvb, offset, 1, ENC_BIG_ENDIAN);
-        switch(type_of_data){
+        switch (type_of_data) {
         case 3:
             /* Synchronous */
         case 4:
@@ -905,10 +905,10 @@ dissect_dpnns_sup_str_par(tvbuff_t *tvb, proto_tree * tree, int par_type_num, in
     int     par_len;
 
     par_len = par_end_offset - par_start_offset;
-    if(par_len==0){
+    if (par_len==0) {
         par_type_num = DPNSS_NONE;
     }
-    switch (par_type_num){
+    switch (par_type_num) {
     case DPNSS_NONE:
         proto_tree_add_text(tree, tvb, par_start_offset, par_len,"Par: None");
         break;
@@ -1082,9 +1082,9 @@ dissect_dpnss_sup_info_str(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
     tvb_end_offset = tvb_length(tvb);
 
     str_no = 1;
-    while((offset<tvb_end_offset)&&(last_string == FALSE)){
+    while ((offset<tvb_end_offset)&&(last_string == FALSE)) {
         octet = tvb_get_guint8(tvb,offset);
-        if (octet == '*'){
+        if (octet == '*') {
             /* Supplementary Information String */
             start_offset = offset;
             has_par = TRUE;
@@ -1101,29 +1101,29 @@ dissect_dpnss_sup_info_str(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
              * The number may have a trailing alpha character at the end.
              */
             sup_inf_str_end_offset = tvb_find_guint8(tvb, offset, hash_offset-offset, '*');
-            if(sup_inf_str_end_offset==-1){
+            if (sup_inf_str_end_offset==-1) {
                 /* no parameters */
                 has_par = FALSE;
                 sup_inf_str_end_offset = hash_offset;
             }
             sup_inf_str_len = sup_inf_str_end_offset - offset;
             sup_str_num = atoi(tvb_format_text(tvb, offset, sup_inf_str_len));
-            if((sup_str_num != 0) && (sup_str_num < array_length(dpnns_sup_serv_set))){
+            if ((sup_str_num != 0) && (sup_str_num < array_length(dpnns_sup_serv_set))) {
                 proto_tree_add_text(sup_str_tree, tvb,offset,sup_inf_str_len,
                                     "Sup str:%s ", dpnns_sup_serv_set[sup_str_num].compact_name);
                 offset = sup_inf_str_end_offset+1;
                 /* Find parameter(s) */
-                while(has_par){
+                while (has_par) {
                     number_of_found_par++;
                     /* 1:st Parameter */
                     par_start_offset = offset;
                     par_end_offset = tvb_find_guint8(tvb, offset, -1, '*');
-                    if(par_end_offset == -1){
+                    if (par_end_offset == -1) {
                         /* last parameter */
                         par_end_offset = hash_offset;
                         has_par = FALSE;
                     }
-                    switch(number_of_found_par){
+                    switch (number_of_found_par) {
                     case 1:
                         par_type_num = dpnns_sup_serv_set[sup_str_num].par1_num;
                         dissect_dpnns_sup_str_par(tvb,sup_str_tree, par_type_num, par_start_offset, par_end_offset);
@@ -1150,7 +1150,7 @@ dissect_dpnss_sup_info_str(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
             }
             offset = hash_offset+1;
             str_no++;
-        }else{
+        } else {
             last_string = TRUE;
             proto_tree_add_item(tree, hf_dpnss_dest_addr, tvb, offset, -1, ENC_ASCII|ENC_NA);
         }
@@ -1164,20 +1164,20 @@ dissect_dpnss_LbL_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
     proto_item *sic_field_item, *ind_field_item;
     proto_tree *sic_field_tree, *ind_field_tree;
-    int offset = 0;
-    int tvb_end_offset;
-    guint8 octet;
+    int         offset = 0;
+    int         tvb_end_offset;
+    guint8      octet;
 
     tvb_end_offset = tvb_length(tvb);
 
     proto_tree_add_item(tree, hf_dpnss_LbL_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN);
     octet = tvb_get_guint8(tvb,offset)&0x0f;
     offset++;
-    if(check_col(pinfo->cinfo, COL_INFO))
+    if (check_col(pinfo->cinfo, COL_INFO))
         col_add_fstr(pinfo->cinfo, COL_INFO, "%s ",
             val_to_str(octet, dpnss_LbL_msg_short_type_vals, "Unknown (%d)" ));
-    if(tree){
-        switch (octet){
+    if (tree) {
+        switch (octet) {
         case DPNSS_LbL_MSG_LLM_C:
             /* 2.3.1 LINK-by-LINK Message (COMPLETE) - LLM(C)*/
         case DPNSS_LbL_MSG_LLM_I:
@@ -1194,7 +1194,7 @@ dissect_dpnss_LbL_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
             /* Rejection Cause */
             proto_tree_add_item(tree, hf_dpnss_rejection_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
             /* Indication Field (Optional) */
-            if(tvb_end_offset>offset){
+            if (tvb_end_offset>offset) {
                 ind_field_item = proto_tree_add_text(tree, tvb, offset, -1,
                                                      "Indication Field: %s",
                                                      tvb_format_text(tvb,offset,tvb_length_remaining(tvb, offset)));
@@ -1251,7 +1251,7 @@ dissect_dpnss_LbL_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
             break;
         }
     }
-       return offset;
+    return offset;
 }
 
 
@@ -1260,20 +1260,20 @@ dissect_dpnss_e2e_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
     proto_item *sel_field_item, *sic_field_item, *ind_field_item;
     proto_tree *sel_field_tree, *sic_field_tree, *ind_field_tree;
-    int offset = 0;
-    int tvb_end_offset;
-    guint8 octet;
+    int         offset = 0;
+    int         tvb_end_offset;
+    guint8      octet;
 
     tvb_end_offset = tvb_length(tvb);
 
     proto_tree_add_item(tree, hf_dpnss_e2e_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN);
     octet = tvb_get_guint8(tvb,offset)&0x0f;
     offset++;
-    if(check_col(pinfo->cinfo, COL_INFO))
+    if (check_col(pinfo->cinfo, COL_INFO))
         col_add_fstr(pinfo->cinfo, COL_INFO, "%s ",
             val_to_str(octet, dpnss_e2e_msg_short_type_vals, "Unknown (%d)" ));
-    if(tree){
-        switch (octet){
+    if (tree) {
+        switch (octet) {
         case DPNSS_E2E_MSG_EEM_C:
         /* 2.2.1 END-to-END Message (COMPLETE) - EEM(C) */
         case DPNSS_E2E_MSG_EEM_I:
@@ -1293,7 +1293,7 @@ dissect_dpnss_e2e_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
             proto_tree_add_item(tree, hf_dpnss_clearing_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
             offset++;
             /* Indication Field (Optional) */
-            if(tvb_end_offset>offset){
+            if (tvb_end_offset>offset) {
                 ind_field_item = proto_tree_add_text(tree, tvb, offset, -1,
                                                      "Indication Field: %s",
                                                      tvb_format_text(tvb,offset,tvb_length_remaining(tvb, offset)));
@@ -1337,7 +1337,7 @@ dissect_dpnss_e2e_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
             proto_tree_add_item(tree, hf_dpnss_man_code, tvb, offset, 1, ENC_BIG_ENDIAN);
             proto_tree_add_item(tree, hf_dpnss_subcode, tvb, offset, 1, ENC_BIG_ENDIAN);
             offset++;
-            if((octet&0x80)==0x80){
+            if ((octet&0x80)==0x80) {
                 /* Extension bit set */
                 offset++;
             }
@@ -1358,20 +1358,20 @@ dissect_dpnss_cc_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
     proto_item *sel_field_item, *sic_field_item, *ind_field_item;
     proto_tree *sel_field_tree, *sic_field_tree, *ind_field_tree;
-    int offset = 0;
-    int tvb_end_offset;
-    guint8 octet;
+    int         offset = 0;
+    int         tvb_end_offset;
+    guint8      octet;
 
     tvb_end_offset = tvb_length(tvb);
     proto_tree_add_item(tree, hf_dpnss_cc_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN);
     octet = tvb_get_guint8(tvb,offset)&0x0f;
     offset++;
-    if(check_col(pinfo->cinfo, COL_INFO))
+    if (check_col(pinfo->cinfo, COL_INFO))
         col_add_fstr(pinfo->cinfo, COL_INFO, "%s ",
             val_to_str(octet, dpnss_cc_msg_short_type_vals, "Unknown (%d)" ));
 
-    if(tree){
-        switch (octet){
+    if (tree) {
+        switch (octet) {
         case DPNSS_CC_MSG_ISRM_C:
             /* 2.1.1 INITIAL SERVICE REQUEST Message (COMPLETE) - ISRM (C) */
             /* fall trough */
@@ -1404,7 +1404,7 @@ dissect_dpnss_cc_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
             break;
         case DPNSS_CC_MSG_CCM:
             /* 2.1.5 CALL CONNECTED Message - CCM */
-            if(tvb_end_offset>offset){
+            if (tvb_end_offset>offset) {
                 /* Indication Field (Optional) */
                 ind_field_item = proto_tree_add_text(tree, tvb, offset, -1,
                                                      "Indication Field: %s",
@@ -1432,7 +1432,7 @@ dissect_dpnss_cc_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
             proto_tree_add_item(tree, hf_dpnss_clearing_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
             offset++;
             /* Indication Field (Optional) */
-            if(tvb_end_offset>offset){
+            if (tvb_end_offset>offset) {
                 ind_field_item = proto_tree_add_text(tree, tvb, offset, -1,
                                                      "Indication Field: %s",
                                                      tvb_format_text(tvb,offset,tvb_length_remaining(tvb, offset)));
@@ -1445,7 +1445,7 @@ dissect_dpnss_cc_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
             /* Rejection Cause */
             proto_tree_add_item(tree, hf_dpnss_rejection_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
             /* Indication Field (Optional) */
-            if(tvb_end_offset>offset){
+            if (tvb_end_offset>offset) {
                 ind_field_item = proto_tree_add_text(tree, tvb, offset, -1,
                                                      "Indication Field: %s",
                                                      tvb_format_text(tvb,offset,tvb_length_remaining(tvb, offset)));
@@ -1465,7 +1465,7 @@ dissect_dpnss_cc_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         case DPNSS_CC_MSG_SSRM_C:
             /* 2.1.12 SUBSEQUENT SERVICE REQUEST Message (COMPLETE) - SSRM(C) */
             /* Selection Field (Optional) */
-            if(tvb_end_offset>offset){
+            if (tvb_end_offset>offset) {
                 sel_field_item = proto_tree_add_text(tree, tvb, offset, -1,
                                                      "Selection Field: %s",
                                                      tvb_format_text(tvb,offset,tvb_length_remaining(tvb, offset)));
@@ -1487,10 +1487,10 @@ dissect_dpnss_cc_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 static void
 dissect_dpnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-    int offset = 0;
+    int         offset = 0;
     proto_item *item;
     proto_tree *dpnss_tree;
-    guint8 octet;
+    guint8      octet;
 
 /* Make entries in Protocol column and Info column on summary display */
     col_set_str(pinfo->cinfo, COL_PROTOCOL, "DPNSS");
@@ -1499,7 +1499,7 @@ dissect_dpnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     dpnss_tree = proto_item_add_subtree(item, ett_dpnss);
     proto_tree_add_item(dpnss_tree, hf_dpnss_msg_grp_id, tvb, offset, 1, ENC_BIG_ENDIAN);
     octet = tvb_get_guint8(tvb,offset)>>4;
-    switch (octet){
+    switch (octet) {
     case DPNNS_MESSAGE_GROUP_CC:
         /* Call Control Message Group */
         dissect_dpnss_cc_msg(tvb, pinfo, dpnss_tree);
@@ -1521,8 +1521,6 @@ dissect_dpnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 void
 proto_register_dpnss(void)
 {
-
-
 /* Setup list of header fields  See Section 1.6.1 for details*/
     static hf_register_info hf[] = {
         { &hf_dpnss_msg_grp_id,
@@ -1665,7 +1663,7 @@ proto_register_dpnss(void)
     proto_dpnss = proto_register_protocol("Digital Private Signalling System No 1","DPNSS", "dpnss");
     register_dissector("dpnss", dissect_dpnss, proto_dpnss);
 
-    /* Required function calls to register the header fields and subtrees used */
+/* Required function calls to register the header fields and subtrees used */
     proto_register_field_array(proto_dpnss, hf, array_length(hf));
     proto_register_subtree_array(ett, array_length(ett));
 
index 5fe95ceb0c0152caf785131b8dacb412f9cb9a5e..b5f37ee501e657b3ae74d579b04784d883764193 100644 (file)
 *   of the DDM commands and reply messages are in EBCDIC.
 *
 *   Documentation:
-*      DRDA Version 3 Vol. 3: Distributed Relational Database Architecture,
-*      Open Group.
-*      Version 3 is no longer available; for the latest version, see
+*   DRDA Version 3 Vol. 3: Distributed Relational Database Architecture,
+*   Open Group.
+*   Version 3 is no longer available; for the latest version, see
 *
-*              http://www.opengroup.org/dbiop/
+*       http://www.opengroup.org/dbiop/
 *
-*      Reference for Remote DRDA Requesters and Servers, IBM.
+*   Reference for Remote DRDA Requesters and Servers, IBM.
 *
-*              https://www-304.ibm.com/support/docview.wss?uid=pub1sc18985301
+*       https://www-304.ibm.com/support/docview.wss?uid=pub1sc18985301
 */
 
 #ifdef HAVE_CONFIG_H
@@ -85,580 +85,578 @@ static dissector_handle_t drda_tcp_handle;
 
 static gboolean drda_desegment = TRUE;
 
-#define DRDA_MAGIC    0xD0
-
-#define DRDA_CP_DATA        0x0000
-#define DRDA_CP_CODPNT      0x000C
-#define DRDA_CP_FDODSC      0x0010
-#define DRDA_CP_TYPDEFNAM   0x002F
-#define DRDA_CP_TYPDEFOVR   0x0035
-#define DRDA_CP_CODPNTDR    0x0064
-#define DRDA_CP_EXCSAT      0x1041
-#define DRDA_CP_SYNCCTL     0x1055
-#define DRDA_CP_SYNCRSY     0x1069
-#define DRDA_CP_ACCSEC      0x106D
-#define DRDA_CP_SECCHK      0x106E
-#define DRDA_CP_SYNCLOG     0x106F
-#define DRDA_CP_RSCTYP      0x111F
-#define DRDA_CP_RSNCOD      0x1127
-#define DRDA_CP_RSCNAM      0x112D
-#define DRDA_CP_PRDID       0x112E
-#define DRDA_CP_PRCCNVCD    0x113F
-#define DRDA_CP_VRSNAM      0x1144
-#define DRDA_CP_SRVCLSNM    0x1147
-#define DRDA_CP_SVRCOD      0x1149
-#define DRDA_CP_SYNERRCD    0x114A
-#define DRDA_CP_SRVDGN      0x1153
-#define DRDA_CP_SRVRLSLV    0x115A
-#define DRDA_CP_SPVNAM      0x115D
-#define DRDA_CP_EXTNAM      0x115E
-#define DRDA_CP_SRVNAM      0x116D
-#define DRDA_CP_SECMGRNM    0x1196
-#define DRDA_CP_DEPERRCD    0x119B
-#define DRDA_CP_CCSIDSBC    0x119C
-#define DRDA_CP_CCSIDDBC    0x119D
-#define DRDA_CP_CCSIDMBC    0x119E
-#define DRDA_CP_USRID       0x11A0
-#define DRDA_CP_PASSWORD    0x11A1
-#define DRDA_CP_SECMEC      0x11A2
-#define DRDA_CP_SECCHKCD    0x11A4
-#define DRDA_CP_SVCERRNO    0x11B4
-#define DRDA_CP_SECTKN      0x11DC
-#define DRDA_CP_NEWPASSWORD 0x11DE
-#define DRDA_CP_MGRLVLRM    0x1210
-#define DRDA_CP_MGRDEPRM    0x1218
-#define DRDA_CP_SECCHKRM    0x1219
-#define DRDA_CP_CMDATHRM    0x121C
-#define DRDA_CP_AGNPRMRM    0x1232
-#define DRDA_CP_RSCLMTRM    0x1233
-#define DRDA_CP_PRCCNVRM    0x1245
-#define DRDA_CP_CMDCMPRM    0x124B
-#define DRDA_CP_SYNTAXRM    0x124C
-#define DRDA_CP_CMDNSPRM    0x1250
-#define DRDA_CP_PRMNSPRM    0x1251
-#define DRDA_CP_VALNSPRM    0x1252
-#define DRDA_CP_OBJNSPRM    0x1253
-#define DRDA_CP_CMDCHKRM    0x1254
-#define DRDA_CP_TRGNSPRM    0x125F
-#define DRDA_CP_AGENT       0x1403
-#define DRDA_CP_MGRLVLLS    0x1404
-#define DRDA_CP_SUPERVISOR  0x143C
-#define DRDA_CP_SECMGR      0x1440
-#define DRDA_CP_EXCSATRD    0x1443
-#define DRDA_CP_CMNAPPC     0x1444
-#define DRDA_CP_DICTIONARY  0x1458
-#define DRDA_CP_MGRLVLN     0x1473
-#define DRDA_CP_CMNTCPIP    0x1474
-#define DRDA_CP_FDODTA      0x147A
-#define DRDA_CP_CMNSYNCPT   0x147C
-#define DRDA_CP_ACCSECRD    0x14AC
-#define DRDA_CP_SYNCPTMGR   0x14C0
-#define DRDA_CP_RSYNCMGR    0x14C1
-#define DRDA_CP_CCSIDMGR    0x14CC
-#define DRDA_CP_MONITOR     0x1900
-#define DRDA_CP_MONITORRD   0x1C00
-#define DRDA_CP_XAMGR       0x1C01
-#define DRDA_CP_ACCRDB      0x2001
-#define DRDA_CP_BGNBND      0x2002
-#define DRDA_CP_BNDSQLSTT   0x2004
-#define DRDA_CP_CLSQRY      0x2005
-#define DRDA_CP_CNTQRY      0x2006
-#define DRDA_CP_DRPPKG      0x2007
-#define DRDA_CP_DSCSQLSTT   0x2008
-#define DRDA_CP_ENDBND      0x2009
-#define DRDA_CP_EXCSQLIMM   0x200A
-#define DRDA_CP_EXCSQLSTT   0x200B
-#define DRDA_CP_OPNQRY      0x200C
-#define DRDA_CP_PRPSQLSTT   0x200D
-#define DRDA_CP_RDBCMM      0x200E
-#define DRDA_CP_RDBRLLBCK   0x200F
-#define DRDA_CP_REBIND      0x2010
-#define DRDA_CP_DSCRDBTBL   0x2012
-#define DRDA_CP_EXCSQLSET   0x2014
-#define DRDA_CP_DSCERRCD    0x2101
-#define DRDA_CP_QRYPRCTYP   0x2102
-#define DRDA_CP_RDBINTTKN   0x2103
-#define DRDA_CP_PRDDTA      0x2104
-#define DRDA_CP_RDBCMTOK    0x2105
-#define DRDA_CP_RDBCOLID    0x2108
-#define DRDA_CP_PKGID       0x2109
-#define DRDA_CP_PKGCNSTKN   0x210D
-#define DRDA_CP_RTNSETSTT   0x210E
-#define DRDA_CP_RDBACCCL    0x210F
-#define DRDA_CP_RDBNAM      0x2110
-#define DRDA_CP_OUTEXP      0x2111
-#define DRDA_CP_PKGNAMCT    0x2112
-#define DRDA_CP_PKGNAMCSN   0x2113
-#define DRDA_CP_QRYBLKSZ    0x2114
-#define DRDA_CP_UOWDSP      0x2115
-#define DRDA_CP_RTNSQLDA    0x2116
-#define DRDA_CP_RDBALWUPD   0x211A
-#define DRDA_CP_SQLCSRHLD   0x211F
-#define DRDA_CP_STTSTRDEL   0x2120
-#define DRDA_CP_STTDECDEL   0x2121
-#define DRDA_CP_PKGDFTCST   0x2125
-#define DRDA_CP_QRYBLKCTL   0x2132
-#define DRDA_CP_CRRTKN      0x2135
-#define DRDA_CP_PRCNAM      0x2138
-#define DRDA_CP_PKGSNLST    0x2139
-#define DRDA_CP_NBRROW      0x213A
-#define DRDA_CP_TRGDFTRT    0x213B
-#define DRDA_CP_QRYRELSCR   0x213C
-#define DRDA_CP_QRYROWNBR   0x213D
-#define DRDA_CP_QRYRFRTBL   0x213E
-#define DRDA_CP_MAXRSLCNT   0x2140
-#define DRDA_CP_MAXBLKEXT   0x2141
-#define DRDA_CP_RSLSETFLG   0x2142
-#define DRDA_CP_TYPSQLDA    0x2146
-#define DRDA_CP_OUTOVROPT   0x2147
-#define DRDA_CP_RTNEXTDTA   0x2148
-#define DRDA_CP_QRYATTSCR   0x2149
-#define DRDA_CP_QRYATTUPD   0x2150
-#define DRDA_CP_QRYSCRORN   0x2152
-#define DRDA_CP_QRYROWSNS   0x2153
-#define DRDA_CP_QRYBLKRST   0x2154
-#define DRDA_CP_QRYRTNDTA   0x2155
-#define DRDA_CP_QRYROWSET   0x2156
-#define DRDA_CP_QRYATTSNS   0x2157
-#define DRDA_CP_QRYINSID    0x215B
-#define DRDA_CP_QRYCLSIMP   0x215D
-#define DRDA_CP_QRYCLSRLS   0x215E
-#define DRDA_CP_QRYOPTVAL   0x215F
-#define DRDA_CP_DIAGLVL     0x2160
-#define DRDA_CP_ACCRDBRM    0x2201
-#define DRDA_CP_QRYNOPRM    0x2202
-#define DRDA_CP_RDBNACRM    0x2204
-#define DRDA_CP_OPNQRYRM    0x2205
-#define DRDA_CP_PKGBNARM    0x2206
-#define DRDA_CP_RDBACCRM    0x2207
-#define DRDA_CP_BGNBNDRM    0x2208
-#define DRDA_CP_PKGBPARM    0x2209
-#define DRDA_CP_DSCINVRM    0x220A
-#define DRDA_CP_ENDQRYRM    0x220B
-#define DRDA_CP_ENDUOWRM    0x220C
-#define DRDA_CP_ABNUOWRM    0x220D
-#define DRDA_CP_DTAMCHRM    0x220E
-#define DRDA_CP_QRYPOPRM    0x220F
-#define DRDA_CP_RDBNFNRM    0x2211
-#define DRDA_CP_OPNQFLRM    0x2212
-#define DRDA_CP_SQLERRRM    0x2213
-#define DRDA_CP_RDBUPDRM    0x2218
-#define DRDA_CP_RSLSETRM    0x2219
-#define DRDA_CP_RDBAFLRM    0x221A
-#define DRDA_CP_CMDVLTRM    0x221D
-#define DRDA_CP_CMMRQSRM    0x2225
-#define DRDA_CP_RDBATHRM    0x22CB
-#define DRDA_CP_SQLAM       0x2407
-#define DRDA_CP_SQLCARD     0x2408
-#define DRDA_CP_SQLCINRD    0x240B
-#define DRDA_CP_SQLRSLRD    0x240E
-#define DRDA_CP_RDB         0x240F
-#define DRDA_CP_FRCFIXROW   0x2410
-#define DRDA_CP_SQLDARD     0x2411
-#define DRDA_CP_SQLDTA      0x2412
-#define DRDA_CP_SQLDTARD    0x2413
-#define DRDA_CP_SQLSTT      0x2414
-#define DRDA_CP_OUTOVR      0x2415
-#define DRDA_CP_LMTBLKPRC   0x2417
-#define DRDA_CP_FIXROWPRC   0x2418
-#define DRDA_CP_SQLSTTVRB   0x2419
-#define DRDA_CP_QRYDSC      0x241A
-#define DRDA_CP_QRYDTA      0x241B
-#define DRDA_CP_CSTMBCS     0x2435
-#define DRDA_CP_SRVLST      0x244E
-#define DRDA_CP_SQLATTR     0x2450
-
-#define DRDA_DSSFMT_SAME_CORR  0x01
-#define DRDA_DSSFMT_CONTINUE   0x02
-#define DRDA_DSSFMT_CHAINED    0x04
-#define DRDA_DSSFMT_RESERVED   0x08
-
-#define DRDA_DSSFMT_RQSDSS   0x01
-#define DRDA_DSSFMT_RPYDSS   0x02
-#define DRDA_DSSFMT_OBJDSS   0x03
-#define DRDA_DSSFMT_CMNDSS   0x04
-#define DRDA_DSSFMT_NORPYDSS 0x05
+#define DRDA_MAGIC  0xD0
+
+#define DRDA_CP_DATA          0x0000
+#define DRDA_CP_CODPNT        0x000C
+#define DRDA_CP_FDODSC        0x0010
+#define DRDA_CP_TYPDEFNAM     0x002F
+#define DRDA_CP_TYPDEFOVR     0x0035
+#define DRDA_CP_CODPNTDR      0x0064
+#define DRDA_CP_EXCSAT        0x1041
+#define DRDA_CP_SYNCCTL       0x1055
+#define DRDA_CP_SYNCRSY       0x1069
+#define DRDA_CP_ACCSEC        0x106D
+#define DRDA_CP_SECCHK        0x106E
+#define DRDA_CP_SYNCLOG       0x106F
+#define DRDA_CP_RSCTYP        0x111F
+#define DRDA_CP_RSNCOD        0x1127
+#define DRDA_CP_RSCNAM        0x112D
+#define DRDA_CP_PRDID         0x112E
+#define DRDA_CP_PRCCNVCD      0x113F
+#define DRDA_CP_VRSNAM        0x1144
+#define DRDA_CP_SRVCLSNM      0x1147
+#define DRDA_CP_SVRCOD        0x1149
+#define DRDA_CP_SYNERRCD      0x114A
+#define DRDA_CP_SRVDGN        0x1153
+#define DRDA_CP_SRVRLSLV      0x115A
+#define DRDA_CP_SPVNAM        0x115D
+#define DRDA_CP_EXTNAM        0x115E
+#define DRDA_CP_SRVNAM        0x116D
+#define DRDA_CP_SECMGRNM      0x1196
+#define DRDA_CP_DEPERRCD      0x119B
+#define DRDA_CP_CCSIDSBC      0x119C
+#define DRDA_CP_CCSIDDBC      0x119D
+#define DRDA_CP_CCSIDMBC      0x119E
+#define DRDA_CP_USRID         0x11A0
+#define DRDA_CP_PASSWORD      0x11A1
+#define DRDA_CP_SECMEC        0x11A2
+#define DRDA_CP_SECCHKCD      0x11A4
+#define DRDA_CP_SVCERRNO      0x11B4
+#define DRDA_CP_SECTKN        0x11DC
+#define DRDA_CP_NEWPASSWORD   0x11DE
+#define DRDA_CP_MGRLVLRM      0x1210
+#define DRDA_CP_MGRDEPRM      0x1218
+#define DRDA_CP_SECCHKRM      0x1219
+#define DRDA_CP_CMDATHRM      0x121C
+#define DRDA_CP_AGNPRMRM      0x1232
+#define DRDA_CP_RSCLMTRM      0x1233
+#define DRDA_CP_PRCCNVRM      0x1245
+#define DRDA_CP_CMDCMPRM      0x124B
+#define DRDA_CP_SYNTAXRM      0x124C
+#define DRDA_CP_CMDNSPRM      0x1250
+#define DRDA_CP_PRMNSPRM      0x1251
+#define DRDA_CP_VALNSPRM      0x1252
+#define DRDA_CP_OBJNSPRM      0x1253
+#define DRDA_CP_CMDCHKRM      0x1254
+#define DRDA_CP_TRGNSPRM      0x125F
+#define DRDA_CP_AGENT         0x1403
+#define DRDA_CP_MGRLVLLS      0x1404
+#define DRDA_CP_SUPERVISOR    0x143C
+#define DRDA_CP_SECMGR        0x1440
+#define DRDA_CP_EXCSATRD      0x1443
+#define DRDA_CP_CMNAPPC       0x1444
+#define DRDA_CP_DICTIONARY    0x1458
+#define DRDA_CP_MGRLVLN       0x1473
+#define DRDA_CP_CMNTCPIP      0x1474
+#define DRDA_CP_FDODTA        0x147A
+#define DRDA_CP_CMNSYNCPT     0x147C
+#define DRDA_CP_ACCSECRD      0x14AC
+#define DRDA_CP_SYNCPTMGR     0x14C0
+#define DRDA_CP_RSYNCMGR      0x14C1
+#define DRDA_CP_CCSIDMGR      0x14CC
+#define DRDA_CP_MONITOR       0x1900
+#define DRDA_CP_MONITORRD     0x1C00
+#define DRDA_CP_XAMGR         0x1C01
+#define DRDA_CP_ACCRDB        0x2001
+#define DRDA_CP_BGNBND        0x2002
+#define DRDA_CP_BNDSQLSTT     0x2004
+#define DRDA_CP_CLSQRY        0x2005
+#define DRDA_CP_CNTQRY        0x2006
+#define DRDA_CP_DRPPKG        0x2007
+#define DRDA_CP_DSCSQLSTT     0x2008
+#define DRDA_CP_ENDBND        0x2009
+#define DRDA_CP_EXCSQLIMM     0x200A
+#define DRDA_CP_EXCSQLSTT     0x200B
+#define DRDA_CP_OPNQRY        0x200C
+#define DRDA_CP_PRPSQLSTT     0x200D
+#define DRDA_CP_RDBCMM        0x200E
+#define DRDA_CP_RDBRLLBCK     0x200F
+#define DRDA_CP_REBIND        0x2010
+#define DRDA_CP_DSCRDBTBL     0x2012
+#define DRDA_CP_EXCSQLSET     0x2014
+#define DRDA_CP_DSCERRCD      0x2101
+#define DRDA_CP_QRYPRCTYP     0x2102
+#define DRDA_CP_RDBINTTKN     0x2103
+#define DRDA_CP_PRDDTA        0x2104
+#define DRDA_CP_RDBCMTOK      0x2105
+#define DRDA_CP_RDBCOLID      0x2108
+#define DRDA_CP_PKGID         0x2109
+#define DRDA_CP_PKGCNSTKN     0x210D
+#define DRDA_CP_RTNSETSTT     0x210E
+#define DRDA_CP_RDBACCCL      0x210F
+#define DRDA_CP_RDBNAM        0x2110
+#define DRDA_CP_OUTEXP        0x2111
+#define DRDA_CP_PKGNAMCT      0x2112
+#define DRDA_CP_PKGNAMCSN     0x2113
+#define DRDA_CP_QRYBLKSZ      0x2114
+#define DRDA_CP_UOWDSP        0x2115
+#define DRDA_CP_RTNSQLDA      0x2116
+#define DRDA_CP_RDBALWUPD     0x211A
+#define DRDA_CP_SQLCSRHLD     0x211F
+#define DRDA_CP_STTSTRDEL     0x2120
+#define DRDA_CP_STTDECDEL     0x2121
+#define DRDA_CP_PKGDFTCST     0x2125
+#define DRDA_CP_QRYBLKCTL     0x2132
+#define DRDA_CP_CRRTKN        0x2135
+#define DRDA_CP_PRCNAM        0x2138
+#define DRDA_CP_PKGSNLST      0x2139
+#define DRDA_CP_NBRROW        0x213A
+#define DRDA_CP_TRGDFTRT      0x213B
+#define DRDA_CP_QRYRELSCR     0x213C
+#define DRDA_CP_QRYROWNBR     0x213D
+#define DRDA_CP_QRYRFRTBL     0x213E
+#define DRDA_CP_MAXRSLCNT     0x2140
+#define DRDA_CP_MAXBLKEXT     0x2141
+#define DRDA_CP_RSLSETFLG     0x2142
+#define DRDA_CP_TYPSQLDA      0x2146
+#define DRDA_CP_OUTOVROPT     0x2147
+#define DRDA_CP_RTNEXTDTA     0x2148
+#define DRDA_CP_QRYATTSCR     0x2149
+#define DRDA_CP_QRYATTUPD     0x2150
+#define DRDA_CP_QRYSCRORN     0x2152
+#define DRDA_CP_QRYROWSNS     0x2153
+#define DRDA_CP_QRYBLKRST     0x2154
+#define DRDA_CP_QRYRTNDTA     0x2155
+#define DRDA_CP_QRYROWSET     0x2156
+#define DRDA_CP_QRYATTSNS     0x2157
+#define DRDA_CP_QRYINSID      0x215B
+#define DRDA_CP_QRYCLSIMP     0x215D
+#define DRDA_CP_QRYCLSRLS     0x215E
+#define DRDA_CP_QRYOPTVAL     0x215F
+#define DRDA_CP_DIAGLVL       0x2160
+#define DRDA_CP_ACCRDBRM      0x2201
+#define DRDA_CP_QRYNOPRM      0x2202
+#define DRDA_CP_RDBNACRM      0x2204
+#define DRDA_CP_OPNQRYRM      0x2205
+#define DRDA_CP_PKGBNARM      0x2206
+#define DRDA_CP_RDBACCRM      0x2207
+#define DRDA_CP_BGNBNDRM      0x2208
+#define DRDA_CP_PKGBPARM      0x2209
+#define DRDA_CP_DSCINVRM      0x220A
+#define DRDA_CP_ENDQRYRM      0x220B
+#define DRDA_CP_ENDUOWRM      0x220C
+#define DRDA_CP_ABNUOWRM      0x220D
+#define DRDA_CP_DTAMCHRM      0x220E
+#define DRDA_CP_QRYPOPRM      0x220F
+#define DRDA_CP_RDBNFNRM      0x2211
+#define DRDA_CP_OPNQFLRM      0x2212
+#define DRDA_CP_SQLERRRM      0x2213
+#define DRDA_CP_RDBUPDRM      0x2218
+#define DRDA_CP_RSLSETRM      0x2219
+#define DRDA_CP_RDBAFLRM      0x221A
+#define DRDA_CP_CMDVLTRM      0x221D
+#define DRDA_CP_CMMRQSRM      0x2225
+#define DRDA_CP_RDBATHRM      0x22CB
+#define DRDA_CP_SQLAM         0x2407
+#define DRDA_CP_SQLCARD       0x2408
+#define DRDA_CP_SQLCINRD      0x240B
+#define DRDA_CP_SQLRSLRD      0x240E
+#define DRDA_CP_RDB           0x240F
+#define DRDA_CP_FRCFIXROW     0x2410
+#define DRDA_CP_SQLDARD       0x2411
+#define DRDA_CP_SQLDTA        0x2412
+#define DRDA_CP_SQLDTARD      0x2413
+#define DRDA_CP_SQLSTT        0x2414
+#define DRDA_CP_OUTOVR        0x2415
+#define DRDA_CP_LMTBLKPRC     0x2417
+#define DRDA_CP_FIXROWPRC     0x2418
+#define DRDA_CP_SQLSTTVRB     0x2419
+#define DRDA_CP_QRYDSC        0x241A
+#define DRDA_CP_QRYDTA        0x241B
+#define DRDA_CP_CSTMBCS       0x2435
+#define DRDA_CP_SRVLST        0x244E
+#define DRDA_CP_SQLATTR       0x2450
+
+#define DRDA_DSSFMT_SAME_CORR 0x01
+#define DRDA_DSSFMT_CONTINUE  0x02
+#define DRDA_DSSFMT_CHAINED   0x04
+#define DRDA_DSSFMT_RESERVED  0x08
+
+#define DRDA_DSSFMT_RQSDSS    0x01
+#define DRDA_DSSFMT_RPYDSS    0x02
+#define DRDA_DSSFMT_OBJDSS    0x03
+#define DRDA_DSSFMT_CMNDSS    0x04
+#define DRDA_DSSFMT_NORPYDSS  0x05
 
 #define DRDA_TEXT_DDM   "DDM"
 #define DRDA_TEXT_PARAM "Parameter"
 
 static const value_string drda_opcode_vals[] = {
-  { DRDA_CP_DATA,         "Data" },
-  { DRDA_CP_CODPNT,       "Code Point" },
-  { DRDA_CP_FDODSC,       "FD:OCA Data Descriptor" },
-  { DRDA_CP_TYPDEFNAM,    "Data Type Definition Name" },
-  { DRDA_CP_TYPDEFOVR,    "TYPDEF Overrides" },
-  { DRDA_CP_CODPNTDR,     "Code Point Data Representation" },
-  { DRDA_CP_EXCSAT,       "Exchange Server Attributes" },
-  { DRDA_CP_SYNCCTL,      "Sync Point Control Request" },
-  { DRDA_CP_SYNCRSY,      "Sync Point Resync Command" },
-  { DRDA_CP_ACCSEC,       "Access Security" },
-  { DRDA_CP_SECCHK,       "Security Check" },
-  { DRDA_CP_SYNCLOG,      "Sync Point Log" },
-  { DRDA_CP_RSCTYP,       "Resource Type Information" },
-  { DRDA_CP_RSNCOD,       "Reason Code Information" },
-  { DRDA_CP_RSCNAM,       "Resource Name Information" },
-  { DRDA_CP_PRDID,        "Product-Specific Identifier" },
-  { DRDA_CP_PRCCNVCD,     "Conversation Protocol Error Code" },
-  { DRDA_CP_VRSNAM,       "Version Name" },
-  { DRDA_CP_SRVCLSNM,     "Server Class Name" },
-  { DRDA_CP_SVRCOD,       "Severity Code" },
-  { DRDA_CP_SYNERRCD,     "Syntax Error Code" },
-  { DRDA_CP_SRVDGN,       "Server Diagnostic Information" },
-  { DRDA_CP_SRVRLSLV,     "Server Product Release Level" },
-  { DRDA_CP_SPVNAM,       "Supervisor Name" },
-  { DRDA_CP_EXTNAM,       "External Name" },
-  { DRDA_CP_SRVNAM,       "Server Name" },
-  { DRDA_CP_SECMGRNM,     "Security Manager Name" },
-  { DRDA_CP_DEPERRCD,     "Manager Dependency Error Code" },
-  { DRDA_CP_CCSIDSBC,     "CCSID for Single-Byte Characters" },
-  { DRDA_CP_CCSIDDBC,     "CCSID for Double-byte Characters" },
-  { DRDA_CP_CCSIDMBC,     "CCSID for Mixed-byte Characters" },
-  { DRDA_CP_USRID,        "User ID at the Target System" },
-  { DRDA_CP_PASSWORD,     "Password" },
-  { DRDA_CP_SECMEC,       "Security Mechanism" },
-  { DRDA_CP_SECCHKCD,     "Security Check Code" },
-  { DRDA_CP_SVCERRNO,     "Security Service ErrorNumber" },
-  { DRDA_CP_SECTKN,       "Security Token" },
-  { DRDA_CP_NEWPASSWORD,  "New Password" },
-  { DRDA_CP_MGRLVLRM,     "Manager-Level Conflict" },
-  { DRDA_CP_MGRDEPRM,     "Manager Dependency Error" },
-  { DRDA_CP_SECCHKRM,     "Security Check" },
-  { DRDA_CP_CMDATHRM,     "Not Authorized to Command" },
-  { DRDA_CP_AGNPRMRM,     "Permanent Agent Error" },
-  { DRDA_CP_RSCLMTRM,     "Resource Limits Reached" },
-  { DRDA_CP_PRCCNVRM,     "Conversational Protocol Error" },
-  { DRDA_CP_CMDCMPRM,     "Command Processing Completed" },
-  { DRDA_CP_SYNTAXRM,     "Data Stream Syntax Error" },
-  { DRDA_CP_CMDNSPRM,     "Command Not Supported" },
-  { DRDA_CP_PRMNSPRM,     "Parameter Not Supported" },
-  { DRDA_CP_VALNSPRM,     "Parameter Value Not Supported" },
-  { DRDA_CP_OBJNSPRM,     "Object Not Supported" },
-  { DRDA_CP_CMDCHKRM,     "Command Check" },
-  { DRDA_CP_TRGNSPRM,     "Target Not Supported" },
-  { DRDA_CP_AGENT,        "Agent" },
-  { DRDA_CP_MGRLVLLS,     "Manager-Level List" },
-  { DRDA_CP_SUPERVISOR,   "Supervisor" },
-  { DRDA_CP_SECMGR,       "Security Manager" },
-  { DRDA_CP_EXCSATRD,     "Server Attributes Reply Data" },
-  { DRDA_CP_CMNAPPC,      "LU 6.2 Conversational Communications Manager" },
-  { DRDA_CP_DICTIONARY,   "Dictionary" },
-  { DRDA_CP_MGRLVLN,      "Manager-Level Number Attribute" },
-  { DRDA_CP_CMNTCPIP,     "TCP/IP CommunicationManager" },
-  { DRDA_CP_FDODTA,       "FD:OCA Data" },
-  { DRDA_CP_CMNSYNCPT,
-               "SNA LU 6.2 Sync Point Conversational Communications Manager" },
-  { DRDA_CP_ACCSECRD,     "Access Security Reply Data" },
-  { DRDA_CP_SYNCPTMGR,    "Sync Point Manager" },
-  { DRDA_CP_RSYNCMGR,     "ResynchronizationManager" },
-  { DRDA_CP_CCSIDMGR,     "CCSID Manager" },
-  { DRDA_CP_MONITOR,      "Monitor Events" },
-  { DRDA_CP_MONITORRD,    "Monitor Reply Data" },
-  { DRDA_CP_XAMGR,        "XAManager" },
-  { DRDA_CP_ACCRDB,       "Access RDB" },
-  { DRDA_CP_BGNBND,       "Begin Binding a Package to an RDB" },
-  { DRDA_CP_BNDSQLSTT,    "Bind SQL Statement to an RDB Package" },
-  { DRDA_CP_CLSQRY,       "Close Query" },
-  { DRDA_CP_CNTQRY,       "Continue Query" },
-  { DRDA_CP_DRPPKG,       "Drop RDB Package" },
-  { DRDA_CP_DSCSQLSTT,    "Describe SQL Statement" },
-  { DRDA_CP_ENDBND,       "End Binding a Package to an RDB" },
-  { DRDA_CP_EXCSQLIMM,    "Execute Immediate SQL Statement" },
-  { DRDA_CP_EXCSQLSTT,    "Execute SQL Statement" },
-  { DRDA_CP_OPNQRY,       "Open Query" },
-  { DRDA_CP_PRPSQLSTT,    "Prepare SQL Statement" },
-  { DRDA_CP_RDBCMM,       "RDB Commit Unit of Work" },
-  { DRDA_CP_RDBRLLBCK,    "RDB Rollback Unit of Work" },
-  { DRDA_CP_REBIND,       "Rebind an Existing RDB Package" },
-  { DRDA_CP_DSCRDBTBL,    "Describe RDB Table" },
-  { DRDA_CP_EXCSQLSET,    "Set SQL Environment" },
-  { DRDA_CP_DSCERRCD,     "Description Error Code" },
-  { DRDA_CP_QRYPRCTYP,    "Query Protocol Type" },
-  { DRDA_CP_RDBINTTKN,    "RDB Interrupt Token" },
-  { DRDA_CP_PRDDTA,       "Product-Specific Data" },
-  { DRDA_CP_RDBCMTOK,     "RDB Commit Allowed" },
-  { DRDA_CP_RDBCOLID,     "RDB Collection Identifier" },
-  { DRDA_CP_PKGID,        "RDB Package Identifier" },
-  { DRDA_CP_PKGCNSTKN,    "RDB Package Consistency Token" },
-  { DRDA_CP_RTNSETSTT,    "Return SET Statement" },
-  { DRDA_CP_RDBACCCL,     "RDB Access Manager Class" },
-  { DRDA_CP_RDBNAM,       "Relational Database Name" },
-  { DRDA_CP_OUTEXP,       "Output Expected" },
-  { DRDA_CP_PKGNAMCT,     "RDB Package Name and Consistency Token" },
-  { DRDA_CP_PKGNAMCSN,
-               "RDB Package Name, Consistency Token, and Section Number" },
-  { DRDA_CP_QRYBLKSZ,     "Query Block Size" },
-  { DRDA_CP_UOWDSP,       "Unit of Work Disposition" },
-  { DRDA_CP_RTNSQLDA,     "Maximum Result Set Count" },
-  { DRDA_CP_RDBALWUPD,    "RDB Allow Updates" },
-  { DRDA_CP_SQLCSRHLD,    "Hold Cursor Position" },
-  { DRDA_CP_STTSTRDEL,    "Statement String Delimiter" },
-  { DRDA_CP_STTDECDEL,    "Statement Decimal Delimiter" },
-  { DRDA_CP_PKGDFTCST,    "Package Default Character Subtype" },
-  { DRDA_CP_QRYBLKCTL,    "Query Block Protocol Control" },
-  { DRDA_CP_CRRTKN,       "Correlation Token" },
-  { DRDA_CP_PRCNAM,       "Procedure Name" },
-  { DRDA_CP_PKGSNLST,     "RDB Result Set Reply Message" },
-  { DRDA_CP_NBRROW,       "Number of Fetch or Insert Rows" },
-  { DRDA_CP_TRGDFTRT,     "Target Default Value Return" },
-  { DRDA_CP_QRYRELSCR,    "Query Relative Scrolling Action" },
-  { DRDA_CP_QRYROWNBR,    "Query Row Number" },
-  { DRDA_CP_QRYRFRTBL,    "Query Refresh Answer Set Table" },
-  { DRDA_CP_MAXRSLCNT,    "Maximum Result Set Count" },
-  { DRDA_CP_MAXBLKEXT,    "Maximum Number of Extra Blocks" },
-  { DRDA_CP_RSLSETFLG,    "Result Set Flags" },
-  { DRDA_CP_TYPSQLDA,     "Type of SQL Descriptor Area" },
-  { DRDA_CP_OUTOVROPT,    "Output Override Option" },
-  { DRDA_CP_RTNEXTDTA,    "Return of EXTDTA Option" },
-  { DRDA_CP_QRYATTSCR,    "Query Attribute for Scrollability" },
-  { DRDA_CP_QRYATTUPD,    "Query Attribute for Updatability" },
-  { DRDA_CP_QRYSCRORN,    "Query Scroll Orientation" },
-  { DRDA_CP_QRYROWSNS,    "Query Row Sensitivity" },
-  { DRDA_CP_QRYBLKRST,    "Query Block Reset" },
-  { DRDA_CP_QRYRTNDTA,    "Query Returns Datat" },
-  { DRDA_CP_QRYROWSET,    "Query Rowset Size" },
-  { DRDA_CP_QRYATTSNS,    "Query Attribute for Sensitivity" },
-  { DRDA_CP_QRYINSID,     "Query Instance Identifier" },
-  { DRDA_CP_QRYCLSIMP,    "Query Close Implicit" },
-  { DRDA_CP_QRYCLSRLS,    "Query Close Lock Release" },
-  { DRDA_CP_QRYOPTVAL,    "QRYOPTVAL" },
-  { DRDA_CP_DIAGLVL,      "SQL Error Diagnostic Level" },
-  { DRDA_CP_ACCRDBRM,     "Access to RDB Completed" },
-  { DRDA_CP_QRYNOPRM,     "Query Not Open" },
-  { DRDA_CP_RDBNACRM,     "RDB Not Accessed" },
-  { DRDA_CP_OPNQRYRM,     "Open Query Complete" },
-  { DRDA_CP_PKGBNARM,     "RDB Package Binding Not Active" },
-  { DRDA_CP_RDBACCRM,     "RDB Currently Accessed" },
-  { DRDA_CP_BGNBNDRM,     "Begin Bind Error" },
-  { DRDA_CP_PKGBPARM,     "RDB Package Binding Process Active" },
-  { DRDA_CP_DSCINVRM,     "Invalid Description" },
-  { DRDA_CP_ENDQRYRM,     "End of Query" },
-  { DRDA_CP_ENDUOWRM,     "End Unit of Work Condition" },
-  { DRDA_CP_ABNUOWRM,     "Abnormal End Unit ofWork Condition" },
-  { DRDA_CP_DTAMCHRM,     "Data Descriptor Mismatch" },
-  { DRDA_CP_QRYPOPRM,     "Query Previously Opened" },
-  { DRDA_CP_RDBNFNRM,     "RDB Not Found" },
-  { DRDA_CP_OPNQFLRM,     "Open Query Failure" },
-  { DRDA_CP_SQLERRRM,     "SQL Error Condition" },
-  { DRDA_CP_RDBUPDRM,     "RDB Update Reply Message" },
-  { DRDA_CP_RSLSETRM,     "RDB Result Set Reply Message" },
-  { DRDA_CP_RDBAFLRM,     "RDB Access Failed Reply Message" },
-  { DRDA_CP_CMDVLTRM,     "Command Violation" },
-  { DRDA_CP_CMMRQSRM,     "Commitment Request" },
-  { DRDA_CP_RDBATHRM,     "Not Authorized to RDB" },
-  { DRDA_CP_SQLAM,        "SQL Application Manager" },
-  { DRDA_CP_SQLCARD,      "SQL Communications Area Reply Data" },
-  { DRDA_CP_SQLCINRD,     "SQL Result Set Column Information Reply Data" },
-  { DRDA_CP_SQLRSLRD,     "SQL Result Set Reply Data" },
-  { DRDA_CP_RDB,          "Relational Database" },
-  { DRDA_CP_FRCFIXROW,    "Force Fixed Row Query Protocol" },
-  { DRDA_CP_SQLDARD,      "SQLDA Reply Data" },
-  { DRDA_CP_SQLDTA,       "SQL Program Variable Data" },
-  { DRDA_CP_SQLDTARD,     "SQL Data Reply Data" },
-  { DRDA_CP_SQLSTT,       "SQL Statement" },
-  { DRDA_CP_OUTOVR,       "Output Override Descriptor" },
-  { DRDA_CP_LMTBLKPRC,    "Limited Block Protocol" },
-  { DRDA_CP_FIXROWPRC,    "Fixed Row Query Protocol" },
-  { DRDA_CP_SQLSTTVRB,    "SQL Statement Variable Descriptions" },
-  { DRDA_CP_QRYDSC,       "Query Answer Set Description" },
-  { DRDA_CP_QRYDTA,       "Query Answer Set Data" },
-  { DRDA_CP_SQLATTR,      "SQL Statement Attributes" },
-  { 0,          NULL }
+    { DRDA_CP_DATA,         "Data" },
+    { DRDA_CP_CODPNT,       "Code Point" },
+    { DRDA_CP_FDODSC,       "FD:OCA Data Descriptor" },
+    { DRDA_CP_TYPDEFNAM,    "Data Type Definition Name" },
+    { DRDA_CP_TYPDEFOVR,    "TYPDEF Overrides" },
+    { DRDA_CP_CODPNTDR,     "Code Point Data Representation" },
+    { DRDA_CP_EXCSAT,       "Exchange Server Attributes" },
+    { DRDA_CP_SYNCCTL,      "Sync Point Control Request" },
+    { DRDA_CP_SYNCRSY,      "Sync Point Resync Command" },
+    { DRDA_CP_ACCSEC,       "Access Security" },
+    { DRDA_CP_SECCHK,       "Security Check" },
+    { DRDA_CP_SYNCLOG,      "Sync Point Log" },
+    { DRDA_CP_RSCTYP,       "Resource Type Information" },
+    { DRDA_CP_RSNCOD,       "Reason Code Information" },
+    { DRDA_CP_RSCNAM,       "Resource Name Information" },
+    { DRDA_CP_PRDID,        "Product-Specific Identifier" },
+    { DRDA_CP_PRCCNVCD,     "Conversation Protocol Error Code" },
+    { DRDA_CP_VRSNAM,       "Version Name" },
+    { DRDA_CP_SRVCLSNM,     "Server Class Name" },
+    { DRDA_CP_SVRCOD,       "Severity Code" },
+    { DRDA_CP_SYNERRCD,     "Syntax Error Code" },
+    { DRDA_CP_SRVDGN,       "Server Diagnostic Information" },
+    { DRDA_CP_SRVRLSLV,     "Server Product Release Level" },
+    { DRDA_CP_SPVNAM,       "Supervisor Name" },
+    { DRDA_CP_EXTNAM,       "External Name" },
+    { DRDA_CP_SRVNAM,       "Server Name" },
+    { DRDA_CP_SECMGRNM,     "Security Manager Name" },
+    { DRDA_CP_DEPERRCD,     "Manager Dependency Error Code" },
+    { DRDA_CP_CCSIDSBC,     "CCSID for Single-Byte Characters" },
+    { DRDA_CP_CCSIDDBC,     "CCSID for Double-byte Characters" },
+    { DRDA_CP_CCSIDMBC,     "CCSID for Mixed-byte Characters" },
+    { DRDA_CP_USRID,        "User ID at the Target System" },
+    { DRDA_CP_PASSWORD,     "Password" },
+    { DRDA_CP_SECMEC,       "Security Mechanism" },
+    { DRDA_CP_SECCHKCD,     "Security Check Code" },
+    { DRDA_CP_SVCERRNO,     "Security Service ErrorNumber" },
+    { DRDA_CP_SECTKN,       "Security Token" },
+    { DRDA_CP_NEWPASSWORD,  "New Password" },
+    { DRDA_CP_MGRLVLRM,     "Manager-Level Conflict" },
+    { DRDA_CP_MGRDEPRM,     "Manager Dependency Error" },
+    { DRDA_CP_SECCHKRM,     "Security Check" },
+    { DRDA_CP_CMDATHRM,     "Not Authorized to Command" },
+    { DRDA_CP_AGNPRMRM,     "Permanent Agent Error" },
+    { DRDA_CP_RSCLMTRM,     "Resource Limits Reached" },
+    { DRDA_CP_PRCCNVRM,     "Conversational Protocol Error" },
+    { DRDA_CP_CMDCMPRM,     "Command Processing Completed" },
+    { DRDA_CP_SYNTAXRM,     "Data Stream Syntax Error" },
+    { DRDA_CP_CMDNSPRM,     "Command Not Supported" },
+    { DRDA_CP_PRMNSPRM,     "Parameter Not Supported" },
+    { DRDA_CP_VALNSPRM,     "Parameter Value Not Supported" },
+    { DRDA_CP_OBJNSPRM,     "Object Not Supported" },
+    { DRDA_CP_CMDCHKRM,     "Command Check" },
+    { DRDA_CP_TRGNSPRM,     "Target Not Supported" },
+    { DRDA_CP_AGENT,        "Agent" },
+    { DRDA_CP_MGRLVLLS,     "Manager-Level List" },
+    { DRDA_CP_SUPERVISOR,   "Supervisor" },
+    { DRDA_CP_SECMGR,       "Security Manager" },
+    { DRDA_CP_EXCSATRD,     "Server Attributes Reply Data" },
+    { DRDA_CP_CMNAPPC,      "LU 6.2 Conversational Communications Manager" },
+    { DRDA_CP_DICTIONARY,   "Dictionary" },
+    { DRDA_CP_MGRLVLN,      "Manager-Level Number Attribute" },
+    { DRDA_CP_CMNTCPIP,     "TCP/IP CommunicationManager" },
+    { DRDA_CP_FDODTA,       "FD:OCA Data" },
+    { DRDA_CP_CMNSYNCPT,
+      "SNA LU 6.2 Sync Point Conversational Communications Manager" },
+    { DRDA_CP_ACCSECRD,     "Access Security Reply Data" },
+    { DRDA_CP_SYNCPTMGR,    "Sync Point Manager" },
+    { DRDA_CP_RSYNCMGR,     "ResynchronizationManager" },
+    { DRDA_CP_CCSIDMGR,     "CCSID Manager" },
+    { DRDA_CP_MONITOR,      "Monitor Events" },
+    { DRDA_CP_MONITORRD,    "Monitor Reply Data" },
+    { DRDA_CP_XAMGR,        "XAManager" },
+    { DRDA_CP_ACCRDB,       "Access RDB" },
+    { DRDA_CP_BGNBND,       "Begin Binding a Package to an RDB" },
+    { DRDA_CP_BNDSQLSTT,    "Bind SQL Statement to an RDB Package" },
+    { DRDA_CP_CLSQRY,       "Close Query" },
+    { DRDA_CP_CNTQRY,       "Continue Query" },
+    { DRDA_CP_DRPPKG,       "Drop RDB Package" },
+    { DRDA_CP_DSCSQLSTT,    "Describe SQL Statement" },
+    { DRDA_CP_ENDBND,       "End Binding a Package to an RDB" },
+    { DRDA_CP_EXCSQLIMM,    "Execute Immediate SQL Statement" },
+    { DRDA_CP_EXCSQLSTT,    "Execute SQL Statement" },
+    { DRDA_CP_OPNQRY,       "Open Query" },
+    { DRDA_CP_PRPSQLSTT,    "Prepare SQL Statement" },
+    { DRDA_CP_RDBCMM,       "RDB Commit Unit of Work" },
+    { DRDA_CP_RDBRLLBCK,    "RDB Rollback Unit of Work" },
+    { DRDA_CP_REBIND,       "Rebind an Existing RDB Package" },
+    { DRDA_CP_DSCRDBTBL,    "Describe RDB Table" },
+    { DRDA_CP_EXCSQLSET,    "Set SQL Environment" },
+    { DRDA_CP_DSCERRCD,     "Description Error Code" },
+    { DRDA_CP_QRYPRCTYP,    "Query Protocol Type" },
+    { DRDA_CP_RDBINTTKN,    "RDB Interrupt Token" },
+    { DRDA_CP_PRDDTA,       "Product-Specific Data" },
+    { DRDA_CP_RDBCMTOK,     "RDB Commit Allowed" },
+    { DRDA_CP_RDBCOLID,     "RDB Collection Identifier" },
+    { DRDA_CP_PKGID,        "RDB Package Identifier" },
+    { DRDA_CP_PKGCNSTKN,    "RDB Package Consistency Token" },
+    { DRDA_CP_RTNSETSTT,    "Return SET Statement" },
+    { DRDA_CP_RDBACCCL,     "RDB Access Manager Class" },
+    { DRDA_CP_RDBNAM,       "Relational Database Name" },
+    { DRDA_CP_OUTEXP,       "Output Expected" },
+    { DRDA_CP_PKGNAMCT,     "RDB Package Name and Consistency Token" },
+    { DRDA_CP_PKGNAMCSN,
+      "RDB Package Name, Consistency Token, and Section Number" },
+    { DRDA_CP_QRYBLKSZ,     "Query Block Size" },
+    { DRDA_CP_UOWDSP,       "Unit of Work Disposition" },
+    { DRDA_CP_RTNSQLDA,     "Maximum Result Set Count" },
+    { DRDA_CP_RDBALWUPD,    "RDB Allow Updates" },
+    { DRDA_CP_SQLCSRHLD,    "Hold Cursor Position" },
+    { DRDA_CP_STTSTRDEL,    "Statement String Delimiter" },
+    { DRDA_CP_STTDECDEL,    "Statement Decimal Delimiter" },
+    { DRDA_CP_PKGDFTCST,    "Package Default Character Subtype" },
+    { DRDA_CP_QRYBLKCTL,    "Query Block Protocol Control" },
+    { DRDA_CP_CRRTKN,       "Correlation Token" },
+    { DRDA_CP_PRCNAM,       "Procedure Name" },
+    { DRDA_CP_PKGSNLST,     "RDB Result Set Reply Message" },
+    { DRDA_CP_NBRROW,       "Number of Fetch or Insert Rows" },
+    { DRDA_CP_TRGDFTRT,     "Target Default Value Return" },
+    { DRDA_CP_QRYRELSCR,    "Query Relative Scrolling Action" },
+    { DRDA_CP_QRYROWNBR,    "Query Row Number" },
+    { DRDA_CP_QRYRFRTBL,    "Query Refresh Answer Set Table" },
+    { DRDA_CP_MAXRSLCNT,    "Maximum Result Set Count" },
+    { DRDA_CP_MAXBLKEXT,    "Maximum Number of Extra Blocks" },
+    { DRDA_CP_RSLSETFLG,    "Result Set Flags" },
+    { DRDA_CP_TYPSQLDA,     "Type of SQL Descriptor Area" },
+    { DRDA_CP_OUTOVROPT,    "Output Override Option" },
+    { DRDA_CP_RTNEXTDTA,    "Return of EXTDTA Option" },
+    { DRDA_CP_QRYATTSCR,    "Query Attribute for Scrollability" },
+    { DRDA_CP_QRYATTUPD,    "Query Attribute for Updatability" },
+    { DRDA_CP_QRYSCRORN,    "Query Scroll Orientation" },
+    { DRDA_CP_QRYROWSNS,    "Query Row Sensitivity" },
+    { DRDA_CP_QRYBLKRST,    "Query Block Reset" },
+    { DRDA_CP_QRYRTNDTA,    "Query Returns Datat" },
+    { DRDA_CP_QRYROWSET,    "Query Rowset Size" },
+    { DRDA_CP_QRYATTSNS,    "Query Attribute for Sensitivity" },
+    { DRDA_CP_QRYINSID,     "Query Instance Identifier" },
+    { DRDA_CP_QRYCLSIMP,    "Query Close Implicit" },
+    { DRDA_CP_QRYCLSRLS,    "Query Close Lock Release" },
+    { DRDA_CP_QRYOPTVAL,    "QRYOPTVAL" },
+    { DRDA_CP_DIAGLVL,      "SQL Error Diagnostic Level" },
+    { DRDA_CP_ACCRDBRM,     "Access to RDB Completed" },
+    { DRDA_CP_QRYNOPRM,     "Query Not Open" },
+    { DRDA_CP_RDBNACRM,     "RDB Not Accessed" },
+    { DRDA_CP_OPNQRYRM,     "Open Query Complete" },
+    { DRDA_CP_PKGBNARM,     "RDB Package Binding Not Active" },
+    { DRDA_CP_RDBACCRM,     "RDB Currently Accessed" },
+    { DRDA_CP_BGNBNDRM,     "Begin Bind Error" },
+    { DRDA_CP_PKGBPARM,     "RDB Package Binding Process Active" },
+    { DRDA_CP_DSCINVRM,     "Invalid Description" },
+    { DRDA_CP_ENDQRYRM,     "End of Query" },
+    { DRDA_CP_ENDUOWRM,     "End Unit of Work Condition" },
+    { DRDA_CP_ABNUOWRM,     "Abnormal End Unit ofWork Condition" },
+    { DRDA_CP_DTAMCHRM,     "Data Descriptor Mismatch" },
+    { DRDA_CP_QRYPOPRM,     "Query Previously Opened" },
+    { DRDA_CP_RDBNFNRM,     "RDB Not Found" },
+    { DRDA_CP_OPNQFLRM,     "Open Query Failure" },
+    { DRDA_CP_SQLERRRM,     "SQL Error Condition" },
+    { DRDA_CP_RDBUPDRM,     "RDB Update Reply Message" },
+    { DRDA_CP_RSLSETRM,     "RDB Result Set Reply Message" },
+    { DRDA_CP_RDBAFLRM,     "RDB Access Failed Reply Message" },
+    { DRDA_CP_CMDVLTRM,     "Command Violation" },
+    { DRDA_CP_CMMRQSRM,     "Commitment Request" },
+    { DRDA_CP_RDBATHRM,     "Not Authorized to RDB" },
+    { DRDA_CP_SQLAM,        "SQL Application Manager" },
+    { DRDA_CP_SQLCARD,      "SQL Communications Area Reply Data" },
+    { DRDA_CP_SQLCINRD,     "SQL Result Set Column Information Reply Data" },
+    { DRDA_CP_SQLRSLRD,     "SQL Result Set Reply Data" },
+    { DRDA_CP_RDB,          "Relational Database" },
+    { DRDA_CP_FRCFIXROW,    "Force Fixed Row Query Protocol" },
+    { DRDA_CP_SQLDARD,      "SQLDA Reply Data" },
+    { DRDA_CP_SQLDTA,       "SQL Program Variable Data" },
+    { DRDA_CP_SQLDTARD,     "SQL Data Reply Data" },
+    { DRDA_CP_SQLSTT,       "SQL Statement" },
+    { DRDA_CP_OUTOVR,       "Output Override Descriptor" },
+    { DRDA_CP_LMTBLKPRC,    "Limited Block Protocol" },
+    { DRDA_CP_FIXROWPRC,    "Fixed Row Query Protocol" },
+    { DRDA_CP_SQLSTTVRB,    "SQL Statement Variable Descriptions" },
+    { DRDA_CP_QRYDSC,       "Query Answer Set Description" },
+    { DRDA_CP_QRYDTA,       "Query Answer Set Data" },
+    { DRDA_CP_SQLATTR,      "SQL Statement Attributes" },
+    { 0,          NULL }
 };
-
 static value_string_ext drda_opcode_vals_ext = VALUE_STRING_EXT_INIT(drda_opcode_vals);
 
 static const value_string drda_opcode_abbr[] = {
-  { DRDA_CP_DATA,         "DATA" },
-  { DRDA_CP_CODPNT,       "CODPNT" },
-  { DRDA_CP_FDODSC,       "FDODSC" },
-  { DRDA_CP_TYPDEFNAM,    "TYPDEFNAM" },
-  { DRDA_CP_TYPDEFOVR,    "TYPDEFOVR" },
-  { DRDA_CP_CODPNTDR,     "CODPNTDR" },
-  { DRDA_CP_EXCSAT,       "EXCSAT" },
-  { DRDA_CP_SYNCCTL,      "SYNCCTL" },
-  { DRDA_CP_SYNCRSY,      "SYNCRSY" },
-  { DRDA_CP_ACCSEC,       "ACCSEC" },
-  { DRDA_CP_SECCHK,       "SECCHK" },
-  { DRDA_CP_SYNCLOG,      "SYNCLOG" },
-  { DRDA_CP_RSCTYP,       "RSCTYP" },
-  { DRDA_CP_RSNCOD,       "RSNCOD" },
-  { DRDA_CP_RSCNAM,       "RSCNAM" },
-  { DRDA_CP_PRDID,        "PRDID" },
-  { DRDA_CP_PRCCNVCD,     "PRCCNVCD" },
-  { DRDA_CP_VRSNAM,       "VRSNAM" },
-  { DRDA_CP_SRVCLSNM,     "SRVCLSNM" },
-  { DRDA_CP_SVRCOD,       "SVRCOD" },
-  { DRDA_CP_SYNERRCD,     "SYNERRCD" },
-  { DRDA_CP_SRVDGN,       "SRVDGN" },
-  { DRDA_CP_SRVRLSLV,     "SRVRLSLV" },
-  { DRDA_CP_SPVNAM,       "SPVNAM" },
-  { DRDA_CP_EXTNAM,       "EXTNAM" },
-  { DRDA_CP_SRVNAM,       "SRVNAM" },
-  { DRDA_CP_SECMGRNM,     "SECMGRNM" },
-  { DRDA_CP_DEPERRCD,     "DEPERRCD" },
-  { DRDA_CP_CCSIDSBC,     "CCSIDSBC" },
-  { DRDA_CP_CCSIDDBC,     "CCSIDDBC" },
-  { DRDA_CP_CCSIDMBC,     "CCSIDMBC" },
-  { DRDA_CP_USRID,        "USRID" },
-  { DRDA_CP_PASSWORD,     "PASSWORD" },
-  { DRDA_CP_SECMEC,       "SECMEC" },
-  { DRDA_CP_SECCHKCD,     "SECCHKCD" },
-  { DRDA_CP_SVCERRNO,     "SVCERRNO" },
-  { DRDA_CP_SECTKN,       "SECTKN" },
-  { DRDA_CP_NEWPASSWORD,  "NEWPASSWORD" },
-  { DRDA_CP_MGRLVLRM,     "MGRLVLRM" },
-  { DRDA_CP_MGRDEPRM,     "MGRDEPRM" },
-  { DRDA_CP_SECCHKRM,     "SECCHKRM" },
-  { DRDA_CP_CMDATHRM,     "CMDATHRM" },
-  { DRDA_CP_AGNPRMRM,     "AGNPRMRM" },
-  { DRDA_CP_RSCLMTRM,     "RSCLMTRM" },
-  { DRDA_CP_PRCCNVRM,     "PRCCNVRM" },
-  { DRDA_CP_CMDCMPRM,     "CMDCMPRM" },
-  { DRDA_CP_SYNTAXRM,     "SYNTAXRM" },
-  { DRDA_CP_CMDNSPRM,     "CMDNSPRM" },
-  { DRDA_CP_PRMNSPRM,     "PRMNSPRM" },
-  { DRDA_CP_VALNSPRM,     "VALNSPRM" },
-  { DRDA_CP_OBJNSPRM,     "OBJNSPRM" },
-  { DRDA_CP_CMDCHKRM,     "CMDCHKRM" },
-  { DRDA_CP_TRGNSPRM,     "TRGNSPRM" },
-  { DRDA_CP_AGENT,        "AGENT" },
-  { DRDA_CP_MGRLVLLS,     "MGRLVLLS" },
-  { DRDA_CP_SUPERVISOR,   "SUPERVISOR" },
-  { DRDA_CP_SECMGR,       "SECMGR" },
-  { DRDA_CP_EXCSATRD,     "EXCSATRD" },
-  { DRDA_CP_CMNAPPC,      "CMNAPPC" },
-  { DRDA_CP_DICTIONARY,   "DICTIONARY" },
-  { DRDA_CP_MGRLVLN,      "MGRLVLN" },
-  { DRDA_CP_CMNTCPIP,     "CMNTCPIP" },
-  { DRDA_CP_FDODTA,       "FDODTA" },
-  { DRDA_CP_CMNSYNCPT,    "CMNSYNCPT" },
-  { DRDA_CP_ACCSECRD,     "ACCSECRD" },
-  { DRDA_CP_SYNCPTMGR,    "SYNCPTMGR" },
-  { DRDA_CP_RSYNCMGR,     "RSYNCMGR" },
-  { DRDA_CP_CCSIDMGR,     "CCSIDMGR" },
-  { DRDA_CP_MONITOR,      "MONITOR" },
-  { DRDA_CP_MONITORRD,    "MONITORRD" },
-  { DRDA_CP_XAMGR,        "XAMGR" },
-  { DRDA_CP_ACCRDB,       "ACCRDB" },
-  { DRDA_CP_BGNBND,       "BGNBND" },
-  { DRDA_CP_BNDSQLSTT,    "BNDSQLSTT" },
-  { DRDA_CP_CLSQRY,       "CLSQRY" },
-  { DRDA_CP_CNTQRY,       "CNTQRY" },
-  { DRDA_CP_DRPPKG,       "DRPPKG" },
-  { DRDA_CP_DSCSQLSTT,    "DSCSQLSTT" },
-  { DRDA_CP_ENDBND,       "ENDBND" },
-  { DRDA_CP_EXCSQLIMM,    "EXCSQLIMM" },
-  { DRDA_CP_EXCSQLSTT,    "EXCSQLSTT" },
-  { DRDA_CP_OPNQRY,       "OPNQRY" },
-  { DRDA_CP_PRPSQLSTT,    "PRPSQLSTT" },
-  { DRDA_CP_RDBCMM,       "RDBCMM" },
-  { DRDA_CP_RDBRLLBCK,    "RDBRLLBCK" },
-  { DRDA_CP_REBIND,       "REBIND" },
-  { DRDA_CP_DSCRDBTBL,    "DSCRDBTBL" },
-  { DRDA_CP_EXCSQLSET,    "EXCSQLSET" },
-  { DRDA_CP_DSCERRCD,     "DSCERRCD" },
-  { DRDA_CP_QRYPRCTYP,    "QRYPRCTYP" },
-  { DRDA_CP_RDBINTTKN,    "RDBINTTKN" },
-  { DRDA_CP_PRDDTA,       "PRDDTA" },
-  { DRDA_CP_RDBCMTOK,     "RDBCMTOK" },
-  { DRDA_CP_RDBCOLID,     "RDBCOLID" },
-  { DRDA_CP_PKGID,        "PKGID" },
-  { DRDA_CP_PKGCNSTKN,    "PKGCNSTKN" },
-  { DRDA_CP_RTNSETSTT,    "RTNSETSTT" },
-  { DRDA_CP_RDBACCCL,     "RDBACCCL" },
-  { DRDA_CP_RDBNAM,       "RDBNAM" },
-  { DRDA_CP_OUTEXP,       "OUTEXP" },
-  { DRDA_CP_PKGNAMCT,     "PKGNAMCT" },
-  { DRDA_CP_PKGNAMCSN,    "PKGNAMCSN" },
-  { DRDA_CP_QRYBLKSZ,     "QRYBLKSZ" },
-  { DRDA_CP_UOWDSP,       "UOWDSP" },
-  { DRDA_CP_RTNSQLDA,     "RTNSQLDA" },
-  { DRDA_CP_RDBALWUPD,    "RDBALWUPD" },
-  { DRDA_CP_SQLCSRHLD,    "SQLCSRHLD" },
-  { DRDA_CP_STTSTRDEL,    "STTSTRDEL" },
-  { DRDA_CP_STTDECDEL,    "STTDECDEL" },
-  { DRDA_CP_PKGDFTCST,    "PKGDFTCST" },
-  { DRDA_CP_QRYBLKCTL,    "QRYBLKCTL" },
-  { DRDA_CP_CRRTKN,       "CRRTKN" },
-  { DRDA_CP_PRCNAM,       "PRCNAM" },
-  { DRDA_CP_PKGSNLST,     "PKGSNLST" },
-  { DRDA_CP_NBRROW,       "NBRROW" },
-  { DRDA_CP_TRGDFTRT,     "TRGDFTRT" },
-  { DRDA_CP_QRYRELSCR,    "QRYRELSCR" },
-  { DRDA_CP_QRYROWNBR,    "QRYROWNBR" },
-  { DRDA_CP_QRYRFRTBL,    "QRYRFRTBL" },
-  { DRDA_CP_MAXRSLCNT,    "MAXRSLCNT" },
-  { DRDA_CP_MAXBLKEXT,    "MAXBLKEXT" },
-  { DRDA_CP_RSLSETFLG,    "RSLSETFLG" },
-  { DRDA_CP_TYPSQLDA,     "TYPSQLDA" },
-  { DRDA_CP_OUTOVROPT,    "OUTOVROPT" },
-  { DRDA_CP_RTNEXTDTA,    "RTNEXTDTA" },
-  { DRDA_CP_QRYATTSCR,    "QRYATTSCR" },
-  { DRDA_CP_QRYATTUPD,    "QRYATTUPD" },
-  { DRDA_CP_QRYSCRORN,    "QRYSCRORN" },
-  { DRDA_CP_QRYROWSNS,    "QRYROWSNS" },
-  { DRDA_CP_QRYBLKRST,    "QRYBLKRST" },
-  { DRDA_CP_QRYRTNDTA,    "QRYRTNDTA" },
-  { DRDA_CP_QRYROWSET,    "QRYROWSET" },
-  { DRDA_CP_QRYATTSNS,    "QRYATTSNS" },
-  { DRDA_CP_QRYINSID,     "QRYINSID" },
-  { DRDA_CP_QRYCLSIMP,    "QRYCLSIMP" },
-  { DRDA_CP_QRYCLSRLS,    "QRYCLSRLS" },
-  { DRDA_CP_QRYOPTVAL,    "QRYOPTVAL" },
-  { DRDA_CP_DIAGLVL,      "DIAGLVL" },
-  { DRDA_CP_ACCRDBRM,     "ACCRDBRM" },
-  { DRDA_CP_QRYNOPRM,     "QRYNOPRM" },
-  { DRDA_CP_RDBNACRM,     "RDBNACRM" },
-  { DRDA_CP_OPNQRYRM,     "OPNQRYRM" },
-  { DRDA_CP_PKGBNARM,     "PKGBNARM" },
-  { DRDA_CP_RDBACCRM,     "RDBACCRM" },
-  { DRDA_CP_BGNBNDRM,     "BGNBNDRM" },
-  { DRDA_CP_PKGBPARM,     "PKGBPARM" },
-  { DRDA_CP_DSCINVRM,     "DSCINVRM" },
-  { DRDA_CP_ENDQRYRM,     "ENDQRYRM" },
-  { DRDA_CP_ENDUOWRM,     "ENDUOWRM" },
-  { DRDA_CP_ABNUOWRM,     "ABNUOWRM" },
-  { DRDA_CP_DTAMCHRM,     "DTAMCHRM" },
-  { DRDA_CP_QRYPOPRM,     "QRYPOPRM" },
-  { DRDA_CP_RDBNFNRM,     "RDBNFNRM" },
-  { DRDA_CP_OPNQFLRM,     "OPNQFLRM" },
-  { DRDA_CP_SQLERRRM,     "SQLERRRM" },
-  { DRDA_CP_RDBUPDRM,     "RDBUPDRM" },
-  { DRDA_CP_RSLSETRM,     "RSLSETRM" },
-  { DRDA_CP_RDBAFLRM,     "RDBAFLRM" },
-  { DRDA_CP_CMDVLTRM,     "CMDVLTRM" },
-  { DRDA_CP_CMMRQSRM,     "CMMRQSRM" },
-  { DRDA_CP_RDBATHRM,     "RDBATHRM" },
-  { DRDA_CP_SQLAM,        "SQLAM" },
-  { DRDA_CP_SQLCARD,      "SQLCARD" },
-  { DRDA_CP_SQLCINRD,     "SQLCINRD" },
-  { DRDA_CP_SQLRSLRD,     "SQLRSLRD" },
-  { DRDA_CP_RDB,          "RDB" },
-  { DRDA_CP_FRCFIXROW,    "FRCFIXROW" },
-  { DRDA_CP_SQLDARD,      "SQLDARD" },
-  { DRDA_CP_SQLDTA,       "SQLDTA" },
-  { DRDA_CP_SQLDTARD,     "SQLDTARD" },
-  { DRDA_CP_SQLSTT,       "SQLSTT" },
-  { DRDA_CP_OUTOVR,       "OUTOVR" },
-  { DRDA_CP_LMTBLKPRC,    "LMTBLKPRC" },
-  { DRDA_CP_FIXROWPRC,    "FIXROWPRC" },
-  { DRDA_CP_SQLSTTVRB,    "SQLSTTVRB" },
-  { DRDA_CP_QRYDSC,       "QRYDSC" },
-  { DRDA_CP_QRYDTA,       "QRYDTA" },
-  { DRDA_CP_SQLATTR,      "SQLATTR" },
-  { 0,          NULL }
+    { DRDA_CP_DATA,         "DATA" },
+    { DRDA_CP_CODPNT,       "CODPNT" },
+    { DRDA_CP_FDODSC,       "FDODSC" },
+    { DRDA_CP_TYPDEFNAM,    "TYPDEFNAM" },
+    { DRDA_CP_TYPDEFOVR,    "TYPDEFOVR" },
+    { DRDA_CP_CODPNTDR,     "CODPNTDR" },
+    { DRDA_CP_EXCSAT,       "EXCSAT" },
+    { DRDA_CP_SYNCCTL,      "SYNCCTL" },
+    { DRDA_CP_SYNCRSY,      "SYNCRSY" },
+    { DRDA_CP_ACCSEC,       "ACCSEC" },
+    { DRDA_CP_SECCHK,       "SECCHK" },
+    { DRDA_CP_SYNCLOG,      "SYNCLOG" },
+    { DRDA_CP_RSCTYP,       "RSCTYP" },
+    { DRDA_CP_RSNCOD,       "RSNCOD" },
+    { DRDA_CP_RSCNAM,       "RSCNAM" },
+    { DRDA_CP_PRDID,        "PRDID" },
+    { DRDA_CP_PRCCNVCD,     "PRCCNVCD" },
+    { DRDA_CP_VRSNAM,       "VRSNAM" },
+    { DRDA_CP_SRVCLSNM,     "SRVCLSNM" },
+    { DRDA_CP_SVRCOD,       "SVRCOD" },
+    { DRDA_CP_SYNERRCD,     "SYNERRCD" },
+    { DRDA_CP_SRVDGN,       "SRVDGN" },
+    { DRDA_CP_SRVRLSLV,     "SRVRLSLV" },
+    { DRDA_CP_SPVNAM,       "SPVNAM" },
+    { DRDA_CP_EXTNAM,       "EXTNAM" },
+    { DRDA_CP_SRVNAM,       "SRVNAM" },
+    { DRDA_CP_SECMGRNM,     "SECMGRNM" },
+    { DRDA_CP_DEPERRCD,     "DEPERRCD" },
+    { DRDA_CP_CCSIDSBC,     "CCSIDSBC" },
+    { DRDA_CP_CCSIDDBC,     "CCSIDDBC" },
+    { DRDA_CP_CCSIDMBC,     "CCSIDMBC" },
+    { DRDA_CP_USRID,        "USRID" },
+    { DRDA_CP_PASSWORD,     "PASSWORD" },
+    { DRDA_CP_SECMEC,       "SECMEC" },
+    { DRDA_CP_SECCHKCD,     "SECCHKCD" },
+    { DRDA_CP_SVCERRNO,     "SVCERRNO" },
+    { DRDA_CP_SECTKN,       "SECTKN" },
+    { DRDA_CP_NEWPASSWORD,  "NEWPASSWORD" },
+    { DRDA_CP_MGRLVLRM,     "MGRLVLRM" },
+    { DRDA_CP_MGRDEPRM,     "MGRDEPRM" },
+    { DRDA_CP_SECCHKRM,     "SECCHKRM" },
+    { DRDA_CP_CMDATHRM,     "CMDATHRM" },
+    { DRDA_CP_AGNPRMRM,     "AGNPRMRM" },
+    { DRDA_CP_RSCLMTRM,     "RSCLMTRM" },
+    { DRDA_CP_PRCCNVRM,     "PRCCNVRM" },
+    { DRDA_CP_CMDCMPRM,     "CMDCMPRM" },
+    { DRDA_CP_SYNTAXRM,     "SYNTAXRM" },
+    { DRDA_CP_CMDNSPRM,     "CMDNSPRM" },
+    { DRDA_CP_PRMNSPRM,     "PRMNSPRM" },
+    { DRDA_CP_VALNSPRM,     "VALNSPRM" },
+    { DRDA_CP_OBJNSPRM,     "OBJNSPRM" },
+    { DRDA_CP_CMDCHKRM,     "CMDCHKRM" },
+    { DRDA_CP_TRGNSPRM,     "TRGNSPRM" },
+    { DRDA_CP_AGENT,        "AGENT" },
+    { DRDA_CP_MGRLVLLS,     "MGRLVLLS" },
+    { DRDA_CP_SUPERVISOR,   "SUPERVISOR" },
+    { DRDA_CP_SECMGR,       "SECMGR" },
+    { DRDA_CP_EXCSATRD,     "EXCSATRD" },
+    { DRDA_CP_CMNAPPC,      "CMNAPPC" },
+    { DRDA_CP_DICTIONARY,   "DICTIONARY" },
+    { DRDA_CP_MGRLVLN,      "MGRLVLN" },
+    { DRDA_CP_CMNTCPIP,     "CMNTCPIP" },
+    { DRDA_CP_FDODTA,       "FDODTA" },
+    { DRDA_CP_CMNSYNCPT,    "CMNSYNCPT" },
+    { DRDA_CP_ACCSECRD,     "ACCSECRD" },
+    { DRDA_CP_SYNCPTMGR,    "SYNCPTMGR" },
+    { DRDA_CP_RSYNCMGR,     "RSYNCMGR" },
+    { DRDA_CP_CCSIDMGR,     "CCSIDMGR" },
+    { DRDA_CP_MONITOR,      "MONITOR" },
+    { DRDA_CP_MONITORRD,    "MONITORRD" },
+    { DRDA_CP_XAMGR,        "XAMGR" },
+    { DRDA_CP_ACCRDB,       "ACCRDB" },
+    { DRDA_CP_BGNBND,       "BGNBND" },
+    { DRDA_CP_BNDSQLSTT,    "BNDSQLSTT" },
+    { DRDA_CP_CLSQRY,       "CLSQRY" },
+    { DRDA_CP_CNTQRY,       "CNTQRY" },
+    { DRDA_CP_DRPPKG,       "DRPPKG" },
+    { DRDA_CP_DSCSQLSTT,    "DSCSQLSTT" },
+    { DRDA_CP_ENDBND,       "ENDBND" },
+    { DRDA_CP_EXCSQLIMM,    "EXCSQLIMM" },
+    { DRDA_CP_EXCSQLSTT,    "EXCSQLSTT" },
+    { DRDA_CP_OPNQRY,       "OPNQRY" },
+    { DRDA_CP_PRPSQLSTT,    "PRPSQLSTT" },
+    { DRDA_CP_RDBCMM,       "RDBCMM" },
+    { DRDA_CP_RDBRLLBCK,    "RDBRLLBCK" },
+    { DRDA_CP_REBIND,       "REBIND" },
+    { DRDA_CP_DSCRDBTBL,    "DSCRDBTBL" },
+    { DRDA_CP_EXCSQLSET,    "EXCSQLSET" },
+    { DRDA_CP_DSCERRCD,     "DSCERRCD" },
+    { DRDA_CP_QRYPRCTYP,    "QRYPRCTYP" },
+    { DRDA_CP_RDBINTTKN,    "RDBINTTKN" },
+    { DRDA_CP_PRDDTA,       "PRDDTA" },
+    { DRDA_CP_RDBCMTOK,     "RDBCMTOK" },
+    { DRDA_CP_RDBCOLID,     "RDBCOLID" },
+    { DRDA_CP_PKGID,        "PKGID" },
+    { DRDA_CP_PKGCNSTKN,    "PKGCNSTKN" },
+    { DRDA_CP_RTNSETSTT,    "RTNSETSTT" },
+    { DRDA_CP_RDBACCCL,     "RDBACCCL" },
+    { DRDA_CP_RDBNAM,       "RDBNAM" },
+    { DRDA_CP_OUTEXP,       "OUTEXP" },
+    { DRDA_CP_PKGNAMCT,     "PKGNAMCT" },
+    { DRDA_CP_PKGNAMCSN,    "PKGNAMCSN" },
+    { DRDA_CP_QRYBLKSZ,     "QRYBLKSZ" },
+    { DRDA_CP_UOWDSP,       "UOWDSP" },
+    { DRDA_CP_RTNSQLDA,     "RTNSQLDA" },
+    { DRDA_CP_RDBALWUPD,    "RDBALWUPD" },
+    { DRDA_CP_SQLCSRHLD,    "SQLCSRHLD" },
+    { DRDA_CP_STTSTRDEL,    "STTSTRDEL" },
+    { DRDA_CP_STTDECDEL,    "STTDECDEL" },
+    { DRDA_CP_PKGDFTCST,    "PKGDFTCST" },
+    { DRDA_CP_QRYBLKCTL,    "QRYBLKCTL" },
+    { DRDA_CP_CRRTKN,       "CRRTKN" },
+    { DRDA_CP_PRCNAM,       "PRCNAM" },
+    { DRDA_CP_PKGSNLST,     "PKGSNLST" },
+    { DRDA_CP_NBRROW,       "NBRROW" },
+    { DRDA_CP_TRGDFTRT,     "TRGDFTRT" },
+    { DRDA_CP_QRYRELSCR,    "QRYRELSCR" },
+    { DRDA_CP_QRYROWNBR,    "QRYROWNBR" },
+    { DRDA_CP_QRYRFRTBL,    "QRYRFRTBL" },
+    { DRDA_CP_MAXRSLCNT,    "MAXRSLCNT" },
+    { DRDA_CP_MAXBLKEXT,    "MAXBLKEXT" },
+    { DRDA_CP_RSLSETFLG,    "RSLSETFLG" },
+    { DRDA_CP_TYPSQLDA,     "TYPSQLDA" },
+    { DRDA_CP_OUTOVROPT,    "OUTOVROPT" },
+    { DRDA_CP_RTNEXTDTA,    "RTNEXTDTA" },
+    { DRDA_CP_QRYATTSCR,    "QRYATTSCR" },
+    { DRDA_CP_QRYATTUPD,    "QRYATTUPD" },
+    { DRDA_CP_QRYSCRORN,    "QRYSCRORN" },
+    { DRDA_CP_QRYROWSNS,    "QRYROWSNS" },
+    { DRDA_CP_QRYBLKRST,    "QRYBLKRST" },
+    { DRDA_CP_QRYRTNDTA,    "QRYRTNDTA" },
+    { DRDA_CP_QRYROWSET,    "QRYROWSET" },
+    { DRDA_CP_QRYATTSNS,    "QRYATTSNS" },
+    { DRDA_CP_QRYINSID,     "QRYINSID" },
+    { DRDA_CP_QRYCLSIMP,    "QRYCLSIMP" },
+    { DRDA_CP_QRYCLSRLS,    "QRYCLSRLS" },
+    { DRDA_CP_QRYOPTVAL,    "QRYOPTVAL" },
+    { DRDA_CP_DIAGLVL,      "DIAGLVL" },
+    { DRDA_CP_ACCRDBRM,     "ACCRDBRM" },
+    { DRDA_CP_QRYNOPRM,     "QRYNOPRM" },
+    { DRDA_CP_RDBNACRM,     "RDBNACRM" },
+    { DRDA_CP_OPNQRYRM,     "OPNQRYRM" },
+    { DRDA_CP_PKGBNARM,     "PKGBNARM" },
+    { DRDA_CP_RDBACCRM,     "RDBACCRM" },
+    { DRDA_CP_BGNBNDRM,     "BGNBNDRM" },
+    { DRDA_CP_PKGBPARM,     "PKGBPARM" },
+    { DRDA_CP_DSCINVRM,     "DSCINVRM" },
+    { DRDA_CP_ENDQRYRM,     "ENDQRYRM" },
+    { DRDA_CP_ENDUOWRM,     "ENDUOWRM" },
+    { DRDA_CP_ABNUOWRM,     "ABNUOWRM" },
+    { DRDA_CP_DTAMCHRM,     "DTAMCHRM" },
+    { DRDA_CP_QRYPOPRM,     "QRYPOPRM" },
+    { DRDA_CP_RDBNFNRM,     "RDBNFNRM" },
+    { DRDA_CP_OPNQFLRM,     "OPNQFLRM" },
+    { DRDA_CP_SQLERRRM,     "SQLERRRM" },
+    { DRDA_CP_RDBUPDRM,     "RDBUPDRM" },
+    { DRDA_CP_RSLSETRM,     "RSLSETRM" },
+    { DRDA_CP_RDBAFLRM,     "RDBAFLRM" },
+    { DRDA_CP_CMDVLTRM,     "CMDVLTRM" },
+    { DRDA_CP_CMMRQSRM,     "CMMRQSRM" },
+    { DRDA_CP_RDBATHRM,     "RDBATHRM" },
+    { DRDA_CP_SQLAM,        "SQLAM" },
+    { DRDA_CP_SQLCARD,      "SQLCARD" },
+    { DRDA_CP_SQLCINRD,     "SQLCINRD" },
+    { DRDA_CP_SQLRSLRD,     "SQLRSLRD" },
+    { DRDA_CP_RDB,          "RDB" },
+    { DRDA_CP_FRCFIXROW,    "FRCFIXROW" },
+    { DRDA_CP_SQLDARD,      "SQLDARD" },
+    { DRDA_CP_SQLDTA,       "SQLDTA" },
+    { DRDA_CP_SQLDTARD,     "SQLDTARD" },
+    { DRDA_CP_SQLSTT,       "SQLSTT" },
+    { DRDA_CP_OUTOVR,       "OUTOVR" },
+    { DRDA_CP_LMTBLKPRC,    "LMTBLKPRC" },
+    { DRDA_CP_FIXROWPRC,    "FIXROWPRC" },
+    { DRDA_CP_SQLSTTVRB,    "SQLSTTVRB" },
+    { DRDA_CP_QRYDSC,       "QRYDSC" },
+    { DRDA_CP_QRYDTA,       "QRYDTA" },
+    { DRDA_CP_SQLATTR,      "SQLATTR" },
+    { 0,          NULL }
 };
-
 static value_string_ext drda_opcode_abbr_ext = VALUE_STRING_EXT_INIT(drda_opcode_abbr);
 
 static const value_string drda_dsstyp_abbr[] = {
-  { DRDA_DSSFMT_RQSDSS,     "RQSDSS" },
-  { DRDA_DSSFMT_RPYDSS,     "RPYDSS" },
-  { DRDA_DSSFMT_OBJDSS,     "OBJDSS" },
-  { DRDA_DSSFMT_CMNDSS,     "CMNDSS" },
-  { DRDA_DSSFMT_NORPYDSS,   "NORPYDSS" },
-  { 0,          NULL }
+    { DRDA_DSSFMT_RQSDSS,     "RQSDSS" },
+    { DRDA_DSSFMT_RPYDSS,     "RPYDSS" },
+    { DRDA_DSSFMT_OBJDSS,     "OBJDSS" },
+    { DRDA_DSSFMT_CMNDSS,     "CMNDSS" },
+    { DRDA_DSSFMT_NORPYDSS,   "NORPYDSS" },
+    { 0,          NULL }
 };
 
 static guint iPreviousFrameNumber = 0;
@@ -666,245 +664,283 @@ static guint iPreviousFrameNumber = 0;
 static void
 drda_init(void)
 {
-       iPreviousFrameNumber = 0;
+    iPreviousFrameNumber = 0;
 }
 
 static void
 dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-       gint offset = 0;
-
-       guint16 iCommand;
-       guint16 iLength;
-       guint16 iCommandEnd = 0;
-
-       guint8 iFormatFlags;
-       guint8 iDSSType;
-       guint8 iDSSFlags;
-
-       guint16 iParameterCP;
-       gint iLengthParam;
-
-       col_set_str(pinfo->cinfo, COL_PROTOCOL, "DRDA");
-       /* This is a trick to know whether this is the first PDU in this packet or not */
-       if (iPreviousFrameNumber != pinfo->fd->num)
-               col_clear(pinfo->cinfo, COL_INFO);
-       else
-               col_append_str(pinfo->cinfo, COL_INFO, " | ");
-
-       iPreviousFrameNumber = pinfo->fd->num;
-       /* There may be multiple DRDA commands in one frame */
-       while ((guint) (offset + 10) <= tvb_length(tvb))
-       {
-               iCommand = tvb_get_ntohs(tvb, offset + 8);
-               iLength = tvb_get_ntohs(tvb, offset + 0);
-               /* iCommandEnd is the length of the packet up to the end of the current command */
-               iCommandEnd += iLength;
-
-               if (offset > 0)
-                       col_append_str(pinfo->cinfo, COL_INFO, " | ");
-               col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext(iCommand, &drda_opcode_abbr_ext, "Unknown (0x%02x)"));
-
-               if (tree)
-               {
-                       proto_tree      *drda_tree;
-                       proto_tree      *drdaroot_tree;
-                       proto_tree      *drda_tree_sub;
-                       proto_item      *ti;
-
-                       ti = proto_tree_add_item(tree, proto_drda, tvb, offset, -1, ENC_NA);
-                       proto_item_append_text(ti, " (%s)", val_to_str_ext(iCommand, &drda_opcode_vals_ext, "Unknown (0x%02x)"));
-                       drdaroot_tree = proto_item_add_subtree(ti, ett_drda);
-
-                       ti = proto_tree_add_text(drdaroot_tree, tvb, offset, 10, DRDA_TEXT_DDM);
-                       proto_item_append_text(ti, " (%s)", val_to_str_ext(iCommand, &drda_opcode_abbr_ext, "Unknown (0x%02x)"));
-                       drda_tree = proto_item_add_subtree(ti, ett_drda_ddm);
-
-                       proto_tree_add_item(drda_tree, hf_drda_ddm_length, tvb, offset + 0, 2, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(drda_tree, hf_drda_ddm_magic, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
-
-                       iFormatFlags = tvb_get_guint8(tvb, offset + 3);
-                       iDSSType = iFormatFlags & 0x0F;
-                       iDSSFlags = iFormatFlags >> 4;
-
-                       ti = proto_tree_add_item(drda_tree, hf_drda_ddm_format, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
-                       drda_tree_sub = proto_item_add_subtree(ti, ett_drda_ddm_format);
-
-                       proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_reserved, tvb, offset + 3, 1, iDSSFlags);
-                       proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_chained, tvb, offset + 3, 1, iDSSFlags);
-                       proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_errcont, tvb, offset + 3, 1, iDSSFlags);
-                       proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_samecorr, tvb, offset + 3, 1, iDSSFlags);
-                       proto_tree_add_uint(drda_tree_sub, hf_drda_ddm_fmt_dsstyp, tvb, offset + 3, 1, iDSSType);
-
-                       proto_tree_add_item(drda_tree, hf_drda_ddm_rc, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(drda_tree, hf_drda_ddm_length2, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(drda_tree, hf_drda_ddm_codepoint, tvb, offset + 8, 2, ENC_BIG_ENDIAN);
-
-                       /* The number of attributes is variable */
-                       for (offset += 10; offset < iCommandEnd; )
-                       {
-                               if (tvb_length_remaining(tvb, offset) >= 2)
-                               {
-                                       iLengthParam = tvb_get_ntohs(tvb, offset + 0);
-                                       if (iLengthParam == 0 || iLengthParam == 1) iLengthParam = iLength - 10;
-                                       if (tvb_length_remaining(tvb, offset) >= iLengthParam)
-                                       {
-                                               iParameterCP = tvb_get_ntohs(tvb, offset + 2);
-                                               ti = proto_tree_add_text(drdaroot_tree, tvb, offset, iLengthParam, DRDA_TEXT_PARAM);
-                                               proto_item_append_text(ti, " (%s)", val_to_str_ext(iParameterCP, &drda_opcode_vals_ext, "Unknown (0x%02x)"));
-                                               drda_tree_sub = proto_item_add_subtree(ti, ett_drda_param);
-                                               proto_tree_add_item(drda_tree_sub, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN);
-                                               proto_tree_add_item(drda_tree_sub, hf_drda_param_codepoint, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
-                                               proto_tree_add_item(drda_tree_sub, hf_drda_param_data, tvb, offset + 4, iLengthParam - 4, ENC_UTF_8|ENC_NA);
-                                               proto_tree_add_item(drda_tree_sub, hf_drda_param_data_ebcdic, tvb, offset + 4, iLengthParam - 4, ENC_EBCDIC|ENC_NA);
-                                               if (iCommand == DRDA_CP_SQLSTT)
-                                               {
-                                                       /* Extract SQL statement from packet */
-                                                       tvbuff_t* next_tvb = NULL;
-                                                       next_tvb = tvb_new_subset(tvb, offset + 4, iLengthParam - 4, iLengthParam - 4);
-                                                       add_new_data_source(pinfo, next_tvb, "SQL statement");
-                                                       proto_tree_add_item(drdaroot_tree, hf_drda_sqlstatement, next_tvb, 0, iLengthParam - 5, ENC_UTF_8|ENC_NA);
-                                                       proto_tree_add_item(drdaroot_tree, hf_drda_sqlstatement_ebcdic, next_tvb, 0, iLengthParam - 4, ENC_EBCDIC|ENC_NA);
-                                               }
-                                       }
-                                       offset += iLengthParam;
-                               }
-                               else
-                               {
-                                       break;
-                               }
-                       }
-               }
-               else
-               {
-                       /* No tree, advance directly to next command */
-                       offset += iLength;
-               }
-       }
+    gint offset = 0;
+
+    guint16 iCommand;
+    guint16 iLength;
+    guint16 iCommandEnd = 0;
+
+    guint8 iFormatFlags;
+    guint8 iDSSType;
+    guint8 iDSSFlags;
+
+    guint16 iParameterCP;
+    gint iLengthParam;
+
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "DRDA");
+    /* This is a trick to know whether this is the first PDU in this packet or not */
+    if (iPreviousFrameNumber != pinfo->fd->num)
+        col_clear(pinfo->cinfo, COL_INFO);
+    else
+        col_append_str(pinfo->cinfo, COL_INFO, " | ");
+
+    iPreviousFrameNumber = pinfo->fd->num;
+    /* There may be multiple DRDA commands in one frame */
+    while ((guint) (offset + 10) <= tvb_length(tvb))
+    {
+        iCommand = tvb_get_ntohs(tvb, offset + 8);
+        iLength = tvb_get_ntohs(tvb, offset + 0);
+        /* iCommandEnd is the length of the packet up to the end of the current command */
+        iCommandEnd += iLength;
+
+        if (offset > 0)
+            col_append_str(pinfo->cinfo, COL_INFO, " | ");
+        col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext(iCommand, &drda_opcode_abbr_ext, "Unknown (0x%02x)"));
+
+        if (tree)
+        {
+            proto_tree  *drda_tree;
+            proto_tree  *drdaroot_tree;
+            proto_tree  *drda_tree_sub;
+            proto_item  *ti;
+
+            ti = proto_tree_add_item(tree, proto_drda, tvb, offset, -1, ENC_NA);
+            proto_item_append_text(ti, " (%s)", val_to_str_ext(iCommand, &drda_opcode_vals_ext, "Unknown (0x%02x)"));
+            drdaroot_tree = proto_item_add_subtree(ti, ett_drda);
+
+            ti = proto_tree_add_text(drdaroot_tree, tvb, offset, 10, DRDA_TEXT_DDM);
+            proto_item_append_text(ti, " (%s)", val_to_str_ext(iCommand, &drda_opcode_abbr_ext, "Unknown (0x%02x)"));
+            drda_tree = proto_item_add_subtree(ti, ett_drda_ddm);
+
+            proto_tree_add_item(drda_tree, hf_drda_ddm_length, tvb, offset + 0, 2, ENC_BIG_ENDIAN);
+            proto_tree_add_item(drda_tree, hf_drda_ddm_magic, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
+
+            iFormatFlags = tvb_get_guint8(tvb, offset + 3);
+            iDSSType = iFormatFlags & 0x0F;
+            iDSSFlags = iFormatFlags >> 4;
+
+            ti = proto_tree_add_item(drda_tree, hf_drda_ddm_format, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
+            drda_tree_sub = proto_item_add_subtree(ti, ett_drda_ddm_format);
+
+            proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_reserved, tvb, offset + 3, 1, iDSSFlags);
+            proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_chained, tvb, offset + 3, 1, iDSSFlags);
+            proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_errcont, tvb, offset + 3, 1, iDSSFlags);
+            proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_samecorr, tvb, offset + 3, 1, iDSSFlags);
+            proto_tree_add_uint(drda_tree_sub, hf_drda_ddm_fmt_dsstyp, tvb, offset + 3, 1, iDSSType);
+
+            proto_tree_add_item(drda_tree, hf_drda_ddm_rc, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
+            proto_tree_add_item(drda_tree, hf_drda_ddm_length2, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
+            proto_tree_add_item(drda_tree, hf_drda_ddm_codepoint, tvb, offset + 8, 2, ENC_BIG_ENDIAN);
+
+            /* The number of attributes is variable */
+            for (offset += 10; offset < iCommandEnd; )
+            {
+                if (tvb_length_remaining(tvb, offset) >= 2)
+                {
+                    iLengthParam = tvb_get_ntohs(tvb, offset + 0);
+                    if (iLengthParam == 0 || iLengthParam == 1) iLengthParam = iLength - 10;
+                    if (tvb_length_remaining(tvb, offset) >= iLengthParam)
+                    {
+                        iParameterCP = tvb_get_ntohs(tvb, offset + 2);
+                        ti = proto_tree_add_text(drdaroot_tree, tvb, offset, iLengthParam,
+                                     DRDA_TEXT_PARAM);
+                        proto_item_append_text(ti, " (%s)", val_to_str_ext(iParameterCP, &drda_opcode_vals_ext, "Unknown (0x%02x)"));
+                        drda_tree_sub = proto_item_add_subtree(ti, ett_drda_param);
+                        proto_tree_add_item(drda_tree_sub, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN);
+                        proto_tree_add_item(drda_tree_sub, hf_drda_param_codepoint, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
+                        proto_tree_add_item(drda_tree_sub, hf_drda_param_data, tvb, offset + 4, iLengthParam - 4, ENC_UTF_8|ENC_NA);
+                        proto_tree_add_item(drda_tree_sub, hf_drda_param_data_ebcdic, tvb, offset + 4, iLengthParam - 4, ENC_EBCDIC|ENC_NA);
+                        if (iCommand == DRDA_CP_SQLSTT)
+                        {
+                            /* Extract SQL statement from packet */
+                            tvbuff_t* next_tvb = NULL;
+                            next_tvb = tvb_new_subset(tvb, offset + 4, iLengthParam - 4, iLengthParam - 4);
+                            add_new_data_source(pinfo, next_tvb, "SQL statement");
+                            proto_tree_add_item(drdaroot_tree, hf_drda_sqlstatement, next_tvb, 0, iLengthParam - 5, ENC_UTF_8|ENC_NA);
+                            proto_tree_add_item(drdaroot_tree, hf_drda_sqlstatement_ebcdic, next_tvb, 0, iLengthParam - 4, ENC_EBCDIC|ENC_NA);
+                        }
+                    }
+                    offset += iLengthParam;
+                }
+                else
+                {
+                    break;
+                }
+            }
+        }
+        else
+        {
+            /* No tree, advance directly to next command */
+            offset += iLength;
+        }
+    }
 }
 
 static guint
 get_drda_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
 {
-       if (tvb_length_remaining(tvb, offset) >= 10)
-       {
-               return (tvb_get_ntohs(tvb, offset));
-       }
-       return 0;
+    if (tvb_length_remaining(tvb, offset) >= 10)
+    {
+        return (tvb_get_ntohs(tvb, offset));
+    }
+    return 0;
 }
 
 static void
 dissect_drda_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-       tcp_dissect_pdus(tvb, pinfo, tree, drda_desegment, 10, get_drda_pdu_len, dissect_drda);
+    tcp_dissect_pdus(tvb, pinfo, tree, drda_desegment, 10, get_drda_pdu_len, dissect_drda);
 }
 
 
 static gboolean
 dissect_drda_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-       conversation_t * conversation;
-       if (tvb_length(tvb) >= 10)
-       {
-               /* The first header is 6 bytes long, so the length in the second header should 6 bytes less */
-               guint16 cOuterLength, cInnerLength;
-               cOuterLength = tvb_get_ntohs(tvb, 0);
-               cInnerLength = tvb_get_ntohs(tvb, 6);
-               if ((tvb_get_guint8(tvb, 2) == DRDA_MAGIC) && ((cOuterLength - cInnerLength) == 6))
-               {
-                       /* Register this dissector for this conversation */
-                       conversation = find_or_create_conversation(pinfo);
-                       conversation_set_dissector(conversation, drda_tcp_handle);
-
-                       /* Dissect the packet */
-                       dissect_drda(tvb, pinfo, tree);
-                       return TRUE;
-               }
-       }
-       return FALSE;
+    conversation_t * conversation;
+    if (tvb_length(tvb) >= 10)
+    {
+        /* The first header is 6 bytes long, so the length in the second header should 6 bytes less */
+        guint16 cOuterLength, cInnerLength;
+        cOuterLength = tvb_get_ntohs(tvb, 0);
+        cInnerLength = tvb_get_ntohs(tvb, 6);
+        if ((tvb_get_guint8(tvb, 2) == DRDA_MAGIC) && ((cOuterLength - cInnerLength) == 6))
+        {
+            /* Register this dissector for this conversation */
+            conversation = find_or_create_conversation(pinfo);
+            conversation_set_dissector(conversation, drda_tcp_handle);
+
+            /* Dissect the packet */
+            dissect_drda(tvb, pinfo, tree);
+            return TRUE;
+        }
+    }
+    return FALSE;
 }
 
 void
 proto_register_drda(void)
 {
-  static hf_register_info hf[] = {
-   { &hf_drda_ddm_length,
-      { "Length", "drda.ddm.length", FT_UINT16, BASE_DEC, NULL, 0x0, "DDM length", HFILL }},
-
-   { &hf_drda_ddm_magic,
-      { "Magic", "drda.ddm.ddmid", FT_UINT8, BASE_HEX, NULL, 0x0, "DDM magic", HFILL }},
-
-   { &hf_drda_ddm_format,
-      { "Format", "drda.ddm.format", FT_UINT8, BASE_HEX, NULL, 0x0, "DDM format", HFILL }},
-
-   { &hf_drda_ddm_fmt_reserved,
-      { "Reserved", "drda.ddm.fmt.bit0", FT_BOOLEAN, 4, TFS(&tfs_set_notset), DRDA_DSSFMT_RESERVED, "DSSFMT reserved", HFILL }},
-
-   { &hf_drda_ddm_fmt_chained,
-      { "Chained", "drda.ddm.fmt.bit1", FT_BOOLEAN, 4, TFS(&tfs_set_notset), DRDA_DSSFMT_CHAINED, "DSSFMT chained", HFILL }},
-
-   { &hf_drda_ddm_fmt_errcont,
-      { "Continue", "drda.ddm.fmt.bit2", FT_BOOLEAN, 4, TFS(&tfs_set_notset), DRDA_DSSFMT_CONTINUE, "DSSFMT continue on error", HFILL }},
-
-   { &hf_drda_ddm_fmt_samecorr,
-      { "Same correlation", "drda.ddm.fmt.bit3", FT_BOOLEAN, 4, TFS(&tfs_set_notset), DRDA_DSSFMT_SAME_CORR, "DSSFMT same correlation", HFILL }},
-
-   { &hf_drda_ddm_fmt_dsstyp,
-      { "DSS type", "drda.ddm.fmt.dsstyp", FT_UINT8, BASE_DEC, VALS(drda_dsstyp_abbr), 0x0, "DSSFMT type", HFILL }},
-
-   { &hf_drda_ddm_rc,
-      { "CorrelId", "drda.ddm.rqscrr", FT_UINT16, BASE_DEC, NULL, 0x0, "DDM correlation identifier", HFILL }},
-
-   { &hf_drda_ddm_length2,
-      { "Length2", "drda.ddm.length2", FT_UINT16, BASE_DEC, NULL, 0x0, "DDM length2", HFILL }},
-
-   { &hf_drda_ddm_codepoint,
-      { "Code point", "drda.ddm.codepoint", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &drda_opcode_abbr_ext, 0x0, "DDM code point", HFILL }},
-
-   { &hf_drda_param_length,
-      { "Length", "drda.param.length", FT_UINT16, BASE_DEC, NULL, 0x0, "Param length", HFILL }},
-
-   { &hf_drda_param_codepoint,
-      { "Code point", "drda.param.codepoint", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &drda_opcode_abbr_ext, 0x0, "Param code point", HFILL }},
-
-   { &hf_drda_param_data,
-      { "Data (ASCII)", "drda.param.data", FT_STRING, BASE_NONE, NULL, 0x0, "Param data left as ASCII for display", HFILL }},
-
-   { &hf_drda_param_data_ebcdic,
-      { "Data (EBCDIC)", "drda.param.data.ebcdic", FT_STRING, BASE_NONE, NULL, 0x0, "Param data converted from EBCDIC to ASCII for display", HFILL }},
-
-   { &hf_drda_sqlstatement,
-     { "SQL statement (ASCII)", "drda.sqlstatement", FT_STRING, BASE_NONE, NULL, 0x0, "SQL statement left as ASCII for display", HFILL }},
-
-   { &hf_drda_sqlstatement_ebcdic,
-      { "SQL statement (EBCDIC)", "drda.sqlstatement.ebcdic", FT_STRING, BASE_NONE, NULL, 0x0, "SQL statement converted from EBCDIC to ASCII for display", HFILL }}
-
-  };
-  static gint *ett[] = {
-    &ett_drda,
-    &ett_drda_ddm,
-    &ett_drda_ddm_format,
-    &ett_drda_param
-  };
-
-  module_t *drda_module;
-
-  proto_drda = proto_register_protocol("DRDA", "DRDA", "drda");
-  proto_register_field_array(proto_drda, hf, array_length(hf));
-  proto_register_subtree_array(ett, array_length(ett));
-
-  drda_module = prefs_register_protocol(proto_drda, NULL);
-  prefs_register_bool_preference(drda_module, "desegment",
-    "Reassemble DRDA messages spanning multiple TCP segments",
-    "Whether the DRDA dissector should reassemble messages spanning multiple TCP segments."
-    " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
-    &drda_desegment);
-  register_init_routine(&drda_init);
+    static hf_register_info hf[] = {
+        { &hf_drda_ddm_length,
+          { "Length", "drda.ddm.length",
+            FT_UINT16, BASE_DEC, NULL, 0x0,
+            "DDM length", HFILL }},
+
+        { &hf_drda_ddm_magic,
+          { "Magic", "drda.ddm.ddmid",
+            FT_UINT8, BASE_HEX, NULL, 0x0,
+            "DDM magic", HFILL }},
+
+        { &hf_drda_ddm_format,
+          { "Format", "drda.ddm.format",
+            FT_UINT8, BASE_HEX, NULL, 0x0,
+            "DDM format", HFILL }},
+
+        { &hf_drda_ddm_fmt_reserved,
+          { "Reserved", "drda.ddm.fmt.bit0",
+            FT_BOOLEAN, 4, TFS(&tfs_set_notset), DRDA_DSSFMT_RESERVED,
+            "DSSFMT reserved", HFILL }},
+
+        { &hf_drda_ddm_fmt_chained,
+          { "Chained", "drda.ddm.fmt.bit1",
+            FT_BOOLEAN, 4, TFS(&tfs_set_notset), DRDA_DSSFMT_CHAINED,
+            "DSSFMT chained", HFILL }},
+
+        { &hf_drda_ddm_fmt_errcont,
+          { "Continue", "drda.ddm.fmt.bit2",
+            FT_BOOLEAN, 4, TFS(&tfs_set_notset), DRDA_DSSFMT_CONTINUE,
+            "DSSFMT continue on error", HFILL }},
+
+        { &hf_drda_ddm_fmt_samecorr,
+          { "Same correlation", "drda.ddm.fmt.bit3",
+            FT_BOOLEAN, 4, TFS(&tfs_set_notset), DRDA_DSSFMT_SAME_CORR,
+            "DSSFMT same correlation", HFILL }},
+
+        { &hf_drda_ddm_fmt_dsstyp,
+          { "DSS type", "drda.ddm.fmt.dsstyp",
+            FT_UINT8, BASE_DEC, VALS(drda_dsstyp_abbr), 0x0,
+            "DSSFMT type", HFILL }},
+
+        { &hf_drda_ddm_rc,
+          { "CorrelId", "drda.ddm.rqscrr",
+            FT_UINT16, BASE_DEC, NULL, 0x0,
+            "DDM correlation identifier", HFILL }},
+
+        { &hf_drda_ddm_length2,
+          { "Length2", "drda.ddm.length2",
+            FT_UINT16, BASE_DEC, NULL, 0x0,
+            "DDM length2", HFILL }},
+
+        { &hf_drda_ddm_codepoint,
+          { "Code point", "drda.ddm.codepoint",
+            FT_UINT16, BASE_HEX|BASE_EXT_STRING, &drda_opcode_abbr_ext, 0x0,
+            "DDM code point", HFILL }},
+
+        { &hf_drda_param_length,
+          { "Length", "drda.param.length",
+            FT_UINT16, BASE_DEC, NULL, 0x0,
+            "Param length", HFILL }},
+
+        { &hf_drda_param_codepoint,
+          { "Code point", "drda.param.codepoint",
+            FT_UINT16, BASE_HEX|BASE_EXT_STRING, &drda_opcode_abbr_ext, 0x0,
+            "Param code point", HFILL }},
+
+        { &hf_drda_param_data,
+          { "Data (ASCII)", "drda.param.data",
+            FT_STRING, BASE_NONE, NULL, 0x0,
+            "Param data left as ASCII for display", HFILL }},
+
+        { &hf_drda_param_data_ebcdic,
+          { "Data (EBCDIC)", "drda.param.data.ebcdic",
+            FT_STRING, BASE_NONE, NULL, 0x0,
+            "Param data converted from EBCDIC to ASCII for display", HFILL }},
+
+        { &hf_drda_sqlstatement,
+          { "SQL statement (ASCII)", "drda.sqlstatement",
+            FT_STRING, BASE_NONE, NULL, 0x0,
+            "SQL statement left as ASCII for display", HFILL }},
+
+        { &hf_drda_sqlstatement_ebcdic,
+          { "SQL statement (EBCDIC)", "drda.sqlstatement.ebcdic",
+            FT_STRING, BASE_NONE, NULL, 0x0,
+            "SQL statement converted from EBCDIC to ASCII for display", HFILL }}
+
+    };
+    static gint *ett[] = {
+        &ett_drda,
+        &ett_drda_ddm,
+        &ett_drda_ddm_format,
+        &ett_drda_param
+    };
+
+    module_t *drda_module;
+
+    proto_drda = proto_register_protocol("DRDA", "DRDA", "drda");
+    proto_register_field_array(proto_drda, hf, array_length(hf));
+    proto_register_subtree_array(ett, array_length(ett));
+
+    drda_module = prefs_register_protocol(proto_drda, NULL);
+    prefs_register_bool_preference(drda_module, "desegment",
+                       "Reassemble DRDA messages spanning multiple TCP segments",
+                       "Whether the DRDA dissector should reassemble messages spanning"
+                       " multiple TCP segments."
+                       " To use this option, you must also enable"
+                       " \"Allow subdissectors to reassemble TCP streams\""
+                       " in the TCP protocol settings.",
+                       &drda_desegment);
+    register_init_routine(&drda_init);
 }
 
 void
 proto_reg_handoff_drda(void)
 {
-       heur_dissector_add("tcp", dissect_drda_heur, proto_drda);
-       drda_tcp_handle = create_dissector_handle(dissect_drda_tcp, proto_drda);
+    heur_dissector_add("tcp", dissect_drda_heur, proto_drda);
+    drda_tcp_handle = create_dissector_handle(dissect_drda_tcp, proto_drda);
 }
index d002d61f2ba913bc811436765f62c6c5d5e1a0f2..8c8ab1fe96683a5b15318a6b1a952ed2d7bde080 100644 (file)
@@ -162,7 +162,7 @@ static const value_string names_message_type[] = {
 };
 
 static const value_string names_error[] = {
-       {       0, "OK" },
+       {       0,     "OK" },
        {       10014, "WSAEFAULT" },
        {       10060, "WSAETIMEDOUT" },
        {       10108, "WSASERVICE_NOT_FOUND" },
@@ -171,7 +171,7 @@ static const value_string names_error[] = {
 };
 
 static const value_string names_family[] = {
-       {       WINSOCK_AF_INET,        "AF_INET"       },
+       {       WINSOCK_AF_INET, "AF_INET"      },
        {       0, NULL }
 };
 
@@ -834,300 +834,372 @@ void proto_reg_handoff_dtpt(void);
 void
 proto_register_dtpt(void)
 {
-  static hf_register_info hf[] = {
-    { &hf_dtpt_version,
-      { "Version", "dtpt.version",
-       FT_UINT8, BASE_DEC, NULL, 0x0,
-       "Protocol Version", HFILL }},
-    { &hf_dtpt_message_type,
-      { "Message Type", "dtpt.message_type",
-       FT_UINT8, BASE_DEC, VALS(names_message_type), 0x0,
-       "Packet Message Type", HFILL }},
-    { &hf_dtpt_flags,
-      { "ControlFlags", "dtpt.flags",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "ControlFlags as documented for WSALookupServiceBegin", HFILL }},
-    { &hf_dtpt_flags_deep,
-      { "DEEP", "dtpt.flags.deep",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_DEEP,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_containers,
-      { "CONTAINERS", "dtpt.flags.containers",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_CONTAINERS,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_nocontainers,
-      { "NOCONTAINERS", "dtpt.flags.nocontainers",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_NOCONTAINERS,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_nearest,
-      { "NEAREST", "dtpt.flags.nearest",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_NEAREST,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_return_name,
-      { "RETURN_NAME", "dtpt.flags.return_name",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_NAME,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_return_type,
-      { "RETURN_TYPE", "dtpt.flags.return_type",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_TYPE,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_return_version,
-      { "RETURN_VERSION", "dtpt.flags.return_version",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_VERSION,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_return_comment,
-      { "RETURN_COMMENT", "dtpt.flags.return_comment",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_COMMENT,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_return_addr,
-      { "RETURN_ADDR", "dtpt.flags.return_addr",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_ADDR,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_return_blob,
-      { "RETURN_BLOB", "dtpt.flags.return_blob",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_BLOB,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_return_aliases,
-      { "RETURN_ALIASES", "dtpt.flags.return_aliases",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_ALIASES,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_return_query_string,
-      { "RETURN_QUERY_STRING", "dtpt.flags.return_query_string",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_QUERY_STRING,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_flushcache,
-      { "FLUSHCACHE", "dtpt.flags.flushcache",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_FLUSHCACHE,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_flushprevious,
-      { "FLUSHPREVIOUS", "dtpt.flags.flushprevious",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_FLUSHPREVIOUS,
-       NULL, HFILL }},
-    { &hf_dtpt_flags_res_service,
-      { "RES_SERVICE", "dtpt.flags.res_service",
-       FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RES_SERVICE,
-       NULL, HFILL }},
-    { &hf_dtpt_payload_size,
-      { "Payload Size", "dtpt.payload_size",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "Payload Size of the following packet containing a serialized WSAQUERYSET", HFILL }},
-    { &hf_dtpt_handle,
-      { "Handle", "dtpt.handle",
-       FT_UINT64, BASE_HEX, NULL, 0x0,
-       "Lookup handle", HFILL }},
-    { &hf_dtpt_error,
-      { "Last Error", "dtpt.error",
-       FT_UINT32, BASE_DEC, VALS(names_error), 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_buffer_size,
-      { "Buffer Size", "dtpt.buffer_size",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_data_size,
-      { "Data Size", "dtpt.data_size",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_queryset_rawsize,
-      { "QuerySet Size", "dtpt.queryset_size",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "Size of the binary WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_size,
-      { "dwSize", "dtpt.queryset.dwSize",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "dwSize field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_service_instance_name_pointer,
-      { "lpszServiceInstanceName", "dtpt.queryset.lpszServiceInstanceName",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "lpszServiceInstanceName field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_service_class_id_pointer,
-      { "lpServiceClassId", "dtpt.queryset.lpServiceClassId",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "lpServiceClassId in the WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_version,
-      { "lpVersion", "dtpt.queryset.lpVersion",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "lpVersion in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_comment_pointer,
-      { "lpszComment", "dtpt.lpszComment",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "lpszComment field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_namespace,
-      { "dwNameSpace", "dtpt.queryset.dwNameSpace",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "dwNameSpace field in WSAQUERYSE", HFILL }},
-    { &hf_dtpt_queryset_provider_id_pointer,
-      { "lpNSProviderId", "dtpt.queryset.lpNSProviderId",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "lpNSProviderId field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_context_pointer,
-      { "lpszContext", "dtpt.queryset.lpszContext",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "lpszContext field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_protocols_number,
-      { "dwNumberOfProtocols", "dtpt.queryset.dwNumberOfProtocols",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "dwNumberOfProtocols field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_protocols_pointer,
-      { "lpafpProtocols", "dtpt.queryset.lpafpProtocols",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "lpafpProtocols field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_query_string_pointer,
-      { "lpszQueryString", "dtpt.queryset.lpszQueryString",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "lpszQueryString field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_cs_addrs_number,
-      { "dwNumberOfCsAddrs", "dtpt.queryset.dwNumberOfCsAddrs",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "dwNumberOfCsAddrs field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_cs_addrs_pointer,
-      { "lpcsaBuffer", "dtpt.queryset.lpcsaBuffer",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "lpcsaBuffer field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_output_flags,
-      { "dwOutputFlags", "dtpt.queryset.dwOutputFlags",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "dwOutputFlags field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_queryset_blob_pointer,
-      { "lpBlob", "dtpt.queryset.lpBlob",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "lpBlob field in WSAQUERYSET", HFILL }},
-    { &hf_dtpt_wstring_length,
-      { "Length", "dtpt.wstring.length",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "String Length", HFILL }},
-    { &hf_dtpt_wstring_data,
-      { "Data", "dtpt.wstring.data",
-       FT_STRING, BASE_NONE, NULL, 0x0,
-       "String Data", HFILL }},
-    { &hf_dtpt_guid_length,
-      { "Length", "dtpt.guid.length",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "GUID Length", HFILL }},
-    { &hf_dtpt_guid_data,
-      { "Data", "dtpt.guid.data",
-       FT_GUID, BASE_NONE, NULL, 0x0,
-       "GUID Data", HFILL }},
-    { &hf_dtpt_service_instance_name,
-      { "Service Instance Name", "dtpt.service_instance_name",
-       FT_STRINGZ, BASE_NONE, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_service_class_id,
-      { "Service Class ID", "dtpt.service_class_id",
-       FT_GUID, BASE_NONE, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_comment,
-      { "Comment", "dtpt.comment",
-       FT_STRINGZ, BASE_NONE, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_ns_provider_id,
-      { "NS Provider ID", "dtpt.ns_provider_id",
-       FT_GUID, BASE_NONE, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_context,
-      { "Context", "dtpt.context",
-       FT_STRINGZ, BASE_NONE, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_protocols_number,
-      { "Number of Protocols", "dtpt.protocols.number",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_protocols_length,
-      { "Length of Protocols", "dtpt.protocols.length",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_protocol_family,
-      { "Family", "dtpt.protocol.family",
-       FT_UINT32, BASE_DEC, VALS(names_family), 0x0,
-       "Protocol Family", HFILL }},
-    { &hf_dtpt_protocol_protocol,
-      { "Protocol", "dtpt.protocol.protocol",
-       FT_UINT32, BASE_DEC, VALS(names_protocol), 0x0,
-       "Protocol Protocol", HFILL }},
-    { &hf_dtpt_query_string,
-      { "Query String", "dtpt.query_string",
-       FT_STRINGZ, BASE_NONE, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_cs_addrs_number,
-      { "Number of CS Addresses", "dtpt.cs_addrs.number",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_cs_addrs_length1,
-      { "Length of CS Addresses Part 1", "dtpt.cs_addrs.length1",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_cs_addr_socket_type,
-      { "Socket Type", "dtpt.cs_addrs.socket_type",
-       FT_UINT32, BASE_DEC, VALS(names_socket_type), 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_cs_addr_protocol,
-      { "Protocol", "dtpt.cs_addrs.protocol",
-       FT_UINT32, BASE_DEC, VALS(names_protocol), 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_cs_addr_local_pointer,
-      { "Local Address Pointer", "dtpt.cs_addr.local_pointer",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_cs_addr_local_length,
-      { "Local Address Length", "dtpt.cs_addr.local_length",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "Local Address Pointer", HFILL }},
-    { &hf_dtpt_cs_addr_local,
-      { "Local Address", "dtpt.cs_addr.local",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_cs_addr_remote_pointer,
-      { "Remote Address Pointer", "dtpt.cs_addr.remote_pointer",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_cs_addr_remote_length,
-      { "Remote Address Length", "dtpt.cs_addr.remote_length",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "Remote Address Pointer", HFILL }},
-    { &hf_dtpt_cs_addr_remote,
-      { "Remote Address", "dtpt.cs_addr.remote",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       NULL, HFILL }},
-    { &hf_dtpt_sockaddr_length,
-      { "Length", "dtpt.sockaddr.length",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Socket Address Length", HFILL }},
-    { &hf_dtpt_sockaddr_family,
-      { "Family", "dtpt.sockaddr.family",
-       FT_UINT16, BASE_DEC, VALS(names_family), 0x0,
-       "Socket Address Family", HFILL }},
-    { &hf_dtpt_sockaddr_port,
-      { "Port", "dtpt.sockaddr.port",
-       FT_UINT16, BASE_DEC, NULL, 0x0,
-       "Socket Address Port", HFILL }},
-    { &hf_dtpt_sockaddr_address,
-      { "Address", "dtpt.sockaddr.address",
-       FT_IPv4, BASE_NONE, NULL, 0x0,
-       "Socket Address Address", HFILL }},
-    { &hf_dtpt_blob_rawsize,
-      { "Blob Size", "dtpt.blob_size",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "Size of the binary BLOB", HFILL }},
-    { &hf_dtpt_blob_size,
-      { "cbSize", "dtpt.blob.cbSize",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "cbSize field in BLOB", HFILL }},
-    { &hf_dtpt_blob_data_pointer,
-      { "pBlobData", "dtpt.blob.pBlobData",
-       FT_UINT32, BASE_HEX, NULL, 0x0,
-       "pBlobData field in BLOB", HFILL }},
-    { &hf_dtpt_blob_data_length,
-      { "Length", "dtpt.blob.data_length",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "Length of the Blob Data Block", HFILL }},
-    { &hf_dtpt_blob_data,
-      { "Data", "dtpt.blob.data",
-       FT_BYTES, BASE_NONE, NULL, 0x0,
-       "Blob Data Block", HFILL }},
-    { &hf_dtpt_connect_addr,
-      { "Address", "dtpt.connect_addr",
-       FT_UINT32, BASE_DEC, NULL, 0x0,
-       "Connect to Address", HFILL }},
-  };
+       static hf_register_info hf[] = {
+               { &hf_dtpt_version,
+                 { "Version", "dtpt.version",
+                   FT_UINT8, BASE_DEC, NULL, 0x0,
+                   "Protocol Version", HFILL }},
+
+               { &hf_dtpt_message_type,
+                 { "Message Type", "dtpt.message_type",
+                   FT_UINT8, BASE_DEC, VALS(names_message_type), 0x0,
+                   "Packet Message Type", HFILL }},
+
+               { &hf_dtpt_flags,
+                 { "ControlFlags", "dtpt.flags",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "ControlFlags as documented for WSALookupServiceBegin", HFILL }},
+
+               { &hf_dtpt_flags_deep,
+                 { "DEEP", "dtpt.flags.deep",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_DEEP,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_containers,
+                 { "CONTAINERS", "dtpt.flags.containers",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_CONTAINERS,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_nocontainers,
+                 { "NOCONTAINERS", "dtpt.flags.nocontainers",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_NOCONTAINERS,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_nearest,
+                 { "NEAREST", "dtpt.flags.nearest",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_NEAREST,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_return_name,
+                 { "RETURN_NAME", "dtpt.flags.return_name",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_NAME,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_return_type,
+                 { "RETURN_TYPE", "dtpt.flags.return_type",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_TYPE,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_return_version,
+                 { "RETURN_VERSION", "dtpt.flags.return_version",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_VERSION,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_return_comment,
+                 { "RETURN_COMMENT", "dtpt.flags.return_comment",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_COMMENT,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_return_addr,
+                 { "RETURN_ADDR", "dtpt.flags.return_addr",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_ADDR,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_return_blob,
+                 { "RETURN_BLOB", "dtpt.flags.return_blob",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_BLOB,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_return_aliases,
+                 { "RETURN_ALIASES", "dtpt.flags.return_aliases",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_ALIASES,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_return_query_string,
+                 { "RETURN_QUERY_STRING", "dtpt.flags.return_query_string",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RETURN_QUERY_STRING,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_flushcache,
+                 { "FLUSHCACHE", "dtpt.flags.flushcache",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_FLUSHCACHE,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_flushprevious,
+                 { "FLUSHPREVIOUS", "dtpt.flags.flushprevious",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_FLUSHPREVIOUS,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_flags_res_service,
+                 { "RES_SERVICE", "dtpt.flags.res_service",
+                   FT_BOOLEAN, 32, TFS(&tfs_set_notset), LUP_RES_SERVICE,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_payload_size,
+                 { "Payload Size", "dtpt.payload_size",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "Payload Size of the following packet containing a serialized WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_handle,
+                 { "Handle", "dtpt.handle",
+                   FT_UINT64, BASE_HEX, NULL, 0x0,
+                   "Lookup handle", HFILL }},
+
+               { &hf_dtpt_error,
+                 { "Last Error", "dtpt.error",
+                   FT_UINT32, BASE_DEC, VALS(names_error), 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_buffer_size,
+                 { "Buffer Size", "dtpt.buffer_size",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_data_size,
+                 { "Data Size", "dtpt.data_size",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_queryset_rawsize,
+                 { "QuerySet Size", "dtpt.queryset_size",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "Size of the binary WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_size,
+                 { "dwSize", "dtpt.queryset.dwSize",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "dwSize field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_service_instance_name_pointer,
+                 { "lpszServiceInstanceName", "dtpt.queryset.lpszServiceInstanceName",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "lpszServiceInstanceName field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_service_class_id_pointer,
+                 { "lpServiceClassId", "dtpt.queryset.lpServiceClassId",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "lpServiceClassId in the WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_version,
+                 { "lpVersion", "dtpt.queryset.lpVersion",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "lpVersion in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_comment_pointer,
+                 { "lpszComment", "dtpt.lpszComment",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "lpszComment field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_namespace,
+                 { "dwNameSpace", "dtpt.queryset.dwNameSpace",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "dwNameSpace field in WSAQUERYSE", HFILL }},
+
+               { &hf_dtpt_queryset_provider_id_pointer,
+                 { "lpNSProviderId", "dtpt.queryset.lpNSProviderId",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "lpNSProviderId field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_context_pointer,
+                 { "lpszContext", "dtpt.queryset.lpszContext",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "lpszContext field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_protocols_number,
+                 { "dwNumberOfProtocols", "dtpt.queryset.dwNumberOfProtocols",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "dwNumberOfProtocols field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_protocols_pointer,
+                 { "lpafpProtocols", "dtpt.queryset.lpafpProtocols",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "lpafpProtocols field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_query_string_pointer,
+                 { "lpszQueryString", "dtpt.queryset.lpszQueryString",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "lpszQueryString field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_cs_addrs_number,
+                 { "dwNumberOfCsAddrs", "dtpt.queryset.dwNumberOfCsAddrs",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "dwNumberOfCsAddrs field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_cs_addrs_pointer,
+                 { "lpcsaBuffer", "dtpt.queryset.lpcsaBuffer",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "lpcsaBuffer field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_output_flags,
+                 { "dwOutputFlags", "dtpt.queryset.dwOutputFlags",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "dwOutputFlags field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_queryset_blob_pointer,
+                 { "lpBlob", "dtpt.queryset.lpBlob",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "lpBlob field in WSAQUERYSET", HFILL }},
+
+               { &hf_dtpt_wstring_length,
+                 { "Length", "dtpt.wstring.length",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "String Length", HFILL }},
+
+               { &hf_dtpt_wstring_data,
+                 { "Data", "dtpt.wstring.data",
+                   FT_STRING, BASE_NONE, NULL, 0x0,
+                   "String Data", HFILL }},
+
+               { &hf_dtpt_guid_length,
+                 { "Length", "dtpt.guid.length",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "GUID Length", HFILL }},
+
+               { &hf_dtpt_guid_data,
+                 { "Data", "dtpt.guid.data",
+                   FT_GUID, BASE_NONE, NULL, 0x0,
+                   "GUID Data", HFILL }},
+
+               { &hf_dtpt_service_instance_name,
+                 { "Service Instance Name", "dtpt.service_instance_name",
+                   FT_STRINGZ, BASE_NONE, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_service_class_id,
+                 { "Service Class ID", "dtpt.service_class_id",
+                   FT_GUID, BASE_NONE, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_comment,
+                 { "Comment", "dtpt.comment",
+                   FT_STRINGZ, BASE_NONE, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_ns_provider_id,
+                 { "NS Provider ID", "dtpt.ns_provider_id",
+                   FT_GUID, BASE_NONE, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_context,
+                 { "Context", "dtpt.context",
+                   FT_STRINGZ, BASE_NONE, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_protocols_number,
+                 { "Number of Protocols", "dtpt.protocols.number",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_protocols_length,
+                 { "Length of Protocols", "dtpt.protocols.length",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_protocol_family,
+                 { "Family", "dtpt.protocol.family",
+                   FT_UINT32, BASE_DEC, VALS(names_family), 0x0,
+                   "Protocol Family", HFILL }},
+
+               { &hf_dtpt_protocol_protocol,
+                 { "Protocol", "dtpt.protocol.protocol",
+                   FT_UINT32, BASE_DEC, VALS(names_protocol), 0x0,
+                   "Protocol Protocol", HFILL }},
+
+               { &hf_dtpt_query_string,
+                 { "Query String", "dtpt.query_string",
+                   FT_STRINGZ, BASE_NONE, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_cs_addrs_number,
+                 { "Number of CS Addresses", "dtpt.cs_addrs.number",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_cs_addrs_length1,
+                 { "Length of CS Addresses Part 1", "dtpt.cs_addrs.length1",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_cs_addr_socket_type,
+                 { "Socket Type", "dtpt.cs_addrs.socket_type",
+                   FT_UINT32, BASE_DEC, VALS(names_socket_type), 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_cs_addr_protocol,
+                 { "Protocol", "dtpt.cs_addrs.protocol",
+                   FT_UINT32, BASE_DEC, VALS(names_protocol), 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_cs_addr_local_pointer,
+                 { "Local Address Pointer", "dtpt.cs_addr.local_pointer",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_cs_addr_local_length,
+                 { "Local Address Length", "dtpt.cs_addr.local_length",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "Local Address Pointer", HFILL }},
+
+               { &hf_dtpt_cs_addr_local,
+                 { "Local Address", "dtpt.cs_addr.local",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_cs_addr_remote_pointer,
+                 { "Remote Address Pointer", "dtpt.cs_addr.remote_pointer",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_cs_addr_remote_length,
+                 { "Remote Address Length", "dtpt.cs_addr.remote_length",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "Remote Address Pointer", HFILL }},
+
+               { &hf_dtpt_cs_addr_remote,
+                 { "Remote Address", "dtpt.cs_addr.remote",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   NULL, HFILL }},
+
+               { &hf_dtpt_sockaddr_length,
+                 { "Length", "dtpt.sockaddr.length",
+                   FT_UINT16, BASE_DEC, NULL, 0x0,
+                   "Socket Address Length", HFILL }},
+
+               { &hf_dtpt_sockaddr_family,
+                 { "Family", "dtpt.sockaddr.family",
+                   FT_UINT16, BASE_DEC, VALS(names_family), 0x0,
+                   "Socket Address Family", HFILL }},
+
+               { &hf_dtpt_sockaddr_port,
+                 { "Port", "dtpt.sockaddr.port",
+                   FT_UINT16, BASE_DEC, NULL, 0x0,
+                   "Socket Address Port", HFILL }},
+
+               { &hf_dtpt_sockaddr_address,
+                 { "Address", "dtpt.sockaddr.address",
+                   FT_IPv4, BASE_NONE, NULL, 0x0,
+                   "Socket Address Address", HFILL }},
+
+               { &hf_dtpt_blob_rawsize,
+                 { "Blob Size", "dtpt.blob_size",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "Size of the binary BLOB", HFILL }},
+
+               { &hf_dtpt_blob_size,
+                 { "cbSize", "dtpt.blob.cbSize",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "cbSize field in BLOB", HFILL }},
+
+               { &hf_dtpt_blob_data_pointer,
+                 { "pBlobData", "dtpt.blob.pBlobData",
+                   FT_UINT32, BASE_HEX, NULL, 0x0,
+                   "pBlobData field in BLOB", HFILL }},
+
+               { &hf_dtpt_blob_data_length,
+                 { "Length", "dtpt.blob.data_length",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "Length of the Blob Data Block", HFILL }},
+
+               { &hf_dtpt_blob_data,
+                 { "Data", "dtpt.blob.data",
+                   FT_BYTES, BASE_NONE, NULL, 0x0,
+                   "Blob Data Block", HFILL }},
+
+               { &hf_dtpt_connect_addr,
+                 { "Address", "dtpt.connect_addr",
+                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "Connect to Address", HFILL }},
+       };
        static gint *ett[] = {
                &ett_dtpt,
                &ett_dtpt_flags,
@@ -1150,17 +1222,17 @@ proto_register_dtpt(void)
        guids_add_guid(&guid_svcid_inet_hostaddrbyinetstring, "SVCID_INET_HOSTADDRBYINETSTRING");
 
        proto_dtpt = proto_register_protocol("DeskTop PassThrough Protocol",
-                                       "DTPT", "dtpt");
+                                            "DTPT", "dtpt");
        proto_register_field_array(proto_dtpt, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));
 
        /* Register a configuration option for port */
        dtpt_module = prefs_register_protocol(proto_dtpt,
-               proto_reg_handoff_dtpt);
+                                             proto_reg_handoff_dtpt);
        prefs_register_uint_preference(dtpt_module, "tcp.port",
-                                       "DTPT Server TCP Port",
-                                       "Set the TDP port for the DTPT Server",
-                                       10, &gbl_dtptServerPort);
+                                      "DTPT Server TCP Port",
+                                      "Set the TDP port for the DTPT Server",
+                                      10, &gbl_dtptServerPort);
 }
 
 
index 6b6bc7caad6ef12f87916c55fd9e66fdd91aa055..9bbfd7e8f596db0dc199f98f48ab93b84bb9b936 100644 (file)
@@ -96,7 +96,8 @@ static dissector_handle_t dpnss_handle;
 static void
 dissect_int_interface_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
 {
-  proto_tree_add_item(parameter_tree, hf_int_interface_id, parameter_tvb, INT_INTERFACE_ID_OFFSET, INT_INTERFACE_ID_LENGTH, ENC_BIG_ENDIAN);
+  proto_tree_add_item(parameter_tree, hf_int_interface_id,
+                      parameter_tvb, INT_INTERFACE_ID_OFFSET, INT_INTERFACE_ID_LENGTH, ENC_BIG_ENDIAN);
   proto_item_append_text(parameter_item, " (%d)", tvb_get_ntohl(parameter_tvb, INT_INTERFACE_ID_OFFSET));
 }
 
@@ -109,7 +110,8 @@ dissect_text_interface_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree
 
   interface_id_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
 
-  proto_tree_add_item(parameter_tree, hf_text_interface_id, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, ENC_ASCII|ENC_NA);
+  proto_tree_add_item(parameter_tree, hf_text_interface_id,
+                      parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, ENC_ASCII|ENC_NA);
   proto_item_append_text(parameter_item, " (%.*s)", interface_id_length,
                          tvb_get_ephemeral_string(parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length));
 }
@@ -122,7 +124,8 @@ dissect_info_string_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tre
   guint16 info_string_length;
 
   info_string_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
-  proto_tree_add_item(parameter_tree, hf_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII|ENC_NA);
+  proto_tree_add_item(parameter_tree, hf_info_string,
+                      parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII|ENC_NA);
   proto_item_append_text(parameter_item, " (%.*s)", info_string_length,
                          tvb_get_ephemeral_string(parameter_tvb, INFO_STRING_OFFSET, info_string_length));
 }
@@ -176,8 +179,10 @@ dissect_integer_range_interface_identifier_parameter(tvbuff_t *parameter_tvb, pr
   number_of_ranges = (tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH) / INTERVAL_LENGTH;
   offset = PARAMETER_VALUE_OFFSET;
   for(range_number = 1; range_number <= number_of_ranges; range_number++) {
-    proto_tree_add_item(parameter_tree, hf_interface_range_start, parameter_tvb, offset + START_OFFSET, START_LENGTH, ENC_BIG_ENDIAN);
-    proto_tree_add_item(parameter_tree, hf_interface_range_end,   parameter_tvb, offset + END_OFFSET,   END_LENGTH,   ENC_BIG_ENDIAN);
+    proto_tree_add_item(parameter_tree, hf_interface_range_start,
+                        parameter_tvb, offset + START_OFFSET, START_LENGTH, ENC_BIG_ENDIAN);
+    proto_tree_add_item(parameter_tree, hf_interface_range_end,
+                        parameter_tvb, offset + END_OFFSET,   END_LENGTH,   ENC_BIG_ENDIAN);
     offset += INTERVAL_LENGTH;
   };
 
@@ -192,7 +197,8 @@ dissect_heartbeat_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_
   guint16 heartbeat_data_length;
 
   heartbeat_data_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
-  proto_tree_add_item(parameter_tree, hf_heartbeat_data, parameter_tvb, HEARTBEAT_DATA_OFFSET, heartbeat_data_length, ENC_NA);
+  proto_tree_add_item(parameter_tree, hf_heartbeat_data,
+                      parameter_tvb, HEARTBEAT_DATA_OFFSET, heartbeat_data_length, ENC_NA);
   proto_item_append_text(parameter_item, " (%u byte%s)", heartbeat_data_length, plurality(heartbeat_data_length, "", "s"));
 }
 
@@ -210,9 +216,11 @@ static const value_string traffic_mode_type_values[] = {
 static void
 dissect_traffic_mode_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
 {
-  proto_tree_add_item(parameter_tree, hf_traffic_mode_type, parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, ENC_BIG_ENDIAN);
+  proto_tree_add_item(parameter_tree, hf_traffic_mode_type,
+                      parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, ENC_BIG_ENDIAN);
   proto_item_append_text(parameter_item, " (%s)",
-                         val_to_str(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET), traffic_mode_type_values, "unknown"));
+                         val_to_str_const(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET),
+                                          traffic_mode_type_values, "unknown"));
 }
 
 #define INVALID_VERSION_ERROR                         0x01
@@ -253,9 +261,12 @@ static const value_string error_code_values[] = {
 static void
 dissect_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
 {
-  proto_tree_add_item(parameter_tree, hf_error_code, parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, ENC_BIG_ENDIAN);
+  proto_tree_add_item(parameter_tree, hf_error_code,
+                      parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, ENC_BIG_ENDIAN);
   proto_item_append_text(parameter_item, " (%s)",
-                         val_to_str(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET), error_code_values, "unknown"));
+                         val_to_str_const(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET),
+                                          error_code_values,
+                                          "unknown"));
 }
 
 #define ASP_STATE_CHANGE_STATUS_TYPE  0x01
@@ -296,13 +307,16 @@ dissect_status_type_identification_parameter(tvbuff_t *parameter_tvb, proto_tree
   status_type = tvb_get_ntohs(parameter_tvb, STATUS_TYPE_OFFSET);
   status_id   = tvb_get_ntohs(parameter_tvb, STATUS_IDENT_OFFSET);
 
-  proto_tree_add_item(parameter_tree, hf_status_type, parameter_tvb, STATUS_TYPE_OFFSET, STATUS_TYPE_LENGTH, ENC_BIG_ENDIAN);
+  proto_tree_add_item(parameter_tree, hf_status_type,
+                      parameter_tvb, STATUS_TYPE_OFFSET, STATUS_TYPE_LENGTH, ENC_BIG_ENDIAN);
   proto_tree_add_uint_format(parameter_tree, hf_status_id,  parameter_tvb, STATUS_IDENT_OFFSET, STATUS_IDENT_LENGTH,
                              status_id, "Status identification: %u (%s)", status_id,
-                             val_to_str(status_type * 256 * 256 + status_id, status_type_id_values, "unknown"));
+                             val_to_str_const(status_type * 256 * 256 + status_id, status_type_id_values, "unknown"));
 
   proto_item_append_text(parameter_item, " (%s)",
-                         val_to_str(status_type * 256 * 256 + status_id, status_type_id_values, "unknown status information"));
+                         val_to_str_const(status_type * 256 * 256 + status_id,
+                                          status_type_id_values,
+                                          "unknown status information"));
 }
 
 #define PROTOCOL_DATA_OFFSET PARAMETER_VALUE_OFFSET
@@ -316,8 +330,8 @@ dissect_protocol_data_parameter(tvbuff_t *parameter_tvb, proto_item *parameter_i
   protocol_data_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
   protocol_data_tvb    = tvb_new_subset(parameter_tvb, PROTOCOL_DATA_OFFSET, protocol_data_length, protocol_data_length);
   if(dpnss_handle){
-         call_dissector(dpnss_handle, protocol_data_tvb, pinfo, tree);
-         return;
+    call_dissector(dpnss_handle, protocol_data_tvb, pinfo, tree);
+    return;
   }
 
   call_dissector(data_handle, protocol_data_tvb, pinfo, tree);
@@ -343,9 +357,12 @@ static const value_string release_reason_values[] = {
 static void
 dissect_release_reason_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
 {
-  proto_tree_add_item(parameter_tree, hf_release_reason, parameter_tvb, RELEASE_REASON_OFFSET, RELEASE_REASON_LENGTH, ENC_BIG_ENDIAN);
+  proto_tree_add_item(parameter_tree, hf_release_reason,
+                      parameter_tvb, RELEASE_REASON_OFFSET, RELEASE_REASON_LENGTH, ENC_BIG_ENDIAN);
   proto_item_append_text(parameter_item, " (%s)",
-                         val_to_str(tvb_get_ntohl(parameter_tvb, RELEASE_REASON_OFFSET), release_reason_values, "unknown"));
+                         val_to_str_const(tvb_get_ntohl(parameter_tvb, RELEASE_REASON_OFFSET),
+                                          release_reason_values,
+                                          "unknown"));
 }
 
 #define TEI_STATUS_ASSIGNED       0
@@ -362,9 +379,12 @@ static const value_string tei_status_values[] = {
 static void
 dissect_tei_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
 {
-  proto_tree_add_item(parameter_tree, hf_tei_status, parameter_tvb, TEI_STATUS_OFFSET, TEI_STATUS_LENGTH, ENC_BIG_ENDIAN);
+  proto_tree_add_item(parameter_tree, hf_tei_status,
+                      parameter_tvb, TEI_STATUS_OFFSET, TEI_STATUS_LENGTH, ENC_BIG_ENDIAN);
   proto_item_append_text(parameter_item, " (%s)",
-                      val_to_str(tvb_get_ntohl(parameter_tvb, TEI_STATUS_OFFSET), tei_status_values, "unknown"));
+                      val_to_str_const(tvb_get_ntohl(parameter_tvb, TEI_STATUS_OFFSET),
+                                       tei_status_values,
+                                       "unknown"));
 }
 
 #define ASP_ID_LENGTH 4
@@ -385,7 +405,8 @@ dissect_dlc_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree
   /* FIXME: This can be done better */
   parameter_value_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
   if (parameter_value_length > 0)
-    proto_tree_add_item(parameter_tree, hf_states, parameter_tvb, PARAMETER_VALUE_OFFSET, parameter_value_length, ENC_NA);
+    proto_tree_add_item(parameter_tree,
+                        hf_states, parameter_tvb, PARAMETER_VALUE_OFFSET, parameter_value_length, ENC_NA);
 }
 
 static void
@@ -395,9 +416,11 @@ dissect_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, p
 
   parameter_value_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
   if (parameter_value_length > 0)
-    proto_tree_add_item(parameter_tree, hf_parameter_value, parameter_tvb, PARAMETER_VALUE_OFFSET, parameter_value_length, ENC_NA);
+    proto_tree_add_item(parameter_tree, hf_parameter_value,
+                        parameter_tvb, PARAMETER_VALUE_OFFSET, parameter_value_length, ENC_NA);
   proto_item_append_text(parameter_item, " with tag %u and %u byte%s value",
-                         tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET), parameter_value_length, plurality(parameter_value_length, "", "s"));
+                         tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET),
+                         parameter_value_length, plurality(parameter_value_length, "", "s"));
 }
 
 #define INT_INTERFACE_IDENTIFIER_PARAMETER_TAG           0x01
@@ -447,13 +470,16 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree,
   padding_length = tvb_length(parameter_tvb) - length;
 
   /* create proto_tree stuff */
-  parameter_item   = proto_tree_add_text(dua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, tvb_length(parameter_tvb), "%s",
-                                         val_to_str(tag, parameter_tag_values, "Unknown parameter"));
+  parameter_item   = proto_tree_add_text(dua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET,
+                                         tvb_length(parameter_tvb), "%s",
+                                         val_to_str_const(tag, parameter_tag_values, "Unknown parameter"));
   parameter_tree   = proto_item_add_subtree(parameter_item, ett_dua_parameter);
 
   /* add tag and length to the dua tree */
-  proto_tree_add_item(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
-  proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
+  proto_tree_add_item(parameter_tree, hf_parameter_tag,
+                      parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
+  proto_tree_add_item(parameter_tree, hf_parameter_length,
+                      parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
 
   switch(tag) {
   case INT_INTERFACE_IDENTIFIER_PARAMETER_TAG:
@@ -507,7 +533,8 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree,
   };
 
   if (padding_length > 0)
-    proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
+    proto_tree_add_item(parameter_tree, hf_parameter_padding,
+                        parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
 }
 
 static void
@@ -657,18 +684,24 @@ dissect_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tre
   message_type   = tvb_get_guint8(common_header_tvb, MESSAGE_TYPE_OFFSET);
 
   if (check_col(pinfo->cinfo, COL_INFO))
-    col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(message_class * 256 + message_type, message_class_type_acro_values, "UNKNOWN"));
+    col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type,
+                                                                 message_class_type_acro_values,
+                                                                 "Unknown"));
 
   if (dua_tree) {
     /* add the components of the common header to the protocol tree */
     proto_tree_add_item(dua_tree, hf_version, common_header_tvb, VERSION_OFFSET, VERSION_LENGTH, ENC_BIG_ENDIAN);
     proto_tree_add_item(dua_tree, hf_reserved, common_header_tvb, RESERVED_OFFSET, RESERVED_LENGTH, ENC_BIG_ENDIAN);
-    proto_tree_add_item(dua_tree, hf_message_class, common_header_tvb, MESSAGE_CLASS_OFFSET, MESSAGE_CLASS_LENGTH, ENC_BIG_ENDIAN);
+    proto_tree_add_item(dua_tree, hf_message_class,
+                        common_header_tvb, MESSAGE_CLASS_OFFSET, MESSAGE_CLASS_LENGTH, ENC_BIG_ENDIAN);
     proto_tree_add_uint_format(dua_tree, hf_message_type,
                                common_header_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH,
                                message_type, "Message type: %u (%s)",
-                               message_type, val_to_str(message_class * 256 + message_type, message_class_type_values, "reserved"));
-    proto_tree_add_item(dua_tree, hf_message_length, common_header_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
+                               message_type, val_to_str_const(message_class * 256 + message_type,
+                                                              message_class_type_values,
+                                                              "reserved"));
+    proto_tree_add_item(dua_tree, hf_message_length,
+                        common_header_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
   }
 }
 
@@ -712,36 +745,156 @@ proto_register_dua(void)
 
   /* Setup list of header fields */
   static hf_register_info hf[] = {
-    { &hf_int_interface_id,      { "Integer interface identifier", "dua.int_interface_identifier",  FT_UINT32,   BASE_HEX,  NULL,                           0x0,               NULL, HFILL } },
-    { &hf_text_interface_id,     { "Text interface identifier",    "dua.text_interface_identifier", FT_STRING,  BASE_NONE, NULL,                           0x0,               NULL, HFILL } },
-    { &hf_info_string,           { "Info string",                  "dua.info_string",               FT_STRING,  BASE_NONE, NULL,                           0x0,               NULL, HFILL } },
-    { &hf_dlci_reserved,         { "Reserved",                     "dua.dlci_reserved",             FT_UINT16,  BASE_DEC,  NULL,                           RESERVED_BIT_MASK, NULL, HFILL } },
-    { &hf_dlci_v_bit,            { "V-bit",                        "dua.dlci_v_bit",                FT_BOOLEAN, 16,        NULL,                           V_BIT_MASK,        NULL, HFILL } },
-    { &hf_dlci_zero_bit,         { "Zero bit",                     "dua.dlci_zero_bit",             FT_BOOLEAN, 16,        NULL,                           ZERO_BIT_MASK,     NULL, HFILL } },
-    { &hf_dlci_channel,          { "Channel",                      "dua.dlci_channel",              FT_UINT16,   BASE_DEC, NULL,                           CHANNEL_BIT_MASK,  NULL, HFILL } },
-    { &hf_dlci_one_bit,          { "One bit",                      "dua.dlci_one_bit",              FT_BOOLEAN, 16,        NULL,                           ONE_BIT_MASK,      NULL, HFILL } },
-    { &hf_dlci_spare,            { "Spare",                        "dua.dlci_spare",                FT_UINT16,  BASE_DEC,  NULL,                           0x0,               NULL, HFILL } },
-    { &hf_diag_info,             { "Diagnostic information",       "dua.diagnostic_information",    FT_BYTES,   BASE_NONE, NULL,                           0x0,               NULL, HFILL } },
-    { &hf_interface_range_start, { "Start",                        "dua.interface_range_start",     FT_UINT32,  BASE_DEC,  NULL,                           0x0,               NULL, HFILL } },
-    { &hf_interface_range_end,   { "End",                          "dua.interface_range_end",       FT_UINT32,  BASE_DEC,  NULL,                           0x0,               NULL, HFILL } },
-    { &hf_heartbeat_data,        { "Heartbeat data",               "dua.heartbeat_data",            FT_BYTES,   BASE_NONE, NULL,                           0x0,               NULL, HFILL } },
-    { &hf_traffic_mode_type,     { "Traffic mode type",            "dua.traffic_mode_type",         FT_UINT32,  BASE_HEX,  VALS(traffic_mode_type_values), 0x0,               NULL, HFILL } },
-    { &hf_error_code,            { "Error code",                   "dua.error_code",                FT_UINT32,  BASE_DEC,  VALS(error_code_values),        0x0,               NULL, HFILL } },
-    { &hf_status_type,           { "Status type",                  "dua.status_type",               FT_UINT16,  BASE_DEC,  VALS(status_type_values),       0x0,               NULL, HFILL } },
-    { &hf_status_id,             { "Status identification",        "dua.status_identification",     FT_UINT16,  BASE_DEC,  NULL,                           0x0,               NULL, HFILL } },
-    { &hf_release_reason,        { "Reason",                       "dua.release_reason",            FT_UINT32,  BASE_HEX,  VALS(release_reason_values),    0x0,               NULL, HFILL } },
-    { &hf_tei_status,            { "TEI status",                   "dua.tei_status",                FT_UINT32,  BASE_HEX,  VALS(tei_status_values),        0x0,               NULL, HFILL } },
-    { &hf_asp_id,                { "ASP identifier",               "dua.asp_identifier",            FT_UINT32,  BASE_HEX,  NULL,                           0x0,               NULL, HFILL } },
-    { &hf_states,                { "States",                       "dua.states",                    FT_BYTES,   BASE_NONE, NULL,                           0x0,               NULL, HFILL } },
-    { &hf_parameter_tag,         { "Parameter Tag",                "dua.parameter_tag",             FT_UINT16,  BASE_DEC,  VALS(parameter_tag_values),     0x0,               NULL, HFILL } },
-    { &hf_parameter_length,      { "Parameter length",             "dua.parameter_length",          FT_UINT16,  BASE_DEC,  NULL,                           0x0,               NULL, HFILL } },
-    { &hf_parameter_value,       { "Parameter value",              "dua.parameter_value",           FT_BYTES,   BASE_NONE, NULL,                           0x0,               NULL, HFILL } },
-    { &hf_parameter_padding,     { "Parameter padding",            "dua.parameter_padding",         FT_BYTES,   BASE_NONE, NULL,                           0x0,               NULL, HFILL } },
-    { &hf_version,               { "Version",                      "dua.version",                   FT_UINT8,   BASE_DEC,  VALS(protocol_version_values),  0x0,               NULL, HFILL } },
-    { &hf_reserved,              { "Reserved",                     "dua.reserved",                  FT_UINT8,   BASE_HEX,  NULL,                           0x0,               NULL, HFILL } },
-    { &hf_message_class,         { "Message class",                "dua.message_class",             FT_UINT8,   BASE_DEC,  VALS(message_class_values),     0x0,               NULL, HFILL } },
-    { &hf_message_type,          { "Message Type",                 "dua.message_type",              FT_UINT8,   BASE_DEC,  NULL,                           0x0,               NULL, HFILL } },
-    { &hf_message_length,        { "Message length",               "dua.message_length",            FT_UINT32,  BASE_DEC,  NULL,                           0x0,               NULL, HFILL } },
+    { &hf_int_interface_id,
+      { "Integer interface identifier", "dua.int_interface_identifier",
+        FT_UINT32,   BASE_HEX,  NULL,                          0x0,
+        NULL, HFILL } },
+
+    { &hf_text_interface_id,
+      { "Text interface identifier",    "dua.text_interface_identifier",
+        FT_STRING,  BASE_NONE, NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_info_string,
+      { "Info string",                  "dua.info_string",
+        FT_STRING,  BASE_NONE, NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_dlci_reserved,
+      { "Reserved",                     "dua.dlci_reserved",
+        FT_UINT16,  BASE_DEC,  NULL,                           RESERVED_BIT_MASK,
+        NULL, HFILL } },
+
+    { &hf_dlci_v_bit,
+      { "V-bit",                        "dua.dlci_v_bit",
+        FT_BOOLEAN, 16,        NULL,                           V_BIT_MASK,
+        NULL, HFILL } },
+
+    { &hf_dlci_zero_bit,
+      { "Zero bit",                     "dua.dlci_zero_bit",
+        FT_BOOLEAN, 16,        NULL,                           ZERO_BIT_MASK,
+        NULL, HFILL } },
+
+    { &hf_dlci_channel,
+      { "Channel",                      "dua.dlci_channel",
+        FT_UINT16,   BASE_DEC, NULL,                           CHANNEL_BIT_MASK,
+        NULL, HFILL } },
+
+    { &hf_dlci_one_bit,
+      { "One bit",                      "dua.dlci_one_bit",
+        FT_BOOLEAN, 16,        NULL,                           ONE_BIT_MASK,
+        NULL, HFILL } },
+
+    { &hf_dlci_spare,
+      { "Spare",                        "dua.dlci_spare",
+        FT_UINT16,  BASE_DEC,  NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_diag_info,
+      { "Diagnostic information",       "dua.diagnostic_information",
+        FT_BYTES,   BASE_NONE, NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_interface_range_start,
+      { "Start",                        "dua.interface_range_start",
+        FT_UINT32,  BASE_DEC,  NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_interface_range_end,
+      { "End",                          "dua.interface_range_end",
+        FT_UINT32,  BASE_DEC,  NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_heartbeat_data,
+      { "Heartbeat data",               "dua.heartbeat_data",
+        FT_BYTES,   BASE_NONE, NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_traffic_mode_type,
+      { "Traffic mode type",            "dua.traffic_mode_type",
+        FT_UINT32,  BASE_HEX,  VALS(traffic_mode_type_values), 0x0,
+        NULL, HFILL } },
+
+    { &hf_error_code,
+      { "Error code",                   "dua.error_code",
+        FT_UINT32,  BASE_DEC,  VALS(error_code_values),        0x0,
+        NULL, HFILL } },
+
+    { &hf_status_type,
+      { "Status type",                  "dua.status_type",
+        FT_UINT16,  BASE_DEC,  VALS(status_type_values),       0x0,
+        NULL, HFILL } },
+
+    { &hf_status_id,
+      { "Status identification",        "dua.status_identification",
+        FT_UINT16,  BASE_DEC,  NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_release_reason,
+      { "Reason",                       "dua.release_reason",
+        FT_UINT32,  BASE_HEX,  VALS(release_reason_values),    0x0,
+        NULL, HFILL } },
+
+    { &hf_tei_status,
+      { "TEI status",                   "dua.tei_status",
+        FT_UINT32,  BASE_HEX,  VALS(tei_status_values),        0x0,
+        NULL, HFILL } },
+
+    { &hf_asp_id,
+      { "ASP identifier",               "dua.asp_identifier",
+        FT_UINT32,  BASE_HEX,  NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_states,
+      { "States",                       "dua.states",
+        FT_BYTES,   BASE_NONE, NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_parameter_tag,
+      { "Parameter Tag",                "dua.parameter_tag",
+        FT_UINT16,  BASE_DEC,  VALS(parameter_tag_values),     0x0,
+        NULL, HFILL } },
+
+    { &hf_parameter_length,
+      { "Parameter length",             "dua.parameter_length",
+        FT_UINT16,  BASE_DEC,  NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_parameter_value,
+      { "Parameter value",              "dua.parameter_value",
+        FT_BYTES,   BASE_NONE, NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_parameter_padding,
+      { "Parameter padding",            "dua.parameter_padding",
+        FT_BYTES,   BASE_NONE, NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_version,
+      { "Version",                      "dua.version",
+        FT_UINT8,   BASE_DEC,  VALS(protocol_version_values),  0x0,
+        NULL, HFILL } },
+
+    { &hf_reserved,
+      { "Reserved",                     "dua.reserved",
+        FT_UINT8,   BASE_HEX,  NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_message_class,
+      { "Message class",                "dua.message_class",
+        FT_UINT8,   BASE_DEC,  VALS(message_class_values),     0x0,
+        NULL, HFILL } },
+
+    { &hf_message_type,
+      { "Message Type",                 "dua.message_type",
+        FT_UINT8,   BASE_DEC,  NULL,                           0x0,
+        NULL, HFILL } },
+
+    { &hf_message_length,
+      { "Message length",               "dua.message_length",
+        FT_UINT32,  BASE_DEC,  NULL,                           0x0,
+        NULL, HFILL } },
+
    };
   /* Setup protocol subtree array */
   static gint *ett[] = {
@@ -765,8 +918,8 @@ proto_reg_handoff_dua(void)
 {
   dissector_handle_t dua_handle;
 
-  dua_handle  = find_dissector("dua");
-  data_handle = find_dissector("data");
+  dua_handle   = find_dissector("dua");
+  data_handle  = find_dissector("data");
   dpnss_handle = find_dissector("dpnss");
   dissector_add_uint("sctp.ppi", DUA_PAYLOAD_PROTOCOL_ID, dua_handle);
 }
index ba887b95eb36bc5ad52eff639eed9c0a6ff3a2ac..59e792e2f9c9f4c49b62c14e55af647d0fc5a22d 100644 (file)
@@ -75,43 +75,43 @@ static gint ett_keyinfo = -1;
 static dissector_handle_t eap_handle;
 static dissector_handle_t data_handle;
 
-#define EAPOL_HDR_LEN  4
+#define EAPOL_HDR_LEN   4
 
 #define EAPOL_2001      1
 #define EAPOL_2004      2
 #define EAPOL_2010      3
 
-#define EAP_PACKET             0
-#define EAPOL_START            1
-#define EAPOL_LOGOFF           2
-#define EAPOL_KEY              3
-#define EAPOL_ENCAP_ASF_ALERT  4
+#define EAP_PACKET              0
+#define EAPOL_START             1
+#define EAPOL_LOGOFF            2
+#define EAPOL_KEY               3
+#define EAPOL_ENCAP_ASF_ALERT   4
 
-#define EAPOL_RSN_KEY          2 /* TBD, may change in final IEEE 802.1X-REV
-                                  */
-#define EAPOL_WPA_KEY          254
+#define EAPOL_RSN_KEY           2 /* TBD, may change in final IEEE 802.1X-REV
+                                   */
+#define EAPOL_WPA_KEY           254
 
 static const value_string eapol_version_vals[] = {
-    { EAPOL_2001,   "802.1X-2001" },
-    { EAPOL_2004,   "802.1X-2004" },
-    { EAPOL_2010,   "802.1X-2010" },
-    { 0,            NULL }
+  { EAPOL_2001,   "802.1X-2001" },
+  { EAPOL_2004,   "802.1X-2004" },
+  { EAPOL_2010,   "802.1X-2010" },
+  { 0, NULL }
 };
 
 static const value_string eapol_type_vals[] = {
-    { EAP_PACKET,            "EAP Packet" },
-    { EAPOL_START,           "Start" },
-    { EAPOL_LOGOFF,          "Logoff" },
-    { EAPOL_KEY,             "Key" },
-    { EAPOL_ENCAP_ASF_ALERT, "Encapsulated ASF Alert" },
-    { 0,                     NULL }
+  { EAP_PACKET,            "EAP Packet" },
+  { EAPOL_START,           "Start" },
+  { EAPOL_LOGOFF,          "Logoff" },
+  { EAPOL_KEY,             "Key" },
+  { EAPOL_ENCAP_ASF_ALERT, "Encapsulated ASF Alert" },
+  { 0, NULL }
 };
 
 static const value_string eapol_keydes_type_vals[] = {
-       { 1, "RC4 Descriptor" },
-       { EAPOL_RSN_KEY, "EAPOL RSN Key" },
-       { EAPOL_WPA_KEY, "EAPOL WPA Key" },
-       { 0, NULL }
+  { 1, "RC4 Descriptor" },
+  { EAPOL_RSN_KEY, "EAPOL RSN Key" },
+  { EAPOL_WPA_KEY, "EAPOL WPA Key" },
+  { 0, NULL }
 };
 
 #define KEY_INFO_KEYDES_VERSION_MASK        0x0007
@@ -125,24 +125,22 @@ static const value_string eapol_keydes_type_vals[] = {
 #define KEY_INFO_REQUEST_MASK               0x0800
 #define KEY_INFO_ENCRYPTED_KEY_DATA_MASK    0x1000
 
-static const true_false_string keytype_tfs =
-       { "Unicast", "Broadcast" };
+static const true_false_string keytype_tfs = { "Unicast", "Broadcast" };
 
-static const true_false_string keyinfo_key_type_tfs =
-       { "Pairwise Key", "Group Key" };
+static const true_false_string keyinfo_key_type_tfs = { "Pairwise Key", "Group Key" };
 
 #define KEYDES_KEY_INDEX_TYPE_MASK      0x80
 #define KEYDES_KEY_INDEX_NUMBER_MASK    0x7F
 
-#define KEYDES_VER_TYPE1       0x01
-#define KEYDES_VER_TYPE2       0x02
-#define KEYDES_VER_TYPE3       0x03
+#define KEYDES_VER_TYPE1        0x01
+#define KEYDES_VER_TYPE2        0x02
+#define KEYDES_VER_TYPE3        0x03
 
 static const value_string keydes_version_vals[] = {
-       { KEYDES_VER_TYPE1,     "RC4 Cipher, HMAC-MD5 MIC" },
-       { KEYDES_VER_TYPE2,     "AES Cipher, HMAC-SHA1 MIC" },
-       { KEYDES_VER_TYPE3,     "AES Cipher, AES-128-CMAC MIC" },
-       { 0,            NULL }
+  { KEYDES_VER_TYPE1,     "RC4 Cipher, HMAC-MD5 MIC" },
+  { KEYDES_VER_TYPE2,     "AES Cipher, HMAC-SHA1 MIC" },
+  { KEYDES_VER_TYPE3,     "AES Cipher, AES-128-CMAC MIC" },
+  { 0, NULL }
 };
 
 static void
@@ -179,7 +177,7 @@ dissect_eapol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     proto_tree_add_item(eapol_tree, hf_eapol_type, tvb, offset, 1, ENC_BIG_ENDIAN);
   if (check_col(pinfo->cinfo, COL_INFO))
     col_add_str(pinfo->cinfo, COL_INFO,
-               val_to_str(eapol_type, eapol_type_vals, "Unknown Type (0x%02X)"));
+                val_to_str(eapol_type, eapol_type_vals, "Unknown Type (0x%02X)"));
   offset++;
 
   eapol_len = tvb_get_ntohs(tvb, offset);
@@ -204,8 +202,8 @@ dissect_eapol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
       proto_tree_add_item(eapol_tree, hf_eapol_keydes_type, tvb, offset, 1, ENC_BIG_ENDIAN);
       offset += 1;
       if (keydesc_type == EAPOL_WPA_KEY || keydesc_type == EAPOL_RSN_KEY) {
-       keyinfo = tvb_get_ntohs(tvb, offset);
-       if (check_col(pinfo->cinfo, COL_INFO)) {
+        keyinfo = tvb_get_ntohs(tvb, offset);
+        if (check_col(pinfo->cinfo, COL_INFO)) {
           if (keyinfo & KEY_INFO_REQUEST_MASK) {
             col_set_str(pinfo->cinfo, COL_INFO, "Key (Request)");
             if (keyinfo & KEY_INFO_ERROR_MASK)
@@ -237,92 +235,92 @@ dissect_eapol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
               col_set_str(pinfo->cinfo, COL_INFO, "Key (Group Message 2 of 2)");
           }
         }
-       keyinfo_item =
-         proto_tree_add_item(eapol_tree, hf_eapol_wpa_keydes_keyinfo, tvb,
-                             offset, 2, ENC_BIG_ENDIAN);
-
-       keyinfo_tree = proto_item_add_subtree(keyinfo_item, ett_keyinfo);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_keydes_version, tvb, offset, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_key_type, tvb, offset, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_key_index, tvb, offset, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_install, tvb, offset, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_key_ack, tvb, offset, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_key_mic, tvb, offset, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_secure, tvb, offset, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_error, tvb, offset, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_request, tvb, offset, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_encrypted_key_data, tvb, offset, 2, ENC_BIG_ENDIAN);
+        keyinfo_item =
+          proto_tree_add_item(eapol_tree, hf_eapol_wpa_keydes_keyinfo, tvb,
+                              offset, 2, ENC_BIG_ENDIAN);
+
+        keyinfo_tree = proto_item_add_subtree(keyinfo_item, ett_keyinfo);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_keydes_version, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_key_type, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_key_index, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_install, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_key_ack, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_key_mic, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_secure, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_error, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_request, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(keyinfo_tree, hf_eapol_wpa_keydes_keyinfo_encrypted_key_data, tvb, offset, 2, ENC_BIG_ENDIAN);
 
         offset += 2;
         proto_tree_add_item(eapol_tree, hf_eapol_keydes_key_len, tvb, offset,
-                           2, ENC_BIG_ENDIAN);
+                            2, ENC_BIG_ENDIAN);
         offset += 2;
         proto_tree_add_item(eapol_tree, hf_eapol_keydes_replay_counter, tvb,
-                           offset, 8, ENC_BIG_ENDIAN);
+                            offset, 8, ENC_BIG_ENDIAN);
         offset += 8;
         proto_tree_add_item(eapol_tree, hf_eapol_wpa_keydes_nonce, tvb, offset,
-                           32, ENC_BIG_ENDIAN);
+                            32, ENC_BIG_ENDIAN);
         offset += 32;
         proto_tree_add_item(eapol_tree, hf_eapol_keydes_key_iv, tvb,
-                           offset, 16, ENC_BIG_ENDIAN);
+                            offset, 16, ENC_BIG_ENDIAN);
         offset += 16;
         proto_tree_add_item(eapol_tree, hf_eapol_wpa_keydes_rsc, tvb, offset,
-                           8, ENC_BIG_ENDIAN);
+                            8, ENC_BIG_ENDIAN);
         offset += 8;
         proto_tree_add_item(eapol_tree, hf_eapol_wpa_keydes_id, tvb, offset, 8,
-                           ENC_BIG_ENDIAN);
+                            ENC_BIG_ENDIAN);
         offset += 8;
         proto_tree_add_item(eapol_tree, hf_eapol_wpa_keydes_mic, tvb, offset,
-                           16, ENC_BIG_ENDIAN);
+                            16, ENC_BIG_ENDIAN);
         offset += 16;
         eapol_data_len = tvb_get_ntohs(tvb, offset);
         proto_tree_add_item(eapol_tree, hf_eapol_wpa_keydes_data_len, tvb,
-                           offset, 2, ENC_BIG_ENDIAN);
+                            offset, 2, ENC_BIG_ENDIAN);
         offset += 2;
         if (eapol_data_len != 0) {
           ti = proto_tree_add_item(eapol_tree, hf_eapol_wpa_keydes_data,
-               tvb, offset, eapol_data_len, ENC_BIG_ENDIAN);
-         if ((keyinfo & KEY_INFO_ENCRYPTED_KEY_DATA_MASK) ||
-             !(keyinfo & KEY_INFO_KEY_TYPE_MASK)) {
-           /* RSN: EAPOL-Key Key Data is encrypted.
-            * WPA: Group Keys use encrypted Key Data.
-            * Cannot parse this without knowing the key.
-            * IEEE 802.11i-2004 8.5.2.
-            */
-         } else {
-           keydes_tree = proto_item_add_subtree(ti, ett_eapol_keydes_data);
-           ieee_80211_add_tagged_parameters(tvb, offset, pinfo, keydes_tree,
-                                            eapol_data_len, -1);
-         }
+                tvb, offset, eapol_data_len, ENC_BIG_ENDIAN);
+          if ((keyinfo & KEY_INFO_ENCRYPTED_KEY_DATA_MASK) ||
+              !(keyinfo & KEY_INFO_KEY_TYPE_MASK)) {
+            /* RSN: EAPOL-Key Key Data is encrypted.
+             * WPA: Group Keys use encrypted Key Data.
+             * Cannot parse this without knowing the key.
+             * IEEE 802.11i-2004 8.5.2.
+             */
+          } else {
+            keydes_tree = proto_item_add_subtree(ti, ett_eapol_keydes_data);
+            ieee_80211_add_tagged_parameters(tvb, offset, pinfo, keydes_tree,
+                                             eapol_data_len, -1);
+          }
         }
       } else {
         eapol_key_len = tvb_get_ntohs(tvb, offset);
         proto_tree_add_item(eapol_tree, hf_eapol_keydes_key_len, tvb, offset, 2, ENC_BIG_ENDIAN);
         offset += 2;
         proto_tree_add_item(eapol_tree, hf_eapol_keydes_replay_counter, tvb,
-                         offset, 8, ENC_BIG_ENDIAN);
+                            offset, 8, ENC_BIG_ENDIAN);
         offset += 8;
         proto_tree_add_item(eapol_tree, hf_eapol_keydes_key_iv, tvb,
-                         offset, 16, ENC_NA);
+                            offset, 16, ENC_NA);
         offset += 16;
         ti = proto_tree_add_item(eapol_tree, hf_eapol_keydes_key_index, tvb, offset, 1, ENC_BIG_ENDIAN);
         key_index_tree = proto_item_add_subtree(ti, ett_eapol_key_index);
         proto_tree_add_item(key_index_tree, hf_eapol_keydes_key_index_type,
-                            tvb, offset, 1, ENC_BIG_ENDIAN);
+                            tvb, offset, 1, ENC_BIG_ENDIAN);
         proto_tree_add_item(key_index_tree, hf_eapol_keydes_key_index_number,
-                            tvb, offset, 1, ENC_BIG_ENDIAN);
+                            tvb, offset, 1, ENC_BIG_ENDIAN);
         offset += 1;
         proto_tree_add_item(eapol_tree, hf_eapol_keydes_key_signature, tvb,
-                         offset, 16, ENC_NA);
+                            offset, 16, ENC_NA);
         offset += 16;
         if (eapol_key_len != 0) {
-                 /* IEEE 802.1X-2004 7.6.3.6: If no bytes remain, then */
+          /* IEEE 802.1X-2004 7.6.3.6: If no bytes remain, then */
           generated_locally = eapol_len <= 44; /* Size of rc4 key with no key content */
-          if (!generated_locally) { 
+          if (!generated_locally) {
               proto_tree_add_item(eapol_tree, hf_eapol_keydes_key, tvb, offset,
                                   eapol_key_len, ENC_BIG_ENDIAN);
           }
-            
+
           proto_tree_add_boolean(eapol_tree, hf_eapol_keydes_key_generated_locally, tvb, offset,
                                  0, generated_locally);
         }
@@ -330,7 +328,7 @@ dissect_eapol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     }
     break;
 
-  case EAPOL_ENCAP_ASF_ALERT:  /* XXX - is this an SNMP trap? */
+  case EAPOL_ENCAP_ASF_ALERT:   /* XXX - is this an SNMP trap? */
   default:
     next_tvb = tvb_new_subset_remaining(tvb, offset);
     call_dissector(data_handle, next_tvb, pinfo, eapol_tree);
@@ -342,132 +340,162 @@ void
 proto_register_eapol(void)
 {
   static hf_register_info hf[] = {
-       { &hf_eapol_version, {
-               "Version", "eapol.version", FT_UINT8, BASE_DEC,
-               VALS(eapol_version_vals), 0x0, NULL, HFILL }},
-       { &hf_eapol_type, {
-               "Type", "eapol.type", FT_UINT8, BASE_DEC,
-               VALS(eapol_type_vals), 0x0, NULL, HFILL }},
-       { &hf_eapol_len, {
-               "Length", "eapol.len", FT_UINT16, BASE_DEC,
-               NULL, 0x0, NULL, HFILL }},
-       { &hf_eapol_keydes_type, {
-               "Key Descriptor Type", "eapol.keydes.type", FT_UINT8, BASE_DEC,
-               VALS(eapol_keydes_type_vals), 0x0, NULL, HFILL }},
-       { &hf_eapol_keydes_key_len, {
-               "Key Length", "eapol.keydes.key_len", FT_UINT16, BASE_DEC,
-               NULL, 0x0, NULL, HFILL }},
-       { &hf_eapol_keydes_replay_counter, {
-               "Replay Counter", "eapol.keydes.replay_counter", FT_UINT64, BASE_DEC,
-               NULL, 0x0, NULL, HFILL }},
-       { &hf_eapol_keydes_key_iv, {
-               "Key IV", "eapol.keydes.key_iv", FT_BYTES, BASE_NONE,
-               NULL, 0x0, NULL, HFILL }},
+    { &hf_eapol_version, {
+        "Version", "eapol.version",
+        FT_UINT8, BASE_DEC, VALS(eapol_version_vals), 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_type, {
+        "Type", "eapol.type",
+        FT_UINT8, BASE_DEC, VALS(eapol_type_vals), 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_len, {
+        "Length", "eapol.len",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_keydes_type, {
+        "Key Descriptor Type", "eapol.keydes.type",
+        FT_UINT8, BASE_DEC, VALS(eapol_keydes_type_vals), 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_keydes_key_len, {
+        "Key Length", "eapol.keydes.key_len",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_keydes_replay_counter, {
+        "Replay Counter", "eapol.keydes.replay_counter",
+        FT_UINT64, BASE_DEC, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_keydes_key_iv, {
+        "Key IV", "eapol.keydes.key_iv",
+        FT_BYTES, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
     { &hf_eapol_keydes_key_index, {
-        "Key Index", "eapol.keydes.key_index", FT_UINT8, BASE_HEX,
-        NULL, 0x0, NULL, HFILL }},
-       { &hf_eapol_keydes_key_index_type, {
-               "Type", "eapol.keydes.key_index.type", FT_BOOLEAN, 8,
-               TFS(&keytype_tfs), KEYDES_KEY_INDEX_TYPE_MASK , NULL, HFILL }},
-       { &hf_eapol_keydes_key_index_number, {
-               "Number", "eapol.keydes.key_index.number", FT_UINT8, BASE_DEC,
-               NULL, KEYDES_KEY_INDEX_NUMBER_MASK, NULL, HFILL }},
-       { &hf_eapol_keydes_key_signature, {
-               "Key Signature", "eapol.keydes.key_signature", FT_BYTES, BASE_NONE,
-               NULL, 0x0, NULL, HFILL }},
-       { &hf_eapol_keydes_key, {
-               "Key", "eapol.keydes.key", FT_BYTES, BASE_NONE,
-               NULL, 0x0, NULL, HFILL }},
+        "Key Index", "eapol.keydes.key_index",
+        FT_UINT8, BASE_HEX, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_keydes_key_index_type, {
+        "Type", "eapol.keydes.key_index.type",
+        FT_BOOLEAN, 8, TFS(&keytype_tfs), KEYDES_KEY_INDEX_TYPE_MASK ,
+        NULL, HFILL }},
+
+    { &hf_eapol_keydes_key_index_number, {
+        "Number", "eapol.keydes.key_index.number",
+        FT_UINT8, BASE_DEC, NULL, KEYDES_KEY_INDEX_NUMBER_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_keydes_key_signature, {
+        "Key Signature", "eapol.keydes.key_signature",
+        FT_BYTES, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_keydes_key, {
+        "Key", "eapol.keydes.key",
+        FT_BYTES, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
     { &hf_eapol_keydes_key_generated_locally, {
-          "Key Generated Locally", "eapol.keydes.key.generated_locally",
-          FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo, {
-               "Key Information", "eapol.keydes.key_info", FT_UINT16,
-               BASE_HEX, NULL, 0x0, NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_keydes_version, {
-               "Key Descriptor Version",
-               "eapol.keydes.key_info.keydes_version",
-               FT_UINT16, BASE_DEC, VALS(keydes_version_vals),
-               KEY_INFO_KEYDES_VERSION_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_key_type, {
-               "Key Type",
-               "eapol.keydes.key_info.key_type",
-               FT_BOOLEAN, 16, TFS(&keyinfo_key_type_tfs),
-               KEY_INFO_KEY_TYPE_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_key_index, {
-               "Key Index",
-               "eapol.keydes.key_info.key_index",
-               FT_UINT16, BASE_DEC, NULL,
-               KEY_INFO_KEY_INDEX_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_install, {
-               "Install",
-               "eapol.keydes.key_info.install",
-               FT_BOOLEAN, 16, TFS(&tfs_set_notset),
-               KEY_INFO_INSTALL_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_key_ack, {
-               "Key ACK",
-               "eapol.keydes.key_info.key_ack",
-               FT_BOOLEAN, 16, TFS(&tfs_set_notset),
-               KEY_INFO_KEY_ACK_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_key_mic, {
-               "Key MIC",
-               "eapol.keydes.key_info.key_mic",
-               FT_BOOLEAN, 16, TFS(&tfs_set_notset),
-               KEY_INFO_KEY_MIC_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_secure, {
-               "Secure",
-               "eapol.keydes.key_info.secure",
-               FT_BOOLEAN, 16, TFS(&tfs_set_notset),
-               KEY_INFO_SECURE_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_error, {
-               "Error",
-               "eapol.keydes.key_info.error",
-               FT_BOOLEAN, 16, TFS(&tfs_set_notset),
-               KEY_INFO_ERROR_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_request, {
-               "Request",
-               "eapol.keydes.key_info.request",
-               FT_BOOLEAN, 16, TFS(&tfs_set_notset),
-               KEY_INFO_REQUEST_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_keyinfo_encrypted_key_data, {
-               "Encrypted Key Data",
-               "eapol.keydes.key_info.encrypted_key_data",
-               FT_BOOLEAN, 16, TFS(&tfs_set_notset),
-               KEY_INFO_ENCRYPTED_KEY_DATA_MASK,
-               NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_nonce, {
-               "WPA Key Nonce", "eapol.keydes.nonce", FT_BYTES, BASE_NONE,
-               NULL, 0x0, NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_rsc, {
-               "WPA Key RSC", "eapol.keydes.rsc", FT_BYTES, BASE_NONE, NULL,
-               0x0, NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_id, {
-               "WPA Key ID", "eapol.keydes.id", FT_BYTES, BASE_NONE, NULL,
-               0x0, NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_mic, {
-               "WPA Key MIC", "eapol.keydes.mic", FT_BYTES, BASE_NONE, NULL,
-               0x0, NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_data_len, {
-               "WPA Key Data Length", "eapol.keydes.data_len", FT_UINT16, BASE_DEC,
-               NULL, 0x0, NULL, HFILL }},
-       { &hf_eapol_wpa_keydes_data, {
-               "WPA Key Data", "eapol.keydes.data", FT_BYTES, BASE_NONE,
-               NULL, 0x0, NULL, HFILL }},
+        "Key Generated Locally", "eapol.keydes.key.generated_locally",
+        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo, {
+        "Key Information", "eapol.keydes.key_info",
+        FT_UINT16, BASE_HEX, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_keydes_version, {
+        "Key Descriptor Version", "eapol.keydes.key_info.keydes_version",
+        FT_UINT16, BASE_DEC, VALS(keydes_version_vals), KEY_INFO_KEYDES_VERSION_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_key_type, {
+        "Key Type", "eapol.keydes.key_info.key_type",
+        FT_BOOLEAN, 16, TFS(&keyinfo_key_type_tfs), KEY_INFO_KEY_TYPE_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_key_index, {
+        "Key Index", "eapol.keydes.key_info.key_index",
+        FT_UINT16, BASE_DEC, NULL, KEY_INFO_KEY_INDEX_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_install, {
+        "Install", "eapol.keydes.key_info.install",
+        FT_BOOLEAN, 16, TFS(&tfs_set_notset), KEY_INFO_INSTALL_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_key_ack, {
+        "Key ACK", "eapol.keydes.key_info.key_ack",
+        FT_BOOLEAN, 16, TFS(&tfs_set_notset), KEY_INFO_KEY_ACK_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_key_mic, {
+        "Key MIC", "eapol.keydes.key_info.key_mic",
+        FT_BOOLEAN, 16, TFS(&tfs_set_notset), KEY_INFO_KEY_MIC_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_secure, {
+        "Secure", "eapol.keydes.key_info.secure",
+        FT_BOOLEAN, 16, TFS(&tfs_set_notset), KEY_INFO_SECURE_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_error, {
+        "Error", "eapol.keydes.key_info.error",
+        FT_BOOLEAN, 16, TFS(&tfs_set_notset), KEY_INFO_ERROR_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_request, {
+        "Request", "eapol.keydes.key_info.request",
+        FT_BOOLEAN, 16, TFS(&tfs_set_notset), KEY_INFO_REQUEST_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_keyinfo_encrypted_key_data, {
+        "Encrypted Key Data", "eapol.keydes.key_info.encrypted_key_data",
+        FT_BOOLEAN, 16, TFS(&tfs_set_notset), KEY_INFO_ENCRYPTED_KEY_DATA_MASK,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_nonce, {
+        "WPA Key Nonce", "eapol.keydes.nonce",
+        FT_BYTES, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_rsc, {
+        "WPA Key RSC", "eapol.keydes.rsc",
+        FT_BYTES, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_id, {
+        "WPA Key ID", "eapol.keydes.id",
+        FT_BYTES, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_mic, {
+        "WPA Key MIC", "eapol.keydes.mic",
+        FT_BYTES, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_data_len, {
+        "WPA Key Data Length", "eapol.keydes.data_len",
+        FT_UINT16, BASE_DEC, NULL, 0x0,
+        NULL, HFILL }},
+
+    { &hf_eapol_wpa_keydes_data, {
+        "WPA Key Data", "eapol.keydes.data",
+        FT_BYTES, BASE_NONE, NULL, 0x0,
+        NULL, HFILL }},
   };
+
   static gint *ett[] = {
-       &ett_eapol,
-       &ett_eapol_keydes_data,
-       &ett_keyinfo,
-       &ett_eapol_key_index
+    &ett_eapol,
+    &ett_eapol_keydes_data,
+    &ett_keyinfo,
+    &ett_eapol_key_index
   };
 
   proto_eapol = proto_register_protocol("802.1X Authentication", "EAPOL", "eapol");
@@ -483,7 +511,7 @@ proto_reg_handoff_eapol(void)
   /*
    * Get handles for the EAP and raw data dissectors.
    */
-  eap_handle = find_dissector("eap");
+  eap_handle  = find_dissector("eap");
   data_handle = find_dissector("data");
 
   eapol_handle = create_dissector_handle(dissect_eapol, proto_eapol);
index 24b066cfd2e7f923e2f63cb6cc22483c5626a569..82b8f5d8993471e575492435bd4394e2c4f09140 100644 (file)
@@ -34,7 +34,7 @@
 #include <glib.h>
 #include <epan/packet.h>
 
-#define ECHO_PORT      7
+#define ECHO_PORT  7
 
 static int proto_echo = -1;
 
@@ -47,10 +47,8 @@ static gint ett_echo = -1;
 static void dissect_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
 
-  proto_tree   *echo_tree = NULL;
-  proto_item   *ti, *hidden_item;
-  int           offset = 0;
-  gboolean      request = FALSE;
+  int         offset    = 0;
+  gboolean    request   = FALSE;
 
   if (pinfo->destport == ECHO_PORT) {
     request = TRUE;
@@ -60,10 +58,12 @@ static void dissect_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
   if (check_col(pinfo->cinfo, COL_INFO)) {
     col_set_str(pinfo->cinfo, COL_INFO,
-                (request) ? "Request" : "Response");
+                (request) ? "Request" : "Response");
   }
 
   if (tree) {
+    proto_tree *echo_tree;
+    proto_item *ti, *hidden_item;
 
     ti = proto_tree_add_item(tree, proto_echo, tvb, offset, -1, ENC_NA);
     echo_tree = proto_item_add_subtree(ti, ett_echo);
@@ -86,17 +86,17 @@ void proto_register_echo(void)
 
   static hf_register_info hf[] = {
     { &hf_echo_data,
-      { "Echo data",   "echo.data",
-       FT_BYTES,       BASE_NONE,      NULL,   0x0,
-       NULL, HFILL }},
+      { "Echo data",    "echo.data",
+        FT_BYTES,       BASE_NONE,      NULL,   0x0,
+        NULL, HFILL }},
     { &hf_echo_request,
-      { "Echo request",        "echo.request",
-       FT_BOOLEAN,     BASE_NONE,      NULL,   0x0,
-       "Echo data", HFILL }},
+      { "Echo request", "echo.request",
+        FT_BOOLEAN,     BASE_NONE,      NULL,   0x0,
+        "Echo data", HFILL }},
     { &hf_echo_response,
       { "Echo response","echo.response",
-       FT_BOOLEAN,     BASE_NONE,      NULL,   0x0,
-       "Echo data", HFILL }}
+        FT_BOOLEAN,     BASE_NONE,      NULL,   0x0,
+        "Echo data", HFILL }}
   };
 
   static gint *ett[] = {
index 4e41f7b8e97c5031e64e89d9d7dd8d0601f715f9..70482a394d65b3d88bb12a84c1c0b9ec4ce64ef9 100644 (file)
@@ -1,4 +1,5 @@
-/*
+/* packet-enc.c
+ *
  * Copyright (c) 2003 Markus Friedl.  All rights reserved.
  *
  * $Id$
@@ -23,6 +24,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
@@ -97,16 +99,16 @@ capture_enc(const guchar *pd, int len, packet_counts *ld)
 static const value_string af_vals[] = {
   { BSD_ENC_INET,  "IPv4" },
   { BSD_ENC_INET6, "IPv6" },
-  { 0,            NULL }
+  { 0, NULL }
 };
 
 static void
 dissect_enc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-  struct enchdr ench;
-  tvbuff_t *next_tvb;
-  proto_tree *enc_tree;
-  proto_item *ti;
+  struct enchdr  ench;
+  tvbuff_t      *next_tvb;
+  proto_tree    *enc_tree;
+  proto_item    *ti;
 
   col_set_str(pinfo->cinfo, COL_PROTOCOL, "ENC");
 
@@ -120,16 +122,16 @@ dissect_enc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
   if (tree) {
     ti = proto_tree_add_protocol_format(tree, proto_enc, tvb, 0,
-             ENC_HDRLEN,
-             "Enc %s, SPI 0x%8.8x, %s%s%s%s",
-             val_to_str(ench.af, af_vals, "unknown (%u)"),
-             ench.spi,
-             ench.flags ? "" : "unprotected",
-             ench.flags & BSD_ENC_M_AUTH ? "authentic" : "",
-             (ench.flags & (BSD_ENC_M_AUTH|BSD_ENC_M_CONF)) ==
-               (BSD_ENC_M_AUTH|BSD_ENC_M_CONF) ? ", " : "",
-             ench.flags & BSD_ENC_M_CONF ? "confidential" : ""
-            );
+                                        ENC_HDRLEN,
+                                        "Enc %s, SPI 0x%8.8x, %s%s%s%s",
+                                        val_to_str(ench.af, af_vals, "unknown (%u)"),
+                                        ench.spi,
+                                        ench.flags ? "" : "unprotected",
+                                        ench.flags & BSD_ENC_M_AUTH ? "authentic" : "",
+                                        (ench.flags & (BSD_ENC_M_AUTH|BSD_ENC_M_CONF)) ==
+                                        (BSD_ENC_M_AUTH|BSD_ENC_M_CONF) ? ", " : "",
+                                        ench.flags & BSD_ENC_M_CONF ? "confidential" : ""
+      );
     enc_tree = proto_item_add_subtree(ti, ett_enc);
 
     proto_tree_add_uint(enc_tree, hf_enc_af, tvb,
@@ -179,7 +181,7 @@ proto_register_enc(void)
   static gint *ett[] = { &ett_enc };
 
   proto_enc = proto_register_protocol("OpenBSD Encapsulating device",
-                                     "ENC", "enc");
+                                      "ENC", "enc");
   proto_register_field_array(proto_enc, hf, array_length(hf));
   proto_register_subtree_array(ett, array_length(ett));
 }
@@ -189,10 +191,10 @@ proto_reg_handoff_enc(void)
 {
   dissector_handle_t enc_handle;
 
-  ip_handle = find_dissector("ip");
+  ip_handle   = find_dissector("ip");
   ipv6_handle = find_dissector("ipv6");
   data_handle = find_dissector("data");
 
-  enc_handle = create_dissector_handle(dissect_enc, proto_enc);
+  enc_handle  = create_dissector_handle(dissect_enc, proto_enc);
   dissector_add_uint("wtap_encap", WTAP_ENCAP_ENC, enc_handle);
 }
index 860c5d939a1dbdac318859bedd61819de0c7ec3c..33f5ad387d9483a4d537d3bbb9c996aba672ddfb 100644 (file)
 
 
 /* Initialize the protocol and registered fields */
-static int proto_enip              = -1;
-static int proto_cipsafety         = -1;
-
-static int hf_enip_command         = -1;
-static int hf_enip_length          = -1;
-static int hf_enip_options         = -1;
-static int hf_enip_sendercontex    = -1;
-static int hf_enip_status          = -1;
-static int hf_enip_session         = -1;
-static int hf_enip_encapver        = -1;
-static int hf_enip_sinfamily       = -1;
-static int hf_enip_sinport         = -1;
-static int hf_enip_sinaddr         = -1;
-static int hf_enip_sinzero         = -1;
-static int hf_enip_timeout         = -1;
-static int hf_enip_encap_data      = -1;
-
-static int hf_enip_lir_vendor      = -1;
-static int hf_enip_lir_devtype     = -1;
-static int hf_enip_lir_prodcode    = -1;
-static int hf_enip_lir_revision    = -1;
-static int hf_enip_lir_status      = -1;
-static int hf_enip_lir_serial      = -1;
-static int hf_enip_lir_namelen     = -1;
-static int hf_enip_lir_name        = -1;
-static int hf_enip_lir_state       = -1;
-
-static int hf_enip_lsr_capaflags   = -1;
-static int hf_enip_lsr_tcp         = -1;
-static int hf_enip_lsr_udp         = -1;
+static int proto_enip = -1;
+static int proto_cipsafety = -1;
+
+static int hf_enip_command = -1;
+static int hf_enip_length = -1;
+static int hf_enip_options = -1;
+static int hf_enip_sendercontex = -1;
+static int hf_enip_status = -1;
+static int hf_enip_session = -1;
+static int hf_enip_encapver = -1;
+static int hf_enip_sinfamily = -1;
+static int hf_enip_sinport = -1;
+static int hf_enip_sinaddr = -1;
+static int hf_enip_sinzero = -1;
+static int hf_enip_timeout = -1;
+static int hf_enip_encap_data = -1;
+
+static int hf_enip_lir_vendor = -1;
+static int hf_enip_lir_devtype = -1;
+static int hf_enip_lir_prodcode = -1;
+static int hf_enip_lir_revision = -1;
+static int hf_enip_lir_status = -1;
+static int hf_enip_lir_serial = -1;
+static int hf_enip_lir_namelen = -1;
+static int hf_enip_lir_name = -1;
+static int hf_enip_lir_state = -1;
+
+static int hf_enip_lsr_capaflags = -1;
+static int hf_enip_lsr_tcp = -1;
+static int hf_enip_lsr_udp = -1;
 static int hf_enip_lsr_servicename = -1;
 
-static int hf_enip_rs_version      = -1;
-static int hf_enip_rs_optionflags  = -1;
+static int hf_enip_rs_version = -1;
+static int hf_enip_rs_optionflags = -1;
 
-static int hf_enip_srrd_ifacehnd   = -1;
+static int hf_enip_srrd_ifacehnd = -1;
 
-static int hf_enip_sud_ifacehnd    = -1;
+static int hf_enip_sud_ifacehnd = -1;
 
-static int hf_enip_cpf_itemcount   = -1;
-static int hf_enip_cpf_typeid      = -1;
-static int hf_enip_cpf_length      = -1;
-static int hf_enip_cpf_cdi_seqcnt  = -1;
+static int hf_enip_cpf_itemcount = -1;
+static int hf_enip_cpf_typeid = -1;
+static int hf_enip_cpf_length = -1;
+static int hf_enip_cpf_cdi_seqcnt = -1;
 static int hf_enip_cpf_cdi_32bitheader = -1;
 static int hf_enip_cpf_cdi_32bitheader_roo = -1;
 static int hf_enip_cpf_cdi_32bitheader_coo = -1;
 static int hf_enip_cpf_cdi_32bitheader_run_idle = -1;
-static int hf_enip_cpf_cai_connid  = -1;
-static int hf_enip_cpf_sai_connid  = -1;
-static int hf_enip_cpf_sai_seqnum  = -1;
+static int hf_enip_cpf_cai_connid = -1;
+static int hf_enip_cpf_sai_connid = -1;
+static int hf_enip_cpf_sai_seqnum = -1;
 
-static int hf_enip_cpf_data        = -1;
+static int hf_enip_cpf_data = -1;
 
 static int hf_enip_response_in = -1;
 static int hf_enip_response_to = -1;
@@ -149,107 +149,107 @@ static int hf_enip_time = -1;
 static int hf_enip_connection_transport_data = -1;
 
 /* Parsed Attributes */
-static int hf_tcpip_status                            = -1;
-static int hf_tcpip_status_interface_config           = -1;
-static int hf_tcpip_status_mcast_pending              = -1;
-static int hf_tcpip_status_interface_config_pending   = -1;
-static int hf_tcpip_status_acd                        = -1;
-static int hf_tcpip_status_reserved                   = -1;
-static int hf_tcpip_config_cap                        = -1;
-static int hf_tcpip_config_cap_bootp                  = -1;
-static int hf_tcpip_config_cap_dns                    = -1;
-static int hf_tcpip_config_cap_dhcp                   = -1;
-static int hf_tcpip_config_cap_dhcp_dns_update        = -1;
-static int hf_tcpip_config_cap_config_settable        = -1;
-static int hf_tcpip_config_cap_hardware_config        = -1;
-static int hf_tcpip_config_cap_interface_reset        = -1;
-static int hf_tcpip_config_cap_acd                    = -1;
-static int hf_tcpip_config_cap_reserved               = -1;
-static int hf_tcpip_config_control                    = -1;
-static int hf_tcpip_config_control_config             = -1;
-static int hf_tcpip_config_control_dns                = -1;
-static int hf_tcpip_config_control_reserved           = -1;
-static int hf_tcpip_physical_link_size                = -1;
-static int hf_tcpip_ic_ip_addr                        = -1;
-static int hf_tcpip_ic_subnet_mask                    = -1;
-static int hf_tcpip_ic_gateway                        = -1;
-static int hf_tcpip_ic_name_server                    = -1;
-static int hf_tcpip_ic_name_server2                   = -1;
-static int hf_tcpip_ic_domain_name                    = -1;
-static int hf_tcpip_hostname                          = -1;
-static int hf_tcpip_ttl_value                         = -1;
-static int hf_tcpip_mcast_alloc                       = -1;
-static int hf_tcpip_mcast_reserved                    = -1;
-static int hf_tcpip_mcast_num_mcast                   = -1;
-static int hf_tcpip_mcast_addr_start                  = -1;
-static int hf_tcpip_lcd_acd_activity                  = -1;
-static int hf_tcpip_lcd_remote_mac                    = -1;
-static int hf_tcpip_lcd_arp_pdu                       = -1;
-static int hf_tcpip_select_acd                        = -1;
-static int hf_tcpip_quick_connect                     = -1;
-
-static int hf_elink_interface_flags                   = -1;
-static int hf_elink_iflags_link_status                = -1;
-static int hf_elink_iflags_duplex                     = -1;
-static int hf_elink_iflags_neg_status                 = -1;
-static int hf_elink_iflags_manual_reset               = -1;
-static int hf_elink_iflags_local_hw_fault             = -1;
-static int hf_elink_iflags_reserved                   = -1;
-static int hf_elink_interface_speed                   = -1;
-static int hf_elink_physical_address                  = -1;
-static int hf_elink_icount_in_octets                  = -1;
-static int hf_elink_icount_in_ucast                   = -1;
-static int hf_elink_icount_in_nucast                  = -1;
-static int hf_elink_icount_in_discards                = -1;
-static int hf_elink_icount_in_errors                  = -1;
-static int hf_elink_icount_in_unknown_protos          = -1;
-static int hf_elink_icount_out_octets                 = -1;
-static int hf_elink_icount_out_ucast                  = -1;
-static int hf_elink_icount_out_nucast                 = -1;
-static int hf_elink_icount_out_discards               = -1;
-static int hf_elink_icount_out_errors                 = -1;
-static int hf_elink_mcount_alignment_errors           = -1;
-static int hf_elink_mcount_fcs_errors                 = -1;
-static int hf_elink_mcount_single_collisions          = -1;
-static int hf_elink_mcount_multiple_collisions        = -1;
-static int hf_elink_mcount_sqe_test_errors            = -1;
-static int hf_elink_mcount_deferred_transmission      = -1;
-static int hf_elink_mcount_late_collisions            = -1;
-static int hf_elink_mcount_excessive_collisions       = -1;
-static int hf_elink_mcount_mac_transmit_errors        = -1;
-static int hf_elink_mcount_carrier_sense_errors       = -1;
-static int hf_elink_mcount_frame_too_long             = -1;
-static int hf_elink_mcount_mac_receive_errors         = -1;
-static int hf_elink_icontrol_control_bits             = -1;
-static int hf_elink_icontrol_control_bits_auto_neg    = -1;
+static int hf_tcpip_status = -1;
+static int hf_tcpip_status_interface_config = -1;
+static int hf_tcpip_status_mcast_pending = -1;
+static int hf_tcpip_status_interface_config_pending = -1;
+static int hf_tcpip_status_acd = -1;
+static int hf_tcpip_status_reserved = -1;
+static int hf_tcpip_config_cap = -1;
+static int hf_tcpip_config_cap_bootp = -1;
+static int hf_tcpip_config_cap_dns = -1;
+static int hf_tcpip_config_cap_dhcp = -1;
+static int hf_tcpip_config_cap_dhcp_dns_update = -1;
+static int hf_tcpip_config_cap_config_settable = -1;
+static int hf_tcpip_config_cap_hardware_config = -1;
+static int hf_tcpip_config_cap_interface_reset = -1;
+static int hf_tcpip_config_cap_acd = -1;
+static int hf_tcpip_config_cap_reserved = -1;
+static int hf_tcpip_config_control = -1;
+static int hf_tcpip_config_control_config = -1;
+static int hf_tcpip_config_control_dns = -1;
+static int hf_tcpip_config_control_reserved = -1;
+static int hf_tcpip_physical_link_size = -1;
+static int hf_tcpip_ic_ip_addr = -1;
+static int hf_tcpip_ic_subnet_mask = -1;
+static int hf_tcpip_ic_gateway = -1;
+static int hf_tcpip_ic_name_server = -1;
+static int hf_tcpip_ic_name_server2 = -1;
+static int hf_tcpip_ic_domain_name = -1;
+static int hf_tcpip_hostname = -1;
+static int hf_tcpip_ttl_value = -1;
+static int hf_tcpip_mcast_alloc = -1;
+static int hf_tcpip_mcast_reserved = -1;
+static int hf_tcpip_mcast_num_mcast = -1;
+static int hf_tcpip_mcast_addr_start = -1;
+static int hf_tcpip_lcd_acd_activity = -1;
+static int hf_tcpip_lcd_remote_mac = -1;
+static int hf_tcpip_lcd_arp_pdu = -1;
+static int hf_tcpip_select_acd = -1;
+static int hf_tcpip_quick_connect = -1;
+
+static int hf_elink_interface_flags = -1;
+static int hf_elink_iflags_link_status = -1;
+static int hf_elink_iflags_duplex = -1;
+static int hf_elink_iflags_neg_status = -1;
+static int hf_elink_iflags_manual_reset = -1;
+static int hf_elink_iflags_local_hw_fault = -1;
+static int hf_elink_iflags_reserved = -1;
+static int hf_elink_interface_speed = -1;
+static int hf_elink_physical_address = -1;
+static int hf_elink_icount_in_octets = -1;
+static int hf_elink_icount_in_ucast = -1;
+static int hf_elink_icount_in_nucast = -1;
+static int hf_elink_icount_in_discards = -1;
+static int hf_elink_icount_in_errors = -1;
+static int hf_elink_icount_in_unknown_protos = -1;
+static int hf_elink_icount_out_octets = -1;
+static int hf_elink_icount_out_ucast = -1;
+static int hf_elink_icount_out_nucast = -1;
+static int hf_elink_icount_out_discards = -1;
+static int hf_elink_icount_out_errors = -1;
+static int hf_elink_mcount_alignment_errors = -1;
+static int hf_elink_mcount_fcs_errors = -1;
+static int hf_elink_mcount_single_collisions = -1;
+static int hf_elink_mcount_multiple_collisions = -1;
+static int hf_elink_mcount_sqe_test_errors = -1;
+static int hf_elink_mcount_deferred_transmission = -1;
+static int hf_elink_mcount_late_collisions = -1;
+static int hf_elink_mcount_excessive_collisions = -1;
+static int hf_elink_mcount_mac_transmit_errors = -1;
+static int hf_elink_mcount_carrier_sense_errors = -1;
+static int hf_elink_mcount_frame_too_long = -1;
+static int hf_elink_mcount_mac_receive_errors = -1;
+static int hf_elink_icontrol_control_bits = -1;
+static int hf_elink_icontrol_control_bits_auto_neg = -1;
 static int hf_elink_icontrol_control_bits_forced_duplex = -1;
-static int hf_elink_icontrol_control_bits_reserved    = -1;
-static int hf_elink_icontrol_forced_speed             = -1;
-static int hf_elink_interface_type                    = -1;
-static int hf_elink_interface_state                   = -1;
-static int hf_elink_admin_state                       = -1;
-static int hf_elink_interface_label                   = -1;
-
-static int hf_qos_8021q_enable                        = -1;
-static int hf_qos_dscp_ptp_event                      = -1;
-static int hf_qos_dscp_ptp_general                    = -1;
-static int hf_qos_dscp_urgent                         = -1;
-static int hf_qos_dscp_scheduled                      = -1;
-static int hf_qos_dscp_high                           = -1;
-static int hf_qos_dscp_low                            = -1;
-static int hf_qos_dscp_explicit                       = -1;
+static int hf_elink_icontrol_control_bits_reserved = -1;
+static int hf_elink_icontrol_forced_speed = -1;
+static int hf_elink_interface_type = -1;
+static int hf_elink_interface_state = -1;
+static int hf_elink_admin_state = -1;
+static int hf_elink_interface_label = -1;
+
+static int hf_qos_8021q_enable = -1;
+static int hf_qos_dscp_ptp_event = -1;
+static int hf_qos_dscp_ptp_general = -1;
+static int hf_qos_dscp_urgent = -1;
+static int hf_qos_dscp_scheduled = -1;
+static int hf_qos_dscp_high = -1;
+static int hf_qos_dscp_low = -1;
+static int hf_qos_dscp_explicit = -1;
 
 /* Initialize the subtree pointers */
-static gint ett_enip          = -1;
-static gint ett_count_tree    = -1;
-static gint ett_type_tree     = -1;
-static gint ett_command_tree  = -1;
-static gint ett_sockadd       = -1;
+static gint ett_enip = -1;
+static gint ett_count_tree = -1;
+static gint ett_type_tree = -1;
+static gint ett_command_tree = -1;
+static gint ett_sockadd = -1;
 static gint ett_32bitheader_tree = -1;
-static gint ett_lsrcf         = -1;
-static gint ett_tcpip_status  = -1;
-static gint ett_tcpip_config_cap      = -1;
-static gint ett_tcpip_config_control  = -1;
+static gint ett_lsrcf = -1;
+static gint ett_tcpip_status = -1;
+static gint ett_tcpip_config_cap = -1;
+static gint ett_tcpip_config_control = -1;
 static gint ett_elink_interface_flags = -1;
 static gint ett_elink_icontrol_bits = -1;
 
@@ -260,31 +260,31 @@ static dissector_handle_t  arp_handle;
 static dissector_handle_t  cipsafety_handle;
 static dissector_handle_t  cipmotion_handle;
 
-static gboolean enip_desegment = TRUE;
+static gboolean enip_desegment  = TRUE;
 static gboolean enip_OTrun_idle = TRUE;
 static gboolean enip_TOrun_idle = FALSE;
 
-static int proto_dlr     = -1;
+static int proto_dlr = -1;
 
-static int hf_dlr_ringsubtype      = -1;
+static int hf_dlr_ringsubtype = -1;
 static int hf_dlr_ringprotoversion = -1;
-static int hf_dlr_frametype        = -1;
-static int hf_dlr_sourceport       = -1;
-static int hf_dlr_sourceip         = -1;
-static int hf_dlr_sequenceid       = -1;
+static int hf_dlr_frametype = -1;
+static int hf_dlr_sourceport = -1;
+static int hf_dlr_sourceip = -1;
+static int hf_dlr_sequenceid = -1;
 
-static int hf_dlr_ringstate            = -1;
+static int hf_dlr_ringstate = -1;
 static int hf_dlr_supervisorprecedence = -1;
-static int hf_dlr_beaconinterval       = -1;
-static int hf_dlr_beacontimeout        = -1;
-static int hf_dlr_beaconreserved       = -1;
+static int hf_dlr_beaconinterval = -1;
+static int hf_dlr_beacontimeout = -1;
+static int hf_dlr_beaconreserved = -1;
 
-static int hf_dlr_nreqreserved   = -1;
+static int hf_dlr_nreqreserved = -1;
 
 static int hf_dlr_nressourceport = -1;
-static int hf_dlr_nresreserved   = -1;
+static int hf_dlr_nresreserved = -1;
 
-static int hf_dlr_lnknbrstatus   = -1;
+static int hf_dlr_lnknbrstatus = -1;
 static int hf_dlr_lnknbrreserved = -1;
 
 static int hf_dlr_lfreserved = -1;
@@ -292,8 +292,8 @@ static int hf_dlr_lfreserved = -1;
 static int hf_dlr_anreserved = -1;
 
 static int hf_dlr_sonumnodes = -1;
-static int hf_dlr_somac      = -1;
-static int hf_dlr_soip       = -1;
+static int hf_dlr_somac = -1;
+static int hf_dlr_soip = -1;
 static int hf_dlr_soreserved = -1;
 
 static gint ett_dlr = -1;
@@ -316,12 +316,12 @@ static const value_string encap_cmd_vals[] = {
 
 /* Translate function to string - Encapsulation status */
 static const value_string encap_status_vals[] = {
-   { SUCCESS,              "Success" },
-   { INVALID_CMD,          "Invalid Command" },
-   { NO_RESOURCES,         "No Memory Resources" },
-   { INCORRECT_DATA,       "Incorrect Data" },
-   { INVALID_SESSION,      "Invalid Session Handle" },
-   { INVALID_LENGTH,       "Invalid Length" },
+   { SUCCESS,              "Success"                       },
+   { INVALID_CMD,          "Invalid Command"               },
+   { NO_RESOURCES,         "No Memory Resources"           },
+   { INCORRECT_DATA,       "Incorrect Data"                },
+   { INVALID_SESSION,      "Invalid Session Handle"        },
+   { INVALID_LENGTH,       "Invalid Length"                },
    { UNSUPPORTED_PROT_REV, "Unsupported Protocol Revision" },
 
    { 0,                    NULL }
@@ -329,15 +329,15 @@ static const value_string encap_status_vals[] = {
 
 /* Translate function to Common data format values */
 static const value_string cdf_type_vals[] = {
-   { CDF_NULL,             "Null Address Item" },
-   { LIST_IDENTITY_RESP,   "List Identity Response" },
-   { CONNECTION_BASED,     "Connected Address Item" },
-   { CONNECTION_TRANSPORT, "Connected Data Item" },
-   { UNCONNECTED_MSG,      "Unconnected Data Item" },
-   { LIST_SERVICES_RESP,   "List Services Response" },
+   { CDF_NULL,             "Null Address Item"        },
+   { LIST_IDENTITY_RESP,   "List Identity Response"   },
+   { CONNECTION_BASED,     "Connected Address Item"   },
+   { CONNECTION_TRANSPORT, "Connected Data Item"      },
+   { UNCONNECTED_MSG,      "Unconnected Data Item"    },
+   { LIST_SERVICES_RESP,   "List Services Response"   },
    { SOCK_ADR_INFO_OT,     "Socket Address Info O->T" },
    { SOCK_ADR_INFO_TO,     "Socket Address Info T->O" },
-   { SEQ_ADDRESS,          "Sequenced Address Item" },
+   { SEQ_ADDRESS,          "Sequenced Address Item"   },
 
    { 0,                    NULL }
 };
@@ -453,13 +453,13 @@ static const value_string enip_interface_handle_vals[] = {
 
 /* Translate function to DLR Frame Type values */
 static const value_string dlr_frame_type_vals[] = {
-   { DLR_FT_BEACON,           "Beacon" },
-   { DLR_FT_NEIGHBOR_REQ,     "Neighbor_Check_Request" },
-   { DLR_FT_NEIGHBOR_RES,     "Neighbor_Check_Response" },
+   { DLR_FT_BEACON,           "Beacon"                        },
+   { DLR_FT_NEIGHBOR_REQ,     "Neighbor_Check_Request"        },
+   { DLR_FT_NEIGHBOR_RES,     "Neighbor_Check_Response"       },
    { DLR_FT_LINK_STAT,        "Link_Status / Neighbor_Status" },
-   { DLR_FT_LOCATE_FLT,       "Locate_Fault" },
-   { DLR_FT_ANNOUNCE,         "Announce" },
-   { DLR_FT_SIGN_ON,          "Sign_On" },
+   { DLR_FT_LOCATE_FLT,       "Locate_Fault"                  },
+   { DLR_FT_ANNOUNCE,         "Announce"                      },
+   { DLR_FT_SIGN_ON,          "Sign_On"                       },
 
    { 0,                    NULL }
 };
@@ -498,7 +498,7 @@ enum enip_packet_type {ENIP_REQUEST_PACKET, ENIP_RESPONSE_PACKET, ENIP_CANNOT_CL
 enum enip_packet_data_type { EPDT_UNKNOWN, EPDT_CONNECTED_TRANSPORT, EPDT_UNCONNECTED };
 
 typedef struct enip_request_key {
-   enum enip_packet_type requesttype;
+   enum enip_packet_type      requesttype;
    enum enip_packet_data_type type;
    guint32 session_handle;
    guint64 sender_context;
@@ -571,8 +571,8 @@ enip_request_hash (gconstpointer v)
 static enip_request_info_t *
 enip_match_request( packet_info *pinfo, proto_tree *tree, enip_request_key_t *prequest_key )
 {
-   enip_request_key_t *new_request_key;
-   enip_request_val_t *request_val;
+   enip_request_key_t  *new_request_key;
+   enip_request_val_t  *request_val;
    enip_request_info_t *request_info = NULL;
 
    request_info = NULL;
@@ -716,11 +716,11 @@ enip_conn_hash (gconstpointer v)
 void
 enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
 {
-   enip_conn_key_t *conn_key;
-   enip_conn_val_t *conn_val;
-   conversation_t *conversation, *conversationTO;
+   enip_conn_key_t  *conn_key;
+   enip_conn_val_t  *conn_val;
+   conversation_t   *conversation, *conversationTO;
    enip_conv_info_t *enip_info;
-   address dest_address;
+   address           dest_address;
 
    if (pinfo->fd->flags.visited)
       return;
@@ -772,12 +772,12 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
          /* check for O->T conversation */
          /* similar logic to find_or_create_conversation(), but since I/O traffic
          is on UDP, the pinfo parameter doesn't have the correct information */
-             if((conversation = find_conversation(pinfo->fd->num, &pinfo->dst, &dest_address,
-                                          PT_UDP, connInfo->O2T.port, 0, NO_PORT_B)) == NULL) {
+         if((conversation = find_conversation(pinfo->fd->num, &pinfo->dst, &dest_address,
+                                              PT_UDP, connInfo->O2T.port, 0, NO_PORT_B)) == NULL) {
 
-             conversation = conversation_new(pinfo->fd->num, &pinfo->dst, &dest_address,
-                     PT_UDP, connInfo->O2T.port, 0, NO_PORT2);
-             }
+            conversation = conversation_new(pinfo->fd->num, &pinfo->dst, &dest_address,
+                                            PT_UDP, connInfo->O2T.port, 0, NO_PORT2);
+         }
 
          enip_info = conversation_get_proto_data(conversation, proto_enip);
          if (enip_info == NULL)
@@ -796,11 +796,11 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
             or ports aren't equal, a separate conversation must be generated */
          dest_address.data = &connInfo->T2O.ipaddress;
          if((conversationTO = find_conversation(pinfo->fd->num, &pinfo->src, &dest_address,
-                                PT_UDP, connInfo->T2O.port, 0, NO_PORT_B)) == NULL) {
+                                                PT_UDP, connInfo->T2O.port, 0, NO_PORT_B)) == NULL) {
 
              conversationTO = conversation_new(pinfo->fd->num, &pinfo->src,
-                                   &dest_address, PT_UDP,
-                                   connInfo->T2O.port, 0, NO_PORT2);
+                                               &dest_address, PT_UDP,
+                                               connInfo->T2O.port, 0, NO_PORT2);
          }
 
          enip_info = conversation_get_proto_data(conversationTO, proto_enip);
@@ -846,7 +846,7 @@ void
 enip_close_cip_connection(packet_info *pinfo, guint16 ConnSerialNumber,
                           guint16 VendorID, guint32 DeviceSerialNumber )
 {
-   enip_conn_key_t conn_key;
+   enip_conn_key_t  conn_key;
    enip_conn_val_t *conn_val;
 
    if (pinfo->fd->flags.visited)
@@ -868,9 +868,9 @@ enip_close_cip_connection(packet_info *pinfo, guint16 ConnSerialNumber,
 static guint32
 enip_get_explicit_connid(packet_info *pinfo, enip_request_key_t *prequest_key, guint32 connid)
 {
-   conversation_t *conversation;
+   conversation_t   *conversation;
    enip_conv_info_t *enip_info;
-   enip_conn_val_t *conn_val;
+   enip_conn_val_t  *conn_val;
 
    if (  prequest_key == NULL
       || ( prequest_key->requesttype != ENIP_REQUEST_PACKET && prequest_key->requesttype != ENIP_RESPONSE_PACKET )
@@ -922,9 +922,9 @@ enip_get_explicit_connid(packet_info *pinfo, enip_request_key_t *prequest_key, g
 static enip_conn_val_t*
 enip_get_io_connid(packet_info *pinfo, guint32 connid, enum enip_connid_type* pconnid_type)
 {
-   conversation_t *conversation;
+   conversation_t   *conversation;
    enip_conv_info_t *enip_info;
-   enip_conn_val_t *conn_val = NULL;
+   enip_conn_val_t  *conn_val = NULL;
 
    *pconnid_type = ECIDT_UNKNOWN;
 
@@ -972,8 +972,8 @@ int dissect_tcpip_status(packet_info *pinfo, proto_tree *tree, proto_item *item,
                              int offset, int total_len)
 
 {
-   proto_itemstatus_item;
-   proto_treestatus_tree;
+   proto_item *status_item;
+   proto_tree *status_tree;
 
    if (total_len < 4)
    {
@@ -996,8 +996,8 @@ int dissect_tcpip_config_cap(packet_info *pinfo, proto_tree *tree, proto_item *i
                              int offset, int total_len)
 
 {
-   proto_itemcap_item;
-   proto_treecap_tree;
+   proto_item *cap_item;
+   proto_tree *cap_tree;
 
    if (total_len < 4)
    {
@@ -1024,8 +1024,8 @@ int dissect_tcpip_config_control(packet_info *pinfo, proto_tree *tree, proto_ite
                              int offset, int total_len)
 
 {
-   proto_itemcontrol_item;
-   proto_treecontrol_tree;
+   proto_item *control_item;
+   proto_tree *control_tree;
 
    if (total_len < 4)
    {
@@ -1046,8 +1046,8 @@ int dissect_tcpip_physical_link(packet_info *pinfo, proto_tree *tree, proto_item
                              int offset, int total_len)
 
 {
-   guint16 path_size;
-   proto_itempath_item;
+   guint16     path_size;
+   proto_item *path_item;
 
    path_size = tvb_get_letohs( tvb, offset)*2;
    proto_tree_add_uint_format_value(tree, hf_tcpip_physical_link_size, tvb, offset, 2, path_size / 2, "%d (words)", path_size / 2);
@@ -1136,8 +1136,8 @@ int dissect_elink_interface_flags(packet_info *pinfo, proto_tree *tree, proto_it
                              int offset, int total_len)
 
 {
-   proto_itemflag_item;
-   proto_treeflag_tree;
+   proto_item *flag_item;
+   proto_tree *flag_tree;
 
    if (total_len < 4)
    {
@@ -1210,8 +1210,8 @@ int dissect_elink_interface_control(packet_info *pinfo, proto_tree *tree, proto_
                              int offset, int total_len)
 
 {
-   proto_itemcontrol_item;
-   proto_treecontrol_tree;
+   proto_item *control_item;
+   proto_tree *control_tree;
 
    if (total_len < 4)
    {
@@ -1232,39 +1232,39 @@ int dissect_elink_interface_control(packet_info *pinfo, proto_tree *tree, proto_
 attribute_info_t enip_attribute_vals[29] = {
 
    /* TCP/IP object */
-   {0xF5, FALSE, 1, "Status", cip_dissector_func, NULL, dissect_tcpip_status},
-   {0xF5, FALSE, 2, "Configuration Capability", cip_dissector_func, NULL, dissect_tcpip_config_cap},
-   {0xF5, FALSE, 3, "Configuration Control", cip_dissector_func, NULL, dissect_tcpip_config_control},
-   {0xF5, FALSE, 4, "Physical Link Object", cip_dissector_func, NULL, dissect_tcpip_physical_link},
-   {0xF5, FALSE, 5, "Interface Configuration", cip_dissector_func, NULL, dissect_tcpip_interface_config},
-   {0xF5, FALSE, 6, "Host Name", cip_string, &hf_tcpip_hostname, NULL},
-   {0xF5, FALSE, 8, "TTL Value", cip_usint, &hf_tcpip_ttl_value, NULL},
-   {0xF5, FALSE, 9, "Multicast Configuration", cip_dissector_func, NULL, dissect_tcpip_mcast_config},
+   {0xF5, FALSE,  1, "Status", cip_dissector_func, NULL, dissect_tcpip_status},
+   {0xF5, FALSE,  2, "Configuration Capability", cip_dissector_func, NULL, dissect_tcpip_config_cap},
+   {0xF5, FALSE,  3, "Configuration Control", cip_dissector_func, NULL, dissect_tcpip_config_control},
+   {0xF5, FALSE,  4, "Physical Link Object", cip_dissector_func, NULL, dissect_tcpip_physical_link},
+   {0xF5, FALSE,  5, "Interface Configuration", cip_dissector_func, NULL, dissect_tcpip_interface_config},
+   {0xF5, FALSE,  6, "Host Name", cip_string, &hf_tcpip_hostname, NULL},
+   {0xF5, FALSE,  8, "TTL Value", cip_usint, &hf_tcpip_ttl_value, NULL},
+   {0xF5, FALSE,  9, "Multicast Configuration", cip_dissector_func, NULL, dissect_tcpip_mcast_config},
    {0xF5, FALSE, 10, "Select ACD", cip_bool, &hf_tcpip_select_acd, NULL},
    {0xF5, FALSE, 11, "Last Conflict Detected", cip_dissector_func, NULL, dissect_tcpip_last_conflict},
    {0xF5, FALSE, 12, "EtherNet/IP Quick Connect", cip_bool, &hf_tcpip_quick_connect, NULL},
 
    /* Ethernet Link object */
-   {0xF6, FALSE, 1, "Interface Speed", cip_dword, &hf_elink_interface_speed, NULL},
-   {0xF6, FALSE, 2, "Interface Flags", cip_dissector_func, NULL, dissect_elink_interface_flags},
-   {0xF6, FALSE, 3, "Physical Address", cip_byte_array, &hf_elink_physical_address, NULL},
-   {0xF6, FALSE, 4, "Interface Counters", cip_dissector_func, NULL, dissect_elink_interface_counters},
-   {0xF6, FALSE, 5, "Media Counters", cip_dissector_func, NULL, dissect_elink_media_counters},
-   {0xF6, FALSE, 6, "Interface Control", cip_dissector_func, NULL, dissect_elink_interface_control},
-   {0xF6, FALSE, 7, "Interface Type", cip_usint, &hf_elink_interface_type, NULL},
-   {0xF6, FALSE, 8, "Interface State", cip_usint, &hf_elink_interface_state, NULL},
-   {0xF6, FALSE, 9, "Admin State", cip_usint, &hf_elink_admin_state, NULL},
+   {0xF6, FALSE,  1, "Interface Speed", cip_dword, &hf_elink_interface_speed, NULL},
+   {0xF6, FALSE,  2, "Interface Flags", cip_dissector_func, NULL, dissect_elink_interface_flags},
+   {0xF6, FALSE,  3, "Physical Address", cip_byte_array, &hf_elink_physical_address, NULL},
+   {0xF6, FALSE,  4, "Interface Counters", cip_dissector_func, NULL, dissect_elink_interface_counters},
+   {0xF6, FALSE,  5, "Media Counters", cip_dissector_func, NULL, dissect_elink_media_counters},
+   {0xF6, FALSE,  6, "Interface Control", cip_dissector_func, NULL, dissect_elink_interface_control},
+   {0xF6, FALSE,  7, "Interface Type", cip_usint, &hf_elink_interface_type, NULL},
+   {0xF6, FALSE,  8, "Interface State", cip_usint, &hf_elink_interface_state, NULL},
+   {0xF6, FALSE,  9, "Admin State", cip_usint, &hf_elink_admin_state, NULL},
    {0xF6, FALSE, 10, "Interface Label", cip_short_string, &hf_elink_interface_label, NULL},
 
    /* QoS object */
-   {0x48, FALSE, 1, "802.1Q Tag Enable", cip_bool, &hf_qos_8021q_enable, NULL},
-   {0x48, FALSE, 2, "DSCP PTP Event", cip_usint, &hf_qos_dscp_ptp_event, NULL},
-   {0x48, FALSE, 3, "DSCP PTP General", cip_usint, &hf_qos_dscp_ptp_general, NULL},
-   {0x48, FALSE, 4, "DSCP Urgent", cip_usint, &hf_qos_dscp_urgent, NULL},
-   {0x48, FALSE, 5, "DSCP Scheduled", cip_usint, &hf_qos_dscp_scheduled, NULL},
-   {0x48, FALSE, 6, "DSCP High", cip_usint, &hf_qos_dscp_high, NULL},
-   {0x48, FALSE, 7, "DSCP Low", cip_usint, &hf_qos_dscp_low, NULL},
-   {0x48, FALSE, 8, "DSCP Explicit", cip_usint, &hf_qos_dscp_explicit, NULL}
+   {0x48, FALSE,  1, "802.1Q Tag Enable", cip_bool, &hf_qos_8021q_enable, NULL},
+   {0x48, FALSE,  2, "DSCP PTP Event", cip_usint, &hf_qos_dscp_ptp_event, NULL},
+   {0x48, FALSE,  3, "DSCP PTP General", cip_usint, &hf_qos_dscp_ptp_general, NULL},
+   {0x48, FALSE,  4, "DSCP Urgent", cip_usint, &hf_qos_dscp_urgent, NULL},
+   {0x48, FALSE,  5, "DSCP Scheduled", cip_usint, &hf_qos_dscp_scheduled, NULL},
+   {0x48, FALSE,  6, "DSCP High", cip_usint, &hf_qos_dscp_high, NULL},
+   {0x48, FALSE,  7, "DSCP Low", cip_usint, &hf_qos_dscp_low, NULL},
+   {0x48, FALSE,  8, "DSCP Explicit", cip_usint, &hf_qos_dscp_explicit, NULL}
 
 };
 
@@ -1291,17 +1291,17 @@ static void
 dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
             packet_info *pinfo, proto_tree *tree, proto_tree *dissector_tree, int offset, guint32 ifacehndl)
 {
-   proto_item *temp_item, *count_item, *type_item, *sockaddr_item, *io_item;
-   proto_tree *temp_tree, *count_tree, *item_tree, *sockaddr_tree, *io_tree;
-   int item_count, item_length, item, io_length;
-   unsigned char name_length;
-   tvbuff_t *next_tvb;
-   enip_request_info_t *request_info;
-   enip_conn_val_t* conn_info = NULL;
-   gboolean FwdOpen = FALSE,
-            FwdOpenReply = FALSE;
-   enum enip_connid_type connid_type = ECIDT_UNKNOWN;
-   cip_safety_info_t* cip_safety;
+   proto_item            *temp_item, *count_item, *type_item, *sockaddr_item, *io_item;
+   proto_tree            *temp_tree, *count_tree, *item_tree, *sockaddr_tree, *io_tree;
+   int                    item_count, item_length, item, io_length;
+   unsigned char          name_length;
+   tvbuff_t              *next_tvb;
+   enip_request_info_t   *request_info;
+   enip_conn_val_t*       conn_info    = NULL;
+   gboolean               FwdOpen      = FALSE;
+   gboolean               FwdOpenReply = FALSE;
+   enum enip_connid_type  connid_type  = ECIDT_UNKNOWN;
+   cip_safety_info_t*     cip_safety;
 
    /* Create item count tree */
    item_count = tvb_get_letohs( tvb, offset );
@@ -1698,12 +1698,12 @@ get_enip_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
 static void
 dissect_enip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-   int      packet_type;
-   guint16  encap_cmd, encap_data_length;
-   const char *pkt_type_str = "";
-   guint32  ifacehndl;
-   enip_request_key_t request_key;
-   conversation_t *conversation;
+   int                 packet_type;
+   guint16             encap_cmd, encap_data_length;
+   const char         *pkt_type_str = "";
+   guint32             ifacehndl;
+   enip_request_key_t  request_key;
+   conversation_t     *conversation;
 
    /* Set up structures needed to add the protocol subtree and manage it */
    proto_item *ti, *encaph, *csf;
@@ -2064,152 +2064,682 @@ proto_register_enip(void)
 {
    /* Setup list of header fields */
    static hf_register_info hf[] = {
-      { &hf_enip_command, { "Command", "enip.command", FT_UINT16, BASE_HEX, VALS(encap_cmd_vals), 0, "Encapsulation command", HFILL }},
-      { &hf_enip_length, { "Length", "enip.length", FT_UINT16, BASE_DEC, NULL, 0, "Encapsulation length", HFILL }},
-      { &hf_enip_session, { "Session Handle", "enip.session", FT_UINT32, BASE_HEX, NULL, 0, "Session identification", HFILL }},
-      { &hf_enip_status, { "Status", "enip.status", FT_UINT32, BASE_HEX, VALS(encap_status_vals), 0, "Status code", HFILL }},
-      { &hf_enip_sendercontex, { "Sender Context", "enip.context", FT_BYTES, BASE_NONE, NULL, 0, "Information pertient to the sender", HFILL }},
-      { &hf_enip_options, { "Options", "enip.options", FT_UINT32, BASE_HEX, NULL, 0, "Options flags", HFILL }},
-      { &hf_enip_encapver, { "Encapsulation Version", "enip.encapver", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_enip_sinfamily, { "sin_family", "enip.sinfamily", FT_UINT16, BASE_DEC, NULL, 0, "Socket Address.Sin Family", HFILL }},
-      { &hf_enip_sinport, { "sin_port", "enip.sinport", FT_UINT16, BASE_DEC, NULL, 0, "Socket Address.Sin Port", HFILL }},
-      { &hf_enip_sinaddr, { "sin_addr", "enip.sinaddr", FT_IPv4, BASE_NONE, NULL, 0, "Socket Address.Sin Addr", HFILL }},
-      { &hf_enip_sinzero, { "sin_zero", "enip.sinzero", FT_BYTES, BASE_NONE, NULL, 0, "Socket Address.Sin Zero", HFILL }},
-      { &hf_enip_timeout, { "Timeout", "enip.timeout", FT_UINT16, BASE_DEC, NULL, 0, "Encapsulation Timeout", HFILL }},
-      { &hf_enip_encap_data, { "Encap Data", "enip.encap_data", FT_BYTES, BASE_NONE, NULL, 0, "Encapsulation Data", HFILL }},
+      { &hf_enip_command,
+        { "Command", "enip.command",
+          FT_UINT16, BASE_HEX, VALS(encap_cmd_vals), 0,
+          "Encapsulation command", HFILL }},
+
+      { &hf_enip_length,
+        { "Length", "enip.length",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          "Encapsulation length", HFILL }},
+
+      { &hf_enip_session,
+        { "Session Handle", "enip.session",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          "Session identification", HFILL }},
+
+      { &hf_enip_status,
+        { "Status", "enip.status",
+          FT_UINT32, BASE_HEX, VALS(encap_status_vals), 0,
+          "Status code", HFILL }},
+
+      { &hf_enip_sendercontex,
+        { "Sender Context", "enip.context",
+          FT_BYTES, BASE_NONE, NULL, 0,
+          "Information pertient to the sender", HFILL }},
+
+      { &hf_enip_options,
+        { "Options", "enip.options",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          "Options flags", HFILL }},
+
+      { &hf_enip_encapver,
+        { "Encapsulation Version", "enip.encapver",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_enip_sinfamily,
+        { "sin_family", "enip.sinfamily",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          "Socket Address.Sin Family", HFILL }},
+
+      { &hf_enip_sinport,
+        { "sin_port", "enip.sinport",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          "Socket Address.Sin Port", HFILL }},
+
+      { &hf_enip_sinaddr,
+        { "sin_addr", "enip.sinaddr",
+          FT_IPv4, BASE_NONE, NULL, 0,
+          "Socket Address.Sin Addr", HFILL }},
+
+      { &hf_enip_sinzero,
+        { "sin_zero", "enip.sinzero",
+          FT_BYTES, BASE_NONE, NULL, 0,
+          "Socket Address.Sin Zero", HFILL }},
+
+      { &hf_enip_timeout,
+        { "Timeout", "enip.timeout",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          "Encapsulation Timeout", HFILL }},
+
+      { &hf_enip_encap_data,
+        { "Encap Data", "enip.encap_data",
+          FT_BYTES, BASE_NONE, NULL, 0,
+          "Encapsulation Data", HFILL }},
+
       /* List Services Reply */
-      { &hf_enip_lsr_capaflags, { "Capability Flags", "enip.lsr.capaflags", FT_UINT16, BASE_HEX, NULL, 0, "ListServices Reply: Capability Flags", HFILL }},
-      { &hf_enip_lsr_tcp, { "Supports CIP Encapsulation via TCP", "enip.lsr.capaflags.tcp", FT_BOOLEAN, 16, TFS(&tfs_true_false), 0x0020, "ListServices Reply: Supports CIP Encapsulation via TCP", HFILL }},
-      { &hf_enip_lsr_udp, { "Supports CIP Class 0 or 1 via UDP", "enip.lsr.capaflags.udp", FT_BOOLEAN, 16, TFS(&tfs_true_false), 0x0100, "ListServices Reply: Supports CIP Class 0 or 1 via UDP", HFILL }},
-      { &hf_enip_lsr_servicename, { "Name of Service", "enip.lsr.servicename", FT_STRING, BASE_NONE, NULL, 0, "ListServices Reply: Name of Service", HFILL }},
+      { &hf_enip_lsr_capaflags,
+        { "Capability Flags", "enip.lsr.capaflags",
+          FT_UINT16, BASE_HEX, NULL, 0,
+          "ListServices Reply: Capability Flags", HFILL }},
+
+      { &hf_enip_lsr_tcp,
+        { "Supports CIP Encapsulation via TCP", "enip.lsr.capaflags.tcp",
+          FT_BOOLEAN, 16, TFS(&tfs_true_false), 0x0020,
+          "ListServices Reply: Supports CIP Encapsulation via TCP", HFILL }},
+
+      { &hf_enip_lsr_udp,
+        { "Supports CIP Class 0 or 1 via UDP", "enip.lsr.capaflags.udp",
+          FT_BOOLEAN, 16, TFS(&tfs_true_false), 0x0100,
+          "ListServices Reply: Supports CIP Class 0 or 1 via UDP", HFILL }},
+
+      { &hf_enip_lsr_servicename,
+        { "Name of Service", "enip.lsr.servicename",
+          FT_STRING, BASE_NONE, NULL, 0,
+          "ListServices Reply: Name of Service", HFILL }},
+
       /* Register Session */
-      { &hf_enip_rs_version, { "Protocol Version", "enip.rs.version", FT_UINT16, BASE_DEC, NULL, 0, "Register Session: Protocol Version", HFILL }},
-      { &hf_enip_rs_optionflags, { "Option Flags", "enip.rs.flags", FT_UINT16, BASE_HEX, NULL, 0, "Register Session: Option Flags", HFILL }},
+      { &hf_enip_rs_version,
+        { "Protocol Version", "enip.rs.version",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          "Register Session: Protocol Version", HFILL }},
+
+      { &hf_enip_rs_optionflags,
+        { "Option Flags", "enip.rs.flags",
+          FT_UINT16, BASE_HEX, NULL, 0,
+          "Register Session: Option Flags", HFILL }},
+
       /* Send Request/Reply Data */
-      { &hf_enip_srrd_ifacehnd, { "Interface Handle", "enip.srrd.iface", FT_UINT32, BASE_HEX, VALS(enip_interface_handle_vals), 0, "SendRRData: Interface handle", HFILL }},
+      { &hf_enip_srrd_ifacehnd,
+        { "Interface Handle", "enip.srrd.iface",
+          FT_UINT32, BASE_HEX, VALS(enip_interface_handle_vals), 0,
+          "SendRRData: Interface handle", HFILL }},
+
       /* Send Unit Data */
-      { &hf_enip_sud_ifacehnd, { "Interface Handle", "enip.sud.iface", FT_UINT32, BASE_HEX, VALS(enip_interface_handle_vals), 0, "SendUnitData: Interface handle", HFILL }},
+      { &hf_enip_sud_ifacehnd,
+        { "Interface Handle", "enip.sud.iface",
+          FT_UINT32, BASE_HEX, VALS(enip_interface_handle_vals), 0,
+          "SendUnitData: Interface handle", HFILL }},
+
       /* List identity reply */
-      { &hf_enip_lir_vendor, { "Vendor ID", "enip.lir.vendor", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_vendor_vals_ext, 0, "ListIdentity Reply: Vendor ID", HFILL }},
-      { &hf_enip_lir_devtype, { "Device Type", "enip.lir.devtype", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &cip_devtype_vals_ext, 0, "ListIdentity Reply: Device Type", HFILL }},
-      { &hf_enip_lir_prodcode, { "Product Code", "enip.lir.prodcode", FT_UINT16, BASE_DEC, NULL, 0, "ListIdentity Reply: Product Code", HFILL }},
-      { &hf_enip_lir_revision, { "Revision", "enip.lir.revision", FT_UINT16, BASE_CUSTOM, enip_fmt_lir_revision, 0, "ListIdentity Reply: Revision", HFILL }},
-      { &hf_enip_lir_status, { "Status", "enip.lir.status", FT_UINT16, BASE_HEX, NULL, 0, "ListIdentity Reply: Status", HFILL }},
-      { &hf_enip_lir_serial, { "Serial Number", "enip.lir.serial", FT_UINT32, BASE_HEX, NULL, 0, "ListIdentity Reply: Serial Number", HFILL }},
-      { &hf_enip_lir_namelen, { "Product Name Length", "enip.lir.namelen", FT_UINT8, BASE_DEC, NULL, 0, "ListIdentity Reply: Product Name Length", HFILL }},
-      { &hf_enip_lir_name, { "Product Name", "enip.lir.name", FT_STRING, BASE_NONE, NULL, 0, "ListIdentity Reply: Product Name", HFILL }},
-      { &hf_enip_lir_state, { "State", "enip.lir.state", FT_UINT8, BASE_HEX, NULL, 0, "ListIdentity Reply: State", HFILL }},
+      { &hf_enip_lir_vendor,
+        { "Vendor ID", "enip.lir.vendor",
+          FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_vendor_vals_ext, 0,
+          "ListIdentity Reply: Vendor ID", HFILL }},
+
+      { &hf_enip_lir_devtype,
+        { "Device Type", "enip.lir.devtype",
+          FT_UINT16, BASE_DEC|BASE_EXT_STRING, &cip_devtype_vals_ext, 0,
+          "ListIdentity Reply: Device Type", HFILL }},
+
+      { &hf_enip_lir_prodcode,
+        { "Product Code", "enip.lir.prodcode",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          "ListIdentity Reply: Product Code", HFILL }},
+
+      { &hf_enip_lir_revision,
+        { "Revision", "enip.lir.revision",
+          FT_UINT16, BASE_CUSTOM, enip_fmt_lir_revision, 0,
+          "ListIdentity Reply: Revision", HFILL }},
+
+      { &hf_enip_lir_status,
+        { "Status", "enip.lir.status",
+          FT_UINT16, BASE_HEX, NULL, 0,
+          "ListIdentity Reply: Status", HFILL }},
+
+      { &hf_enip_lir_serial,
+        { "Serial Number", "enip.lir.serial",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          "ListIdentity Reply: Serial Number", HFILL }},
+
+      { &hf_enip_lir_namelen,
+        { "Product Name Length", "enip.lir.namelen",
+          FT_UINT8, BASE_DEC, NULL, 0,
+          "ListIdentity Reply: Product Name Length", HFILL }},
+
+      { &hf_enip_lir_name,
+        { "Product Name", "enip.lir.name",
+          FT_STRING, BASE_NONE, NULL, 0,
+          "ListIdentity Reply: Product Name", HFILL }},
+
+      { &hf_enip_lir_state,
+        { "State", "enip.lir.state",
+          FT_UINT8, BASE_HEX, NULL, 0,
+          "ListIdentity Reply: State", HFILL }},
+
       /* Common Packet Format */
-      { &hf_enip_cpf_itemcount, { "Item Count", "enip.cpf.itemcount", FT_UINT16, BASE_DEC, NULL, 0, "Common Packet Format: Item Count", HFILL }},
-      { &hf_enip_cpf_typeid, { "Type ID", "enip.cpf.typeid", FT_UINT16, BASE_HEX, VALS(cdf_type_vals), 0, "Common Packet Format: Type of encapsulated item", HFILL }},
-      { &hf_enip_cpf_length, { "Length", "enip.cpf.length", FT_UINT16, BASE_DEC, NULL, 0, "Common Packet Format: Length", HFILL }},
+      { &hf_enip_cpf_itemcount,
+        { "Item Count", "enip.cpf.itemcount",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          "Common Packet Format: Item Count", HFILL }},
+
+      { &hf_enip_cpf_typeid,
+        { "Type ID", "enip.cpf.typeid",
+          FT_UINT16, BASE_HEX, VALS(cdf_type_vals), 0,
+          "Common Packet Format: Type of encapsulated item", HFILL }},
+
+      { &hf_enip_cpf_length,
+        { "Length", "enip.cpf.length",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          "Common Packet Format: Length", HFILL }},
+
       /* Connected Data Item */
-      { &hf_enip_cpf_cdi_seqcnt, { "Sequence Count", "enip.cpf.cdi.seqcnt", FT_UINT16, BASE_HEX, NULL, 0, "Common Packet Format: Connected Data Item, Sequence Count", HFILL }},
-      { &hf_enip_cpf_cdi_32bitheader, { "32-bit Header", "enip.cpf.cdi.32bitheader", FT_UINT32, BASE_HEX, NULL, 0, "Common Packet Format: Connected Data Item, 32-bit Header", HFILL }},
-      { &hf_enip_cpf_cdi_32bitheader_roo, { "ROO", "enip.cpf.cdi.roo", FT_UINT32, BASE_HEX, NULL, 0xC, "Common Packet Format: Connected Data Item, Ready for Ownership of Outputs", HFILL }},
-      { &hf_enip_cpf_cdi_32bitheader_coo, { "COO", "enip.cpf.cdi.coo", FT_UINT32, BASE_HEX, NULL, 0x2, "Common Packet Format: Connected Data Item, Claim Output Ownership", HFILL }},
-      { &hf_enip_cpf_cdi_32bitheader_run_idle, { "Run/Idle", "enip.cpf.cdi.run_idle", FT_UINT32, BASE_HEX, VALS(enip_run_idle_vals), 0x1, "Common Packet Format: Connected Data Item, Run/Idle", HFILL }},
+      { &hf_enip_cpf_cdi_seqcnt,
+        { "Sequence Count", "enip.cpf.cdi.seqcnt",
+          FT_UINT16, BASE_HEX, NULL, 0,
+          "Common Packet Format: Connected Data Item, Sequence Count", HFILL }},
+
+      { &hf_enip_cpf_cdi_32bitheader,
+        { "32-bit Header", "enip.cpf.cdi.32bitheader",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          "Common Packet Format: Connected Data Item, 32-bit Header", HFILL }},
+
+      { &hf_enip_cpf_cdi_32bitheader_roo,
+        { "ROO", "enip.cpf.cdi.roo",
+          FT_UINT32, BASE_HEX, NULL, 0xC,
+          "Common Packet Format: Connected Data Item, Ready for Ownership of Outputs", HFILL }},
+
+      { &hf_enip_cpf_cdi_32bitheader_coo,
+        { "COO", "enip.cpf.cdi.coo",
+          FT_UINT32, BASE_HEX, NULL, 0x2,
+          "Common Packet Format: Connected Data Item, Claim Output Ownership", HFILL }},
+
+      { &hf_enip_cpf_cdi_32bitheader_run_idle,
+        { "Run/Idle", "enip.cpf.cdi.run_idle",
+          FT_UINT32, BASE_HEX, VALS(enip_run_idle_vals), 0x1,
+          "Common Packet Format: Connected Data Item, Run/Idle", HFILL }},
+
       /* Connection Address Item */
-      { &hf_enip_cpf_cai_connid, { "Connection ID", "enip.cpf.cai.connid", FT_UINT32, BASE_HEX, NULL, 0, "Common Packet Format: Connection Address Item, Connection Identifier", HFILL }},
+      { &hf_enip_cpf_cai_connid,
+        { "Connection ID", "enip.cpf.cai.connid",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          "Common Packet Format: Connection Address Item, Connection Identifier", HFILL }},
+
       /* Sequenced Address Type */
-      { &hf_enip_cpf_sai_connid, { "Connection ID", "enip.cpf.sai.connid", FT_UINT32, BASE_HEX, NULL, 0, "Common Packet Format: Sequenced Address Item, Connection Identifier", HFILL }},
-      { &hf_enip_cpf_sai_seqnum, { "Sequence Number", "enip.cpf.sai.seq", FT_UINT32, BASE_DEC, NULL, 0, "Common Packet Format: Sequenced Address Item, Sequence Number", HFILL }},
-      { &hf_enip_cpf_data, { "Data", "enip.cpf.data", FT_BYTES, BASE_NONE, NULL, 0, "Common Packet Format: Unknown Data", HFILL }},
+      { &hf_enip_cpf_sai_connid,
+        { "Connection ID", "enip.cpf.sai.connid",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          "Common Packet Format: Sequenced Address Item, Connection Identifier", HFILL }},
+
+      { &hf_enip_cpf_sai_seqnum,
+        { "Sequence Number", "enip.cpf.sai.seq",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          "Common Packet Format: Sequenced Address Item, Sequence Number", HFILL }},
+
+      { &hf_enip_cpf_data,
+        { "Data", "enip.cpf.data",
+          FT_BYTES, BASE_NONE, NULL, 0,
+          "Common Packet Format: Unknown Data", HFILL }},
+
       /* Request/Response Matching */
-      { &hf_enip_response_in, { "Response In", "enip.response_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "The response to this ENIP request is in this frame", HFILL }},
-      { &hf_enip_response_to, { "Request In", "enip.response_to", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This is a response to the ENIP request in this frame", HFILL }},
-      { &hf_enip_time, { "Time", "enip.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,"The time between the Call and the Reply", HFILL }},
-      { &hf_enip_connection_transport_data, { "Data", "enip.connection_transport_data", FT_BYTES, BASE_NONE, NULL, 0x0, "Connection Transport Data", HFILL }},
-
-      { &hf_tcpip_status, { "Status", "cip.tcpip.status", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_status_interface_config, { "Interface Configuration Status", "cip.tcpip.status.interface_config", FT_UINT32, BASE_DEC, enip_tcpip_status_interface_config_vals, 0x0000000F, NULL, HFILL }},
-      { &hf_tcpip_status_mcast_pending, { "MCast Pending", "cip.tcpip.status.mcast_pending", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000010, NULL, HFILL }},
-      { &hf_tcpip_status_interface_config_pending, { "Interface Configuration Pending", "cip.tcpip.status.interface_config_pending", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000020, NULL, HFILL }},
-      { &hf_tcpip_status_acd, { "ACD Status", "cip.tcpip.status.acd", FT_UINT32, BASE_DEC, enip_tcpip_status_acd_vals, 0x00000040, NULL, HFILL }},
-      { &hf_tcpip_status_reserved, { "Reserved", "cip.tcpip.status.reserved", FT_UINT32, BASE_HEX, NULL, 0xFFFFFF80, NULL, HFILL }},
-      { &hf_tcpip_config_cap, { "Configuration Capability", "cip.tcpip.config_cap", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_config_cap_bootp, { "BOOTP Client", "cip.tcpip.config_cap.bootp", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000001, NULL, HFILL }},
-      { &hf_tcpip_config_cap_dns, { "DNS Client", "cip.tcpip.config_cap.dns", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000002, NULL, HFILL }},
-      { &hf_tcpip_config_cap_dhcp, { "DHCP Client", "cip.tcpip.config_cap.dhcp", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000004, NULL, HFILL }},
-      { &hf_tcpip_config_cap_dhcp_dns_update, { "DHCP-DNS Update", "cip.tcpip.config_cap.dhcp_dns_update", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000008, NULL, HFILL }},
-      { &hf_tcpip_config_cap_config_settable, { "Configuration Settable", "cip.tcpip.config_cap.config_settable", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000010, NULL, HFILL }},
-      { &hf_tcpip_config_cap_hardware_config, { "Hardware Configurable", "cip.tcpip.config_cap.hardware_config", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000020, NULL, HFILL }},
-      { &hf_tcpip_config_cap_interface_reset, { "Interface Configuration Change Requires Reset", "cip.tcpip.config_cap.interface_reset", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000040, NULL, HFILL }},
-      { &hf_tcpip_config_cap_acd, { "ACD Capable", "cip.tcpip.config_cap.acd", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000080, NULL, HFILL }},
-      { &hf_tcpip_config_cap_reserved, { "Reserved", "cip.tcpip.config_cap.reserved", FT_UINT32, BASE_HEX, NULL, 0xFFFFFF00, NULL, HFILL }},
-      { &hf_tcpip_config_control, { "Configuration Control", "cip.tcpip.config_control", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_config_control_config, { "Configuration Method", "cip.tcpip.config_control.config", FT_UINT32, BASE_DEC, enip_tcpip_config_control_config_vals, 0x0000000F, NULL, HFILL }},
-      { &hf_tcpip_config_control_dns, { "DNS Enable", "cip.tcpip.config_control.dns", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000010, NULL, HFILL }},
-      { &hf_tcpip_config_control_reserved, { "Reserved", "cip.tcpip.config_control.reserved", FT_UINT32, BASE_HEX, NULL, 0xFFFFFFE0, NULL, HFILL }},
-      { &hf_tcpip_physical_link_size, { "Size", "cip.tcpip.physical_link_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_ic_ip_addr, { "IP Address", "cip.tcpip.ip_addr", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_ic_subnet_mask, { "Subnet Mask", "cip.tcpip.subnet_mask", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_ic_gateway, { "Gateway", "cip.tcpip.gateway", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_ic_name_server, { "Name Server", "cip.tcpip.name_server", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_ic_name_server2, { "Name Server2", "cip.tcpip.name_server2", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_ic_domain_name, { "Domain Name", "cip.tcpip.domain_name", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_hostname, { "Hostname", "cip.tcpip.hostname", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_ttl_value, { "TTL Value", "cip.tcpip.ttl_value", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_mcast_alloc, { "Alloc Control", "cip.tcpip.mcast.alloc", FT_UINT8, BASE_DEC, enip_tcpip_mcast_alloc_vals, 0, NULL, HFILL }},
-      { &hf_tcpip_mcast_reserved, { "Reserved", "cip.tcpip.mcast.reserved", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_mcast_num_mcast, { "Num MCast", "cip.tcpip.mcast.num_mcast", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_mcast_addr_start, { "MCast Start Addr", "cip.tcpip.mcast.addr_start", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_select_acd, { "Select ACD", "cip.tcpip.select_acd", FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0, NULL, HFILL }},
-      { &hf_tcpip_lcd_acd_activity, { "ACD Activity", "cip.tcpip.last_conflict.acd_activity", FT_UINT8, BASE_DEC, enip_tcpip_acd_activity_vals, 0, NULL, HFILL }},
-      { &hf_tcpip_lcd_remote_mac, { "RemoteMAC", "cip.tcpip.last_conflict.remote_mac", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_lcd_arp_pdu, { "Arp PDU", "cip.tcpip.last_conflict.arp_pdu", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_tcpip_quick_connect, { "Ethernet/IP Quick Connection", "cip.tcpip.quick_connect", FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x1, NULL, HFILL }},
-
-      { &hf_elink_interface_speed, { "Interface Speed", "cip.elink.interface_speed", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_interface_flags, { "Interface Flags", "cip.elink.iflags", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
-      { &hf_elink_iflags_link_status, { "Link Status", "cip.elink.iflags.link_status", FT_BOOLEAN, 32, TFS(&tfs_active_inactive), 0x00000001, NULL, HFILL }},
-      { &hf_elink_iflags_duplex, { "Duplex", "cip.elink.iflags.duplex", FT_UINT32, BASE_DEC, enip_elink_duplex_vals, 0x00000002, NULL, HFILL }},
-      { &hf_elink_iflags_neg_status, { "Negotiation Status", "cip.elink.iflags.neg_status", FT_UINT32, BASE_DEC, enip_elink_iflags_neg_status_vals, 0x0000001C, NULL, HFILL }},
-      { &hf_elink_iflags_manual_reset, { "Manual Reset Required", "cip.elink.iflags.manual_reset", FT_UINT32, BASE_DEC, enip_elink_iflags_reset_vals, 0x00000020, NULL, HFILL }},
-      { &hf_elink_iflags_local_hw_fault, { "Local Hardware Fault", "cip.elink.iflags.local_hw_fault", FT_UINT32, BASE_DEC, enip_elink_iflags_hw_fault_vals, 0x00000040, NULL, HFILL }},
-      { &hf_elink_iflags_reserved, { "Reserved", "cip.elink.iflags.reserved", FT_UINT32, BASE_HEX, NULL, 0xFFFFFF80, NULL, HFILL }},
-      { &hf_elink_physical_address, { "Physical Addresss", "cip.elink.physical_address", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_in_octets, { "In Octets", "cip.elink.icount.in_octets", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_in_ucast, { "In Ucast Packets", "cip.elink.icount.in_ucast", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_in_nucast, { "In NUcast Packets", "cip.elink.icount.in_nucast", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_in_discards, { "In Discards", "cip.elink.icount.in_discards", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_in_errors, { "In Errors", "cip.elink.icount.in_errors", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_in_unknown_protos, { "In Unknown Protos", "cip.elink.icount.in_unknown_protos", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_out_octets, { "Out Octets", "cip.elink.icount.out_octets", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_out_ucast, { "Out Ucast Packets", "cip.elink.icount.out_ucast", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_out_nucast, { "Out NUcast Packets", "cip.elink.icount.out_nucast", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_out_discards, { "Out Discards", "cip.elink.icount.out_discards", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icount_out_errors, { "Out Errors", "cip.elink.icount.out_errors", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_alignment_errors, { "Alignment Errors", "cip.elink.mcount.alignment_errors", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_fcs_errors, { "FCS Errors", "cip.elink.mcount.fcs_errors", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_single_collisions, { "Single Collisions", "cip.elink.mcount.single_collisions", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_multiple_collisions, { "Multiple Collisions", "cip.elink.mcount.multiple_collisions", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_sqe_test_errors, { "SQE Test Errors", "cip.elink.mcount.sqe_test_errors", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_deferred_transmission, { "Deferred Transmission", "cip.elink.mcount.deferred_transmission", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_late_collisions, { "Late Collisions", "cip.elink.mcount.late_collisions", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_excessive_collisions, { "Excessive Collisions", "cip.elink.mcount.excessive_collisions", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_mac_transmit_errors, { "MAC Transmit Errors", "cip.elink.mcount.mac_transmit_errors", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_carrier_sense_errors, { "Carrier Sense Errors", "cip.elink.mcount.carrier_sense_errors", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_frame_too_long, { "Frame Too Long", "cip.elink.mcount.frame_too_long", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_mcount_mac_receive_errors, { "MAC Receive Errors", "cip.elink.mcount.mac_receive_errors", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icontrol_control_bits, { "Control Bits", "cip.elink.icontrol.control_bits", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
-      { &hf_elink_icontrol_control_bits_auto_neg, { "Auto-negotiate", "cip.elink.icontrol.control_bits.auto_neg", FT_BOOLEAN, 16, TFS(&tfs_enabled_disabled), 0x0001, NULL, HFILL }},
-      { &hf_elink_icontrol_control_bits_forced_duplex, { "Forced Duplex Mode", "cip.elink.icontrol.control_bits.forced_duplex", FT_UINT16, BASE_DEC, enip_elink_duplex_vals, 0x0002, NULL, HFILL }},
-      { &hf_elink_icontrol_control_bits_reserved, { "Reserved", "cip.elink.icontrol.control_bits.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFFC, NULL, HFILL }},
-      { &hf_elink_icontrol_forced_speed, { "Forced Interface Speed", "cip.elink.icontrol.forced_speed", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_elink_interface_type, { "Interface Type", "cip.elink.interface_type", FT_UINT8, BASE_DEC, enip_elink_interface_type_vals, 0, NULL, HFILL }},
-      { &hf_elink_interface_state, { "Interface State", "cip.elink.interface_state", FT_UINT8, BASE_DEC, enip_elink_interface_state_vals, 0, NULL, HFILL }},
-      { &hf_elink_admin_state, { "Admin State", "cip.elink.admin_state", FT_UINT8, BASE_DEC, enip_elink_admin_state_vals, 0, NULL, HFILL }},
-      { &hf_elink_interface_label, { "Interface Label", "cip.elink.interface_label", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
-
-      { &hf_qos_8021q_enable, { "802.1Q Tag Enable", "cip.qos.8021q_enable", FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x1, NULL, HFILL }},
-      { &hf_qos_dscp_ptp_event, { "DSCP PTP Event", "cip.qos.ptp_event", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_qos_dscp_ptp_general, { "DSCP PTP General", "cip.qos.ptp_general", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_qos_dscp_urgent, { "DSCP Urgent", "cip.qos.urgent", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_qos_dscp_scheduled, { "DSCP Scheduled", "cip.qos.scheduled", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_qos_dscp_high, { "DSCP High", "cip.qos.high", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_qos_dscp_low, { "DSCP Low", "cip.qos.low", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
-      { &hf_qos_dscp_explicit, { "DSCP Explicit", "cip.qos.explicit", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}
+      { &hf_enip_response_in,
+        { "Response In", "enip.response_in",
+          FT_FRAMENUM, BASE_NONE, NULL, 0x0,
+          "The response to this ENIP request is in this frame", HFILL }},
+
+      { &hf_enip_response_to,
+        { "Request In", "enip.response_to",
+          FT_FRAMENUM, BASE_NONE, NULL, 0x0,
+          "This is a response to the ENIP request in this frame", HFILL }},
+
+      { &hf_enip_time,
+        { "Time", "enip.time",
+          FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
+          "The time between the Call and the Reply", HFILL }},
+
+      { &hf_enip_connection_transport_data,
+        { "Data", "enip.connection_transport_data",
+          FT_BYTES, BASE_NONE, NULL, 0x0,
+          "Connection Transport Data", HFILL }},
+
+      { &hf_tcpip_status,
+        { "Status", "cip.tcpip.status",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_status_interface_config,
+        { "Interface Configuration Status", "cip.tcpip.status.interface_config",
+          FT_UINT32, BASE_DEC, enip_tcpip_status_interface_config_vals, 0x0000000F,
+          NULL, HFILL }},
+
+      { &hf_tcpip_status_mcast_pending,
+        { "MCast Pending", "cip.tcpip.status.mcast_pending",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000010,
+          NULL, HFILL }},
+
+      { &hf_tcpip_status_interface_config_pending,
+        { "Interface Configuration Pending", "cip.tcpip.status.interface_config_pending",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000020,
+          NULL, HFILL }},
+
+      { &hf_tcpip_status_acd,
+        { "ACD Status", "cip.tcpip.status.acd",
+          FT_UINT32, BASE_DEC, enip_tcpip_status_acd_vals, 0x00000040,
+          NULL, HFILL }},
+
+      { &hf_tcpip_status_reserved,
+        { "Reserved", "cip.tcpip.status.reserved",
+          FT_UINT32, BASE_HEX, NULL, 0xFFFFFF80,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap,
+        { "Configuration Capability", "cip.tcpip.config_cap",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap_bootp,
+        { "BOOTP Client", "cip.tcpip.config_cap.bootp",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000001,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap_dns,
+        { "DNS Client", "cip.tcpip.config_cap.dns",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000002,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap_dhcp,
+        { "DHCP Client", "cip.tcpip.config_cap.dhcp",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000004,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap_dhcp_dns_update,
+        { "DHCP-DNS Update", "cip.tcpip.config_cap.dhcp_dns_update",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000008,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap_config_settable,
+        { "Configuration Settable", "cip.tcpip.config_cap.config_settable",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000010,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap_hardware_config,
+        { "Hardware Configurable", "cip.tcpip.config_cap.hardware_config",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000020,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap_interface_reset,
+        { "Interface Configuration Change Requires Reset", "cip.tcpip.config_cap.interface_reset",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000040,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap_acd,
+        { "ACD Capable", "cip.tcpip.config_cap.acd",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000080,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_cap_reserved,
+        { "Reserved", "cip.tcpip.config_cap.reserved",
+          FT_UINT32, BASE_HEX, NULL, 0xFFFFFF00,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_control,
+        { "Configuration Control", "cip.tcpip.config_control",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_control_config,
+        { "Configuration Method", "cip.tcpip.config_control.config",
+          FT_UINT32, BASE_DEC, enip_tcpip_config_control_config_vals, 0x0000000F,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_control_dns,
+        { "DNS Enable", "cip.tcpip.config_control.dns",
+          FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00000010,
+          NULL, HFILL }},
+
+      { &hf_tcpip_config_control_reserved,
+        { "Reserved", "cip.tcpip.config_control.reserved",
+          FT_UINT32, BASE_HEX, NULL, 0xFFFFFFE0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_physical_link_size,
+        { "Size", "cip.tcpip.physical_link_size",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_ic_ip_addr,
+        { "IP Address", "cip.tcpip.ip_addr",
+          FT_IPv4, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_ic_subnet_mask,
+        { "Subnet Mask", "cip.tcpip.subnet_mask",
+          FT_IPv4, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_ic_gateway,
+        { "Gateway", "cip.tcpip.gateway",
+          FT_IPv4, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_ic_name_server,
+        { "Name Server", "cip.tcpip.name_server",
+          FT_IPv4, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_ic_name_server2,
+        { "Name Server2", "cip.tcpip.name_server2",
+          FT_IPv4, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_ic_domain_name,
+        { "Domain Name", "cip.tcpip.domain_name",
+          FT_STRING, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_hostname,
+        { "Hostname", "cip.tcpip.hostname",
+          FT_STRING, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_ttl_value,
+        { "TTL Value", "cip.tcpip.ttl_value",
+          FT_UINT8, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_mcast_alloc,
+        { "Alloc Control", "cip.tcpip.mcast.alloc",
+          FT_UINT8, BASE_DEC, enip_tcpip_mcast_alloc_vals, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_mcast_reserved,
+        { "Reserved", "cip.tcpip.mcast.reserved",
+          FT_UINT8, BASE_HEX, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_mcast_num_mcast,
+        { "Num MCast", "cip.tcpip.mcast.num_mcast",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_mcast_addr_start,
+        { "MCast Start Addr", "cip.tcpip.mcast.addr_start",
+          FT_IPv4, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_select_acd,
+        { "Select ACD", "cip.tcpip.select_acd",
+          FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_lcd_acd_activity,
+        { "ACD Activity", "cip.tcpip.last_conflict.acd_activity",
+          FT_UINT8, BASE_DEC, enip_tcpip_acd_activity_vals, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_lcd_remote_mac,
+        { "RemoteMAC", "cip.tcpip.last_conflict.remote_mac",
+          FT_ETHER, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_lcd_arp_pdu,
+        { "Arp PDU", "cip.tcpip.last_conflict.arp_pdu",
+          FT_BYTES, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_tcpip_quick_connect,
+        { "Ethernet/IP Quick Connection", "cip.tcpip.quick_connect",
+          FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x1,
+          NULL, HFILL }},
+
+
+      { &hf_elink_interface_speed,
+        { "Interface Speed", "cip.elink.interface_speed",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_interface_flags,
+        { "Interface Flags", "cip.elink.iflags",
+          FT_UINT32, BASE_HEX, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_iflags_link_status,
+        { "Link Status", "cip.elink.iflags.link_status",
+          FT_BOOLEAN, 32, TFS(&tfs_active_inactive), 0x00000001,
+          NULL, HFILL }},
+
+      { &hf_elink_iflags_duplex,
+        { "Duplex", "cip.elink.iflags.duplex",
+          FT_UINT32, BASE_DEC, enip_elink_duplex_vals, 0x00000002,
+          NULL, HFILL }},
+
+      { &hf_elink_iflags_neg_status,
+        { "Negotiation Status", "cip.elink.iflags.neg_status",
+          FT_UINT32, BASE_DEC, enip_elink_iflags_neg_status_vals, 0x0000001C,
+          NULL, HFILL }},
+
+      { &hf_elink_iflags_manual_reset,
+        { "Manual Reset Required", "cip.elink.iflags.manual_reset",
+          FT_UINT32, BASE_DEC, enip_elink_iflags_reset_vals, 0x00000020,
+          NULL, HFILL }},
+
+      { &hf_elink_iflags_local_hw_fault,
+        { "Local Hardware Fault", "cip.elink.iflags.local_hw_fault",
+          FT_UINT32, BASE_DEC, enip_elink_iflags_hw_fault_vals, 0x00000040,
+          NULL, HFILL }},
+
+      { &hf_elink_iflags_reserved,
+        { "Reserved", "cip.elink.iflags.reserved",
+          FT_UINT32, BASE_HEX, NULL, 0xFFFFFF80,
+          NULL, HFILL }},
+
+      { &hf_elink_physical_address,
+        { "Physical Addresss", "cip.elink.physical_address",
+          FT_ETHER, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_in_octets,
+        { "In Octets", "cip.elink.icount.in_octets",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_in_ucast,
+        { "In Ucast Packets", "cip.elink.icount.in_ucast",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_in_nucast,
+        { "In NUcast Packets", "cip.elink.icount.in_nucast",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_in_discards,
+        { "In Discards", "cip.elink.icount.in_discards",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_in_errors,
+        { "In Errors", "cip.elink.icount.in_errors",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_in_unknown_protos,
+        { "In Unknown Protos", "cip.elink.icount.in_unknown_protos",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_out_octets,
+        { "Out Octets", "cip.elink.icount.out_octets",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_out_ucast,
+        { "Out Ucast Packets", "cip.elink.icount.out_ucast",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_out_nucast,
+        { "Out NUcast Packets", "cip.elink.icount.out_nucast",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_out_discards,
+        { "Out Discards", "cip.elink.icount.out_discards",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icount_out_errors,
+        { "Out Errors", "cip.elink.icount.out_errors",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_alignment_errors,
+        { "Alignment Errors", "cip.elink.mcount.alignment_errors",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_fcs_errors,
+        { "FCS Errors", "cip.elink.mcount.fcs_errors",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_single_collisions,
+        { "Single Collisions", "cip.elink.mcount.single_collisions",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_multiple_collisions,
+        { "Multiple Collisions", "cip.elink.mcount.multiple_collisions",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_sqe_test_errors,
+        { "SQE Test Errors", "cip.elink.mcount.sqe_test_errors",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_deferred_transmission,
+        { "Deferred Transmission", "cip.elink.mcount.deferred_transmission",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_late_collisions,
+        { "Late Collisions", "cip.elink.mcount.late_collisions",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_excessive_collisions,
+        { "Excessive Collisions", "cip.elink.mcount.excessive_collisions",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_mac_transmit_errors,
+        { "MAC Transmit Errors", "cip.elink.mcount.mac_transmit_errors",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_carrier_sense_errors,
+        { "Carrier Sense Errors", "cip.elink.mcount.carrier_sense_errors",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_frame_too_long,
+        { "Frame Too Long", "cip.elink.mcount.frame_too_long",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_mcount_mac_receive_errors,
+        { "MAC Receive Errors", "cip.elink.mcount.mac_receive_errors",
+          FT_UINT32, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icontrol_control_bits,
+        { "Control Bits", "cip.elink.icontrol.control_bits",
+          FT_UINT16, BASE_HEX, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_icontrol_control_bits_auto_neg,
+        { "Auto-negotiate", "cip.elink.icontrol.control_bits.auto_neg",
+          FT_BOOLEAN, 16, TFS(&tfs_enabled_disabled), 0x0001,
+          NULL, HFILL }},
+
+      { &hf_elink_icontrol_control_bits_forced_duplex,
+        { "Forced Duplex Mode", "cip.elink.icontrol.control_bits.forced_duplex",
+          FT_UINT16, BASE_DEC, enip_elink_duplex_vals, 0x0002,
+          NULL, HFILL }},
+
+      { &hf_elink_icontrol_control_bits_reserved,
+        { "Reserved", "cip.elink.icontrol.control_bits.reserved",
+          FT_UINT16, BASE_HEX, NULL, 0xFFFC,
+          NULL, HFILL }},
+
+      { &hf_elink_icontrol_forced_speed,
+        { "Forced Interface Speed", "cip.elink.icontrol.forced_speed",
+          FT_UINT16, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_interface_type,
+        { "Interface Type", "cip.elink.interface_type",
+          FT_UINT8, BASE_DEC, enip_elink_interface_type_vals, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_interface_state,
+        { "Interface State", "cip.elink.interface_state",
+          FT_UINT8, BASE_DEC, enip_elink_interface_state_vals, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_admin_state,
+        { "Admin State", "cip.elink.admin_state",
+          FT_UINT8, BASE_DEC, enip_elink_admin_state_vals, 0,
+          NULL, HFILL }},
+
+      { &hf_elink_interface_label,
+        { "Interface Label", "cip.elink.interface_label",
+          FT_STRING, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
+
+
+      { &hf_qos_8021q_enable,
+        { "802.1Q Tag Enable", "cip.qos.8021q_enable",
+          FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x1,
+          NULL, HFILL }},
+
+      { &hf_qos_dscp_ptp_event,
+        { "DSCP PTP Event", "cip.qos.ptp_event",
+          FT_UINT8, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_qos_dscp_ptp_general,
+        { "DSCP PTP General", "cip.qos.ptp_general",
+          FT_UINT8, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_qos_dscp_urgent,
+        { "DSCP Urgent", "cip.qos.urgent",
+          FT_UINT8, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_qos_dscp_scheduled,
+        { "DSCP Scheduled", "cip.qos.scheduled",
+          FT_UINT8, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_qos_dscp_high,
+        { "DSCP High", "cip.qos.high",
+          FT_UINT8, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_qos_dscp_low,
+        { "DSCP Low", "cip.qos.low",
+          FT_UINT8, BASE_DEC, NULL, 0,
+          NULL, HFILL }},
+
+      { &hf_qos_dscp_explicit,
+        { "DSCP Explicit", "cip.qos.explicit",
+          FT_UINT8, BASE_DEC, NULL, 0,
+          NULL, HFILL }}
 
    };
 
@@ -2414,10 +2944,6 @@ proto_register_enip(void)
 } /* end of proto_register_enip() */
 
 
-/* If this dissector uses sub-dissector registration add a registration routine.
-   This format is required because a script is used to find these routines and
-   create the code that calls these routines.
-*/
 void
 proto_reg_handoff_enip(void)
 {
index 73bb83253dcc3569c78d99e078e98297f1368d13..32b1235189d1b14fd25fd8b7fe1f622c72363cd0 100644 (file)
@@ -66,206 +66,206 @@ static dissector_handle_t edp_handle = NULL;
 #define EPMD_PORT 4369
 
 /* Definitions of message codes */
-#define EPMD_ALIVE_REQ    'a'
+#define EPMD_ALIVE_REQ     'a'
 #define EPMD_ALIVE_OK_RESP 'Y'
-#define EPMD_PORT_REQ     'p'
-#define EPMD_NAMES_REQ    'n'
-#define EPMD_DUMP_REQ     'd'
-#define EPMD_KILL_REQ     'k'
-#define EPMD_STOP_REQ     's'
+#define EPMD_PORT_REQ      'p'
+#define EPMD_NAMES_REQ     'n'
+#define EPMD_DUMP_REQ      'd'
+#define EPMD_KILL_REQ      'k'
+#define EPMD_STOP_REQ      's'
 /* New epmd messages */
-#define EPMD_ALIVE2_REQ   'x' /* 120 */
-#define EPMD_PORT2_REQ    'z' /* 122 */
-#define EPMD_ALIVE2_RESP  'y' /* 121 */
-#define EPMD_PORT2_RESP   'w' /* 119 */
+#define EPMD_ALIVE2_REQ    'x' /* 120 */
+#define EPMD_PORT2_REQ     'z' /* 122 */
+#define EPMD_ALIVE2_RESP   'y' /* 121 */
+#define EPMD_PORT2_RESP    'w' /* 119 */
 
 static const value_string message_types[] = {
-  { EPMD_ALIVE_REQ    , "EPMD_ALIVE_REQ" },
-  { EPMD_ALIVE_OK_RESP, "EPMD_ALIVE_OK_RESP" },
-  { EPMD_PORT_REQ     , "EPMD_PORT_REQ" },
-  { EPMD_NAMES_REQ    , "EPMD_NAMES_REQ" },
-  { EPMD_DUMP_REQ     , "EPMD_DUMP_REQ" },
-  { EPMD_KILL_REQ     , "EPMD_KILL_REQ" },
-  { EPMD_STOP_REQ     , "EPMD_STOP_REQ" },
-  { EPMD_ALIVE2_REQ   , "EPMD_ALIVE2_REQ" },
-  { EPMD_PORT2_REQ    , "EPMD_PORT2_REQ" },
-  { EPMD_ALIVE2_RESP  , "EPMD_ALIVE2_RESP" },
-  { EPMD_PORT2_RESP   , "EPMD_PORT2_RESP" },
-  {  0, NULL }
+    { EPMD_ALIVE_REQ    , "EPMD_ALIVE_REQ"     },
+    { EPMD_ALIVE_OK_RESP, "EPMD_ALIVE_OK_RESP" },
+    { EPMD_PORT_REQ     , "EPMD_PORT_REQ"      },
+    { EPMD_NAMES_REQ    , "EPMD_NAMES_REQ"     },
+    { EPMD_DUMP_REQ     , "EPMD_DUMP_REQ"      },
+    { EPMD_KILL_REQ     , "EPMD_KILL_REQ"      },
+    { EPMD_STOP_REQ     , "EPMD_STOP_REQ"      },
+    { EPMD_ALIVE2_REQ   , "EPMD_ALIVE2_REQ"    },
+    { EPMD_PORT2_REQ    , "EPMD_PORT2_REQ"     },
+    { EPMD_ALIVE2_RESP  , "EPMD_ALIVE2_RESP"   },
+    { EPMD_PORT2_RESP   , "EPMD_PORT2_RESP"    },
+    {  0, NULL }
 };
 
 static const value_string node_type_vals[] = {
-  {  72 , "R3 hidden node" },
-  {  77 , "R3 erlang node" },
-  { 104 , "R4 hidden node" },
-  { 109 , "R4 erlang node" },
-  { 110 , "R6 nodes" },
-  {  0, NULL }
+    {  72 , "R3 hidden node" },
+    {  77 , "R3 erlang node" },
+    { 104 , "R4 hidden node" },
+    { 109 , "R4 erlang node" },
+    { 110 , "R6 nodes" },
+    {  0, NULL }
 };
 
 static const value_string protocol_vals[] = {
-  {  0 , "tcp/ip-v4" },
-  {  0, NULL }
+    {  0 , "tcp/ip-v4" },
+    {  0, NULL }
 };
 
 const value_string epmd_version_vals[] = {
-  {  0 , "R3" },
-  {  1 , "R4" },
-  {  2 , "R5" },
-  {  3 , "R5C" },
-  {  4 , "R6 dev" },
-  {  5 , "R6" },
-  {  0, NULL }
+    {  0 , "R3"     },
+    {  1 , "R4"     },
+    {  2 , "R5"     },
+    {  3 , "R5C"    },
+    {  4 , "R6 dev" },
+    {  5 , "R6"     },
+    {  0, NULL }
 };
 
 static void
 dissect_epmd_request(packet_info *pinfo, tvbuff_t *tvb, gint offset, proto_tree *tree) {
-  guint8 type;
-  guint16 name_length = 0;
-  const gchar *name = NULL;
-
-  proto_tree_add_item(tree, hf_epmd_len, tvb, offset, 2, ENC_BIG_ENDIAN);
-  offset += 2;
-  type = tvb_get_guint8(tvb, offset);
-  proto_tree_add_item(tree, hf_epmd_type, tvb, offset, 1, ENC_BIG_ENDIAN);
-  offset++;
-  col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, VALS(message_types), "unknown (0x%02X)"));
-
-  switch (type) {
-    case EPMD_ALIVE2_REQ:
-      proto_tree_add_item(tree, hf_epmd_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
-      offset += 2;
-      proto_tree_add_item(tree, hf_epmd_node_type, tvb, offset, 1, ENC_BIG_ENDIAN);
-      offset++;
-      proto_tree_add_item(tree, hf_epmd_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
-      offset++;
-      proto_tree_add_item(tree, hf_epmd_dist_high, tvb, offset, 2, ENC_BIG_ENDIAN);
-      offset += 2;
-      proto_tree_add_item(tree, hf_epmd_dist_low, tvb, offset, 2, ENC_BIG_ENDIAN);
-      offset += 2;
-      name_length = tvb_get_ntohs(tvb, offset);
-      proto_tree_add_item(tree, hf_epmd_name_len, tvb, offset, 2, ENC_BIG_ENDIAN);
-      proto_tree_add_item(tree, hf_epmd_name, tvb, offset + 2, name_length, ENC_ASCII|ENC_NA);
-      name = tvb_get_ephemeral_string(tvb, offset + 2, name_length);
-      offset += 2 + name_length;
-      if (tvb_length_remaining(tvb, offset) >= 2) {
-        guint16 elen=0;
-        elen = tvb_get_ntohs(tvb, offset);
-        proto_tree_add_item(tree, hf_epmd_elen, tvb, offset, 2, ENC_BIG_ENDIAN);
-        if (elen > 0)
-          proto_tree_add_item(tree, hf_epmd_edata, tvb, offset + 2, elen, ENC_NA);
-        offset += 2 + elen;
-      }
-      break;
-
-    case EPMD_PORT_REQ:
-    case EPMD_PORT2_REQ:
-      name_length = tvb_length_remaining(tvb, offset);
-      proto_tree_add_item(tree, hf_epmd_name, tvb, offset, name_length, ENC_ASCII|ENC_NA);
-      name = tvb_get_ephemeral_string(tvb, offset, name_length);
-      break;
-
-    case EPMD_ALIVE_REQ:
-      proto_tree_add_item(tree, hf_epmd_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
-      offset += 2;
-      name_length = tvb_length_remaining(tvb, offset);
-      proto_tree_add_item(tree, hf_epmd_name, tvb, offset, name_length, ENC_ASCII|ENC_NA);
-      name = tvb_get_ephemeral_string(tvb, offset, name_length);
-      break;
-
-    case EPMD_NAMES_REQ:
-      break;
-
-  }
-
-  if (name) {
-    col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name);
-  }
+    guint8       type;
+    guint16      name_length = 0;
+    const gchar *name        = NULL;
+
+    proto_tree_add_item(tree, hf_epmd_len, tvb, offset, 2, ENC_BIG_ENDIAN);
+    offset += 2;
+    type = tvb_get_guint8(tvb, offset);
+    proto_tree_add_item(tree, hf_epmd_type, tvb, offset, 1, ENC_BIG_ENDIAN);
+    offset++;
+    col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, VALS(message_types), "unknown (0x%02X)"));
+
+    switch (type) {
+        case EPMD_ALIVE2_REQ:
+            proto_tree_add_item(tree, hf_epmd_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
+            offset += 2;
+            proto_tree_add_item(tree, hf_epmd_node_type, tvb, offset, 1, ENC_BIG_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_epmd_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_epmd_dist_high, tvb, offset, 2, ENC_BIG_ENDIAN);
+            offset += 2;
+            proto_tree_add_item(tree, hf_epmd_dist_low, tvb, offset, 2, ENC_BIG_ENDIAN);
+            offset += 2;
+            name_length = tvb_get_ntohs(tvb, offset);
+            proto_tree_add_item(tree, hf_epmd_name_len, tvb, offset, 2, ENC_BIG_ENDIAN);
+            proto_tree_add_item(tree, hf_epmd_name, tvb, offset + 2, name_length, ENC_ASCII|ENC_NA);
+            name = tvb_get_ephemeral_string(tvb, offset + 2, name_length);
+            offset += 2 + name_length;
+            if (tvb_length_remaining(tvb, offset) >= 2) {
+                guint16 elen=0;
+                elen = tvb_get_ntohs(tvb, offset);
+                proto_tree_add_item(tree, hf_epmd_elen, tvb, offset, 2, ENC_BIG_ENDIAN);
+                if (elen > 0)
+                    proto_tree_add_item(tree, hf_epmd_edata, tvb, offset + 2, elen, ENC_NA);
+                offset += 2 + elen;
+            }
+            break;
+
+        case EPMD_PORT_REQ:
+        case EPMD_PORT2_REQ:
+            name_length = tvb_length_remaining(tvb, offset);
+            proto_tree_add_item(tree, hf_epmd_name, tvb, offset, name_length, ENC_ASCII|ENC_NA);
+            name = tvb_get_ephemeral_string(tvb, offset, name_length);
+            break;
+
+        case EPMD_ALIVE_REQ:
+            proto_tree_add_item(tree, hf_epmd_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
+            offset += 2;
+            name_length = tvb_length_remaining(tvb, offset);
+            proto_tree_add_item(tree, hf_epmd_name, tvb, offset, name_length, ENC_ASCII|ENC_NA);
+            name = tvb_get_ephemeral_string(tvb, offset, name_length);
+            break;
+
+        case EPMD_NAMES_REQ:
+            break;
+
+    }
+
+    if (name) {
+        col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name);
+    }
 
 }
 
 static void
 dissect_epmd_response_names(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset, proto_tree *tree) {
-  proto_tree_add_item(tree, hf_epmd_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
-  offset += 2;
-  proto_tree_add_item(tree, hf_epmd_names, tvb, offset, -1, ENC_NA);
+    proto_tree_add_item(tree, hf_epmd_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
+    offset += 2;
+    proto_tree_add_item(tree, hf_epmd_names, tvb, offset, -1, ENC_NA);
 }
 
 static void
 dissect_epmd_response(packet_info *pinfo, tvbuff_t *tvb, gint offset, proto_tree *tree) {
-  guint8 type, result;
-  guint32 port;
-  guint16 name_length = 0;
-  const gchar *name = NULL;
-  conversation_t *conv = NULL;
-
-  port = tvb_get_ntohl(tvb, offset);
-  if (port == EPMD_PORT) {
-    dissect_epmd_response_names(pinfo, tvb, offset, tree);
-    return;
-  }
-
-  type = tvb_get_guint8(tvb, offset);
-  proto_tree_add_item(tree, hf_epmd_type, tvb, offset, 1, ENC_BIG_ENDIAN);
-  offset++;
-  col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, VALS(message_types), "unknown (0x%02X)"));
-
-  switch (type) {
-    case EPMD_ALIVE_OK_RESP:
-    case EPMD_ALIVE2_RESP:
-      result = tvb_get_guint8(tvb, offset);
-      proto_tree_add_item(tree, hf_epmd_result, tvb, offset, 1, ENC_BIG_ENDIAN);
-      offset++;
-      proto_tree_add_item(tree, hf_epmd_creation, tvb, offset, 2, ENC_BIG_ENDIAN);
-      offset += 2;
-      if (!result) {
-        col_append_str(pinfo->cinfo, COL_INFO, " OK");
-      } else {
-        col_append_fstr(pinfo->cinfo, COL_INFO, " ERROR 0x%02X", result);
-      }
-      break;
-
-    case EPMD_PORT2_RESP:
-      result = tvb_get_guint8(tvb, offset);
-      proto_tree_add_item(tree, hf_epmd_result, tvb, offset, 1, ENC_BIG_ENDIAN);
-      offset++;
-      if (!result) {
-        col_append_str(pinfo->cinfo, COL_INFO, " OK");
-      } else {
-        col_append_fstr(pinfo->cinfo, COL_INFO, " ERROR 0x%02X", result);
-        break;
-      }
-      port = tvb_get_ntohs(tvb, offset);
-      proto_tree_add_item(tree, hf_epmd_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
-      offset += 2;
-      proto_tree_add_item(tree, hf_epmd_node_type, tvb, offset, 1, ENC_BIG_ENDIAN);
-      offset++;
-      proto_tree_add_item(tree, hf_epmd_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
-      offset++;
-      proto_tree_add_item(tree, hf_epmd_dist_high, tvb, offset, 2, ENC_BIG_ENDIAN);
-      offset += 2;
-      proto_tree_add_item(tree, hf_epmd_dist_low, tvb, offset, 2, ENC_BIG_ENDIAN);
-      offset += 2;
-      name_length = tvb_get_ntohs(tvb, offset);
-      proto_tree_add_item(tree, hf_epmd_name_len, tvb, offset, 2, ENC_BIG_ENDIAN);
-      proto_tree_add_item(tree, hf_epmd_name, tvb, offset + 2, name_length, ENC_ASCII|ENC_NA);
-      name = tvb_get_ephemeral_string(tvb, offset + 2, name_length);
-      offset += 2 + name_length;
-      if (tvb_length_remaining(tvb, offset) >= 2) {
-        guint16 elen=0;
-        elen = tvb_get_ntohs(tvb, offset);
-        proto_tree_add_item(tree, hf_epmd_elen, tvb, offset, 2, ENC_BIG_ENDIAN);
-        if (elen > 0)
-          proto_tree_add_item(tree, hf_epmd_edata, tvb, offset + 2, elen, ENC_NA);
-        offset += 2 + elen;
-      }
-      col_append_fstr(pinfo->cinfo, COL_INFO, " %s port=%d", name, port);
-      if (!pinfo->fd->flags.visited) {
-        conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_TCP, port,        0, NO_PORT2);
-        conversation_set_dissector(conv, edp_handle);
-      }
-      break;
-  }
+    guint8          type, result;
+    guint32         port;
+    guint16         name_length = 0;
+    const gchar    *name        = NULL;
+    conversation_t *conv        = NULL;
+
+    port = tvb_get_ntohl(tvb, offset);
+    if (port == EPMD_PORT) {
+        dissect_epmd_response_names(pinfo, tvb, offset, tree);
+        return;
+    }
+
+    type = tvb_get_guint8(tvb, offset);
+    proto_tree_add_item(tree, hf_epmd_type, tvb, offset, 1, ENC_BIG_ENDIAN);
+    offset++;
+    col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, VALS(message_types), "unknown (0x%02X)"));
+
+    switch (type) {
+        case EPMD_ALIVE_OK_RESP:
+        case EPMD_ALIVE2_RESP:
+            result = tvb_get_guint8(tvb, offset);
+            proto_tree_add_item(tree, hf_epmd_result, tvb, offset, 1, ENC_BIG_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_epmd_creation, tvb, offset, 2, ENC_BIG_ENDIAN);
+            offset += 2;
+            if (!result) {
+                col_append_str(pinfo->cinfo, COL_INFO, " OK");
+            } else {
+                col_append_fstr(pinfo->cinfo, COL_INFO, " ERROR 0x%02X", result);
+            }
+            break;
+
+        case EPMD_PORT2_RESP:
+            result = tvb_get_guint8(tvb, offset);
+            proto_tree_add_item(tree, hf_epmd_result, tvb, offset, 1, ENC_BIG_ENDIAN);
+            offset++;
+            if (!result) {
+                col_append_str(pinfo->cinfo, COL_INFO, " OK");
+            } else {
+                col_append_fstr(pinfo->cinfo, COL_INFO, " ERROR 0x%02X", result);
+                break;
+            }
+            port = tvb_get_ntohs(tvb, offset);
+            proto_tree_add_item(tree, hf_epmd_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
+            offset += 2;
+            proto_tree_add_item(tree, hf_epmd_node_type, tvb, offset, 1, ENC_BIG_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_epmd_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_epmd_dist_high, tvb, offset, 2, ENC_BIG_ENDIAN);
+            offset += 2;
+            proto_tree_add_item(tree, hf_epmd_dist_low, tvb, offset, 2, ENC_BIG_ENDIAN);
+            offset += 2;
+            name_length = tvb_get_ntohs(tvb, offset);
+            proto_tree_add_item(tree, hf_epmd_name_len, tvb, offset, 2, ENC_BIG_ENDIAN);
+            proto_tree_add_item(tree, hf_epmd_name, tvb, offset + 2, name_length, ENC_ASCII|ENC_NA);
+            name = tvb_get_ephemeral_string(tvb, offset + 2, name_length);
+            offset += 2 + name_length;
+            if (tvb_length_remaining(tvb, offset) >= 2) {
+                guint16 elen=0;
+                elen = tvb_get_ntohs(tvb, offset);
+                proto_tree_add_item(tree, hf_epmd_elen, tvb, offset, 2, ENC_BIG_ENDIAN);
+                if (elen > 0)
+                    proto_tree_add_item(tree, hf_epmd_edata, tvb, offset + 2, elen, ENC_NA);
+                offset += 2 + elen;
+            }
+            col_append_fstr(pinfo->cinfo, COL_INFO, " %s port=%d", name, port);
+            if (!pinfo->fd->flags.visited) {
+                conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_TCP, port, 0, NO_PORT2);
+                conversation_set_dissector(conv, edp_handle);
+            }
+            break;
+    }
 }
 
 static gboolean
@@ -281,118 +281,132 @@ check_epmd(tvbuff_t *tvb) {
      * doesn't bring very much.
      */
     if (tvb_length(tvb) < 3)
-       return(FALSE);
+        return (FALSE);
 
     type = tvb_get_guint8(tvb, 0);
     switch (type) {
-       case EPMD_ALIVE_OK_RESP:
-       case EPMD_ALIVE2_RESP:
-       case EPMD_PORT2_RESP:
-           return(TRUE);
-       default:
-           break;
+        case EPMD_ALIVE_OK_RESP:
+        case EPMD_ALIVE2_RESP:
+        case EPMD_PORT2_RESP:
+            return (TRUE);
+        default:
+            break;
     }
 
     type = tvb_get_guint8(tvb, 2);
     switch (type) {
-       case EPMD_ALIVE_REQ:
-       case EPMD_ALIVE2_REQ:
-       case EPMD_PORT_REQ:
-       case EPMD_PORT2_REQ:
-       case EPMD_NAMES_REQ:
-           return( TRUE);
-       default:
-           break;
+        case EPMD_ALIVE_REQ:
+        case EPMD_ALIVE2_REQ:
+        case EPMD_PORT_REQ:
+        case EPMD_PORT2_REQ:
+        case EPMD_NAMES_REQ:
+            return (TRUE);
+        default:
+            break;
     }
 
-    return(FALSE);
+    return (FALSE);
 }
 
 static int
 dissect_epmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
-  proto_tree *epmd_tree;
-  proto_item *ti;
+    proto_tree *epmd_tree;
+    proto_item *ti;
 
-  if (!check_epmd(tvb))
-         return(0);
+    if (!check_epmd(tvb))
+        return (0);
 
-  col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME);
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME);
 
-  ti = proto_tree_add_item(tree, proto_epmd, tvb, 0, -1, ENC_NA);
-  epmd_tree = proto_item_add_subtree(ti, ett_epmd);
+    ti = proto_tree_add_item(tree, proto_epmd, tvb, 0, -1, ENC_NA);
+    epmd_tree = proto_item_add_subtree(ti, ett_epmd);
 
-  if (pinfo->match_port == pinfo->destport) {
-    dissect_epmd_request(pinfo, tvb, 0, epmd_tree);
-  } else {
-    dissect_epmd_response(pinfo, tvb, 0, epmd_tree);
-  }
+    if (pinfo->match_port == pinfo->destport) {
+        dissect_epmd_request(pinfo, tvb, 0, epmd_tree);
+    } else {
+        dissect_epmd_response(pinfo, tvb, 0, epmd_tree);
+    }
 
-  return(tvb_length(tvb));
+    return (tvb_length(tvb));
 }
 
 void
 proto_register_epmd(void)
 {
     static hf_register_info hf[] = {
-       { &hf_epmd_len,
-           {   "Length", "epmd.len",
-               FT_UINT16, BASE_DEC, NULL, 0x0,
-               "Message Length", HFILL }},
-       { &hf_epmd_type,
-           { "Type", "epmd.type",
-               FT_UINT8, BASE_DEC, VALS(message_types), 0x0,
-               "Message Type", HFILL }},
-       { &hf_epmd_result,
-           { "Result", "epmd.result",
-               FT_UINT8, BASE_DEC, NULL, 0x0,
-               NULL, HFILL }},
-       { &hf_epmd_port_no,
-           { "Port No", "epmd.port_no",
-               FT_UINT16, BASE_DEC, NULL, 0x0,
-               NULL, HFILL }},
-       { &hf_epmd_node_type,
-           { "Node Type", "epmd.node_type",
-               FT_UINT8, BASE_DEC, VALS(node_type_vals), 0x0,
-               NULL, HFILL }},
-       { &hf_epmd_protocol,
-           { "Protocol", "epmd.protocol",
-               FT_UINT8, BASE_DEC, VALS(protocol_vals), 0x0,
-               NULL, HFILL }},
-       { &hf_epmd_creation,
-           { "Creation", "epmd.creation",
-               FT_UINT16, BASE_DEC, NULL, 0x0,
-               NULL, HFILL }},
-       { &hf_epmd_dist_high,
-           { "Highest Version", "epmd.dist_high",
-               FT_UINT16, BASE_DEC, VALS(epmd_version_vals), 0x0,
-               NULL, HFILL }},
-       { &hf_epmd_dist_low,
-           { "Lowest Version", "epmd.dist_low",
-               FT_UINT16, BASE_DEC, VALS(epmd_version_vals), 0x0,
-               NULL, HFILL }},
-       { &hf_epmd_name_len,
-           { "Name Length", "epmd.name_len",
-               FT_UINT16, BASE_DEC, NULL, 0x0,
-               NULL, HFILL }},
-       { &hf_epmd_name,
-           { "Node Name", "epmd.name",
-               FT_STRING, BASE_NONE, NULL, 0x0,
-               NULL, HFILL }},
-       { &hf_epmd_elen,
-           { "Elen", "epmd.elen",
-               FT_UINT16, BASE_DEC, NULL, 0x0,
-               "Extra Length", HFILL }},
-       { &hf_epmd_edata,
-           { "Edata", "epmd.edata",
-               FT_BYTES, BASE_NONE, NULL, 0x0,
-               "Extra Data", HFILL }},
-       { &hf_epmd_names,
-           { "Names", "epmd.names",
-               FT_BYTES, BASE_NONE, NULL, 0x0,
-               "List of names", HFILL }}
+        { &hf_epmd_len,
+          { "Length", "epmd.len",
+            FT_UINT16, BASE_DEC, NULL, 0x0,
+            "Message Length", HFILL }},
+
+        { &hf_epmd_type,
+          { "Type", "epmd.type",
+            FT_UINT8, BASE_DEC, VALS(message_types), 0x0,
+            "Message Type", HFILL }},
+
+        { &hf_epmd_result,
+          { "Result", "epmd.result",
+            FT_UINT8, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }},
+
+        { &hf_epmd_port_no,
+          { "Port No", "epmd.port_no",
+            FT_UINT16, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }},
+
+        { &hf_epmd_node_type,
+          { "Node Type", "epmd.node_type",
+            FT_UINT8, BASE_DEC, VALS(node_type_vals), 0x0,
+            NULL, HFILL }},
+
+        { &hf_epmd_protocol,
+          { "Protocol", "epmd.protocol",
+            FT_UINT8, BASE_DEC, VALS(protocol_vals), 0x0,
+            NULL, HFILL }},
+
+        { &hf_epmd_creation,
+          { "Creation", "epmd.creation",
+            FT_UINT16, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }},
+
+        { &hf_epmd_dist_high,
+          { "Highest Version", "epmd.dist_high",
+            FT_UINT16, BASE_DEC, VALS(epmd_version_vals), 0x0,
+            NULL, HFILL }},
+
+        { &hf_epmd_dist_low,
+          { "Lowest Version", "epmd.dist_low",
+            FT_UINT16, BASE_DEC, VALS(epmd_version_vals), 0x0,
+            NULL, HFILL }},
+
+        { &hf_epmd_name_len,
+          { "Name Length", "epmd.name_len",
+            FT_UINT16, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }},
+
+        { &hf_epmd_name,
+          { "Node Name", "epmd.name",
+            FT_STRING, BASE_NONE, NULL, 0x0,
+            NULL, HFILL }},
+
+        { &hf_epmd_elen,
+          { "Elen", "epmd.elen",
+            FT_UINT16, BASE_DEC, NULL, 0x0,
+            "Extra Length", HFILL }},
+
+        { &hf_epmd_edata,
+          { "Edata", "epmd.edata",
+            FT_BYTES, BASE_NONE, NULL, 0x0,
+            "Extra Data", HFILL }},
+
+        { &hf_epmd_names,
+          { "Names", "epmd.names",
+            FT_BYTES, BASE_NONE, NULL, 0x0,
+            "List of names", HFILL }}
     };
+
     static gint *ett[] = {
-       &ett_epmd,
+        &ett_epmd,
     };
 
     proto_epmd = proto_register_protocol(PNAME, PSNAME, PFNAME);
@@ -403,10 +417,10 @@ proto_register_epmd(void)
 
 void
 proto_reg_handoff_epmd(void) {
-  dissector_handle_t epmd_handle;
+    dissector_handle_t epmd_handle;
 
-  epmd_handle = find_dissector("epmd");
-  edp_handle = find_dissector("erldp");
+    epmd_handle = find_dissector("epmd");
+    edp_handle = find_dissector("erldp");
 
-  dissector_add_uint("tcp.port", EPMD_PORT, epmd_handle);
+    dissector_add_uint("tcp.port", EPMD_PORT, epmd_handle);
 }
index 87d6295f6c8ee439a8614f0cbf8b0aede48cdb7f..ba7903b0702e3915766b54dfbd749919229a64f8 100644 (file)
@@ -162,19 +162,19 @@ esis_dissect_esh_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree) {
     len   -= 1;
 
     ti = proto_tree_add_text( tree, tvb, offset, -1,
-            "Number of Source Addresses (SA, Format: NSAP) : %u", no_sa );
+                              "Number of Source Addresses (SA, Format: NSAP) : %u", no_sa );
     offset++;
 
     esis_area_tree = proto_item_add_subtree( ti, ett_esis_area_addr );
     while ( no_sa-- > 0 ) {
-       sal = (int) tvb_get_guint8(tvb, offset);
-       proto_tree_add_text(esis_area_tree, tvb, offset, 1, "SAL: %2u Octets", sal);
-       offset++;
-       proto_tree_add_text(esis_area_tree, tvb, offset, sal,
-                           " SA: %s",
-                          print_nsap_net( tvb_get_ptr(tvb, offset, sal), sal ) );
-       offset += sal;
-       len    -= ( sal + 1 );
+      sal = (int) tvb_get_guint8(tvb, offset);
+      proto_tree_add_text(esis_area_tree, tvb, offset, 1, "SAL: %2u Octets", sal);
+      offset++;
+      proto_tree_add_text(esis_area_tree, tvb, offset, sal,
+                          " SA: %s",
+                          print_nsap_net( tvb_get_ptr(tvb, offset, sal), sal ) );
+      offset += sal;
+      len    -= ( sal + 1 );
     }
     dissect_osi_options( len, tvb, offset, tree );
   }
@@ -194,8 +194,8 @@ esis_dissect_ish_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree) {
                          "### Network Entity Title Section ###");
     proto_tree_add_text( tree, tvb, offset++, 1, "NETL: %2u Octets", netl);
     proto_tree_add_text( tree, tvb, offset, netl,
-                           " NET: %s",
-                          print_nsap_net( tvb_get_ptr(tvb, offset, netl), netl ) );
+                         " NET: %s",
+                         print_nsap_net( tvb_get_ptr(tvb, offset, netl), netl ) );
     offset += netl;
     len    -= ( netl + 1 );
 
@@ -218,7 +218,7 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree) {
     proto_tree_add_text( tree, tvb, offset++, 1, "DAL: %2u Octets", tmpl);
     proto_tree_add_text( tree, tvb, offset, tmpl,
                          " DA : %s",
-                        print_nsap_net( tvb_get_ptr(tvb, offset, tmpl), tmpl ) );
+                         print_nsap_net( tvb_get_ptr(tvb, offset, tmpl), tmpl ) );
     offset += tmpl;
     len    -= ( tmpl + 1 );
     tmpl    = (int) tvb_get_guint8(tvb, offset);
@@ -227,8 +227,8 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree) {
                          "###  Subnetwork Address Section ###");
     proto_tree_add_text( tree, tvb, offset++, 1, "BSNPAL: %2u Octets", tmpl);
     proto_tree_add_text( tree, tvb, offset, tmpl,
-                           " BSNPA: %s",
-                          print_system_id( tvb_get_ptr(tvb, offset, tmpl), tmpl ) );
+                         " BSNPA: %s",
+                         print_system_id( tvb_get_ptr(tvb, offset, tmpl), tmpl ) );
     offset += tmpl;
     len    -= ( tmpl + 1 );
     tmpl    = (int) tvb_get_guint8(tvb, offset);
@@ -245,7 +245,7 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree) {
       proto_tree_add_text( tree, tvb, offset++, 1, "NETL: %2u Octets", tmpl );
       proto_tree_add_text( tree, tvb, offset, tmpl,
                            " NET: %s",
-                          print_nsap_net( tvb_get_ptr(tvb, offset, tmpl), tmpl ) );
+                           print_nsap_net( tvb_get_ptr(tvb, offset, tmpl), tmpl ) );
       offset += tmpl;
       len    -= ( tmpl + 1 );
     }
@@ -271,119 +271,119 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree) {
  */
 static void
 dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
-   const char *pdu_type_string        = NULL;
-   const char *pdu_type_format_string = "PDU Type      : %s (R:%s%s%s)";
-   esis_hdr_t  ehdr;
-   proto_item *ti;
-   proto_tree *esis_tree    = NULL;
-   guint8      variable_len;
-   guint       tmp_uint     = 0;
-   const char *cksum_status;
-
-   col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESIS");
-   col_clear(pinfo->cinfo, COL_INFO);
-
-   tvb_memcpy(tvb, (guint8 *)&ehdr, 0, sizeof ehdr);
-
-   if (tree) {
-     ti = proto_tree_add_item(tree, proto_esis, tvb, 0, -1, ENC_NA);
-     esis_tree = proto_item_add_subtree(ti, ett_esis);
-
-     if (ehdr.esis_version != ESIS_REQUIRED_VERSION){
-       esis_dissect_unknown(tvb, esis_tree,
-                          "Unknown ESIS version (%u vs %u)",
+  const char *pdu_type_string        = NULL;
+  const char *pdu_type_format_string = "PDU Type      : %s (R:%s%s%s)";
+  esis_hdr_t  ehdr;
+  proto_item *ti;
+  proto_tree *esis_tree    = NULL;
+  guint8      variable_len;
+  guint       tmp_uint     = 0;
+  const char *cksum_status;
+
+  col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESIS");
+  col_clear(pinfo->cinfo, COL_INFO);
+
+  tvb_memcpy(tvb, (guint8 *)&ehdr, 0, sizeof ehdr);
+
+  if (tree) {
+    ti = proto_tree_add_item(tree, proto_esis, tvb, 0, -1, ENC_NA);
+    esis_tree = proto_item_add_subtree(ti, ett_esis);
+
+    if (ehdr.esis_version != ESIS_REQUIRED_VERSION){
+      esis_dissect_unknown(tvb, esis_tree,
+                           "Unknown ESIS version (%u vs %u)",
                            ehdr.esis_version, ESIS_REQUIRED_VERSION );
-       return;
-     }
+      return;
+    }
 
-     if (ehdr.esis_length < ESIS_HDR_FIXED_LENGTH) {
-       esis_dissect_unknown(tvb, esis_tree,
-                          "Bogus ESIS length (%u, must be >= %u)",
+    if (ehdr.esis_length < ESIS_HDR_FIXED_LENGTH) {
+      esis_dissect_unknown(tvb, esis_tree,
+                           "Bogus ESIS length (%u, must be >= %u)",
                            ehdr.esis_length, ESIS_HDR_FIXED_LENGTH );
-       return;
-     }
-     proto_tree_add_uint( esis_tree, hf_esis_nlpi, tvb, 0, 1, ehdr.esis_nlpi );
-     proto_tree_add_uint( esis_tree, hf_esis_length, tvb,
-                          1, 1, ehdr.esis_length );
-     proto_tree_add_uint( esis_tree, hf_esis_version, tvb, 2, 1,
-                          ehdr.esis_version );
-     proto_tree_add_uint( esis_tree, hf_esis_reserved, tvb, 3, 1,
-                          ehdr.esis_reserved );
-
-     pdu_type_string = val_to_str(ehdr.esis_type&OSI_PDU_TYPE_MASK,
-                                  esis_vals, "Unknown (0x%x)");
-
-     proto_tree_add_uint_format( esis_tree, hf_esis_type, tvb, 4, 1,
-                                 ehdr.esis_type,
-                                 pdu_type_format_string,
-                                 pdu_type_string,
-                                 (ehdr.esis_type&BIT_8) ? "1" : "0",
-                                 (ehdr.esis_type&BIT_7) ? "1" : "0",
-                                 (ehdr.esis_type&BIT_6) ? "1" : "0");
-
-     tmp_uint = pntohs( ehdr.esis_holdtime );
-     proto_tree_add_uint_format(esis_tree, hf_esis_holdtime, tvb, 5, 2,
-                                tmp_uint, "Holding Time  : %u seconds",
-                                tmp_uint );
-
-     tmp_uint = pntohs( ehdr.esis_checksum );
-
-     switch (calc_checksum( tvb, 0, ehdr.esis_length, tmp_uint )) {
-
-     case NO_CKSUM:
-       cksum_status = "Not Used";
-       break;
-
-     case DATA_MISSING:
-       cksum_status = "Not checkable - not all of packet was captured";
-       break;
-
-     case CKSUM_OK:
-       cksum_status = "Is good";
-       break;
-
-     case CKSUM_NOT_OK:
-       cksum_status = "Is wrong";
-       break;
-
-     default:
-       cksum_status = NULL;
-       DISSECTOR_ASSERT_NOT_REACHED();
-     }
-     proto_tree_add_uint_format( esis_tree, hf_esis_checksum, tvb, 7, 2,
-                                 tmp_uint, "Checksum      : 0x%x ( %s )",
-                                 tmp_uint, cksum_status );
-   }
-
-
-   /*
-    * Let us make sure we use the same names for all our decodes
-    * here.  First, dump the name into info column, and THEN
-    * dispatch the sub-type.
-    */
-   if (check_col(pinfo->cinfo, COL_INFO)) {
-     col_add_str(pinfo->cinfo, COL_INFO,
-                 val_to_str( ehdr.esis_type&OSI_PDU_TYPE_MASK, esis_vals,
-                             "Unknown (0x%x)" ) );
-   }
-
-   variable_len = ehdr.esis_length - ESIS_HDR_FIXED_LENGTH;
-
-   switch (ehdr.esis_type & OSI_PDU_TYPE_MASK) {
-     case ESIS_ESH_PDU:
-          esis_dissect_esh_pdu( variable_len, tvb, esis_tree);
-     break;
-     case ESIS_ISH_PDU:
-          esis_dissect_ish_pdu( variable_len, tvb, esis_tree);
-     break;
-     case ESIS_RD_PDU:
-          esis_dissect_redirect_pdu( variable_len, tvb, esis_tree);
-     break;
-     default:
-         esis_dissect_unknown(tvb, esis_tree,
-                             "Unknown ESIS packet type 0x%x",
-                             ehdr.esis_type & OSI_PDU_TYPE_MASK );
-   }
+      return;
+    }
+    proto_tree_add_uint( esis_tree, hf_esis_nlpi, tvb, 0, 1, ehdr.esis_nlpi );
+    proto_tree_add_uint( esis_tree, hf_esis_length, tvb,
+                         1, 1, ehdr.esis_length );
+    proto_tree_add_uint( esis_tree, hf_esis_version, tvb, 2, 1,
+                         ehdr.esis_version );
+    proto_tree_add_uint( esis_tree, hf_esis_reserved, tvb, 3, 1,
+                         ehdr.esis_reserved );
+
+    pdu_type_string = val_to_str(ehdr.esis_type&OSI_PDU_TYPE_MASK,
+                                 esis_vals, "Unknown (0x%x)");
+
+    proto_tree_add_uint_format( esis_tree, hf_esis_type, tvb, 4, 1,
+                                ehdr.esis_type,
+                                pdu_type_format_string,
+                                pdu_type_string,
+                                (ehdr.esis_type&BIT_8) ? "1" : "0",
+                                (ehdr.esis_type&BIT_7) ? "1" : "0",
+                                (ehdr.esis_type&BIT_6) ? "1" : "0");
+
+    tmp_uint = pntohs( ehdr.esis_holdtime );
+    proto_tree_add_uint_format(esis_tree, hf_esis_holdtime, tvb, 5, 2,
+                               tmp_uint, "Holding Time  : %u seconds",
+                               tmp_uint );
+
+    tmp_uint = pntohs( ehdr.esis_checksum );
+
+    switch (calc_checksum( tvb, 0, ehdr.esis_length, tmp_uint )) {
+
+    case NO_CKSUM:
+      cksum_status = "Not Used";
+      break;
+
+    case DATA_MISSING:
+      cksum_status = "Not checkable - not all of packet was captured";
+      break;
+
+    case CKSUM_OK:
+      cksum_status = "Is good";
+      break;
+
+    case CKSUM_NOT_OK:
+      cksum_status = "Is wrong";
+      break;
+
+    default:
+      cksum_status = NULL;
+      DISSECTOR_ASSERT_NOT_REACHED();
+    }
+    proto_tree_add_uint_format( esis_tree, hf_esis_checksum, tvb, 7, 2,
+                                tmp_uint, "Checksum      : 0x%x ( %s )",
+                                tmp_uint, cksum_status );
+  }
+
+
+  /*
+   * Let us make sure we use the same names for all our decodes
+   * here.  First, dump the name into info column, and THEN
+   * dispatch the sub-type.
+   */
+  if (check_col(pinfo->cinfo, COL_INFO)) {
+    col_add_str(pinfo->cinfo, COL_INFO,
+                val_to_str( ehdr.esis_type&OSI_PDU_TYPE_MASK, esis_vals,
+                            "Unknown (0x%x)" ) );
+  }
+
+  variable_len = ehdr.esis_length - ESIS_HDR_FIXED_LENGTH;
+
+  switch (ehdr.esis_type & OSI_PDU_TYPE_MASK) {
+  case ESIS_ESH_PDU:
+    esis_dissect_esh_pdu( variable_len, tvb, esis_tree);
+    break;
+  case ESIS_ISH_PDU:
+    esis_dissect_ish_pdu( variable_len, tvb, esis_tree);
+    break;
+  case ESIS_RD_PDU:
+    esis_dissect_redirect_pdu( variable_len, tvb, esis_tree);
+    break;
+  default:
+    esis_dissect_unknown(tvb, esis_tree,
+                         "Unknown ESIS packet type 0x%x",
+                         ehdr.esis_type & OSI_PDU_TYPE_MASK );
+  }
 } /* dissect_esis */
 
 
@@ -391,17 +391,17 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
  * Name: proto_register_esis()
  *
  * Description:
- *     main register for esis protocol set.  We register some display
- *     formats and the protocol module variables.
+ *      main register for esis protocol set.  We register some display
+ *      formats and the protocol module variables.
  *
- *     NOTE: this procedure to autolinked by the makefile process that
- *     builds register.c
+ *      NOTE: this procedure to autolinked by the makefile process that
+ *      builds register.c
  *
  * Input:
- *     void
+ *      void
  *
  * Output:
- *     void
+ *      void
  */
 void
 proto_register_esis(void) {
@@ -409,19 +409,24 @@ proto_register_esis(void) {
     { &hf_esis_nlpi,
       { "Network Layer Protocol Identifier", "esis.nlpi",
         FT_UINT8, BASE_HEX, VALS(nlpid_vals), 0x0, NULL, HFILL }},
+
     { &hf_esis_length,
-      { "PDU Length", "esis.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+      { "PDU Length", "esis.length",  FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+
     { &hf_esis_version,
-      { "Version (==1)", "esis.ver",    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+      { "Version (==1)", "esis.ver",  FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+
     { &hf_esis_reserved,
-      { "Reserved(==0)", "esis.res",    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+      { "Reserved(==0)", "esis.res",  FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+
     { &hf_esis_type,
-      { "PDU Type", "esis.type",   FT_UINT8, BASE_DEC, VALS(esis_vals),
-         0xff, NULL, HFILL }},
+      { "PDU Type", "esis.type",      FT_UINT8, BASE_DEC, VALS(esis_vals), 0xff, NULL, HFILL }},
+
     { &hf_esis_holdtime,
-      { "Holding Time", "esis.htime",  FT_UINT16, BASE_DEC, NULL, 0x0, "s", HFILL }},
+      { "Holding Time", "esis.htime", FT_UINT16, BASE_DEC, NULL, 0x0, "s", HFILL }},
+
     { &hf_esis_checksum,
-      { "Checksum", "esis.chksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}
+      { "Checksum", "esis.chksum",    FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}
   };
   /*
    *
index 4b4db5211da81ac28f5ae79cd8ceb8378e572a65..7cb91cd3f5b0b6f7c107529341c653d5bbbbf4bd 100644 (file)
@@ -28,8 +28,6 @@
 # include "config.h"
 #endif
 
-#include <stdlib.h>
-
 #include <glib.h>
 
 #include <epan/packet.h>
@@ -68,14 +66,14 @@ typedef enum {
 } fcencap_proto_t;
 
 static const value_string fcip_eof_vals[] = {
-    {FCIP_EOFn, "EOFn" },
-    {FCIP_EOFt, "EOFt" },
-    {FCIP_EOFrt, "EOFrt" },
-    {FCIP_EOFdt, "EOFdt" },
-    {FCIP_EOFni, "EOFni" },
+    {FCIP_EOFn,   "EOFn"   },
+    {FCIP_EOFt,   "EOFt"   },
+    {FCIP_EOFrt,  "EOFrt"  },
+    {FCIP_EOFdt,  "EOFdt"  },
+    {FCIP_EOFni,  "EOFni"  },
     {FCIP_EOFdti, "EOFdti" },
     {FCIP_EOFrti, "EOFrti" },
-    {FCIP_EOFa, "EOFa" },
+    {FCIP_EOFa,   "EOFa"   },
     {0, NULL},
 };
 
@@ -92,8 +90,8 @@ static const value_string fcip_sof_vals[] = {
 };
 
 static const value_string fcencap_proto_vals[] = {
-    {FCENCAP_PROTO_FCIP, "FCIP"},
-    {FCENCAP_PROTO_iFCP, "iFCP"},
+    {FCENCAP_PROTO_FCIP, "FCIP" },
+    {FCENCAP_PROTO_iFCP, "iFCP" },
     {0, NULL},
 };
 
@@ -104,32 +102,32 @@ static const guint8 fcip_header_8_bytes[8] = {
 
 static int proto_fcip          = -1;
 
-static int hf_fcip_protocol    = -1;
-static int hf_fcip_protocol_c  = -1;
-static int hf_fcip_version     = -1;
-static int hf_fcip_version_c   = -1;
-static int hf_fcip_encap_word1 = -1;
-static int hf_fcip_flags       = -1;
-static int hf_fcip_flags_c     = -1;
-static int hf_fcip_framelen    = -1;
-static int hf_fcip_framelen_c  = -1;
-static int hf_fcip_tsec        = -1;
-static int hf_fcip_tusec       = -1;
-static int hf_fcip_encap_crc   = -1;
-static int hf_fcip_sof         = -1;
-static int hf_fcip_sof_c       = -1;
-static int hf_fcip_eof         = -1;
-static int hf_fcip_eof_c       = -1;
+static int hf_fcip_protocol       = -1;
+static int hf_fcip_protocol_c     = -1;
+static int hf_fcip_version        = -1;
+static int hf_fcip_version_c      = -1;
+static int hf_fcip_encap_word1    = -1;
+static int hf_fcip_flags          = -1;
+static int hf_fcip_flags_c        = -1;
+static int hf_fcip_framelen       = -1;
+static int hf_fcip_framelen_c     = -1;
+static int hf_fcip_tsec           = -1;
+static int hf_fcip_tusec          = -1;
+static int hf_fcip_encap_crc      = -1;
+static int hf_fcip_sof            = -1;
+static int hf_fcip_sof_c          = -1;
+static int hf_fcip_eof            = -1;
+static int hf_fcip_eof_c          = -1;
 static int hf_fcip_pflags_changed = -1;
 static int hf_fcip_pflags_special = -1;
-static int hf_fcip_pflags_c = -1;
-static int hf_fcip_src_wwn = -1;
-static int hf_fcip_dst_wwn = -1;
-static int hf_fcip_conn_code = -1;
-static int hf_fcip_katov = -1;
-static int hf_fcip_src_entity_id = -1;
-static int hf_fcip_conn_nonce = -1;
-static int hf_fcip_conn_flags = -1;
+static int hf_fcip_pflags_c       = -1;
+static int hf_fcip_src_wwn        = -1;
+static int hf_fcip_dst_wwn        = -1;
+static int hf_fcip_conn_code      = -1;
+static int hf_fcip_katov          = -1;
+static int hf_fcip_src_entity_id  = -1;
+static int hf_fcip_conn_nonce     = -1;
+static int hf_fcip_conn_flags     = -1;
 
 static int ett_fcip            = -1;
 
@@ -145,9 +143,9 @@ static dissector_handle_t fc_handle;
 static guint
 get_next_fcip_header_offset (tvbuff_t *tvb, packet_info *pinfo, gint offset)
 {
-    gint bytes_remaining = tvb_length_remaining (tvb, offset);
-    gint frame_len;
-    guint16 flen, flen1;
+    gint       bytes_remaining = tvb_length_remaining (tvb, offset);
+    gint       frame_len;
+    guint16    flen, flen1;
     fcip_eof_t eof, eofc;
 
     /*
@@ -194,8 +192,8 @@ NXT_BYTE: while (bytes_remaining) {
                  * Tell the TCP dissector where the data for this
                  * message starts in the data it handed us, and that we need
                  * "some more data."  Don't tell it exactly how many bytes
-                * we need because if/when we ask for even more (after the
-                * header) that will break reassembly.
+                 * we need because if/when we ask for even more (after the
+                 * header) that will break reassembly.
                  */
                 pinfo->desegment_offset = offset;
                 pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
@@ -271,9 +269,9 @@ NXT_BYTE: while (bytes_remaining) {
 
 
         /* Test f
-        * We dont test this since some implementations actually provide
-        * a CRC here.
-        */
+         * We dont test this since some implementations actually provide
+         * a CRC here.
+         */
 
         if (bytes_remaining >= (frame_len)) {
             if (tvb_bytes_exist (tvb, offset+frame_len, 8)) {
@@ -539,7 +537,7 @@ proto_register_fcip (void)
     /* Setup list of header fields  See Section 1.6.1 for details*/
     static hf_register_info hf[] = {
         { &hf_fcip_protocol,
-         { "Protocol", "fcip.proto", FT_UINT8, BASE_DEC,
+          { "Protocol", "fcip.proto", FT_UINT8, BASE_DEC,
             VALS(fcencap_proto_vals), 0, NULL, HFILL }},
         { &hf_fcip_protocol_c,
           {"Protocol (1's Complement)", "fcip.protoc", FT_UINT8, BASE_DEC,
@@ -627,8 +625,6 @@ proto_register_fcip (void)
     /* Register the protocol name and description */
     proto_fcip = proto_register_protocol("FCIP", "Fibre Channel over IP", "fcip");
 
-    /* Required function calls to register the header fields and
-     * subtrees used */
     proto_register_field_array(proto_fcip, hf, array_length(hf));
     proto_register_subtree_array(ett, array_length(ett));
 
@@ -637,7 +633,8 @@ proto_register_fcip (void)
                                    "desegment",
                                    "Reassemble FCIP messages spanning multiple TCP segments",
                                    "Whether the FCIP dissector should reassemble messages spanning multiple TCP segments."
-                                   " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
+                                   " To use this option, you must also enable"
+                                   " \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
                                    &fcip_desegment);
     prefs_register_uint_preference(fcip_module,
                                    "target_port",
@@ -647,16 +644,6 @@ proto_register_fcip (void)
                                    &fcip_port);
 }
 
-
-/*
- * If this dissector uses sub-dissector registration add a
- * registration routine.
- */
-
-/*
- * This format is required because a script is used to find these
- * routines and create the code that calls these routines.
- */
 void
 proto_reg_handoff_fcip (void)
 {
@@ -668,5 +655,5 @@ proto_reg_handoff_fcip (void)
     dissector_add_handle("tcp.port", fcip_handle);
 
     data_handle = find_dissector("data");
-    fc_handle = find_dissector("fc");
+    fc_handle   = find_dissector("fc");
 }