Merge branch 'repeater'

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Conflicts:
	.gitignore
pull/1/head
Johannes Schindelin 11 years ago
commit 646f844f69

4
.gitignore vendored

@ -48,9 +48,11 @@ examples/colourmaptest
examples/example examples/example
examples/filetransfer examples/filetransfer
examples/fontsel examples/fontsel
examples/mac
examples/pnmshow examples/pnmshow
examples/pnmshow24 examples/pnmshow24
examples/regiontest examples/regiontest
examples/repeater
examples/rotate examples/rotate
examples/simple examples/simple
examples/simple15 examples/simple15
@ -78,3 +80,5 @@ CMakeCache.txt
cmake_install.cmake cmake_install.cmake
/CMakeFiles /CMakeFiles
/rfbproto.pdf /rfbproto.pdf
/rfbproto.rst
/vencrypt.txt

@ -23,5 +23,5 @@ noinst_HEADERS=radon.h rotatetemplate.c
noinst_PROGRAMS=example pnmshow regiontest pnmshow24 fontsel \ noinst_PROGRAMS=example pnmshow regiontest pnmshow24 fontsel \
vncev storepasswd colourmaptest simple simple15 $(MAC) \ vncev storepasswd colourmaptest simple simple15 $(MAC) \
$(FILETRANSFER) backchannel $(BLOOPTEST) camera rotate \ $(FILETRANSFER) backchannel $(BLOOPTEST) camera rotate \
zippy zippy repeater

@ -0,0 +1,68 @@
/* This example shows how to connect to an UltraVNC repeater. */
#include <rfb/rfb.h>
static void clientGone(rfbClientPtr cl)
{
rfbShutdownServer(cl->screen, TRUE);
}
int main(int argc,char** argv)
{
char *repeaterHost;
int repeaterPort, sock;
char id[250];
rfbClientPtr cl;
int i,j;
uint16_t* f;
/* Parse command-line arguments */
if (argc < 3) {
fprintf(stderr,
"Usage: %s <id> <repeater-host> [<repeater-port>]\n", argv[0]);
exit(1);
}
snprintf(id, sizeof(id) - 1, "ID:%s", argv[1]);
repeaterHost = argv[2];
repeaterPort = argc < 4 ? 5500 : atoi(argv[3]);
/* The initialization is identical to simple15.c */
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,5,3,2);
if(!server)
return 0;
server->frameBuffer=(char*)malloc(400*300*2);
f=(uint16_t*)server->frameBuffer;
for(j=0;j<300;j++)
for(i=0;i<400;i++)
f[j*400+i]=/* red */ ((j*32/300) << 10) |
/* green */ (((j+400-i)*32/700) << 5) |
/* blue */ ((i*32/400));
/* Now for the repeater-specific part: */
server->port = -1; /* do not listen on any port */
server->ipv6port = -1; /* do not listen on any port */
sock = rfbConnectToTcpAddr(repeaterHost, repeaterPort);
if (sock < 0) {
perror("connect to repeater");
return 1;
}
if (write(sock, id, sizeof(id)) != sizeof(id)) {
perror("writing id");
return 1;
}
cl = rfbNewClient(server, sock);
if (!cl) {
perror("new client");
return 1;
}
cl->reverseConnection = 0;
cl->clientGoneHook = clientGone;
/* Run the server */
rfbInitServer(server);
rfbRunEventLoop(server,-1,FALSE);
return 0;
}

@ -578,6 +578,9 @@ ReadSupportedSecurityType(rfbClient* client, uint32_t *result, rfbBool subAuth)
rfbClientLog("%d) Received security type %d\n", loop, tAuth[loop]); rfbClientLog("%d) Received security type %d\n", loop, tAuth[loop]);
if (flag) continue; if (flag) continue;
if (tAuth[loop]==rfbVncAuth || tAuth[loop]==rfbNoAuth || if (tAuth[loop]==rfbVncAuth || tAuth[loop]==rfbNoAuth ||
#if defined(LIBVNCSERVER_HAVE_GNUTLS) || defined(LIBVNCSERVER_HAVE_LIBSSL)
tAuth[loop]==rfbVeNCrypt ||
#endif
(tAuth[loop]==rfbARD && client->GetCredential) || (tAuth[loop]==rfbARD && client->GetCredential) ||
(!subAuth && (tAuth[loop]==rfbTLS || (tAuth[loop]==rfbVeNCrypt && client->GetCredential)))) (!subAuth && (tAuth[loop]==rfbTLS || (tAuth[loop]==rfbVeNCrypt && client->GetCredential))))
{ {

Loading…
Cancel
Save