|
|
|
@ -24,12 +24,13 @@
|
|
|
|
|
#include "parse.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
struct trans *APP_CC
|
|
|
|
|
struct trans *
|
|
|
|
|
APP_CC
|
|
|
|
|
trans_create(int mode, int in_size, int out_size)
|
|
|
|
|
{
|
|
|
|
|
struct trans *self = (struct trans *)NULL;
|
|
|
|
|
struct trans *self = (struct trans *) NULL;
|
|
|
|
|
|
|
|
|
|
self = (struct trans *)g_malloc(sizeof(struct trans), 1);
|
|
|
|
|
self = (struct trans *) g_malloc(sizeof(struct trans), 1);
|
|
|
|
|
|
|
|
|
|
if (self != NULL)
|
|
|
|
|
{
|
|
|
|
@ -101,8 +102,7 @@ trans_get_wait_objs(struct trans *self, tbus *objs, int *count)
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
int APP_CC
|
|
|
|
|
trans_get_wait_objs_rw(struct trans *self,
|
|
|
|
|
tbus *robjs, int *rcount,
|
|
|
|
|
trans_get_wait_objs_rw(struct trans *self, tbus *robjs, int *rcount,
|
|
|
|
|
tbus *wobjs, int *wcount)
|
|
|
|
|
{
|
|
|
|
|
if (self == 0)
|
|
|
|
@ -183,8 +183,8 @@ send_waiting(struct trans *self, int block)
|
|
|
|
|
int APP_CC
|
|
|
|
|
trans_check_wait_objs(struct trans *self)
|
|
|
|
|
{
|
|
|
|
|
tbus in_sck = (tbus)0;
|
|
|
|
|
struct trans *in_trans = (struct trans *)NULL;
|
|
|
|
|
tbus in_sck = (tbus) 0;
|
|
|
|
|
struct trans *in_trans = (struct trans *) NULL;
|
|
|
|
|
int read_bytes = 0;
|
|
|
|
|
int to_read = 0;
|
|
|
|
|
int read_so_far = 0;
|
|
|
|
@ -233,8 +233,10 @@ trans_check_wait_objs(struct trans *self)
|
|
|
|
|
in_trans->type1 = TRANS_TYPE_SERVER;
|
|
|
|
|
in_trans->status = TRANS_STATUS_UP;
|
|
|
|
|
in_trans->is_term = self->is_term;
|
|
|
|
|
g_strncpy(in_trans->addr, self->addr, sizeof(self->addr) - 1);
|
|
|
|
|
g_strncpy(in_trans->port, self->port, sizeof(self->port) - 1);
|
|
|
|
|
g_strncpy(in_trans->addr, self->addr,
|
|
|
|
|
sizeof(self->addr) - 1);
|
|
|
|
|
g_strncpy(in_trans->port, self->port,
|
|
|
|
|
sizeof(self->port) - 1);
|
|
|
|
|
|
|
|
|
|
if (self->trans_conn_in(self, in_trans) != 0)
|
|
|
|
|
{
|
|
|
|
@ -252,7 +254,7 @@ trans_check_wait_objs(struct trans *self)
|
|
|
|
|
{
|
|
|
|
|
if (g_tcp_can_recv(self->sck, 0))
|
|
|
|
|
{
|
|
|
|
|
read_so_far = (int)(self->in_s->end - self->in_s->data);
|
|
|
|
|
read_so_far = (int) (self->in_s->end - self->in_s->data);
|
|
|
|
|
to_read = self->header_size - read_so_far;
|
|
|
|
|
|
|
|
|
|
if (to_read > 0)
|
|
|
|
@ -284,7 +286,7 @@ trans_check_wait_objs(struct trans *self)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
read_so_far = (int)(self->in_s->end - self->in_s->data);
|
|
|
|
|
read_so_far = (int) (self->in_s->end - self->in_s->data);
|
|
|
|
|
|
|
|
|
|
if (read_so_far == self->header_size)
|
|
|
|
|
{
|
|
|
|
@ -402,7 +404,7 @@ trans_tcp_force_write_s(struct trans *self, struct stream *out_s)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size = (int)(out_s->end - out_s->data);
|
|
|
|
|
size = (int) (out_s->end - out_s->data);
|
|
|
|
|
total = 0;
|
|
|
|
|
|
|
|
|
|
if (send_waiting(self, 1) != 0)
|
|
|
|
@ -477,7 +479,7 @@ trans_write_copy(struct trans *self)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
out_s = self->out_s;
|
|
|
|
|
size = (int)(out_s->end - out_s->data);
|
|
|
|
|
size = (int) (out_s->end - out_s->data);
|
|
|
|
|
make_stream(wait_s);
|
|
|
|
|
init_stream(wait_s, size);
|
|
|
|
|
out_uint8a(wait_s, out_s->data, size);
|
|
|
|
@ -615,14 +617,15 @@ trans_listen(struct trans *self, char *port)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
struct stream *APP_CC
|
|
|
|
|
struct stream *
|
|
|
|
|
APP_CC
|
|
|
|
|
trans_get_in_s(struct trans *self)
|
|
|
|
|
{
|
|
|
|
|
struct stream *rv = (struct stream *)NULL;
|
|
|
|
|
struct stream *rv = (struct stream *) NULL;
|
|
|
|
|
|
|
|
|
|
if (self == NULL)
|
|
|
|
|
{
|
|
|
|
|
rv = (struct stream *)NULL;
|
|
|
|
|
rv = (struct stream *) NULL;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -633,14 +636,15 @@ trans_get_in_s(struct trans *self)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
struct stream *APP_CC
|
|
|
|
|
struct stream *
|
|
|
|
|
APP_CC
|
|
|
|
|
trans_get_out_s(struct trans *self, int size)
|
|
|
|
|
{
|
|
|
|
|
struct stream *rv = (struct stream *)NULL;
|
|
|
|
|
struct stream *rv = (struct stream *) NULL;
|
|
|
|
|
|
|
|
|
|
if (self == NULL)
|
|
|
|
|
{
|
|
|
|
|
rv = (struct stream *)NULL;
|
|
|
|
|
rv = (struct stream *) NULL;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -684,8 +688,9 @@ trans_shutdown_tls_mode(struct trans *self)
|
|
|
|
|
return xrdp_tls_disconnect(self->tls);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* set callback back to tcp */
|
|
|
|
|
/* set callback back to tcp
|
|
|
|
|
self->trans_read_call = trans_tcp_force_read_s;
|
|
|
|
|
self->trans_write_call = trans_tcp_force_write_s;
|
|
|
|
|
*/
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|