blob: 7b839393833aa64f04739e29e24e62f07096f4c0 [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
Pierre Ossman0ff26552016-02-05 10:26:56 +01002 * Copyright 2009-2019 Pierre Ossman for Cendio AB
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00003 *
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 Ossman1143ee62018-06-20 11:40:37 +020026#include <list>
27
Pierre Ossman7638e9c2014-01-16 13:12:40 +010028#include <rdr/types.h>
29
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000030namespace rdr { class OutStream; }
31
32namespace rfb {
33
34 class PixelFormat;
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020035 class ServerParams;
Steve Kondik1f5d4b12017-07-08 02:00:49 -070036 struct ScreenSet;
Pierre Ossman59da99f2016-02-05 10:43:12 +010037 struct Point;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000038 struct Rect;
39
Pierre Ossman59da99f2016-02-05 10:43:12 +010040 class CMsgWriter {
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000041 public:
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020042 CMsgWriter(ServerParams* server, rdr::OutStream* os);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000043 virtual ~CMsgWriter();
44
Pierre Ossman7638e9c2014-01-16 13:12:40 +010045 void writeClientInit(bool shared);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000046
Pierre Ossman7638e9c2014-01-16 13:12:40 +010047 void writeSetPixelFormat(const PixelFormat& pf);
Pierre Ossman1143ee62018-06-20 11:40:37 +020048 void writeSetEncodings(const std::list<rdr::U32> encodings);
Pierre Ossman7638e9c2014-01-16 13:12:40 +010049 void writeSetDesktopSize(int width, int height, const ScreenSet& layout);
Pierre Ossmane7a41d52009-03-23 16:48:35 +000050
Pierre Ossman7638e9c2014-01-16 13:12:40 +010051 void writeFramebufferUpdateRequest(const Rect& r,bool incremental);
52 void writeEnableContinuousUpdates(bool enable, int x, int y, int w, int h);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000053
Pierre Ossman7638e9c2014-01-16 13:12:40 +010054 void writeFence(rdr::U32 flags, unsigned len, const char data[]);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000055
Pierre Ossman59da99f2016-02-05 10:43:12 +010056 void writeKeyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
57 void writePointerEvent(const Point& pos, int buttonMask);
Pierre Ossman0ff26552016-02-05 10:26:56 +010058
Pierre Ossman66f1db52019-05-02 12:32:03 +020059 void writeClientCutText(const char* str);
Pierre Ossman7638e9c2014-01-16 13:12:40 +010060
Pierre Ossman0ff26552016-02-05 10:26:56 +010061 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 Kaplinskya2adc8d2006-05-25 05:01:55 +000068 protected:
Pierre Ossman7638e9c2014-01-16 13:12:40 +010069 void startMsg(int type);
70 void endMsg();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000071
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020072 ServerParams* server;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000073 rdr::OutStream* os;
74 };
75}
76#endif