/* 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 */
* 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;
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);
}
}
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 */
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);
}
-
static void
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;
/* 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);
void
register_tap_listener_gtkhttpstat(void)
{
- register_ethereal_tap("http,stat,", gtk_httpstat_init);
+ register_tap_listener_cmd_arg("http,stat,", gtk_httpstat_init);
}