comparison src/main/java/com/glavsoft/rfb/protocol/state/InitTightState.java @ 0:4689cc86d6cb

create TreeViewer2 Repository
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Tue, 03 Jul 2012 13:20:49 +0900
parents
children 472a9bcacb21
comparison
equal deleted inserted replaced
-1:000000000000 0:4689cc86d6cb
1 // Copyright (C) 2010, 2011 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.protocol.state;
26
27 import com.glavsoft.exceptions.TransportException;
28 import com.glavsoft.rfb.encoding.ServerInitMessage;
29 import com.glavsoft.rfb.protocol.ProtocolContext;
30 import com.glavsoft.rfb.protocol.ProtocolSettings;
31
32 /**
33 * Server Interaction Capabilities Message (protocol versions 3.7t, 3.8t)
34 *
35 * If TightVNC protocol extensions are enabled, the server informs the client
36 * what message types it supports in addition to ones defined in the standard
37 * RFB protocol.
38 * Also, the server sends the list of all supported encodings (note that it's
39 * not necessary to advertise the "raw" encoding sinse it MUST be supported in
40 * RFB 3.x protocols).
41 *
42 * This data immediately follows the server initialisation message.
43 */
44 public class InitTightState extends InitState {
45
46 public InitTightState(ProtocolContext context) {
47 super(context);
48 }
49
50 /**
51 * typedef struct _rfbInteractionCapsMsg {
52 * CARD16 nServerMessageTypes;
53 * CARD16 nClientMessageTypes;
54 * CARD16 nEncodingTypes;
55 * CARD16 pad;><------><------>// reserved, must be 0
56 * // followed by nServerMessageTypes * rfbCapabilityInfo structures
57 * // followed by nClientMessageTypes * rfbCapabilityInfo structures
58 * } rfbInteractionCapsMsg;
59 * #define sz_rfbInteractionCapsMsg 8
60 */
61 @Override
62 protected void clientAndServerInit() throws TransportException {
63 ServerInitMessage serverInitMessage = getServerInitMessage();
64 int nServerMessageTypes = reader.readUInt16();
65 int nClientMessageTypes = reader.readUInt16();
66 int nEncodingTypes = reader.readUInt16();
67 reader.readUInt16(); //padding
68 ProtocolSettings settings = context.getSettings();
69 settings.serverMessagesCapabilities.read(reader, nServerMessageTypes);
70 settings.clientMessagesCapabilities.read(reader, nClientMessageTypes);
71 settings.encodingTypesCapabilities.read(reader, nEncodingTypes);
72 completeContextData(serverInitMessage);
73 }
74
75 }