*
* $Id$
*
- * 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
#include "epan/packet_info.h"
#include "epan/value_string.h"
-#include "tap.h"
+#include <epan/tap.h>
+#include <epan/stat_cmd_args.h>
#include "register.h"
#include <epan/dissectors/packet-http.h>
typedef struct _http_response_code_t {
guint32 packets; /* 3 */
guint response_code; /* 404 */
- gchar *name; /* Not Found */
+ const gchar *name; /* Not Found */
httpstat_t *sp;
} http_response_code_t;
http_draw_hash_responses( gint * key _U_ , http_response_code_t *data, char * format)
{
if (data==NULL) {
- g_warning("C'est quoi ce borderl key=%d\n", *key);
+ g_warning("No data available, key=%d\n", *key);
exit(EXIT_FAILURE);
}
if (data->packets==0)
httpstat_reset(void *psp )
{
httpstat_t *sp=psp;
- if (!sp) {
- g_hash_table_foreach( sp->hash_responses, (GHFunc)http_reset_hash_responses, NULL);
- g_hash_table_foreach( sp->hash_responses, (GHFunc)http_reset_hash_requests, NULL);
- }
+
+ g_hash_table_foreach( sp->hash_responses, (GHFunc)http_reset_hash_responses, NULL);
+ g_hash_table_foreach( sp->hash_requests, (GHFunc)http_reset_hash_requests, NULL);
+
}
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 */
/* 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,void* userdata _U_)
{
httpstat_t *sp;
- char *filter=NULL;
+ const char *filter=NULL;
GString *error_string;
if (!strncmp (optarg, "http,stat,", 10)){
/* 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, "tshark: Couldn't register http,stat tap: %s\n",
error_string->str);
g_string_free(error_string, TRUE);
exit(1);
void
register_tap_listener_gtkhttpstat(void)
{
- register_ethereal_tap("http,stat,", gtk_httpstat_init);
+ register_stat_cmd_arg("http,stat,", gtk_httpstat_init,NULL);
}