Update:
[obnox/wireshark/wip.git] / tap-h225rassrt.c
index 7158a726928f57d4d2e64a60d4a1aeed208fa1ae..a0c6d8e37e85c82e4dd759a81640e3c3dc574bc8 100644 (file)
 #endif
 
 #include <string.h>
+#include "epan/packet.h"
 #include "epan/packet_info.h"
 #include <epan/tap.h>
 #include <epan/stat_cmd_args.h>
 #include "epan/value_string.h"
-#include "register.h"
 #include <epan/dissectors/packet-h225.h>
 #include "timestats.h"
 
@@ -168,7 +168,6 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
 
        default:
                return 0;
-               break;
        }
        return 1;
 }
@@ -215,28 +214,24 @@ static void
 h225rassrt_init(const char *optarg, void* userdata _U_)
 {
        h225rassrt_t *hs;
-       const char *filter=NULL;
        GString *error_string;
 
+       hs = g_malloc(sizeof(h225rassrt_t));
        if(!strncmp(optarg,"h225,srt,",9)){
-               filter=optarg+9;
+               hs->filter=g_strdup(optarg+9);
        } else {
-               filter="";
+               hs->filter=NULL;
        }
 
-       hs = g_malloc(sizeof(h225rassrt_t));
-       hs->filter=g_malloc(strlen(filter)+1);
-       strcpy(hs->filter, filter);
-
        h225rassrt_reset(hs);
 
-       error_string=register_tap_listener("h225", hs, filter, NULL, h225rassrt_packet, h225rassrt_draw);
+       error_string=register_tap_listener("h225", hs, hs->filter, 0, NULL, h225rassrt_packet, h225rassrt_draw);
        if(error_string){
                /* error, we failed to attach to the tap. clean up */
                g_free(hs->filter);
                g_free(hs);
 
-               fprintf(stderr, "twireshark: Couldn't register h225,srt tap: %s\n",
+               fprintf(stderr, "tshark: Couldn't register h225,srt tap: %s\n",
                    error_string->str);
                g_string_free(error_string, TRUE);
                exit(1);