For proto_tree_add_item(..., proto_xxx, ...)use ENC_NA as the encoding arg.
[obnox/wireshark/wip.git] / epan / dissectors / packet-pcli.c
index a957ac5669b7b62ed51b486ed9f90eb47a8dcc2a..d193367465a8ab03403524b86ae383daf4c6fbd5 100644 (file)
 #include "config.h"
 #endif
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
 #include <time.h>
-#include <string.h>
 
 #include <glib.h>
 #include <epan/packet.h>
@@ -63,7 +61,7 @@ static int hf_pcli_cccid = -1;
 
 static int ett_pcli = -1;
 
-/* 
+/*
  * Here are the global variables associated with the preferences
  * for pcli
  */
@@ -73,17 +71,15 @@ static guint global_udp_port_pcli = UDP_PORT_PCLI;
 /* A static handle for the ip dissector */
 static dissector_handle_t ip_handle;
 
-static void 
+static void
 dissect_pcli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
-  
+
   guint32 cccid;
   proto_tree *ti,*pcli_tree;
   tvbuff_t * next_tvb;
 
   /* Set the protocol column */
-  if(check_col(pinfo->cinfo,COL_PROTOCOL)){
-    col_add_str(pinfo->cinfo,COL_PROTOCOL,"PCLI");
-  }
+  col_set_str(pinfo->cinfo, COL_PROTOCOL, "PCLI");
 
   /* Get the CCCID */
   cccid = tvb_get_ntohl(tvb,0);
@@ -93,13 +89,13 @@ dissect_pcli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
     col_add_fstr(pinfo->cinfo, COL_INFO, "CCCID: %u",cccid);
   }
 
-  /* 
+  /*
    *If we have a non-null tree (ie we are building the proto_tree
    * instead of just filling out the columns ), then add a PLCI
    * tree node and put a CCCID header element under it.
    */
   if(tree) {
-    ti = proto_tree_add_item(tree,proto_pcli,tvb,0,0,FALSE);
+    ti = proto_tree_add_item(tree,proto_pcli,tvb,0,0,ENC_NA);
     pcli_tree = proto_item_add_subtree(ti,ett_pcli);
     proto_tree_add_uint(pcli_tree,hf_pcli_cccid,tvb,
                        0,4,cccid);
@@ -108,11 +104,11 @@ dissect_pcli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
   /*
    * Hand off to the IP dissector.
    */
-  next_tvb = tvb_new_subset(tvb,4,-1,-1);
+  next_tvb = tvb_new_subset_remaining(tvb,4);
   call_dissector(ip_handle,next_tvb,pinfo,tree);
 }
 
-void 
+void
 proto_register_pcli(void) {
   static hf_register_info hf[] = {
     { &hf_pcli_cccid,
@@ -155,10 +151,10 @@ proto_reg_handoff_pcli(void) {
     ip_handle = find_dissector("ip");
     pcli_initialized = TRUE;
   } else {
-    dissector_delete("udp.port",udp_port_pcli,pcli_handle);
+    dissector_delete_uint("udp.port",udp_port_pcli,pcli_handle);
   }
 
   udp_port_pcli = global_udp_port_pcli;
-  
-  dissector_add("udp.port",global_udp_port_pcli,pcli_handle);
+
+  dissector_add_uint("udp.port",global_udp_port_pcli,pcli_handle);
 }