libfreerdp-core: add support for load balance info

This commit is contained in:
Marc-André Moreau 2013-04-11 11:51:10 -04:00
parent e7436a1a9d
commit d0e989a549
4 changed files with 20 additions and 3 deletions

View File

@ -63,6 +63,7 @@ COMMAND_LINE_ARGUMENT_A args[] =
{ "gu", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user> or <user>[@<domain>]", NULL, NULL, -1, NULL, "Gateway username" },
{ "gp", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Gateway password" },
{ "gd", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Gateway domain" },
{ "load-balance-info", COMMAND_LINE_VALUE_REQUIRED, "<info string>", NULL, NULL, -1, NULL, "Load balance info" },
{ "app", COMMAND_LINE_VALUE_REQUIRED, "||<alias> or <executable path>", NULL, NULL, -1, NULL, "Remote application program" },
{ "app-name", COMMAND_LINE_VALUE_REQUIRED, "<app name>", NULL, NULL, -1, NULL, "Remote application name for user interface" },
{ "app-icon", COMMAND_LINE_VALUE_REQUIRED, "<icon path>", NULL, NULL, -1, NULL, "Remote application icon for user interface" },
@ -1214,6 +1215,11 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
settings->DisableWallpaper = TRUE;
settings->DisableFullWindowDrag = TRUE;
}
CommandLineSwitchCase(arg, "load-balance-info")
{
settings->LoadBalanceInfo = (BYTE*) _strdup(arg->Value);
settings->LoadBalanceInfoLength = strlen((char*) settings->LoadBalanceInfo);
}
CommandLineSwitchCase(arg, "app-name")
{
settings->RemoteApplicationName = _strdup(arg->Value);

View File

@ -517,6 +517,12 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~((size_t) file->ShellWorkingDirectory))
settings->ShellWorkingDirectory = file->ShellWorkingDirectory;
if (~((size_t) file->LoadBalanceInfo))
{
settings->LoadBalanceInfo = (BYTE*) _strdup(file->LoadBalanceInfo);
settings->LoadBalanceInfoLength = strlen((char*) settings->LoadBalanceInfo);
}
if (~file->ConnectionType)
{
freerdp_set_connection_type(settings, file->ConnectionType);

View File

@ -135,6 +135,9 @@ BOOL rdp_client_connect(rdpRdp* rdp)
nego_set_cookie_max_length(rdp->nego, settings->CookieMaxLength);
if (settings->LoadBalanceInfo)
nego_set_routing_token(rdp->nego, settings->LoadBalanceInfo, settings->LoadBalanceInfoLength);
if (!nego_connect(rdp->nego))
{
fprintf(stderr, "Error: protocol security negotiation or connection failure\n");

View File

@ -648,12 +648,14 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
stream_get_mark(s, bm);
stream_seek(s, length);
if (nego->RoutingToken != NULL)
if (nego->RoutingToken)
{
stream_write(s, nego->RoutingToken, nego->RoutingTokenLength);
length += nego->RoutingTokenLength;
stream_write_BYTE(s, 0x0D); /* CR */
stream_write_BYTE(s, 0x0A); /* LF */
length += nego->RoutingTokenLength + 2;
}
else if (nego->cookie != NULL)
else if (nego->cookie)
{
cookie_length = strlen(nego->cookie);