VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.4.2/osdep.h@ 78293

Last change on this file since 78293 was 43272, checked in by vboxsync, 12 years ago

Additions/x11: more original X server headers.

  • Property svn:eol-style set to native
File size: 8.5 KB
Line 
1/***********************************************************
2
3Copyright 1987, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28 All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46******************************************************************/
47
48#ifdef HAVE_DIX_CONFIG_H
49#include <dix-config.h>
50#endif
51
52#ifndef _OSDEP_H_
53#define _OSDEP_H_ 1
54
55#define BOTIMEOUT 200 /* in milliseconds */
56#define BUFSIZE 4096
57#define BUFWATERMARK 8192
58
59#include <X11/Xdmcp.h>
60
61#ifndef sgi /* SGI defines OPEN_MAX in a useless way */
62#ifndef X_NOT_POSIX
63#ifdef _POSIX_SOURCE
64#include <limits.h>
65#else
66#define _POSIX_SOURCE
67#include <limits.h>
68#undef _POSIX_SOURCE
69#endif
70#else /* X_NOT_POSIX */
71#ifdef WIN32
72#define _POSIX_
73#include <limits.h>
74#undef _POSIX_
75#endif
76#endif /* X_NOT_POSIX */
77#endif
78
79#ifdef __QNX__
80#define NOFILES_MAX 256
81#endif
82#ifndef OPEN_MAX
83#ifdef SVR4
84#define OPEN_MAX 256
85#else
86#include <sys/param.h>
87#ifndef OPEN_MAX
88#if defined(NOFILE) && !defined(NOFILES_MAX)
89#define OPEN_MAX NOFILE
90#else
91#if !defined(WIN32)
92#define OPEN_MAX NOFILES_MAX
93#else
94#define OPEN_MAX 256
95#endif
96#endif
97#endif
98#endif
99#endif
100
101#include <X11/Xpoll.h>
102
103/*
104 * MAXSOCKS is used only for initialising MaxClients when no other method
105 * like sysconf(_SC_OPEN_MAX) is not supported.
106 */
107
108#if OPEN_MAX <= 256
109#define MAXSOCKS (OPEN_MAX - 1)
110#else
111#define MAXSOCKS 256
112#endif
113
114/* MAXSELECT is the number of fds that select() can handle */
115#define MAXSELECT (sizeof(fd_set) * NBBY)
116
117#ifndef HAS_GETDTABLESIZE
118#if !defined(hpux) && !defined(SVR4) && !defined(SYSV)
119#define HAS_GETDTABLESIZE
120#endif
121#endif
122
123#include <stddef.h>
124
125typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
126typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
127typedef Bool (*AddAuthorFunc)(unsigned name_length, char *name, unsigned data_length, char *data);
128
129typedef struct _connectionInput {
130 struct _connectionInput *next;
131 char *buffer; /* contains current client input */
132 char *bufptr; /* pointer to current start of data */
133 int bufcnt; /* count of bytes in buffer */
134 int lenLastReq;
135 int size;
136} ConnectionInput, *ConnectionInputPtr;
137
138typedef struct _connectionOutput {
139 struct _connectionOutput *next;
140 int size;
141 unsigned char *buf;
142 int count;
143} ConnectionOutput, *ConnectionOutputPtr;
144
145struct _osComm;
146
147#define AuthInitArgs void
148typedef void (*AuthInitFunc) (AuthInitArgs);
149
150#define AuthAddCArgs unsigned short data_length, char *data, XID id
151typedef int (*AuthAddCFunc) (AuthAddCArgs);
152
153#define AuthCheckArgs unsigned short data_length, char *data, ClientPtr client, char **reason
154typedef XID (*AuthCheckFunc) (AuthCheckArgs);
155
156#define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap
157typedef int (*AuthFromIDFunc) (AuthFromIDArgs);
158
159#define AuthGenCArgs unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return
160typedef XID (*AuthGenCFunc) (AuthGenCArgs);
161
162#define AuthRemCArgs unsigned short data_length, char *data
163typedef int (*AuthRemCFunc) (AuthRemCArgs);
164
165#define AuthRstCArgs void
166typedef int (*AuthRstCFunc) (AuthRstCArgs);
167
168#define AuthToIDArgs unsigned short data_length, char *data
169typedef XID (*AuthToIDFunc) (AuthToIDArgs);
170
171typedef void (*OsCloseFunc)(ClientPtr);
172
173typedef int (*OsFlushFunc)(ClientPtr who, struct _osComm * oc, char* extraBuf, int extraCount);
174
175typedef struct _osComm {
176 int fd;
177 ConnectionInputPtr input;
178 ConnectionOutputPtr output;
179 XID auth_id; /* authorization id */
180 CARD32 conn_time; /* timestamp if not established, else 0 */
181 struct _XtransConnInfo *trans_conn; /* transport connection object */
182} OsCommRec, *OsCommPtr;
183
184extern int FlushClient(
185 ClientPtr /*who*/,
186 OsCommPtr /*oc*/,
187 char* /*extraBuf*/,
188 int /*extraCount*/
189);
190
191extern void FreeOsBuffers(
192 OsCommPtr /*oc*/
193);
194
195#include "dix.h"
196
197extern fd_set AllSockets;
198extern fd_set AllClients;
199extern fd_set LastSelectMask;
200extern fd_set WellKnownConnections;
201extern fd_set EnabledDevices;
202extern fd_set ClientsWithInput;
203extern fd_set ClientsWriteBlocked;
204extern fd_set OutputPending;
205extern fd_set IgnoredClientsWithInput;
206
207#ifndef WIN32
208extern int *ConnectionTranslation;
209#else
210extern int GetConnectionTranslation(int conn);
211extern void SetConnectionTranslation(int conn, int client);
212extern void ClearConnectionTranslation();
213#endif
214
215extern Bool NewOutputPending;
216extern Bool AnyClientsWriteBlocked;
217
218extern WorkQueuePtr workQueue;
219
220/* added by raphael */
221#ifdef WIN32
222typedef long int fd_mask;
223#endif
224#define ffs mffs
225extern int mffs(fd_mask);
226
227/* in auth.c */
228extern void GenerateRandomData (int len, char *buf);
229
230/* in mitauth.c */
231extern XID MitCheckCookie (AuthCheckArgs);
232extern XID MitGenerateCookie (AuthGenCArgs);
233extern XID MitToID (AuthToIDArgs);
234extern int MitAddCookie (AuthAddCArgs);
235extern int MitFromID (AuthFromIDArgs);
236extern int MitRemoveCookie (AuthRemCArgs);
237extern int MitResetCookie (AuthRstCArgs);
238
239/* in xdmauth.c */
240#ifdef HASXDMAUTH
241extern XID XdmCheckCookie (AuthCheckArgs);
242extern XID XdmToID (AuthToIDArgs);
243extern int XdmAddCookie (AuthAddCArgs);
244extern int XdmFromID (AuthFromIDArgs);
245extern int XdmRemoveCookie (AuthRemCArgs);
246extern int XdmResetCookie (AuthRstCArgs);
247#endif
248
249/* in rpcauth.c */
250#ifdef SECURE_RPC
251extern void SecureRPCInit (AuthInitArgs);
252extern XID SecureRPCCheck (AuthCheckArgs);
253extern XID SecureRPCToID (AuthToIDArgs);
254extern int SecureRPCAdd (AuthAddCArgs);
255extern int SecureRPCFromID (AuthFromIDArgs);
256extern int SecureRPCRemove (AuthRemCArgs);
257extern int SecureRPCReset (AuthRstCArgs);
258#endif
259
260/* in secauth.c */
261extern XID AuthSecurityCheck (AuthCheckArgs);
262
263/* in xdmcp.c */
264extern void XdmcpUseMsg (void);
265extern int XdmcpOptions(int argc, char **argv, int i);
266extern void XdmcpRegisterConnection (
267 int type,
268 char *address,
269 int addrlen);
270extern void XdmcpRegisterAuthorizations (void);
271extern void XdmcpRegisterAuthorization (char *name, int namelen);
272extern void XdmcpInit (void);
273extern void XdmcpReset (void);
274extern void XdmcpOpenDisplay(int sock);
275extern void XdmcpCloseDisplay(int sock);
276extern void XdmcpRegisterAuthentication (
277 char *name,
278 int namelen,
279 char *data,
280 int datalen,
281 ValidatorFunc Validator,
282 GeneratorFunc Generator,
283 AddAuthorFunc AddAuth);
284
285struct sockaddr_in;
286extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr);
287
288#ifdef HASXDMAUTH
289extern void XdmAuthenticationInit (char *cookie, int cookie_length);
290#endif
291
292#endif /* _OSDEP_H_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette