blob: 9e647baabb7904e2f91ac7a66ab8b35c05c4a5b2 [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
Pierre Ossmanc0397262014-03-14 15:59:46 +010026#include <set>
27
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000028#include <rdr/types.h>
Pierre Ossman126e5642014-02-13 14:40:25 +010029#include <rfb/Cursor.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000030#include <rfb/PixelFormat.h>
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000031#include <rfb/ScreenSet.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000032
33namespace rdr { class InStream; }
34
35namespace rfb {
36
Pierre Ossmanb948a912014-01-15 13:23:43 +010037 const int subsampleUndefined = -1;
38 const int subsampleNone = 0;
39 const int subsampleGray = 1;
40 const int subsample2X = 2;
41 const int subsample4X = 3;
42 const int subsample8X = 4;
43 const int subsample16X = 5;
44
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000045 class ConnParams {
46 public:
47 ConnParams();
48 ~ConnParams();
49
50 bool readVersion(rdr::InStream* is, bool* done);
51 void writeVersion(rdr::OutStream* os);
52
53 int majorVersion;
54 int minorVersion;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000055
56 void setVersion(int major, int minor) {
57 majorVersion = major; minorVersion = minor;
58 }
Pierre Ossmanf22d3502015-11-10 12:58:49 +010059 bool isVersion(int major, int minor) const {
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000060 return majorVersion == major && minorVersion == minor;
61 }
Pierre Ossmanf22d3502015-11-10 12:58:49 +010062 bool beforeVersion(int major, int minor) const {
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000063 return (majorVersion < major ||
64 (majorVersion == major && minorVersion < minor));
65 }
Pierre Ossmanf22d3502015-11-10 12:58:49 +010066 bool afterVersion(int major, int minor) const {
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000067 return !beforeVersion(major,minor+1);
68 }
69
70 int width;
71 int height;
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000072 ScreenSet screenLayout;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000073
Pierre Ossmanf22d3502015-11-10 12:58:49 +010074 const PixelFormat& pf() const { return pf_; }
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000075 void setPF(const PixelFormat& pf);
76
Pierre Ossmanf22d3502015-11-10 12:58:49 +010077 const char* name() const { return name_; }
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000078 void setName(const char* name);
79
Pierre Ossmanf22d3502015-11-10 12:58:49 +010080 const Cursor& cursor() const { return cursor_; }
Pierre Ossman126e5642014-02-13 14:40:25 +010081 void setCursor(const Cursor& cursor);
82
Pierre Ossmanf22d3502015-11-10 12:58:49 +010083 bool supportsEncoding(rdr::S32 encoding) const;
Pierre Ossman941d2902014-01-15 13:51:53 +010084
Peter Åstrand98fe98c2010-02-10 07:43:02 +000085 void setEncodings(int nEncodings, const rdr::S32* encodings);
Pierre Ossman941d2902014-01-15 13:51:53 +010086
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000087 bool useCopyRect;
88
89 bool supportsLocalCursor;
90 bool supportsLocalXCursor;
91 bool supportsDesktopResize;
Pierre Ossmanc5e25602009-03-20 12:59:05 +000092 bool supportsExtendedDesktopSize;
Peter Åstrandc39e0782009-01-15 12:21:42 +000093 bool supportsDesktopRename;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000094 bool supportsLastRect;
95
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000096 bool supportsSetDesktopSize;
Pierre Ossmanc754cce2011-11-14 15:44:11 +000097 bool supportsFence;
Pierre Ossmanc898d9a2011-11-14 16:22:23 +000098 bool supportsContinuousUpdates;
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000099
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000100 int compressLevel;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000101 int qualityLevel;
DRCb4a83232011-08-19 04:57:18 +0000102 int fineQualityLevel;
Pierre Ossmanb948a912014-01-15 13:23:43 +0100103 int subsampling;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000104
105 private:
106
107 PixelFormat pf_;
108 char* name_;
Pierre Ossman126e5642014-02-13 14:40:25 +0100109 Cursor cursor_;
Pierre Ossmanc0397262014-03-14 15:59:46 +0100110 std::set<rdr::S32> encodings_;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000111 char verStr[13];
112 int verStrPos;
113 };
114}
115#endif