summaryrefslogtreecommitdiffstats
path: root/libvncclient/vncviewer.c
diff options
context:
space:
mode:
authorVic Lee <llyzs@163.com>2010-01-15 13:47:43 +0800
committerJohannes Schindelin <johannes.schindelin@gmx.de>2010-01-16 11:28:00 +0100
commita2ad61755fb01031193bf89421f6bc2c8e706165 (patch)
tree35946fe5feee9e6061ff5cd4158281defd1e5a26 /libvncclient/vncviewer.c
parent909683fd970fa842a12d2437ea30a624caf2e761 (diff)
downloadlibtdevnc-a2ad61755fb01031193bf89421f6bc2c8e706165.tar.gz
libtdevnc-a2ad61755fb01031193bf89421f6bc2c8e706165.zip
Add UltraVNC Repeater support in libvncclient
[jes: adjusted coding style, made sure port is initialized correctly] Signed-off-by: Vic Lee <llyzs@163.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'libvncclient/vncviewer.c')
-rw-r--r--libvncclient/vncviewer.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c
index 111a7f6..fa150cd 100644
--- a/libvncclient/vncviewer.c
+++ b/libvncclient/vncviewer.c
@@ -119,6 +119,9 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
client->programName="";
client->serverHost=strdup("");
client->serverPort=5900;
+
+ client->destHost = NULL;
+ client->destPort = 5900;
client->CurrentKeyboardLedState = 0;
client->HandleKeyboardLedState = (HandleKeyboardLedStateProc)DummyPoint;
@@ -202,8 +205,15 @@ static rfbBool rfbInitConnection(rfbClient* client)
given VNC server */
if (!client->listenSpecified) {
- if (!client->serverHost || !ConnectToRFBServer(client,client->serverHost,client->serverPort))
+ if (!client->serverHost)
return FALSE;
+ if (client->destHost) {
+ if (!ConnectToRFBRepeater(client,client->serverHost,client->serverPort,client->destHost,client->destPort))
+ return FALSE;
+ } else {
+ if (!ConnectToRFBServer(client,client->serverHost,client->serverPort))
+ return FALSE;
+ }
}
/* Initialise the VNC connection, including reading the password */
@@ -278,6 +288,19 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) {
} else if (i+1<*argc && strcmp(argv[i], "-scale") == 0) {
client->appData.scaleSetting = atoi(argv[i+1]);
j+=2;
+ } else if (i+1<*argc && strcmp(argv[i], "-repeaterdest") == 0) {
+ char* colon=strchr(argv[i+1],':');
+
+ if(client->destHost)
+ free(client->destHost);
+ client->destPort = 5900;
+
+ client->destHost = strdup(argv[i+1]);
+ if(colon) {
+ client->destHost[(int)(colon-argv[i+1])] = '\0';
+ client->destPort = atoi(colon+1);
+ }
+ j+=2;
} else {
char* colon=strchr(argv[i],':');
@@ -342,6 +365,8 @@ void rfbClientCleanup(rfbClient* client) {
close(client->listenSock);
free(client->desktopName);
free(client->serverHost);
+ if (client->destHost)
+ free(client->destHost);
if (client->clientAuthSchemes)
free(client->clientAuthSchemes);
free(client);