server: implement frame acknowledge PDU.

This commit is contained in:
Vic Lee 2012-05-11 16:35:11 +08:00
parent 4a6c5a72c4
commit 4050944f6e
6 changed files with 56 additions and 8 deletions

View File

@ -67,6 +67,8 @@ struct rdp_freerdp_peer
psPeerSendChannelData SendChannelData;
psPeerReceiveChannelData ReceiveChannelData;
uint32 ack_frame_id;
};
FREERDP_API void freerdp_peer_context_new(freerdp_peer* client);

View File

@ -123,6 +123,12 @@ struct _SURFACE_FRAME_MARKER
};
typedef struct _SURFACE_FRAME_MARKER SURFACE_FRAME_MARKER;
enum SURFCMD_FRAMEACTION
{
SURFACECMD_FRAMEACTION_BEGIN = 0x0000,
SURFACECMD_FRAMEACTION_END = 0x0001
};
/* Update Interface */
typedef void (*pBeginPaint)(rdpContext* context);

View File

@ -1613,7 +1613,14 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings)
void rdp_read_frame_acknowledge_capability_set(STREAM* s, uint16 length, rdpSettings* settings)
{
if (settings->server_mode)
{
stream_read_uint32(s, settings->frame_acknowledge); /* (4 bytes) */
}
else
{
stream_seek_uint32(s); /* (4 bytes) */
}
}
/**
@ -1873,7 +1880,7 @@ void rdp_write_demand_active(STREAM* s, rdpSettings* settings)
stream_seek_uint16(s); /* numberCapabilities (2 bytes) */
stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */
numberCapabilities = 13;
numberCapabilities = 14;
rdp_write_general_capability_set(s, settings);
rdp_write_bitmap_capability_set(s, settings);
rdp_write_order_capability_set(s, settings);
@ -1887,6 +1894,7 @@ void rdp_write_demand_active(STREAM* s, rdpSettings* settings)
rdp_write_desktop_composition_capability_set(s, settings);
rdp_write_surface_commands_capability_set(s, settings);
rdp_write_bitmap_codecs_capability_set(s, settings);
rdp_write_frame_acknowledge_capability_set(s, settings);
if (settings->persistent_bitmap_cache)
{

View File

@ -25,6 +25,7 @@
static boolean freerdp_peer_initialize(freerdp_peer* client)
{
client->context->rdp->settings->server_mode = true;
client->context->rdp->settings->frame_acknowledge = 0;
client->context->rdp->state = CONNECTION_STATE_INITIAL;
if (client->context->rdp->settings->rdp_key_file != NULL)
@ -120,6 +121,10 @@ static boolean peer_recv_data_pdu(freerdp_peer* client, STREAM* s)
mcs_send_disconnect_provider_ultimatum(client->context->rdp->mcs);
return false;
case DATA_PDU_TYPE_FRAME_ACKNOWLEDGE:
stream_read_uint32(s, client->ack_frame_id);
break;
default:
printf("Data PDU type %d\n", type);
break;

View File

@ -33,12 +33,6 @@ enum SURFCMD_CMDTYPE
CMDTYPE_STREAM_SURFACE_BITS = 0x0006
};
enum SURFCMD_FRAMEACTION
{
SURFACECMD_FRAMEACTION_BEGIN = 0x0000,
SURFACECMD_FRAMEACTION_END = 0x0001
};
boolean update_recv_surfcmds(rdpUpdate* update, uint32 size, STREAM* s);
void update_write_surfcmd_surface_bits_header(STREAM* s, SURFACE_BITS_COMMAND* cmd);

View File

@ -60,6 +60,7 @@ struct test_peer_context
WTSVirtualChannelManager* vcm;
void* debug_channel;
freerdp_thread* debug_channel_thread;
uint32 frame_id;
};
typedef struct test_peer_context testPeerContext;
@ -120,6 +121,30 @@ static STREAM* test_peer_stream_init(testPeerContext* context)
return context->s;
}
static void test_peer_begin_frame(freerdp_peer* client)
{
rdpUpdate* update = client->update;
SURFACE_FRAME_MARKER* fm = &update->surface_frame_marker;
testPeerContext* context = (testPeerContext*) client->context;
fm->frameAction = SURFACECMD_FRAMEACTION_BEGIN;
fm->frameId = context->frame_id;
update->SurfaceFrameMarker(update->context, fm);
}
static void test_peer_end_frame(freerdp_peer* client)
{
rdpUpdate* update = client->update;
SURFACE_FRAME_MARKER* fm = &update->surface_frame_marker;
testPeerContext* context = (testPeerContext*) client->context;
fm->frameAction = SURFACECMD_FRAMEACTION_END;
fm->frameId = context->frame_id;
update->SurfaceFrameMarker(update->context, fm);
context->frame_id++;
}
static void test_peer_draw_background(freerdp_peer* client)
{
testPeerContext* context = (testPeerContext*) client->context;
@ -133,6 +158,8 @@ static void test_peer_draw_background(freerdp_peer* client)
if (!client->settings->rfx_codec && !client->settings->ns_codec)
return;
test_peer_begin_frame(client);
s = test_peer_stream_init(context);
rect.x = 0;
@ -169,6 +196,8 @@ static void test_peer_draw_background(freerdp_peer* client)
update->SurfaceBits(update->context, cmd);
xfree(rgb_data);
test_peer_end_frame(client);
}
static void test_peer_load_icon(freerdp_peer* client)
@ -229,6 +258,8 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y)
if (context->icon_width < 1 || !context->activated)
return;
test_peer_begin_frame(client);
rect.x = 0;
rect.y = 0;
rect.width = context->icon_width;
@ -289,6 +320,8 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y)
context->icon_x = x;
context->icon_y = y;
test_peer_end_frame(client);
}
static boolean test_sleep_tsdiff(uint32 *old_sec, uint32 *old_usec, uint32 new_sec, uint32 new_usec)