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 |
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 | // CMsgWriter - class for writing RFB messages on the server side. |
| 21 | // |
| 22 | |
| 23 | #ifndef __RFB_CMSGWRITER_H__ |
| 24 | #define __RFB_CMSGWRITER_H__ |
| 25 | |
Pierre Ossman | 1143ee6 | 2018-06-20 11:40:37 +0200 | [diff] [blame] | 26 | #include <list> |
| 27 | |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 28 | #include <rdr/types.h> |
| 29 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 30 | namespace rdr { class OutStream; } |
| 31 | |
| 32 | namespace rfb { |
| 33 | |
| 34 | class PixelFormat; |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 35 | class ServerParams; |
Steve Kondik | 1f5d4b1 | 2017-07-08 02:00:49 -0700 | [diff] [blame] | 36 | struct ScreenSet; |
Pierre Ossman | 59da99f | 2016-02-05 10:43:12 +0100 | [diff] [blame] | 37 | struct Point; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 38 | struct Rect; |
| 39 | |
Pierre Ossman | 59da99f | 2016-02-05 10:43:12 +0100 | [diff] [blame] | 40 | class CMsgWriter { |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 41 | public: |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 42 | CMsgWriter(ServerParams* server, rdr::OutStream* os); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 43 | virtual ~CMsgWriter(); |
| 44 | |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 45 | void writeClientInit(bool shared); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 46 | |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 47 | void writeSetPixelFormat(const PixelFormat& pf); |
Pierre Ossman | 1143ee6 | 2018-06-20 11:40:37 +0200 | [diff] [blame] | 48 | void writeSetEncodings(const std::list<rdr::U32> encodings); |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 49 | void writeSetDesktopSize(int width, int height, const ScreenSet& layout); |
Pierre Ossman | e7a41d5 | 2009-03-23 16:48:35 +0000 | [diff] [blame] | 50 | |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 51 | void writeFramebufferUpdateRequest(const Rect& r,bool incremental); |
| 52 | void writeEnableContinuousUpdates(bool enable, int x, int y, int w, int h); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 53 | |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 54 | void writeFence(rdr::U32 flags, unsigned len, const char data[]); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 55 | |
Pierre Ossman | 59da99f | 2016-02-05 10:43:12 +0100 | [diff] [blame] | 56 | void writeKeyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); |
| 57 | void writePointerEvent(const Point& pos, int buttonMask); |
Pierre Ossman | 0ff2655 | 2016-02-05 10:26:56 +0100 | [diff] [blame^] | 58 | |
Pierre Ossman | 66f1db5 | 2019-05-02 12:32:03 +0200 | [diff] [blame] | 59 | void writeClientCutText(const char* str); |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 60 | |
Pierre Ossman | 0ff2655 | 2016-02-05 10:26:56 +0100 | [diff] [blame^] | 61 | void writeClipboardCaps(rdr::U32 caps, const rdr::U32* lengths); |
| 62 | void writeClipboardRequest(rdr::U32 flags); |
| 63 | void writeClipboardPeek(rdr::U32 flags); |
| 64 | void writeClipboardNotify(rdr::U32 flags); |
| 65 | void writeClipboardProvide(rdr::U32 flags, const size_t* lengths, |
| 66 | const rdr::U8* const* data); |
| 67 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 68 | protected: |
Pierre Ossman | 7638e9c | 2014-01-16 13:12:40 +0100 | [diff] [blame] | 69 | void startMsg(int type); |
| 70 | void endMsg(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 71 | |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 72 | ServerParams* server; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 73 | rdr::OutStream* os; |
| 74 | }; |
| 75 | } |
| 76 | #endif |