libxrdp: work on fastpath input

ulab-next
speidy 11 years ago
parent cbf5d50a5c
commit f525c0f8e7

@ -137,6 +137,15 @@ libxrdp_process_data(struct xrdp_session *session)
} }
break; break;
case 2: /* FASTPATH_INPUT_EVENT */
if (xrdp_rdp_process_fastpath_data_input((struct xrdp_rdp *)session->rdp,
session->s) != 0)
{
DEBUG(("libxrdp_process_data returned non zero"));
cont = 0;
term = 1;
}
break;
default: default:
g_writeln("unknown in libxrdp_process_data: code= %d", code); g_writeln("unknown in libxrdp_process_data: code= %d", code);
dead_lock_counter++; dead_lock_counter++;

@ -82,6 +82,7 @@ struct xrdp_fastpath
struct xrdp_tcp* tcp_layer; struct xrdp_tcp* tcp_layer;
int numEvents; int numEvents;
int secFlags; int secFlags;
int firstPacket;
}; };
/* sec */ /* sec */
@ -373,6 +374,8 @@ xrdp_rdp_process_confirm_active(struct xrdp_rdp* self, struct stream* s);
int APP_CC int APP_CC
xrdp_rdp_process_data(struct xrdp_rdp* self, struct stream* s); xrdp_rdp_process_data(struct xrdp_rdp* self, struct stream* s);
int APP_CC int APP_CC
xrdp_rdp_process_fastpath_data_input(struct xrdp_rdp *self, struct stream *s);
int APP_CC
xrdp_rdp_disconnect(struct xrdp_rdp* self); xrdp_rdp_disconnect(struct xrdp_rdp* self);
int APP_CC int APP_CC
xrdp_rdp_send_deactive(struct xrdp_rdp* self); xrdp_rdp_send_deactive(struct xrdp_rdp* self);

@ -88,7 +88,7 @@ xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
} }
// receive the left bytes // receive the left bytes
if (xrdp_tcp_recv(self->tcp_layer, s, len) != 0) if (xrdp_tcp_recv(self->tcp_layer, s, len - (s->p - s->data)) != 0)
{ {
return 1; return 1;
} }

@ -277,7 +277,9 @@ xrdp_rdp_recv(struct xrdp_rdp *self, struct stream *s, int *code)
if (error == 2) /* we have fastpath packet! */ if (error == 2) /* we have fastpath packet! */
{ {
return xrdp_rdp_recv_fastpath(self, s, code); s->next_packet = 0;
*code = 2;
return 0;
} }
if (error == -1) /* special code for send demand active */ if (error == -1) /* special code for send demand active */
@ -344,20 +346,6 @@ xrdp_rdp_recv(struct xrdp_rdp *self, struct stream *s, int *code)
} }
} }
/*****************************************************************************/ /*****************************************************************************/
/* returns error */
int APP_CC
xrdp_rdp_recv_fastpath(struct xrdp_rdp *self, struct stream *s, int *code)
{
int i;
DEBUG(("in xrdp_rdp_recv_fastpath"));
// for (i = 0 ; i < self->sec_layer->fastpath_layer->numEvents ; i++) {
//
// }
g_hexdump(s->data, 7);
DEBUG(("out xrdp_rdp_recv_fastpath"));
return 1;
}
/*****************************************************************************/
int APP_CC int APP_CC
xrdp_rdp_send(struct xrdp_rdp *self, struct stream *s, int pdu_type) xrdp_rdp_send(struct xrdp_rdp *self, struct stream *s, int pdu_type)
{ {
@ -1711,7 +1699,77 @@ xrdp_rdp_send_disconnect_reason(struct xrdp_rdp *self, int reason)
return 0; return 0;
} }
#endif #endif
/*****************************************************************************/
/* FASTPATH_INPUT_EVENT */
int APP_CC
xrdp_rdp_process_fastpath_data_input(struct xrdp_rdp *self, struct stream *s)
{
int i;
int eventHeader;
int eventCode;
int eventFlags;
int code;
int flags;
// process fastpath input events
for (i = 0 ; i < self->sec_layer->fastpath_layer->numEvents ; i++) {
in_uint8(s, eventHeader);
eventFlags = (eventHeader & 0x1F);
eventCode = (eventHeader >> 5);
g_writeln("eventCode= %d, eventFlags= %d, numEvents= %d", eventCode, eventFlags, self->sec_layer->fastpath_layer->numEvents);
switch (eventCode)
{
case FASTPATH_INPUT_EVENT_SCANCODE:
in_uint8(s, code); /* keyCode (1 byte) */
g_writeln("scan code detected: %d", code);
flags = 0;
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE))
flags |= KBD_FLAG_UP;
else
flags |= KBD_FLAG_DOWN;
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED))
flags |= KBD_FLAG_EXT;
if (self->session->callback != 0)
{
/* msg_type can be
RDP_INPUT_SYNCHRONIZE - 0
RDP_INPUT_SCANCODE - 4
RDP_INPUT_MOUSE - 0x8001
RDP_INPUT_MOUSEX - 0x8002 */
/* call to xrdp_wm.c : callback */
self->session->callback(self->session->id, RDP_INPUT_SCANCODE, flags, 0,
code, time);
}
break;
case FASTPATH_INPUT_EVENT_MOUSE:
in_uint8s(s, 6);
break;
case FASTPATH_INPUT_EVENT_MOUSEX:
in_uint8s(s, 6);
break;
case FASTPATH_INPUT_EVENT_SYNC:
break;
case FASTPATH_INPUT_EVENT_UNICODE:
in_uint8s(s, 2);
break;
default:
printf("Unknown eventCode %d\n", eventCode);
break;
}
}
return 0;
}
/*****************************************************************************/ /*****************************************************************************/
/* RDP_PDU_DATA */ /* RDP_PDU_DATA */
int APP_CC int APP_CC

@ -743,7 +743,6 @@ xrdp_sec_recv_fastpath(struct xrdp_sec *self, struct stream *s)
return 1; return 1;
} }
in_uint8s(s, 8); /* dataSignature, skip for now */ in_uint8s(s, 8); /* dataSignature, skip for now */
if (self->fastpath_layer->secFlags & FASTPATH_INPUT_ENCRYPTED) { if (self->fastpath_layer->secFlags & FASTPATH_INPUT_ENCRYPTED) {

Loading…
Cancel
Save