blob: 8b4638c7aa84cb399bb6ba2198d2a92aedc3fae2 [file] [log] [blame]
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00001/* Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18//
19// CMsgReader - class for reading RFB messages on the server side
20// (i.e. messages from client to server).
21//
22
23#ifndef __RFB_CMSGREADER_H__
24#define __RFB_CMSGREADER_H__
25
26#include <rdr/types.h>
27#include <rfb/encodings.h>
28#include <rfb/Decoder.h>
29
30namespace rdr { class InStream; }
31
32namespace rfb {
33 class CMsgHandler;
34 struct Rect;
35
36 class CMsgReader {
37 public:
38 virtual ~CMsgReader();
39
40 virtual void readServerInit()=0;
41
42 // readMsg() reads a message, calling the handler as appropriate.
43 virtual void readMsg()=0;
44
45 rdr::InStream* getInStream() { return is; }
46 rdr::U8* getImageBuf(int required, int requested=0, int* nPixels=0);
47 int bpp();
48
49 int imageBufIdealSize;
50
51 protected:
52 virtual void readSetColourMapEntries();
53 virtual void readBell();
54 virtual void readServerCutText();
55
56 virtual void endMsg();
57
58 virtual void readFramebufferUpdateStart();
59 virtual void readFramebufferUpdateEnd();
60 virtual void readRect(const Rect& r, unsigned int encoding);
61
62 virtual void readCopyRect(const Rect& r);
63
64 virtual void readSetCursor(const Point& hotspot, const Point& size);
65
66 CMsgReader(CMsgHandler* handler, rdr::InStream* is);
67
68 CMsgHandler* handler;
69 rdr::InStream* is;
70 Decoder* decoders[encodingMax+1];
71 rdr::U8* imageBuf;
72 int imageBufSize;
73 };
74}
75#endif