0
|
1 // Copyright (C) 2010, 2011, 2012, 2013 GlavSoft LLC.
|
|
2 // All rights reserved.
|
|
3 //
|
|
4 //-------------------------------------------------------------------------
|
|
5 // This file is part of the TightVNC software. Please visit our Web site:
|
|
6 //
|
|
7 // http://www.tightvnc.com/
|
|
8 //
|
|
9 // This program is free software; you can redistribute it and/or modify
|
|
10 // it under the terms of the GNU General Public License as published by
|
|
11 // the Free Software Foundation; either version 2 of the License, or
|
|
12 // (at your option) any later version.
|
|
13 //
|
|
14 // This program is distributed in the hope that it will be useful,
|
|
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 // GNU General Public License for more details.
|
|
18 //
|
|
19 // You should have received a copy of the GNU General Public License along
|
|
20 // with this program; if not, write to the Free Software Foundation, Inc.,
|
|
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
22 //-------------------------------------------------------------------------
|
|
23 //
|
|
24
|
|
25 package com.glavsoft.rfb;
|
|
26
|
|
27 import com.glavsoft.exceptions.TransportException;
|
|
28 import com.glavsoft.transport.Reader;
|
|
29
|
|
30 /**
|
|
31 * Structure used to describe protocol options such as tunneling methods,
|
|
32 * authentication schemes and message types (protocol versions 3.7t, 3.8t).
|
|
33 * typedef struct _rfbCapabilityInfo {
|
|
34 * CARD32 code; // numeric identifier
|
|
35 * CARD8 vendorSignature[4]; // vendor identification
|
|
36 * CARD8 nameSignature[8]; // abbreviated option name
|
|
37 * } rfbCapabilityInfo;
|
|
38 */
|
|
39 public class RfbCapabilityInfo {
|
|
40 /*
|
|
41 * Vendors known by TightVNC: standard VNC/RealVNC, TridiaVNC, and TightVNC.
|
|
42 * #define rfbStandardVendor "STDV"
|
|
43 * #define rfbTridiaVncVendor "TRDV"
|
|
44 * #define rfbTightVncVendor "TGHT"
|
|
45 */
|
|
46 public static final String VENDOR_STANDARD = "STDV";
|
|
47 public static final String VENDOR_TRIADA = "TRDV";
|
|
48 public static final String VENDOR_TIGHT = "TGHT";
|
|
49
|
|
50 public static final String TUNNELING_NO_TUNNELING = "NOTUNNEL";
|
|
51
|
|
52 public static final String AUTHENTICATION_NO_AUTH = "NOAUTH__";
|
|
53 public static final String AUTHENTICATION_VNC_AUTH ="VNCAUTH_";
|
|
54
|
|
55 public static final String ENCODING_COPYRECT = "COPYRECT";
|
|
56 public static final String ENCODING_HEXTILE = "HEXTILE_";
|
|
57 public static final String ENCODING_ZLIB = "ZLIB____";
|
|
58 public static final String ENCODING_ZRLE = "ZRLE____";
|
|
59 public static final String ENCODING_RRE = "RRE_____";
|
|
60 public static final String ENCODING_TIGHT = "TIGHT___";
|
|
61 // "Pseudo" encoding types
|
|
62 public static final String ENCODING_RICH_CURSOR = "RCHCURSR";
|
|
63 public static final String ENCODING_CURSOR_POS = "POINTPOS";
|
|
64 public static final String ENCODING_DESKTOP_SIZE = "NEWFBSIZ";
|
|
65
|
|
66 private int code;
|
|
67 private String vendorSignature;
|
|
68 private String nameSignature;
|
|
69 private boolean enable;
|
|
70
|
|
71 public RfbCapabilityInfo(int code, String vendorSignature, String nameSignature) {
|
|
72 this.code = code;
|
|
73 this.vendorSignature = vendorSignature;
|
|
74 this.nameSignature = nameSignature;
|
|
75 enable = true;
|
|
76 }
|
|
77
|
|
78 public RfbCapabilityInfo(Reader reader) throws TransportException {
|
|
79 code = reader.readInt32();
|
|
80 vendorSignature = reader.readString(4);
|
|
81 nameSignature = reader.readString(8);
|
|
82 }
|
|
83
|
|
84 @Override
|
|
85 public boolean equals(Object otherObj) {
|
|
86 if (this == otherObj) { return true; }
|
|
87 if (null == otherObj) { return false; }
|
|
88 if (getClass() != otherObj.getClass()) { return false; }
|
|
89 RfbCapabilityInfo other = (RfbCapabilityInfo) otherObj;
|
|
90 return code == other.code &&
|
|
91 vendorSignature.equals(other.vendorSignature) &&
|
|
92 nameSignature.equals(other.nameSignature);
|
|
93 }
|
|
94
|
|
95 public void setEnable(boolean enable) {
|
|
96 this.enable = enable;
|
|
97 }
|
|
98
|
|
99 public int getCode() {
|
|
100 return code;
|
|
101 }
|
|
102
|
|
103 public String getVendorSignature() {
|
|
104 return vendorSignature;
|
|
105 }
|
|
106
|
|
107 public String getNameSignature() {
|
|
108 return nameSignature;
|
|
109 }
|
|
110
|
|
111 public boolean isEnabled() {
|
|
112 return enable;
|
|
113 }
|
|
114
|
|
115 @Override
|
|
116 public String toString() {
|
|
117 return "RfbCapabilityInfo: [code: " + code +
|
|
118 ", vendor: " + vendorSignature +
|
|
119 ", name: " + nameSignature +
|
|
120 "]";
|
|
121 }
|
|
122 }
|