* Routines for X11 dissection
* Copyright 2000, Christophe Tronche <ch.tronche@computer.org>
*
- * $Id: packet-x11.c,v 1.23 2001/10/04 00:30:23 guy Exp $
+ * $Id: packet-x11.c,v 1.26 2001/12/03 03:59:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
static gint ett_x11 = -1;
static gint ett_x11_request = -1;
+static dissector_handle_t data_handle;
+
#define TCP_PORT_X11 6000
#define TCP_PORT_X11_2 6001
#define TCP_PORT_X11_3 6002
static void listOfString8(tvbuff_t *tvb, int hf, int hf_item, int length)
{
char *s = NULL;
- int allocated = 0;
+ guint allocated = 0;
proto_tree *tt;
int i;
while(length--) {
unsigned l = VALUE8(tvb, cur_offset);
- if (allocated < l + 1) {
+ if (allocated < (l + 1)) {
/* g_realloc doesn't work ??? */
g_free(s);
s = g_malloc(l + 1);
truncated = TRUE;
l = STRING16_MAX_DISPLAYED_LENGTH;
}
- if (*sLength < l + 3) {
+ if (*sLength < (int) l + 3) {
g_free(*s);
*s = g_malloc(l + 3);
*sLength = l + 3;
proto_tree *ttt;
gint8 delta = VALUE8(tvb, cur_offset + 1);
if (sizeIs16) l += l;
- if (allocated < l + 1) {
+ if ((unsigned) allocated < l + 1) {
/* g_realloc doesn't work ??? */
g_free(s);
s = g_malloc(l + 1);
little_endian = guess_byte_ordering(tvb, pinfo);
left = dissect_x11_request_loop(tvb, x11_tree);
if (left)
- dissect_data(tvb, cur_offset, pinfo, x11_tree);
+ call_dissector(data_handle,tvb_new_subset(tvb, cur_offset,-1, tvb_reported_length_remaining(tvb,cur_offset)), pinfo, x11_tree);
}
static void
/* Code to process the packet goes here */
- dissect_data(tvb, 0, pinfo, x11_tree);
+ call_dissector(data_handle,tvb, pinfo, x11_tree);
}
}
void
proto_reg_handoff_x11(void)
{
- dissector_add("tcp.port", TCP_PORT_X11, dissect_x11, proto_x11);
- dissector_add("tcp.port", TCP_PORT_X11_2, dissect_x11, proto_x11);
- dissector_add("tcp.port", TCP_PORT_X11_3, dissect_x11, proto_x11);
+ dissector_handle_t x11_handle;
+
+ x11_handle = create_dissector_handle(dissect_x11, proto_x11);
+ dissector_add("tcp.port", TCP_PORT_X11, x11_handle);
+ dissector_add("tcp.port", TCP_PORT_X11_2, x11_handle);
+ dissector_add("tcp.port", TCP_PORT_X11_3, x11_handle);
+ data_handle = find_dissector("data");
}