Added play-rfx command line option.

PCAP dumps can now be played with /play-rfx:path_to_file again.
This commit is contained in:
Bernhard Miklautz 2013-05-27 15:28:08 +02:00
parent 9dbc240f68
commit ce17a827c4
2 changed files with 15 additions and 6 deletions

View File

@ -134,6 +134,7 @@ COMMAND_LINE_ARGUMENT_A args[] =
{ "wm-class", COMMAND_LINE_VALUE_REQUIRED, "<class name>", NULL, NULL, -1, NULL, "set the WM_CLASS hint for the window instance" }, { "wm-class", COMMAND_LINE_VALUE_REQUIRED, "<class name>", NULL, NULL, -1, NULL, "set the WM_CLASS hint for the window instance" },
{ "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1, NULL, "print version" }, { "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1, NULL, "print version" },
{ "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", "print help" }, { "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", "print help" },
{ "play-rfx", COMMAND_LINE_VALUE_REQUIRED, "<pcap file>", NULL, NULL, -1, NULL, "Replay rfx pcap file" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL } { NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
}; };
@ -1596,6 +1597,11 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
{ {
settings->WmClass = _strdup(arg->Value); settings->WmClass = _strdup(arg->Value);
} }
CommandLineSwitchCase(arg, "play-rfx")
{
settings->PlayRemoteFxFile = _strdup(arg->Value);
settings->PlayRemoteFx = TRUE;
}
CommandLineSwitchDefault(arg) CommandLineSwitchDefault(arg)
{ {

View File

@ -127,28 +127,31 @@ BOOL freerdp_connect(freerdp* instance)
update = instance->update; update = instance->update;
s = StreamPool_Take(rdp->transport->ReceivePool, 0); s = StreamPool_Take(rdp->transport->ReceivePool, 0);
instance->update->pcap_rfx = pcap_open(settings->PlayRemoteFxFile, FALSE); update->pcap_rfx = pcap_open(settings->PlayRemoteFxFile, FALSE);
if (update->pcap_rfx) if (!update->pcap_rfx)
return FALSE;
else
update->play_rfx = TRUE; update->play_rfx = TRUE;
while (update->play_rfx && pcap_has_next_record(update->pcap_rfx)) while (pcap_has_next_record(update->pcap_rfx))
{ {
pcap_get_next_record_header(update->pcap_rfx, &record); pcap_get_next_record_header(update->pcap_rfx, &record);
Stream_EnsureCapacity(s, record.length); Stream_EnsureCapacity(s, record.length);
record.data = Stream_Buffer(s); record.data = Stream_Buffer(s);
pcap_get_next_record_content(update->pcap_rfx, &record); pcap_get_next_record_content(update->pcap_rfx, &record);
Stream_SetLength(s,record.length);
Stream_SetPosition(s, 0); Stream_SetPosition(s, 0);
update->BeginPaint(update->context); update->BeginPaint(update->context);
update_recv_surfcmds(update, Stream_Capacity(s), s); update_recv_surfcmds(update, Stream_Length(s) , s);
update->EndPaint(update->context); update->EndPaint(update->context);
} }
Stream_Release(s); Stream_Release(s);
return TRUE; return TRUE;
} }
} }