]> git.sesse.net Git - rdpsrv/blob - Xserver/programs/Xserver/os/osdep.h
Support RDP5 logon packets.
[rdpsrv] / Xserver / programs / Xserver / os / osdep.h
1 /***********************************************************
2
3 Copyright (c) 1987  X Consortium
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of the X Consortium shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from the X Consortium.
25
26
27 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
28
29                         All Rights Reserved
30
31 Permission to use, copy, modify, and distribute this software and its 
32 documentation for any purpose and without fee is hereby granted, 
33 provided that the above copyright notice appear in all copies and that
34 both that copyright notice and this permission notice appear in 
35 supporting documentation, and that the name of Digital not be
36 used in advertising or publicity pertaining to distribution of the
37 software without specific, written prior permission.  
38
39 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45 SOFTWARE.
46
47 ******************************************************************/
48 /* $XConsortium: osdep.h /main/42 1996/12/15 21:27:39 rws $ */
49 /* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.4 1996/12/23 07:09:58 dawes Exp $ */
50
51 #ifdef AMOEBA
52 #include <stddef.h>
53 #define port am_port_t
54 #include <amoeba.h>
55 #include <stdio.h>
56 #include <assert.h>
57 #include <semaphore.h>
58 #include <circbuf.h>
59 #include <exception.h>
60 #include <vc.h>
61 #include <fault.h>
62 #include <module/signals.h>
63 #include <server/x11/Xamoeba.h>
64 #undef  port
65 #endif
66
67 #define BOTIMEOUT 200 /* in milliseconds */
68 #define BUFSIZE 4096
69 #define BUFWATERMARK 8192
70 #ifndef MAXBUFSIZE
71 #define MAXBUFSIZE (1 << 22)
72 #endif
73
74 #include <X11/Xmd.h>
75
76 #ifndef sgi         /* SGI defines OPEN_MAX in a useless way */
77 #ifndef X_NOT_POSIX
78 #ifdef _POSIX_SOURCE
79 #include <limits.h>
80 #else
81 #define _POSIX_SOURCE
82 #include <limits.h>
83 #undef _POSIX_SOURCE
84 #endif
85 #else /* X_NOT_POSIX */
86 #ifdef WIN32
87 #define _POSIX_
88 #include <limits.h>
89 #undef _POSIX_
90 #endif
91 #endif /* X_NOT_POSIX */
92 #endif
93
94 #ifndef OPEN_MAX
95 #ifdef SVR4
96 #define OPEN_MAX 128
97 #else
98 #include <sys/param.h>
99 #ifndef OPEN_MAX
100 #if defined(NOFILE) && !defined(NOFILES_MAX)
101 #define OPEN_MAX NOFILE
102 #else
103 #ifndef __EMX__
104 #define OPEN_MAX NOFILES_MAX
105 #else
106 #define OPEN_MAX 256
107 #endif
108 #endif
109 #endif
110 #endif
111 #endif
112
113 #if OPEN_MAX <= 128
114 #define MAXSOCKS (OPEN_MAX - 1)
115 #else
116 #define MAXSOCKS 128
117 #endif
118
119 #ifndef NULL
120 #define NULL 0
121 #endif
122
123 #ifdef AMOEBA
124 #include "X.h"
125 #include "misc.h"
126
127 #define FamilyAmoeba 33
128
129 extern char             *XServerHostName;       /* X server host name */
130 extern char             *XTcpServerName;        /* TCP/IP server name */
131 extern int              maxClient;              /* Highest client# */
132 extern int              nNewConns;              /* # of new clients */
133 #endif /* AMOEBA */
134
135 typedef struct _connectionInput {
136     struct _connectionInput *next;
137     char *buffer;               /* contains current client input */
138     char *bufptr;               /* pointer to current start of data */
139     int  bufcnt;                /* count of bytes in buffer */
140     int lenLastReq;
141     int size;
142 } ConnectionInput, *ConnectionInputPtr;
143
144 typedef struct _connectionOutput {
145     struct _connectionOutput *next;
146     int size;
147     unsigned char *buf;
148     int count;
149 #ifdef LBX
150     Bool nocompress;
151 #endif
152 } ConnectionOutput, *ConnectionOutputPtr;
153
154 #ifdef K5AUTH
155 typedef struct _k5_state {
156     int         stageno;        /* current stage of auth protocol */
157     pointer     srvcreds;       /* server credentials */
158     pointer     srvname;        /* server principal name */
159     pointer     ktname;         /* key table: principal-key pairs */
160     pointer     skey;           /* session key */
161 }           k5_state;
162 #endif
163
164 #ifdef LBX
165 typedef struct _LbxProxy *OsProxyPtr;
166 #endif
167
168 typedef struct _osComm {
169     int fd;
170     ConnectionInputPtr input;
171     ConnectionOutputPtr output;
172     XID auth_id;                /* authorization id */
173 #ifdef K5AUTH
174     k5_state    authstate;      /* state of setup auth conversation */
175 #endif
176     CARD32 conn_time;           /* timestamp if not established, else 0  */
177     struct _XtransConnInfo *trans_conn; /* transport connection object */
178 #ifdef LBX
179     OsProxyPtr proxy;
180     ConnectionInputPtr largereq;
181     void (*Close) ();
182     int  (*Flush) ();
183 #endif
184 } OsCommRec, *OsCommPtr;
185
186 #ifdef LBX
187 #define FlushClient(who, oc, extraBuf, extraCount) \
188     (*(oc)->Flush)(who, oc, extraBuf, extraCount)
189 extern int StandardFlushClient(
190 #if NeedFunctionPrototypes
191     ClientPtr /*who*/,
192     OsCommPtr /*oc*/,
193     char* /*extraBuf*/,
194     int /*extraCount*/
195 #endif
196 );
197 #else
198 extern int FlushClient(
199 #if NeedFunctionPrototypes
200     ClientPtr /*who*/,
201     OsCommPtr /*oc*/,
202     char* /*extraBuf*/,
203     int /*extraCount*/
204 #endif
205 );
206 #endif
207
208 extern void FreeOsBuffers(
209 #if NeedFunctionPrototypes
210     OsCommPtr /*oc*/
211 #endif
212 );
213
214 extern ConnectionInputPtr AllocateInputBuffer(
215 #if NeedFunctionPrototypes
216     void
217 #endif
218 );
219
220 extern ConnectionOutputPtr AllocateOutputBuffer(
221 #if NeedFunctionPrototypes
222     void
223 #endif
224 );