From 2c3a3a53f0f0c4e83ae4e15a3e9b372b2bd944ea Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 23 Oct 2012 00:36:55 -0700 Subject: [PATCH] Use client information object to complete handshake. --- .../protocol/ConfiguredGuacamoleSocket.java | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/guacamole-common/src/main/java/net/sourceforge/guacamole/protocol/ConfiguredGuacamoleSocket.java b/guacamole-common/src/main/java/net/sourceforge/guacamole/protocol/ConfiguredGuacamoleSocket.java index 1e57b171e..2fe2bcb14 100644 --- a/guacamole-common/src/main/java/net/sourceforge/guacamole/protocol/ConfiguredGuacamoleSocket.java +++ b/guacamole-common/src/main/java/net/sourceforge/guacamole/protocol/ConfiguredGuacamoleSocket.java @@ -64,7 +64,8 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket { /** * Creates a new ConfiguredGuacamoleSocket which uses the given * GuacamoleConfiguration to complete the initial protocol handshake over - * the given GuacamoleSocket. + * the given GuacamoleSocket. A default GuacamoleClientInformation object + * is used to provide basic client information. * * @param socket The GuacamoleSocket to wrap. * @param config The GuacamoleConfiguration to use to complete the initial @@ -74,6 +75,26 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket { */ public ConfiguredGuacamoleSocket(GuacamoleSocket socket, GuacamoleConfiguration config) throws GuacamoleException { + this(socket, config, new GuacamoleClientInformation()); + } + + + /** + * Creates a new ConfiguredGuacamoleSocket which uses the given + * GuacamoleConfiguration and GuacamoleClientInformation to complete the + * initial protocol handshake over the given GuacamoleSocket. + * + * @param socket The GuacamoleSocket to wrap. + * @param config The GuacamoleConfiguration to use to complete the initial + * protocol handshake. + * @param info The GuacamoleClientInformation to use to complete the initial + * protocol handshake. + * @throws GuacamoleException If an error occurs while completing the + * initial protocol handshake. + */ + public ConfiguredGuacamoleSocket(GuacamoleSocket socket, + GuacamoleConfiguration config, + GuacamoleClientInformation info) throws GuacamoleException { this.socket = socket; @@ -109,6 +130,21 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket { } + // Send size + writer.writeInstruction( + new GuacamoleInstruction( + Operation.CLIENT_SIZE, + Integer.toString(info.getOptimalScreenWidth()), + Integer.toString(info.getOptimalScreenHeight()) + ) + ); + + // Send supported audio formats (STUB) + writer.writeInstruction(new GuacamoleInstruction(Operation.CLIENT_AUDIO)); + + // Send supported video formats (STUB) + writer.writeInstruction(new GuacamoleInstruction(Operation.CLIENT_VIDEO)); + // Send args writer.writeInstruction(new GuacamoleInstruction(Operation.CLIENT_CONNECT, args));