blob: 7b36160957d05589223c03dfd7524d8e0e4d18d5 [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 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 readFramebufferUpdateStart();
57 virtual void readFramebufferUpdateEnd();
Peter Åstrand98fe98c2010-02-10 07:43:02 +000058 virtual void readRect(const Rect& r, int encoding);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000059
60 virtual void readCopyRect(const Rect& r);
61
62 virtual void readSetCursor(int width, int height, const Point& hotspot);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000063
64 CMsgReader(CMsgHandler* handler, rdr::InStream* is);
65
66 CMsgHandler* handler;
67 rdr::InStream* is;
68 Decoder* decoders[encodingMax+1];
69 rdr::U8* imageBuf;
70 int imageBufSize;
71 };
72}
73#endif