Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | */ |
| 18 | // |
| 19 | // ConnParams - structure containing the connection parameters. |
| 20 | // |
| 21 | |
| 22 | #ifndef __RFB_CONNPARAMS_H__ |
| 23 | #define __RFB_CONNPARAMS_H__ |
| 24 | |
| 25 | #include <rdr/types.h> |
| 26 | #include <rfb/PixelFormat.h> |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 27 | #include <rfb/ScreenSet.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 28 | |
| 29 | namespace rdr { class InStream; } |
| 30 | |
| 31 | namespace rfb { |
| 32 | |
| 33 | class ConnParams { |
| 34 | public: |
| 35 | ConnParams(); |
| 36 | ~ConnParams(); |
| 37 | |
| 38 | bool readVersion(rdr::InStream* is, bool* done); |
| 39 | void writeVersion(rdr::OutStream* os); |
| 40 | |
| 41 | int majorVersion; |
| 42 | int minorVersion; |
Constantin Kaplinsky | ce0907d | 2006-09-08 12:55:37 +0000 | [diff] [blame] | 43 | bool tightExtensionsEnabled; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 44 | |
| 45 | void setVersion(int major, int minor) { |
| 46 | majorVersion = major; minorVersion = minor; |
| 47 | } |
| 48 | bool isVersion(int major, int minor) { |
| 49 | return majorVersion == major && minorVersion == minor; |
| 50 | } |
| 51 | bool beforeVersion(int major, int minor) { |
| 52 | return (majorVersion < major || |
| 53 | (majorVersion == major && minorVersion < minor)); |
| 54 | } |
| 55 | bool afterVersion(int major, int minor) { |
| 56 | return !beforeVersion(major,minor+1); |
| 57 | } |
| 58 | |
| 59 | int width; |
| 60 | int height; |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 61 | ScreenSet screenLayout; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 62 | |
| 63 | const PixelFormat& pf() { return pf_; } |
| 64 | void setPF(const PixelFormat& pf); |
| 65 | |
| 66 | const char* name() { return name_; } |
| 67 | void setName(const char* name); |
| 68 | |
Peter Åstrand | 98fe98c | 2010-02-10 07:43:02 +0000 | [diff] [blame^] | 69 | rdr::S32 currentEncoding() { return currentEncoding_; } |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 70 | int nEncodings() { return nEncodings_; } |
Peter Åstrand | 98fe98c | 2010-02-10 07:43:02 +0000 | [diff] [blame^] | 71 | const rdr::S32* encodings() { return encodings_; } |
| 72 | void setEncodings(int nEncodings, const rdr::S32* encodings); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 73 | bool useCopyRect; |
| 74 | |
| 75 | bool supportsLocalCursor; |
| 76 | bool supportsLocalXCursor; |
| 77 | bool supportsDesktopResize; |
Pierre Ossman | c5e2560 | 2009-03-20 12:59:05 +0000 | [diff] [blame] | 78 | bool supportsExtendedDesktopSize; |
Peter Åstrand | c39e078 | 2009-01-15 12:21:42 +0000 | [diff] [blame] | 79 | bool supportsDesktopRename; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 80 | bool supportsLastRect; |
| 81 | |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 82 | bool supportsSetDesktopSize; |
| 83 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 84 | bool customCompressLevel; |
| 85 | int compressLevel; |
| 86 | bool noJpeg; |
| 87 | int qualityLevel; |
| 88 | |
| 89 | private: |
| 90 | |
| 91 | PixelFormat pf_; |
| 92 | char* name_; |
| 93 | int nEncodings_; |
Peter Åstrand | 98fe98c | 2010-02-10 07:43:02 +0000 | [diff] [blame^] | 94 | rdr::S32* encodings_; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 95 | int currentEncoding_; |
| 96 | char verStr[13]; |
| 97 | int verStrPos; |
| 98 | }; |
| 99 | } |
| 100 | #endif |