blob: 1322186ad19569074de07a85ef99e42b690b992a [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 Ossman7638e9c2014-01-16 13:12:40 +010026#include <rdr/types.h>
27
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000028namespace rdr { class OutStream; }
29
30namespace rfb {
31
32 class PixelFormat;
33 class ConnParams;
Steve Kondik1f5d4b12017-07-08 02:00:49 -070034 struct ScreenSet;
Pierre Ossman59da99f2016-02-05 10:43:12 +010035 struct Point;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000036 struct Rect;
37
Pierre Ossman59da99f2016-02-05 10:43:12 +010038 class CMsgWriter {
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000039 public:
Pierre Ossman7638e9c2014-01-16 13:12:40 +010040 CMsgWriter(ConnParams* cp, rdr::OutStream* os);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000041 virtual ~CMsgWriter();
42
Pierre Ossman7638e9c2014-01-16 13:12:40 +010043 void writeClientInit(bool shared);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000044
Pierre Ossman7638e9c2014-01-16 13:12:40 +010045 void writeSetPixelFormat(const PixelFormat& pf);
46 void writeSetEncodings(int nEncodings, rdr::U32* encodings);
47 void writeSetEncodings(int preferredEncoding, bool useCopyRect);
48 void writeSetDesktopSize(int width, int height, const ScreenSet& layout);
Pierre Ossmane7a41d52009-03-23 16:48:35 +000049
Pierre Ossman7638e9c2014-01-16 13:12:40 +010050 void writeFramebufferUpdateRequest(const Rect& r,bool incremental);
51 void writeEnableContinuousUpdates(bool enable, int x, int y, int w, int h);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000052
Pierre Ossman7638e9c2014-01-16 13:12:40 +010053 void writeFence(rdr::U32 flags, unsigned len, const char data[]);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000054
Pierre Ossman59da99f2016-02-05 10:43:12 +010055 void writeKeyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
56 void writePointerEvent(const Point& pos, int buttonMask);
57 void writeClientCutText(const char* str, rdr::U32 len);
Pierre Ossman7638e9c2014-01-16 13:12:40 +010058
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000059 protected:
Pierre Ossman7638e9c2014-01-16 13:12:40 +010060 void startMsg(int type);
61 void endMsg();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000062
63 ConnParams* cp;
64 rdr::OutStream* os;
65 };
66}
67#endif