Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
Pierre Ossman | b948a91 | 2014-01-15 13:23:43 +0100 | [diff] [blame] | 2 | * Copyright 2014 Pierre Ossman for Cendio AB |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 3 | * |
| 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> |
| 27 | #include <rfb/PixelFormat.h> |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 28 | #include <rfb/ScreenSet.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 29 | |
| 30 | namespace rdr { class InStream; } |
| 31 | |
| 32 | namespace rfb { |
| 33 | |
Pierre Ossman | b948a91 | 2014-01-15 13:23:43 +0100 | [diff] [blame] | 34 | const int subsampleUndefined = -1; |
| 35 | const int subsampleNone = 0; |
| 36 | const int subsampleGray = 1; |
| 37 | const int subsample2X = 2; |
| 38 | const int subsample4X = 3; |
| 39 | const int subsample8X = 4; |
| 40 | const int subsample16X = 5; |
| 41 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 42 | class ConnParams { |
| 43 | public: |
| 44 | ConnParams(); |
| 45 | ~ConnParams(); |
| 46 | |
| 47 | bool readVersion(rdr::InStream* is, bool* done); |
| 48 | void writeVersion(rdr::OutStream* os); |
| 49 | |
| 50 | int majorVersion; |
| 51 | int minorVersion; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 52 | |
| 53 | void setVersion(int major, int minor) { |
| 54 | majorVersion = major; minorVersion = minor; |
| 55 | } |
| 56 | bool isVersion(int major, int minor) { |
| 57 | return majorVersion == major && minorVersion == minor; |
| 58 | } |
| 59 | bool beforeVersion(int major, int minor) { |
| 60 | return (majorVersion < major || |
| 61 | (majorVersion == major && minorVersion < minor)); |
| 62 | } |
| 63 | bool afterVersion(int major, int minor) { |
| 64 | return !beforeVersion(major,minor+1); |
| 65 | } |
| 66 | |
| 67 | int width; |
| 68 | int height; |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 69 | ScreenSet screenLayout; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 70 | |
| 71 | const PixelFormat& pf() { return pf_; } |
| 72 | void setPF(const PixelFormat& pf); |
| 73 | |
| 74 | const char* name() { return name_; } |
| 75 | void setName(const char* name); |
| 76 | |
Peter Åstrand | 98fe98c | 2010-02-10 07:43:02 +0000 | [diff] [blame] | 77 | rdr::S32 currentEncoding() { return currentEncoding_; } |
Pierre Ossman | 941d290 | 2014-01-15 13:51:53 +0100 | [diff] [blame] | 78 | |
Peter Åstrand | 98fe98c | 2010-02-10 07:43:02 +0000 | [diff] [blame] | 79 | void setEncodings(int nEncodings, const rdr::S32* encodings); |
Pierre Ossman | 941d290 | 2014-01-15 13:51:53 +0100 | [diff] [blame] | 80 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 81 | bool useCopyRect; |
| 82 | |
| 83 | bool supportsLocalCursor; |
| 84 | bool supportsLocalXCursor; |
| 85 | bool supportsDesktopResize; |
Pierre Ossman | c5e2560 | 2009-03-20 12:59:05 +0000 | [diff] [blame] | 86 | bool supportsExtendedDesktopSize; |
Peter Åstrand | c39e078 | 2009-01-15 12:21:42 +0000 | [diff] [blame] | 87 | bool supportsDesktopRename; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 88 | bool supportsLastRect; |
| 89 | |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 90 | bool supportsSetDesktopSize; |
Pierre Ossman | c754cce | 2011-11-14 15:44:11 +0000 | [diff] [blame] | 91 | bool supportsFence; |
Pierre Ossman | c898d9a | 2011-11-14 16:22:23 +0000 | [diff] [blame] | 92 | bool supportsContinuousUpdates; |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 93 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 94 | int compressLevel; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 95 | int qualityLevel; |
DRC | b4a8323 | 2011-08-19 04:57:18 +0000 | [diff] [blame] | 96 | int fineQualityLevel; |
Pierre Ossman | b948a91 | 2014-01-15 13:23:43 +0100 | [diff] [blame] | 97 | int subsampling; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 98 | |
| 99 | private: |
| 100 | |
| 101 | PixelFormat pf_; |
| 102 | char* name_; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 103 | int currentEncoding_; |
| 104 | char verStr[13]; |
| 105 | int verStrPos; |
| 106 | }; |
| 107 | } |
| 108 | #endif |