From ae38cee2f0b64f62cf569cc8b15eb18d1de7c9f0 Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Sun, 28 Nov 2004 04:56:58 +0000 Subject: added vnc mod --- xrdp/os_calls.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) (limited to 'xrdp/os_calls.c') diff --git a/xrdp/os_calls.c b/xrdp/os_calls.c index 164c93f3..cd921f01 100644 --- a/xrdp/os_calls.c +++ b/xrdp/os_calls.c @@ -33,6 +33,9 @@ #include #include #include +#include +#include +#include #endif #include #include @@ -74,6 +77,10 @@ int g_init_system(void) #endif #ifdef MEMLEAK g_memlist = xrdp_list_create(); + printf("some info\n\r"); + printf("sizeof xrdp_bitmap is %d\n\r", sizeof(struct xrdp_bitmap)); + printf("sizeof xrdp_wm is %d\n\r", sizeof(struct xrdp_wm)); + printf("sizeof stream is %d\n\r", sizeof(struct stream)); #endif return 0; } @@ -261,6 +268,28 @@ void g_tcp_close(int sck) #endif } +/*****************************************************************************/ +int g_tcp_connect(int sck, char* address, char* port) +{ + struct sockaddr_in s; + struct hostent* h; + + g_memset(&s, 0, sizeof(struct sockaddr_in)); + s.sin_family = AF_INET; + s.sin_port = htons(atoi(port)); + s.sin_addr.s_addr = inet_addr(address); + if (s.sin_addr.s_addr == INADDR_NONE) + { + h = gethostbyname(address); + if (h != 0) + if (h->h_name != 0) + if (h->h_addr_list != 0) + if ((*(h->h_addr_list)) != 0) + s.sin_addr.s_addr = *((int*)(*(h->h_addr_list))); + } + return connect(sck, (struct sockaddr*)&s, sizeof(struct sockaddr_in)); +} + /*****************************************************************************/ int g_tcp_set_non_blocking(int sck) { @@ -349,6 +378,7 @@ int g_tcp_select(int sck1, int sck2) fd_set rfds; struct timeval time; int max; + int rv; time.tv_sec = 0; time.tv_usec = 0; @@ -358,7 +388,16 @@ int g_tcp_select(int sck1, int sck2) max = sck1; if (sck2 > max) max = sck2; - return select(max + 1, &rfds, 0, 0, &time); + rv = select(max + 1, &rfds, 0, 0, &time); + if (rv > 0) + { + rv = 0; + if (FD_ISSET(((unsigned int)sck1), &rfds)) + rv = rv | 1; + if (FD_ISSET(((unsigned int)sck2), &rfds)) + rv = rv | 2; + } + return rv; } /*****************************************************************************/ @@ -692,3 +731,32 @@ char* g_strdup(char* in) g_strcpy(p, in); return p; } + +/*****************************************************************************/ +int g_strcmp(char* c1, char* c2) +{ + return strcmp(c1, c2); +} + +/*****************************************************************************/ +int g_load_library(char* in) +{ + return (int)dlopen(in, RTLD_LOCAL | RTLD_LAZY); +} + +/*****************************************************************************/ +int g_free_library(int lib) +{ + if (lib == 0) + return 0; + return dlclose((void*)lib); +} + +/*****************************************************************************/ +/* returns NULL if not found */ +void* g_get_proc_address(int lib, char* name) +{ + if (lib == 0) + return 0; + return dlsym((void*)lib, name); +} -- cgit v1.2.1