CVS: rdesktop Makefile.in,1.12,1.13 channels.c,1.14,1.15 proto.h,1.86,1.87 rdesktop.c,1.143,1.144 types.h,1.27,1.28
Peter Åstrand <[email protected]>
| Newsgroups | gmane.network.rdesktop.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5880
Modified Files:
Makefile.in channels.c proto.h rdesktop.c types.h
Log Message:
Added support for a new virtual channel, lspci, which makes it
possible for the remote RDP server to enumerate the local PCI devices.
Index: Makefile.in
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/Makefile.in,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Makefile.in 27 Dec 2005 09:20:33 -0000 1.12
--- Makefile.in 2 Mar 2006 15:22:25 -0000 1.13
***************
*** 26,30 ****
SOUNDOBJ = @SOUNDOBJ@
! RDPOBJ = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o
X11OBJ = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o
VNCOBJ = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o
--- 26,30 ----
SOUNDOBJ = @SOUNDOBJ@
! RDPOBJ = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o lspci.o
X11OBJ = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o
VNCOBJ = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o
***************
*** 83,87 ****
iso.c licence.c mcs.c orders.c parallel.c printer.c printercache.c \
pstcache.c rdesktop.c rdp5.c rdp.c rdpdr.c rdpsnd.c rdpsnd_oss.c \
! secure.c serial.c tcp.c xclip.c xkeymap.c xwin.c >> proto.h
cat proto.tail >> proto.h
--- 83,87 ----
iso.c licence.c mcs.c orders.c parallel.c printer.c printercache.c \
pstcache.c rdesktop.c rdp5.c rdp.c rdpdr.c rdpsnd.c rdpsnd_oss.c \
! secure.c serial.c tcp.c xclip.c xkeymap.c xwin.c lspci.c >> proto.h
cat proto.tail >> proto.h
Index: channels.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/channels.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** channels.c 6 Mar 2005 21:11:04 -0000 1.14
--- channels.c 2 Mar 2006 15:22:25 -0000 1.15
***************
*** 22,26 ****
#include "rdesktop.h"
! #define MAX_CHANNELS 4
#define CHANNEL_CHUNK_LENGTH 1600
#define CHANNEL_FLAG_FIRST 0x01
--- 22,26 ----
#include "rdesktop.h"
! #define MAX_CHANNELS 5
#define CHANNEL_CHUNK_LENGTH 1600
#define CHANNEL_FLAG_FIRST 0x01
Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -d -r1.86 -r1.87
*** proto.h 23 Jan 2006 06:52:13 -0000 1.86
--- proto.h 2 Mar 2006 15:22:25 -0000 1.87
***************
*** 118,121 ****
--- 118,123 ----
void toupper_str(char *p);
BOOL str_startswith(const char *s, const char *prefix);
+ BOOL str_handle_lines(const char *input, char **rest, str_handle_lines_t linehandler, void *data);
+ BOOL subprocess(char *const argv[], str_handle_lines_t linehandler, void *data);
char *l_to_a(long N, int base);
int load_licence(unsigned char **data);
***************
*** 270,273 ****
--- 272,277 ----
void ui_begin_update(void);
void ui_end_update(void);
+ /* lspci.c */
+ BOOL lspci_init(void);
/* *INDENT-OFF* */
Index: rdesktop.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdesktop.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -C2 -d -r1.143 -r1.144
*** rdesktop.c 27 Feb 2006 19:36:35 -0000 1.143
--- rdesktop.c 2 Mar 2006 15:22:25 -0000 1.144
***************
*** 87,90 ****
--- 87,91 ----
BOOL g_console_session = False;
BOOL g_numlock_sync = False;
+ BOOL lspci_enabled = False;
BOOL g_owncolmap = False;
BOOL g_ownbackstore = True; /* We can't rely on external BackingStore */
***************
*** 680,683 ****
--- 681,688 ----
serial_enum_devices(&g_num_devices, optarg + 7);
}
+ else if (str_startswith(optarg, "lspci"))
+ {
+ lspci_enabled = True;
+ }
else if (str_startswith(optarg, "lptport"))
{
***************
*** 805,808 ****
--- 810,817 ----
rdpsnd_init();
#endif
+
+ if (lspci_enabled)
+ lspci_init();
+
rdpdr_init();
***************
*** 1179,1182 ****
--- 1188,1302 ----
+ /* Split input into lines, and call linehandler for each
+ line. Incomplete lines are saved in the rest variable, which should
+ initially point to NULL. When linehandler returns False, stop and
+ return False. Otherwise, return True. */
+ BOOL
+ str_handle_lines(const char *input, char **rest, str_handle_lines_t linehandler, void *data)
+ {
+ char *buf, *p;
+ char *oldrest;
+ size_t inputlen;
+ size_t buflen;
+ size_t restlen = 0;
+ BOOL ret = True;
+
+ /* Copy data to buffer */
+ inputlen = strlen(input);
+ if (*rest)
+ restlen = strlen(*rest);
+ buflen = restlen + inputlen + 1;
+ buf = (char *) xmalloc(buflen);
+ buf[0] = '\0';
+ if (*rest)
+ STRNCPY(buf, *rest, buflen);
+ strncat(buf, input, inputlen);
+ p = buf;
+
+ while (1)
+ {
+ char *newline = strchr(p, '\n');
+ if (newline)
+ {
+ *newline = '\0';
+ if (!linehandler(p, data))
+ {
+ p = newline + 1;
+ ret = False;
+ break;
+ }
+ p = newline + 1;
+ }
+ else
+ {
+ break;
+
+ }
+ }
+
+ /* Save in rest */
+ oldrest = *rest;
+ restlen = buf + buflen - p;
+ *rest = (char *) xmalloc(restlen);
+ STRNCPY((*rest), p, restlen);
+ xfree(oldrest);
+
+ xfree(buf);
+ return ret;
+ }
+
+ /* Execute the program specified by argv. For each line in
+ stdout/stderr output, call linehandler. Returns false on failure. */
+ BOOL
+ subprocess(char *const argv[], str_handle_lines_t linehandler, void *data)
+ {
+ pid_t child;
+ int fd[2];
+ int n = 1;
+ char output[256];
+ char *rest = NULL;
+
+ if (pipe(fd) < 0)
+ {
+ perror("pipe");
+ return False;
+ }
+
+ if ((child = fork()) < 0)
+ {
+ perror("fork");
+ return False;
+ }
+
+ /* Child */
+ if (child == 0)
+ {
+ /* Close read end */
+ close(fd[0]);
+
+ /* Redirect stdout and stderr to pipe */
+ dup2(fd[1], 1);
+ dup2(fd[1], 2);
+
+ /* Execute */
+ execvp(argv[0], argv);
+ perror("Error executing child");
+ _exit(128);
+ }
+
+ /* Parent. Close write end. */
+ close(fd[1]);
+ while (n > 0)
+ {
+ n = read(fd[0], output, 255);
+ output[n] = '\0';
+ str_handle_lines(output, &rest, linehandler, data);
+ }
+ xfree(rest);
+
+ return True;
+ }
+
+
/* not all clibs got ltoa */
#define LTOA_BUFSIZE (sizeof(long) * 8 + 1)
Index: types.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/types.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** types.h 15 Aug 2005 11:44:35 -0000 1.27
--- types.h 2 Mar 2006 15:22:25 -0000 1.28
***************
*** 265,266 ****
--- 265,268 ----
}
FILEINFO;
+
+ typedef BOOL(*str_handle_lines_t) (const char *line, void *data);
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642