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 VBOX
|
---|
37 | #undef DEBUG
|
---|
38 | #endif
|
---|
39 | #ifdef WITH_DEBUG
|
---|
40 | #define DEBUG(args) printf args;
|
---|
41 | #else
|
---|
42 | #define DEBUG(args)
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | #ifdef WITH_DEBUG_KBD
|
---|
46 | #define DEBUG_KBD(args) printf args;
|
---|
47 | #else
|
---|
48 | #define DEBUG_KBD(args)
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | #ifdef WITH_DEBUG_RDP5
|
---|
52 | #define DEBUG_RDP5(args) printf args;
|
---|
53 | #else
|
---|
54 | #define DEBUG_RDP5(args)
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | #ifdef WITH_DEBUG_CLIPBOARD
|
---|
58 | #define DEBUG_CLIPBOARD(args) printf args;
|
---|
59 | #else
|
---|
60 | #define DEBUG_CLIPBOARD(args)
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | #ifdef WITH_DEBUG_CHANNEL
|
---|
64 | #define DEBUG_CHANNEL(args) printf args;
|
---|
65 | #else
|
---|
66 | #define DEBUG_CHANNEL(args)
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | #define STRNCPY(dst,src,n) { strncpy(dst,src,n-1); dst[n-1] = 0; }
|
---|
70 |
|
---|
71 | #ifndef MIN
|
---|
72 | #define MIN(x,y) (((x) < (y)) ? (x) : (y))
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | #ifndef MAX
|
---|
76 | #define MAX(x,y) (((x) > (y)) ? (x) : (y))
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | /* timeval macros */
|
---|
80 | #ifndef timerisset
|
---|
81 | #define timerisset(tvp)\
|
---|
82 | ((tvp)->tv_sec || (tvp)->tv_usec)
|
---|
83 | #endif
|
---|
84 | #ifndef timercmp
|
---|
85 | #define timercmp(tvp, uvp, cmp)\
|
---|
86 | ((tvp)->tv_sec cmp (uvp)->tv_sec ||\
|
---|
87 | (tvp)->tv_sec == (uvp)->tv_sec &&\
|
---|
88 | (tvp)->tv_usec cmp (uvp)->tv_usec)
|
---|
89 | #endif
|
---|
90 | #ifndef timerclear
|
---|
91 | #define timerclear(tvp)\
|
---|
92 | ((tvp)->tv_sec = (tvp)->tv_usec = 0)
|
---|
93 | #endif
|
---|
94 |
|
---|
95 | /* If configure does not define the endianess, try
|
---|
96 | to find it out */
|
---|
97 | #if !defined(L_ENDIAN) && !defined(B_ENDIAN)
|
---|
98 | #if __BYTE_ORDER == __LITTLE_ENDIAN
|
---|
99 | #define L_ENDIAN
|
---|
100 | #elif __BYTE_ORDER == __BIG_ENDIAN
|
---|
101 | #define B_ENDIAN
|
---|
102 | #else
|
---|
103 | #error Unknown endianness. Edit rdesktop.h.
|
---|
104 | #endif
|
---|
105 | #endif /* B_ENDIAN, L_ENDIAN from configure */
|
---|
106 |
|
---|
107 | /* No need for alignment on x86 and amd64 */
|
---|
108 | #if !defined(NEED_ALIGN)
|
---|
109 | #if !(defined(__x86__) || defined(__x86_64__) || \
|
---|
110 | defined(__AMD64__) || defined(_M_IX86) || \
|
---|
111 | defined(__i386__))
|
---|
112 | #define NEED_ALIGN
|
---|
113 | #endif
|
---|
114 | #endif
|
---|
115 |
|
---|
116 | #include "parse.h"
|
---|
117 | #include "constants.h"
|
---|
118 | #include "types.h"
|
---|
119 |
|
---|
120 | #ifndef MAKE_PROTO
|
---|
121 | #include "proto.h"
|
---|
122 | #endif
|
---|