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_";
|
15
|
54
|
|
55 public static final String AUTHENTICATION_REQ_AUTH ="REQAUTH_";
|
0
|
56
|
|
57 public static final String ENCODING_COPYRECT = "COPYRECT";
|
|
58 public static final String ENCODING_HEXTILE = "HEXTILE_";
|
|
59 public static final String ENCODING_ZLIB = "ZLIB____";
|
|
60 public static final String ENCODING_ZRLE = "ZRLE____";
|
|
61 public static final String ENCODING_RRE = "RRE_____";
|
|
62 public static final String ENCODING_TIGHT = "TIGHT___";
|
|
63 // "Pseudo" encoding types
|
|
64 public static final String ENCODING_RICH_CURSOR = "RCHCURSR";
|
|
65 public static final String ENCODING_CURSOR_POS = "POINTPOS";
|
|
66 public static final String ENCODING_DESKTOP_SIZE = "NEWFBSIZ";
|
|
67
|
|
68 private int code;
|
|
69 private String vendorSignature;
|
|
70 private String nameSignature;
|
|
71 private boolean enable;
|
|
72
|
|
73 public RfbCapabilityInfo(int code, String vendorSignature, String nameSignature) {
|
|
74 this.code = code;
|
|
75 this.vendorSignature = vendorSignature;
|
|
76 this.nameSignature = nameSignature;
|
|
77 enable = true;
|
|
78 }
|
|
79
|
|
80 public RfbCapabilityInfo(Reader reader) throws TransportException {
|
|
81 code = reader.readInt32();
|
|
82 vendorSignature = reader.readString(4);
|
|
83 nameSignature = reader.readString(8);
|
|
84 }
|
|
85
|
|
86 @Override
|
|
87 public boolean equals(Object otherObj) {
|
|
88 if (this == otherObj) { return true; }
|
|
89 if (null == otherObj) { return false; }
|
|
90 if (getClass() != otherObj.getClass()) { return false; }
|
|
91 RfbCapabilityInfo other = (RfbCapabilityInfo) otherObj;
|
|
92 return code == other.code &&
|
|
93 vendorSignature.equals(other.vendorSignature) &&
|
|
94 nameSignature.equals(other.nameSignature);
|
|
95 }
|
|
96
|
|
97 public void setEnable(boolean enable) {
|
|
98 this.enable = enable;
|
|
99 }
|
|
100
|
|
101 public int getCode() {
|
|
102 return code;
|
|
103 }
|
|
104
|
|
105 public String getVendorSignature() {
|
|
106 return vendorSignature;
|
|
107 }
|
|
108
|
|
109 public String getNameSignature() {
|
|
110 return nameSignature;
|
|
111 }
|
|
112
|
|
113 public boolean isEnabled() {
|
|
114 return enable;
|
|
115 }
|
|
116
|
|
117 @Override
|
|
118 public String toString() {
|
|
119 return "RfbCapabilityInfo: [code: " + code +
|
|
120 ", vendor: " + vendorSignature +
|
|
121 ", name: " + nameSignature +
|
|
122 "]";
|
|
123 }
|
|
124 }
|