Added rdp2vnc support
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@332 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
49e48ec58c
commit
b5753d0a87
@ -1,2 +1,3 @@
|
|||||||
rdesktop
|
rdesktop
|
||||||
Makeconf
|
Makeconf
|
||||||
|
rdp2vnc
|
||||||
|
23
Makefile
23
Makefile
@ -14,14 +14,31 @@ datadir = $(prefix)/share/rdesktop
|
|||||||
|
|
||||||
KEYMAP_PATH = $(datadir)/keymaps/
|
KEYMAP_PATH = $(datadir)/keymaps/
|
||||||
|
|
||||||
RDPOBJ = rdesktop.o tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o xwin.o xkeymap.o ewmhints.c
|
RDPOBJ = rdesktop.o tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o xwin.o xkeymap.o ewmhints.o
|
||||||
|
RDP2VNCOBJ = vnc/rdp2vnc.o tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o
|
||||||
CRYPTOBJ = crypto/rc4_enc.o crypto/rc4_skey.o crypto/md5_dgst.o crypto/sha1dgst.o crypto/bn_exp.o crypto/bn_mul.o crypto/bn_div.o crypto/bn_sqr.o crypto/bn_add.o crypto/bn_shift.o crypto/bn_asm.o crypto/bn_ctx.o crypto/bn_lib.o
|
CRYPTOBJ = crypto/rc4_enc.o crypto/rc4_skey.o crypto/md5_dgst.o crypto/sha1dgst.o crypto/bn_exp.o crypto/bn_mul.o crypto/bn_div.o crypto/bn_sqr.o crypto/bn_add.o crypto/bn_shift.o crypto/bn_asm.o crypto/bn_ctx.o crypto/bn_lib.o
|
||||||
|
|
||||||
include Makeconf # configure-generated
|
include Makeconf # configure-generated
|
||||||
|
|
||||||
|
all: $(TARGETS)
|
||||||
|
|
||||||
rdesktop: $(RDPOBJ) $(CRYPTOBJ)
|
rdesktop: $(RDPOBJ) $(CRYPTOBJ)
|
||||||
$(CC) $(CFLAGS) -o rdesktop $(RDPOBJ) $(CRYPTOBJ) $(LDFLAGS)
|
$(CC) $(CFLAGS) -o rdesktop $(RDPOBJ) $(CRYPTOBJ) $(LDFLAGS) -lX11
|
||||||
|
|
||||||
|
rdp2vnc: $(RDP2VNCOBJ) $(CRYPTOBJ)
|
||||||
|
$(CCLD) $(CFLAGS) -o rdp2vnc $(RDP2VNCOBJ) $(CRYPTOBJ) $(LDFLAGS) $(LDVNC)
|
||||||
|
|
||||||
|
vnc/rdp2vnc.o: rdesktop.c
|
||||||
|
$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/rdp2vnc.o -c rdesktop.c
|
||||||
|
|
||||||
|
vnc/vnc.o: vnc/vnc.c
|
||||||
|
$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/vnc.o -c vnc/vnc.c
|
||||||
|
|
||||||
|
vnc/xkeymap.o: xkeymap.c
|
||||||
|
$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/xkeymap.o -c xkeymap.c
|
||||||
|
|
||||||
|
vnc/x11stubs.o: vnc/x11stubs.c
|
||||||
|
$(CC) $(CFLAGS) $(VNCINC) -o vnc/x11stubs.o -c vnc/x11stubs.c
|
||||||
|
|
||||||
Makeconf:
|
Makeconf:
|
||||||
./configure
|
./configure
|
||||||
@ -51,7 +68,7 @@ proto:
|
|||||||
cproto -DMAKE_PROTO -o proto.h *.c
|
cproto -DMAKE_PROTO -o proto.h *.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o crypto/*.o *~ rdesktop
|
rm -f *.o crypto/*.o *~ vnc/*.o vnc/*~ rdesktop rdp2vnc
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
mkdir -p /tmp/rdesktop-make-dist-dir
|
mkdir -p /tmp/rdesktop-make-dist-dir
|
||||||
|
28
configure
vendored
28
configure
vendored
@ -47,6 +47,12 @@ case $arg in
|
|||||||
--with-egd-socket=*)
|
--with-egd-socket=*)
|
||||||
extraegdpath=$optarg
|
extraegdpath=$optarg
|
||||||
;;
|
;;
|
||||||
|
--with-libvncserver)
|
||||||
|
withvncserver=yes
|
||||||
|
;;
|
||||||
|
--with-libvncserver-config=*)
|
||||||
|
vncserverconfig=$optarg
|
||||||
|
;;
|
||||||
--with-debug)
|
--with-debug)
|
||||||
cflags="$cflags -g -DWITH_DEBUG"
|
cflags="$cflags -g -DWITH_DEBUG"
|
||||||
;;
|
;;
|
||||||
@ -68,6 +74,9 @@ case $arg in
|
|||||||
echo " --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib"
|
echo " --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib"
|
||||||
echo " --without-openssl use in-tree crypto, even if OpenSSL is available"
|
echo " --without-openssl use in-tree crypto, even if OpenSSL is available"
|
||||||
echo " --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH"
|
echo " --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH"
|
||||||
|
echo " --with-libvncserver make rdp2vnc"
|
||||||
|
echo " --with-libvncserver-config=CMD"
|
||||||
|
echo " use CMD as libvncserver-config"
|
||||||
echo " --with-debug enable protocol debugging output"
|
echo " --with-debug enable protocol debugging output"
|
||||||
echo " --with-debug-kbd enable debugging of keyboard handling"
|
echo " --with-debug-kbd enable debugging of keyboard handling"
|
||||||
echo
|
echo
|
||||||
@ -139,8 +148,8 @@ if [ $xdir != "/usr" ]; then
|
|||||||
rpath="$rpath:$xdir/lib"
|
rpath="$rpath:$xdir/lib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ldflags="$ldflags -lX11"
|
ldflags="$ldflags"
|
||||||
|
targets="$targets rdesktop"
|
||||||
|
|
||||||
if [ -z "$withoutopenssl" ]; then
|
if [ -z "$withoutopenssl" ]; then
|
||||||
# Find OpenSSL installation if available
|
# Find OpenSSL installation if available
|
||||||
@ -177,6 +186,20 @@ if [ -z "$withoutopenssl" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$withvncserver" ]; then
|
||||||
|
if [ -z "$vncserverconfig" ]; then
|
||||||
|
vncserverconfig=libvncserver-config
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "VNCINC=`$vncserverconfig --cflags`" >> Makeconf
|
||||||
|
echo "LDVNC=`$vncserverconfig --libs`" >> Makeconf
|
||||||
|
echo "CCLD=`$vncserverconfig --link`" >> Makeconf
|
||||||
|
echo >> Makeconf
|
||||||
|
targets="$targets rdp2vnc"
|
||||||
|
|
||||||
|
echo "Found libvncserver: Building rdp2vnc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Find EGD socket if we don't have /dev/urandom or /dev/random
|
# Find EGD socket if we don't have /dev/urandom or /dev/random
|
||||||
|
|
||||||
@ -222,6 +245,7 @@ esac
|
|||||||
|
|
||||||
echo "CFLAGS = $cflags" >>Makeconf
|
echo "CFLAGS = $cflags" >>Makeconf
|
||||||
echo "LDFLAGS = $ldflags" >>Makeconf
|
echo "LDFLAGS = $ldflags" >>Makeconf
|
||||||
|
echo "TARGETS = $targets" >>Makeconf
|
||||||
|
|
||||||
echo "configure complete - now run make"
|
echo "configure complete - now run make"
|
||||||
|
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
indent -bli0 -i8 -cli8 -npcs -l100 *.h *.c
|
indent -bli0 -i8 -cli8 -npcs -l100 *.h *.c vnc/*.h vnc/*.c
|
||||||
|
|
||||||
|
40
rdesktop.c
40
rdesktop.c
@ -61,6 +61,13 @@ BOOL grab_keyboard = True;
|
|||||||
BOOL hide_decorations = False;
|
BOOL hide_decorations = False;
|
||||||
extern BOOL owncolmap;
|
extern BOOL owncolmap;
|
||||||
|
|
||||||
|
#ifdef RDP2VNC
|
||||||
|
extern int rfb_port;
|
||||||
|
extern int defer_time;
|
||||||
|
void
|
||||||
|
rdp2vnc_connect(char *server, uint32 flags, char *domain, char *password,
|
||||||
|
char *shell, char *directory);
|
||||||
|
#endif
|
||||||
/* Display usage information */
|
/* Display usage information */
|
||||||
static void
|
static void
|
||||||
usage(char *program)
|
usage(char *program)
|
||||||
@ -70,6 +77,10 @@ usage(char *program)
|
|||||||
fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n");
|
fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n");
|
||||||
|
|
||||||
fprintf(stderr, "Usage: %s [options] server[:port]\n", program);
|
fprintf(stderr, "Usage: %s [options] server[:port]\n", program);
|
||||||
|
#ifdef RDP2VNC
|
||||||
|
fprintf(stderr, " -V: vnc port\n");
|
||||||
|
fprintf(stderr, " -E: defer time (ms)\n");
|
||||||
|
#endif
|
||||||
fprintf(stderr, " -u: user name\n");
|
fprintf(stderr, " -u: user name\n");
|
||||||
fprintf(stderr, " -d: domain\n");
|
fprintf(stderr, " -d: domain\n");
|
||||||
fprintf(stderr, " -s: shell\n");
|
fprintf(stderr, " -s: shell\n");
|
||||||
@ -148,10 +159,30 @@ main(int argc, char *argv[])
|
|||||||
domain[0] = password[0] = shell[0] = directory[0] = 0;
|
domain[0] = password[0] = shell[0] = directory[0] = 0;
|
||||||
strcpy(keymapname, "en-us");
|
strcpy(keymapname, "en-us");
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "u:d:s:S:c:p:n:k:g:a:fbemCKT:Dh?")) != -1)
|
#ifdef RDP2VNC
|
||||||
|
#define VNCOPT "V:E:"
|
||||||
|
#else
|
||||||
|
#define VNCOPT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while ((c = getopt(argc, argv, VNCOPT "u:d:s:S:c:p:n:k:g:a:fbemCKT:Dh?")) != -1)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
#ifdef RDP2VNC
|
||||||
|
case 'V':
|
||||||
|
rfb_port = strtol(optarg, NULL, 10);
|
||||||
|
if (rfb_port < 100)
|
||||||
|
rfb_port += 5900;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'E':
|
||||||
|
defer_time = strtol(optarg, NULL, 10);
|
||||||
|
if (defer_time < 0)
|
||||||
|
defer_time = 0;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
STRNCPY(username, optarg, sizeof(username));
|
STRNCPY(username, optarg, sizeof(username));
|
||||||
username_option = 1;
|
username_option = 1;
|
||||||
@ -328,6 +359,10 @@ main(int argc, char *argv[])
|
|||||||
strncat(title, server, sizeof(title) - sizeof("rdesktop - "));
|
strncat(title, server, sizeof(title) - sizeof("rdesktop - "));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RDP2VNC
|
||||||
|
rdp2vnc_connect(server, flags, domain, password, shell, directory);
|
||||||
|
#else
|
||||||
|
|
||||||
if (!ui_init())
|
if (!ui_init())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -346,6 +381,9 @@ main(int argc, char *argv[])
|
|||||||
DEBUG(("Disconnecting...\n"));
|
DEBUG(("Disconnecting...\n"));
|
||||||
rdp_disconnect();
|
rdp_disconnect();
|
||||||
ui_deinit();
|
ui_deinit();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
68
vnc/vnc.h
Normal file
68
vnc/vnc.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#ifndef VNC_H
|
||||||
|
#define VNC_H
|
||||||
|
|
||||||
|
#define BOOL rfb_BOOL
|
||||||
|
#include "rfb.h"
|
||||||
|
#undef BOOL
|
||||||
|
|
||||||
|
typedef unsigned int vncPixel;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t w, h;
|
||||||
|
uint16_t linew;
|
||||||
|
rfbPixelFormat *format;
|
||||||
|
char *data;
|
||||||
|
BOOL owner;
|
||||||
|
}
|
||||||
|
vncBuffer;
|
||||||
|
|
||||||
|
extern int vncPreparedClientSocket;
|
||||||
|
extern int vncPreparedServerSocket;
|
||||||
|
|
||||||
|
/* - Buffer management */
|
||||||
|
extern vncBuffer *vncNewBuffer(int w, int h, int depth);
|
||||||
|
extern vncBuffer *vncDupBuffer(vncBuffer * b);
|
||||||
|
extern void vncDeleteBuffer(vncBuffer * b);
|
||||||
|
|
||||||
|
/* - Colourmaps */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t r, g, b;
|
||||||
|
}
|
||||||
|
vncColour;
|
||||||
|
|
||||||
|
extern void vncSetColourMap(rfbScreenInfoPtr s, rfbColourMap * m);
|
||||||
|
extern rfbColourMap *vncNewColourMap(rfbScreenInfoPtr s, int n);
|
||||||
|
extern void vncSetColourMapEntry(rfbColourMap * m, int i, vncPixel r, vncPixel g, vncPixel b);
|
||||||
|
extern void vncDeleteColourMap(rfbColourMap * m);
|
||||||
|
|
||||||
|
/* - Simple pixel manipulation */
|
||||||
|
extern vncPixel vncGetPixel(vncBuffer * b, int x, int y);
|
||||||
|
extern void vncSetPixel(vncBuffer * b, int x, int y, vncPixel c);
|
||||||
|
|
||||||
|
/* - Drawing primitives */
|
||||||
|
extern void vncSetRect(rfbScreenInfoPtr s, int x, int y, int w, int h, vncPixel c);
|
||||||
|
extern void vncCopyBlit(rfbScreenInfoPtr s, int x, int y, int w, int h, int srcx, int srcy);
|
||||||
|
extern void vncCopyBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h,
|
||||||
|
vncBuffer * b, int srcx, int srcy);
|
||||||
|
extern void vncTransBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h,
|
||||||
|
vncBuffer * b, int srcx, int srcy, int bg);
|
||||||
|
extern void vncXorBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h,
|
||||||
|
vncBuffer * b, int srcx, int srcy);
|
||||||
|
extern void vncAndBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h,
|
||||||
|
vncBuffer * b, int srcx, int srcy);
|
||||||
|
extern vncBuffer *vncGetRect(rfbScreenInfoPtr s, int x, int y, int w, int h);
|
||||||
|
|
||||||
|
// - Low level VNC update primitives upon which the rest are based
|
||||||
|
extern void vncQueueCopyRect(rfbScreenInfoPtr s, int x, int y, int w, int h, int src_x, int src_y);
|
||||||
|
extern void vncQueueUpdate(rfbScreenInfoPtr s, int x, int y, int w, int h);
|
||||||
|
|
||||||
|
/* cursor */
|
||||||
|
extern rfbCursorPtr vncNewCursor(vncBuffer * mask, vncBuffer * pointer, int hotx, int hoty);
|
||||||
|
extern void vncSetCursor(rfbScreenInfoPtr s, rfbCursorPtr c);
|
||||||
|
|
||||||
|
int vncListenAtTcpAddr(unsigned short port);
|
||||||
|
void vncPrintStats();
|
||||||
|
|
||||||
|
#endif
|
1405
vnc/x11stubs.c
Normal file
1405
vnc/x11stubs.c
Normal file
File diff suppressed because it is too large
Load Diff
31
vnc/x11stubs.h
Normal file
31
vnc/x11stubs.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef NOXKEYMAP_H
|
||||||
|
#define NOXKEYMAP_H
|
||||||
|
|
||||||
|
/* Fake a few X11 calls */
|
||||||
|
|
||||||
|
#define XK_MISCELLANY
|
||||||
|
#include <rfb.h>
|
||||||
|
#include <keysym.h>
|
||||||
|
|
||||||
|
#define NoSymbol 0L
|
||||||
|
#define ShiftMask (1<<0)
|
||||||
|
#define LockMask (1<<1)
|
||||||
|
#define ControlMask (1<<2)
|
||||||
|
#define Mod1Mask (1<<3)
|
||||||
|
#define Mod2Mask (1<<4)
|
||||||
|
#define Mod3Mask (1<<5)
|
||||||
|
#define Mod4Mask (1<<6)
|
||||||
|
#define Mod5Mask (1<<7)
|
||||||
|
#define Button1 1
|
||||||
|
#define Button2 2
|
||||||
|
#define Button3 3
|
||||||
|
#define Button4 4
|
||||||
|
#define Button5 5
|
||||||
|
|
||||||
|
typedef int Display;
|
||||||
|
|
||||||
|
KeySym XStringToKeysym(const char *str);
|
||||||
|
const char *XKeysymToString(KeySym keysym);
|
||||||
|
void XDisplayKeycodes(Display * display, int *min_keycode, int *max_keycode);
|
||||||
|
|
||||||
|
#endif
|
@ -18,9 +18,13 @@
|
|||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef RDP2VNC
|
||||||
|
#include "vnc/x11stubs.h"
|
||||||
|
#else
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#define XK_MISCELLANY
|
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user