Clarify / add explanations for the fields
[obnox/wireshark/wip.git] / tap-radiusstat.c
index fc560b94e901a272729c4b2716e1da6a65a7f7b3..9faf97b6abd3adcd946e8dcb3980e02b27499015 100644 (file)
@@ -1,7 +1,7 @@
 /* tap-radiusstat.c
  * Copyright 2006 Alejandro Vaquero <alejandrovaquero@yahoo.com>
  *
- * 
+ * $Id$
  *
  * Wireshark - Network traffic analyzer
  * By Gerald Combs <gerald@wireshark.org>
@@ -37,7 +37,6 @@
 #include <epan/tap.h>
 #include <epan/stat_cmd_args.h>
 #include "epan/value_string.h"
-#include "register.h"
 #include <epan/dissectors/packet-radius.h>
 #include "timestats.h"
 
@@ -54,14 +53,15 @@ typedef struct _radiusstat_t {
 } radiusstat_t;
 
 static const value_string radius_message_code[] = {
-  {  0,        "Overall       "},
-  {  1,        "Access        "},
-  {  2,        "Accounting    "},
-  {  3,        "Access Passw  "},
+  {  0, "Overall       "},
+  {  1, "Access        "},
+  {  2, "Accounting    "},
+  {  3, "Access Passw  "},
   {  4, "Ascend Acce Ev"},
-  {  5, "Diconnect     "},
+  {  5, "Disconnect    "},
   {  6, "Change Filter "},
   {  7, "Other         "},
+  {  0, NULL}
 };
 
 static int
@@ -169,18 +169,15 @@ radiusstat_init(const char *optarg, void* userdata _U_)
 {
        radiusstat_t *rs;
        int i;
-       const char *filter=NULL;
        GString *error_string;
 
+       rs=g_malloc(sizeof(radiusstat_t));
        if(!strncmp(optarg,"radius,rtd,",11)){
-               filter=optarg+11;
+               rs->filter=g_strdup(optarg+11);
        } else {
-               filter="";
+               rs->filter=NULL;
        }
 
-       rs=g_malloc(sizeof(radiusstat_t));
-       rs->filter=g_strdup(filter);
-
        for(i=0;i<NUM_TIMESTATS;i++) {
                rs->rtd[i].num=0;
                rs->rtd[i].min_num=0;
@@ -198,7 +195,7 @@ radiusstat_init(const char *optarg, void* userdata _U_)
        rs->req_dup_num=0;
        rs->rsp_dup_num=0;
 
-       error_string=register_tap_listener("radius", rs, filter, NULL, radiusstat_packet, radiusstat_draw);
+       error_string=register_tap_listener("radius", rs, rs->filter, 0, NULL, radiusstat_packet, radiusstat_draw);
        if(error_string){
                /* error, we failed to attach to the tap. clean up */
                g_free(rs->filter);