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 |
17 |
along with this program; if not, write to the Free Software |
18 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
*/ |
20 |
|
21 |
#include <stdlib.h> |
22 |
#include <stdio.h> |
23 |
#include <string.h> |
24 |
#include <dirent.h> |
25 |
#include <sys/time.h> |
26 |
#ifdef HAVE_SYS_SELECT_H |
27 |
#include <sys/select.h> |
28 |
#else |
29 |
#include <sys/types.h> |
30 |
#include <unistd.h> |
31 |
#endif |
32 |
#include <limits.h> /* PATH_MAX */ |
33 |
|
34 |
#define VERSION "1.5.0" |
35 |
|
36 |
#ifdef WITH_DEBUG |
37 |
#define DEBUG(args) printf args; |
38 |
#else |
39 |
#define DEBUG(args) |
40 |
#endif |
41 |
|
42 |
#ifdef WITH_DEBUG_KBD |
43 |
#define DEBUG_KBD(args) printf args; |
44 |
#else |
45 |
#define DEBUG_KBD(args) |
46 |
#endif |
47 |
|
48 |
#ifdef WITH_DEBUG_RDP5 |
49 |
#define DEBUG_RDP5(args) printf args; |
50 |
#else |
51 |
#define DEBUG_RDP5(args) |
52 |
#endif |
53 |
|
54 |
#ifdef WITH_DEBUG_CLIPBOARD |
55 |
#define DEBUG_CLIPBOARD(args) printf args; |
56 |
#else |
57 |
#define DEBUG_CLIPBOARD(args) |
58 |
#endif |
59 |
|
60 |
#ifdef WITH_DEBUG_CHANNEL |
61 |
#define DEBUG_CHANNEL(args) printf args; |
62 |
#else |
63 |
#define DEBUG_CHANNEL(args) |
64 |
#endif |
65 |
|
66 |
#ifdef WITH_DEBUG_SCARD |
67 |
#define DEBUG_SCARD(args) printf args; |
68 |
#else |
69 |
#define DEBUG_SCARD(args) |
70 |
#endif |
71 |
|
72 |
#define STRNCPY(dst,src,n) { strncpy(dst,src,n-1); dst[n-1] = 0; } |
73 |
|
74 |
#ifndef MIN |
75 |
#define MIN(x,y) (((x) < (y)) ? (x) : (y)) |
76 |
#endif |
77 |
|
78 |
#ifndef MAX |
79 |
#define MAX(x,y) (((x) > (y)) ? (x) : (y)) |
80 |
#endif |
81 |
|
82 |
/* timeval macros */ |
83 |
#ifndef timerisset |
84 |
#define timerisset(tvp)\ |
85 |
((tvp)->tv_sec || (tvp)->tv_usec) |
86 |
#endif |
87 |
#ifndef timercmp |
88 |
#define timercmp(tvp, uvp, cmp)\ |
89 |
((tvp)->tv_sec cmp (uvp)->tv_sec ||\ |
90 |
(tvp)->tv_sec == (uvp)->tv_sec &&\ |
91 |
(tvp)->tv_usec cmp (uvp)->tv_usec) |
92 |
#endif |
93 |
#ifndef timerclear |
94 |
#define timerclear(tvp)\ |
95 |
((tvp)->tv_sec = (tvp)->tv_usec = 0) |
96 |
#endif |
97 |
|
98 |
/* If configure does not define the endianess, try |
99 |
to find it out */ |
100 |
#if !defined(L_ENDIAN) && !defined(B_ENDIAN) |
101 |
#if __BYTE_ORDER == __LITTLE_ENDIAN |
102 |
#define L_ENDIAN |
103 |
#elif __BYTE_ORDER == __BIG_ENDIAN |
104 |
#define B_ENDIAN |
105 |
#else |
106 |
#error Unknown endianness. Edit rdesktop.h. |
107 |
#endif |
108 |
#endif /* B_ENDIAN, L_ENDIAN from configure */ |
109 |
|
110 |
/* No need for alignment on x86 and amd64 */ |
111 |
#if !defined(NEED_ALIGN) |
112 |
#if !(defined(__x86__) || defined(__x86_64__) || \ |
113 |
defined(__AMD64__) || defined(_M_IX86) || \ |
114 |
defined(__i386__)) |
115 |
#define NEED_ALIGN |
116 |
#endif |
117 |
#endif |
118 |
|
119 |
#include "parse.h" |
120 |
#include "constants.h" |
121 |
#include "types.h" |
122 |
|
123 |
#ifndef MAKE_PROTO |
124 |
#include "proto.h" |
125 |
#endif |