From Cyril Margaria:
[obnox/wireshark/wip.git] / tap-h225counter.c
index 294e2e1f41dc06be51cd4ee909e49fd69fa51746..29afbdacec2cf2618f8c4efaafc22bb8c7589bb4 100644 (file)
@@ -1,11 +1,11 @@
 /* tap_h225counter.c
- * h225 message counter for ethereal
+ * h225 message counter for wireshark
  * Copyright 2003 Lars Roland
  *
- * $Id: tap-h225counter.c,v 1.2 2003/12/15 04:23:54 guy Exp $
+ * $Id$
  *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * 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 <string.h>
 #include "epan/packet_info.h"
-#include "tap.h"
+#include <epan/tap.h>
+#include <epan/stat_cmd_args.h>
 #include "epan/value_string.h"
 #include "register.h"
-#include "packet-h225.h"
+#include <epan/dissectors/packet-h225.h>
 
 /* following values represent the size of their valuestring arrays */
 
@@ -130,10 +131,10 @@ h225counter_reset(void *phs)
 }
 
 static int
-h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, void *phi)
+h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
 {
        h225counter_t *hs=(h225counter_t *)phs;
-       h225_packet_info *pi=phi;
+       const h225_packet_info *pi=phi;
 
        switch (pi->msg_type) {
 
@@ -360,7 +361,7 @@ h225counter_draw(void *phs)
        printf("Call Signalling:\n");
        for(i=0;i<=CS_MSG_TYPES;i++) {
                if(hs->cs_msg[i]!=0) {
-                       printf("  %s : %u\n", val_to_str(i,h323_message_body_vals,"unknown cs-messages   "), hs->cs_msg[i]);
+                       printf("  %s : %u\n", val_to_str(i,T_h323_message_body_vals,"unknown cs-messages   "), hs->cs_msg[i]);
                        /* reason counter */
                        switch(i) {
                        case 5: /* ReleaseComplete */
@@ -387,17 +388,16 @@ h225counter_draw(void *phs)
 
 
 static void
-h225counter_init(char *optarg)
+h225counter_init(const char *optarg, void* userdata _U_)
 {
        h225counter_t *hs;
-       char *filter=NULL;
+       const char *filter=NULL;
        GString *error_string;
 
        if(!strncmp(optarg,"h225,counter,",13)){
                filter=optarg+13;
        } else {
-               filter=g_malloc(1);
-               *filter='\0';
+               filter="";
        }
 
        hs = g_malloc(sizeof(h225counter_t));
@@ -412,7 +412,7 @@ h225counter_init(char *optarg)
                g_free(hs->filter);
                g_free(hs);
 
-               fprintf(stderr, "tethereal: Couldn't register h225,counter tap: %s\n",
+               fprintf(stderr, "tshark: Couldn't register h225,counter tap: %s\n",
                    error_string->str);
                g_string_free(error_string, TRUE);
                exit(1);
@@ -423,5 +423,5 @@ h225counter_init(char *optarg)
 void
 register_tap_listener_h225counter(void)
 {
-       register_ethereal_tap("h225,counter", h225counter_init);
+       register_stat_cmd_arg("h225,counter", h225counter_init,NULL);
 }