ReactOS 0.4.15-dev-7659-ga55345b
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-2008
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 3 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
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <stdlib.h>
23#include <stdio.h>
24#include <string.h>
25#ifdef _WIN32
26#include <winsock2.h> /* winsock2.h first */
27#include <mmsystem.h>
28#include <time.h>
29#define DIR int
30#else /* WIN32 */
31#include <dirent.h>
32#include <sys/time.h>
33#ifdef HAVE_SYS_SELECT_H
34#include <sys/select.h>
35#else /* HAVE_SYS_SELECT_H */
36#include <sys/types.h>
37#include <unistd.h>
38#endif /* HAVE_SYS_SELECT_H */
39#endif /* WIN32 */
40//#include <limits.h> /* PATH_MAX */
41#ifdef HAVE_SYSEXITS_H
42#include <sysexits.h>
43#endif
44
45#define VERSION "1.8.3"
46
47/* standard exit codes */
48#ifndef EX_OK
49#define EX_OK 0
50#endif
51#ifndef EX_USAGE
52#define EX_USAGE 64
53#endif
54#ifndef EX_DATAERR
55#define EX_DATAERR 65
56#endif
57#ifndef EX_NOINPUT
58#define EX_NOINPUT 66
59#endif
60#ifndef EX_NOUSER
61#define EX_NOUSER 67
62#endif
63#ifndef EX_NOHOST
64#define EX_NOHOST 68
65#endif
66#ifndef EX_UNAVAILABLE
67#define EX_UNAVAILABLE 69
68#endif
69#ifndef EX_SOFTWARE
70#define EX_SOFTWARE 70
71#endif
72#ifndef EX_OSERR
73#define EX_OSERR 71
74#endif
75#ifndef EX_OSFILE
76#define EX_OSFILE 72
77#endif
78#ifndef EX_CANTCREAT
79#define EX_CANTCREAT 73
80#endif
81#ifndef EX_IOERR
82#define EX_IOERR 74
83#endif
84#ifndef EX_TEMPFAIL
85#define EX_TEMPFAIL 75
86#endif
87#ifndef EX_PROTOCOL
88#define EX_PROTOCOL 76
89#endif
90#ifndef EX_NOPERM
91#define EX_NOPERM 77
92#endif
93#ifndef EX_CONFIG
94#define EX_CONFIG 78
95#endif
96
97/* rdesktop specific exit codes, lined up with disconnect PDU reasons */
98#define EXRD_API_DISCONNECT 1
99#define EXRD_API_LOGOFF 2
100#define EXRD_IDLE_TIMEOUT 3
101#define EXRD_LOGON_TIMEOUT 4
102#define EXRD_REPLACED 5
103#define EXRD_OUT_OF_MEM 6
104#define EXRD_DENIED 7
105#define EXRD_DENIED_FIPS 8
106#define EXRD_INSUFFICIENT_PRIVILEGES 9
107#define EXRD_FRESH_CREDENTIALS_REQUIRED 10
108#define EXRD_RPC_DISCONNECT_BY_USER 11
109#define EXRD_DISCONNECT_BY_USER 12
110#define EXRD_LIC_INTERNAL 16
111#define EXRD_LIC_NOSERVER 17
112#define EXRD_LIC_NOLICENSE 18
113#define EXRD_LIC_MSG 19
114#define EXRD_LIC_HWID 20
115#define EXRD_LIC_CLIENT 21
116#define EXRD_LIC_NET 22
117#define EXRD_LIC_PROTO 23
118#define EXRD_LIC_ENC 24
119#define EXRD_LIC_UPGRADE 25
120#define EXRD_LIC_NOREMOTE 26
121
122/* other exit codes */
123#define EXRD_WINDOW_CLOSED 62
124#define EXRD_UNKNOWN 63
125
126#ifdef WITH_DEBUG
127#define DEBUG(args) printf args;
128#else
129#define DEBUG(args)
130#endif
131
132#ifdef WITH_DEBUG_KBD
133#define DEBUG_KBD(args) printf args;
134#else
135#define DEBUG_KBD(args)
136#endif
137
138#ifdef WITH_DEBUG_RDP5
139#define DEBUG_RDP5(args) printf args;
140#else
141#define DEBUG_RDP5(args)
142#endif
143
144#ifdef WITH_DEBUG_CLIPBOARD
145#define DEBUG_CLIPBOARD(args) printf args;
146#else
147#define DEBUG_CLIPBOARD(args)
148#endif
149
150#ifdef WITH_DEBUG_SOUND
151#define DEBUG_SOUND(args) printf args;
152#else
153#define DEBUG_SOUND(args)
154#endif
155
156#ifdef WITH_DEBUG_CHANNEL
157#define DEBUG_CHANNEL(args) printf args;
158#else
159#define DEBUG_CHANNEL(args)
160#endif
161
162#ifdef WITH_DEBUG_SCARD
163#define DEBUG_SCARD(args) printf args;
164#else
165#define DEBUG_SCARD(args)
166#endif
167
168#define STRNCPY(dst,src,n) { strncpy(dst,src,n-1); dst[n-1] = 0; }
169
170#ifndef MIN
171#define MIN(x,y) (((x) < (y)) ? (x) : (y))
172#endif
173
174#ifndef MAX
175#define MAX(x,y) (((x) > (y)) ? (x) : (y))
176#endif
177
178/* timeval macros */
179#ifndef timerisset
180#define timerisset(tvp)\
181 ((tvp)->tv_sec || (tvp)->tv_usec)
182#endif
183#ifndef timercmp
184#define timercmp(tvp, uvp, cmp)\
185 ((tvp)->tv_sec cmp (uvp)->tv_sec ||\
186 (tvp)->tv_sec == (uvp)->tv_sec &&\
187 (tvp)->tv_usec cmp (uvp)->tv_usec)
188#endif
189#ifndef timerclear
190#define timerclear(tvp)\
191 ((tvp)->tv_sec = (tvp)->tv_usec = 0)
192#endif
193
194/* If configure does not define the endianness, try
195 to find it out */
196#if !defined(L_ENDIAN) && !defined(B_ENDIAN)
197#if __BYTE_ORDER == __LITTLE_ENDIAN
198#define L_ENDIAN
199#elif __BYTE_ORDER == __BIG_ENDIAN
200#define B_ENDIAN
201#else
202#error Unknown endianness. Edit rdesktop.h.
203#endif
204#endif /* B_ENDIAN, L_ENDIAN from configure */
205
206/* No need for alignment on x86 and amd64 */
207#if !defined(NEED_ALIGN)
208#if !(defined(__x86__) || defined(__x86_64__) || \
209 defined(__AMD64__) || defined(_M_IX86) || \
210 defined(__i386__))
211#define NEED_ALIGN
212#endif
213#endif
214
215#include "parse.h"
216#include "constants.h"
217#include "types.h"
218
219#ifndef MAKE_PROTO
220#include "proto.h"
221#endif