#include <epan/ipproto.h>
#include <epan/strutil.h>
#include <epan/tap.h>
+#include <epan/tvbuff-int.h>
-#include <../globals.h>
#include <../simple_dialog.h>
+#include "gtkglobals.h"
#include "gtk/follow_stream.h"
#include <gtk/keys.h>
#include <gtk/main.h>
#include "gtk/follow_udp.h"
-
+#include "gtk/utf8_entities.h"
static int
udp_queue_packet_data(void *tapdata, packet_info *pinfo,
follow_record_t *follow_record;
follow_info_t *follow_info = tapdata;
const tvbuff_t *next_tvb = data;
-
+
follow_record = g_malloc(sizeof(follow_record_t));
follow_record->data = g_byte_array_sized_new(next_tvb->length);
if (ADDRESSES_EQUAL(&follow_info->client_ip, &pinfo->src) &&
follow_info->client_port == pinfo->srcport)
follow_record->is_server = FALSE;
- else
+ else
follow_record->is_server = TRUE;
/* update stream counter */
a dissection routine on belongs (this might be the most recently
selected packet, or it might be the last packet in the file). */
void
-follow_udp_stream_cb(GtkWidget *w, gpointer data _U_)
+follow_udp_stream_cb(GtkWidget *w _U_, gpointer data _U_)
{
- GtkWidget *filter_te;
+ GtkWidget *filter_te, *filter_cm;
gchar *follow_filter;
const gchar *previous_filter;
int filter_out_filter_len, previous_filter_len;
"sure you have a UDP packet selected.");
return;
}
-
+
follow_info = g_new0(follow_info_t, 1);
follow_info->follow_type = FOLLOW_UDP;
}
/* Set the display filter entry accordingly */
- filter_te = g_object_get_data(G_OBJECT(w), E_DFILTER_TE_KEY);
+ filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY);
+ filter_te = gtk_bin_get_child(GTK_BIN(filter_cm));
/* needed in follow_filter_out_stream(), is there a better way? */
follow_info->filter_te = filter_te;
/* allocate our new filter. API claims g_malloc terminates program on failure */
/* my calc for max alloc needed is really +10 but when did a few extra bytes hurt ? */
- previous_filter_len = previous_filter?strlen(previous_filter):0;
- filter_out_filter_len = strlen(follow_filter) + previous_filter_len + 16;
+ previous_filter_len = previous_filter?(int)strlen(previous_filter):0;
+ filter_out_filter_len = (int)strlen(follow_filter) + previous_filter_len + 16;
follow_info->filter_out_filter = (gchar *)g_malloc(filter_out_filter_len);
/* append the negation */
/* data will be passed via tap callback*/
msg = register_tap_listener("udp_follow", follow_info, follow_filter,
- NULL, udp_queue_packet_data, NULL);
+ 0, NULL, udp_queue_packet_data, NULL);
if (msg) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't register udp_follow tap: %s\n",
msg->str);
+ g_free(follow_info->filter_out_filter);
g_free(follow_info);
+ g_free(follow_filter);
return;
}
memcpy(&ipaddr, stats.ip_address[1], 4);
hostname1 = get_hostname(ipaddr);
}
-
+
port0 = get_udp_port(stats.port[0]);
port1 = get_udp_port(stats.port[1]);
-
+
follow_info->is_ipv6 = stats.is_ipv6;
/* Both Stream Directions */
both_directions_string = g_strdup_printf("Entire conversation (%u bytes)", follow_info->bytes_written[0] + follow_info->bytes_written[1]);
-
+
if(follow_info->client_port == stats.port[0]) {
server_to_client_string =
- g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
+ g_strdup_printf("%s:%s " UTF8_RIGHTWARDS_ARROW " %s:%s (%u bytes)",
hostname0, port0,
hostname1, port1,
follow_info->bytes_written[0]);
-
+
client_to_server_string =
- g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
+ g_strdup_printf("%s:%s " UTF8_RIGHTWARDS_ARROW " %s:%s (%u bytes)",
hostname1, port1,
hostname0, port0,
follow_info->bytes_written[1]);
} else {
server_to_client_string =
- g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
+ g_strdup_printf("%s:%s " UTF8_RIGHTWARDS_ARROW " %s:%s (%u bytes)",
hostname1, port1,
hostname0, port0,
follow_info->bytes_written[0]);
-
+
client_to_server_string =
- g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
+ g_strdup_printf("%s:%s " UTF8_RIGHTWARDS_ARROW " %s:%s (%u bytes)",
hostname0, port0,
hostname1, port1,
follow_info->bytes_written[1]);
#define FLT_BUF_SIZE 1024
/*
- * XXX - the routine pointed to by "print_line" doesn't get handed lines,
+ * XXX - the routine pointed to by "print_line_fcn_p" doesn't get handed lines,
* it gets handed bufferfuls. That's fine for "follow_write_raw()"
* and "follow_add_to_gtk_text()", but, as "follow_print_text()" calls
* the "print_line()" routine from "print.c", and as that routine might
*/
frs_return_t
follow_read_udp_stream(follow_info_t *follow_info,
- gboolean (*print_line)(char *, size_t, gboolean, void *),
+ gboolean (*print_line_fcn_p)(char *, size_t, gboolean, void *),
void *arg)
{
- int iplen;
guint32 global_client_pos = 0, global_server_pos = 0;
guint32 server_packet_count = 0;
guint32 client_packet_count = 0;
follow_record_t *follow_record;
char *buffer;
- iplen = (follow_info->is_ipv6) ? 16 : 4;
-
+
for (cur = follow_info->payload; cur; cur = g_list_next(cur)) {
follow_record = cur->data;
skip = FALSE;
if (!skip) {
buffer = g_memdup(follow_record->data->data,
follow_record->data->len);
-
- frs_return = follow_show(follow_info, print_line,
+
+ frs_return = follow_show(follow_info, print_line_fcn_p,
buffer,
follow_record->data->len,
follow_record->is_server, arg,
- global_pos,
+ global_pos,
&server_packet_count,
&client_packet_count);
g_free(buffer);