19 #include <freerdp/config.h>
21 #include <winpr/crt.h>
22 #include <winpr/ssl.h>
23 #include <winpr/path.h>
24 #include <winpr/cmdline.h>
25 #include <winpr/winsock.h>
27 #include <winpr/tools/makecert.h>
29 #include <freerdp/server/shadow.h>
30 #include <freerdp/settings.h>
32 #include <freerdp/log.h>
33 #define TAG SERVER_TAG("shadow")
35 int main(
int argc,
char** argv)
40 {
"log-filters", COMMAND_LINE_VALUE_REQUIRED,
"<tag>:<level>[,<tag>:<level>[,...]]", NULL,
41 NULL, -1, NULL,
"Set logger filters, see wLog(7) for details" },
42 {
"log-level", COMMAND_LINE_VALUE_REQUIRED,
"[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]", NULL,
43 NULL, -1, NULL,
"Set the default log level, see wLog(7) for details" },
44 {
"port", COMMAND_LINE_VALUE_REQUIRED,
"<number>", NULL, NULL, -1, NULL,
"Server port" },
45 {
"ipc-socket", COMMAND_LINE_VALUE_REQUIRED,
"<ipc-socket>", NULL, NULL, -1, NULL,
46 "Server IPC socket" },
47 {
"bind-address", COMMAND_LINE_VALUE_REQUIRED,
"<bind-address>[,<another address>, ...]",
49 "An address to bind to. Use '[<ipv6>]' for IPv6 addresses, e.g. '[::1]' for "
51 {
"monitors", COMMAND_LINE_VALUE_OPTIONAL,
"<0,1,2...>", NULL, NULL, -1, NULL,
52 "Select or list monitors" },
53 {
"max-connections", COMMAND_LINE_VALUE_REQUIRED,
"<number>", 0, NULL, -1, NULL,
54 "maximum connections allowed to server, 0 to deactivate" },
55 {
"rect", COMMAND_LINE_VALUE_REQUIRED,
"<x,y,w,h>", NULL, NULL, -1, NULL,
56 "Select rectangle within monitor to share" },
57 {
"auth", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
58 "Clients must authenticate" },
59 {
"remote-guard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL,
60 "Remote credential guard" },
61 {
"may-view", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
62 "Clients may view without prompt" },
63 {
"may-interact", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
64 "Clients may interact without prompt" },
65 {
"sec", COMMAND_LINE_VALUE_REQUIRED,
"<rdp|tls|nla|ext>", NULL, NULL, -1, NULL,
66 "force specific protocol security" },
67 {
"sec-rdp", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
68 "rdp protocol security" },
69 {
"sec-tls", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
70 "tls protocol security" },
71 {
"sec-nla", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
72 "nla protocol security" },
73 {
"sec-ext", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL,
74 "nla extended protocol security" },
75 {
"sam-file", COMMAND_LINE_VALUE_REQUIRED,
"<file>", NULL, NULL, -1, NULL,
76 "NTLM SAM file for NLA authentication" },
77 {
"keytab", COMMAND_LINE_VALUE_REQUIRED,
"<file>", NULL, NULL, -1, NULL,
78 "Kerberos keytab file for NLA authentication" },
79 {
"ccache", COMMAND_LINE_VALUE_REQUIRED,
"<file>", NULL, NULL, -1, NULL,
80 "Kerberos host ccache file for NLA authentication" },
81 {
"tls-secrets-file", COMMAND_LINE_VALUE_REQUIRED,
"<file>", NULL, NULL, -1, NULL,
82 "file where tls secrets shall be stored" },
83 {
"nsc", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
"Allow NSC codec" },
84 {
"rfx", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
85 "Allow RFX surface bits" },
86 {
"gfx", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
87 "Allow GFX pipeline" },
88 {
"gfx-progressive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
89 "Allow GFX progressive codec" },
90 {
"gfx-rfx", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
91 "Allow GFX RFX codec" },
92 {
"gfx-planar", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
93 "Allow GFX planar codec" },
94 {
"gfx-avc420", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
95 "Allow GFX AVC420 codec" },
96 {
"gfx-avc444", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
97 "Allow GFX AVC444 codec" },
98 {
"version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1,
99 NULL,
"Print version" },
100 {
"buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG, NULL, NULL, NULL,
101 -1, NULL,
"Print the build configuration" },
102 {
"help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1,
"?",
104 { NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
107 shadow_subsystem_set_entry_builtin(NULL);
109 rdpShadowServer* server = shadow_server_new();
114 WLog_ERR(TAG,
"Server new failed");
118 rdpSettings* settings = server->settings;
119 WINPR_ASSERT(settings);
146 if ((status = shadow_server_parse_command_line(server, argc, argv, shadow_args)) < 0)
148 shadow_server_command_line_status_print(server, argc, argv, status, shadow_args);
152 if ((status = shadow_server_init(server)) < 0)
154 WLog_ERR(TAG,
"Server initialization failed.");
158 if ((status = shadow_server_start(server)) < 0)
160 WLog_ERR(TAG,
"Failed to start server.");
167 while (GetMessage(&msg, 0, 0, 0))
169 TranslateMessage(&msg);
170 DispatchMessage(&msg);
175 (void)WaitForSingleObject(server->thread, INFINITE);
177 if (!GetExitCodeThread(server->thread, &dwExitCode))
180 status = (int)dwExitCode;
183 shadow_server_uninit(server);
184 shadow_server_free(server);
FREERDP_API BOOL freerdp_settings_set_uint32(rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id, UINT32 param)
Sets a UINT32 settings value.
FREERDP_API BOOL freerdp_settings_set_bool(rdpSettings *settings, FreeRDP_Settings_Keys_Bool id, BOOL param)
Sets a BOOL settings value.