📄 rfbproto.h
字号:
* FramebufferUpdate - a block of rectangles to be copied to the framebuffer.
*
* This message consists of a header giving the number of rectangles of pixel
* data followed by the rectangles themselves. The header is padded so that
* together with the type byte it is an exact multiple of 4 bytes (to help
* with alignment of 32-bit pixels):
*/
typedef struct {
CARD8 type; /* always rfbFramebufferUpdate */
CARD8 pad;
CARD16 nRects;
/* followed by nRects rectangles */
} rfbFramebufferUpdateMsg;
#define sz_rfbFramebufferUpdateMsg 4
#ifdef DSHOW
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* KeyFrameUpdate - Acknowledgment of a key frame request, it tells the client
* that the next update received will be a key frame.
*/
typedef struct {
CARD8 type;
} rfbKeyFrameUpdateMsg;
#define sz_rfbKeyFrameUpdateMsg 1
#endif
/*
* Each rectangle of pixel data consists of a header describing the position
* and size of the rectangle and a type word describing the encoding of the
* pixel data, followed finally by the pixel data. Note that if the client has
* not sent a SetEncodings message then it will only receive raw pixel data.
* Also note again that this structure is a multiple of 4 bytes.
*/
typedef struct {
rfbRectangle r;
CARD32 encoding; /* one of the encoding types rfbEncoding... */
} rfbFramebufferUpdateRectHeader;
#define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4)
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Raw Encoding. Pixels are sent in top-to-bottom scanline order,
* left-to-right within a scanline with no padding in between.
*/
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* CopyRect Encoding. The pixels are specified simply by the x and y position
* of the source rectangle.
*/
typedef struct {
CARD16 srcX;
CARD16 srcY;
} rfbCopyRect;
#define sz_rfbCopyRect 4
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* RRE - Rise-and-Run-length Encoding. We have an rfbRREHeader structure
* giving the number of subrectangles following. Finally the data follows in
* the form [<bgpixel><subrect><subrect>...] where each <subrect> is
* [<pixel><rfbRectangle>].
*/
typedef struct {
CARD32 nSubrects;
} rfbRREHeader;
#define sz_rfbRREHeader 4
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* CoRRE - Compact RRE Encoding. We have an rfbRREHeader structure giving
* the number of subrectangles following. Finally the data follows in the form
* [<bgpixel><subrect><subrect>...] where each <subrect> is
* [<pixel><rfbCoRRERectangle>]. This means that
* the whole rectangle must be at most 255x255 pixels.
*/
typedef struct {
CARD8 x;
CARD8 y;
CARD8 w;
CARD8 h;
} rfbCoRRERectangle;
#define sz_rfbCoRRERectangle 4
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Hextile Encoding. The rectangle is divided up into "tiles" of 16x16 pixels,
* starting at the top left going in left-to-right, top-to-bottom order. If
* the width of the rectangle is not an exact multiple of 16 then the width of
* the last tile in each row will be correspondingly smaller. Similarly if the
* height is not an exact multiple of 16 then the height of each tile in the
* final row will also be smaller. Each tile begins with a "subencoding" type
* byte, which is a mask made up of a number of bits. If the Raw bit is set
* then the other bits are irrelevant; w*h pixel values follow (where w and h
* are the width and height of the tile). Otherwise the tile is encoded in a
* similar way to RRE, except that the position and size of each subrectangle
* can be specified in just two bytes. The other bits in the mask are as
* follows:
*
* BackgroundSpecified - if set, a pixel value follows which specifies
* the background colour for this tile. The first non-raw tile in a
* rectangle must have this bit set. If this bit isn't set then the
* background is the same as the last tile.
*
* ForegroundSpecified - if set, a pixel value follows which specifies
* the foreground colour to be used for all subrectangles in this tile.
* If this bit is set then the SubrectsColoured bit must be zero.
*
* AnySubrects - if set, a single byte follows giving the number of
* subrectangles following. If not set, there are no subrectangles (i.e.
* the whole tile is just solid background colour).
*
* SubrectsColoured - if set then each subrectangle is preceded by a pixel
* value giving the colour of that subrectangle. If not set, all
* subrectangles are the same colour, the foreground colour; if the
* ForegroundSpecified bit wasn't set then the foreground is the same as
* the last tile.
*
* The position and size of each subrectangle is specified in two bytes. The
* Pack macros below can be used to generate the two bytes from x, y, w, h,
* and the Extract macros can be used to extract the x, y, w, h values from
* the two bytes.
*/
#define rfbHextileRaw (1 << 0)
#define rfbHextileBackgroundSpecified (1 << 1)
#define rfbHextileForegroundSpecified (1 << 2)
#define rfbHextileAnySubrects (1 << 3)
#define rfbHextileSubrectsColoured (1 << 4)
#define rfbHextilePackXY(x,y) (((x) << 4) | (y))
#define rfbHextilePackWH(w,h) ((((w)-1) << 4) | ((h)-1))
#define rfbHextileExtractX(byte) ((byte) >> 4)
#define rfbHextileExtractY(byte) ((byte) & 0xf)
#define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
#define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* ZLIB - zlib compression Encoding. We have an rfbZlibHeader structure
* giving the number of bytes to follow. Finally the data follows in
* zlib compressed format.
*/
typedef struct {
CARD32 nBytes;
} rfbZlibHeader;
#define sz_rfbZlibHeader 4
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* ZRLE - encoding combining Zlib compression, tiling, palettisation and
* run-length encoding.
*/
typedef struct {
CARD32 length;
} rfbZRLEHeader;
#define sz_rfbZRLEHeader 4
#define rfbZRLETileWidth 64
#define rfbZRLETileHeight 64
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Tight Encoding. FIXME: Add more documentation.
*/
#define rfbTightExplicitFilter 0x04
#define rfbTightFill 0x08
#define rfbTightJpeg 0x09
#define rfbTightMaxSubencoding 0x09
/* Filters to improve compression efficiency */
#define rfbTightFilterCopy 0x00
#define rfbTightFilterPalette 0x01
#define rfbTightFilterGradient 0x02
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* ZLIBHEX - zlib compressed Hextile Encoding. Essentially, this is the
* hextile encoding with zlib compression on the tiles that can not be
* efficiently encoded with one of the other hextile subencodings. The
* new zlib subencoding uses two bytes to specify the length of the
* compressed tile and then the compressed data follows. As with the
* raw sub-encoding, the zlib subencoding invalidates the other
* values, if they are also set.
*/
#define rfbHextileZlibRaw (1 << 5)
#define rfbHextileZlibHex (1 << 6)
#define rfbHextileZlibMono (1 << 7)
/*-----------------------------------------------------------------------------
* SetColourMapEntries - these messages are only sent if the pixel
* format uses a "colour map" (i.e. trueColour false) and the client has not
* fixed the entire colour map using FixColourMapEntries. In addition they
* will only start being sent after the client has sent its first
* FramebufferUpdateRequest. So if the client always tells the server to use
* trueColour then it never needs to process this type of message.
*/
typedef struct {
CARD8 type; /* always rfbSetColourMapEntries */
CARD8 pad;
CARD16 firstColour;
CARD16 nColours;
/* Followed by nColours * 3 * CARD16
r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
} rfbSetColourMapEntriesMsg;
#define sz_rfbSetColourMapEntriesMsg 6
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* XCursor encoding. This is a special encoding used to transmit X-style
* cursor shapes from server to clients. Note that for this encoding,
* coordinates in rfbFramebufferUpdateRectHeader structure hold hotspot
* position (r.x, r.y) and cursor size (r.w, r.h). If (w * h != 0), two RGB
* samples are sent after header in the rfbXCursorColors structure. They
* denote foreground and background colors of the cursor. If a client
* supports only black-and-white cursors, it should ignore these colors and
* assume that foreground is black and background is white. Next, two bitmaps
* (1 bits per pixel) follow: first one with actual data (value 0 denotes
* background color, value 1 denotes foreground color), second one with
* transparency data (bits with zero value mean that these pixels are
* transparent). Both bitmaps represent cursor data in a byte stream, from
* left to right, from top to bottom, and each row is byte-aligned. Most
* significant bits correspond to leftmost pixels. The number of bytes in
* each row can be calculated as ((w + 7) / 8). If (w * h == 0), cursor
* should be hidden (or default local cursor should be set by the client).
*/
typedef struct {
CARD8 foreRed;
CARD8 foreGreen;
CARD8 foreBlue;
CARD8 backRed;
CARD8 backGreen;
CARD8 backBlue;
} rfbXCursorColors;
#define sz_rfbXCursorColors 6
/*-----------------------------------------------------------------------------
* Bell - ring a bell on the client if it has one.
*/
typedef struct {
CARD8 type; /* always rfbBell */
} rfbBellMsg;
#define sz_rfbBellMsg 1
/*-----------------------------------------------------------------------------
* ServerCutText - the server has new text in its cut buffer.
*/
typedef struct {
CARD8 type; /* always rfbServerCutText */
CARD8 pad1;
CARD16 pad2;
CARD32 length;
/* followed by char text[length] */
} rfbServerCutTextMsg;
#define sz_rfbServerCutTextMsg 8
/*-----------------------------------------------------------------------------
* // Modif sf@2002
* FileTransferMsg - The client sends FileTransfer message.
* Bidirectional message - Files can be sent from client to server & vice versa
*/
typedef struct _rfbFileTransferMsg {
CARD8 type; /* always rfbFileTransfer */
CARD8 contentType; // See defines below
CARD16 contentParam;// Other possible content classification (Dir or File name, etc..)
CARD32 size; // FileSize or packet index or error or other
// CARD32 sizeH; // Additional 32Bits params to handle big values. Only for V2 (we want backward compatibility between all V1 versions)
CARD32 length;
/* followed by data char text[length] */
} rfbFileTransferMsg;
#define sz_rfbFileTransferMsg 12
#define rfbFileTransferVersion 2 // v1 is the old FT version ( <= 1.0.0 RC18 versions)
// FileTransfer Content types and Params defines
#define rfbDirContentRequest 1 // Client asks for the content of a given Server directory
#define rfbDirPacket 2 // Full directory name or full file name.
// Null content means end of Directory
#define rfbFileTransferRequest 3 // Client asks the server for the transfer of a given file
#define rfbFileHeader 4 // First packet of a file transfer, containing file's features
#define rfbFilePacket 5 // One chunk of the file
#define rfbEndOfFile 6 // End of file transfer (the file has been received or error)
#define rfbAbortFileTransfer 7 // The file transfer must be aborted, whatever the state
#define rfbFileTransferOffer 8 // The client offers to send a file to the server
#define rfbFileAcceptHeader 9 // The server accepts or rejects the file
#define rfbCommand 10 // The Client sends a simple command (File Delete, Dir create etc...)
#define rfbCommandReturn 11 // The Client receives the server's answer about a simple command
#define rfbFileChecksums 12 // The zipped checksums of the destination file (Delta Transfer)
#define rfbFileTransferAccess 14 // Request FileTransfer authorization
// rfbDirContentRequest client Request - content params
#define rfbRDirContent 1 // Request a Server Directory contents
#define rfbRDrivesList 2 // Request the server's drives list
#define rfbRDirRecursiveList 3 // Request a server directory content recursive sorted list
#define rfbRDirRecursiveSize 4 // Request a server directory content recursive size
// rfbDirPacket & rfbCommandReturn server Answer - content params
#define rfbADirectory 1 // Reception of a directory name
#define rfbAFile 2 // Reception of a file name
#define rfbADrivesList 3 // Reception of a list of drives
#define rfbADirCreate 4 // Response to a create dir command
#define rfbADirDelete 5 // Response to a delete dir command
#define rfbAFileCreate 6 // Response to a create file command
#define rfbAFileDelete 7 // Response to a delete file command
#define rfbAFileRename 8 // Response to a rename file command
#define rfbADirRename 9 // Response to a rename dir command
#define rfbADirRecursiveListItem 10
#define rfbADirRecursiveSize 11
// rfbCommand Command - content params
#define rfbCDirCreate 1 // Request the server to create the given directory
#define rfbCDirDelete 2 // Request the server to delete the given directory
#define rfbCFileCreate 3 // Request the server to create the given file
#define rfbCFileDelete 4 // Request the server to delete the given file
#define rfbCFileRename 5 // Request the server to rename the given file
#define rfbCDirRename 6 // Request the server to rename the given directory
// Errors - content params or "size" field
#define rfbRErrorUnknownCmd 1 // Unknown FileTransfer command.
#define rfbRErrorCmd 0xFFFFFFFF// Error when a command fails on remote side (ret in "size" field)
#define sz_rfbBlockSize 8192 // Size of a File Transfer packet (before compression)
#define rfbZipDirectoryPrefix "!UVNCDIR-\0" // Transfered directory are zipped in a file with this prefix. Must end with "-"
#define sz_rfbZipDirectoryPrefix 9
#define rfbDirPrefix "[ "
#define rfbDirSuffix " ]"
/*-----------------------------------------------------------------------------
* Modif sf@2002
* TextChatMsg - Utilized to order the TextChat mode on server or client
* Bidirectional message
*/
typedef struct _rfbTextChatMsg {
CARD8 type; /* always rfbTextChat */
CARD8 pad1; // Could be used later as an additionnal param
CARD16 pad2; // Could be used later as text offset, for instance
CARD32 length; // Specific values for Open, close, finished (-1, -2, -3)
/* followed by char text[length] */
} rfbTextChatMsg;
#define sz_rfbTextChatMsg 8
#define rfbTextMaxSize 4096
#define rfbTextChatOpen 0xFFFFFFFF
#define rfbTextChatClose 0xFFFFFFFE
#define rfbTextChatFinished 0xFFFFFFFD
/*-----------------------------------------------------------------------------
* Modif sf@2002
* ResizeFrameBuffer - The Client must change the size of its framebuffer
*/
typedef struct _rfbResizeFrameBufferMsg {
CARD8 type; /* always rfbResizeFrameBuffer */
CARD8 pad1;
CARD16 framebufferWidth; // FrameBuffer width
CARD16 framebufferHeigth; // FrameBuffer height
} rfbResizeFrameBufferMsg;
#define sz_rfbResizeFrameBufferMsg 6
/*-----------------------------------------------------------------------------
* Modif TR@2004
* ModeChange - Handling des Richtungswechsels
*/
typedef struct _rfbModeChangeMsg {
CARD8 type; /* rfbModeChange or rfbModeChangeRequest */
CARD8 newmode; /* rfbCD_... */
CARD16 reserved; //
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -