1 /* DO NOT EDIT THIS FILE.
3 It has been auto-edited by fixincludes from:
5 "/usr/include/X11/Xtrans/Xtransint.h"
7 This had to be done to correct non-standard usages in the
8 original, manufacturer supplied header file. */
10 /* $XdotOrg: xc/lib/xtrans/Xtransint.h,v 1.2 2004/04/23 18:44:27 eich Exp $ */
11 /* $Xorg: Xtransint.h,v 1.4 2001/02/09 02:04:06 xorgcvs Exp $ */
14 Copyright 1993, 1994, 1998 The Open Group
16 Permission to use, copy, modify, distribute, and sell this software and its
17 documentation for any purpose is hereby granted without fee, provided that
18 the above copyright notice appear in all copies and that both that
19 copyright notice and this permission notice appear in supporting
22 The above copyright notice and this permission notice shall be included
23 in all copies or substantial portions of the Software.
25 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
29 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
30 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31 OTHER DEALINGS IN THE SOFTWARE.
33 Except as contained in this notice, the name of The Open Group shall
34 not be used in advertising or otherwise to promote the sale, use or
35 other dealings in this Software without prior written authorization
39 /* $XFree86: xc/lib/xtrans/Xtransint.h,v 3.41 2003/08/28 00:35:23 tsi Exp $ */
41 /* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
45 * Permission to use, copy, modify, and distribute this software and its
46 * documentation for any purpose and without fee is hereby granted, provided
47 * that the above copyright notice appear in all copies and that both that
48 * copyright notice and this permission notice appear in supporting
49 * documentation, and that the name NCR not be used in advertising
50 * or publicity pertaining to distribution of the software without specific,
51 * written prior permission. NCR makes no representations about the
52 * suitability of this software for any purpose. It is provided "as is"
53 * without express or implied warranty.
55 * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
56 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
57 * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
58 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
59 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
60 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
61 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
68 * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport
69 * Interface code. Each use of the PRMSG macro has a level associated with
70 * it. XTRANSDEBUG is defined to be a level. If the invocation level is =<
71 * the value of XTRANSDEBUG, then the message will be printed out to stderr.
72 * Recommended levels are:
74 * XTRANSDEBUG=1 Error messages
75 * XTRANSDEBUG=2 API Function Tracing
76 * XTRANSDEBUG=3 All Function Tracing
77 * XTRANSDEBUG=4 printing of intermediate values
78 * XTRANSDEBUG=5 really detailed stuff
81 * Defining XTRANSDEBUGTIMESTAMP will cause printing timestamps with each
87 # define XTRANSDEBUG 1
89 # define XTRANSDEBUG 1
94 # define _WILLWINSOCK_
101 #endif /* XTRANSDEBUG */
107 # include <sys/socket.h>
111 # include <netinet/in.h>
112 # include <arpa/inet.h>
114 # include <sys/ioctl.h>
118 * Moved the setting of NEED_UTSNAME to this header file from Xtrans.c,
119 * to avoid a race condition. JKJ (6/5/97)
122 # if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(hpux) || defined(USG) || defined(SVR4) || defined(__SCO__)
123 # ifndef NEED_UTSNAME
124 # define NEED_UTSNAME
126 # include <sys/utsname.h>
130 * makedepend screws up on #undef OPEN_MAX, so we define a new symbol
133 # ifndef TRANS_OPEN_MAX
136 # ifdef _POSIX_SOURCE
139 # define _POSIX_SOURCE
141 # undef _POSIX_SOURCE
145 # if defined(_SC_OPEN_MAX) && !defined(__UNIXOS2__)
146 # define OPEN_MAX (sysconf(_SC_OPEN_MAX))
149 # define OPEN_MAX 256
151 # include <sys/param.h>
154 # define OPEN_MAX 256
157 # define OPEN_MAX NOFILE
159 # if !defined(__UNIXOS2__) && !defined(__QNX__)
160 # define OPEN_MAX NOFILES_MAX
162 # define OPEN_MAX 256
170 # if defined(_SC_OPEN_MAX)
171 # define TRANS_OPEN_MAX OPEN_MAX
172 # else /* !__GNU__ */
174 # define TRANS_OPEN_MAX 256
176 # define TRANS_OPEN_MAX OPEN_MAX
180 # endif /* TRANS_OPEN_MAX */
185 # define ESET(val) errno = val
187 # define EGET() errno
191 # include <limits.h> /* for USHRT_MAX */
193 # define ESET(val) WSASetLastError(val)
194 # define EGET() WSAGetLastError()
201 #define X_TCP_PORT 6000
204 struct _XtransConnInfo {
205 struct _Xtransport *transptr;
218 #define XTRANS_OPEN_COTS_CLIENT 1
219 #define XTRANS_OPEN_COTS_SERVER 2
220 #define XTRANS_OPEN_CLTS_CLIENT 3
221 #define XTRANS_OPEN_CLTS_SERVER 4
224 typedef struct _Xtransport {
230 XtransConnInfo (*OpenCOTSClient)(
231 struct _Xtransport *, /* transport */
232 char *, /* protocol */
237 #endif /* TRANS_CLIENT */
241 XtransConnInfo (*OpenCOTSServer)(
242 struct _Xtransport *, /* transport */
243 char *, /* protocol */
248 #endif /* TRANS_SERVER */
252 XtransConnInfo (*OpenCLTSClient)(
253 struct _Xtransport *, /* transport */
254 char *, /* protocol */
259 #endif /* TRANS_CLIENT */
263 XtransConnInfo (*OpenCLTSServer)(
264 struct _Xtransport *, /* transport */
265 char *, /* protocol */
270 #endif /* TRANS_SERVER */
275 XtransConnInfo (*ReopenCOTSServer)(
276 struct _Xtransport *, /* transport */
281 XtransConnInfo (*ReopenCLTSServer)(
282 struct _Xtransport *, /* transport */
287 #endif /* TRANS_REOPEN */
291 XtransConnInfo, /* connection */
298 # define ADDR_IN_USE_ALLOWED 1
300 int (*CreateListener)(
301 XtransConnInfo, /* connection */
303 unsigned int /* flags */
306 int (*ResetListener)(
307 XtransConnInfo /* connection */
310 XtransConnInfo (*Accept)(
311 XtransConnInfo, /* connection */
315 #endif /* TRANS_SERVER */
320 XtransConnInfo, /* connection */
325 #endif /* TRANS_CLIENT */
327 int (*BytesReadable)(
328 XtransConnInfo, /* connection */
329 BytesReadable_t * /* pend */
333 XtransConnInfo, /* connection */
339 XtransConnInfo, /* connection */
345 XtransConnInfo, /* connection */
346 struct iovec *, /* buf */
351 XtransConnInfo, /* connection */
352 struct iovec *, /* buf */
357 XtransConnInfo /* connection */
361 XtransConnInfo /* connection */
364 int (*CloseForCloning)(
365 XtransConnInfo /* connection */
371 typedef struct _Xtransport_table {
372 Xtransport *transport;
378 * Flags for the flags member of Xtransport.
381 #define TRANS_ALIAS (1<<0) /* record is an alias, don't create server */
382 #define TRANS_LOCAL (1<<1) /* local transport */
383 #define TRANS_DISABLED (1<<2) /* Don't open this one */
384 #define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */
385 #define TRANS_NOUNLINK (1<<4) /* Dont unlink transport endpoints */
387 /* Flags to preserve when setting others */
388 #define TRANS_KEEPFLAGS (TRANS_NOUNLINK)
391 * readv() and writev() don't exist or don't work correctly on some
392 * systems, so they may be emulated.
395 #if defined(CRAY) || (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
397 #define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt)
399 static int TRANS(ReadV)(
400 XtransConnInfo, /* ciptr */
401 struct iovec *, /* iov */
407 #define READV(ciptr, iov, iovcnt) readv(ciptr->fd, iov, iovcnt)
409 #endif /* CRAY || (SYSV && i386) || WIN32 || __sxg__ || */
412 #if defined(CRAY) || (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
414 #define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt)
416 static int TRANS(WriteV)(
417 XtransConnInfo, /* ciptr */
418 struct iovec *, /* iov */
424 #define WRITEV(ciptr, iov, iovcnt) writev(ciptr->fd, iov, iovcnt)
426 #endif /* CRAY || WIN32 || __sxg__ */
429 static int is_numeric (
434 static int trans_mkdir (
441 * Some XTRANSDEBUG stuff
444 #if defined(XTRANSDEBUG)
445 /* add hack to the format string to avoid warnings about extra arguments
448 #ifdef XTRANSDEBUGTIMESTAMP
449 #if defined(XSERV_t) && defined(TRANS_SERVER)
450 /* Use ErrorF() for the X server */
451 #define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
452 int hack= 0, saveerrno=errno; \
454 gettimeofday(&tp,0); \
455 ErrorF(__xtransname); \
456 ErrorF(x+hack,a,b,c); \
457 ErrorF("timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \
461 #define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
462 int hack= 0, saveerrno=errno; \
464 gettimeofday(&tp,0); \
465 fprintf(stderr, __xtransname); fflush(stderr); \
466 fprintf(stderr, x+hack,a,b,c); fflush(stderr); \
467 fprintf(stderr, "timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \
471 #endif /* XSERV_t && TRANS_SERVER */
472 #else /* XTRANSDEBUGTIMESTAMP */
473 #if defined(XSERV_t) && defined(TRANS_SERVER)
474 /* Use ErrorF() for the X server */
475 #define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
476 int hack= 0, saveerrno=errno; \
477 ErrorF(__xtransname); \
478 ErrorF(x+hack,a,b,c); \
482 #define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
483 int hack= 0, saveerrno=errno; \
484 fprintf(stderr, __xtransname); fflush(stderr); \
485 fprintf(stderr, x+hack,a,b,c); fflush(stderr); \
488 #endif /* XSERV_t && TRANS_SERVER */
489 #endif /* XTRANSDEBUGTIMESTAMP */
491 #define PRMSG(lvl,x,a,b,c) ((void)0)
492 #endif /* XTRANSDEBUG */
494 #endif /* _XTRANSINT_H_ */