started work on moduals

ulab-original
jsorg71 20 years ago
parent 0be4f03392
commit 9c580f9a84

@ -0,0 +1,35 @@
This document is intended to explain xrdp server design.
Many connections, all capable of running different moduals
one connection could be using a vnc connection
one could be running a custom app made for xrdp
one could be running a X11 session
clients control the screen size and color depth
all controlled by a cofiguaration file.
you can create a lib or use a lib with your executable that talks
to xrdp server.
------ ----------
-xrdp---linked-------mylib.so- session 1
------ ----------
|
| -------------------------
|----unix socket--myapp linked to libxrdp- session 2
| -------------------------
|
| -----------
|----linked-------mylib2.so- session 3
-----------
Any of the above sessions can repeat or have different session
numbers or not even be used.
If a session is disconnected, all that changes is the rdp connection
is lost, the session remains.
For X11, start the XServer after the user is
authenticated. First check for the next available X11 display,
create a user session, start the XServer and set the DISPLAY enviromenet
variable.

@ -6,6 +6,10 @@ Credits
Mark from up 19.9 was the first to work with rdp server code.
To use this run make the ./xrdp, then connect with rdesktop or mstsc.
Only tested with linux and i386.
Tested with linux and i386.
I've got it compiling in windows with borland free tools.
xrdp directory is the main server code
design.txt is an attempt to expain the project design
Jay

@ -30,6 +30,7 @@
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/time.h>
#include <sys/types.h>
#endif
@ -241,6 +242,15 @@ int g_tcp_socket(void)
return rv;
}
/*****************************************************************************/
int g_tcp_local_socket(void)
{
int rv;
rv = socket(PF_LOCAL, SOCK_STREAM, 0);
return rv;
}
/*****************************************************************************/
void g_tcp_close(int sck)
{
@ -279,6 +289,17 @@ int g_tcp_bind(int sck, char* port)
return bind(sck, (struct sockaddr*)&s, sizeof(struct sockaddr_in));
}
/*****************************************************************************/
int g_tcp_local_bind(int sck, char* port)
{
struct sockaddr_un s;
memset(&s, 0, sizeof(struct sockaddr_un));
s.sun_family = AF_UNIX;
strcpy(s.sun_path, port);
return bind(sck, (struct sockaddr*)&s, sizeof(struct sockaddr_un));
}
/*****************************************************************************/
int g_tcp_listen(int sck)
{
@ -323,16 +344,21 @@ int g_tcp_last_error_would_block(int sck)
}
/*****************************************************************************/
int g_tcp_select(int sck)
int g_tcp_select(int sck1, int sck2)
{
fd_set rfds;
struct timeval time;
int max;
time.tv_sec = 0;
time.tv_usec = 0;
FD_ZERO(&rfds);
FD_SET(((unsigned int)sck), &rfds);
return select(sck + 1, &rfds, 0, 0, &time);
FD_SET(((unsigned int)sck1), &rfds);
FD_SET(((unsigned int)sck2), &rfds);
max = sck1;
if (sck2 > max)
max = sck2;
return select(max + 1, &rfds, 0, 0, &time);
}
/*****************************************************************************/

@ -51,15 +51,17 @@ void g_memset(void* ptr, int val, int size);
void g_memcpy(void* d_ptr, const void* s_ptr, int size);
int g_getchar(void);
int g_tcp_socket(void);
int g_tcp_local_socket(void);
void g_tcp_close(int sck);
int g_tcp_set_non_blocking(int sck);
int g_tcp_bind(int sck, char* port);
int g_tcp_local_bind(int sck, char* port);
int g_tcp_listen(int sck);
int g_tcp_accept(int sck);
int g_tcp_recv(int sck, void* ptr, int len, int flags);
int g_tcp_send(int sck, void* ptr, int len, int flags);
int g_tcp_last_error_would_block(int sck);
int g_tcp_select(int sck);
int g_tcp_select(int sck1, int sck2);
int g_is_term(void);
void g_set_term(int in_val);
void g_sleep(int msecs);

@ -59,7 +59,7 @@ int xrdp_process_main_loop(struct xrdp_process* self)
{
while (!g_is_term() && !self->term)
{
i = g_tcp_select(self->sck);
i = g_tcp_select(self->sck, self->app_sck);
if (i == 1)
{
init_stream(s, 8192);
@ -105,6 +105,9 @@ int xrdp_process_main_loop(struct xrdp_process* self)
xrdp_wm_init(self->wm);
}
}
else if (i == 2)
{
}
else if (i == 0)
g_sleep(10);
else

@ -336,6 +336,7 @@ struct xrdp_process
/* create these when up and running */
struct xrdp_orders* orders;
struct xrdp_wm* wm;
int app_sck;
};
/* rdp listener */

Loading…
Cancel
Save