change all file offsets from long to gint64 so we can - theoretically - handle files...
[obnox/wireshark/wip.git] / tap-sipstat.c
index 791c7b1fc5b5ac428b8043276531de5a690f6f6a..0862c4152df610a028bdfc6057c29069031962b5 100644 (file)
@@ -1,11 +1,11 @@
 /* tap_sipstat.c
- * sip message counter for ethereal
+ * sip message counter for wireshark
  *
  * $Id$
  * Copied from gtk/sip_stat.c and tap-httpstat.c
  *
- * 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
@@ -35,7 +35,8 @@
 
 #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 <epan/dissectors/packet-sip.h>
@@ -55,7 +56,7 @@ typedef struct _sip_stats_t {
 typedef struct _sip_response_code_t {
        guint32          packets;               /* 3 */
        guint            response_code;         /* 404 */
-       gchar           *name;                  /* Not Found */
+       const gchar     *name;                  /* Not Found */
        sipstat_t       *sp;
 } sip_response_code_t;
 
@@ -96,6 +97,7 @@ static const value_string vals_status_code[] = {
     { 407, "Proxy Authentication Required"},
     { 408, "Request Timeout"},
     { 410, "Gone"},
+    { 412, "Conditional Request Failed"},
     { 413, "Request Entity Too Large"},
     { 414, "Request-URI Too Long"},
     { 415, "Unsupported Media Type"},
@@ -103,6 +105,7 @@ static const value_string vals_status_code[] = {
     { 420, "Bad Extension"},
     { 421, "Extension Required"},
     { 423, "Interval Too Brief"},
+    { 429, "Provide Referrer Identity"},
     { 480, "Temporarily Unavailable"},
     { 481, "Call/Transaction Does Not Exist"},
     { 482, "Loop Detected"},
@@ -115,6 +118,7 @@ static const value_string vals_status_code[] = {
     { 489, "Bad Event"},
     { 491, "Request Pending"},
     { 493, "Undecipherable"},
+    { 494, "Security Agreement Required"},
     { 499, "Client Error - Others"},
 
     { 500, "Server Internal Error"},
@@ -217,9 +221,9 @@ sipstat_reset(void *psp  )
 
 /* Main entry point to SIP tap */
 static int
-sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, void *pri)
+sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
 {
-    sip_info_value_t *value=pri;
+    const sip_info_value_t *value=pri;
     sipstat_t *sp = (sipstat_t *)psp;
     
     /* Total number of packets, including continuation packets */
@@ -344,10 +348,10 @@ sipstat_draw(void *psp  )
 }
 
 static void
-sipstat_init(char *optarg)
+sipstat_init(const char *optarg, void* userdata _U_)
 {
        sipstat_t *sp;
-       char *filter=NULL;
+       const char *filter=NULL;
        GString *error_string;
 
        if (strncmp (optarg, "sip,stat,", 9) == 0){
@@ -376,7 +380,7 @@ sipstat_init(char *optarg)
                /* error, we failed to attach to the tap. clean up */
                g_free(sp->filter);
                g_free(sp);
-               fprintf (stderr, "tethereal: Coulnd't register sip,stat tap: %s\n",
+               fprintf (stderr, "tshark: Couldn't register sip,stat tap: %s\n",
                                error_string->str);
                g_string_free(error_string, TRUE);
                exit(1);
@@ -390,5 +394,5 @@ sipstat_init(char *optarg)
 void
 register_tap_listener_sipstat(void)
 {
-       register_ethereal_tap("sip,stat", sipstat_init);
+       register_stat_cmd_arg("sip,stat", sipstat_init,NULL);
 }