Move some headers for stuff defined by a dissector into epan/dissectors
[obnox/wireshark/wip.git] / epan / dissectors / packet-cops.c
index 48853fdd5531fc0ee9b612634e59cd25f1efeb5e..8c3861a5e22643c3b0ee74515c0c7fbe79d2bf3b 100644 (file)
 #endif /* HAVE_NET_SNMP */
 #endif /* HAVE_SOME_SNMP */
 
-#include "asn1.h"
-#include "format-oid.h"
+#include <epan/asn1.h>
+#include <epan/dissectors/format-oid.h>
 #include <epan/prefs.h>
+#include <epan/emem.h>
 
 /* XXX - The "plain" COPS port (3288) can be overridden in the prefs.
    The PacketCable port cannot - should this be the case? */
@@ -156,7 +157,7 @@ struct _COPS_CNV
   guint class;
   guint tag;
   gint  syntax;
-  gchar *name;
+  const gchar *name;
 };
 
 static COPS_CNV CopsCnv [] =
@@ -174,7 +175,7 @@ static COPS_CNV CopsCnv [] =
   {0,       0,         -1,                  NULL}
 };
 
-static gchar *
+static const gchar *
 cops_tag_cls2syntax ( guint tag, guint cls, gushort *syntax)
 {
   COPS_CNV *cnv;
@@ -415,13 +416,24 @@ static const value_string cops_report_type_vals[] = {
 
 /* PacketCable Types */
 
-//static dissector_handle_t sdp_handle;
+/* static dissector_handle_t sdp_handle; */
 
 #define COPS_CLIENT_PC_DQOS    0x8008
 #define COPS_CLIENT_PC_MM      0x800a
 
 static const value_string cops_client_type_vals[] = {
+       {0,                   "None"},
+       {1,                   "RSVP"},
+       {2,                   "DiffServ QoS"},
+       {0x8001,              "IP Highway"},
+       {0x8002,              "IP Highway"},
+       {0x8003,              "IP Highway"},
+       {0x8004,              "IP Highway"},
+       {0x8005,              "Fujitsu"},
+       {0x8006,              "HP OpenView PolicyXpert"},
+       {0x8007,              "HP OpenView PolicyXpert"},
        {COPS_CLIENT_PC_DQOS, "PacketCable Dynamic Quality-of-Service"},
+       {0x8009,              "3GPP"},
        {COPS_CLIENT_PC_MM,   "PacketCable Multimedia"},
        {0, NULL},
 };
@@ -445,7 +457,7 @@ static const value_string table_cops_dqos_transaction_id[] =
   { 0xc,  "Gate Delete Err" },
   { 0xd,  "Gate Open" },
   { 0xe,  "Gate Close" },
-  { 0xFF, NULL },
+  { 0, NULL },
 };
 
 /* Direction */
@@ -453,7 +465,7 @@ static const value_string table_cops_direction[] =
 {
   { 0x0,  "Downstream gate" },
   { 0x1,  "Upstream gate" },
-  { 0xFF, NULL },
+  { 0, NULL },
 };
 
 /* Session Class */
@@ -463,7 +475,7 @@ static const value_string table_cops_session_class[] =
   { 0x1,  "Normal priority VoIP session" },
   { 0x2,  "High priority VoIP session" },
   { 0x3,  "Reserved" },
-  { 0xFF, NULL },
+  { 0, NULL },
 };
 
 /* Reason Code */
@@ -471,7 +483,7 @@ static const value_string table_cops_reason_code[] =
 {
   { 0x0,  "Gate Delete Operation" },
   { 0x1,  "Gate Close Operation" },
-  { 0xFF, NULL },
+  { 0, NULL },
 };
 
 /* Reason Sub Code - Delete */
@@ -484,7 +496,7 @@ static const value_string table_cops_reason_subcode_delete[] =
   { 0x4,  "Unexpected Gate-Open" },
   { 0x5,  "Local Gate-Close failure" },
   { 0x127,"Unspecified error" },
-  { 0xFF, NULL },
+  { 0, NULL },
 };
 
 /* Reason Sub Code - Close */
@@ -499,7 +511,7 @@ static const value_string table_cops_reason_subcode_close[] =
   { 0x6,  "Timer T7 expiration; Service Flow reservation timeout" },
   { 0x7,  "Timer T8 expiration; Service Flow inactivity in the upstream direction" },
   { 0x127,"Unspecified error" },
-  { 0xFF, NULL },
+  { 0, NULL },
 };
 
 /* PacketCable Error */
@@ -513,7 +525,7 @@ static const value_string table_cops_packetcable_error[] =
   { 0x6,  "Missing Required Object" },
   { 0x7,  "Invalid Object" },
   { 0x127,"Unspecified error" },
-  { 0xFF, NULL },
+  { 0, NULL },
 };
 
 
@@ -696,6 +708,7 @@ static gint hf_cops_pc_dfcdc_ip = -1;
 static gint hf_cops_pc_dfccc_ip = -1;
 static gint hf_cops_pc_dfcdc_ip_port = -1;
 static gint hf_cops_pc_dfccc_ip_port = -1;
+static gint hf_cops_pc_dfccc_id = -1;
 
 /* PacketCable Multimedia */
 static gint hf_cops_pcmm_amid = -1;
@@ -775,19 +788,19 @@ void proto_reg_handoff_cops(void);
 static guint get_cops_pdu_len(tvbuff_t *tvb, int offset);
 static void dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
 
-static int dissect_cops_object(tvbuff_t *tvb, guint32 offset, proto_tree *tree, guint16 client_type);
-static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *tree,
-                                     guint16 client_type, guint8 c_num, guint8 c_type, guint16 len);
+static int dissect_cops_object(tvbuff_t *tvb, packet_info *pinfo, guint8 op_code, guint32 offset, proto_tree *tree, guint16 client_type);
+static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, proto_tree *tree,
+                                     guint8 op_code, guint16 client_type, guint8 c_num, guint8 c_type, int len);
 
-static void dissect_cops_pr_objects(tvbuff_t *tvb, guint32 offset, proto_tree *tree, guint16 pr_len);
+static void dissect_cops_pr_objects(tvbuff_t *tvb, guint32 offset, proto_tree *tree, int pr_len);
 static int dissect_cops_pr_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *tree,
-                                       guint8 s_num, guint8 s_type, guint16 len);
+                                       guint8 s_num, guint8 s_type, int len);
 
 /* Added for PacketCable */
-proto_tree *info_to_cops_subtree(tvbuff_t *, proto_tree *, int, int, char *);
-proto_item *info_to_display(tvbuff_t *, proto_item *, int, int, char *, const value_string *, int, gint *);
+static proto_tree *info_to_cops_subtree(tvbuff_t *, proto_tree *, int, int, const char *);
+static proto_item *info_to_display(tvbuff_t *, proto_item *, int, int, const char *, const value_string *, int, gint *);
 
-static void cops_transaction_id(tvbuff_t *, proto_tree *, guint, guint32);
+static void cops_transaction_id(tvbuff_t *, packet_info *, proto_tree *, guint8, guint, guint32);
 static void cops_subscriber_id_v4(tvbuff_t *, proto_tree *, guint, guint32);
 static void cops_subscriber_id_v6(tvbuff_t *, proto_tree *, guint, guint32);
 static void cops_gate_id(tvbuff_t *, proto_tree *, guint, guint32);
@@ -803,11 +816,9 @@ static void cops_amid(tvbuff_t *, proto_tree *, guint, guint32);
 
 static void decode_docsis_request_transmission_policy(tvbuff_t *tvb, guint32 offset, proto_tree *tree, gint hf);
 
-static void cops_analyze_packetcable_dqos_obj(tvbuff_t *, proto_tree *, guint32);
-static void cops_analyze_packetcable_mm_obj(tvbuff_t *, proto_tree *, guint32);
+static void cops_analyze_packetcable_dqos_obj(tvbuff_t *, packet_info *, proto_tree *, guint8, guint32);
+static void cops_analyze_packetcable_mm_obj(tvbuff_t *, packet_info *, proto_tree *, guint8, guint32);
 
-static packet_info *cpinfo;
-static guint8 opcode_idx;
 static gboolean cops_packetcable = TRUE;
 
 /* End of addition for PacketCable */
@@ -850,10 +861,6 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   /* Currently used by PacketCable */
   client_type = tvb_get_ntohs(tvb, 2);
 
-  /* PacketCable: Remember the next two values to manipulate the info field in the Gui */
-  cpinfo = pinfo;
-  opcode_idx = op_code;
-
   if (tree) {
     proto_item *ti, *tv;
     proto_tree *cops_tree, *ver_flags_tree;
@@ -886,7 +893,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     offset += 4;
 
     while (tvb_reported_length_remaining(tvb, offset) >= COPS_OBJECT_HDR_SIZE) {
-      object_len = dissect_cops_object(tvb, offset, cops_tree, client_type);
+      object_len = dissect_cops_object(tvb, pinfo, op_code, offset, cops_tree, client_type);
       if (object_len < 0)
         return;
       offset += object_len;
@@ -900,7 +907,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   }
 }
 
-static char *cops_c_type_to_str(guint8 c_num, guint8 c_type)
+static const char *cops_c_type_to_str(guint8 c_num, guint8 c_type)
 {
   switch (c_num) {
   case COPS_OBJ_HANDLE:
@@ -957,13 +964,13 @@ static char *cops_c_type_to_str(guint8 c_num, guint8 c_type)
   return "";
 }
 
-static int dissect_cops_object(tvbuff_t *tvb, guint32 offset, proto_tree *tree, guint16 client_type)
+static int dissect_cops_object(tvbuff_t *tvb, packet_info *pinfo, guint8 op_code, guint32 offset, proto_tree *tree, guint16 client_type)
 {
-  guint16 object_len, contents_len;
+  int object_len, contents_len;
   guint8 c_num, c_type;
   proto_item *ti;
   proto_tree *obj_tree;
-  char *type_str;
+  const char *type_str;
 
   object_len = tvb_get_ntohs(tvb, offset);
   if (object_len < COPS_OBJECT_HDR_SIZE) {
@@ -996,7 +1003,7 @@ static int dissect_cops_object(tvbuff_t *tvb, guint32 offset, proto_tree *tree,
   offset++;
 
   contents_len = object_len - COPS_OBJECT_HDR_SIZE;
-  dissect_cops_object_data(tvb, offset, obj_tree, client_type, c_num, c_type, contents_len);
+  dissect_cops_object_data(tvb, pinfo, offset, obj_tree, op_code, client_type, c_num, c_type, contents_len);
 
   /* Pad to 32bit boundary */
   if (object_len % sizeof (guint32))
@@ -1005,11 +1012,11 @@ static int dissect_cops_object(tvbuff_t *tvb, guint32 offset, proto_tree *tree,
   return object_len;
 }
 
-static void dissect_cops_pr_objects(tvbuff_t *tvb, guint32 offset, proto_tree *tree, guint16 pr_len)
+static void dissect_cops_pr_objects(tvbuff_t *tvb, guint32 offset, proto_tree *tree, int pr_len)
 {
-  guint16 object_len, contents_len;
+  int object_len, contents_len;
   guint8 s_num, s_type;
-  char *type_str;
+  const char *type_str;
   int ret;
   proto_tree *cops_pr_tree, *obj_tree;
   proto_item *ti;
@@ -1063,8 +1070,8 @@ static void dissect_cops_pr_objects(tvbuff_t *tvb, guint32 offset, proto_tree *t
   }
 }
 
-static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *tree,
-                                     guint16 client_type, guint8 c_num, guint8 c_type, guint16 len)
+static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, proto_tree *tree,
+                                     guint8 op_code, guint16 client_type, guint8 c_num, guint8 c_type, int len)
 {
   proto_item *ti;
   proto_tree *r_type_tree, *itf_tree, *reason_tree, *dec_tree, *error_tree, *clientsi_tree, *pdp_tree;
@@ -1089,7 +1096,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *
   case COPS_OBJ_IN_INT:
   case COPS_OBJ_OUT_INT:
     if (c_type == 1) {          /* IPv4 */
-      tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset, 4);
+      ipv4addr = tvb_get_ipv4(tvb, offset);
       ifindex = tvb_get_ntohl(tvb, offset + 4);
       ti = proto_tree_add_text(tree, tvb, offset, 8, "Contents: IPv4 address %s, ifIndex: %u",
                                ip_to_str((guint8 *)&ipv4addr), ifindex);
@@ -1099,7 +1106,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *
                           tvb, offset, 4, ipv4addr);
       offset += 4;
     } else if (c_type == 2) {   /* IPv6 */
-      tvb_memcpy(tvb, (guint8 *)&ipv6addr, offset, sizeof ipv6addr);
+      tvb_get_ipv6(tvb, offset, &ipv6addr);
       ifindex = tvb_get_ntohl(tvb, offset + sizeof ipv6addr);
       ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, ifIndex: %u",
                                ip6_to_str(&ipv6addr), ifindex);
@@ -1143,16 +1150,16 @@ static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *
       offset += 2;
       proto_tree_add_uint(dec_tree, hf_cops_dec_flags, tvb, offset, 2, cmd_flags);
     } else if (c_type == 5) { /*COPS-PR Data*/
-      ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: %u bytes", len);
+      ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: %d bytes", len);
       dec_tree = proto_item_add_subtree(ti, ett_cops_decision);
       dissect_cops_pr_objects(tvb, offset, dec_tree, len);
     }
 
     /* PacketCable : Analyze the remaining data if available */
     if (client_type == COPS_CLIENT_PC_DQOS && c_type == 4) {
-       cops_analyze_packetcable_dqos_obj(tvb, tree, offset);
+       cops_analyze_packetcable_dqos_obj(tvb, pinfo, tree, op_code, offset);
     } else if (client_type == COPS_CLIENT_PC_MM && c_type == 4) {
-       cops_analyze_packetcable_mm_obj(tvb, tree, offset);
+       cops_analyze_packetcable_mm_obj(tvb, pinfo, tree, op_code, offset);
     }
 
     break;
@@ -1179,17 +1186,17 @@ static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *
 
     /* For PacketCable */
     if (client_type == COPS_CLIENT_PC_DQOS && c_type == 1) {
-       cops_analyze_packetcable_dqos_obj(tvb, tree, offset);
+       cops_analyze_packetcable_dqos_obj(tvb, pinfo, tree, op_code, offset);
        break;
     } else if (client_type == COPS_CLIENT_PC_MM && c_type == 1) {
-       cops_analyze_packetcable_mm_obj(tvb, tree, offset);
+       cops_analyze_packetcable_mm_obj(tvb, pinfo, tree, op_code, offset);
        break;
     }
 
     if (c_type != 2) /*Not COPS-PR data*/
       break;
 
-    ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: %u bytes", len);
+    ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: %d bytes", len);
     clientsi_tree = proto_item_add_subtree(ti, ett_cops_clientsi);
 
     dissect_cops_pr_objects(tvb, offset, clientsi_tree, len);
@@ -1225,7 +1232,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *
   case COPS_OBJ_PDPREDIRADDR:
   case COPS_OBJ_LASTPDPADDR:
     if (c_type == 1) {          /* IPv4 */
-      tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset, 4);
+      ipv4addr = tvb_get_ipv4(tvb, offset);
       tcp_port = tvb_get_ntohs(tvb, offset + 4 + 2);
       ti = proto_tree_add_text(tree, tvb, offset, 8, "Contents: IPv4 address %s, TCP Port Number: %u",
                                ip_to_str((guint8 *)&ipv4addr), tcp_port);
@@ -1235,7 +1242,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *
                           tvb, offset, 4, ipv4addr);
       offset += 4;
     } else if (c_type == 2) {   /* IPv6 */
-      tvb_memcpy(tvb, (guint8 *)&ipv6addr, offset, sizeof ipv6addr);
+      tvb_get_ipv6(tvb, offset, &ipv6addr);
       tcp_port = tvb_get_ntohs(tvb, offset + sizeof ipv6addr + 2);
       ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, TCP Port Number: %u",
                                ip6_to_str(&ipv6addr), tcp_port);
@@ -1271,7 +1278,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *
 
     break;
   default:
-    proto_tree_add_text(tree, tvb, offset, len, "Contents: %u bytes", len);
+    proto_tree_add_text(tree, tvb, offset, len, "Contents: %d bytes", len);
 
     break;
   }
@@ -1294,7 +1301,7 @@ static guchar*format_asn_value (struct variable_list *variable, subid_t *variabl
     variable->type= type_from_packet;
 
   buf_len = SPRINT_MAX_LEN; /*defined in NET-SNMP's snmp-impl.h*/
-  buf = g_malloc(buf_len);
+  buf = ep_alloc(buf_len);
   *buf = '\0';
   out_len = 0;
 
@@ -1303,7 +1310,7 @@ static guchar*format_asn_value (struct variable_list *variable, subid_t *variabl
     variable->type=mib_to_asn_type(subtree->type);
 
   if (!sprint_realloc_by_type(&buf, &buf_len, &out_len, TRUE, variable, subtree->enums, subtree->hint, NULL))
-    sprintf(buf,"%s","sprint_realloc_by_type failed");
+    g_snprintf(buf,SPRINT_MAX_LEN,"%s","sprint_realloc_by_type failed");
 
   return buf;
 }
@@ -1323,7 +1330,7 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb, guint32 offset,
 
   guint vb_length;
   gushort vb_type;
-  gchar *vb_type_name;
+  const gchar *vb_type_name;
 
   int ret;
   guint cls, con, tag;
@@ -1347,7 +1354,6 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb, guint32 offset,
 
   unsigned int i;
   gchar *buf;
-  int len;
 
   while (asnlen > 0) { /*while there is ASN stuff to be decoded*/
 
@@ -1400,7 +1406,6 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb, guint32 offset,
 
           proto_tree_add_text(tree, asn1.tvb, offset, length,
                               "Value: %s", vb_display_string);
-          g_free(vb_display_string);
         }
         else
 #endif /* HAVE_NET_SNMP */
@@ -1430,7 +1435,6 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb, guint32 offset,
 
           proto_tree_add_text(tree, asn1.tvb, offset, length, "Value %s: %s",vb_type_name, vb_display_string);
 
-          g_free(vb_display_string);
         }
         else
 #endif /* HAVE_NET_SNMP */
@@ -1461,7 +1465,6 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb, guint32 offset,
           proto_tree_add_text(tree, asn1.tvb, offset, length,
                               "Value: %s (ASN.1 type from packet: %s)", vb_display_string, vb_type_name);
 
-          g_free(vb_display_string);
         }
         else
         {
@@ -1479,17 +1482,14 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb, guint32 offset,
              * We stopped, due to a non-printable character, before we got
              * to the end of the string.
              */
-            vb_display_string = g_malloc(4*vb_length);
-            buf = &vb_display_string[0];
-            len = sprintf(buf, "%03u", vb_octet_string[0]);
-            buf += len;
+            vb_display_string = ep_alloc(4*vb_length);
+            buf = vb_display_string;
+            buf += g_snprintf(buf, 4*vb_length, "%03u", vb_octet_string[0]);
             for (i = 1; i < vb_length; i++) {
-              len = sprintf(buf, ".%03u", vb_octet_string[i]);
-              buf += len;
+              buf += g_snprintf(buf, 4*vb_length-(buf-vb_display_string), ".%03u", vb_octet_string[i]);
             }
             proto_tree_add_text(tree, asn1.tvb, offset, length,
                                 "Value: %s: %s", vb_type_name, vb_display_string);
-            g_free(vb_display_string);
           } else {
             proto_tree_add_text(tree, asn1.tvb, offset, length,
                                 "Value: %s: %.*s", vb_type_name, (int)vb_length,
@@ -1558,16 +1558,12 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb, guint32 offset,
           last_decoded_prid_oid_length=vb_oid_length;
         }
 #endif /* HAVE_NET_SNMP */
-
-      g_free(vb_display_string);
-      if(vb_display_string2)
-        g_free(vb_display_string2);
       }
       g_free(vb_oid);
       break;
 
     default:
-      g_assert_not_reached();
+      DISSECTOR_ASSERT_NOT_REACHED();
       return ASN1_ERR_WRONG_TYPE;
     }
 
@@ -1580,7 +1576,7 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb, guint32 offset,
 }
 
 static int dissect_cops_pr_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *tree,
-                                       guint8 s_num, guint8 s_type, guint16 len)
+                                       guint8 s_num, guint8 s_type, int len)
 {
   proto_item *ti;
   proto_tree *asn1_object_tree, *gperror_tree, *cperror_tree;
@@ -1668,7 +1664,7 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, guint32 offset, proto_tree
 
     break;
   default:
-    proto_tree_add_text(tree, tvb, offset, len, "Contents: %u bytes", len);
+    proto_tree_add_text(tree, tvb, offset, len, "Contents: %d bytes", len);
     break;
   }
 
@@ -1750,22 +1746,22 @@ void proto_register_cops(void)
     },
     { &hf_cops_in_int_ipv4,
       { "IPv4 address",           "cops.in-int.ipv4",
-      FT_IPv4, 0, NULL, 0xFFFF,
+      FT_IPv4, 0, NULL, 0,
       "IPv4 address in COPS IN-Int object", HFILL }
     },
     { &hf_cops_in_int_ipv6,
       { "IPv6 address",           "cops.in-int.ipv6",
-      FT_IPv6, 0, NULL, 0xFFFF,
+      FT_IPv6, 0, NULL, 0,
       "IPv6 address in COPS IN-Int object", HFILL }
     },
     { &hf_cops_out_int_ipv4,
       { "IPv4 address",           "cops.out-int.ipv4",
-      FT_IPv4, 0, NULL, 0xFFFF,
+      FT_IPv4, 0, NULL, 0,
       "IPv4 address in COPS OUT-Int object", HFILL }
     },
     { &hf_cops_out_int_ipv6,
       { "IPv6 address",           "cops.out-int.ipv6",
-      FT_IPv6, 0, NULL, 0xFFFF,
+      FT_IPv6, 0, NULL, 0,
       "IPv6 address in COPS OUT-Int", HFILL }
     },
     { &hf_cops_int_ifindex,
@@ -1820,22 +1816,22 @@ void proto_register_cops(void)
     },
     { &hf_cops_pdprediraddr_ipv4,
       { "IPv4 address",           "cops.pdprediraddr.ipv4",
-      FT_IPv4, 0, NULL, 0xFFFF,
+      FT_IPv4, 0, NULL, 0,
       "IPv4 address in COPS PDPRedirAddr object", HFILL }
     },
     { &hf_cops_pdprediraddr_ipv6,
       { "IPv6 address",           "cops.pdprediraddr.ipv6",
-      FT_IPv6, 0, NULL, 0xFFFF,
+      FT_IPv6, 0, NULL, 0,
       "IPv6 address in COPS PDPRedirAddr object", HFILL }
     },
     { &hf_cops_lastpdpaddr_ipv4,
       { "IPv4 address",           "cops.lastpdpaddr.ipv4",
-      FT_IPv4, 0, NULL, 0xFFFF,
+      FT_IPv4, 0, NULL, 0,
       "IPv4 address in COPS LastPDPAddr object", HFILL }
     },
     { &hf_cops_lastpdpaddr_ipv6,
       { "IPv6 address",           "cops.lastpdpaddr.ipv6",
-      FT_IPv6, 0, NULL, 0xFFFF,
+      FT_IPv6, 0, NULL, 0,
       "IPv6 address in COPS LastPDPAddr object", HFILL }
     },
     { &hf_cops_pdp_tcp_port,
@@ -2031,6 +2027,11 @@ void proto_register_cops(void)
         FT_UINT16, BASE_HEX, NULL, 0x00,
         "DF IP Port CCC", HFILL }
     },
+    { &hf_cops_pc_dfccc_id,
+      { "CCC ID", "cops.pc_dfccc_id",
+        FT_UINT32, BASE_DEC, NULL, 0x00,
+        "CCC ID", HFILL }
+    },
     { &hf_cops_pc_activity_count,
       { "Count", "cops.pc_activity_count",
         FT_UINT32, BASE_HEX, NULL, 0x00,
@@ -2206,12 +2207,12 @@ void proto_register_cops(void)
     },
     { &hf_cops_pcmm_classifier_src_addr,
            { "Source address", "cops.pc_mm_classifier_src_addr",
-           FT_IPv4, 0, NULL, 0xFFFF,
+           FT_IPv4, 0, NULL, 0,
            "PacketCable Multimedia Classifier Source IP Address", HFILL }
     },
     { &hf_cops_pcmm_classifier_dst_addr,
            { "Destination address", "cops.pc_mm_classifier_dst_addr",
-           FT_IPv4, 0, NULL, 0xFFFF,
+           FT_IPv4, 0, NULL, 0,
            "PacketCable Multimedia Classifier Destination IP Address", HFILL }
     },
     { &hf_cops_pcmm_classifier_src_port,
@@ -2486,11 +2487,13 @@ void proto_reg_handoff_cops(void)
  *
  */
 
-proto_item *info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octets, char *str, const value_string *vsp, int mode,gint *hf_proto_parameter)
+static proto_item *
+info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octets, const char *str, const value_string *vsp, int mode,gint *hf_proto_parameter)
 {
      proto_item *pi = NULL;
      guint8   code8  = 0;
      guint16  code16 = 0;
+     guint32  codeipv4 = 0;
      guint32  code32 = 0;
      float    codefl = 0.0;
 
@@ -2556,7 +2559,7 @@ proto_item *info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octe
              switch (mode) {
                case FMT_FLT:  codefl  = tvb_get_ntohieee_float(tvb,offset);
                               break;
-               case FMT_IPv4: tvb_memcpy(tvb, (guint8 *)&code32, offset, 4);
+               case FMT_IPv4: codeipv4 = tvb_get_ipv4(tvb, offset);
                               break;
                default:       code32  = tvb_get_ntohl(tvb,offset);
             }
@@ -2570,7 +2573,7 @@ proto_item *info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octe
                 }
                 /* Ip address format*/
                 if (mode==FMT_IPv4) {
-                   pi = proto_tree_add_ipv4(stt, *hf_proto_parameter,tvb, offset, octets, code32);
+                   pi = proto_tree_add_ipv4(stt, *hf_proto_parameter,tvb, offset, octets, codeipv4);
                    break;
                 }
                 /* Ieee float format */
@@ -2614,7 +2617,8 @@ proto_item *info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octe
 }
 
 /* Print the subtree information for cops */
-proto_tree *info_to_cops_subtree(tvbuff_t *tvb, proto_tree *st, int n, int offset, char *str) {
+static proto_tree *
+info_to_cops_subtree(tvbuff_t *tvb, proto_tree *st, int n, int offset, const char *str) {
      proto_item *tv;
 
      tv  = proto_tree_add_uint_format( st, hf_cops_subtree, tvb, offset, n, (guint)NULL, str);
@@ -2623,7 +2627,7 @@ proto_tree *info_to_cops_subtree(tvbuff_t *tvb, proto_tree *st, int n, int offse
 
 /* Cops - Section : D-QoS Transaction ID */
 static void
-cops_transaction_id(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
+cops_transaction_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *st, guint8 op_code, guint n, guint32 offset) {
 
      proto_tree *stt;
      guint16  code16;
@@ -2631,6 +2635,7 @@ cops_transaction_id(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"D-QoS Transaction ID");
+     offset += 4;
 
      /* Transaction Identifier */
      info_to_display(tvb,stt,offset,2,"D-QoS Transaction Identifier", NULL,FMT_DEC,&hf_cops_pc_transaction_id);
@@ -2643,12 +2648,12 @@ cops_transaction_id(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
             val_to_str(code16,table_cops_dqos_transaction_id, "Unknown (0x%04x)"),code16);
 
      /* Write the right data into the 'info field' on the Gui */
-     sprintf(info,"COPS %-20s - ",val_to_str(opcode_idx,cops_op_code_vals, "Unknown"));
+     g_snprintf(info,sizeof(info),"COPS %-20s - ",val_to_str(op_code,cops_op_code_vals, "Unknown"));
      strcat(info,val_to_str(code16,table_cops_dqos_transaction_id, "Unknown"));
 
-     if (check_col(cpinfo->cinfo, COL_INFO)) {
-          col_clear(cpinfo->cinfo, COL_INFO);
-          col_add_str(cpinfo->cinfo, COL_INFO,info);
+     if (check_col(pinfo->cinfo, COL_INFO)) {
+          col_clear(pinfo->cinfo, COL_INFO);
+          col_add_str(pinfo->cinfo, COL_INFO,info);
      }
 
 }
@@ -2661,6 +2666,7 @@ cops_subscriber_id_v4(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      tv = info_to_cops_subtree(tvb,st,n,offset,"Subscriber ID (IPv4)");
+     offset += 4;
 
      /* Subscriber Identifier */
      info_to_display(tvb,tv,offset,4,"Subscriber Identifier (IPv4)", NULL,FMT_IPv4,&hf_cops_pc_subscriber_id_ipv4);
@@ -2674,6 +2680,7 @@ cops_subscriber_id_v6(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      tv = info_to_cops_subtree(tvb,st,n,offset,"Subscriber ID (IPv6)");
+     offset += 4;
 
      /* Subscriber Identifier */
      info_to_display(tvb,tv,offset,16,"Subscriber Identifier (IPv6)", NULL,FMT_IPv6,&hf_cops_pc_subscriber_id_ipv6);
@@ -2687,6 +2694,7 @@ cops_gate_id(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Gate ID");
+     offset += 4;
 
      /* Gate Identifier */
      info_to_display(tvb,stt,offset,4,"Gate Identifier", NULL,FMT_HEX,&hf_cops_pc_gate_id);
@@ -2700,6 +2708,7 @@ cops_activity_count(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Activity Count");
+     offset += 4;
 
      /* Activity Count */
      info_to_display(tvb,stt,offset,4,"Count", NULL,FMT_DEC,&hf_cops_pc_activity_count);
@@ -2713,6 +2722,7 @@ cops_gate_specs(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Gate Specifications");
+     offset += 4;
 
      /* Direction */
      info_to_display(tvb,stt,offset,1,"Direction",table_cops_direction,FMT_DEC,&hf_cops_pc_direction);
@@ -2806,6 +2816,7 @@ cops_surveillance_parameters(tvbuff_t *tvb, proto_tree *st, guint n, guint32 off
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Electronic Surveillance Parameters");
+     offset += 4;
 
      /* DF IP Address for CDC */
      info_to_display(tvb,stt,offset,4,"DF IP Address for CDC", NULL,FMT_IPv4,&hf_cops_pc_dfcdc_ip);
@@ -2832,7 +2843,7 @@ cops_surveillance_parameters(tvbuff_t *tvb, proto_tree *st, guint n, guint32 off
      offset += 2;
 
      /* CCCID */
-     info_to_display(tvb,stt,offset,4,"CCCID", NULL,FMT_IPv4,&hf_cops_pc_srks_ip);
+     info_to_display(tvb,stt,offset,4,"CCCID", NULL,FMT_DEC,&hf_cops_pc_dfccc_id);
      offset += 4;
 
      /* BCID Timestamp */
@@ -2840,12 +2851,12 @@ cops_surveillance_parameters(tvbuff_t *tvb, proto_tree *st, guint n, guint32 off
      offset += 4;
 
      /* BCID Element ID */
-     bcid_str = tvb_get_string(tvb, offset, 8);
+     bcid_str = tvb_format_text(tvb, offset, 8);
      proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Element ID",bcid_str);
      offset += 8;
 
      /* BCID Time Zone */
-     bcid_str = tvb_get_string(tvb, offset, 8);
+     bcid_str = tvb_format_text(tvb, offset, 8);
      proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Time Zone",bcid_str);
      offset += 8;
 
@@ -2862,6 +2873,7 @@ cops_event_generation_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offse
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Event Generation Info");
+     offset += 4;
 
      /* Primary Record Keeping Server IP Address */
      info_to_display(tvb,stt,offset,4,"PRKS IP Address", NULL,FMT_IPv4,&hf_cops_pc_prks_ip);
@@ -2900,12 +2912,12 @@ cops_event_generation_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offse
      offset += 4;
 
      /* BCID Element ID */
-     bcid_str = tvb_get_string(tvb, offset, 8);
+     bcid_str = tvb_format_text(tvb, offset, 8);
      proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Element ID",bcid_str);
      offset += 8;
 
      /* BCID Time Zone */
-     bcid_str = tvb_get_string(tvb, offset, 8);
+     bcid_str = tvb_format_text(tvb, offset, 8);
      proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Time Zone",bcid_str);
      offset += 8;
 
@@ -2921,6 +2933,7 @@ cops_remote_gate_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Remote Gate Info");
+     offset += 4;
 
      /* CMTS IP Address */
      info_to_display(tvb,stt,offset,4,"CMTS IP Address", NULL,FMT_IPv4,&hf_cops_pc_cmts_ip);
@@ -2971,6 +2984,7 @@ cops_packetcable_reason(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"PacketCable Reason");
+     offset += 4;
 
      /* Reason Code */
      code16 = tvb_get_ntohs(tvb,offset);
@@ -2996,6 +3010,7 @@ cops_packetcable_error(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"PacketCable Error");
+     offset += 4;
 
      /* Error Code */
      info_to_display(tvb,stt,offset,2,"Error Code",table_cops_packetcable_error,FMT_DEC,&hf_cops_pc_packetcable_err_code);
@@ -3008,7 +3023,7 @@ cops_packetcable_error(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
 /* Cops - Section : Multimedia Transaction ID */
 static void
-cops_mm_transaction_id(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
+cops_mm_transaction_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *st, guint8 op_code, guint n, guint32 offset) {
 
      proto_tree *stt;
      guint16  code16;
@@ -3016,6 +3031,7 @@ cops_mm_transaction_id(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"MM Transaction ID");
+     offset += 4;
 
      /* Transaction Identifier */
      info_to_display(tvb,stt,offset,2,"Multimedia Transaction Identifier", NULL,FMT_DEC,&hf_cops_pc_transaction_id);
@@ -3028,12 +3044,12 @@ cops_mm_transaction_id(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
             val_to_str(code16,table_cops_mm_transaction_id, "Unknown (0x%04x)"),code16);
 
      /* Write the right data into the 'info field' on the Gui */
-     sprintf(info,"COPS %-20s - ",val_to_str(opcode_idx,cops_op_code_vals, "Unknown"));
+     g_snprintf(info,sizeof(info),"COPS %-20s - ",val_to_str(op_code,cops_op_code_vals, "Unknown"));
      strcat(info,val_to_str(code16,table_cops_mm_transaction_id, "Unknown"));
 
-     if (check_col(cpinfo->cinfo, COL_INFO)) {
-          col_clear(cpinfo->cinfo, COL_INFO);
-          col_add_str(cpinfo->cinfo, COL_INFO,info);
+     if (check_col(pinfo->cinfo, COL_INFO)) {
+          col_clear(pinfo->cinfo, COL_INFO);
+          col_add_str(pinfo->cinfo, COL_INFO,info);
      }
 
 }
@@ -3046,6 +3062,7 @@ cops_amid(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"AMID");
+     offset += 4;
 
      /* Gate Identifier */
      info_to_display(tvb,stt,offset,4,"Application Manager ID", NULL,FMT_DEC,&hf_cops_pcmm_amid);
@@ -3061,6 +3078,7 @@ cops_mm_gate_spec(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Gate Spec");
+     offset += 4;
 
      /* Flags */
      gs_flags = tvb_get_guint8(tvb, offset);
@@ -3115,6 +3133,7 @@ cops_classifier(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Classifier");
+     offset += 4;
 
      /* Protocol ID */
      info_to_display(tvb,stt,offset,2,"Protocol ID",NULL,FMT_DEC,&hf_cops_pcmm_classifier_protocol_id);
@@ -3160,6 +3179,7 @@ cops_flow_spec(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Flow Spec");
+     offset += 4;
 
      /* Envelope */
      info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_flow_spec_envelope);
@@ -3281,6 +3301,7 @@ cops_docsis_service_class_name(tvbuff_t *tvb, proto_tree *st, guint object_len,
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,object_len,offset,"DOCSIS Service Class Name");
+     offset += 4;
 
      /* Envelope */
      info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
@@ -3305,6 +3326,7 @@ cops_best_effort_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Best Effort Service");
+     offset += 4;
 
      /* Envelope */
      info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
@@ -3431,6 +3453,7 @@ cops_non_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Non-Real-Time Polling Service");
+     offset += 4;
 
      /* Envelope */
      info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
@@ -3569,6 +3592,7 @@ cops_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Real-Time Polling Service");
+     offset += 4;
 
      /* Envelope */
      info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
@@ -3698,6 +3722,7 @@ cops_unsolicited_grant_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Unsolicited Grant Service");
+     offset += 4;
 
      /* Envelope */
      info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
@@ -3800,6 +3825,7 @@ cops_ugs_with_activity_detection(tvbuff_t *tvb, proto_tree *st, guint n, guint32
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Unsolicited Grant Service with Activity Detection");
+     offset += 4;
 
      /* Envelope */
      info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
@@ -3926,6 +3952,7 @@ cops_downstream_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Downstream Service");
+     offset += 4;
 
      /* Envelope */
      info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
@@ -4053,6 +4080,7 @@ cops_mm_event_generation_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 of
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Event Generation Info");
+     offset += 4;
 
      /* Primary Record Keeping Server IP Address */
      info_to_display(tvb,stt,offset,4,"PRKS IP Address", NULL,FMT_IPv4,&hf_cops_pc_prks_ip);
@@ -4083,12 +4111,12 @@ cops_mm_event_generation_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 of
      offset += 4;
 
      /* BCID Element ID */
-     bcid_str = tvb_get_string(tvb, offset, 8);
+     bcid_str = tvb_format_text(tvb, offset, 8);
      proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Element ID",bcid_str);
      offset += 8;
 
      /* BCID Time Zone */
-     bcid_str = tvb_get_string(tvb, offset, 8);
+     bcid_str = tvb_format_text(tvb, offset, 8);
      proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Time Zone",bcid_str);
      offset += 8;
 
@@ -4104,6 +4132,7 @@ cops_volume_based_usage_limit(tvbuff_t *tvb, proto_tree *st, guint object_len, g
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,object_len,offset,"Volume-Based Usage Limit");
+     offset += 4;
 
      /* Usage Limit */
      proto_tree_add_item(stt, hf_cops_pcmm_volume_based_usage_limit, tvb, offset, 8,
@@ -4118,6 +4147,7 @@ cops_time_based_usage_limit(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offs
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Time-Based Usage Limit");
+     offset += 4;
 
      /* Time Limit */
      info_to_display(tvb,stt,offset,4,"Time Limit", NULL,FMT_DEC,&hf_cops_pcmm_time_based_usage_limit);
@@ -4132,6 +4162,7 @@ cops_opaque_data(tvbuff_t *tvb, proto_tree *st, guint object_len, guint32 offset
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,object_len,offset,"Opaque Data");
+     offset += 4;
 
      /* Opaque Data */
      proto_tree_add_text(stt, tvb, offset, 8,"Opaque Data");
@@ -4145,6 +4176,7 @@ cops_gate_time_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Gate Time Info");
+     offset += 4;
 
      /* Gate Time Info */
      info_to_display(tvb,stt,offset,4,"Time Committed", NULL,FMT_DEC,&hf_cops_pcmm_gate_time_info);
@@ -4159,6 +4191,7 @@ cops_gate_usage_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Gate Usage Info");
+     offset += 4;
 
      /* Gate Time Info */
      info_to_display(tvb,stt,offset,4,"Octet Count", NULL,FMT_DEC,&hf_cops_pcmm_gate_usage_info);
@@ -4174,6 +4207,7 @@ cops_packetcable_mm_error(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"PacketCable Error");
+     offset += 4;
 
      code = tvb_get_ntohs(tvb, offset);
      proto_tree_add_uint_format(stt, hf_cops_pcmm_packetcable_error_code, tvb, offset, 2, code,
@@ -4200,6 +4234,7 @@ cops_gate_state(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 
      /* Create a subtree */
      stt = info_to_cops_subtree(tvb,st,n,offset,"Gate State");
+     offset += 4;
 
      /* State */
      info_to_display(tvb,stt,offset,2,"State",pcmm_gate_state,FMT_DEC,&hf_cops_pcmm_packetcable_gate_state);
@@ -4217,7 +4252,8 @@ cops_version_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
      proto_tree *stt;
 
      /* Create a subtree */
-     stt = info_to_cops_subtree(tvb,st,n,offset,"Gate State");
+     stt = info_to_cops_subtree(tvb,st,n,offset,"Version Info");
+     offset += 4;
 
      /* State */
      info_to_display(tvb,stt,offset,2,"Major Version Number",NULL,FMT_DEC,&hf_cops_pcmm_packetcable_version_info_major);
@@ -4246,7 +4282,8 @@ cops_version_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
 #define PCDQ_SESSION_DESCRIPTION         0x0b01
 
 /* Analyze the PacketCable objects */
-void cops_analyze_packetcable_dqos_obj(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
+static void
+cops_analyze_packetcable_dqos_obj(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 op_code, guint32 offset) {
 
     gint remdata;
     guint16 object_len;
@@ -4276,13 +4313,10 @@ void cops_analyze_packetcable_dqos_obj(tvbuff_t *tvb, proto_tree *tree, guint32
        /* Glom the s_num and s_type together to make switching easier */
        num_type_glob = s_num << 8 | s_type;
 
-       /* Tune offset */
-       offset += 4;
-
        /* Perform the appropriate functions */
        switch (num_type_glob){
         case PCDQ_TRANSACTION_ID:
-               cops_transaction_id(tvb, tree, object_len, offset);
+               cops_transaction_id(tvb, pinfo, tree, op_code, object_len, offset);
                break;
         case PCDQ_SUBSCRIBER_IDv4:
                cops_subscriber_id_v4(tvb, tree, object_len, offset);
@@ -4317,7 +4351,7 @@ void cops_analyze_packetcable_dqos_obj(tvbuff_t *tvb, proto_tree *tree, guint32
        }
 
        /* Tune offset */
-       offset += object_len-4;
+       offset += object_len;
 
        /* See what we can still get from the buffer */
        remdata = tvb_length_remaining(tvb, offset);
@@ -4382,10 +4416,9 @@ decode_docsis_request_transmission_policy(tvbuff_t *tvb, guint32 offset, proto_t
 #define PCMM_VERSION_INFO                  0x1001
 
 
-void
-cops_analyze_packetcable_mm_obj(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
+static void
+cops_analyze_packetcable_mm_obj(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 op_code, guint32 offset) {
 
-    gint remdata;
     guint16 object_len;
     guint8 s_num, s_type;
     guint16 num_type_glob;
@@ -4396,8 +4429,7 @@ cops_analyze_packetcable_mm_obj(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
     }
 
     /* Do the remaining client specific objects */
-    remdata = tvb_length_remaining(tvb, offset);
-    while (remdata > 4) {
+    while (tvb_reported_length_remaining(tvb, offset) > 4) {
 
        /* In case we have remaining data, then lets try to get this analyzed */
        object_len   = tvb_get_ntohs(tvb, offset);
@@ -4413,13 +4445,10 @@ cops_analyze_packetcable_mm_obj(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
        /* Glom the s_num and s_type together to make switching easier */
        num_type_glob = s_num << 8 | s_type;
 
-       /* Tune offset */
-       offset += 4;
-
        /* Perform the appropriate functions */
        switch (num_type_glob){
         case PCMM_TRANSACTION_ID:
-               cops_mm_transaction_id(tvb, tree, object_len, offset);
+               cops_mm_transaction_id(tvb, pinfo, tree, op_code, object_len, offset);
                break;
         case PCMM_AMID:
                cops_amid(tvb, tree, object_len, offset);
@@ -4490,14 +4519,9 @@ cops_analyze_packetcable_mm_obj(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
        }
 
        /* Tune offset */
-       offset += object_len-4;
-
-       /* See what we can still get from the buffer */
-       remdata = tvb_length_remaining(tvb, offset);
+       offset += object_len;
     }
 }
 
 
 /* End of PacketCable Addition */
-
-