* X11 dissector:

- in decoding of replies: 0 is not an unknown opcode, it means that the
  request was unseen or that the opcode of the request is unknown
  (e.g. due to unseen / undecoded QueryExtension replies)

- add special processing for QueryExtension requests & replies in order to
  store new opcodes in a value_string of opcodes saved per conversation

- try to resynchronize sequence number once at first reply if no initial
  connection request was seen

- add decoding of SendEvent request

- add decoding of many replies (AllocColor, GetInputFocus, GetGeometry,
  GetPointerControl, GetScreenSaver, GetSelectionOwner, GrabKeyboard,
  GrabPointer, InternAtom, ListProperties, LookupColor, QueryBestSize,
  QueryKeymap, QueryPointer, TranslateCoordinates)

- fix decoding of EnterNotify / LeaveNotify events

- add decoding of most events (FocusIn, FocusOut, Expose, GraphicsExpose,
  NoExpose, VisibilityNotify, CreateNotify, DestroyNotify, UnmapNotify,
  MapNotify, MapRequest, ReparentNotify, ConfigureNotify, GravityNotify,
  ResizeRequest, CirculateNotify, CirculateRequest, PropertyNotify,
  SelectionClear, SelectionRequest, SelectionNotify, ColormapNotify,
  ClientMessage)

- miscellaneous changes & code cleaning

svn path=/trunk/; revision=10442
This commit is contained in:
Laurent Deniel 2004-03-22 22:53:56 +00:00
parent 516d177e55
commit cc598d0484
3 changed files with 653 additions and 56 deletions

View File

@ -48,6 +48,7 @@ Laurent Deniel <laurent.deniel[AT]free.fr> {
Ability to mark the frames and associated features Ability to mark the frames and associated features
"Protocol Properties..." menu item "Protocol Properties..." menu item
Ring buffer rework Ring buffer rework
X11 decoding enhancements and fixes
Miscellaneous enhancements and fixes Miscellaneous enhancements and fixes
} }

View File

@ -3,7 +3,7 @@
* Copyright 2000, Christophe Tronche <ch.tronche@computer.org> * Copyright 2000, Christophe Tronche <ch.tronche@computer.org>
* Copyright 2003, Michael Shuldman * Copyright 2003, Michael Shuldman
* *
* $Id: packet-x11.c,v 1.55 2004/02/25 23:12:49 guy Exp $ * $Id: packet-x11.c,v 1.56 2004/03/22 22:53:56 deniel Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -76,9 +76,10 @@
* the initial connection request, and the byte order of the connection. * the initial connection request, and the byte order of the connection.
* *
* An opcode of -3 means we haven't yet seen any requests yet. * An opcode of -3 means we haven't yet seen any requests yet.
* An opcode of -2 means we're not expecting a reply. * An opcode of -2 means we're not expecting a reply (unused).
* An opcode of -1 means means we're waiting for a reply to the initial * An opcode of -1 means we're waiting for a reply to the initial
* connection request. * connection request.
* An opcode of 0 means the request was not seen (or unknown).
* Other values are the opcode of the request for which we're expecting * Other values are the opcode of the request for which we're expecting
* a reply. * a reply.
* *
@ -86,6 +87,9 @@
#define NOTHING_SEEN -3 #define NOTHING_SEEN -3
#define NOTHING_EXPECTED -2 #define NOTHING_EXPECTED -2
#define INITIAL_CONN -1 #define INITIAL_CONN -1
#define UNKNOWN_OPCODE 0
#define MAX_OPCODES (255 + 1) /* 255 + INITIAL_CONN */
#define BYTE_ORDER_BE 0 #define BYTE_ORDER_BE 0
#define BYTE_ORDER_LE 1 #define BYTE_ORDER_LE 1
@ -119,16 +123,20 @@ Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask };
#define NoSymbol 0L /* special KeySym */ #define NoSymbol 0L /* special KeySym */
typedef struct { typedef struct {
GHashTable *seqtable; /* hashtable of sequncenumber <-> opcode. */ GHashTable *seqtable; /* hashtable of sequencenumber <-> opcode. */
GHashTable *valtable;/* hashtable of sequencenumber <-> &opcode_vals */
/* major opcodes including extensions (NULL terminated) */
value_string opcode_vals[MAX_OPCODES+1];
int sequencenumber; /* sequencenumber of current packet. */ int sequencenumber; /* sequencenumber of current packet. */
guint32 iconn_frame; /* frame # of initial connection request */ guint32 iconn_frame; /* frame # of initial connection request */
guint32 iconn_reply; /* frame # of initial connection reply */ guint32 iconn_reply; /* frame # of initial connection reply */
int byte_order; /* byte order of connection */ int byte_order; /* byte order of connection */
gboolean resync; /* resynchronization of sequence number performed */
int *keycodemap[256]; /* keycode to keysymvalue map. */ int *keycodemap[256]; /* keycode to keysymvalue map. */
int keysyms_per_keycode; int keysyms_per_keycode;
int first_keycode; int first_keycode;
int *modifiermap[array_length(modifiers)];/* modifier to keycode. */ int *modifiermap[array_length(modifiers)];/* modifier to keycode.*/
int keycodes_per_modifier; int keycodes_per_modifier;
union { union {
@ -367,18 +375,39 @@ static const value_string close_down_mode_vals[] = {
{ 0, NULL } { 0, NULL }
}; };
static const value_string colormap_state_vals[] = {
{ 0, "Uninstalled" },
{ 1, "Installed" },
{ 0, NULL }
};
static const value_string coordinate_mode_vals[] = { static const value_string coordinate_mode_vals[] = {
{ 0, "Origin" }, { 0, "Origin" },
{ 1, "Previous" }, { 1, "Previous" },
{ 0, NULL } { 0, NULL }
}; };
static const value_string destination_vals[] = {
{ 0, "PointerWindow" },
{ 1, "InputFocus" },
{ 0, NULL }
};
static const value_string direction_vals[] = { static const value_string direction_vals[] = {
{ 0, "RaiseLowest" }, { 0, "RaiseLowest" },
{ 1, "LowerHighest" }, { 1, "LowerHighest" },
{ 0, NULL } { 0, NULL }
}; };
static const value_string event_detail_vals[] = {
{ 0, "Ancestor" },
{ 1, "Virtual" },
{ 2, "Inferior" },
{ 3, "Nonlinear" },
{ 4, "NonlinearVirtual" },
{ 0, NULL }
};
#define FAMILY_INTERNET 0 #define FAMILY_INTERNET 0
#define FAMILY_DECNET 1 #define FAMILY_DECNET 1
#define FAMILY_CHAOS 2 #define FAMILY_CHAOS 2
@ -404,6 +433,26 @@ static const value_string fill_style_vals[] = {
{ 0, NULL } { 0, NULL }
}; };
static const value_string focus_detail_vals[] = {
{ 0, "Ancestor" },
{ 1, "Virtual" },
{ 2, "Inferior" },
{ 3, "Nonlinear" },
{ 4, "NonlinearVirtual" },
{ 5, "Pointer" },
{ 6, "PointerRoot" },
{ 7, "None" },
{ 0, NULL }
};
static const value_string focus_mode_vals[] = {
{ 0, "Normal" },
{ 1, "Grab" },
{ 2, "Ungrab" },
{ 3, "WhileGrabbed" },
{ 0, NULL }
};
static const value_string focus_vals[] = { static const value_string focus_vals[] = {
{ 0, "None" }, { 0, "None" },
{ 1, "PointerRoot" }, { 1, "PointerRoot" },
@ -430,6 +479,22 @@ static const value_string function_vals[] = {
{ 0, NULL } { 0, NULL }
}; };
static const value_string grab_mode_vals[] = {
{ 0, "Normal" },
{ 1, "Grab" },
{ 2, "Ungrab" },
{ 0, NULL }
};
static const value_string grab_status_vals[] = {
{ 0, "Success" },
{ 1, "AlreadyGrabbed" },
{ 2, "InvalidTime" },
{ 3, "NotViewable" },
{ 4, "Frozen" },
{ 0, NULL }
};
static const value_string gravity_vals[] = { static const value_string gravity_vals[] = {
{ 1, "NorthWest" }, { 1, "NorthWest" },
{ 2, "North" }, { 2, "North" },
@ -491,6 +556,25 @@ static const value_string on_off_vals[] = {
{ 0, NULL } { 0, NULL }
}; };
static const value_string place_vals[] = {
{ 0, "Top" },
{ 1, "Bottom" },
{ 0, NULL }
};
static const value_string property_state_vals[] = {
{ 0, "NewValue" },
{ 1, "Deleted" },
{ 0, NULL }
};
static const value_string visibility_state_vals[] = {
{ 0, "Unobscured" },
{ 1, "PartiallyObscured" },
{ 2, "FullyObscured" },
{ 0, NULL }
};
/* Requestcodes. From <X11/Xproto.h>. */ /* Requestcodes. From <X11/Xproto.h>. */
#define X_CreateWindow 1 #define X_CreateWindow 1
#define X_ChangeWindowAttributes 2 #define X_ChangeWindowAttributes 2
@ -612,6 +696,8 @@ static const value_string on_off_vals[] = {
#define X_SetModifierMapping 118 #define X_SetModifierMapping 118
#define X_GetModifierMapping 119 #define X_GetModifierMapping 119
#define X_NoOperation 127 #define X_NoOperation 127
#define X_FirstExtension 128
#define X_LastExtension 255
static const value_string opcode_vals[] = { static const value_string opcode_vals[] = {
{ INITIAL_CONN, "Initial connection request" }, { INITIAL_CONN, "Initial connection request" },
@ -639,7 +725,7 @@ static const value_string opcode_vals[] = {
{ X_SetSelectionOwner, "SetSelectionOwner" }, { X_SetSelectionOwner, "SetSelectionOwner" },
{ X_GetSelectionOwner, "GetSelectionOwner" }, { X_GetSelectionOwner, "GetSelectionOwner" },
{ X_ConvertSelection, "ConvertSelection" }, { X_ConvertSelection, "ConvertSelection" },
/* { X_SendEvent, "SendEvent" }, */ { X_SendEvent, "SendEvent" },
{ X_GrabPointer, "GrabPointer" }, { X_GrabPointer, "GrabPointer" },
{ X_UngrabPointer, "UngrabPointer" }, { X_UngrabPointer, "UngrabPointer" },
{ X_GrabButton, "GrabButton" }, { X_GrabButton, "GrabButton" },
@ -772,6 +858,8 @@ static const value_string opcode_vals[] = {
#define ColormapNotify 32 #define ColormapNotify 32
#define ClientMessage 33 #define ClientMessage 33
#define MappingNotify 34 #define MappingNotify 34
#define FirstExtensionEvent 64
#define LastExtensionEvent 127
static const value_string eventcode_vals[] = { static const value_string eventcode_vals[] = {
{ KeyPress, "KeyPress" }, { KeyPress, "KeyPress" },
@ -1058,6 +1146,7 @@ keysyms_per_keycode) {\
#define SETofEVENT(name) { setOfEvent(tvb, offsetp, t, little_endian); } #define SETofEVENT(name) { setOfEvent(tvb, offsetp, t, little_endian); }
#define SETofDEVICEEVENT(name) { setOfDeviceEvent(tvb, offsetp, t, little_endian);} #define SETofDEVICEEVENT(name) { setOfDeviceEvent(tvb, offsetp, t, little_endian);}
#define SETofKEYMASK(name) { setOfKeyButMask(tvb, offsetp, t, little_endian, 0); } #define SETofKEYMASK(name) { setOfKeyButMask(tvb, offsetp, t, little_endian, 0); }
#define SETofKEYBUTMASK(name) { setOfKeyButMask(tvb, offsetp, t, little_endian, 1); }
#define SETofPOINTEREVENT(name) { setOfPointerEvent(tvb, offsetp, t, little_endian); } #define SETofPOINTEREVENT(name) { setOfPointerEvent(tvb, offsetp, t, little_endian); }
#define STRING8(name, length) { string8(tvb, offsetp, t, hf_x11_##name, length); } #define STRING8(name, length) { string8(tvb, offsetp, t, hf_x11_##name, length); }
#define STRING16(name, length) { string16(tvb, offsetp, t, hf_x11_##name, hf_x11_##name##_bytes, length, little_endian); } #define STRING16(name, length) { string16(tvb, offsetp, t, hf_x11_##name, hf_x11_##name##_bytes, length, little_endian); }
@ -1094,7 +1183,7 @@ keysyms_per_keycode) {\
*offsetp, sizeof(seqno), seqno, \ *offsetp, sizeof(seqno), seqno, \
"sequencenumber: %d (%s)", \ "sequencenumber: %d (%s)", \
(int)seqno, \ (int)seqno, \
val_to_str(opcode, opcode_vals, "<Unknown opcode %d>")); \ val_to_str(opcode, state->opcode_vals, "<Unknown opcode %d>")); \
*offsetp += sizeof(seqno); \ *offsetp += sizeof(seqno); \
} while (0) } while (0)
@ -2868,11 +2957,12 @@ static void dissect_x11_request(tvbuff_t *tvb, packet_info *pinfo,
int next_offset; int next_offset;
proto_item *ti; proto_item *ti;
proto_tree *t; proto_tree *t;
int length, opcode; int length, opcode, i;
guint8 v8, v8_2, v8_3; guint8 v8, v8_2, v8_3;
guint16 v16; guint16 v16;
guint32 v32; guint32 v32;
gint left; gint left;
gchar *name;
length = VALUE16(tvb, 2) * 4; length = VALUE16(tvb, 2) * 4;
@ -2893,16 +2983,47 @@ static void dissect_x11_request(tvbuff_t *tvb, packet_info *pinfo,
if (check_col(pinfo->cinfo, COL_INFO)) if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s", sep, col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s", sep,
val_to_str(opcode, opcode_vals, "<Unknown opcode %d>")); val_to_str(opcode, state->opcode_vals,
"<Unknown opcode %d>"));
proto_item_append_text(ti, ", Request, opcode: %d (%s)", proto_item_append_text(ti, ", Request, opcode: %d (%s)",
opcode, val_to_str(opcode, opcode_vals, opcode, val_to_str(opcode, state->opcode_vals,
"<Unknown opcode %d>")); "<Unknown opcode %d>"));
/* /*
* Does this request expect a reply? * Does this request expect a reply?
*/ */
switch(opcode) { switch(opcode) {
case X_QueryExtension:
/* necessary processing even if tree == NULL */
v16 = VALUE16(tvb, 4);
name = g_malloc(v16 + 1);
stringCopy(name, tvb_get_ptr(tvb, 8, v16), v16);
/* store string of extension, opcode will be set at reply */
i = 0;
while(i < MAX_OPCODES) {
if (state->opcode_vals[i].strptr == NULL) {
state->opcode_vals[i].strptr = name;
g_hash_table_insert(state->valtable,
(int *)state->sequencenumber,
(int *)&state->opcode_vals[i]);
break;
} else if (strcmp(state->opcode_vals[i].strptr,
name) == 0) {
g_hash_table_insert(state->valtable,
(int *)state->sequencenumber,
(int *)&state->opcode_vals[i]);
break;
}
i++;
}
/* QueryExtension expects a reply, fall through */
case X_AllocColor: case X_AllocColor:
case X_AllocColorCells: case X_AllocColorCells:
case X_AllocColorPlanes: case X_AllocColorPlanes:
@ -2934,7 +3055,6 @@ static void dissect_x11_request(tvbuff_t *tvb, packet_info *pinfo,
case X_LookupColor: case X_LookupColor:
case X_QueryBestSize: case X_QueryBestSize:
case X_QueryColors: case X_QueryColors:
case X_QueryExtension:
case X_QueryFont: case X_QueryFont:
case X_QueryKeymap: case X_QueryKeymap:
case X_QueryPointer: case X_QueryPointer:
@ -2946,13 +3066,22 @@ static void dissect_x11_request(tvbuff_t *tvb, packet_info *pinfo,
/* /*
* Those requests expect a reply. * Those requests expect a reply.
*/ */
g_hash_table_insert(state->seqtable, g_hash_table_insert(state->seqtable,
(int *)state->sequencenumber, (int *)opcode); (int *)state->sequencenumber,
(int *)opcode);
break; break;
default: default:
/*
* With Extension, we don't know, so assume there could be one
*/
if (opcode >= X_FirstExtension && opcode <= X_LastExtension) {
g_hash_table_insert(state->seqtable,
(int *)state->sequencenumber,
(int *)opcode);
}
/* /*
* No reply is expected from any other request. * No reply is expected from any other request.
*/ */
@ -3123,6 +3252,14 @@ static void dissect_x11_request(tvbuff_t *tvb, packet_info *pinfo,
TIMESTAMP(time); TIMESTAMP(time);
break; break;
case X_SendEvent:
BOOL(propagate);
REQUEST_LENGTH();
WINDOW(destination);
SETofEVENT(event_mask);
UNDECODED(32);
break;
case X_GrabPointer: case X_GrabPointer:
BOOL(owner_events); BOOL(owner_events);
REQUEST_LENGTH(); REQUEST_LENGTH();
@ -4222,11 +4359,26 @@ static void
x11_stateinit(x11_conv_data_t **state, conversation_t *conversation) x11_stateinit(x11_conv_data_t **state, conversation_t *conversation)
{ {
static x11_conv_data_t stateinit; static x11_conv_data_t stateinit;
int i = 0;
*state = g_mem_chunk_alloc(x11_state_chunk); *state = g_mem_chunk_alloc(x11_state_chunk);
**state = stateinit; **state = stateinit;
/* initialise opcodes */
while (1) {
if (opcode_vals[i].strptr == NULL) break;
(*state)->opcode_vals[i].value = opcode_vals[i].value;
(*state)->opcode_vals[i].strptr = opcode_vals[i].strptr;
i++;
}
while (i <= MAX_OPCODES) {
(*state)->opcode_vals[i].value = 0;
(*state)->opcode_vals[i].strptr = NULL;
i++;
}
(*state)->seqtable = g_hash_table_new(g_direct_hash, g_direct_equal); (*state)->seqtable = g_hash_table_new(g_direct_hash, g_direct_equal);
(*state)->valtable = g_hash_table_new(g_direct_hash, g_direct_equal);
g_hash_table_insert((*state)->seqtable, (int *)0, (int *)NOTHING_SEEN); g_hash_table_insert((*state)->seqtable, (int *)0, (int *)NOTHING_SEEN);
(*state)->byte_order = BYTE_ORDER_UNKNOWN; /* don't know yet*/ (*state)->byte_order = BYTE_ORDER_UNKNOWN; /* don't know yet*/
conversation_add_proto_data(conversation, proto_x11, *state); conversation_add_proto_data(conversation, proto_x11, *state);
@ -4379,6 +4531,8 @@ dissect_x11_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean little_endian) gboolean little_endian)
{ {
int offset = 0, *offsetp = &offset, length, left, opcode; int offset = 0, *offsetp = &offset, length, left, opcode;
int major_opcode, sequence_number;
value_string *vals_p;
proto_item *ti; proto_item *ti;
proto_tree *t; proto_tree *t;
@ -4394,8 +4548,9 @@ dissect_x11_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* 1) the request sequence number wraps in the lower 16 * 1) the request sequence number wraps in the lower 16
* bits; * bits;
* *
* 2) we don't see the initial connection request and thus * 2) we don't see the initial connection request and the
* don't have the right sequence numbers; * resynchronization of sequence number fails and thus
* don't have the right sequence numbers
* *
* 3) we don't have all the packets in the capture and * 3) we don't have all the packets in the capture and
* get out of sequence. * get out of sequence.
@ -4404,26 +4559,73 @@ dissect_x11_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* the most recent not-already-replied-to request in the same * the most recent not-already-replied-to request in the same
* connection. That also might mismatch replies to requests if * connection. That also might mismatch replies to requests if
* packets are lost, but there's nothing you can do to fix that. * packets are lost, but there's nothing you can do to fix that.
*
* XXX - if "opcode" is 0, we shouldn't say "Unknown opcode",
* we should say that we don't have the request for the reply.
*/ */
opcode = (int)g_hash_table_lookup(state->seqtable,
(int *)VALUE16(tvb, offset + 2));
sequence_number = VALUE16(tvb, offset + 2);
opcode = (int)g_hash_table_lookup(state->seqtable,
(int *)sequence_number);
if (state->iconn_frame == 0 && state->resync == FALSE) {
/*
* We don't see the initial connection request and no
* resynchronization has been performed yet (first reply),
* set the current sequence number to the one of the
* current reply (this is only performed once).
*/
state->sequencenumber = sequence_number;
state->resync = TRUE;
}
if (opcode == UNKNOWN_OPCODE) {
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO,
"%s to unknown request", sep);
proto_item_append_text(ti, ", Reply to unknown request");
} else {
if (check_col(pinfo->cinfo, COL_INFO)) if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s", col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s",
sep, sep,
/* val_to_str(opcode, state->opcode_vals,
* don't print opcode value since if it's "<Unknown opcode %d>"));
* unknown, we didn't know to save the
* request opcode.
*/
val_to_str(opcode, opcode_vals, "<Unknown opcode %d>"));
proto_item_append_text(ti, ", Reply, opcode: %d (%s)", proto_item_append_text(ti, ", Reply, opcode: %d (%s)",
opcode, val_to_str(opcode, opcode_vals, opcode, val_to_str(opcode,
state->opcode_vals,
"<Unknown opcode %d>")); "<Unknown opcode %d>"));
}
switch (opcode) {
/*
* Replies that need special processing outside tree
*/
case X_QueryExtension:
/*
* if extension is present and request is known:
* store opcode of extension in value_string of
* opcodes
*/
if (!VALUE8(tvb, offset + 8)) {
/* not present */
break;
}
vals_p = g_hash_table_lookup(state->valtable,
(int *)sequence_number);
if (vals_p != NULL) {
major_opcode = VALUE8(tvb, offset + 9);
vals_p->value = major_opcode;
g_hash_table_remove(state->valtable,
(int *)sequence_number);
}
break;
default:
break;
}
if (tree == NULL) if (tree == NULL)
return; return;
@ -4434,9 +4636,36 @@ dissect_x11_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/ */
case X_GetWindowAttributes: case X_GetWindowAttributes:
REPLYCONTENTS_COMMON();
break;
case X_GetGeometry: case X_GetGeometry:
REPLY(reply);
CARD8(depth);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
WINDOW(rootwindow);
INT16(x);
INT16(y);
CARD16(width);
CARD16(height);
CARD16(border_width);
UNUSED(10);
break;
case X_QueryTree: case X_QueryTree:
REPLYCONTENTS_COMMON();
break;
case X_InternAtom: case X_InternAtom:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
ATOM(atom);
UNUSED(20);
break;
case X_GetAtomName: case X_GetAtomName:
REPLYCONTENTS_COMMON(); REPLYCONTENTS_COMMON();
break; break;
@ -4453,36 +4682,151 @@ dissect_x11_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break; break;
case X_ListProperties: case X_ListProperties:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
length = CARD16(property_number);
UNUSED(22);
LISTofATOM(properties, length*4);
break;
case X_GetSelectionOwner: case X_GetSelectionOwner:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
WINDOW(owner);
UNUSED(20);
break;
case X_GrabPointer: case X_GrabPointer:
case X_GrabKeyboard: case X_GrabKeyboard:
REPLY(reply);
ENUM8(grab_status);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
UNUSED(24);
break;
case X_QueryPointer: case X_QueryPointer:
REPLY(reply);
BOOL(same_screen);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
WINDOW(rootwindow);
WINDOW(childwindow);
INT16(root_x);
INT16(root_y);
INT16(win_x);
INT16(win_y);
SETofKEYBUTMASK(mask);
UNUSED(6);
break;
case X_GetMotionEvents: case X_GetMotionEvents:
case X_TranslateCoords:
REPLYCONTENTS_COMMON(); REPLYCONTENTS_COMMON();
break; break;
case X_TranslateCoords:
REPLY(reply);
BOOL(same_screen);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
WINDOW(childwindow);
INT16(dst_x);
INT16(dst_y);
UNUSED(16);
break;
case X_GetInputFocus:
REPLY(reply);
ENUM8(revert_to);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
WINDOW(focus);
UNUSED(20);
break;
case X_QueryKeymap: case X_QueryKeymap:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
LISTofCARD8(keys, 32);
break;
case X_QueryFont: case X_QueryFont:
case X_QueryTextExtents: case X_QueryTextExtents:
case X_ListFonts: case X_ListFonts:
case X_GetImage: case X_GetImage:
case X_ListInstalledColormaps: case X_ListInstalledColormaps:
REPLYCONTENTS_COMMON();
break;
case X_AllocColor: case X_AllocColor:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
CARD16(red);
CARD16(green);
CARD16(blue);
UNUSED(2);
CARD32(pixel);
UNUSED(12);
break;
case X_QueryColors: case X_QueryColors:
REPLYCONTENTS_COMMON();
break;
case X_LookupColor: case X_LookupColor:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
CARD16(exact_red);
CARD16(exact_green);
CARD16(exact_blue);
CARD16(visual_red);
CARD16(visual_green);
CARD16(visual_blue);
UNUSED(12);
break;
case X_QueryBestSize: case X_QueryBestSize:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
CARD16(width);
CARD16(height);
UNUSED(20);
break;
case X_QueryExtension: case X_QueryExtension:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
BOOL(present);
CARD8(major_opcode);
CARD8(first_event);
CARD8(first_error);
UNUSED(20);
break;
case X_ListExtensions: case X_ListExtensions:
REPLYCONTENTS_COMMON(); REPLYCONTENTS_COMMON();
break; break;
case X_GetKeyboardMapping: case X_GetKeyboardMapping:
state->first_keycode state->first_keycode =
= state->request.GetKeyboardMapping.first_keycode, state->request.GetKeyboardMapping.first_keycode;
REPLY(reply); REPLY(reply);
state->keysyms_per_keycode state->keysyms_per_keycode =
= FIELD8(keysyms_per_keycode); FIELD8(keysyms_per_keycode);
SEQUENCENUMBER_REPLY(sequencenumber); SEQUENCENUMBER_REPLY(sequencenumber);
length = REPLYLENGTH(replylength); length = REPLYLENGTH(replylength);
UNUSED(24); UNUSED(24);
@ -4493,8 +4837,32 @@ dissect_x11_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break; break;
case X_GetKeyboardControl: case X_GetKeyboardControl:
REPLYCONTENTS_COMMON();
break;
case X_GetPointerControl: case X_GetPointerControl:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
CARD16(acceleration_numerator);
CARD16(acceleration_denominator);
CARD16(threshold);
UNUSED(18);
break;
case X_GetScreenSaver: case X_GetScreenSaver:
REPLY(reply);
UNUSED(1);
SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength);
CARD16(timeout);
CARD16(interval);
ENUM8(prefer_blanking);
ENUM8(allow_exposures);
UNUSED(18);
break;
case X_ListHosts: case X_ListHosts:
case X_SetPointerMapping: case X_SetPointerMapping:
case X_GetPointerMapping: case X_GetPointerMapping:
@ -4504,8 +4872,8 @@ dissect_x11_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case X_GetModifierMapping: case X_GetModifierMapping:
REPLY(reply); REPLY(reply);
state->keycodes_per_modifier state->keycodes_per_modifier =
= FIELD8(keycodes_per_modifier); FIELD8(keycodes_per_modifier);
SEQUENCENUMBER_REPLY(sequencenumber); SEQUENCENUMBER_REPLY(sequencenumber);
REPLYLENGTH(replylength); REPLYLENGTH(replylength);
UNUSED(24); UNUSED(24);
@ -4592,37 +4960,245 @@ dissect_x11_event(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case EnterNotify: case EnterNotify:
case LeaveNotify: case LeaveNotify:
CARD8(detail); ENUM8(event_detail);
CARD16(event_sequencenumber); CARD16(event_sequencenumber);
EVENTCONTENTS_COMMON(); EVENTCONTENTS_COMMON();
ENUM8(grab_mode);
CARD8(same_screen); CARD8(same_screen);
break; break;
case FocusIn: case FocusIn:
case FocusOut: case FocusOut:
ENUM8(focus_detail);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
ENUM8(focus_mode);
UNUSED(23);
break;
case KeymapNotify: case KeymapNotify:
break;
case Expose: case Expose:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
INT16(x);
INT16(y);
CARD16(width);
CARD16(height);
CARD16(count);
UNUSED(14);
break;
case GraphicsExpose: case GraphicsExpose:
UNUSED(1);
CARD16(event_sequencenumber);
DRAWABLE(drawable);
CARD16(x);
CARD16(y);
CARD16(width);
CARD16(height);
CARD16(minor_opcode);
CARD16(count);
CARD8(major_opcode);
UNUSED(11);
break;
case NoExpose: case NoExpose:
UNUSED(1);
CARD16(event_sequencenumber);
DRAWABLE(drawable);
CARD16(minor_opcode);
CARD8(major_opcode);
UNUSED(21);
break;
case VisibilityNotify: case VisibilityNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
ENUM8(visibility_state);
UNUSED(23);
break;
case CreateNotify: case CreateNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(parent);
WINDOW(eventwindow);
INT16(x);
INT16(y);
CARD16(width);
CARD16(height);
CARD16(border_width);
BOOL(override_redirect);
UNUSED(9);
break;
case DestroyNotify: case DestroyNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
WINDOW(window);
UNUSED(20);
break;
case UnmapNotify: case UnmapNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
WINDOW(window);
BOOL(from_configure);
UNUSED(19);
break;
case MapNotify: case MapNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
WINDOW(window);
BOOL(override_redirect);
UNUSED(19);
break;
case MapRequest: case MapRequest:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(parent);
WINDOW(eventwindow);
UNUSED(20);
break;
case ReparentNotify: case ReparentNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
WINDOW(window);
WINDOW(parent);
INT16(x);
INT16(y);
BOOL(override_redirect);
UNUSED(11);
break;
case ConfigureNotify: case ConfigureNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
WINDOW(window);
WINDOW(above_sibling);
INT16(x);
INT16(y);
CARD16(width);
CARD16(height);
CARD16(border_width);
BOOL(override_redirect);
UNUSED(5);
break;
case ConfigureRequest: case ConfigureRequest:
break;
case GravityNotify: case GravityNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
WINDOW(window);
INT16(x);
INT16(y);
UNUSED(16);
break;
case ResizeRequest: case ResizeRequest:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
CARD16(width);
CARD16(height);
UNUSED(20);
break;
case CirculateNotify: case CirculateNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
WINDOW(window);
UNUSED(4);
ENUM8(place);
UNUSED(15);
break;
case CirculateRequest: case CirculateRequest:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(parent);
WINDOW(eventwindow);
UNUSED(4);
ENUM8(place);
UNUSED(15);
break;
case PropertyNotify: case PropertyNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
ATOM(atom);
TIMESTAMP(time);
ENUM8(property_state);
UNUSED(15);
break;
case SelectionClear: case SelectionClear:
UNUSED(1);
CARD16(event_sequencenumber);
TIMESTAMP(time);
WINDOW(owner);
ATOM(selection);
UNUSED(16);
break;
case SelectionRequest: case SelectionRequest:
UNUSED(1);
CARD16(event_sequencenumber);
TIMESTAMP(time);
WINDOW(owner);
WINDOW(requestor);
ATOM(selection);
ATOM(target);
ATOM(property);
UNUSED(4);
break;
case SelectionNotify: case SelectionNotify:
UNUSED(1);
CARD16(event_sequencenumber);
TIMESTAMP(time);
WINDOW(requestor);
ATOM(selection);
ATOM(target);
ATOM(property);
UNUSED(8);
break;
case ColormapNotify: case ColormapNotify:
UNUSED(1);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
COLORMAP(cmap);
BOOL(new);
ENUM8(colormap_state);
UNUSED(18);
break;
case ClientMessage: case ClientMessage:
CARD8(format);
CARD16(event_sequencenumber);
WINDOW(eventwindow);
ATOM(type);
LISTofBYTE(data, 20);
break;
case MappingNotify: case MappingNotify:
default: default:
break; break;
@ -4714,13 +5290,6 @@ void proto_register_x11(void)
/* Setup list of header fields */ /* Setup list of header fields */
static hf_register_info hf[] = { static hf_register_info hf[] = {
/*
{ &hf_x11_FIELDABBREV,
{ "FIELDNAME", "x11.FIELDABBREV",
FIELDTYPE, FIELDBASE, FIELDCONVERT, BITMASK,
"FIELDDESCR", HFILL }
},
*/
#include "x11-register-info.h" #include "x11-register-info.h"
}; };

View File

@ -3,7 +3,7 @@
# #
# Copyright 2000, Christophe Tronche <ch.tronche@computer.org> # Copyright 2000, Christophe Tronche <ch.tronche@computer.org>
# #
# $Id: x11-fields,v 1.11 2004/01/04 10:57:18 guy Exp $ # $Id: x11-fields,v 1.12 2004/03/22 22:53:56 deniel Exp $
# #
# Ethereal - Network traffic analyzer # Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com> # By Gerald Combs <gerald@ethereal.com>
@ -24,6 +24,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
above-sibling UINT32 HEX
acceleration-denominator INT16 DEC acceleration-denominator INT16 DEC
acceleration-numerator INT16 DEC acceleration-numerator INT16 DEC
access-mode UINT8 DEC VALS access-mode UINT8 DEC VALS
@ -88,7 +89,7 @@ clip-y-origin INT16 DEC
close-down-mode UINT8 DEC VALS close-down-mode UINT8 DEC VALS
cmap UINT32 HEX cmap UINT32 HEX
colormap UINT32 HEX colormap UINT32 HEX
colormap-state UINT8 DEC VALS
color-items NONE NONE color-items NONE NONE
coloritem NONE NONE coloritem NONE NONE
@ -151,6 +152,9 @@ eventbutton UINT8 DEC eventbutton
eventcode UINT8 DEC VALS eventcode eventcode UINT8 DEC VALS eventcode
eventwindow UINT32 HEX eventwindow eventwindow UINT32 HEX eventwindow
first-event UINT8 DEC
first-error UINT8 DEC
gc-dashes UINT8 DEC gc-dashes UINT8 DEC
gc-value-mask UINT32 HEX gc-value-mask UINT32 HEX
@ -185,6 +189,7 @@ data-length UINT32 DEC
delete BOOLEAN NONE Delete this property after reading delete BOOLEAN NONE Delete this property after reading
delta INT16 DEC delta INT16 DEC
depth UINT8 DEC depth UINT8 DEC
destination UINT8 DEC VALS
direction UINT8 DEC VALS direction UINT8 DEC VALS
drawable UINT32 HEX drawable UINT32 HEX
dst-drawable UINT32 HEX dst-drawable UINT32 HEX
@ -192,6 +197,7 @@ dst-gc UINT32 HEX
dst-window UINT32 HEX dst-window UINT32 HEX
dst-x INT16 DEC dst-x INT16 DEC
dst-y INT16 DEC dst-y INT16 DEC
event-detail UINT8 DEC VALS
event-mask UINT32 HEX event-mask UINT32 HEX
KeyPress BOOLEAN 32 0x00000001 KeyPress BOOLEAN 32 0x00000001
@ -221,6 +227,9 @@ event-mask UINT32 HEX
OwnerGrabButton BOOLEAN 32 0x01000000 OwnerGrabButton BOOLEAN 32 0x01000000
erroneous-bits BOOLEAN 32 0xfe000000 erroneous-bits BOOLEAN 32 0xfe000000
exact-blue UINT16 DEC
exact-green UINT16 DEC
exact-red UINT16 DEC
exposures BOOLEAN NONE exposures BOOLEAN NONE
family UINT8 DEC VALS family UINT8 DEC VALS
fid UINT32 HEX Font id fid UINT32 HEX Font id
@ -228,16 +237,21 @@ fill-rule UINT8 DEC VALS
fill-style UINT8 DEC VALS fill-style UINT8 DEC VALS
first-keycode UINT8 DEC first-keycode UINT8 DEC
focus UINT8 DEC VALS focus UINT8 DEC VALS
focus-detail UINT8 DEC VALS
focus-mode UINT8 DEC VALS
font UINT32 HEX font UINT32 HEX
fore-blue UINT16 DEC fore-blue UINT16 DEC
fore-green UINT16 DEC fore-green UINT16 DEC
fore-red UINT16 DEC fore-red UINT16 DEC
foreground UINT32 HEX foreground UINT32 HEX
format UINT8 DEC format UINT8 DEC
from-configure BOOLEAN NONE
function UINT8 DEC VALS function UINT8 DEC VALS
gc UINT32 HEX gc UINT32 HEX
get-property-type UINT32 HEX VALS(zero_is_any_property_type) get-property-type UINT32 HEX VALS(zero_is_any_property_type)
grab_window UINT32 HEX grab-mode UINT8 DEC VALS
grab-status UINT8 DEC VALS
grab-window UINT32 HEX
graphics-exposures BOOLEAN NONE graphics-exposures BOOLEAN NONE
height UINT16 DEC height UINT16 DEC
image-byte-order UINT8 HEX VALS image-byte-order UINT8 HEX VALS
@ -271,6 +285,8 @@ keycodes NONE NONE
keycodes-per-modifier UINT8 DEC keycodes-per-modifier UINT8 DEC
keys UINT8 DEC
keysyms NONE NONE keysyms NONE NONE
item NONE NONE item NONE NONE
keysym UINT32 HEX keysym UINT32 HEX
@ -318,6 +334,7 @@ modifiers-mask UINT16 HEX
motion-buffer-size UINT16 DEC motion buffer size motion-buffer-size UINT16 DEC motion buffer size
new BOOLEAN NONE
number-of-formats-in-pixmap-formats UINT8 DEC number of formats in pixmap formats number-of-formats-in-pixmap-formats UINT8 DEC number of formats in pixmap formats
number-of-screens-in-roots UINT8 DEC number of screens in roots number-of-screens-in-roots UINT8 DEC number of screens in roots
@ -343,6 +360,7 @@ pixel UINT32 HEX
pixels NONE NONE pixels NONE NONE
pixels_item UINT32 HEX pixels_item UINT32 HEX
pixmap UINT32 HEX pixmap UINT32 HEX
place UINT8 DEC VALS
plane-mask UINT32 HEX VALS plane-mask UINT32 HEX VALS
planes UINT16 DEC planes UINT16 DEC
point NONE NONE point NONE NONE
@ -368,12 +386,15 @@ pointer-event-mask UINT16 HEX
pointer-mode UINT8 DEC VALS(pointer_keyboard_mode) pointer-mode UINT8 DEC VALS(pointer_keyboard_mode)
prefer-blanking UINT8 DEC VALS(yes_no_default) prefer-blanking UINT8 DEC VALS(yes_no_default)
present BOOLEAN NONE
propagate BOOLEAN NONE
properties NONE NONE properties NONE NONE
item UINT32 HEX item UINT32 HEX
property UINT32 HEX property UINT32 HEX
property-number UINT16 DEC property-number UINT16 DEC
property-state UINT8 DEC VALS
protocol-major-version UINT16 DEC protocol-major-version UINT16 DEC
protocol-minor-version UINT16 DEC protocol-minor-version UINT16 DEC
reason STRING HEX reason reason STRING HEX reason
@ -459,13 +480,19 @@ undecoded NONE NONE Yet undecoded by dissector
unused NONE NONE unused NONE NONE
valuelength UINT32 DEC valuelength valuelength UINT32 DEC valuelength
vendor STRING HEX vendor vendor STRING HEX vendor
visibility-state UINT8 DEC VALS
visual UINT32 HEX visual UINT32 HEX
visual-blue UINT16 DEC
visual-green UINT16 DEC
visual-red UINT16 DEC
visualid UINT32 HEX visualid UINT32 HEX
warp-pointer-dst-window UINT32 HEX VALS(zero_is_none) warp-pointer-dst-window UINT32 HEX VALS(zero_is_none)
warp-pointer-src-window UINT32 HEX VALS(zero_is_none) warp-pointer-src-window UINT32 HEX VALS(zero_is_none)
wid UINT32 HEX Window id wid UINT32 HEX Window id
width UINT16 DEC width UINT16 DEC
win-gravity UINT8 DEC VALS(gravity) win-gravity UINT8 DEC VALS(gravity)
win-x INT16 DEC
win-y INT16 DEC
window UINT32 HEX window UINT32 HEX
window-class UINT16 DEC VALS Window class window-class UINT16 DEC VALS Window class