add new function tvb_get_ephemeral_stringz()
[obnox/wireshark/wip.git] / tap-httpstat.c
index f4a024cec41a5f912bf25ebee1b60033eae15bff..6d4db1306376273d73cc79acb18daf29f19efc24 100644 (file)
@@ -1,7 +1,7 @@
 /* tap-httpstat.c
  * tap-httpstat   2003 Jean-Michel FAYARD
  *
- * $Id: tap-httpstat.c,v 1.2 2003/09/02 23:09:10 guy Exp $
+ * $Id$
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #endif
 
 #include <stdio.h>
+#include <string.h>
 
 #include "epan/packet_info.h"
 #include "epan/value_string.h"
-#include "tap.h"
+#include <epan/tap.h>
 #include "register.h"
-#include "packet-http.h"
-#include <string.h>
+#include <epan/dissectors/packet-http.h>
 
        
 /* used to keep track of the statictics for an entire program interface */
@@ -48,8 +48,8 @@ typedef struct _http_stats_t {
  * which means we captured 3 reply http/1.1 404 Not Found */
 typedef struct _http_response_code_t {
        guint32          packets;               /* 3 */
-       guint            response_code; /* 404 */
-       gchar           *name;                  /* Not Found */
+       guint            response_code;         /* 404 */
+       const gchar     *name;                  /* Not Found */
        httpstat_t      *sp;
 } http_response_code_t;
 
@@ -144,7 +144,7 @@ http_draw_hash_requests( gchar *key _U_ , http_request_methode_t *data, gchar *
 static void
 http_draw_hash_responses( gint * key _U_ , http_response_code_t *data, char * format)
 {
-       if (data==NULL){
+       if (data==NULL) {
                g_warning("C'est quoi ce borderl key=%d\n", *key);
                exit(EXIT_FAILURE);
        }
@@ -187,9 +187,9 @@ httpstat_reset(void *psp  )
 }
 
 static int
-httpstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, void *pri)
+httpstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
 {
-       http_info_value_t *value=pri;
+       const http_info_value_t *value=pri;
        httpstat_t *sp=(httpstat_t *) psp;
 
        /* We are only interested in reply packets with a status code */
@@ -198,7 +198,7 @@ httpstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, voi
                guint *key=g_malloc( sizeof(guint) );
                http_response_code_t *sc;
                
-               *key=value->response_code ;
+               *key=value->response_code;
                sc =  g_hash_table_lookup( 
                                sp->hash_responses, 
                                key);
@@ -255,7 +255,6 @@ httpstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, voi
 }
 
 
-
 static void
 httpstat_draw(void *psp  )
 {
@@ -281,11 +280,11 @@ httpstat_draw(void *psp  )
 /* When called, this function will create a new instance of gtk_httpstat.
  */
 static void
-gtk_httpstat_init(char *optarg)
+gtk_httpstat_init(const char *optarg)
 {
        httpstat_t *sp;
-       char *filter=NULL;
-       GString         *error_string;
+       const char *filter=NULL;
+       GString *error_string;
        
        if (!strncmp (optarg, "http,stat,", 10)){
                filter=optarg+10;
@@ -314,7 +313,7 @@ gtk_httpstat_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 http,stat tap: %s\n",
+               fprintf (stderr, "tethereal: Couldn't register http,stat tap: %s\n",
                                error_string->str);
                g_string_free(error_string, TRUE);
                exit(1);
@@ -326,5 +325,5 @@ gtk_httpstat_init(char *optarg)
 void
 register_tap_listener_gtkhttpstat(void)
 {
-       register_ethereal_tap("http,stat,", gtk_httpstat_init);
+       register_tap_listener_cmd_arg("http,stat,", gtk_httpstat_init);
 }