blob: 4d533d425de7000ec8c87de7a8766b4bd782d99d [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
Pierre Ossman7638e9c2014-01-16 13:12:40 +01002 * Copyright 2009-2014 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);
58 void writeClientCutText(const char* str, rdr::U32 len);
Pierre Ossman7638e9c2014-01-16 13:12:40 +010059
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000060 protected:
Pierre Ossman7638e9c2014-01-16 13:12:40 +010061 void startMsg(int type);
62 void endMsg();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000063
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020064 ServerParams* server;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000065 rdr::OutStream* os;
66 };
67}
68#endif