As suggested by Kovarththanan Rajaratnam in https://bugs.wireshark.org/bugzilla/show_...
[obnox/wireshark/wip.git] / plugins / docsis / packet-bpkmrsp.c
index 3c0c1bba488cb7c21962fe335788b6b15065f6bb..c92e5f2bce846f1fa41983421fe7ae80e038a403 100644 (file)
@@ -1,9 +1,11 @@
 /* packet-bpkmrsp.c
  * Routines for Baseline Privacy Key Management Response dissection
- * Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
+ * Copyright 2002, Anand V. Narwani <anand[AT]narwani.org>
  *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
  * This program is free software; you can redistribute it and/or
 # include "config.h"
 #endif
 
-#include "plugins/plugin_api.h"
-#include "plugins/plugin_api_defs.h"
-#include "moduleinfo.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
-#include <gmodule.h>
-
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 
 /* Initialize the protocol and registered fields */
@@ -90,24 +70,18 @@ dissect_bpkmrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
   proto_item *it;
   proto_tree *bpkmrsp_tree;
   guint8 code;
-  guint16 attrs_len;
   tvbuff_t *attrs_tvb;
 
 
   code = tvb_get_guint8 (tvb, 0);
 
-  if (check_col (pinfo->cinfo, COL_INFO))
-    {
-      col_clear (pinfo->cinfo, COL_INFO);
-      col_add_fstr (pinfo->cinfo, COL_INFO, "BPKM Response (%s)",
-                   val_to_str (code, code_field_vals, "%s"));
-    }
+  col_add_fstr (pinfo->cinfo, COL_INFO, "BPKM Response (%s)",
+           val_to_str (code, code_field_vals, "Unknown code %u"));
 
   if (tree)
     {
       it =
-       proto_tree_add_protocol_format (tree, proto_docsis_bpkmrsp, tvb, 0,
-                                       tvb_length_remaining (tvb, 0),
+       proto_tree_add_protocol_format (tree, proto_docsis_bpkmrsp, tvb, 0, -1,
                                        "BPKM Response Message");
       bpkmrsp_tree = proto_item_add_subtree (it, ett_docsis_bpkmrsp);
       proto_tree_add_item (bpkmrsp_tree, hf_docsis_bpkmrsp_code, tvb, 0, 1,
@@ -119,18 +93,14 @@ dissect_bpkmrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
     }
 
   /* Code to Call subdissector */
-  attrs_len = tvb_length_remaining (tvb, 4);
-  attrs_tvb = tvb_new_subset (tvb, 4, attrs_len, attrs_len);
+  attrs_tvb = tvb_new_subset_remaining (tvb, 4);
   call_dissector (attrs_handle, attrs_tvb, pinfo, tree);
-
-
-
 }
 
 
 
 
-/* Register the protocol with Ethereal */
+/* Register the protocol with Wireshark */
 
 /* this format is require because a script is used to build the C function
    that calls all the protocol registration.
@@ -144,24 +114,24 @@ proto_register_docsis_bpkmrsp (void)
 /* Setup list of header fields  See Section 1.6.1 for details*/
   static hf_register_info hf[] = {
     {&hf_docsis_bpkmrsp,
-     {"BPKM Response Message", "docsis.bpkmrsp",
-      FT_BYTES, BASE_HEX, NULL, 0x0,
-      "BPKM Response Message", HFILL}
+     {"BPKM Response Message", "docsis_bpkmrsp",
+      FT_BYTES, BASE_NONE, NULL, 0x0,
+      NULL, HFILL}
      },
     {&hf_docsis_bpkmrsp_code,
-     {"BPKM Code", "docsis.bpkmrsp.code",
+     {"BPKM Code", "docsis_bpkmrsp.code",
       FT_UINT8, BASE_DEC, VALS (code_field_vals), 0x0,
       "BPKM Response Message", HFILL}
      },
     {&hf_docsis_bpkmrsp_ident,
-     {"BPKM Identifier", "docsis.bpkmrsp.ident",
+     {"BPKM Identifier", "docsis_bpkmrsp.ident",
       FT_UINT8, BASE_DEC, NULL, 0x0,
-      "BPKM Identifier", HFILL}
+      NULL, HFILL}
      },
     {&hf_docsis_bpkmrsp_length,
-     {"BPKM Length", "docsis.bpkmrsp.length",
+     {"BPKM Length", "docsis_bpkmrsp.length",
       FT_UINT16, BASE_DEC, NULL, 0x0,
-      "BPKM Length", HFILL}
+      NULL, HFILL}
      },
   };