24 #include <freerdp/utils/string.h>
25 #include <freerdp/settings.h>
27 const char* rdp_redirection_flags_to_string(UINT32 flags,
char* buffer,
size_t size)
34 const struct map_t map[] = {
35 { LB_TARGET_NET_ADDRESS,
"LB_TARGET_NET_ADDRESS" },
36 { LB_LOAD_BALANCE_INFO,
"LB_LOAD_BALANCE_INFO" },
37 { LB_USERNAME,
"LB_USERNAME" },
38 { LB_DOMAIN,
"LB_DOMAIN" },
39 { LB_PASSWORD,
"LB_PASSWORD" },
40 { LB_DONTSTOREUSERNAME,
"LB_DONTSTOREUSERNAME" },
41 { LB_SMARTCARD_LOGON,
"LB_SMARTCARD_LOGON" },
42 { LB_NOREDIRECT,
"LB_NOREDIRECT" },
43 { LB_TARGET_FQDN,
"LB_TARGET_FQDN" },
44 { LB_TARGET_NETBIOS_NAME,
"LB_TARGET_NETBIOS_NAME" },
45 { LB_TARGET_NET_ADDRESSES,
"LB_TARGET_NET_ADDRESSES" },
46 { LB_CLIENT_TSV_URL,
"LB_CLIENT_TSV_URL" },
47 { LB_SERVER_TSV_CAPABLE,
"LB_SERVER_TSV_CAPABLE" },
48 { LB_PASSWORD_IS_PK_ENCRYPTED,
"LB_PASSWORD_IS_PK_ENCRYPTED" },
49 { LB_REDIRECTION_GUID,
"LB_REDIRECTION_GUID" },
50 { LB_TARGET_CERTIFICATE,
"LB_TARGET_CERTIFICATE" },
53 for (
size_t x = 0; x < ARRAYSIZE(map); x++)
55 const struct map_t* cur = &map[x];
56 if (flags & cur->flag)
58 if (!winpr_str_append(cur->name, buffer, size,
"|"))
65 const char* rdp_cluster_info_flags_to_string(UINT32 flags,
char* buffer,
size_t size)
67 const UINT32 version = (flags & ServerSessionRedirectionVersionMask) >> 2;
68 if (flags & REDIRECTION_SUPPORTED)
69 winpr_str_append(
"REDIRECTION_SUPPORTED", buffer, size,
"|");
70 if (flags & REDIRECTED_SESSIONID_FIELD_VALID)
71 winpr_str_append(
"REDIRECTED_SESSIONID_FIELD_VALID", buffer, size,
"|");
72 if (flags & REDIRECTED_SMARTCARD)
73 winpr_str_append(
"REDIRECTED_SMARTCARD", buffer, size,
"|");
75 const char* str = NULL;
78 case REDIRECTION_VERSION1:
79 str =
"REDIRECTION_VERSION1";
81 case REDIRECTION_VERSION2:
82 str =
"REDIRECTION_VERSION2";
84 case REDIRECTION_VERSION3:
85 str =
"REDIRECTION_VERSION3";
87 case REDIRECTION_VERSION4:
88 str =
"REDIRECTION_VERSION4";
90 case REDIRECTION_VERSION5:
91 str =
"REDIRECTION_VERSION5";
93 case REDIRECTION_VERSION6:
94 str =
"REDIRECTION_VERSION6";
97 str =
"REDIRECTION_VERSION_UNKNOWN";
100 winpr_str_append(str, buffer, size,
"|");
102 char msg[32] = { 0 };
103 (void)_snprintf(msg,
sizeof(msg),
"[0x%08" PRIx32
"]", flags);
104 winpr_str_append(msg, buffer, size,
"");
109 BOOL freerdp_extract_key_value(
const char* str, UINT32* pkey, UINT32* pvalue)
111 if (!str || !pkey || !pvalue)
116 unsigned long key = strtoul(str, &end1, 0);
117 if ((errno != 0) || !end1 || (*end1 !=
'=') || (key > UINT32_MAX))
121 unsigned long val = strtoul(&end1[1], NULL, 0);
122 if ((errno != 0) || (val > UINT32_MAX))
126 *pvalue = (UINT32)val;