rfbproto.h
Upload User: sbftbdw
Upload Date: 2007-01-03
Package Size: 379k
Code Size: 22k
Category:

Remote Control

Development Platform:

Visual C++

  1. /*
  2.  *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
  3.  *
  4.  *  This is free software; you can redistribute it and/or modify
  5.  *  it under the terms of the GNU General Public License as published by
  6.  *  the Free Software Foundation; either version 2 of the License, or
  7.  *  (at your option) any later version.
  8.  *
  9.  *  This software is distributed in the hope that it will be useful,
  10.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  *  GNU General Public License for more details.
  13.  *
  14.  *  You should have received a copy of the GNU General Public License
  15.  *  along with this software; if not, write to the Free Software
  16.  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  17.  *  USA.
  18.  */
  19. /*
  20.  * rfbproto.h - header file for the RFB protocol version 3.3
  21.  *
  22.  * Uses types CARD<n> for an n-bit unsigned integer, INT<n> for an n-bit signed
  23.  * integer (for n = 8, 16 and 32).
  24.  *
  25.  * All multiple byte integers are in big endian (network) order (most
  26.  * significant byte first).  Unless noted otherwise there is no special
  27.  * alignment of protocol structures.
  28.  *
  29.  *
  30.  * Once the initial handshaking is done, all messages start with a type byte,
  31.  * (usually) followed by message-specific data.  The order of definitions in
  32.  * this file is as follows:
  33.  *
  34.  *  (1) Structures used in several types of message.
  35.  *  (2) Structures used in the initial handshaking.
  36.  *  (3) Message types.
  37.  *  (4) Encoding types.
  38.  *  (5) For each message type, the form of the data following the type byte.
  39.  *      Sometimes this is defined by a single structure but the more complex
  40.  *      messages have to be explained by comments.
  41.  */
  42. /*****************************************************************************
  43.  *
  44.  * Structures used in several messages
  45.  *
  46.  *****************************************************************************/
  47. /*-----------------------------------------------------------------------------
  48.  * Structure used to specify a rectangle.  This structure is a multiple of 4
  49.  * bytes so that it can be interspersed with 32-bit pixel data without
  50.  * affecting alignment.
  51.  */
  52. typedef struct {
  53.     CARD16 x;
  54.     CARD16 y;
  55.     CARD16 w;
  56.     CARD16 h;
  57. } rfbRectangle;
  58. #define sz_rfbRectangle 8
  59. /*-----------------------------------------------------------------------------
  60.  * Structure used to specify pixel format.
  61.  */
  62. typedef struct {
  63.     CARD8 bitsPerPixel; /* 8,16,32 only */
  64.     CARD8 depth; /* 8 to 32 */
  65.     CARD8 bigEndian; /* True if multi-byte pixels are interpreted
  66.    as big endian, or if single-bit-per-pixel
  67.    has most significant bit of the byte
  68.    corresponding to first (leftmost) pixel. Of
  69.    course this is meaningless for 8 bits/pix */
  70.     CARD8 trueColour; /* If false then we need a "colour map" to
  71.    convert pixels to RGB.  If true, xxxMax and
  72.    xxxShift specify bits used for red, green
  73.    and blue */
  74.     /* the following fields are only meaningful if trueColour is true */
  75.     CARD16 redMax; /* maximum red value (= 2^n - 1 where n is the
  76.    number of bits used for red). Note this
  77.    value is always in big endian order. */
  78.     CARD16 greenMax; /* similar for green */
  79.     CARD16 blueMax; /* and blue */
  80.     CARD8 redShift; /* number of shifts needed to get the red
  81.    value in a pixel to the least significant
  82.    bit. To find the red value from a given
  83.    pixel, do the following:
  84.    1) Swap pixel value according to bigEndian
  85.       (e.g. if bigEndian is false and host byte
  86.       order is big endian, then swap).
  87.    2) Shift right by redShift.
  88.    3) AND with redMax (in host byte order).
  89.    4) You now have the red value between 0 and
  90.       redMax. */
  91.     CARD8 greenShift; /* similar for green */
  92.     CARD8 blueShift; /* and blue */
  93.     CARD8 pad1;
  94.     CARD16 pad2;
  95. } rfbPixelFormat;
  96. #define sz_rfbPixelFormat 16
  97. /*****************************************************************************
  98.  *
  99.  * Initial handshaking messages
  100.  *
  101.  *****************************************************************************/
  102. /*-----------------------------------------------------------------------------
  103.  * Protocol Version
  104.  *
  105.  * The server always sends 12 bytes to start which identifies the latest RFB
  106.  * protocol version number which it supports.  These bytes are interpreted
  107.  * as a string of 12 ASCII characters in the format "RFB xxx.yyyn" where
  108.  * xxx and yyy are the major and minor version numbers (for version 3.3
  109.  * this is "RFB 003.003n").
  110.  *
  111.  * The client then replies with a similar 12-byte message giving the version
  112.  * number of the protocol which should actually be used (which may be different
  113.  * to that quoted by the server).
  114.  *
  115.  * It is intended that both clients and servers may provide some level of
  116.  * backwards compatibility by this mechanism.  Servers in particular should
  117.  * attempt to provide backwards compatibility, and even forwards compatibility
  118.  * to some extent.  For example if a client demands version 3.1 of the
  119.  * protocol, a 3.0 server can probably assume that by ignoring requests for
  120.  * encoding types it doesn't understand, everything will still work OK.  This
  121.  * will probably not be the case for changes in the major version number.
  122.  *
  123.  * The format string below can be used in sprintf or sscanf to generate or
  124.  * decode the version string respectively.
  125.  */
  126. #define rfbProtocolVersionFormat "RFB %03d.%03dn"
  127. #define rfbProtocolMajorVersion 3
  128. #define rfbProtocolMinorVersion 3
  129. typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */
  130. #define sz_rfbProtocolVersionMsg 12
  131. /*-----------------------------------------------------------------------------
  132.  * Authentication
  133.  *
  134.  * Once the protocol version has been decided, the server then sends a 32-bit
  135.  * word indicating whether any authentication is needed on the connection.
  136.  * The value of this word determines the authentication scheme in use.  For
  137.  * version 3.0 of the protocol this may have one of the following values:
  138.  */
  139. #define rfbConnFailed 0
  140. #define rfbNoAuth 1
  141. #define rfbVncAuth 2
  142. /*
  143.  * rfbConnFailed: For some reason the connection failed (e.g. the server
  144.  * cannot support the desired protocol version).  This is
  145.  * followed by a string describing the reason (where a
  146.  * string is specified as a 32-bit length followed by that
  147.  * many ASCII characters).
  148.  *
  149.  * rfbNoAuth: No authentication is needed.
  150.  *
  151.  * rfbVncAuth: The VNC authentication scheme is to be used.  A 16-byte
  152.  * challenge follows, which the client encrypts as
  153.  * appropriate using the password and sends the resulting
  154.  * 16-byte response.  If the response is correct, the
  155.  * server sends the 32-bit word rfbVncAuthOK.  If a simple
  156.  * failure happens, the server sends rfbVncAuthFailed and
  157.  * closes the connection. If the server decides that too
  158.  * many failures have occurred, it sends rfbVncAuthTooMany
  159.  * and closes the connection.  In the latter case, the
  160.  * server should not allow an immediate reconnection by
  161.  * the client.
  162.  */
  163. #define rfbVncAuthOK 0
  164. #define rfbVncAuthFailed 1
  165. #define rfbVncAuthTooMany 2
  166. /*-----------------------------------------------------------------------------
  167.  * Client Initialisation Message
  168.  *
  169.  * Once the client and server are sure that they're happy to talk to one
  170.  * another, the client sends an initialisation message.  At present this
  171.  * message only consists of a boolean indicating whether the server should try
  172.  * to share the desktop by leaving other clients connected, or give exclusive
  173.  * access to this client by disconnecting all other clients.
  174.  */
  175. typedef struct {
  176.     CARD8 shared;
  177. } rfbClientInitMsg;
  178. #define sz_rfbClientInitMsg 1
  179. /*-----------------------------------------------------------------------------
  180.  * Server Initialisation Message
  181.  *
  182.  * After the client initialisation message, the server sends one of its own.
  183.  * This tells the client the width and height of the server's framebuffer,
  184.  * its pixel format and the name associated with the desktop.
  185.  */
  186. typedef struct {
  187.     CARD16 framebufferWidth;
  188.     CARD16 framebufferHeight;
  189.     rfbPixelFormat format; /* the server's preferred pixel format */
  190.     CARD32 nameLength;
  191.     /* followed by char name[nameLength] */
  192. } rfbServerInitMsg;
  193. #define sz_rfbServerInitMsg (8 + sz_rfbPixelFormat)
  194. /*
  195.  * Following the server initialisation message it's up to the client to send
  196.  * whichever protocol messages it wants.  Typically it will send a
  197.  * SetPixelFormat message and a SetEncodings message, followed by a
  198.  * FramebufferUpdateRequest.  From then on the server will send
  199.  * FramebufferUpdate messages in response to the client's
  200.  * FramebufferUpdateRequest messages.  The client should send
  201.  * FramebufferUpdateRequest messages with incremental set to true when it has
  202.  * finished processing one FramebufferUpdate and is ready to process another.
  203.  * With a fast client, the rate at which FramebufferUpdateRequests are sent
  204.  * should be regulated to avoid hogging the network.
  205.  */
  206. /*****************************************************************************
  207.  *
  208.  * Message types
  209.  *
  210.  *****************************************************************************/
  211. /* server -> client */
  212. #define rfbFramebufferUpdate 0
  213. #define rfbSetColourMapEntries 1
  214. #define rfbBell 2
  215. #define rfbServerCutText 3
  216. /* client -> server */
  217. #define rfbSetPixelFormat 0
  218. #define rfbFixColourMapEntries 1 /* not currently supported */
  219. #define rfbSetEncodings 2
  220. #define rfbFramebufferUpdateRequest 3
  221. #define rfbKeyEvent 4
  222. #define rfbPointerEvent 5
  223. #define rfbClientCutText 6
  224. /*****************************************************************************
  225.  *
  226.  * Encoding types
  227.  *
  228.  *****************************************************************************/
  229. #define rfbEncodingRaw 0
  230. #define rfbEncodingCopyRect 1
  231. #define rfbEncodingRRE 2
  232. #define rfbEncodingCoRRE 4
  233. #define rfbEncodingHextile 5
  234. /*****************************************************************************
  235.  *
  236.  * Server -> client message definitions
  237.  *
  238.  *****************************************************************************/
  239. /*-----------------------------------------------------------------------------
  240.  * FramebufferUpdate - a block of rectangles to be copied to the framebuffer.
  241.  *
  242.  * This message consists of a header giving the number of rectangles of pixel
  243.  * data followed by the rectangles themselves.  The header is padded so that
  244.  * together with the type byte it is an exact multiple of 4 bytes (to help
  245.  * with alignment of 32-bit pixels):
  246.  */
  247. typedef struct {
  248.     CARD8 type; /* always rfbFramebufferUpdate */
  249.     CARD8 pad;
  250.     CARD16 nRects;
  251.     /* followed by nRects rectangles */
  252. } rfbFramebufferUpdateMsg;
  253. #define sz_rfbFramebufferUpdateMsg 4
  254. /*
  255.  * Each rectangle of pixel data consists of a header describing the position
  256.  * and size of the rectangle and a type word describing the encoding of the
  257.  * pixel data, followed finally by the pixel data.  Note that if the client has
  258.  * not sent a SetEncodings message then it will only receive raw pixel data.
  259.  * Also note again that this structure is a multiple of 4 bytes.
  260.  */
  261. typedef struct {
  262.     rfbRectangle r;
  263.     CARD32 encoding; /* one of the encoding types rfbEncoding... */
  264. } rfbFramebufferUpdateRectHeader;
  265. #define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4)
  266. /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  267.  * Raw Encoding.  Pixels are sent in top-to-bottom scanline order,
  268.  * left-to-right within a scanline with no padding in between.
  269.  */
  270. /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  271.  * CopyRect Encoding.  The pixels are specified simply by the x and y position
  272.  * of the source rectangle.
  273.  */
  274. typedef struct {
  275.     CARD16 srcX;
  276.     CARD16 srcY;
  277. } rfbCopyRect;
  278. #define sz_rfbCopyRect 4
  279. /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  280.  * RRE - Rise-and-Run-length Encoding.  We have an rfbRREHeader structure
  281.  * giving the number of subrectangles following.  Finally the data follows in
  282.  * the form [<bgpixel><subrect><subrect>...] where each <subrect> is
  283.  * [<pixel><rfbRectangle>].
  284.  */
  285. typedef struct {
  286.     CARD32 nSubrects;
  287. } rfbRREHeader;
  288. #define sz_rfbRREHeader 4
  289. /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  290.  * CoRRE - Compact RRE Encoding.  We have an rfbRREHeader structure giving
  291.  * the number of subrectangles following.  Finally the data follows in the form
  292.  * [<bgpixel><subrect><subrect>...] where each <subrect> is
  293.  * [<pixel><rfbCoRRERectangle>].  This means that
  294.  * the whole rectangle must be at most 255x255 pixels.
  295.  */
  296. typedef struct {
  297.     CARD8 x;
  298.     CARD8 y;
  299.     CARD8 w;
  300.     CARD8 h;
  301. } rfbCoRRERectangle;
  302. #define sz_rfbCoRRERectangle 4
  303. /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  304.  * Hextile Encoding.  The rectangle is divided up into "tiles" of 16x16 pixels,
  305.  * starting at the top left going in left-to-right, top-to-bottom order.  If
  306.  * the width of the rectangle is not an exact multiple of 16 then the width of
  307.  * the last tile in each row will be correspondingly smaller.  Similarly if the
  308.  * height is not an exact multiple of 16 then the height of each tile in the
  309.  * final row will also be smaller.  Each tile begins with a "subencoding" type
  310.  * byte, which is a mask made up of a number of bits.  If the Raw bit is set
  311.  * then the other bits are irrelevant; w*h pixel values follow (where w and h
  312.  * are the width and height of the tile).  Otherwise the tile is encoded in a
  313.  * similar way to RRE, except that the position and size of each subrectangle
  314.  * can be specified in just two bytes.  The other bits in the mask are as
  315.  * follows:
  316.  *
  317.  * BackgroundSpecified - if set, a pixel value follows which specifies
  318.  *    the background colour for this tile.  The first non-raw tile in a
  319.  *    rectangle must have this bit set.  If this bit isn't set then the
  320.  *    background is the same as the last tile.
  321.  *
  322.  * ForegroundSpecified - if set, a pixel value follows which specifies
  323.  *    the foreground colour to be used for all subrectangles in this tile.
  324.  *    If this bit is set then the SubrectsColoured bit must be zero.
  325.  *
  326.  * AnySubrects - if set, a single byte follows giving the number of
  327.  *    subrectangles following.  If not set, there are no subrectangles (i.e.
  328.  *    the whole tile is just solid background colour).
  329.  *
  330.  * SubrectsColoured - if set then each subrectangle is preceded by a pixel
  331.  *    value giving the colour of that subrectangle.  If not set, all
  332.  *    subrectangles are the same colour, the foreground colour;  if the
  333.  *    ForegroundSpecified bit wasn't set then the foreground is the same as
  334.  *    the last tile.
  335.  *
  336.  * The position and size of each subrectangle is specified in two bytes.  The
  337.  * Pack macros below can be used to generate the two bytes from x, y, w, h,
  338.  * and the Extract macros can be used to extract the x, y, w, h values from
  339.  * the two bytes.
  340.  */
  341. #define rfbHextileRaw (1 << 0)
  342. #define rfbHextileBackgroundSpecified (1 << 1)
  343. #define rfbHextileForegroundSpecified (1 << 2)
  344. #define rfbHextileAnySubrects (1 << 3)
  345. #define rfbHextileSubrectsColoured (1 << 4)
  346. #define rfbHextilePackXY(x,y) (((x) << 4) | (y))
  347. #define rfbHextilePackWH(w,h) ((((w)-1) << 4) | ((h)-1))
  348. #define rfbHextileExtractX(byte) ((byte) >> 4)
  349. #define rfbHextileExtractY(byte) ((byte) & 0xf)
  350. #define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
  351. #define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
  352. /*-----------------------------------------------------------------------------
  353.  * SetColourMapEntries - these messages are only sent if the pixel
  354.  * format uses a "colour map" (i.e. trueColour false) and the client has not
  355.  * fixed the entire colour map using FixColourMapEntries.  In addition they
  356.  * will only start being sent after the client has sent its first
  357.  * FramebufferUpdateRequest.  So if the client always tells the server to use
  358.  * trueColour then it never needs to process this type of message.
  359.  */
  360. typedef struct {
  361.     CARD8 type; /* always rfbSetColourMapEntries */
  362.     CARD8 pad;
  363.     CARD16 firstColour;
  364.     CARD16 nColours;
  365.     /* Followed by nColours * 3 * CARD16
  366.        r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
  367. } rfbSetColourMapEntriesMsg;
  368. #define sz_rfbSetColourMapEntriesMsg 6
  369. /*-----------------------------------------------------------------------------
  370.  * Bell - ring a bell on the client if it has one.
  371.  */
  372. typedef struct {
  373.     CARD8 type; /* always rfbBell */
  374. } rfbBellMsg;
  375. #define sz_rfbBellMsg 1
  376. /*-----------------------------------------------------------------------------
  377.  * ServerCutText - the server has new text in its cut buffer.
  378.  */
  379. typedef struct {
  380.     CARD8 type; /* always rfbServerCutText */
  381.     CARD8 pad1;
  382.     CARD16 pad2;
  383.     CARD32 length;
  384.     /* followed by char text[length] */
  385. } rfbServerCutTextMsg;
  386. #define sz_rfbServerCutTextMsg 8
  387. /*-----------------------------------------------------------------------------
  388.  * Union of all server->client messages.
  389.  */
  390. typedef union {
  391.     CARD8 type;
  392.     rfbFramebufferUpdateMsg fu;
  393.     rfbSetColourMapEntriesMsg scme;
  394.     rfbBellMsg b;
  395.     rfbServerCutTextMsg sct;
  396. } rfbServerToClientMsg;
  397. /*****************************************************************************
  398.  *
  399.  * Message definitions (client -> server)
  400.  *
  401.  *****************************************************************************/
  402. /*-----------------------------------------------------------------------------
  403.  * SetPixelFormat - tell the RFB server the format in which the client wants
  404.  * pixels sent.
  405.  */
  406. typedef struct {
  407.     CARD8 type; /* always rfbSetPixelFormat */
  408.     CARD8 pad1;
  409.     CARD16 pad2;
  410.     rfbPixelFormat format;
  411. } rfbSetPixelFormatMsg;
  412. #define sz_rfbSetPixelFormatMsg (sz_rfbPixelFormat + 4)
  413. /*-----------------------------------------------------------------------------
  414.  * FixColourMapEntries - when the pixel format uses a "colour map", fix
  415.  * read-only colour map entries.
  416.  *
  417.  *    ***************** NOT CURRENTLY SUPPORTED *****************
  418.  */
  419. typedef struct {
  420.     CARD8 type; /* always rfbFixColourMapEntries */
  421.     CARD8 pad;
  422.     CARD16 firstColour;
  423.     CARD16 nColours;
  424.     /* Followed by nColours * 3 * CARD16
  425.        r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
  426. } rfbFixColourMapEntriesMsg;
  427. #define sz_rfbFixColourMapEntriesMsg 6
  428. /*-----------------------------------------------------------------------------
  429.  * SetEncodings - tell the RFB server which encoding types we accept.  Put them
  430.  * in order of preference, if we have any.  We may always receive raw
  431.  * encoding, even if we don't specify it here.
  432.  */
  433. typedef struct {
  434.     CARD8 type; /* always rfbSetEncodings */
  435.     CARD8 pad;
  436.     CARD16 nEncodings;
  437.     /* followed by nEncodings * CARD32 encoding types */
  438. } rfbSetEncodingsMsg;
  439. #define sz_rfbSetEncodingsMsg 4
  440. /*-----------------------------------------------------------------------------
  441.  * FramebufferUpdateRequest - request for a framebuffer update.  If incremental
  442.  * is true then the client just wants the changes since the last update.  If
  443.  * false then it wants the whole of the specified rectangle.
  444.  */
  445. typedef struct {
  446.     CARD8 type; /* always rfbFramebufferUpdateRequest */
  447.     CARD8 incremental;
  448.     CARD16 x;
  449.     CARD16 y;
  450.     CARD16 w;
  451.     CARD16 h;
  452. } rfbFramebufferUpdateRequestMsg;
  453. #define sz_rfbFramebufferUpdateRequestMsg 10
  454. /*-----------------------------------------------------------------------------
  455.  * KeyEvent - key press or release
  456.  *
  457.  * Keys are specified using the "keysym" values defined by the X Window System.
  458.  * For most ordinary keys, the keysym is the same as the corresponding ASCII
  459.  * value.  Other common keys are:
  460.  *
  461.  * BackSpace 0xff08
  462.  * Tab 0xff09
  463.  * Return or Enter 0xff0d
  464.  * Escape 0xff1b
  465.  * Insert 0xff63
  466.  * Delete 0xffff
  467.  * Home 0xff50
  468.  * End 0xff57
  469.  * Page Up 0xff55
  470.  * Page Down 0xff56
  471.  * Left 0xff51
  472.  * Up 0xff52
  473.  * Right 0xff53
  474.  * Down 0xff54
  475.  * F1 0xffbe
  476.  * F2 0xffbf
  477.  * ... ...
  478.  * F12 0xffc9
  479.  * Shift 0xffe1
  480.  * Control 0xffe3
  481.  * Meta 0xffe7
  482.  * Alt 0xffe9
  483.  */
  484. typedef struct {
  485.     CARD8 type; /* always rfbKeyEvent */
  486.     CARD8 down; /* true if down (press), false if up */
  487.     CARD16 pad;
  488.     CARD32 key; /* key is specified as an X keysym */
  489. } rfbKeyEventMsg;
  490. #define sz_rfbKeyEventMsg 8
  491. /*-----------------------------------------------------------------------------
  492.  * PointerEvent - mouse/pen move and/or button press.
  493.  */
  494. typedef struct {
  495.     CARD8 type; /* always rfbPointerEvent */
  496.     CARD8 buttonMask; /* bits 0-7 are buttons 1-8, 0=up, 1=down */
  497.     CARD16 x;
  498.     CARD16 y;
  499. } rfbPointerEventMsg;
  500. #define rfbButton1Mask 1
  501. #define rfbButton2Mask 2
  502. #define rfbButton3Mask 4
  503. #define sz_rfbPointerEventMsg 6
  504. /*-----------------------------------------------------------------------------
  505.  * ClientCutText - the client has new text in its cut buffer.
  506.  */
  507. typedef struct {
  508.     CARD8 type; /* always rfbClientCutText */
  509.     CARD8 pad1;
  510.     CARD16 pad2;
  511.     CARD32 length;
  512.     /* followed by char text[length] */
  513. } rfbClientCutTextMsg;
  514. #define sz_rfbClientCutTextMsg 8
  515. /*-----------------------------------------------------------------------------
  516.  * Union of all client->server messages.
  517.  */
  518. typedef union {
  519.     CARD8 type;
  520.     rfbSetPixelFormatMsg spf;
  521.     rfbFixColourMapEntriesMsg fcme;
  522.     rfbSetEncodingsMsg se;
  523.     rfbFramebufferUpdateRequestMsg fur;
  524.     rfbKeyEventMsg ke;
  525.     rfbPointerEventMsg pe;
  526.     rfbClientCutTextMsg cct;
  527. } rfbClientToServerMsg;