]> git.sesse.net Git - rdpsrv/blob - Xserver/lib/xtrans/Xtrans.h
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / lib / xtrans / Xtrans.h
1 /* $XConsortium: Xtrans.h,v 1.29 95/06/08 23:20:39 gildea Exp $ */
2 /* $XFree86: xc/lib/xtrans/Xtrans.h,v 3.9 1997/01/18 06:52:39 dawes Exp $ */
3 /*
4
5 Copyright (c) 1993, 1994  X Consortium
6
7 Permission is hereby granted, free of charge, to any person obtaining
8 a copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sublicense, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
14
15 The above copyright notice and this permission notice shall be included
16 in all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 OTHER DEALINGS IN THE SOFTWARE.
25
26 Except as contained in this notice, the name of the X Consortium shall
27 not be used in advertising or otherwise to promote the sale, use or
28 other dealings in this Software without prior written authorization
29 from the X Consortium.
30
31 */
32
33 /* Copyright (c) 1993, 1994 NCR Corporation - Dayton, Ohio, USA
34  *
35  * All Rights Reserved
36  *
37  * Permission to use, copy, modify, and distribute this software and its
38  * documentation for any purpose and without fee is hereby granted, provided
39  * that the above copyright notice appear in all copies and that both that
40  * copyright notice and this permission notice appear in supporting
41  * documentation, and that the name NCR not be used in advertising
42  * or publicity pertaining to distribution of the software without specific,
43  * written prior permission.  NCR makes no representations about the
44  * suitability of this software for any purpose.  It is provided "as is"
45  * without express or implied warranty.
46  *
47  * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
48  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
49  * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
50  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
51  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
52  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
53  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
54  */
55
56 #ifndef _XTRANS_H_
57 #define _XTRANS_H_
58
59 #include <X11/Xfuncproto.h>
60 #include <X11/Xos.h>
61
62
63 /*
64  * Set the functions names according to where this code is being compiled.
65  */
66
67 #ifdef X11_t
68 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
69 #define TRANS(func) _X11Trans##func
70 #else
71 #define TRANS(func) _X11Trans/**/func
72 #endif
73 static char* __xtransname = "_X11Trans";
74 #endif /* X11_t */
75
76 #ifdef XSERV_t
77 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
78 #define TRANS(func) _XSERVTrans##func
79 #else
80 #define TRANS(func) _XSERVTrans/**/func
81 #endif
82 static char* __xtransname = "_XSERVTrans";
83 #define X11_t
84 #endif /* X11_t */
85
86 #ifdef XIM_t
87 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
88 #define TRANS(func) _XimXTrans##func
89 #else
90 #define TRANS(func) _XimXTrans/**/func
91 #endif
92 static char* __xtransname = "_XimTrans";
93 #endif /* XIM_t */
94
95 #ifdef FS_t
96 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
97 #define TRANS(func) _FSTrans##func
98 #else
99 #define TRANS(func) _FSTrans/**/func
100 #endif
101 static char* __xtransname = "_FSTrans";
102 #endif /* FS_t */
103
104 #ifdef FONT_t
105 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
106 #define TRANS(func) _FontTrans##func
107 #else
108 #define TRANS(func) _FontTrans/**/func
109 #endif
110 static char* __xtransname = "_FontTrans";
111 #endif /* FONT_t */
112
113 #ifdef ICE_t
114 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
115 #define TRANS(func) _IceTrans##func
116 #else
117 #define TRANS(func) _IceTrans/**/func
118 #endif
119 static char* __xtransname = "_IceTrans";
120 #endif /* ICE_t */
121
122 #ifdef TEST_t
123 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
124 #define TRANS(func) _TESTTrans##func
125 #else
126 #define TRANS(func) _TESTTrans/**/func
127 #endif
128 static char* __xtransname = "_TESTTrans";
129 #endif /* TEST_t */
130
131 #if !defined(TRANS)
132 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
133 #define TRANS(func) _XTrans##func
134 #else
135 #define TRANS(func) _XTrans/**/func
136 #endif
137 static char* __xtransname = "_XTrans";
138 #endif /* !TRANS */
139
140
141 /*
142  * Create a single address structure that can be used wherever
143  * an address structure is needed. struct sockaddr is not big enough
144  * to hold a sockadd_un, so we create this definition to have a single
145  * structure that is big enough for all the structures we might need.
146  *
147  * This structure needs to be independent of the socket/TLI interface used.
148  */
149
150 #define XTRANS_MAX_ADDR_LEN     128     /* large enough to hold sun_path */
151
152 typedef struct {
153     unsigned char       addr[XTRANS_MAX_ADDR_LEN];
154 } Xtransaddr;
155
156
157 #ifdef LONG64
158 typedef int BytesReadable_t;
159 #else
160 typedef long BytesReadable_t;
161 #endif
162
163
164 #if defined(WIN32) || (defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__)) || defined(MINIX)
165
166 /*
167  *      TRANS(Readv) and TRANS(Writev) use struct iovec, normally found
168  *      in Berkeley systems in <sys/uio.h>.  See the readv(2) and writev(2)
169  *      manual pages for details.
170  */
171
172 struct iovec {
173     caddr_t iov_base;
174     int iov_len;
175 };
176
177 #else
178 #ifndef Lynx
179 #include <sys/uio.h>
180 #else
181 #include <uio.h>
182 #endif
183 #endif
184
185 typedef struct _XtransConnInfo *XtransConnInfo;
186
187
188 /*
189  * Transport Option definitions
190  */
191
192 #define TRANS_NONBLOCKING       1
193 #define TRANS_CLOSEONEXEC       2
194
195
196 /*
197  * Return values of Connect (0 is success)
198  */
199
200 #define TRANS_CONNECT_FAILED    -1
201 #define TRANS_TRY_CONNECT_AGAIN -2
202
203
204 /*
205  * Return values of CreateListener (0 is success)
206  */
207
208 #define TRANS_CREATE_LISTENER_FAILED    -1
209 #define TRANS_ADDR_IN_USE               -2
210
211
212 /*
213  * Return values of Accept (0 is success)
214  */
215
216 #define TRANS_ACCEPT_BAD_MALLOC                 -1
217 #define TRANS_ACCEPT_FAILED                     -2
218 #define TRANS_ACCEPT_MISC_ERROR                 -3
219
220
221 /*
222  * ResetListener return values
223  */
224
225 #define TRANS_RESET_NOOP        1
226 #define TRANS_RESET_NEW_FD      2
227 #define TRANS_RESET_FAILURE     3
228
229
230 /*
231  * Function prototypes for the exposed interface
232  */
233
234 #ifdef TRANS_CLIENT
235
236 XtransConnInfo TRANS(OpenCOTSClient)(
237 #if NeedFunctionPrototypes
238     char *              /* address */
239 #endif
240 );
241
242 #endif /* TRANS_CLIENT */
243
244 #ifdef TRANS_SERVER
245
246 XtransConnInfo TRANS(OpenCOTSServer)(
247 #if NeedFunctionPrototypes
248     char *              /* address */
249 #endif
250 );
251
252 #endif /* TRANS_SERVER */
253
254 #ifdef TRANS_CLIENT
255
256 XtransConnInfo TRANS(OpenCLTSClient)(
257 #if NeedFunctionPrototypes
258     char *              /* address */
259 #endif
260 );
261
262 #endif /* TRANS_CLIENT */
263
264 #ifdef TRANS_SERVER
265
266 XtransConnInfo TRANS(OpenCLTSServer)(
267 #if NeedFunctionPrototypes
268     char *              /* address */
269 #endif
270 );
271
272 #endif /* TRANS_SERVER */
273
274 #ifdef TRANS_REOPEN
275
276 XtransConnInfo TRANS(ReopenCOTSServer)(
277 #if NeedFunctionPrototypes
278     int,                /* trans_id */
279     int,                /* fd */
280     char *              /* port */
281 #endif
282 );
283
284 XtransConnInfo TRANS(ReopenCLTSServer)(
285 #if NeedFunctionPrototypes
286     int,                /* trans_id */
287     int,                /* fd */
288     char *              /* port */
289 #endif
290 );
291
292 int TRANS(GetReopenInfo)(
293 #if NeedFunctionPrototypes
294     XtransConnInfo,     /* ciptr */
295     int *,              /* trans_id */
296     int *,              /* fd */
297     char **             /* port */
298 #endif
299 );
300
301 #endif /* TRANS_REOPEN */
302
303
304 int TRANS(SetOption)(
305 #if NeedFunctionPrototypes
306     XtransConnInfo,     /* ciptr */
307     int,                /* option */
308     int                 /* arg */
309 #endif
310 );
311
312 #ifdef TRANS_SERVER
313
314 int TRANS(CreateListener)(
315 #if NeedFunctionPrototypes
316     XtransConnInfo,     /* ciptr */
317     char *              /* port */
318 #endif
319 );
320
321 int TRANS(NoListen) (
322 #if NeedFunctionPrototypes
323     char*               /* protocol*/
324 #endif
325 );
326
327 int TRANS(ResetListener)(
328 #if NeedFunctionPrototypes
329     XtransConnInfo      /* ciptr */
330 #endif
331 );
332
333 XtransConnInfo TRANS(Accept)(
334 #if NeedFunctionPrototypes
335     XtransConnInfo,     /* ciptr */
336     int *               /* status */
337 #endif
338 );
339
340 #endif /* TRANS_SERVER */
341
342 #ifdef TRANS_CLIENT
343
344 int TRANS(Connect)(
345 #if NeedFunctionPrototypes
346     XtransConnInfo,     /* ciptr */
347     char *              /* address */
348 #endif
349 );
350
351 #endif /* TRANS_CLIENT */
352
353 int TRANS(BytesReadable)(
354 #if NeedFunctionPrototypes
355     XtransConnInfo,     /* ciptr */
356     BytesReadable_t *   /* pend */
357 #endif
358 );
359
360 int TRANS(Read)(
361 #if NeedFunctionPrototypes
362     XtransConnInfo,     /* ciptr */
363     char *,             /* buf */
364     int                 /* size */
365 #endif
366 );
367
368 int TRANS(Write)(
369 #if NeedFunctionPrototypes
370     XtransConnInfo,     /* ciptr */
371     char *,             /* buf */
372     int                 /* size */
373 #endif
374 );
375
376 int TRANS(Readv)(
377 #if NeedFunctionPrototypes
378     XtransConnInfo,     /* ciptr */
379     struct iovec *,     /* buf */
380     int                 /* size */
381 #endif
382 );
383
384 int TRANS(Writev)(
385 #if NeedFunctionPrototypes
386     XtransConnInfo,     /* ciptr */
387     struct iovec *,     /* buf */
388     int                 /* size */
389 #endif
390 );
391
392 int TRANS(Disconnect)(
393 #if NeedFunctionPrototypes
394     XtransConnInfo      /* ciptr */
395 #endif
396 );
397
398 int TRANS(Close)(
399 #if NeedFunctionPrototypes
400     XtransConnInfo      /* ciptr */
401 #endif
402 );
403
404 int TRANS(CloseForCloning)(
405 #if NeedFunctionPrototypes
406     XtransConnInfo      /* ciptr */
407 #endif
408 );
409
410 int TRANS(IsLocal)(
411 #if NeedFunctionPrototypes
412     XtransConnInfo      /* ciptr */
413 #endif
414 );
415
416 int TRANS(GetMyAddr)(
417 #if NeedFunctionPrototypes
418     XtransConnInfo,     /* ciptr */
419     int *,              /* familyp */
420     int *,              /* addrlenp */
421     Xtransaddr **       /* addrp */
422 #endif
423 );
424
425 int TRANS(GetPeerAddr)(
426 #if NeedFunctionPrototypes
427     XtransConnInfo,     /* ciptr */
428     int *,              /* familyp */
429     int *,              /* addrlenp */
430     Xtransaddr **       /* addrp */
431 #endif
432 );
433
434 int TRANS(GetConnectionNumber)(
435 #if NeedFunctionPrototypes
436     XtransConnInfo      /* ciptr */
437 #endif
438 );
439
440 #ifdef TRANS_SERVER
441
442 int TRANS(MakeAllCOTSServerListeners)(
443 #if NeedFunctionPrototypes
444     char *,             /* port */
445     int *,              /* partial */
446     int *,              /* count_ret */
447     XtransConnInfo **   /* ciptrs_ret */
448 #endif
449 );
450
451 int TRANS(MakeAllCLTSServerListeners)(
452 #if NeedFunctionPrototypes
453     char *,             /* port */
454     int *,              /* partial */
455     int *,              /* count_ret */
456     XtransConnInfo **   /* ciptrs_ret */
457 #endif
458 );
459
460 #endif /* TRANS_SERVER */
461
462
463 /*
464  * Function Prototypes for Utility Functions.
465  */
466
467 #ifdef X11_t
468
469 int TRANS(ConvertAddress)(
470 #if NeedFunctionPrototypes
471     int *,              /* familyp */
472     int *,              /* addrlenp */
473     Xtransaddr **       /* addrp */
474 #endif
475 );
476
477 #endif /* X11_t */
478
479 #ifdef ICE_t
480
481 char *
482 TRANS(GetMyNetworkId)(
483 #if NeedFunctionPrototypes
484     XtransConnInfo      /* ciptr */
485 #endif
486 );
487
488 char *
489 TRANS(GetPeerNetworkId)(
490 #if NeedFunctionPrototypes
491     XtransConnInfo      /* ciptr */
492 #endif
493 );
494
495 #endif /* ICE_t */
496
497 #if defined(WIN32) && (defined(TCPCONN) || defined(DNETCONN))
498 int TRANS(WSAStartup)();
499 #endif
500
501 #endif /* _XTRANS_H_ */