diff options
author | jsorg71 <jsorg71> | 2009-09-21 02:59:15 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2009-09-21 02:59:15 +0000 |
commit | a673a075bd5e99ce9d1ff7e505d0ccfb880429ba (patch) | |
tree | fd475ddda4e18ca4fed510ee41c9d846dbdb4cd9 | |
parent | d9b86cc2ff8f2ec79ab52c0330fed1ea85cabb17 (diff) | |
download | xrdp-proprietary-a673a075bd5e99ce9d1ff7e505d0ccfb880429ba.tar.gz xrdp-proprietary-a673a075bd5e99ce9d1ff7e505d0ccfb880429ba.zip |
update trans in xrdp->sesman connection
-rw-r--r-- | xrdp/xrdp.h | 11 | ||||
-rw-r--r-- | xrdp/xrdp_mm.c | 434 | ||||
-rw-r--r-- | xrdp/xrdp_types.h | 21 | ||||
-rw-r--r-- | xrdp/xrdp_wm.c | 97 |
4 files changed, 219 insertions, 344 deletions
diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index 5742a72a..4cec5931 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -125,8 +125,6 @@ callback(long id, int msg, long param1, long param2, long param3, long param4); int APP_CC xrdp_wm_delete_all_childs(struct xrdp_wm* self); int APP_CC -xrdp_wm_app_sck_signal(struct xrdp_wm* self, int app_sck); -int APP_CC xrdp_wm_log_msg(struct xrdp_wm* self, char* msg); int APP_CC xrdp_wm_get_wait_objs(struct xrdp_wm* self, tbus* robjs, int* rc, @@ -341,11 +339,14 @@ xrdp_mm_delete(struct xrdp_mm* self); int APP_CC xrdp_mm_connect(struct xrdp_mm* self); int APP_CC -xrdp_mm_signal(struct xrdp_mm* self); -int APP_CC xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2, tbus param3, tbus param4); - +int APP_CC +xrdp_mm_get_wait_objs(struct xrdp_mm* self, + tbus* read_objs, int* rcount, + tbus* write_objs, int* wcount, int* timeout); +int APP_CC +xrdp_mm_check_wait_objs(struct xrdp_mm* self); int DEFAULT_CC server_begin_update(struct xrdp_mod* mod); int DEFAULT_CC diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 8d1e2b4d..f3327767 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -40,7 +40,7 @@ xrdp_mm_create(struct xrdp_wm* owner) /*****************************************************************************/ /* called from main thread */ static long DEFAULT_CC -sync_unload(long param1, long param2) +xrdp_mm_sync_unload(long param1, long param2) { return g_free_library(param1); } @@ -48,7 +48,7 @@ sync_unload(long param1, long param2) /*****************************************************************************/ /* called from main thread */ static long DEFAULT_CC -sync_load(long param1, long param2) +xrdp_mm_sync_load(long param1, long param2) { long rv; char* libname; @@ -66,14 +66,18 @@ xrdp_mm_module_cleanup(struct xrdp_mm* self) { if (self->mod_exit != 0) { + /* let the module cleanup */ self->mod_exit(self->mod); } } if (self->mod_handle != 0) { - g_xrdp_sync(sync_unload, self->mod_handle, 0); + /* main thread unload */ + g_xrdp_sync(xrdp_mm_sync_unload, self->mod_handle, 0); } trans_delete(self->chan_trans); + self->chan_trans = 0; + self->chan_trans_up = 0; self->mod_init = 0; self->mod_exit = 0; self->mod = 0; @@ -90,107 +94,14 @@ xrdp_mm_delete(struct xrdp_mm* self) } /* free any module stuff */ xrdp_mm_module_cleanup(self); - if (self->sck_obj != 0) - { - g_delete_wait_obj_from_socket(self->sck_obj); - self->sck_obj = 0; - } - if (self->sck != 0) - { - g_tcp_close(self->sck); - self->sck = 0; - } + trans_delete(self->sesman_trans); + self->sesman_trans = 0; + self->sesman_trans_up = 0; list_delete(self->login_names); list_delete(self->login_values); g_free(self); } -/******************************************************************************/ -/* returns error */ -static int APP_CC -xrdp_mm_recv(struct xrdp_mm* self, char* data, int len) -{ - int rcvd; - - if (self->sck_closed) - { - return 1; - } - while (len > 0) - { - rcvd = g_tcp_recv(self->sck, data, len, 0); - if (rcvd == -1) - { - if (g_tcp_last_error_would_block(self->sck)) - { - if (g_is_term()) - { - return 1; - } - g_tcp_can_recv(self->sck, 10); - } - else - { - return 1; - } - } - else if (rcvd == 0) - { - self->sck_closed = 1; - return 1; - } - else - { - data += rcvd; - len -= rcvd; - } - } - return 0; -} - -/*****************************************************************************/ -/* returns error */ -static int APP_CC -xrdp_mm_send(struct xrdp_mm* self, char* data, int len) -{ - int sent; - - if (self->sck_closed) - { - return 1; - } - while (len > 0) - { - sent = g_tcp_send(self->sck, data, len, 0); - if (sent == -1) - { - if (g_tcp_last_error_would_block(self->sck)) - { - if (g_is_term()) - { - return 1; - } - g_tcp_can_send(self->sck, 10); - } - else - { - return 1; - } - } - else if (sent == 0) - { - self->sck_closed = 1; - return 1; - } - else - { - data += sent; - len -= sent; - } - } - return 0; -} - /*****************************************************************************/ static int APP_CC xrdp_mm_send_login(struct xrdp_mm* self) @@ -235,8 +146,7 @@ xrdp_mm_send_login(struct xrdp_mm* self) xrdp_wm_log_msg(self->wm, "error finding username and password"); return 1; } - make_stream(s); - init_stream(s, 8192); + s = trans_get_out_s(self->sesman_trans, 8192); s_push_layer(s, channel_hdr, 8); /* this code is either 0 for Xvnc or 10 for X11rdp */ out_uint16_be(s, self->code); @@ -264,14 +174,13 @@ xrdp_mm_send_login(struct xrdp_mm* self) s_mark_end(s); s_pop_layer(s, channel_hdr); out_uint32_be(s, 0); /* version */ - index = s->end - s->data; + index = (int)(s->end - s->data); out_uint32_be(s, index); /* size */ - rv = xrdp_mm_send(self, s->data, index); + rv = trans_force_write(self->sesman_trans); if (rv != 0) { xrdp_wm_log_msg(self->wm, "xrdp_mm_send_login: xrdp_mm_send failed"); } - free_stream(s); return rv; } @@ -339,7 +248,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm* self) } if (self->mod_handle == 0) { - self->mod_handle = g_xrdp_sync(sync_load, (long)lib, 0); + self->mod_handle = g_xrdp_sync(xrdp_mm_sync_load, (long)lib, 0); if (self->mod_handle != 0) { func = g_get_proc_address(self->mod_handle, "mod_init"); @@ -795,11 +704,7 @@ xrdp_mm_process_login_response(struct xrdp_mm* self, struct stream* s) { xrdp_wm_log_msg(self->wm, "xrdp_mm_process_login_response: login failed"); } - /* close socket */ - g_delete_wait_obj_from_socket(self->sck_obj); - self->sck_obj = 0; - g_tcp_close(self->sck); - self->sck = 0; + self->delete_sesman_trans = 1; self->connected_state = 0; if (self->wm->login_mode != 10) { @@ -860,6 +765,93 @@ xrdp_mm_get_sesman_port(char* port, int port_bytes) } /*****************************************************************************/ +/* returns error + data coming from client that need to go to channel handler */ +int APP_CC +xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2, + tbus param3, tbus param4) +{ + struct stream* s; + int rv; + int length; + int total_length; + int flags; + int id; + char* data; + + rv = 0; + if ((self->chan_trans != 0) && self->chan_trans_up) + { + s = trans_get_out_s(self->chan_trans, 8192); + if (s != 0) + { + id = LOWORD(param1); + flags = HIWORD(param1); + length = param2; + data = (char*)param3; + total_length = param4; + if (total_length < length) + { + g_writeln("warning in xrdp_mm_process_channel_data total_len < length"); + total_length = length; + } + out_uint32_le(s, 0); /* version */ + out_uint32_le(s, 8 + 8 + 2 + 2 + 2 + 4 + length); + out_uint32_le(s, 5); /* msg id */ + out_uint32_le(s, 8 + 2 + 2 + 2 + 4 + length); + out_uint16_le(s, id); + out_uint16_le(s, flags); + out_uint16_le(s, length); + out_uint32_le(s, total_length); + out_uint8a(s, data, length); + s_mark_end(s); + rv = trans_force_write(self->chan_trans); + } + } + return rv; +} + +/*****************************************************************************/ +static int APP_CC +xrdp_mm_sesman_data_in(struct trans* trans) +{ + struct xrdp_mm* self; + struct stream* s; + int version; + int size; + int error; + int code; + + if (trans == 0) + { + return 1; + } + self = (struct xrdp_mm*)(trans->callback_data); + s = trans_get_in_s(trans); + if (s == 0) + { + return 1; + } + in_uint32_be(s, version); + in_uint32_be(s, size); + error = trans_force_read(trans, size - 8); + if (error == 0) + { + in_uint16_be(s, code); + switch (code) + { + case 3: + error = xrdp_mm_process_login_response(self, s); + break; + default: + g_writeln("xrdp_mm_sesman_data_in: unknown code %d", code); + break; + } + } + return error; +} + +/*****************************************************************************/ int APP_CC xrdp_mm_connect(struct xrdp_mm* self) { @@ -903,40 +895,27 @@ xrdp_mm_connect(struct xrdp_mm* self) { ok = 0; errstr[0] = 0; - self->sck = g_tcp_socket(); - self->sck_obj = g_create_wait_obj_from_socket(self->sck, 0); - g_tcp_set_non_blocking(self->sck); + trans_delete(self->sesman_trans); + self->sesman_trans = trans_create(1, 8192, 8192); xrdp_mm_get_sesman_port(port, sizeof(port)); g_snprintf(text, 255, "connecting to sesman ip %s port %s", ip, port); xrdp_wm_log_msg(self->wm, text); - error = g_tcp_connect(self->sck, ip, port); - if (error == 0) - { - ok = 1; - } - else if (error == -1) + + self->sesman_trans->trans_data_in = xrdp_mm_sesman_data_in; + self->sesman_trans->header_size = 8; + self->sesman_trans->callback_data = self; + /* try to connect up to 4 times */ + for (index = 0; index < 4; index++) { - if (g_tcp_last_error_would_block(self->sck)) + if (trans_connect(self->sesman_trans, ip, port, 3000) == 0) { + self->sesman_trans_up = 1; ok = 1; - /* wait up to 3 seconds for connect to complete */ - index = 0; - while (!g_tcp_can_send(self->sck, 100)) - { - index++; - if ((index >= 30) || g_is_term()) - { - g_snprintf(errstr, 255, "error connect sesman - connect timeout"); - ok = 0; - break; - } - } - } - else - { - name = g_get_strerror(); - g_snprintf(errstr, 255, "error connect sesman - %s", name); + break; } + g_sleep(1000); + g_writeln("xrdp_mm_connect: connect failed " + "trying again..."); } if (ok) { @@ -948,10 +927,9 @@ xrdp_mm_connect(struct xrdp_mm* self) else { xrdp_wm_log_msg(self->wm, errstr); - g_delete_wait_obj_from_socket(self->sck_obj); - self->sck_obj = 0; - g_tcp_close(self->sck); - self->sck = 0; + trans_delete(self->sesman_trans); + self->sesman_trans = 0; + self->sesman_trans_up = 0; rv = 1; } } @@ -976,94 +954,82 @@ xrdp_mm_connect(struct xrdp_mm* self) /*****************************************************************************/ int APP_CC -xrdp_mm_signal(struct xrdp_mm* self) +xrdp_mm_get_wait_objs(struct xrdp_mm* self, + tbus* read_objs, int* rcount, + tbus* write_objs, int* wcount, int* timeout) { - struct stream* s; - int error; - int version; - int size; - int code; int rv; + if (self == 0) + { + return 0; + } rv = 0; - if (self->connected_state == 1) + if ((self->sesman_trans != 0) && self->sesman_trans_up) { - make_stream(s); - init_stream(s, 8192); - error = xrdp_mm_recv(self, s->data, 8); - if (error == 0) - { - in_uint32_be(s, version); - in_uint32_be(s, size); - init_stream(s, 8192); - error = (size <= 8) || (size > 8000); - } - if (error == 0) - { - error = xrdp_mm_recv(self, s->data, size - 8); - } - if (error == 0) + trans_get_wait_objs(self->sesman_trans, read_objs, rcount, timeout); + } + if ((self->chan_trans != 0) && self->chan_trans_up) + { + trans_get_wait_objs(self->chan_trans, read_objs, rcount, timeout); + } + if (self->mod != 0) + { + if (self->mod->mod_get_wait_objs != 0) { - in_uint16_be(s, code); - switch (code) - { - case 3: - rv = xrdp_mm_process_login_response(self, s); - break; - default: - g_writeln("unknown code %d in xrdp_mm_signal", code); - break; - } + rv = self->mod->mod_get_wait_objs(self->mod, read_objs, rcount, + write_objs, wcount, timeout); } - free_stream(s); } return rv; } /*****************************************************************************/ -/* returns error - data coming from client that need to go to channel handler */ int APP_CC -xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2, - tbus param3, tbus param4) +xrdp_mm_check_wait_objs(struct xrdp_mm* self) { - struct stream* s; int rv; - int length; - int total_length; - int flags; - int id; - char* data; + if (self == 0) + { + return 0; + } rv = 0; + if ((self->sesman_trans != 0) && self->sesman_trans_up) + { + if (trans_check_wait_objs(self->sesman_trans) != 0) + { + self->delete_sesman_trans = 1; + } + } if ((self->chan_trans != 0) && self->chan_trans_up) { - s = trans_get_out_s(self->chan_trans, 8192); - if (s != 0) + if (trans_check_wait_objs(self->chan_trans) != 0) { - id = LOWORD(param1); - flags = HIWORD(param1); - length = param2; - data = (char*)param3; - total_length = param4; - if (total_length < length) - { - g_writeln("warning in xrdp_mm_process_channel_data total_len < length"); - total_length = length; - } - out_uint32_le(s, 0); /* version */ - out_uint32_le(s, 8 + 8 + 2 + 2 + 2 + 4 + length); - out_uint32_le(s, 5); /* msg id */ - out_uint32_le(s, 8 + 2 + 2 + 2 + 4 + length); - out_uint16_le(s, id); - out_uint16_le(s, flags); - out_uint16_le(s, length); - out_uint32_le(s, total_length); - out_uint8a(s, data, length); - s_mark_end(s); - rv = trans_force_write(self->chan_trans); + self->delete_chan_trans = 1; } } + if (self->mod != 0) + { + if (self->mod->mod_check_wait_objs != 0) + { + rv = self->mod->mod_check_wait_objs(self->mod); + } + } + if (self->delete_sesman_trans) + { + trans_delete(self->sesman_trans); + self->sesman_trans = 0; + self->sesman_trans_up = 0; + self->delete_sesman_trans = 0; + } + if (self->delete_chan_trans) + { + trans_delete(self->chan_trans); + self->chan_trans = 0; + self->chan_trans_up = 0; + self->delete_chan_trans = 0; + } return rv; } @@ -1074,7 +1040,7 @@ server_begin_update(struct xrdp_mod* mod) struct xrdp_wm* wm; struct xrdp_painter* p; - wm = (struct xrdp_wm*)mod->wm; + wm = (struct xrdp_wm*)(mod->wm); p = xrdp_painter_create(wm, wm->session); xrdp_painter_begin_update(p); mod->painter = (long)p; @@ -1087,7 +1053,7 @@ server_end_update(struct xrdp_mod* mod) { struct xrdp_painter* p; - p = (struct xrdp_painter*)mod->painter; + p = (struct xrdp_painter*)(mod->painter); xrdp_painter_end_update(p); xrdp_painter_delete(p); mod->painter = 0; @@ -1101,8 +1067,8 @@ server_fill_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy) struct xrdp_wm* wm; struct xrdp_painter* p; - wm = (struct xrdp_wm*)mod->wm; - p = (struct xrdp_painter*)mod->painter; + wm = (struct xrdp_wm*)(mod->wm); + p = (struct xrdp_painter*)(mod->painter); xrdp_painter_fill_rect(p, wm->screen, x, y, cx, cy); return 0; } @@ -1115,8 +1081,8 @@ server_screen_blt(struct xrdp_mod* mod, int x, int y, int cx, int cy, struct xrdp_wm* wm; struct xrdp_painter* p; - wm = (struct xrdp_wm*)mod->wm; - p = (struct xrdp_painter*)mod->painter; + wm = (struct xrdp_wm*)(mod->wm); + p = (struct xrdp_painter*)(mod->painter); p->rop = 0xcc; xrdp_painter_copy(p, wm->screen, wm->screen, x, y, cx, cy, srcx, srcy); return 0; @@ -1131,8 +1097,8 @@ server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy, struct xrdp_bitmap* b; struct xrdp_painter* p; - wm = (struct xrdp_wm*)mod->wm; - p = (struct xrdp_painter*)mod->painter; + wm = (struct xrdp_wm*)(mod->wm); + p = (struct xrdp_painter*)(mod->painter); b = xrdp_bitmap_create_with_data(width, height, wm->screen->bpp, data, wm); xrdp_painter_copy(p, b, wm->screen, x, y, cx, cy, srcx, srcy); xrdp_bitmap_delete(b); @@ -1146,7 +1112,7 @@ server_set_pointer(struct xrdp_mod* mod, int x, int y, { struct xrdp_wm* wm; - wm = (struct xrdp_wm*)mod->wm; + wm = (struct xrdp_wm*)(mod->wm); xrdp_wm_pointer(wm, data, mask, x, y); return 0; } @@ -1157,7 +1123,7 @@ server_palette(struct xrdp_mod* mod, int* palette) { struct xrdp_wm* wm; - wm = (struct xrdp_wm*)mod->wm; + wm = (struct xrdp_wm*)(mod->wm); if (g_memcmp(wm->palette, palette, 255 * sizeof(int)) != 0) { g_memcpy(wm->palette, palette, 256 * sizeof(int)); @@ -1177,7 +1143,7 @@ server_msg(struct xrdp_mod* mod, char* msg, int code) g_writeln(msg); return 0; } - wm = (struct xrdp_wm*)mod->wm; + wm = (struct xrdp_wm*)(mod->wm); return xrdp_wm_log_msg(wm, msg); } @@ -1194,7 +1160,7 @@ server_set_clip(struct xrdp_mod* mod, int x, int y, int cx, int cy) { struct xrdp_painter* p; - p = (struct xrdp_painter*)mod->painter; + p = (struct xrdp_painter*)(mod->painter); return xrdp_painter_set_clip(p, x, y, cx, cy); } @@ -1204,7 +1170,7 @@ server_reset_clip(struct xrdp_mod* mod) { struct xrdp_painter* p; - p = (struct xrdp_painter*)mod->painter; + p = (struct xrdp_painter*)(mod->painter); return xrdp_painter_clr_clip(p); } @@ -1214,7 +1180,7 @@ server_set_fgcolor(struct xrdp_mod* mod, int fgcolor) { struct xrdp_painter* p; - p = (struct xrdp_painter*)mod->painter; + p = (struct xrdp_painter*)(mod->painter); p->fg_color = fgcolor; p->pen.color = p->fg_color; return 0; @@ -1226,7 +1192,7 @@ server_set_bgcolor(struct xrdp_mod* mod, int bgcolor) { struct xrdp_painter* p; - p = (struct xrdp_painter*)mod->painter; + p = (struct xrdp_painter*)(mod->painter); p->bg_color = bgcolor; return 0; } @@ -1237,7 +1203,7 @@ server_set_opcode(struct xrdp_mod* mod, int opcode) { struct xrdp_painter* p; - p = (struct xrdp_painter*)mod->painter; + p = (struct xrdp_painter*)(mod->painter); p->rop = opcode; return 0; } @@ -1248,7 +1214,7 @@ server_set_mixmode(struct xrdp_mod* mod, int mixmode) { struct xrdp_painter* p; - p = (struct xrdp_painter*)mod->painter; + p = (struct xrdp_painter*)(mod->painter); p->mix_mode = mixmode; return 0; } @@ -1260,7 +1226,7 @@ server_set_brush(struct xrdp_mod* mod, int x_orgin, int y_orgin, { struct xrdp_painter* p; - p = (struct xrdp_painter*)mod->painter; + p = (struct xrdp_painter*)(mod->painter); p->brush.x_orgin = x_orgin; p->brush.y_orgin = y_orgin; p->brush.style = style; @@ -1274,7 +1240,7 @@ server_set_pen(struct xrdp_mod* mod, int style, int width) { struct xrdp_painter* p; - p = (struct xrdp_painter*)mod->painter; + p = (struct xrdp_painter*)(mod->painter); p->pen.style = style; p->pen.width = width; return 0; @@ -1287,8 +1253,8 @@ server_draw_line(struct xrdp_mod* mod, int x1, int y1, int x2, int y2) struct xrdp_wm* wm; struct xrdp_painter* p; - wm = (struct xrdp_wm*)mod->wm; - p = (struct xrdp_painter*)mod->painter; + wm = (struct xrdp_wm*)(mod->wm); + p = (struct xrdp_painter*)(mod->painter); return xrdp_painter_line(p, wm->screen, x1, y1, x2, y2); } @@ -1322,8 +1288,8 @@ server_draw_text(struct xrdp_mod* mod, int font, struct xrdp_wm* wm; struct xrdp_painter* p; - wm = (struct xrdp_wm*)mod->wm; - p = (struct xrdp_painter*)mod->painter; + wm = (struct xrdp_wm*)(mod->wm); + p = (struct xrdp_painter*)(mod->painter); return xrdp_painter_draw_text2(p, wm->screen, font, flags, mixmode, clip_left, clip_top, clip_right, clip_bottom, @@ -1338,7 +1304,7 @@ server_reset(struct xrdp_mod* mod, int width, int height, int bpp) { struct xrdp_wm* wm; - wm = (struct xrdp_wm*)mod->wm; + wm = (struct xrdp_wm*)(mod->wm); if (wm->client_info == 0) { return 1; @@ -1378,7 +1344,7 @@ server_query_channel(struct xrdp_mod* mod, int index, char* channel_name, { struct xrdp_wm* wm; - wm = (struct xrdp_wm*)mod->wm; + wm = (struct xrdp_wm*)(mod->wm); if (wm->mm->sesman_controlled) { return 1; @@ -1394,7 +1360,7 @@ server_get_channel_id(struct xrdp_mod* mod, char* name) { struct xrdp_wm* wm; - wm = (struct xrdp_wm*)mod->wm; + wm = (struct xrdp_wm*)(mod->wm); if (wm->mm->sesman_controlled) { return -1; @@ -1410,7 +1376,7 @@ server_send_to_channel(struct xrdp_mod* mod, int channel_id, { struct xrdp_wm* wm; - wm = (struct xrdp_wm*)mod->wm; + wm = (struct xrdp_wm*)(mod->wm); if (wm->mm->sesman_controlled) { return 1; diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index 97466af4..33dc2795 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -173,22 +173,23 @@ struct xrdp_cache struct xrdp_mm { struct xrdp_wm* wm; /* owner */ - int connected_state; - int sck; - tbus sck_obj; - int sck_closed; + int connected_state; /* true if connected to sesman else false */ + struct trans* sesman_trans; /* connection to sesman */ + int sesman_trans_up; /* true once connected to sesman */ + int delete_sesman_trans; /* boolean set when done with sesman connection */ struct list* login_names; struct list* login_values; /* mod vars */ long mod_handle; /* returned from g_load_library */ struct xrdp_mod* (*mod_init)(void); int (*mod_exit)(struct xrdp_mod*); - struct xrdp_mod* mod; - int display; - int code; - int sesman_controlled; - struct trans* chan_trans; - int chan_trans_up; + struct xrdp_mod* mod; /* module interface */ + int display; /* 10 for :10.0, 11 for :11.0, etc */ + int code; /* 0 Xvnc session 10 X11rdp session */ + int sesman_controlled; /* true if this is a sesman session */ + struct trans* chan_trans; /* connection to chansrv */ + int chan_trans_up; /* true once connected to chansrv */ + int delete_chan_trans; /* boolean set when done with channel connection */ }; struct xrdp_key_info diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index d9b227c5..02ea8f2e 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -1373,36 +1373,6 @@ xrdp_wm_login_mode_changed(struct xrdp_wm* self) return 0; } -/******************************************************************************/ -/* returns error */ -int APP_CC -xrdp_wm_app_sck_signal(struct xrdp_wm* self, int app_sck) -{ - if (self->login_mode == 3) - { - if (xrdp_mm_signal(self->mm) != 0) - { - return 1; - } - } - else if (self->login_mode > 9) - { - if (self->mm->mod == 0) - { - return 1; - } - if (self->mm->mod->mod_signal == 0) - { - return 1; - } - if (self->mm->mod->mod_signal(self->mm->mod) != 0) - { - return 1; - } - } - return 0; -} - /*****************************************************************************/ /* this is the log windows nofity function */ static int DEFAULT_CC @@ -1520,52 +1490,6 @@ xrdp_wm_log_msg(struct xrdp_wm* self, char* msg) } /*****************************************************************************/ -static int APP_CC -xrdp_wm_mod_get_wait_objs(struct xrdp_wm* self, - tbus* read_objs, int* rcount, - tbus* write_objs, int* wcount, int* timeout) -{ - if (self->mm != 0) - { - if ((self->mm->chan_trans != 0) && self->mm->chan_trans_up) - { - trans_get_wait_objs(self->mm->chan_trans, read_objs, rcount, timeout); - } - if (self->mm->mod != 0) - { - if (self->mm->mod->mod_get_wait_objs != 0) - { - return self->mm->mod->mod_get_wait_objs - (self->mm->mod, read_objs, rcount, - write_objs, wcount, timeout); - } - } - } - return 0; -} - -/*****************************************************************************/ -static int APP_CC -xrdp_wm_mod_check_wait_objs(struct xrdp_wm* self) -{ - if (self->mm != 0) - { - if ((self->mm->chan_trans != 0) && self->mm->chan_trans_up) - { - trans_check_wait_objs(self->mm->chan_trans); - } - if (self->mm->mod != 0) - { - if (self->mm->mod->mod_check_wait_objs != 0) - { - return self->mm->mod->mod_check_wait_objs(self->mm->mod); - } - } - } - return 0; -} - -/*****************************************************************************/ int APP_CC xrdp_wm_get_wait_objs(struct xrdp_wm* self, tbus* robjs, int* rc, tbus* wobjs, int* wc, int* timeout) @@ -1578,15 +1502,8 @@ xrdp_wm_get_wait_objs(struct xrdp_wm* self, tbus* robjs, int* rc, } i = *rc; robjs[i++] = self->login_mode_event; - if (self->mm != 0) - { - if (self->mm->sck_obj != 0) - { - robjs[i++] = self->mm->sck_obj; - } - } *rc = i; - return xrdp_wm_mod_get_wait_objs(self, robjs, rc, wobjs, wc, timeout); + return xrdp_mm_get_wait_objs(self->mm, robjs, rc, wobjs, wc, timeout); } /******************************************************************************/ @@ -1605,19 +1522,9 @@ xrdp_wm_check_wait_objs(struct xrdp_wm* self) g_reset_wait_obj(self->login_mode_event); xrdp_wm_login_mode_changed(self); } - if (self->mm != 0) - { - if (self->mm->sck_obj != 0) - { - if (g_is_wait_obj_set(self->mm->sck_obj)) - { - rv = xrdp_mm_signal(self->mm); - } - } - } if (rv == 0) { - rv = xrdp_wm_mod_check_wait_objs(self); + rv = xrdp_mm_check_wait_objs(self->mm); } return rv; } |