Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
Pierre Ossman | 0ff2655 | 2016-02-05 10:26:56 +0100 | [diff] [blame] | 2 | * Copyright 2009-2019 Pierre Ossman for Cendio AB |
DRC | 33c15e3 | 2011-11-03 18:49:21 +0000 | [diff] [blame] | 3 | * Copyright (C) 2011 D. R. Commander. All Rights Reserved. |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 4 | * |
| 5 | * This is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This software is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this software; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 18 | * USA. |
| 19 | */ |
| 20 | // |
| 21 | // CMsgHandler - class to handle incoming messages on the client side. |
| 22 | // |
| 23 | |
| 24 | #ifndef __RFB_CMSGHANDLER_H__ |
| 25 | #define __RFB_CMSGHANDLER_H__ |
| 26 | |
| 27 | #include <rdr/types.h> |
| 28 | #include <rfb/Pixel.h> |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 29 | #include <rfb/ServerParams.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 30 | #include <rfb/Rect.h> |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 31 | #include <rfb/ScreenSet.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 32 | |
| 33 | namespace rdr { class InStream; } |
| 34 | |
| 35 | namespace rfb { |
| 36 | |
| 37 | class CMsgHandler { |
| 38 | public: |
| 39 | CMsgHandler(); |
| 40 | virtual ~CMsgHandler(); |
| 41 | |
| 42 | // The following methods are called as corresponding messages are read. A |
| 43 | // derived class should override these methods as desired. Note that for |
Pierre Ossman | dd45b44 | 2018-10-31 17:08:59 +0100 | [diff] [blame] | 44 | // the setDesktopSize(), setExtendedDesktopSize(), setPixelFormat(), |
Pierre Ossman | 0ff2655 | 2016-02-05 10:26:56 +0100 | [diff] [blame] | 45 | // setName(), serverInit() and clipboardCaps methods, a derived class |
| 46 | // should call on to CMsgHandler's methods to set the members of "server" |
| 47 | // appropriately. |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 48 | |
| 49 | virtual void setDesktopSize(int w, int h); |
Pierre Ossman | 28c1d54 | 2015-03-03 16:27:44 +0100 | [diff] [blame] | 50 | virtual void setExtendedDesktopSize(unsigned reason, unsigned result, |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 51 | int w, int h, |
| 52 | const ScreenSet& layout); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 53 | virtual void setCursor(int width, int height, const Point& hotspot, |
Pierre Ossman | 6a1a0d0 | 2017-02-19 15:48:17 +0100 | [diff] [blame] | 54 | const rdr::U8* data) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 55 | virtual void setPixelFormat(const PixelFormat& pf); |
| 56 | virtual void setName(const char* name); |
Pierre Ossman | c754cce | 2011-11-14 15:44:11 +0000 | [diff] [blame] | 57 | virtual void fence(rdr::U32 flags, unsigned len, const char data[]); |
Pierre Ossman | c898d9a | 2011-11-14 16:22:23 +0000 | [diff] [blame] | 58 | virtual void endOfContinuousUpdates(); |
Pierre Ossman | 5ae2821 | 2017-05-16 14:30:38 +0200 | [diff] [blame] | 59 | virtual void supportsQEMUKeyEvent(); |
Pierre Ossman | dd45b44 | 2018-10-31 17:08:59 +0100 | [diff] [blame] | 60 | virtual void serverInit(int width, int height, |
| 61 | const PixelFormat& pf, |
| 62 | const char* name) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 63 | |
Pierre Ossman | a4c0aac | 2017-02-19 15:50:29 +0100 | [diff] [blame] | 64 | virtual void readAndDecodeRect(const Rect& r, int encoding, |
| 65 | ModifiablePixelBuffer* pb) = 0; |
| 66 | |
Pierre Ossman | f3b0ade | 2015-02-04 14:11:11 +0100 | [diff] [blame] | 67 | virtual void framebufferUpdateStart(); |
| 68 | virtual void framebufferUpdateEnd(); |
Pierre Ossman | fdba3fe | 2014-01-31 13:12:18 +0100 | [diff] [blame] | 69 | virtual void dataRect(const Rect& r, int encoding) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 70 | |
| 71 | virtual void setColourMapEntries(int firstColour, int nColours, |
Adam Tkac | c184d95 | 2009-06-16 10:50:06 +0000 | [diff] [blame] | 72 | rdr::U16* rgbs) = 0; |
| 73 | virtual void bell() = 0; |
Pierre Ossman | 66f1db5 | 2019-05-02 12:32:03 +0200 | [diff] [blame] | 74 | virtual void serverCutText(const char* str) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 75 | |
Pierre Ossman | 2fa63f8 | 2016-12-05 15:26:21 +0100 | [diff] [blame] | 76 | virtual void setLEDState(unsigned int state); |
| 77 | |
Pierre Ossman | 0ff2655 | 2016-02-05 10:26:56 +0100 | [diff] [blame] | 78 | virtual void handleClipboardCaps(rdr::U32 flags, |
| 79 | const rdr::U32* lengths); |
| 80 | virtual void handleClipboardRequest(rdr::U32 flags); |
| 81 | virtual void handleClipboardPeek(rdr::U32 flags); |
| 82 | virtual void handleClipboardNotify(rdr::U32 flags); |
| 83 | virtual void handleClipboardProvide(rdr::U32 flags, |
| 84 | const size_t* lengths, |
| 85 | const rdr::U8* const* data); |
| 86 | |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 87 | ServerParams server; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 88 | }; |
| 89 | } |
| 90 | #endif |