added new wait_obj functions
This commit is contained in:
parent
fee6f82bf7
commit
d061537be9
49
rdp/rdp.c
49
rdp/rdp.c
@ -53,6 +53,7 @@ lib_mod_connect(struct mod* mod)
|
|||||||
if (rdp_rdp_connect(mod->rdp_layer, mod->ip, mod->port) == 0)
|
if (rdp_rdp_connect(mod->rdp_layer, mod->ip, mod->port) == 0)
|
||||||
{
|
{
|
||||||
mod->sck = mod->rdp_layer->sec_layer->mcs_layer->iso_layer->tcp_layer->sck;
|
mod->sck = mod->rdp_layer->sec_layer->mcs_layer->iso_layer->tcp_layer->sck;
|
||||||
|
mod->sck_obj = g_create_wait_obj_from_socket(mod->sck, 0);
|
||||||
DEBUG(("out lib_mod_connect"));
|
DEBUG(("out lib_mod_connect"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -209,6 +210,11 @@ lib_mod_end(struct mod* mod)
|
|||||||
mod->rdp_layer = 0;
|
mod->rdp_layer = 0;
|
||||||
free_stream(mod->in_s);
|
free_stream(mod->in_s);
|
||||||
mod->in_s = 0;
|
mod->in_s = 0;
|
||||||
|
if (mod->sck_obj != 0)
|
||||||
|
{
|
||||||
|
g_delete_wait_obj_from_socket(mod->sck_obj);
|
||||||
|
mod->sck_obj = 0;
|
||||||
|
}
|
||||||
if (mod->sck != 0)
|
if (mod->sck != 0)
|
||||||
{
|
{
|
||||||
g_tcp_close(mod->sck);
|
g_tcp_close(mod->sck);
|
||||||
@ -249,6 +255,47 @@ lib_mod_set_param(struct mod* mod, char* name, char* value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* return error */
|
||||||
|
int DEFAULT_CC
|
||||||
|
lib_mod_get_wait_objs(struct mod* mod, tbus* read_objs, int* rcount,
|
||||||
|
tbus* write_objs, int* wcount, int* timeout)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = *rcount;
|
||||||
|
if (mod != 0)
|
||||||
|
{
|
||||||
|
if (mod->sck_obj != 0)
|
||||||
|
{
|
||||||
|
read_objs[i++] = mod->sck_obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*rcount = i;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* return error */
|
||||||
|
int DEFAULT_CC
|
||||||
|
lib_mod_check_wait_objs(struct mod* mod)
|
||||||
|
{
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
rv = 0;
|
||||||
|
if (mod != 0)
|
||||||
|
{
|
||||||
|
if (mod->sck_obj != 0)
|
||||||
|
{
|
||||||
|
if (g_is_wait_obj_set(mod->sck_obj))
|
||||||
|
{
|
||||||
|
rv = lib_mod_signal(mod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
struct mod* EXPORT_CC
|
struct mod* EXPORT_CC
|
||||||
mod_init(void)
|
mod_init(void)
|
||||||
@ -265,6 +312,8 @@ mod_init(void)
|
|||||||
mod->mod_signal = lib_mod_signal;
|
mod->mod_signal = lib_mod_signal;
|
||||||
mod->mod_end = lib_mod_end;
|
mod->mod_end = lib_mod_end;
|
||||||
mod->mod_set_param = lib_mod_set_param;
|
mod->mod_set_param = lib_mod_set_param;
|
||||||
|
mod->mod_get_wait_objs = lib_mod_get_wait_objs;
|
||||||
|
mod->mod_check_wait_objs = lib_mod_check_wait_objs;
|
||||||
mod->rdp_layer = rdp_rdp_create(mod);
|
mod->rdp_layer = rdp_rdp_create(mod);
|
||||||
DEBUG(("out mod_init"));
|
DEBUG(("out mod_init"));
|
||||||
return mod;
|
return mod;
|
||||||
|
@ -263,7 +263,11 @@ struct mod
|
|||||||
int (*mod_signal)(struct mod* v);
|
int (*mod_signal)(struct mod* v);
|
||||||
int (*mod_end)(struct mod* v);
|
int (*mod_end)(struct mod* v);
|
||||||
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
||||||
long mod_dumby[100 - 6]; /* align, 100 minus the number of mod
|
int (*mod_session_change)(struct mod* v, int, int);
|
||||||
|
int (*mod_get_wait_objs)(struct mod* v, tbus* read_objs, int* rcount,
|
||||||
|
tbus* write_objs, int* wcount, int* timeout);
|
||||||
|
int (*mod_check_wait_objs)(struct mod* v);
|
||||||
|
long mod_dumby[100 - 9]; /* align, 100 minus the number of mod
|
||||||
functions above */
|
functions above */
|
||||||
/* server functions */
|
/* server functions */
|
||||||
int (*server_begin_update)(struct mod* v);
|
int (*server_begin_update)(struct mod* v);
|
||||||
@ -328,6 +332,7 @@ struct mod
|
|||||||
int keylayout;
|
int keylayout;
|
||||||
int up_and_running;
|
int up_and_running;
|
||||||
struct stream* in_s;
|
struct stream* in_s;
|
||||||
|
tbus sck_obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* rdp_tcp.c */
|
/* rdp_tcp.c */
|
||||||
|
45
vnc/vnc.c
45
vnc/vnc.c
@ -1161,6 +1161,7 @@ connections", 0);
|
|||||||
g_sprintf(con_port, "%s", v->port);
|
g_sprintf(con_port, "%s", v->port);
|
||||||
make_stream(pixel_format);
|
make_stream(pixel_format);
|
||||||
v->sck = g_tcp_socket();
|
v->sck = g_tcp_socket();
|
||||||
|
v->sck_obj = g_create_wait_obj_from_socket(v->sck, 0);
|
||||||
v->sck_closed = 0;
|
v->sck_closed = 0;
|
||||||
g_sprintf(text, "connecting to %s %s", v->ip, con_port);
|
g_sprintf(text, "connecting to %s %s", v->ip, con_port);
|
||||||
v->server_msg(v, text, 0);
|
v->server_msg(v, text, 0);
|
||||||
@ -1439,6 +1440,47 @@ lib_mod_set_param(struct vnc* v, char* name, char* value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* return error */
|
||||||
|
int DEFAULT_CC
|
||||||
|
lib_mod_get_wait_objs(struct vnc* v, tbus* read_objs, int* rcount,
|
||||||
|
tbus* write_objs, int* wcount, int* timeout)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = *rcount;
|
||||||
|
if (v != 0)
|
||||||
|
{
|
||||||
|
if (v->sck_obj != 0)
|
||||||
|
{
|
||||||
|
read_objs[i++] = v->sck_obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*rcount = i;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* return error */
|
||||||
|
int DEFAULT_CC
|
||||||
|
lib_mod_check_wait_objs(struct vnc* v)
|
||||||
|
{
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
rv = 0;
|
||||||
|
if (v != 0)
|
||||||
|
{
|
||||||
|
if (v->sck_obj != 0)
|
||||||
|
{
|
||||||
|
if (g_is_wait_obj_set(v->sck_obj))
|
||||||
|
{
|
||||||
|
rv = lib_mod_signal(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
struct vnc* EXPORT_CC
|
struct vnc* EXPORT_CC
|
||||||
mod_init(void)
|
mod_init(void)
|
||||||
@ -1455,6 +1497,8 @@ mod_init(void)
|
|||||||
v->mod_signal = lib_mod_signal;
|
v->mod_signal = lib_mod_signal;
|
||||||
v->mod_end = lib_mod_end;
|
v->mod_end = lib_mod_end;
|
||||||
v->mod_set_param = lib_mod_set_param;
|
v->mod_set_param = lib_mod_set_param;
|
||||||
|
v->mod_get_wait_objs = lib_mod_get_wait_objs;
|
||||||
|
v->mod_check_wait_objs = lib_mod_check_wait_objs;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1466,6 +1510,7 @@ mod_exit(struct vnc* v)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
g_delete_wait_obj_from_socket(v->sck_obj);
|
||||||
g_tcp_close(v->sck);
|
g_tcp_close(v->sck);
|
||||||
g_free(v);
|
g_free(v);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -38,7 +38,11 @@ struct vnc
|
|||||||
int (*mod_signal)(struct vnc* v);
|
int (*mod_signal)(struct vnc* v);
|
||||||
int (*mod_end)(struct vnc* v);
|
int (*mod_end)(struct vnc* v);
|
||||||
int (*mod_set_param)(struct vnc* v, char* name, char* value);
|
int (*mod_set_param)(struct vnc* v, char* name, char* value);
|
||||||
long mod_dumby[100 - 6]; /* align, 100 minus the number of mod
|
int (*mod_session_change)(struct vnc* v, int, int);
|
||||||
|
int (*mod_get_wait_objs)(struct vnc* v, tbus* read_objs, int* rcount,
|
||||||
|
tbus* write_objs, int* wcount, int* timeout);
|
||||||
|
int (*mod_check_wait_objs)(struct vnc* v);
|
||||||
|
long mod_dumby[100 - 9]; /* align, 100 minus the number of mod
|
||||||
functions above */
|
functions above */
|
||||||
/* server functions */
|
/* server functions */
|
||||||
int (*server_begin_update)(struct vnc* v);
|
int (*server_begin_update)(struct vnc* v);
|
||||||
@ -107,4 +111,5 @@ struct vnc
|
|||||||
int clip_chanid;
|
int clip_chanid;
|
||||||
char* clip_data;
|
char* clip_data;
|
||||||
int clip_data_size;
|
int clip_data_size;
|
||||||
|
tbus sck_obj;
|
||||||
};
|
};
|
||||||
|
@ -455,6 +455,8 @@ mod_init(void)
|
|||||||
mod->mod_signal = lib_mod_signal;
|
mod->mod_signal = lib_mod_signal;
|
||||||
mod->mod_end = lib_mod_end;
|
mod->mod_end = lib_mod_end;
|
||||||
mod->mod_set_param = lib_mod_set_param;
|
mod->mod_set_param = lib_mod_set_param;
|
||||||
|
mod->mod_get_wait_objs = lib_mod_get_wait_objs;
|
||||||
|
mod->mod_check_wait_objs = lib_mod_check_wait_objs;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,11 @@ struct mod
|
|||||||
int (*mod_signal)(struct mod* v);
|
int (*mod_signal)(struct mod* v);
|
||||||
int (*mod_end)(struct mod* v);
|
int (*mod_end)(struct mod* v);
|
||||||
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
||||||
long mod_dumby[100 - 6]; /* align, 100 minus the number of mod
|
int (*mod_session_change)(struct mod* v, int, int);
|
||||||
|
int (*mod_get_wait_objs)(struct mod* v, tbus* read_objs, int* rcount,
|
||||||
|
tbus* write_objs, int* wcount, int* timeout);
|
||||||
|
int (*mod_check_wait_objs)(struct mod* v);
|
||||||
|
long mod_dumby[100 - 9]; /* align, 100 minus the number of mod
|
||||||
functions above */
|
functions above */
|
||||||
/* server functions */
|
/* server functions */
|
||||||
int (*server_begin_update)(struct mod* v);
|
int (*server_begin_update)(struct mod* v);
|
||||||
@ -95,4 +99,5 @@ struct mod
|
|||||||
char password[256];
|
char password[256];
|
||||||
char ip[256];
|
char ip[256];
|
||||||
char port[256];
|
char port[256];
|
||||||
|
tbus sck_obj;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user