VirtualBox

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

最後變更 在這個檔案從61386是 25078,由 vboxsync 提交於 15 年 前

Additions/x11/x11include: exported and set eol-style on new headers

  • 屬性 svn:eol-style 設為 native
檔案大小: 9.8 KB
 
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#ifndef MAXBUFSIZE
59#define MAXBUFSIZE (1 << 22)
60#endif
61
62#include <X11/Xdmcp.h>
63
64#ifndef sgi /* SGI defines OPEN_MAX in a useless way */
65#ifndef X_NOT_POSIX
66#ifdef _POSIX_SOURCE
67#include <limits.h>
68#else
69#define _POSIX_SOURCE
70#include <limits.h>
71#undef _POSIX_SOURCE
72#endif
73#else /* X_NOT_POSIX */
74#ifdef WIN32
75#define _POSIX_
76#include <limits.h>
77#undef _POSIX_
78#endif
79#endif /* X_NOT_POSIX */
80#endif
81
82#ifdef __QNX__
83#define NOFILES_MAX 256
84#endif
85#ifndef OPEN_MAX
86#ifdef SVR4
87#define OPEN_MAX 256
88#else
89#include <sys/param.h>
90#ifndef OPEN_MAX
91#if defined(NOFILE) && !defined(NOFILES_MAX)
92#define OPEN_MAX NOFILE
93#else
94#if !defined(__UNIXOS2__) && !defined(WIN32)
95#define OPEN_MAX NOFILES_MAX
96#else
97#define OPEN_MAX 256
98#endif
99#endif
100#endif
101#endif
102#endif
103
104#include <X11/Xpoll.h>
105
106/*
107 * MAXSOCKS is used only for initialising MaxClients when no other method
108 * like sysconf(_SC_OPEN_MAX) is not supported.
109 */
110
111#if OPEN_MAX <= 256
112#define MAXSOCKS (OPEN_MAX - 1)
113#else
114#define MAXSOCKS 256
115#endif
116
117/* MAXSELECT is the number of fds that select() can handle */
118#define MAXSELECT (sizeof(fd_set) * NBBY)
119
120#ifndef HAS_GETDTABLESIZE
121#if !defined(hpux) && !defined(SVR4) && !defined(SYSV)
122#define HAS_GETDTABLESIZE
123#endif
124#endif
125
126#include <stddef.h>
127
128typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
129typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
130typedef Bool (*AddAuthorFunc)(unsigned name_length, char *name, unsigned data_length, char *data);
131
132typedef struct _connectionInput {
133 struct _connectionInput *next;
134 char *buffer; /* contains current client input */
135 char *bufptr; /* pointer to current start of data */
136 int bufcnt; /* count of bytes in buffer */
137 int lenLastReq;
138 int size;
139} ConnectionInput, *ConnectionInputPtr;
140
141typedef struct _connectionOutput {
142 struct _connectionOutput *next;
143 int size;
144 unsigned char *buf;
145 int count;
146} ConnectionOutput, *ConnectionOutputPtr;
147
148#ifdef K5AUTH
149typedef struct _k5_state {
150 int stageno; /* current stage of auth protocol */
151 pointer srvcreds; /* server credentials */
152 pointer srvname; /* server principal name */
153 pointer ktname; /* key table: principal-key pairs */
154 pointer skey; /* session key */
155} k5_state;
156#endif
157
158struct _osComm;
159
160#define AuthInitArgs void
161typedef void (*AuthInitFunc) (AuthInitArgs);
162
163#define AuthAddCArgs unsigned short data_length, char *data, XID id
164typedef int (*AuthAddCFunc) (AuthAddCArgs);
165
166#define AuthCheckArgs unsigned short data_length, char *data, ClientPtr client, char **reason
167typedef XID (*AuthCheckFunc) (AuthCheckArgs);
168
169#define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap
170typedef int (*AuthFromIDFunc) (AuthFromIDArgs);
171
172#define AuthGenCArgs unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return
173typedef XID (*AuthGenCFunc) (AuthGenCArgs);
174
175#define AuthRemCArgs unsigned short data_length, char *data
176typedef int (*AuthRemCFunc) (AuthRemCArgs);
177
178#define AuthRstCArgs void
179typedef int (*AuthRstCFunc) (AuthRstCArgs);
180
181#define AuthToIDArgs unsigned short data_length, char *data
182typedef XID (*AuthToIDFunc) (AuthToIDArgs);
183
184typedef void (*OsCloseFunc)(ClientPtr);
185
186typedef int (*OsFlushFunc)(ClientPtr who, struct _osComm * oc, char* extraBuf, int extraCount);
187
188typedef struct _osComm {
189 int fd;
190 ConnectionInputPtr input;
191 ConnectionOutputPtr output;
192 XID auth_id; /* authorization id */
193#ifdef K5AUTH
194 k5_state authstate; /* state of setup auth conversation */
195#endif
196 CARD32 conn_time; /* timestamp if not established, else 0 */
197 struct _XtransConnInfo *trans_conn; /* transport connection object */
198} OsCommRec, *OsCommPtr;
199
200extern int FlushClient(
201 ClientPtr /*who*/,
202 OsCommPtr /*oc*/,
203 char* /*extraBuf*/,
204 int /*extraCount*/
205);
206
207extern void FreeOsBuffers(
208 OsCommPtr /*oc*/
209);
210
211#include "dix.h"
212
213extern ConnectionInputPtr AllocateInputBuffer(void);
214
215extern ConnectionOutputPtr AllocateOutputBuffer(void);
216
217extern fd_set AllSockets;
218extern fd_set AllClients;
219extern fd_set LastSelectMask;
220extern fd_set WellKnownConnections;
221extern fd_set EnabledDevices;
222extern fd_set ClientsWithInput;
223extern fd_set ClientsWriteBlocked;
224extern fd_set OutputPending;
225extern fd_set IgnoredClientsWithInput;
226
227#ifndef WIN32
228extern int *ConnectionTranslation;
229#else
230extern int GetConnectionTranslation(int conn);
231extern void SetConnectionTranslation(int conn, int client);
232extern void ClearConnectionTranslation();
233#endif
234
235extern Bool NewOutputPending;
236extern Bool AnyClientsWriteBlocked;
237extern Bool CriticalOutputPending;
238
239extern int timesThisConnection;
240extern ConnectionInputPtr FreeInputs;
241extern ConnectionOutputPtr FreeOutputs;
242extern OsCommPtr AvailableInput;
243
244extern WorkQueuePtr workQueue;
245
246/* added by raphael */
247#ifdef WIN32
248typedef long int fd_mask;
249#endif
250#define ffs mffs
251extern int mffs(fd_mask);
252
253/* in auth.c */
254extern void GenerateRandomData (int len, char *buf);
255
256/* in mitauth.c */
257extern XID MitCheckCookie (AuthCheckArgs);
258extern XID MitGenerateCookie (AuthGenCArgs);
259extern XID MitToID (AuthToIDArgs);
260extern int MitAddCookie (AuthAddCArgs);
261extern int MitFromID (AuthFromIDArgs);
262extern int MitRemoveCookie (AuthRemCArgs);
263extern int MitResetCookie (AuthRstCArgs);
264
265/* in xdmauth.c */
266#ifdef HASXDMAUTH
267extern XID XdmCheckCookie (AuthCheckArgs);
268extern XID XdmToID (AuthToIDArgs);
269extern int XdmAddCookie (AuthAddCArgs);
270extern int XdmFromID (AuthFromIDArgs);
271extern int XdmRemoveCookie (AuthRemCArgs);
272extern int XdmResetCookie (AuthRstCArgs);
273#endif
274
275/* in rpcauth.c */
276#ifdef SECURE_RPC
277extern void SecureRPCInit (AuthInitArgs);
278extern XID SecureRPCCheck (AuthCheckArgs);
279extern XID SecureRPCToID (AuthToIDArgs);
280extern int SecureRPCAdd (AuthAddCArgs);
281extern int SecureRPCFromID (AuthFromIDArgs);
282extern int SecureRPCRemove (AuthRemCArgs);
283extern int SecureRPCReset (AuthRstCArgs);
284#endif
285
286/* in k5auth.c */
287#ifdef K5AUTH
288extern XID K5Check (AuthCheckArgs);
289extern XID K5ToID (AuthToIDArgs);
290extern int K5Add (AuthAddCArgs);
291extern int K5FromID (AuthFromIDArgs);
292extern int K5Remove (AuthRemCArgs);
293extern int K5Reset (AuthRstCArgs);
294#endif
295
296/* in secauth.c */
297extern XID AuthSecurityCheck (AuthCheckArgs);
298
299/* in xdmcp.c */
300extern void XdmcpUseMsg (void);
301extern int XdmcpOptions(int argc, char **argv, int i);
302extern void XdmcpSetAuthentication (ARRAY8Ptr name);
303extern void XdmcpRegisterConnection (
304 int type,
305 char *address,
306 int addrlen);
307extern void XdmcpRegisterAuthorizations (void);
308extern void XdmcpRegisterAuthorization (char *name, int namelen);
309extern void XdmcpRegisterDisplayClass (char *name, int length);
310extern void XdmcpInit (void);
311extern void XdmcpReset (void);
312extern void XdmcpOpenDisplay(int sock);
313extern void XdmcpCloseDisplay(int sock);
314extern void XdmcpRegisterAuthentication (
315 char *name,
316 int namelen,
317 char *data,
318 int datalen,
319 ValidatorFunc Validator,
320 GeneratorFunc Generator,
321 AddAuthorFunc AddAuth);
322extern int XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type);
323extern int XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data);
324
325struct sockaddr_in;
326extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr);
327
328#ifdef HASXDMAUTH
329extern void XdmAuthenticationInit (char *cookie, int cookie_length);
330#endif
331
332#endif /* _OSDEP_H_ */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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