ReactOS 0.4.15-dev-8419-g7f0e8a3
rdesktop.h
Go to the documentation of this file.
1/*
2 rdesktop: A Remote Desktop Protocol client.
3 Master include file
4 Copyright (C) Matthew Chapman 1999-2005
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/
20
21#ifndef WIN32_LEAN_AND_MEAN
22#define WIN32_LEAN_AND_MEAN
23#endif
24
25#include <windows.h>
26#include <winsock2.h>
27#include <cchannel.h>
28
29#if 0
30#include <stdlib.h>
31#include <stdio.h>
32#include <string.h>
33#include <dirent.h>
34#include <sys/time.h>
35#ifdef HAVE_SYS_SELECT_H
36#include <sys/select.h>
37#else
38#include <sys/types.h>
39#include <unistd.h>
40#endif
41#include <limits.h> /* PATH_MAX */
42
43/* FIXME FIXME */
44#include <windows.h>
45#include <X11/Xlib.h>
46#include <X11/Xatom.h>
47/* FIXME FIXME */
48#endif
49
50// TODO
51#include <openssl/rc4.h>
52#include <openssl/md5.h>
53#include <openssl/sha.h>
54#include <openssl/bn.h>
55#include <openssl/x509v3.h>
56
57#define VERSION "1.4.1"
58
59#ifdef WITH_DEBUG
60#define DEBUG(args) printf args;
61#else
62#define DEBUG(args)
63#endif
64
65#ifdef WITH_DEBUG_KBD
66#define DEBUG_KBD(args) printf args;
67#else
68#define DEBUG_KBD(args)
69#endif
70
71#ifdef WITH_DEBUG_RDP5
72#define DEBUG_RDP5(args) printf args;
73#else
74#define DEBUG_RDP5(args)
75#endif
76
77#ifdef WITH_DEBUG_CLIPBOARD
78#define DEBUG_CLIPBOARD(args) printf args;
79#else
80#define DEBUG_CLIPBOARD(args)
81#endif
82
83#ifdef WITH_DEBUG_CHANNEL
84#define DEBUG_CHANNEL(args) printf args;
85#else
86#define DEBUG_CHANNEL(args)
87#endif
88
89#define STRNCPY(dst,src,n) { strncpy(dst,src,n-1); dst[n-1] = 0; }
90
91#ifndef MIN
92#define MIN(x,y) (((x) < (y)) ? (x) : (y))
93#endif
94
95#ifndef MAX
96#define MAX(x,y) (((x) > (y)) ? (x) : (y))
97#endif
98
99/* timeval macros */
100#ifndef timerisset
101#define timerisset(tvp)\
102 ((tvp)->tv_sec || (tvp)->tv_usec)
103#endif
104#ifndef timercmp
105#define timercmp(tvp, uvp, cmp)\
106 ((tvp)->tv_sec cmp (uvp)->tv_sec ||\
107 (tvp)->tv_sec == (uvp)->tv_sec &&\
108 (tvp)->tv_usec cmp (uvp)->tv_usec)
109#endif
110#ifndef timerclear
111#define timerclear(tvp)\
112 ((tvp)->tv_sec = (tvp)->tv_usec = 0)
113#endif
114
115/* If configure does not define the endianess, try
116 to find it out */
117#if !defined(L_ENDIAN) && !defined(B_ENDIAN)
118#if __BYTE_ORDER == __LITTLE_ENDIAN
119#define L_ENDIAN
120#elif __BYTE_ORDER == __BIG_ENDIAN
121#define B_ENDIAN
122#else
123#error Unknown endianness. Edit rdesktop.h.
124#endif
125#endif /* B_ENDIAN, L_ENDIAN from configure */
126
127/* No need for alignment on x86 and amd64 */
128#if !defined(NEED_ALIGN)
129#if !(defined(__x86__) || defined(__x86_64__) || \
130 defined(__AMD64__) || defined(_M_IX86) || \
131 defined(__i386__))
132#define NEED_ALIGN
133#endif
134#endif
135
136struct rdpclient;
137typedef struct rdpclient RDPCLIENT;
138
139#include "parse.h"
140#include "constants.h"
141#include "types.h"
142#include "orders.h"
143
144#if 0
145/* Used to store incoming io request, until they are ready to be completed */
146/* using a linked list ensures that they are processed in the right order, */
147/* if multiple ios are being done on the same fd */
148struct async_iorequest
149{
150 uint32 fd, major, minor, offset, device, id, length, partial_len;
151 long timeout, /* Total timeout */
152 itv_timeout; /* Interval timeout (between serial characters) */
153 uint8 *buffer;
154 DEVICE_FNS *fns;
155
156 struct async_iorequest *next; /* next element in list */
157};
158#endif
159
160struct bmpcache_entry
161{
164 sint16 next;
165};
166
167/* holds the whole state of the RDP client */
169{
170 /* channels.c */
171 CHANNEL_DEF channel_defs[CHANNEL_MAX_COUNT];
172 unsigned int num_channels;
173
174 /* licence.c */
178
179 /* mcs.c */
181
182 /* mppc.c */
184
185 /* pstcache.c */
189
190 /* rdesktop.c */
192 unsigned int keylayout;
196
197 int width;
206 BOOL desktop_save; /* desktop save order */
207 BOOL polygon_ellipse_orders; /* polygon / ellipse orders */
211
212 /* Session Directory redirection */
220
221 /* rdp.c */
224
225 /* secure.c */
227
228 /* tcp.c */
230
231 /* cache.c */
232 struct cache_
233 {
234 struct bmpcache_entry bmpcache[3][0xa00];
236
240
243 uint8 deskcache[0x38400 * 4];
245 }
247
248 /* licence.c */
249 struct licence_
250 {
253 }
255
256 /* orders.c */
257 struct orders_
258 {
260 }
262
263 /* rdp.c */
264 struct rdp_
265 {
267
268#if WITH_DEBUG
269 uint32 packetno;
270#endif
271
272#ifdef HAVE_ICONV
273 BOOL iconv_works;
274#endif
275 }
277
278 /* secure.c */
279 struct secure_
280 {
286
293
294 /* These values must be available to reset state - Session Directory */
297 }
299
300 /* tcp.c */
301 struct tcp_
302 {
304 struct stream in;
305 struct stream out;
307 }
309};
310
311#ifndef MAKE_PROTO
312#include "proto.h"
313#endif
#define SEC_MAX_MODULUS_SIZE
Definition: constants.h:93
unsigned short uint16
Definition: types.h:30
unsigned int uint32
Definition: types.h:32
signed short sint16
Definition: types.h:31
unsigned char uint8
Definition: types.h:28
static const WCHAR RSA[]
Definition: oid.c:1223
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint buffer
Definition: glext.h:5915
GLuint in
Definition: glext.h:9616
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint id
Definition: glext.h:5910
GLintptr offset
Definition: glext.h:5920
static HBITMAP
Definition: button.c:44
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
static unsigned __int64 next
Definition: rand_nt.c:6
static int fd
Definition: io.c:51
Definition: cache.c:42
sint16 next
Definition: cache.c:45
HBITMAP bitmap
Definition: rdesktop.h:162
sint16 previous
Definition: cache.c:44
Definition: devices.h:37
Definition: copy.c:22
HCURSOR cursorcache[0x20]
Definition: rdesktop.h:244
HBITMAP volatile_bc[3]
Definition: rdesktop.h:235
FONTGLYPH fontcache[12][256]
Definition: rdesktop.h:241
int bmpcache_lru[3]
Definition: rdesktop.h:237
int bmpcache_mru[3]
Definition: rdesktop.h:238
struct bmpcache_entry bmpcache[3][0xa00]
Definition: rdesktop.h:234
DATABLOB textcache[256]
Definition: rdesktop.h:242
uint8 deskcache[0x38400 *4]
Definition: rdesktop.h:243
int bmpcache_count[3]
Definition: rdesktop.h:239
uint8 sign_key[16]
Definition: rdesktop.h:252
RDP_ORDER_STATE order_state
Definition: rdesktop.h:259
int current_status
Definition: rdesktop.h:266
uint32 server_public_key_len
Definition: rdesktop.h:285
RSA * server_public_key
Definition: rdesktop.h:284
uint8 decrypt_update_key[16]
Definition: rdesktop.h:290
uint8 sign_key[16]
Definition: rdesktop.h:287
uint8 decrypt_key[16]
Definition: rdesktop.h:288
uint8 crypted_random[SEC_MAX_MODULUS_SIZE]
Definition: rdesktop.h:292
uint8 encrypt_key[16]
Definition: rdesktop.h:289
RC4_KEY rc4_decrypt_key
Definition: rdesktop.h:282
uint8 encrypt_update_key[16]
Definition: rdesktop.h:291
RC4_KEY rc4_encrypt_key
Definition: rdesktop.h:283
struct stream out
Definition: rdesktop.h:305
long connection_timeout
Definition: rdesktop.h:306
BOOL use_rdp5
Definition: rdesktop.h:208
int tcp_port_rdp
Definition: rdesktop.h:229
wchar_t * redirect_domain
Definition: rdesktop.h:215
int pstcache_fd[8]
Definition: rdesktop.h:186
int keyboard_subtype
Definition: rdesktop.h:194
BOOL bitmap_cache
Definition: rdesktop.h:201
int keyboard_type
Definition: rdesktop.h:193
struct rdpclient::orders_ orders
unsigned int num_channels
Definition: rdesktop.h:172
BOOL bitmap_cache_persist_enable
Definition: rdesktop.h:202
CHANNEL_DEF channel_defs[CHANNEL_MAX_COUNT]
Definition: rdesktop.h:171
uint16 mcs_userid
Definition: rdesktop.h:180
BOOL licence_issued
Definition: rdesktop.h:177
struct rdpclient::rdp_ rdp
int width
Definition: rdesktop.h:197
BOOL redirect
Definition: rdesktop.h:213
unsigned int keylayout
Definition: rdesktop.h:192
wchar_t * redirect_password
Definition: rdesktop.h:216
char * redirect_cookie
Definition: rdesktop.h:218
int keyboard_functionkeys
Definition: rdesktop.h:195
struct rdpclient::tcp_ tcp
int server_depth
Definition: rdesktop.h:199
uint16 server_rdp_version
Definition: rdesktop.h:226
BOOL bitmap_cache_precache
Definition: rdesktop.h:203
struct rdpclient::licence_ licence
RDPCOMP mppc_dict
Definition: rdesktop.h:183
wchar_t * redirect_username
Definition: rdesktop.h:217
char * licence_username
Definition: rdesktop.h:175
BOOL encryption
Definition: rdesktop.h:204
BOOL pstcache_enumerated
Definition: rdesktop.h:188
BOOL packet_encryption
Definition: rdesktop.h:205
struct rdpclient::secure_ secure
wchar_t * redirect_server
Definition: rdesktop.h:214
struct rdpclient::cache_ cache
uint32 redirect_flags
Definition: rdesktop.h:219
int pstcache_Bpp
Definition: rdesktop.h:187
char licence_hostname[MAX_COMPUTERNAME_LENGTH+1]
Definition: rdesktop.h:176
BOOL desktop_save
Definition: rdesktop.h:206
BOOL bitmap_compression
Definition: rdesktop.h:200
int disconnect_reason
Definition: rdesktop.h:191
uint32 rdp5_performanceflags
Definition: rdesktop.h:210
BOOL polygon_ellipse_orders
Definition: rdesktop.h:207
uint32 rdp_shareid
Definition: rdesktop.h:223
uint8 * next_packet
Definition: rdesktop.h:222
int height
Definition: rdesktop.h:198
BOOL console_session
Definition: rdesktop.h:209
Definition: parse.h:23
Definition: dhcpd.h:245
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:243
HICON HCURSOR
Definition: windef.h:299
UINT_PTR SOCKET
Definition: winsock.h:47