]> git.sesse.net Git - rdpsrv/blob - Xserver/include/Xos.h
Support RDP5 logon packets.
[rdpsrv] / Xserver / include / Xos.h
1 /*
2  * $XConsortium: Xos.h /main/70 1996/11/15 16:00:41 kaleb $
3  * $XFree86: xc/include/Xos.h,v 3.21.2.1 1998/01/23 12:35:11 dawes Exp $
4  * 
5  * 
6 Copyright (c) 1987  X Consortium
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
21 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
25 Except as contained in this notice, the name of the X Consortium shall not be
26 used in advertising or otherwise to promote the sale, use or other dealings
27 in this Software without prior written authorization from the X Consortium.
28  *
29  * The X Window System is a Trademark of X Consortium.
30  *
31  */
32
33 /* This is a collection of things to try and minimize system dependencies
34  * in a "signficant" number of source files.
35  */
36
37 #ifndef _XOS_H_
38 #define _XOS_H_
39
40 #include <X11/Xosdefs.h>
41
42 /*
43  * Get major data types (esp. caddr_t)
44  */
45
46 #ifdef USG
47 #ifndef __TYPES__
48 #ifdef CRAY
49 #define word word_t
50 #endif /* CRAY */
51 #include <sys/types.h>                  /* forgot to protect it... */
52 #define __TYPES__
53 #endif /* __TYPES__ */
54 #else /* USG */
55 #if defined(_POSIX_SOURCE) && (defined(MOTOROLA) || defined(AMOEBA))
56 #undef _POSIX_SOURCE
57 #include <sys/types.h>
58 #define _POSIX_SOURCE
59 #else
60 #include <sys/types.h>
61 #endif
62 #endif /* USG */
63
64
65 /*
66  * Just about everyone needs the strings routines.  We provide both forms here,
67  * index/rindex and strchr/strrchr, so any systems that don't provide them all
68  * need to have #defines here.
69  *
70  * NOTE: The following ISN'T true for this XFree86 version of this file.
71  *
72  * These macros are defined this way, rather than, e.g.:
73  *    #defined index(s,c) strchr(s,c)
74  * because someone might be using them as function pointers, and such
75  * a change would break compatibility for anyone who's relying on them
76  * being the way they currently are. So we're stuck with them this way,
77  * which can be really inconvenient. :-(
78  */
79
80 #ifndef X_NOT_STDC_ENV
81
82 #include <string.h>
83 #ifdef __STDC__
84 #ifndef index
85 #define index(s,c) (strchr((s),(c)))
86 #endif
87 #ifndef rindex
88 #define rindex(s,c) (strrchr((s),(c)))
89 #endif
90 #else
91 #ifndef index
92 #define index strchr
93 #endif
94 #ifndef rindex
95 #define rindex strrchr
96 #endif
97 #endif
98
99 #else
100
101 #ifdef SYSV
102 #if defined(clipper) || defined(__clipper__)
103 #include <malloc.h>
104 #endif
105 #include <string.h>
106 #define index strchr
107 #define rindex strrchr
108 #else
109 #include <strings.h>
110 #define strchr index
111 #define strrchr rindex
112 #endif
113
114 #endif /* X_NOT_STDC_ENV */
115
116 /*
117  * strerror()
118  */
119 #if (defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__)
120 #ifndef strerror
121 extern char *sys_errlist[];
122 extern int sys_nerr;
123 #define strerror(n) \
124     (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error")
125 #endif
126 #endif
127
128 /*
129  * Get open(2) constants
130  */
131 #ifdef X_NOT_POSIX
132 #include <fcntl.h>
133 #if defined(USL) || defined(CRAY) || defined(MOTOROLA) || (defined(i386) && (defined(SYSV) || defined(SVR4))) || defined(__sxg__)
134 #include <unistd.h>
135 #endif
136 #ifdef WIN32
137 #include <X11/Xw32defs.h>
138 #else
139 #include <sys/file.h>
140 #endif
141 #else /* X_NOT_POSIX */
142 #if !defined(_POSIX_SOURCE) && defined(macII)
143 #define _POSIX_SOURCE
144 #include <fcntl.h>
145 #include <unistd.h>
146 #undef _POSIX_SOURCE
147 #else
148 #include <fcntl.h>
149 #include <unistd.h>
150 #endif
151 #endif /* X_NOT_POSIX else */
152
153 #ifdef CSRG_BASED
154 #include <stdlib.h>
155 #include <unistd.h>
156 #endif /* CSRG_BASED */
157
158 /*
159  * Get struct timeval
160  */
161
162 #ifdef SYSV
163
164 #ifndef USL
165 #include <sys/time.h>
166 #endif
167 #include <time.h>
168 #ifdef CRAY
169 #undef word
170 #endif /* CRAY */
171 #if defined(USG) && !defined(CRAY) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__) && !defined(clipper) && !defined(__clipper__)
172 struct timeval {
173     long tv_sec;
174     long tv_usec;
175 };
176 #ifndef USL_SHARELIB
177 struct timezone {
178     int tz_minuteswest;
179     int tz_dsttime;
180 };
181 #endif /* USL_SHARELIB */
182 #endif /* USG */
183
184 #ifdef _SEQUENT_
185 struct timezone {
186     int tz_minuteswest;
187     int tz_dsttime;
188 };
189 #endif /* _SEQUENT_ */
190
191 #else /* not SYSV */
192
193 #if defined(_ANSI_SOURCE) && defined(__bsdi__)
194 #undef _ANSI_SOURCE
195 #include <sys/time.h>
196 #define _ANSI_SOURCE
197 #endif
198
199 #if defined(_POSIX_SOURCE) && defined(SVR4)
200 /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */
201 #undef _POSIX_SOURCE
202 #include <sys/time.h>
203 #define _POSIX_SOURCE
204 #else /* defined(_POSIX_SOURCE) && defined(SVR4) */
205 #ifdef WIN32
206 #include <time.h>
207 #if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_)
208 struct timeval {
209     long    tv_sec;         /* seconds */
210     long    tv_usec;        /* and microseconds */
211 };
212 #endif
213 #include <sys/timeb.h>
214 #define gettimeofday(t) \
215 { \
216     struct _timeb _gtodtmp; \
217     _ftime (&_gtodtmp); \
218     (t)->tv_sec = _gtodtmp.time; \
219     (t)->tv_usec = _gtodtmp.millitm * 1000; \
220 }
221 #else /* WIN32 */
222 #ifdef _SEQUENT_
223 #include <time.h>
224 #else /* _SEQUENT_ */
225 #ifdef AMOEBA
226 #include <time.h>
227 #include <sys/time.h>
228 #else /* AMOEBA */
229 #ifdef MINIX
230 #include <time.h>
231 #else /* !MINIX */
232 #ifndef Lynx
233 #include <sys/time.h>
234 #else
235 #include <time.h>
236 #endif /* Lynx */
237 #endif /* MINIX */
238 #endif /* AMOEBA */
239 #endif /* _SEQUENT_ */
240 #endif /* WIN32 else */
241 #endif /* defined(_POSIX_SOURCE) && defined(SVR4) */
242
243 #endif /* SYSV */
244
245 /* define X_GETTIMEOFDAY macro, a portable gettimeofday() */
246 #if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */
247 #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
248 #else
249 #if defined(SVR4) || defined(VMS) || defined(WIN32)
250 #define X_GETTIMEOFDAY(t) gettimeofday(t)
251 #else
252 #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
253 #endif
254 #endif /* XPG4 else */
255
256 #ifdef MINIX
257 #include <errno.h>
258 #include <net/gen/in.h>
259 #include <net/gen/socket.h>
260 #include <net/gen/udp.h>
261 #include <net/gen/udp_hdr.h>
262
263 struct sockaddr
264 {
265         u16_t sa_family;
266         char sa_data[14];
267 };
268
269 struct sockaddr_in
270 {
271         u16_t sin_family;
272         u16_t sin_port;
273         struct
274         {
275                 ipaddr_t s_addr;
276         } sin_addr;
277         char sin_zero[8];
278 };
279
280 struct in_addr
281 {
282         ipaddr_t s_addr;
283 };
284
285 typedef char *caddr_t;
286 typedef unsigned char u_char;
287 #endif /* MINIX */
288
289 #ifdef __EMX__
290 typedef unsigned long fd_mask;
291 #endif
292
293 /* use POSIX name for signal */
294 #if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) && !defined(ISC)
295 #define SIGCHLD SIGCLD
296 #endif
297
298 #ifdef ISC
299 #include <sys/bsdtypes.h>
300 #include <sys/limits.h>
301 #define NGROUPS 16
302 #endif
303
304 #if defined(ISC) || defined(__EMX__)
305 /*
306  *      Some OS's may not have this
307  */
308
309 #define X_NO_SYS_UN 1
310
311 struct sockaddr_un {
312         short   sun_family;
313         char    sun_path[108];
314 };
315 #endif
316
317 #endif /* _XOS_H_ */