diff options
author | jsorg71 <jsorg71> | 2004-11-28 04:56:58 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2004-11-28 04:56:58 +0000 |
commit | ae38cee2f0b64f62cf569cc8b15eb18d1de7c9f0 (patch) | |
tree | 70d3a8333500a486a305c06c1359c3e292f259d3 /xrdp/os_calls.c | |
parent | 9c580f9a846f9db83508a1bd4b2d9a354d906fcf (diff) | |
download | xrdp-proprietary-ae38cee2f0b64f62cf569cc8b15eb18d1de7c9f0.tar.gz xrdp-proprietary-ae38cee2f0b64f62cf569cc8b15eb18d1de7c9f0.zip |
added vnc mod
Diffstat (limited to 'xrdp/os_calls.c')
-rw-r--r-- | xrdp/os_calls.c | 70 |
1 files changed, 69 insertions, 1 deletions
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 <sys/un.h> #include <sys/time.h> #include <sys/types.h> +#include <dlfcn.h> +#include <arpa/inet.h> +#include <netdb.h> #endif #include <stdlib.h> #include <string.h> @@ -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; } @@ -262,6 +269,28 @@ void g_tcp_close(int sck) } /*****************************************************************************/ +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) { unsigned long i; @@ -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); +} |