blob: 029e95c170e6d11e5ce2bcc5d4c3971e242d23b9 [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
Pierre Ossman7638e9c2014-01-16 13:12:40 +01002 * Copyright 2009-2014 Pierre Ossman for Cendio AB
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00003 *
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// CMsgReader - class for reading RFB messages on the server side
21// (i.e. messages from client to server).
22//
23
24#ifndef __RFB_CMSGREADER_H__
25#define __RFB_CMSGREADER_H__
26
27#include <rdr/types.h>
Pierre Ossman7638e9c2014-01-16 13:12:40 +010028
29#include <rfb/Rect.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000030#include <rfb/encodings.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000031
32namespace rdr { class InStream; }
33
34namespace rfb {
35 class CMsgHandler;
36 struct Rect;
37
38 class CMsgReader {
39 public:
Pierre Ossman7638e9c2014-01-16 13:12:40 +010040 CMsgReader(CMsgHandler* handler, rdr::InStream* is);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000041 virtual ~CMsgReader();
42
Pierre Ossman7638e9c2014-01-16 13:12:40 +010043 void readServerInit();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000044
45 // readMsg() reads a message, calling the handler as appropriate.
Pierre Ossman7638e9c2014-01-16 13:12:40 +010046 void readMsg();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000047
48 rdr::InStream* getInStream() { return is; }
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000049
50 int imageBufIdealSize;
51
52 protected:
Pierre Ossman7638e9c2014-01-16 13:12:40 +010053 void readSetColourMapEntries();
54 void readBell();
55 void readServerCutText();
56 void readFence();
57 void readEndOfContinuousUpdates();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000058
Pierre Ossman7638e9c2014-01-16 13:12:40 +010059 void readFramebufferUpdate();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000060
Pierre Ossman7638e9c2014-01-16 13:12:40 +010061 void readRect(const Rect& r, int encoding);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000062
Pierre Ossman6b68f972017-02-19 15:51:19 +010063 void readSetXCursor(int width, int height, const Point& hotspot);
Pierre Ossman7638e9c2014-01-16 13:12:40 +010064 void readSetCursor(int width, int height, const Point& hotspot);
Pierre Ossmana4c0aac2017-02-19 15:50:29 +010065 void readSetCursorWithAlpha(int width, int height, const Point& hotspot);
Pierre Ossman4a6266f2018-11-05 16:28:18 +010066 void readSetVMwareCursor(int width, int height, const Point& hotspot);
Pierre Ossman7638e9c2014-01-16 13:12:40 +010067 void readSetDesktopName(int x, int y, int w, int h);
68 void readExtendedDesktopSize(int x, int y, int w, int h);
Pierre Ossman2fa63f82016-12-05 15:26:21 +010069 void readLEDState();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000070
71 CMsgHandler* handler;
72 rdr::InStream* is;
Pierre Ossman7638e9c2014-01-16 13:12:40 +010073 int nUpdateRectsLeft;
Michal Srbc26b4b32017-04-06 23:52:22 +030074
75 static const int maxCursorSize = 256;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000076 };
77}
78#endif