diff options
| author | jsorg71 <jsorg71> | 2010-05-04 09:24:24 +0000 |
|---|---|---|
| committer | jsorg71 <jsorg71> | 2010-05-04 09:24:24 +0000 |
| commit | 574355f3e3a24ad7f0c27bc4c7fd2248ed89e99e (patch) | |
| tree | d70599f6a8d101c6d92f1fa4aa23d929ac392342 /libxrdp | |
| parent | 27e097663f6b70801268e53d24a8fa45517367e9 (diff) | |
| download | xrdp-proprietary-574355f3e3a24ad7f0c27bc4c7fd2248ed89e99e.tar.gz xrdp-proprietary-574355f3e3a24ad7f0c27bc4c7fd2248ed89e99e.zip | |
use trans
Diffstat (limited to 'libxrdp')
| -rw-r--r-- | libxrdp/libxrdp.c | 6 | ||||
| -rw-r--r-- | libxrdp/libxrdp.h | 14 | ||||
| -rw-r--r-- | libxrdp/libxrdpinc.h | 4 | ||||
| -rw-r--r-- | libxrdp/xrdp_iso.c | 6 | ||||
| -rw-r--r-- | libxrdp/xrdp_mcs.c | 6 | ||||
| -rw-r--r-- | libxrdp/xrdp_rdp.c | 6 | ||||
| -rw-r--r-- | libxrdp/xrdp_sec.c | 6 | ||||
| -rw-r--r-- | libxrdp/xrdp_tcp.c | 108 |
8 files changed, 33 insertions, 123 deletions
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index 23689db5..7e7446dd 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -14,7 +14,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. xrdp: A Remote Desktop Protocol server. - Copyright (C) Jay Sorg 2004-2009 + Copyright (C) Jay Sorg 2004-2010 this is the interface to libxrdp @@ -24,13 +24,13 @@ /******************************************************************************/ struct xrdp_session* EXPORT_CC -libxrdp_init(long id, int sck) +libxrdp_init(tbus id, struct trans* trans) { struct xrdp_session* session; session = (struct xrdp_session*)g_malloc(sizeof(struct xrdp_session), 1); session->id = id; - session->rdp = xrdp_rdp_create(session, sck); + session->rdp = xrdp_rdp_create(session, trans); session->orders = xrdp_orders_create(session, (struct xrdp_rdp*)session->rdp); session->client_info = &(((struct xrdp_rdp*)session->rdp)->client_info); make_stream(session->s); diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h index 65b69b89..cff56a7c 100644 --- a/libxrdp/libxrdp.h +++ b/libxrdp/libxrdp.h @@ -28,6 +28,7 @@ #endif #include "arch.h" #include "parse.h" +#include "trans.h" #include "xrdp_constants.h" #include "defines.h" #include "os_calls.h" @@ -40,8 +41,7 @@ /* tcp */ struct xrdp_tcp { - int sck; - int sck_closed; + struct trans* trans; struct xrdp_iso* iso_layer; /* owner */ }; @@ -214,7 +214,7 @@ struct xrdp_orders /* xrdp_tcp.c */ struct xrdp_tcp* APP_CC -xrdp_tcp_create(struct xrdp_iso* owner, int sck); +xrdp_tcp_create(struct xrdp_iso* owner, struct trans* trans); void APP_CC xrdp_tcp_delete(struct xrdp_tcp* self); int APP_CC @@ -226,7 +226,7 @@ xrdp_tcp_send(struct xrdp_tcp* self, struct stream* s); /* xrdp_iso.c */ struct xrdp_iso* APP_CC -xrdp_iso_create(struct xrdp_mcs* owner, int sck); +xrdp_iso_create(struct xrdp_mcs* owner, struct trans* trans); void APP_CC xrdp_iso_delete(struct xrdp_iso* self); int APP_CC @@ -240,7 +240,7 @@ xrdp_iso_incoming(struct xrdp_iso* self); /* xrdp_mcs.c */ struct xrdp_mcs* APP_CC -xrdp_mcs_create(struct xrdp_sec* owner, int sck, +xrdp_mcs_create(struct xrdp_sec* owner, struct trans* trans, struct stream* client_mcs_data, struct stream* server_mcs_data); void APP_CC @@ -258,7 +258,7 @@ xrdp_mcs_disconnect(struct xrdp_mcs* self); /* xrdp_sec.c */ struct xrdp_sec* APP_CC -xrdp_sec_create(struct xrdp_rdp* owner, int sck, int crypt_level, +xrdp_sec_create(struct xrdp_rdp* owner, struct trans* trans, int crypt_level, int channel_code); void APP_CC xrdp_sec_delete(struct xrdp_sec* self); @@ -279,7 +279,7 @@ xrdp_sec_disconnect(struct xrdp_sec* self); /* xrdp_rdp.c */ struct xrdp_rdp* APP_CC -xrdp_rdp_create(struct xrdp_session* session, int sck); +xrdp_rdp_create(struct xrdp_session* session, struct trans* trans); void APP_CC xrdp_rdp_delete(struct xrdp_rdp* self); int APP_CC diff --git a/libxrdp/libxrdpinc.h b/libxrdp/libxrdpinc.h index db54ce33..524acafa 100644 --- a/libxrdp/libxrdpinc.h +++ b/libxrdp/libxrdpinc.h @@ -101,7 +101,7 @@ struct xrdp_rect struct xrdp_session { long id; - int sck; + struct trans* trans; int (*callback)(long id, int msg, long param1, long param2, long param3, long param4); void* rdp; @@ -113,7 +113,7 @@ struct xrdp_session }; struct xrdp_session* DEFAULT_CC -libxrdp_init(long id, int sck); +libxrdp_init(tbus id, struct trans* trans); int DEFAULT_CC libxrdp_exit(struct xrdp_session* session); int DEFAULT_CC diff --git a/libxrdp/xrdp_iso.c b/libxrdp/xrdp_iso.c index 939f19ab..7fee92e6 100644 --- a/libxrdp/xrdp_iso.c +++ b/libxrdp/xrdp_iso.c @@ -14,7 +14,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. xrdp: A Remote Desktop Protocol server. - Copyright (C) Jay Sorg 2004-2009 + Copyright (C) Jay Sorg 2004-2010 iso layer @@ -24,14 +24,14 @@ /*****************************************************************************/ struct xrdp_iso* APP_CC -xrdp_iso_create(struct xrdp_mcs* owner, int sck) +xrdp_iso_create(struct xrdp_mcs* owner, struct trans* trans) { struct xrdp_iso* self; DEBUG((" in xrdp_iso_create")); self = (struct xrdp_iso*)g_malloc(sizeof(struct xrdp_iso), 1); self->mcs_layer = owner; - self->tcp_layer = xrdp_tcp_create(self, sck); + self->tcp_layer = xrdp_tcp_create(self, trans); DEBUG((" out xrdp_iso_create")); return self; } diff --git a/libxrdp/xrdp_mcs.c b/libxrdp/xrdp_mcs.c index 8a3406be..af65faf2 100644 --- a/libxrdp/xrdp_mcs.c +++ b/libxrdp/xrdp_mcs.c @@ -14,7 +14,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. xrdp: A Remote Desktop Protocol server. - Copyright (C) Jay Sorg 2004-2009 + Copyright (C) Jay Sorg 2004-2010 mcs layer @@ -24,7 +24,7 @@ /*****************************************************************************/ struct xrdp_mcs* APP_CC -xrdp_mcs_create(struct xrdp_sec* owner, int sck, +xrdp_mcs_create(struct xrdp_sec* owner, struct trans* trans, struct stream* client_mcs_data, struct stream* server_mcs_data) { @@ -37,7 +37,7 @@ xrdp_mcs_create(struct xrdp_sec* owner, int sck, self->chanid = 1001; self->client_mcs_data = client_mcs_data; self->server_mcs_data = server_mcs_data; - self->iso_layer = xrdp_iso_create(self, sck); + self->iso_layer = xrdp_iso_create(self, trans); self->channel_list = list_create(); DEBUG((" out xrdp_mcs_create")); return self; diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 1eea4f46..63019b0d 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -14,7 +14,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. xrdp: A Remote Desktop Protocol server. - Copyright (C) Jay Sorg 2004-2009 + Copyright (C) Jay Sorg 2004-2010 rdp layer @@ -122,7 +122,7 @@ xrdp_rdp_read_config(struct xrdp_client_info* client_info) /*****************************************************************************/ struct xrdp_rdp* APP_CC -xrdp_rdp_create(struct xrdp_session* session, int sck) +xrdp_rdp_create(struct xrdp_session* session, struct trans* trans) { struct xrdp_rdp* self; @@ -133,7 +133,7 @@ xrdp_rdp_create(struct xrdp_session* session, int sck) /* read ini settings */ xrdp_rdp_read_config(&self->client_info); /* create sec layer */ - self->sec_layer = xrdp_sec_create(self, sck, self->client_info.crypt_level, + self->sec_layer = xrdp_sec_create(self, trans, self->client_info.crypt_level, self->client_info.channel_code); /* default 8 bit v1 color bitmap cache entries and size */ self->client_info.cache1_entries = 600; diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c index 758283ad..99067ba7 100644 --- a/libxrdp/xrdp_sec.c +++ b/libxrdp/xrdp_sec.c @@ -14,7 +14,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. xrdp: A Remote Desktop Protocol server. - Copyright (C) Jay Sorg 2004-2009 + Copyright (C) Jay Sorg 2004-2010 secure layer @@ -124,7 +124,7 @@ hex_str_to_bin(char* in, char* out, int out_len) /*****************************************************************************/ struct xrdp_sec* APP_CC -xrdp_sec_create(struct xrdp_rdp* owner, int sck, int crypt_level, +xrdp_sec_create(struct xrdp_rdp* owner, struct trans* trans, int crypt_level, int channel_code) { struct xrdp_sec* self; @@ -152,7 +152,7 @@ xrdp_sec_create(struct xrdp_rdp* owner, int sck, int crypt_level, self->channel_code = channel_code; self->decrypt_rc4_info = ssl_rc4_info_create(); self->encrypt_rc4_info = ssl_rc4_info_create(); - self->mcs_layer = xrdp_mcs_create(self, sck, &self->client_mcs_data, + self->mcs_layer = xrdp_mcs_create(self, trans, &self->client_mcs_data, &self->server_mcs_data); self->chan_layer = xrdp_channel_create(self, self->mcs_layer); DEBUG((" out xrdp_sec_create")); diff --git a/libxrdp/xrdp_tcp.c b/libxrdp/xrdp_tcp.c index 67ba1f68..86a79ea7 100644 --- a/libxrdp/xrdp_tcp.c +++ b/libxrdp/xrdp_tcp.c @@ -14,7 +14,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. xrdp: A Remote Desktop Protocol server. - Copyright (C) Jay Sorg 2004-2009 + Copyright (C) Jay Sorg 2004-2010 tcp layer @@ -24,14 +24,14 @@ /*****************************************************************************/ struct xrdp_tcp* APP_CC -xrdp_tcp_create(struct xrdp_iso* owner, int sck) +xrdp_tcp_create(struct xrdp_iso* owner, struct trans* trans) { struct xrdp_tcp* self; DEBUG((" in xrdp_tcp_create")); self = (struct xrdp_tcp*)g_malloc(sizeof(struct xrdp_tcp), 1); self->iso_layer = owner; - self->sck = sck; + self->trans = trans; DEBUG((" out xrdp_tcp_create")); return self; } @@ -58,54 +58,12 @@ xrdp_tcp_init(struct xrdp_tcp* self, struct stream* s) int APP_CC xrdp_tcp_recv(struct xrdp_tcp* self, struct stream* s, int len) { - int rcvd; - struct xrdp_session* session; - - if (self->sck_closed) - { - DEBUG((" in xrdp_tcp_recv, sck closed")); - return 1; - } DEBUG((" in xrdp_tcp_recv, gota get %d bytes", len)); - session = self->iso_layer->mcs_layer->sec_layer->rdp_layer->session; init_stream(s, len); - while (len > 0) + if (trans_force_read_s(self->trans, s, len) != 0) { - rcvd = g_tcp_recv(self->sck, s->end, len, 0); - if (rcvd == -1) - { - if (g_tcp_last_error_would_block(self->sck)) - { - if (!g_tcp_can_recv(self->sck, 10)) - { - if (session->is_term != 0) - { - if (session->is_term()) - { - DEBUG((" out xrdp_tcp_recv, terminated")); - return 1; - } - } - } - } - else - { - self->sck_closed = 1; - DEBUG((" error = -1 in xrdp_tcp_recv socket %d", self->sck)); - return 1; - } - } - else if (rcvd == 0) - { - self->sck_closed = 1; - DEBUG((" error = 0 in xrdp_tcp_recv socket %d", self->sck)); - return 1; - } - else - { - s->end += rcvd; - len -= rcvd; - } + DEBUG((" error in trans_force_read_s")); + return 1; } DEBUG((" out xrdp_tcp_recv")); return 0; @@ -116,59 +74,11 @@ xrdp_tcp_recv(struct xrdp_tcp* self, struct stream* s, int len) int APP_CC xrdp_tcp_send(struct xrdp_tcp* self, struct stream* s) { - int len; - int total; - int sent; - struct xrdp_session* session; - - if (self->sck_closed) - { - DEBUG((" in xrdp_tcp_send, sck closed")); - return 1; - } - len = s->end - s->data; DEBUG((" in xrdp_tcp_send, gota send %d bytes", len)); - session = self->iso_layer->mcs_layer->sec_layer->rdp_layer->session; - total = 0; - while (total < len) + if (trans_force_write_s(self->trans, s) != 0) { - sent = g_tcp_send(self->sck, s->data + total, len - total, 0); - if (sent == -1) - { - if (g_tcp_last_error_would_block(self->sck)) - { - if (!g_tcp_can_send(self->sck, 10)) - { - if (session->is_term != 0) - { - if (session->is_term()) - { - DEBUG((" out xrdp_tcp_send, terminated")); - return 1; - } - } - } - } - else - { - self->sck_closed = 1; - DEBUG((" error = -1 in xrdp_tcp_send socket %d", self->sck)); - return 1; - } - } - else if (sent == 0) - { - self->sck_closed = 1; - DEBUG((" error = 0 in xrdp_tcp_send socket %d", self->sck)); - return 1; - } - else - { -#if defined(XRDP_DEBUG) - g_hexdump(s->data + total, sent); -#endif - total = total + sent; - } + DEBUG((" error in trans_force_write_s")); + return 1; } DEBUG((" out xrdp_tcp_send, sent %d bytes ok", len)); return 0; |
