http://bugs.ethereal.com/bugzilla/show_bug.cgi?id=377
[obnox/wireshark/wip.git] / tap-wspstat.c
index 670024428863a15f406802e1f9743a2fa9c590ab..1e77dd465730c492856ceb1beeaaa45a7a4403aa 100644 (file)
@@ -1,7 +1,7 @@
 /* tap-rpcstat.c
  * wspstat   2003 Jean-Michel FAYARD
  *
- * $Id: tap-wspstat.c,v 1.1 2003/09/02 22:47:58 guy Exp $
+ * $Id$
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 
 #include <string.h>
 #include "epan/packet_info.h"
-#include "tap.h"
+#include <epan/tap.h>
+#include <epan/stat_cmd_args.h>
 #include "register.h"
 #include "epan/value_string.h"
-#include "packet-wsp.h"
+#include <epan/dissectors/packet-wsp.h>
 
 /* used to keep track of the stats for a specific PDU type*/
 typedef struct _wsp_pdu_t {
-       gchar           *type;
+       const gchar     *type;
        guint32          packets;
 } wsp_pdu_t;
 /* used to keep track of RTT statistics */
 typedef struct _wsp_status_code_t {
-       gchar           *name;
+       const gchar     *name;
        guint32          packets;
 } wsp_status_code_t;
 /* used to keep track of the statictics for an entire program interface */
@@ -129,10 +130,10 @@ index2pdut(gint pdut)
        return 0;
 }
 static int
-wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, void *pri)
+wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
 {
        wspstat_t *sp=psp;
-       wsp_info_value_t *value=pri;
+       const wsp_info_value_t *value=pri;
        gint index = pdut2index(value->pdut);
        int retour=0;
 
@@ -201,22 +202,22 @@ wspstat_draw(void *psp)
        printf("\nStatus code in reply packets\n");
        printf(         "Status Code    Packets  Description\n");
        g_hash_table_foreach( sp->hash, (GHFunc) wsp_print_statuscode, 
-                       "%11d  %9d  %s\n" ) ;
+                       "       0x%02X  %9d  %s\n" ) ;
        printf("===================================================================\n");
 }
 
 /* When called, this function will create a new instance of wspstat.
  * program and version are whick onc-rpc program/version we want to
  * collect statistics for.
- * This function is called from tethereal when it parses the -Z wsp, arguments
+ * This function is called from tethereal when it parses the -z wsp, arguments
  * and it creates a new instance to store statistics in and registers this
  * new instance for the wsp tap.
  */
 static void
-wspstat_init(char *optarg)
+wspstat_init(const char *optarg)
 {
        wspstat_t *sp;
-       char *filter=NULL;
+       const char *filter=NULL;
        guint32 i;
        GString *error_string;
        wsp_status_code_t *sc;
@@ -280,5 +281,5 @@ wspstat_init(char *optarg)
 void 
 register_tap_listener_wspstat(void)
 {
-       register_ethereal_tap("wsp,stat,", wspstat_init);
+       register_stat_cmd_arg("wsp,stat,", wspstat_init);
 }