blob: fb96a7a6cdab77a6734b5a98dde0c2c109b5f7a8 [file] [log] [blame]
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00001/* Copyright (C) 2002-2003 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
28namespace rdr { class InStream; }
29
30namespace 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 supportsDesktopResize;
74
75 private:
76
77 PixelFormat pf_;
78 char* name_;
79 int nEncodings_;
80 rdr::U32* encodings_;
81 int currentEncoding_;
82 char verStr[13];
83 int verStrPos;
84 };
85}
86#endif