remoteosd_rfbproto.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2002 RealVNC Ltd.  All Rights Reserved.
00003  *  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
00004  *
00005  *  This is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This software is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this software; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
00018  *  USA.
00019  */
00020 
00021 /*
00022  * rfbproto.h - header file for the RFB protocol version 3.3
00023  *
00024  * Uses types CARD<n> for an n-bit unsigned integer, INT<n> for an n-bit signed
00025  * integer (for n = 8, 16 and 32).
00026  *
00027  * All multiple byte integers are in big endian (network) order (most
00028  * significant byte first).  Unless noted otherwise there is no special
00029  * alignment of protocol structures.
00030  *
00031  *
00032  * Once the initial handshaking is done, all messages start with a type byte,
00033  * (usually) followed by message-specific data.  The order of definitions in
00034  * this file is as follows:
00035  *
00036  *  (1) Structures used in several types of message.
00037  *  (2) Structures used in the initial handshaking.
00038  *  (3) Message types.
00039  *  (4) Encoding types.
00040  *  (5) For each message type, the form of the data following the type byte.
00041  *      Sometimes this is defined by a single structure but the more complex
00042  *      messages have to be explained by comments.
00043  */
00044 
00045 /*****************************************************************************
00046  *
00047  * Structures used in several messages
00048  *
00049  *****************************************************************************/
00050 
00051 #include "inttypes.h"
00052 #define CARD8  uint8_t
00053 #define CARD16 uint16_t
00054 #define CARD32 uint32_t
00055 
00056 /*-----------------------------------------------------------------------------
00057  * Structure used to specify a rectangle.  This structure is a multiple of 4
00058  * bytes so that it can be interspersed with 32-bit pixel data without
00059  * affecting alignment.
00060  */
00061 typedef struct {
00062     CARD16 x;
00063     CARD16 y;
00064     CARD16 w;
00065     CARD16 h;
00066 } rfbRectangle;
00067 
00068 #define sz_rfbRectangle 8
00069 
00070 
00071 /*-----------------------------------------------------------------------------
00072  * Structure used to specify pixel format.
00073  */
00074 
00075 typedef struct {
00076 
00077     CARD8 bitsPerPixel;     /* 8,16,32 only */
00078 
00079     CARD8 depth;        /* 8 to 32 */
00080 
00081     CARD8 bigEndian;        /* True if multi-byte pixels are interpreted
00082                    as big endian, or if single-bit-per-pixel
00083                    has most significant bit of the byte
00084                    corresponding to first (leftmost) pixel. Of
00085                    course this is meaningless for 8 bits/pix */
00086 
00087     CARD8 trueColour;       /* If false then we need a "colour map" to
00088                    convert pixels to RGB.  If true, xxxMax and
00089                    xxxShift specify bits used for red, green
00090                    and blue */
00091 
00092     /* the following fields are only meaningful if trueColour is true */
00093 
00094     CARD16 redMax;      /* maximum red value (= 2^n - 1 where n is the
00095                    number of bits used for red). Note this
00096                    value is always in big endian order. */
00097 
00098     CARD16 greenMax;        /* similar for green */
00099 
00100     CARD16 blueMax;     /* and blue */
00101 
00102     CARD8 redShift;     /* number of shifts needed to get the red
00103                    value in a pixel to the least significant
00104                    bit. To find the red value from a given
00105                    pixel, do the following:
00106                    1) Swap pixel value according to bigEndian
00107                       (e.g. if bigEndian is false and host byte
00108                       order is big endian, then swap).
00109                    2) Shift right by redShift.
00110                    3) AND with redMax (in host byte order).
00111                    4) You now have the red value between 0 and
00112                       redMax. */
00113 
00114     CARD8 greenShift;       /* similar for green */
00115 
00116     CARD8 blueShift;        /* and blue */
00117 
00118     CARD8 pad1;
00119     CARD16 pad2;
00120 
00121 } rfbPixelFormat;
00122 
00123 #define sz_rfbPixelFormat 16
00124 
00125 
00126 
00127 /*****************************************************************************
00128  *
00129  * Initial handshaking messages
00130  *
00131  *****************************************************************************/
00132 
00133 /*-----------------------------------------------------------------------------
00134  * Protocol Version
00135  *
00136  * The server always sends 12 bytes to start which identifies the latest RFB
00137  * protocol version number which it supports.  These bytes are interpreted
00138  * as a string of 12 ASCII characters in the format "RFB xxx.yyy\n" where
00139  * xxx and yyy are the major and minor version numbers (for version 3.3
00140  * this is "RFB 003.003\n").
00141  *
00142  * The client then replies with a similar 12-byte message giving the version
00143  * number of the protocol which should actually be used (which may be different
00144  * to that quoted by the server).
00145  *
00146  * It is intended that both clients and servers may provide some level of
00147  * backwards compatibility by this mechanism.  Servers in particular should
00148  * attempt to provide backwards compatibility, and even forwards compatibility
00149  * to some extent.  For example if a client demands version 3.1 of the
00150  * protocol, a 3.0 server can probably assume that by ignoring requests for
00151  * encoding types it doesn't understand, everything will still work OK.  This
00152  * will probably not be the case for changes in the major version number.
00153  *
00154  * The format string below can be used in sprintf or sscanf to generate or
00155  * decode the version string respectively.
00156  */
00157 
00158 #define rfbProtocolVersionFormat "RFB %03d.%03d\n"
00159 #define rfbProtocolMajorVersion 3
00160 #define rfbProtocolMinorVersion 3
00161 
00162 typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */
00163 
00164 #define sz_rfbProtocolVersionMsg 12
00165 
00166 
00167 /*-----------------------------------------------------------------------------
00168  * Authentication
00169  *
00170  * Once the protocol version has been decided, the server then sends a 32-bit
00171  * word indicating whether any authentication is needed on the connection.
00172  * The value of this word determines the authentication scheme in use.  For
00173  * version 3.0 of the protocol this may have one of the following values:
00174  */
00175 
00176 #define rfbConnFailed 0
00177 #define rfbNoAuth 1
00178 #define rfbVncAuth 2
00179 
00180 /*
00181  * rfbConnFailed:   For some reason the connection failed (e.g. the server
00182  *          cannot support the desired protocol version).  This is
00183  *          followed by a string describing the reason (where a
00184  *          string is specified as a 32-bit length followed by that
00185  *          many ASCII characters).
00186  *
00187  * rfbNoAuth:       No authentication is needed.
00188  *
00189  * rfbVncAuth:      The VNC authentication scheme is to be used.  A 16-byte
00190  *          challenge follows, which the client encrypts as
00191  *          appropriate using the password and sends the resulting
00192  *          16-byte response.  If the response is correct, the
00193  *          server sends the 32-bit word rfbVncAuthOK.  If a simple
00194  *          failure happens, the server sends rfbVncAuthFailed and
00195  *          closes the connection. If the server decides that too
00196  *          many failures have occurred, it sends rfbVncAuthTooMany
00197  *          and closes the connection.  In the latter case, the
00198  *          server should not allow an immediate reconnection by
00199  *          the client.
00200  */
00201 
00202 #define rfbVncAuthOK 0
00203 #define rfbVncAuthFailed 1
00204 #define rfbVncAuthTooMany 2
00205 
00206 
00207 /*-----------------------------------------------------------------------------
00208  * Client Initialisation Message
00209  *
00210  * Once the client and server are sure that they're happy to talk to one
00211  * another, the client sends an initialisation message.  At present this
00212  * message only consists of a boolean indicating whether the server should try
00213  * to share the desktop by leaving other clients connected, or give exclusive
00214  * access to this client by disconnecting all other clients.
00215  */
00216 
00217 typedef struct {
00218     CARD8 shared;
00219 } rfbClientInitMsg;
00220 
00221 #define sz_rfbClientInitMsg 1
00222 
00223 
00224 /*-----------------------------------------------------------------------------
00225  * Server Initialisation Message
00226  *
00227  * After the client initialisation message, the server sends one of its own.
00228  * This tells the client the width and height of the server's framebuffer,
00229  * its pixel format and the name associated with the desktop.
00230  */
00231 
00232 typedef struct {
00233     CARD16 framebufferWidth;
00234     CARD16 framebufferHeight;
00235     rfbPixelFormat format;  /* the server's preferred pixel format */
00236     CARD32 nameLength;
00237     /* followed by char name[nameLength] */
00238 } rfbServerInitMsg;
00239 
00240 #define sz_rfbServerInitMsg (8 + sz_rfbPixelFormat)
00241 
00242 
00243 /*
00244  * Following the server initialisation message it's up to the client to send
00245  * whichever protocol messages it wants.  Typically it will send a
00246  * SetPixelFormat message and a SetEncodings message, followed by a
00247  * FramebufferUpdateRequest.  From then on the server will send
00248  * FramebufferUpdate messages in response to the client's
00249  * FramebufferUpdateRequest messages.  The client should send
00250  * FramebufferUpdateRequest messages with incremental set to true when it has
00251  * finished processing one FramebufferUpdate and is ready to process another.
00252  * With a fast client, the rate at which FramebufferUpdateRequests are sent
00253  * should be regulated to avoid hogging the network.
00254  */
00255 
00256 
00257 
00258 /*****************************************************************************
00259  *
00260  * Message types
00261  *
00262  *****************************************************************************/
00263 
00264 /* server -> client */
00265 
00266 #define rfbFramebufferUpdate 0
00267 #define rfbSetColourMapEntries 1
00268 #define rfbBell 2
00269 #define rfbServerCutText 3
00270 #define rfbReSizeFrameBuffer 0xF
00271 
00272 
00273 /* client -> server */
00274 
00275 #define rfbSetPixelFormat 0
00276 #define rfbFixColourMapEntries 1    /* not currently supported */
00277 #define rfbSetEncodings 2
00278 #define rfbFramebufferUpdateRequest 3
00279 #define rfbKeyEvent 4
00280 #define rfbPointerEvent 5
00281 #define rfbClientCutText 6
00282 #define rfbSetScaleFactor 0xF
00283 
00284 
00285 
00286 
00287 /*****************************************************************************
00288  *
00289  * Encoding types
00290  *
00291  *****************************************************************************/
00292 
00293 #define rfbEncodingRaw 0
00294 #define rfbEncodingCopyRect 1
00295 #define rfbEncodingRRE 2
00296 #define rfbEncodingCoRRE 4
00297 #define rfbEncodingHextile 5
00298 #define rfbEncodingZRLE 16
00299 
00300 
00301 
00302 /*****************************************************************************
00303  *
00304  * Server -> client message definitions
00305  *
00306  *****************************************************************************/
00307 
00308 
00309 /*-----------------------------------------------------------------------------
00310  * FramebufferUpdate - a block of rectangles to be copied to the framebuffer.
00311  *
00312  * This message consists of a header giving the number of rectangles of pixel
00313  * data followed by the rectangles themselves.  The header is padded so that
00314  * together with the type byte it is an exact multiple of 4 bytes (to help
00315  * with alignment of 32-bit pixels):
00316  */
00317 
00318 typedef struct {
00319     CARD8 type;         /* always rfbFramebufferUpdate */
00320     CARD8 pad;
00321     CARD16 nRects;
00322     /* followed by nRects rectangles */
00323 } rfbFramebufferUpdateMsg;
00324 
00325 #define sz_rfbFramebufferUpdateMsg 4
00326 
00327 /*
00328  * Each rectangle of pixel data consists of a header describing the position
00329  * and size of the rectangle and a type word describing the encoding of the
00330  * pixel data, followed finally by the pixel data.  Note that if the client has
00331  * not sent a SetEncodings message then it will only receive raw pixel data.
00332  * Also note again that this structure is a multiple of 4 bytes.
00333  */
00334 
00335 typedef struct {
00336     rfbRectangle r;
00337     CARD32 encoding;    /* one of the encoding types rfbEncoding... */
00338 } rfbFramebufferUpdateRectHeader;
00339 
00340 #define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4)
00341 
00342 
00343 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00344  * Raw Encoding.  Pixels are sent in top-to-bottom scanline order,
00345  * left-to-right within a scanline with no padding in between.
00346  */
00347 
00348 
00349 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00350  * CopyRect Encoding.  The pixels are specified simply by the x and y position
00351  * of the source rectangle.
00352  */
00353 
00354 typedef struct {
00355     CARD16 srcX;
00356     CARD16 srcY;
00357 } rfbCopyRect;
00358 
00359 #define sz_rfbCopyRect 4
00360 
00361 
00362 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00363  * RRE - Rise-and-Run-length Encoding.  We have an rfbRREHeader structure
00364  * giving the number of subrectangles following.  Finally the data follows in
00365  * the form [<bgpixel><subrect><subrect>...] where each <subrect> is
00366  * [<pixel><rfbRectangle>].
00367  */
00368 
00369 typedef struct {
00370     CARD32 nSubrects;
00371 } rfbRREHeader;
00372 
00373 #define sz_rfbRREHeader 4
00374 
00375 
00376 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00377  * CoRRE - Compact RRE Encoding.  We have an rfbRREHeader structure giving
00378  * the number of subrectangles following.  Finally the data follows in the form
00379  * [<bgpixel><subrect><subrect>...] where each <subrect> is
00380  * [<pixel><rfbCoRRERectangle>].  This means that
00381  * the whole rectangle must be at most 255x255 pixels.
00382  */
00383 
00384 typedef struct {
00385     CARD8 x;
00386     CARD8 y;
00387     CARD8 w;
00388     CARD8 h;
00389 } rfbCoRRERectangle;
00390 
00391 #define sz_rfbCoRRERectangle 4
00392 
00393 
00394 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00395  * Hextile Encoding.  The rectangle is divided up into "tiles" of 16x16 pixels,
00396  * starting at the top left going in left-to-right, top-to-bottom order.  If
00397  * the width of the rectangle is not an exact multiple of 16 then the width of
00398  * the last tile in each row will be correspondingly smaller.  Similarly if the
00399  * height is not an exact multiple of 16 then the height of each tile in the
00400  * final row will also be smaller.  Each tile begins with a "subencoding" type
00401  * byte, which is a mask made up of a number of bits.  If the Raw bit is set
00402  * then the other bits are irrelevant; w*h pixel values follow (where w and h
00403  * are the width and height of the tile).  Otherwise the tile is encoded in a
00404  * similar way to RRE, except that the position and size of each subrectangle
00405  * can be specified in just two bytes.  The other bits in the mask are as
00406  * follows:
00407  *
00408  * BackgroundSpecified - if set, a pixel value follows which specifies
00409  *    the background colour for this tile.  The first non-raw tile in a
00410  *    rectangle must have this bit set.  If this bit isn't set then the
00411  *    background is the same as the last tile.
00412  *
00413  * ForegroundSpecified - if set, a pixel value follows which specifies
00414  *    the foreground colour to be used for all subrectangles in this tile.
00415  *    If this bit is set then the SubrectsColoured bit must be zero.
00416  *
00417  * AnySubrects - if set, a single byte follows giving the number of
00418  *    subrectangles following.  If not set, there are no subrectangles (i.e.
00419  *    the whole tile is just solid background colour).
00420  *
00421  * SubrectsColoured - if set then each subrectangle is preceded by a pixel
00422  *    value giving the colour of that subrectangle.  If not set, all
00423  *    subrectangles are the same colour, the foreground colour;  if the
00424  *    ForegroundSpecified bit wasn't set then the foreground is the same as
00425  *    the last tile.
00426  *
00427  * The position and size of each subrectangle is specified in two bytes.  The
00428  * Pack macros below can be used to generate the two bytes from x, y, w, h,
00429  * and the Extract macros can be used to extract the x, y, w, h values from
00430  * the two bytes.
00431  */
00432 
00433 #define rfbHextileRaw           (1 << 0)
00434 #define rfbHextileBackgroundSpecified   (1 << 1)
00435 #define rfbHextileForegroundSpecified   (1 << 2)
00436 #define rfbHextileAnySubrects       (1 << 3)
00437 #define rfbHextileSubrectsColoured  (1 << 4)
00438 
00439 #define rfbHextilePackXY(x,y) (((x) << 4) | (y))
00440 #define rfbHextilePackWH(w,h) ((((w)-1) << 4) | ((h)-1))
00441 #define rfbHextileExtractX(byte) ((byte) >> 4)
00442 #define rfbHextileExtractY(byte) ((byte) & 0xf)
00443 #define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
00444 #define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
00445 
00446 
00447 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00448  * ZRLE - encoding combining Zlib compression, tiling, palettisation and
00449  * run-length encoding.
00450  */
00451 
00452 typedef struct {
00453     CARD32 length;
00454 } rfbZRLEHeader;
00455 
00456 #define sz_rfbZRLEHeader 4
00457 
00458 #define rfbZRLETileWidth 64
00459 #define rfbZRLETileHeight 64
00460 
00461 
00462 /*-----------------------------------------------------------------------------
00463  * SetColourMapEntries - these messages are only sent if the pixel
00464  * format uses a "colour map" (i.e. trueColour false) and the client has not
00465  * fixed the entire colour map using FixColourMapEntries.  In addition they
00466  * will only start being sent after the client has sent its first
00467  * FramebufferUpdateRequest.  So if the client always tells the server to use
00468  * trueColour then it never needs to process this type of message.
00469  */
00470 
00471 typedef struct {
00472     CARD8 type;         /* always rfbSetColourMapEntries */
00473     CARD8 pad;
00474     CARD16 firstColour;
00475     CARD16 nColours;
00476 
00477     /* Followed by nColours * 3 * CARD16
00478        r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
00479 
00480 } rfbSetColourMapEntriesMsg;
00481 
00482 #define sz_rfbSetColourMapEntriesMsg 6
00483 
00484 
00485 
00486 /*-----------------------------------------------------------------------------
00487  * Bell - ring a bell on the client if it has one.
00488  */
00489 
00490 typedef struct {
00491     CARD8 type;         /* always rfbBell */
00492 } rfbBellMsg;
00493 
00494 #define sz_rfbBellMsg 1
00495 
00496 
00497 
00498 /*-----------------------------------------------------------------------------
00499  * ServerCutText - the server has new text in its cut buffer.
00500  */
00501 
00502 typedef struct {
00503     CARD8 type;         /* always rfbServerCutText */
00504     CARD8 pad1;
00505     CARD16 pad2;
00506     CARD32 length;
00507     /* followed by char text[length] */
00508 } rfbServerCutTextMsg;
00509 
00510 #define sz_rfbServerCutTextMsg 8
00511 
00512 /*-----------------------------------------------------------------------------
00513  * ReSizeFrameBuffer - tell the RFB client to alter its framebuffer, either
00514  * due to a resize of the server desktop or a client-requested scaling factor.
00515  * The pixel format remains unchanged.
00516  */
00517 
00518 typedef struct {
00519     CARD8 type;                 /* always rfbReSizeFrameBuffer */
00520         CARD8 pad1;
00521         CARD16 desktop_w;       /* Desktop width */
00522         CARD16 desktop_h;       /* Desktop height */
00523         CARD16 buffer_w;        /* FrameBuffer width */
00524         CARD16 buffer_h;        /* Framebuffer height */
00525     CARD16 pad2;
00526 
00527 } rfbReSizeFrameBufferMsg;
00528 
00529 #define sz_rfbReSizeFrameBufferMsg (12)
00530 
00531 
00532 
00533 /*-----------------------------------------------------------------------------
00534  * Union of all server->client messages.
00535  */
00536 
00537 typedef union {
00538     CARD8 type;
00539     rfbFramebufferUpdateMsg fu;
00540     rfbSetColourMapEntriesMsg scme;
00541     rfbBellMsg b;
00542     rfbServerCutTextMsg sct;
00543     rfbReSizeFrameBufferMsg rsfb;
00544 } rfbServerToClientMsg;
00545 
00546 
00547 
00548 /*****************************************************************************
00549  *
00550  * Message definitions (client -> server)
00551  *
00552  *****************************************************************************/
00553 
00554 
00555 /*-----------------------------------------------------------------------------
00556  * SetPixelFormat - tell the RFB server the format in which the client wants
00557  * pixels sent.
00558  */
00559 
00560 typedef struct {
00561     CARD8 type;         /* always rfbSetPixelFormat */
00562     CARD8 pad1;
00563     CARD16 pad2;
00564     rfbPixelFormat format;
00565 } rfbSetPixelFormatMsg;
00566 
00567 #define sz_rfbSetPixelFormatMsg (sz_rfbPixelFormat + 4)
00568 
00569 
00570 /*-----------------------------------------------------------------------------
00571  * FixColourMapEntries - when the pixel format uses a "colour map", fix
00572  * read-only colour map entries.
00573  *
00574  *    ***************** NOT CURRENTLY SUPPORTED *****************
00575  */
00576 
00577 typedef struct {
00578     CARD8 type;         /* always rfbFixColourMapEntries */
00579     CARD8 pad;
00580     CARD16 firstColour;
00581     CARD16 nColours;
00582 
00583     /* Followed by nColours * 3 * CARD16
00584        r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
00585 
00586 } rfbFixColourMapEntriesMsg;
00587 
00588 #define sz_rfbFixColourMapEntriesMsg 6
00589 
00590 
00591 /*-----------------------------------------------------------------------------
00592  * SetEncodings - tell the RFB server which encoding types we accept.  Put them
00593  * in order of preference, if we have any.  We may always receive raw
00594  * encoding, even if we don't specify it here.
00595  */
00596 
00597 typedef struct {
00598     CARD8 type;         /* always rfbSetEncodings */
00599     CARD8 pad;
00600     CARD16 nEncodings;
00601     /* followed by nEncodings * CARD32 encoding types */
00602 } rfbSetEncodingsMsg;
00603 
00604 #define sz_rfbSetEncodingsMsg 4
00605 
00606 /*-----------------------------------------------------------------------------
00607  * SetScaleFactor - tell the RFB server to alter the scale factor for the
00608  * client buffer.
00609  */
00610 
00611 typedef struct {
00612     CARD8 type;                 /* always rfbSetScaleFactor */
00613     CARD8 scale;                /* Scale factor (positive non-zero integer) */
00614     CARD16 pad2;
00615 } rfbSetScaleFactorMsg;
00616 
00617 #define sz_rfbSetScaleFactorMsg (4)
00618 
00619 /*-----------------------------------------------------------------------------
00620  * FramebufferUpdateRequest - request for a framebuffer update.  If incremental
00621  * is true then the client just wants the changes since the last update.  If
00622  * false then it wants the whole of the specified rectangle.
00623  */
00624 
00625 typedef struct {
00626     CARD8 type;         /* always rfbFramebufferUpdateRequest */
00627     CARD8 incremental;
00628     CARD16 x;
00629     CARD16 y;
00630     CARD16 w;
00631     CARD16 h;
00632 } rfbFramebufferUpdateRequestMsg;
00633 
00634 #define sz_rfbFramebufferUpdateRequestMsg 10
00635 
00636 
00637 /*-----------------------------------------------------------------------------
00638  * KeyEvent - key press or release
00639  *
00640  * Keys are specified using the "keysym" values defined by the X Window System.
00641  * For most ordinary keys, the keysym is the same as the corresponding ASCII
00642  * value.  Other common keys are:
00643  *
00644  * BackSpace        0xff08
00645  * Tab          0xff09
00646  * Return or Enter  0xff0d
00647  * Escape       0xff1b
00648  * Insert       0xff63
00649  * Delete       0xffff
00650  * Home         0xff50
00651  * End          0xff57
00652  * Page Up      0xff55
00653  * Page Down        0xff56
00654  * Left         0xff51
00655  * Up           0xff52
00656  * Right        0xff53
00657  * Down         0xff54
00658  * F1           0xffbe
00659  * F2           0xffbf
00660  * ...          ...
00661  * F12          0xffc9
00662  * Shift        0xffe1
00663  * Control      0xffe3
00664  * Meta         0xffe7
00665  * Alt          0xffe9
00666  */
00667 
00668 typedef struct {
00669     CARD8 type;         /* always rfbKeyEvent */
00670     CARD8 down;         /* true if down (press), false if up */
00671     CARD16 pad;
00672     CARD32 key;         /* key is specified as an X keysym */
00673 } rfbKeyEventMsg;
00674 
00675 #define sz_rfbKeyEventMsg 8
00676 
00677 
00678 /*-----------------------------------------------------------------------------
00679  * PointerEvent - mouse/pen move and/or button press.
00680  */
00681 
00682 typedef struct {
00683     CARD8 type;         /* always rfbPointerEvent */
00684     CARD8 buttonMask;       /* bits 0-7 are buttons 1-8, 0=up, 1=down */
00685     CARD16 x;
00686     CARD16 y;
00687 } rfbPointerEventMsg;
00688 
00689 #define rfbButton1Mask 1
00690 #define rfbButton2Mask 2
00691 #define rfbButton3Mask 4
00692 #define rfbButton4Mask 8
00693 #define rfbButton5Mask 16
00694 #define rfbWheelUpMask rfbButton4Mask
00695 #define rfbWheelDownMask rfbButton5Mask
00696 
00697 #define sz_rfbPointerEventMsg 6
00698 
00699 
00700 
00701 /*-----------------------------------------------------------------------------
00702  * ClientCutText - the client has new text in its cut buffer.
00703  */
00704 
00705 typedef struct {
00706     CARD8 type;         /* always rfbClientCutText */
00707     CARD8 pad1;
00708     CARD16 pad2;
00709     CARD32 length;
00710     /* followed by char text[length] */
00711 } rfbClientCutTextMsg;
00712 
00713 #define sz_rfbClientCutTextMsg 8
00714 
00715 /*-----------------------------------------------------------------------------
00716  * Union of all client->server messages.
00717  */
00718 
00719 typedef union {
00720     CARD8 type;
00721     rfbSetPixelFormatMsg spf;
00722     rfbSetScaleFactorMsg ssf;
00723     rfbFixColourMapEntriesMsg fcme;
00724     rfbSetEncodingsMsg se;
00725     rfbFramebufferUpdateRequestMsg fur;
00726     rfbKeyEventMsg ke;
00727     rfbPointerEventMsg pe;
00728     rfbClientCutTextMsg cct;
00729 } rfbClientToServerMsg;

Generated on Tue May 25 08:05:00 2010 for VLC by  doxygen 1.5.6