blob: f9de72f31fcbf4596ed2723874bf5aab6c27b8e4 [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 +000028#include <rfb/InputHandler.h>
29
30namespace rdr { class OutStream; }
31
32namespace rfb {
33
34 class PixelFormat;
35 class ConnParams;
Steve Kondik1f5d4b12017-07-08 02:00:49 -070036 struct ScreenSet;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000037 struct Rect;
38
39 class CMsgWriter : public InputHandler {
40 public:
Pierre Ossman7638e9c2014-01-16 13:12:40 +010041 CMsgWriter(ConnParams* cp, rdr::OutStream* os);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000042 virtual ~CMsgWriter();
43
Pierre Ossman7638e9c2014-01-16 13:12:40 +010044 void writeClientInit(bool shared);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000045
Pierre Ossman7638e9c2014-01-16 13:12:40 +010046 void writeSetPixelFormat(const PixelFormat& pf);
47 void writeSetEncodings(int nEncodings, rdr::U32* encodings);
48 void writeSetEncodings(int preferredEncoding, bool useCopyRect);
49 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 Ossman7638e9c2014-01-16 13:12:40 +010056 // InputHandler implementation
57
58 virtual void keyEvent(rdr::U32 key, bool down);
59 virtual void pointerEvent(const Point& pos, int buttonMask);
60 virtual void clientCutText(const char* str, rdr::U32 len);
61
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000062 protected:
Pierre Ossman7638e9c2014-01-16 13:12:40 +010063 void startMsg(int type);
64 void endMsg();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000065
66 ConnParams* cp;
67 rdr::OutStream* os;
68 };
69}
70#endif