summaryrefslogtreecommitdiff
path: root/packet-x11.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-04-17 08:33:09 +0000
committerGuy Harris <guy@alum.mit.edu>2002-04-17 08:33:09 +0000
commite78141670a5ec5c647ac23878bb9564ca768258e (patch)
treef40c646b032dbb6b768444e74f90bef778c3b825 /packet-x11.c
parent43141af937f24e1200fa40d27ad4f22a0360eb67 (diff)
downloadwireshark-e78141670a5ec5c647ac23878bb9564ca768258e.tar.gz
In a ChangeHosts request, display 4-byte Internet addresses as IPv4
addresses. When showing a list of keysyms, build the text representation of the item for the list by appending keysyms to the text of the item as dissected; this fixes a bug in the display of those keysums, and means that we don't build a text string with the keysyms if we're not generating the text representation. svn path=/trunk/; revision=5179
Diffstat (limited to 'packet-x11.c')
-rw-r--r--packet-x11.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/packet-x11.c b/packet-x11.c
index b3bb5e816b..197f805c13 100644
--- a/packet-x11.c
+++ b/packet-x11.c
@@ -2,7 +2,7 @@
* Routines for X11 dissection
* Copyright 2000, Christophe Tronche <ch.tronche@computer.org>
*
- * $Id: packet-x11.c,v 1.40 2002/04/16 09:42:31 guy Exp $
+ * $Id: packet-x11.c,v 1.41 2002/04/17 08:33:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -304,10 +304,14 @@ static const value_string direction_vals[] = {
{ 0, NULL }
};
+#define FAMILY_INTERNET 0
+#define FAMILY_DECNET 1
+#define FAMILY_CHAOS 2
+
static const value_string family_vals[] = {
- { 0, "Internet" },
- { 1, "DECnet" },
- { 2, "Chaos" },
+ { FAMILY_INTERNET, "Internet" },
+ { FAMILY_DECNET, "DECnet" },
+ { FAMILY_CHAOS, "Chaos" },
{ 0, NULL }
};
@@ -692,7 +696,7 @@ static gboolean little_endian = TRUE;
#define COLORMAP(name) { FIELD32(name); }
#define CURSOR(name) { FIELD32(name); }
#define DRAWABLE(name) { FIELD32(name); }
-#define ENUM8(name) { FIELD8(name); }
+#define ENUM8(name) (FIELD8(name))
#define ENUM16(name) { FIELD16(name); }
#define FONT(name) { FIELD32(name); }
#define FONTABLE(name) { FIELD32(name); }
@@ -1000,33 +1004,14 @@ static void listOfKeysyms(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf,
proto_item *tti;
proto_tree *ttt;
int i;
- char buffer[128+3+1];
- int buflen = 128;
- int nchars;
- char *bp;
while(keycode_count--) {
- bp = buffer + sprintf(buffer, "keysyms:");
- for(i = 0; i < keysyms_per_keycode; i++) {
- nchars = snprintf(bp, buflen, " %s", keysymString(VALUE32(tvb, *offsetp + i * 4)));
- if (nchars == -1 || nchars > buflen) {
- /*
- * Some versions of snprintf return -1 if they'd
- * truncate the output.
- */
- strcpy(bp, "...");
- bp += 3;
- break;
- }
- bp += nchars;
- buflen -= nchars;
- }
- *bp = '\0';
tti = proto_tree_add_none_format(tt, hf_item, tvb, *offsetp, keysyms_per_keycode * 4,
- "%s", buffer);
+ "keysyms:");
ttt = proto_item_add_subtree(tti, ett_x11_keysym);
for(i = keysyms_per_keycode; i; i--) {
guint32 v = VALUE32(tvb, *offsetp);
+ proto_item_append_text(tti, " %s", keysymString(v));
proto_tree_add_uint_format(ttt, hf_x11_keysyms_item_keysym, tvb, *offsetp, 4, v,
"keysym: 0x%08x (%s)", v, keysymString(v));
*offsetp += 4;
@@ -3006,10 +2991,18 @@ static void dissect_x11_request(tvbuff_t *tvb, packet_info *pinfo,
case 109: /* ChangeHosts */
ENUM8(change_host_mode);
REQUEST_LENGTH();
- ENUM8(family);
+ v8 = ENUM8(family);
UNUSED(1);
v16 = CARD16(address_length);
- LISTofCARD8(address, v16);
+ if (v8 == FAMILY_INTERNET && v16 == 4) {
+ /*
+ * IPv4 addresses.
+ * XXX - what about IPv6? Is that a family of
+ * FAMILY_INTERNET (0) with a length of 16?
+ */
+ LISTofCARD8(ip_address, v16);
+ } else
+ LISTofCARD8(address, v16);
break;
case 110: /* ListHosts */