blob: 7a6d60ccf91d8818c50be630ac6378150df507ef [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
Pierre Ossmanb948a912014-01-15 13:23:43 +01002 * Copyright 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// ConnParams - structure containing the connection parameters.
21//
22
23#ifndef __RFB_CONNPARAMS_H__
24#define __RFB_CONNPARAMS_H__
25
26#include <rdr/types.h>
Pierre Ossman126e5642014-02-13 14:40:25 +010027#include <rfb/Cursor.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000028#include <rfb/PixelFormat.h>
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000029#include <rfb/ScreenSet.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000030
31namespace rdr { class InStream; }
32
33namespace rfb {
34
Pierre Ossmanb948a912014-01-15 13:23:43 +010035 const int subsampleUndefined = -1;
36 const int subsampleNone = 0;
37 const int subsampleGray = 1;
38 const int subsample2X = 2;
39 const int subsample4X = 3;
40 const int subsample8X = 4;
41 const int subsample16X = 5;
42
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000043 class ConnParams {
44 public:
45 ConnParams();
46 ~ConnParams();
47
48 bool readVersion(rdr::InStream* is, bool* done);
49 void writeVersion(rdr::OutStream* os);
50
51 int majorVersion;
52 int minorVersion;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000053
54 void setVersion(int major, int minor) {
55 majorVersion = major; minorVersion = minor;
56 }
57 bool isVersion(int major, int minor) {
58 return majorVersion == major && minorVersion == minor;
59 }
60 bool beforeVersion(int major, int minor) {
61 return (majorVersion < major ||
62 (majorVersion == major && minorVersion < minor));
63 }
64 bool afterVersion(int major, int minor) {
65 return !beforeVersion(major,minor+1);
66 }
67
68 int width;
69 int height;
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000070 ScreenSet screenLayout;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000071
72 const PixelFormat& pf() { return pf_; }
73 void setPF(const PixelFormat& pf);
74
75 const char* name() { return name_; }
76 void setName(const char* name);
77
Pierre Ossman126e5642014-02-13 14:40:25 +010078 const Cursor& cursor() { return cursor_; }
79 void setCursor(const Cursor& cursor);
80
Peter Åstrand98fe98c2010-02-10 07:43:02 +000081 rdr::S32 currentEncoding() { return currentEncoding_; }
Pierre Ossman941d2902014-01-15 13:51:53 +010082
Peter Åstrand98fe98c2010-02-10 07:43:02 +000083 void setEncodings(int nEncodings, const rdr::S32* encodings);
Pierre Ossman941d2902014-01-15 13:51:53 +010084
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000085 bool useCopyRect;
86
87 bool supportsLocalCursor;
88 bool supportsLocalXCursor;
89 bool supportsDesktopResize;
Pierre Ossmanc5e25602009-03-20 12:59:05 +000090 bool supportsExtendedDesktopSize;
Peter Åstrandc39e0782009-01-15 12:21:42 +000091 bool supportsDesktopRename;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000092 bool supportsLastRect;
93
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000094 bool supportsSetDesktopSize;
Pierre Ossmanc754cce2011-11-14 15:44:11 +000095 bool supportsFence;
Pierre Ossmanc898d9a2011-11-14 16:22:23 +000096 bool supportsContinuousUpdates;
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000097
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000098 int compressLevel;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000099 int qualityLevel;
DRCb4a83232011-08-19 04:57:18 +0000100 int fineQualityLevel;
Pierre Ossmanb948a912014-01-15 13:23:43 +0100101 int subsampling;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000102
103 private:
104
105 PixelFormat pf_;
106 char* name_;
Pierre Ossman126e5642014-02-13 14:40:25 +0100107 Cursor cursor_;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000108 int currentEncoding_;
109 char verStr[13];
110 int verStrPos;
111 };
112}
113#endif