Make the frame_data_sequence structure opaque, and move some other
[obnox/wireshark/wip.git] / tap-bootpstat.c
index 83d304091a86004c3f0f6529496dc6adada71c9b..041364955d545644b283637173181cb0d1cecb39 100644 (file)
@@ -6,17 +6,17 @@
  * 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
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -32,7 +32,6 @@
 #include "epan/packet_info.h"
 #include <epan/tap.h>
 #include <epan/stat_cmd_args.h>
-#include "register.h"
 
 
 typedef const char* bootp_info_value_t;
@@ -61,8 +60,8 @@ dhcp_free_hash( gpointer key _U_ , gpointer value, gpointer user_data _U_ )
 */
 
 static void
-dhcp_reset_hash(gchar *key _U_ , dhcp_message_type_t *data, gpointer ptr _U_ ) 
-{      
+dhcp_reset_hash(gchar *key _U_ , dhcp_message_type_t *data, gpointer ptr _U_ )
+{
        data->packets = 0;
 }
 
@@ -80,7 +79,7 @@ static void
 dhcpstat_reset(void *psp)
 {
        dhcpstat_t *sp=psp;
-       g_hash_table_foreach( sp->hash, (GHFunc)dhcp_reset_hash, NULL); 
+       g_hash_table_foreach( sp->hash, (GHFunc)dhcp_reset_hash, NULL);
 }
 static int
 dhcpstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
@@ -91,8 +90,8 @@ dhcpstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
 
        if (sp==NULL)
                return 0;
-       sc = g_hash_table_lookup( 
-                       sp->hash, 
+       sc = g_hash_table_lookup(
+                       sp->hash,
                        value);
        if (!sc) {
                sc = g_malloc( sizeof(dhcp_message_type_t) );
@@ -119,7 +118,7 @@ dhcpstat_draw(void *psp)
        printf("\n");
        printf("===================================================================\n");
 
-       if (sp->filter==NULL) 
+       if (sp->filter==NULL)
                printf("BOOTP Statistics\n");
        else
                printf("BOOTP Statistics with filter %s\n",  sp->filter);
@@ -128,7 +127,7 @@ dhcpstat_draw(void *psp)
        g_hash_table_foreach( sp->hash, (GHFunc) dhcp_draw_message_type,
                        "%23s %-9d\n" );
        printf("===================================================================\n");
-       
+
 }
 
 
@@ -142,27 +141,27 @@ dhcpstat_init(const char *optarg, void* userdata _U_)
        dhcpstat_t *sp;
        const char      *filter=NULL;
        GString         *error_string;
-       
+
        if (!strncmp (optarg, "bootp,stat,", 11)){
                filter=optarg+11;
        } else {
                filter=NULL;
        }
-       
+
        sp = g_malloc( sizeof(dhcpstat_t) );
        sp->hash = g_hash_table_new( g_str_hash, g_str_equal);
        if(filter){
-               sp->filter=g_malloc(strlen(filter)+1);
-               strcpy(sp->filter,filter);
+               sp->filter=g_strdup(filter);
        } else {
                sp->filter=NULL;
        }
        sp->index = 0;          /* Nothing to display yet */
 
-       error_string = register_tap_listener( 
+       error_string = register_tap_listener(
                        "bootp",
                        sp,
                        filter,
+                       0,
                        dhcpstat_reset,
                        dhcpstat_packet,
                        dhcpstat_draw);