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> |
| 27 | |
| 28 | namespace rdr { class InStream; } |
| 29 | |
| 30 | namespace rfb { |
| 31 | |
| 32 | class ConnParams { |
| 33 | public: |
| 34 | ConnParams(); |
| 35 | ~ConnParams(); |
| 36 | |
| 37 | bool readVersion(rdr::InStream* is, bool* done); |
| 38 | void writeVersion(rdr::OutStream* os); |
| 39 | |
| 40 | int majorVersion; |
| 41 | int minorVersion; |
| 42 | |
| 43 | void setVersion(int major, int minor) { |
| 44 | majorVersion = major; minorVersion = minor; |
| 45 | } |
| 46 | bool isVersion(int major, int minor) { |
| 47 | return majorVersion == major && minorVersion == minor; |
| 48 | } |
| 49 | bool beforeVersion(int major, int minor) { |
| 50 | return (majorVersion < major || |
| 51 | (majorVersion == major && minorVersion < minor)); |
| 52 | } |
| 53 | bool afterVersion(int major, int minor) { |
| 54 | return !beforeVersion(major,minor+1); |
| 55 | } |
| 56 | |
| 57 | int width; |
| 58 | int height; |
| 59 | |
| 60 | const PixelFormat& pf() { return pf_; } |
| 61 | void setPF(const PixelFormat& pf); |
| 62 | |
| 63 | const char* name() { return name_; } |
| 64 | void setName(const char* name); |
| 65 | |
| 66 | rdr::U32 currentEncoding() { return currentEncoding_; } |
| 67 | int nEncodings() { return nEncodings_; } |
| 68 | const rdr::U32* encodings() { return encodings_; } |
| 69 | void setEncodings(int nEncodings, const rdr::U32* encodings); |
| 70 | bool useCopyRect; |
| 71 | |
| 72 | bool supportsLocalCursor; |
| 73 | bool supportsLocalXCursor; |
| 74 | bool supportsDesktopResize; |
| 75 | bool supportsLastRect; |
| 76 | |
| 77 | bool customCompressLevel; |
| 78 | int compressLevel; |
| 79 | bool noJpeg; |
| 80 | int qualityLevel; |
| 81 | |
| 82 | private: |
| 83 | |
| 84 | PixelFormat pf_; |
| 85 | char* name_; |
| 86 | int nEncodings_; |
| 87 | rdr::U32* encodings_; |
| 88 | int currentEncoding_; |
| 89 | char verStr[13]; |
| 90 | int verStrPos; |
| 91 | }; |
| 92 | } |
| 93 | #endif |