Actually parse server announce, add defines for other packets and components.

This commit is contained in:
Michael Jumper 2013-06-19 16:23:11 -07:00
parent 11deb82bcb
commit f295b09987
2 changed files with 105 additions and 3 deletions

View File

@ -38,7 +38,35 @@
#ifndef __GUAC_RDPDR_MESSAGES_H
#define __GUAC_RDPDR_MESSAGES_H
/* STUB */
/**
* Identifies the "core" component of RDPDR as the destination of the received
* packet.
*/
#define RDPDR_CTYP_CORE 0x4472
/**
* Identifies the printing component of RDPDR as the destination of the
* received packet.
*/
#define RDPDR_CTYP_PRN 0x5052
/*
* Packet IDs as required by the RDP spec (see: [MS-RDPEFS].pdf)
*/
#define PAKID_CORE_SERVER_ANNOUNCE 0x496E
#define PAKID_CORE_CLIENTID_CONFIRM 0x4343
#define PAKID_CORE_CLIENT_NAME 0x434E
#define PAKID_CORE_DEVICELIST_ANNOUNCE 0x4441
#define PAKID_CORE_DEVICE_REPLY 0x6472
#define PAKID_CORE_DEVICE_IOREQUEST 0x4952
#define PAKID_CORE_DEVICE_IOCOMPLETION 0x4943
#define PAKID_CORE_SERVER_CAPABILITY 0x5350
#define PAKID_CORE_CLIENT_CAPABILITY 0x4350
#define PAKID_CORE_DEVICELIST_REMOVE 0x444D
#define PAKID_PRN_CACHE_DATA 0x5043
#define PAKID_CORE_USER_LOGGEDON 0x554C
#define PAKID_PRN_USING_XPS 0x5543
#endif

View File

@ -85,13 +85,87 @@ void guac_rdpdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) {
freerdp_event_free(event);
}
static void _guac_rdpdr_process_server_announce(guac_rdpdrPlugin* rdpdr,
STREAM* input_stream) {
int major, minor, client_id;
stream_read_uint16(input_stream, major);
stream_read_uint16(input_stream, minor);
stream_read_uint32(input_stream, client_id);
guac_client_log_info(rdpdr->client, "Connected to RDPDR %i.%i as client %i", major, minor, client_id);
}
void guac_rdpdr_process_receive(rdpSvcPlugin* plugin,
STREAM* input_stream) {
guac_rdpdrPlugin* rdpdr = (guac_rdpdrPlugin*) plugin;
/* STUB - read packet type, dispatch based on type */
guac_client_log_info(rdpdr->client, "STUB - RDPDR data received.");
int component;
int packet_id;
/* Read header */
stream_read_uint16(input_stream, component);
stream_read_uint16(input_stream, packet_id);
/* Core component */
if (component == RDPDR_CTYP_CORE) {
/* Dispatch handlers based on packet ID */
switch (packet_id) {
case PAKID_CORE_SERVER_ANNOUNCE:
_guac_rdpdr_process_server_announce(rdpdr, input_stream);
break;
case PAKID_CORE_CLIENTID_CONFIRM:
break;
case PAKID_CORE_DEVICE_REPLY:
break;
case PAKID_CORE_DEVICE_IOREQUEST:
break;
case PAKID_CORE_DEVICE_IOCOMPLETION:
break;
case PAKID_CORE_SERVER_CAPABILITY:
break;
case PAKID_CORE_USER_LOGGEDON:
break;
default:
guac_client_log_info(rdpdr->client, "Ignoring RDPDR core packet with unexpected ID: 0x%04x", packet_id);
}
} /* end if core */
/* Printer component */
else if (component == RDPDR_CTYP_PRN) {
/* Dispatch handlers based on packet ID */
switch (packet_id) {
case PAKID_PRN_CACHE_DATA:
break;
case PAKID_PRN_USING_XPS:
break;
default:
guac_client_log_info(rdpdr->client, "Ignoring RDPDR printer packet with unexpected ID: 0x%04x", packet_id);
}
} /* end if printer */
else
guac_client_log_info(rdpdr->client, "Ignoring packet for unknown RDPDR component: 0x%04x", component);
}