Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 2 | * Copyright 2009-2014 Pierre Ossman for Cendio AB |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 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 | // 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 Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 28 | |
| 29 | #include <rfb/Rect.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 30 | #include <rfb/encodings.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 31 | |
| 32 | namespace rdr { class InStream; } |
| 33 | |
| 34 | namespace rfb { |
| 35 | class CMsgHandler; |
| 36 | struct Rect; |
| 37 | |
| 38 | class CMsgReader { |
| 39 | public: |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 40 | CMsgReader(CMsgHandler* handler, rdr::InStream* is); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 41 | virtual ~CMsgReader(); |
| 42 | |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 43 | void readServerInit(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 44 | |
| 45 | // readMsg() reads a message, calling the handler as appropriate. |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 46 | void readMsg(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 47 | |
| 48 | rdr::InStream* getInStream() { return is; } |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 49 | |
| 50 | int imageBufIdealSize; |
| 51 | |
| 52 | protected: |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 53 | void readSetColourMapEntries(); |
| 54 | void readBell(); |
| 55 | void readServerCutText(); |
| 56 | void readFence(); |
| 57 | void readEndOfContinuousUpdates(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 58 | |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 59 | void readFramebufferUpdate(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 60 | |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 61 | void readRect(const Rect& r, int encoding); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 62 | |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 63 | void readSetCursor(int width, int height, const Point& hotspot); |
| 64 | void readSetDesktopName(int x, int y, int w, int h); |
| 65 | void readExtendedDesktopSize(int x, int y, int w, int h); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 66 | |
| 67 | CMsgHandler* handler; |
| 68 | rdr::InStream* is; |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 69 | int nUpdateRectsLeft; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 70 | }; |
| 71 | } |
| 72 | #endif |