summaryrefslogtreecommitdiff
path: root/src/rdp/rdp_impl.h
blob: 0e561ed0482fa7b8d053e8d772e386ea0b951934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* BSD-2-Clause license
 * 
 * Copyright (c) 2018-2023 NST <www.newinfosec.ru>, sss <sss at dark-alexandr dot net>. 
 * 
 */

#pragma once

#include <ev.h>

#include <freerdp/freerdp.h>
#include <winpr/clipboard.h>
#include <freerdp/client/cliprdr.h>

#define CLRCONV_ALPHA 1
#define CLRCONV_INVERT 2
/* if defined RGB555 format is used when rendering with a 16-bit frame buffer
 */
#define CLRCONV_RGB555 4
/* Supported Internal Buffer Formats */
#define CLRBUF_16BPP 8
#define CLRBUF_32BPP 32

struct _CLRCONV
{
	int alpha;
	int invert;
	int rgb555;
	rdpPalette *palette;
};
typedef struct _CLRCONV CLRCONV;
typedef CLRCONV *HCLRCONV;

/* #define TAG CLIENT_TAG ("RDP")*/

typedef struct
{
	/* TODO: make variables list instead of static set */
	backend_setting_str host, pcb, user, password,
	    /* new settings from freerdp header:*/
	    Domain, PasswordHash, AcceptedCert, ClientHostname, ClientProductId,
	    AlternateShell, ShellWorkingDirectory, ClientAddress, ClientDir,
	    DynamicDSTTimeZoneKeyName, RemoteAssistanceSessionId,
	    RemoteAssistancePassStub, RemoteAssistancePassword,
	    RemoteAssistanceRCTicket, AuthenticationServiceClass,
	    AllowedTlsCiphers, NtlmSamFile, PreconnectionBlob,
	    RedirectionAcceptedCert, KerberosKdc, KerberosRealm,
	    CertificateName, CertificateFile, PrivateKeyFile,
	    CertificateContent, PrivateKeyContent, WindowTitle, WmClass,
	    ComputerName, ConnectionFile, AssistanceFile, HomePath, ConfigPath,
	    CurrentPath, DumpRemoteFxFile, PlayRemoteFxFile, GatewayHostname,
	    GatewayUsername, GatewayPassword, GatewayDomain, GatewayAccessToken,
	    GatewayAcceptedCert, ProxyHostname, RemoteApplicationName,
	    RemoteApplicationIcon, RemoteApplicationProgram,
	    RemoteApplicationFile, RemoteApplicationGuid,
	    RemoteApplicationCmdLine, ImeFileName, DrivesToRedirect,
	    ActionScript;
	backend_setting_int port, perf, fntlm, nowallp, nowdrag, nomani,
	    notheme, nonla, notls, width, height,
	    /* new settings from freerdp header:*/
	    ServerMode, WaitForOutputBufferFlush, MaxTimeInCheckLoop,
	    DesktopWidth, DesktopHeight, Workarea, Fullscreen, GrabKeyboard,
	    Decorations, RdpVersion, ColorDepth, ExtSecurity, NlaSecurity,
	    TlsSecurity, RdpSecurity, NegotiateSecurityLayer,
	    RestrictedAdminModeRequired, MstscCookieMode, CookieMaxLength,
	    ClientBuild, KeyboardType, KeyboardSubType, KeyboardFunctionKey,
	    KeyboardLayout, UseRdpSecurityLayer, SaltedChecksum, ServerPort,
	    GatewayPort, DesktopResize, ToggleFullscreen, Floatbar, DesktopPosX,
	    DesktopPosY, SoftwareGdi, UnmapButtons, PerformanceFlags,
	    AllowFontSmoothing, AllowDesktopComposition, DisableWallpaper,
	    DisableFullWindowDrag, DisableMenuAnims, DisableThemes,
	    ConnectionType, EncryptionMethods, EncryptionLevel, FIPSMode,
	    CompressionEnabled, LogonNotify, BrushSupportLevel,
	    RemoteApplicationMode, TcpAckTimeout;
} my_rdp_settings;

typedef struct
{
	rdpPointer pointer;
	uint32_t id;
} my_rdp_pointer;

struct rdp_internals_s;
typedef struct rdp_internals_s rdp_internals;

struct my_rdp_clipboard_s;
typedef struct my_rdp_clipboard_s my_rdp_clipboard;

struct my_rdp_ft_s;
typedef struct my_rdp_ft_s my_rdp_ft;

typedef struct
{
	rdpContext context;
	my_rdp_clipboard *clipboard;
	my_rdp_ft *ft_to_client, *ft_to_server;
	rdp_internals *my_internals;
} my_rdp_context;

struct rdp_internals_s
{
	freerdp *instance;
	my_rdp_context *context;

	rdpSettings *settings;

	void *task_info;
	wrdp_core_exports *core;
	wrdp_backend_module *backend;

	my_rdp_settings my_settings;
	rdp_connection_state conn_state;

	/* libev watchers */
	/* TODO: dynamic allocation */
	ev_io rdp_fd[32];
	int rdp_fd_count;

	HCLRCONV clrconv;
	uint32_t m_ptrId;
};

bool rdp_init_internals(void *internals);

bool rdp_connect(void *internals);

bool rdp_init_settings(void *internals);