Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 09:18:46

0001 /*
0002 
0003 Copyright 1993, 1994, 1998  The Open Group
0004 
0005 Permission to use, copy, modify, distribute, and sell this software and its
0006 documentation for any purpose is hereby granted without fee, provided that
0007 the above copyright notice appear in all copies and that both that
0008 copyright notice and this permission notice appear in supporting
0009 documentation.
0010 
0011 The above copyright notice and this permission notice shall be included
0012 in all copies or substantial portions of the Software.
0013 
0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0015 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0016 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
0017 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020 OTHER DEALINGS IN THE SOFTWARE.
0021 
0022 Except as contained in this notice, the name of The Open Group shall
0023 not be used in advertising or otherwise to promote the sale, use or
0024 other dealings in this Software without prior written authorization
0025 from The Open Group.
0026 
0027  * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
0028  *
0029  * All Rights Reserved
0030  *
0031  * Permission to use, copy, modify, and distribute this software and its
0032  * documentation for any purpose and without fee is hereby granted, provided
0033  * that the above copyright notice appear in all copies and that both that
0034  * copyright notice and this permission notice appear in supporting
0035  * documentation, and that the name NCR not be used in advertising
0036  * or publicity pertaining to distribution of the software without specific,
0037  * written prior permission.  NCR makes no representations about the
0038  * suitability of this software for any purpose.  It is provided "as is"
0039  * without express or implied warranty.
0040  *
0041  * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
0042  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
0043  * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
0044  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
0045  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
0046  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
0047  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0048  */
0049 
0050 #ifndef _XTRANS_H_
0051 #define _XTRANS_H_
0052 
0053 #include <X11/Xfuncproto.h>
0054 #include <X11/Xos.h>
0055 #include <X11/Xmd.h>
0056 
0057 #ifndef WIN32
0058 #include <sys/socket.h>
0059 #endif
0060 
0061 #ifdef __clang__
0062 /* Not all clients make use of all provided statics */
0063 #pragma clang diagnostic push
0064 #pragma clang diagnostic ignored "-Wunused-function"
0065 #endif
0066 
0067 /*
0068  * Set the functions names according to where this code is being compiled.
0069  */
0070 
0071 #ifdef X11_t
0072 #define TRANS(func) _X11Trans##func
0073 #ifdef XTRANSDEBUG
0074 static const char *__xtransname = "_X11Trans";
0075 #endif
0076 #endif /* X11_t */
0077 
0078 #ifdef XSERV_t
0079 #define TRANS(func) _XSERVTrans##func
0080 #ifdef XTRANSDEBUG
0081 static const char *__xtransname = "_XSERVTrans";
0082 #endif
0083 #define X11_t
0084 #endif /* XSERV_t */
0085 
0086 #ifdef XIM_t
0087 #define TRANS(func) _XimXTrans##func
0088 #ifdef XTRANSDEBUG
0089 static const char *__xtransname = "_XimTrans";
0090 #endif
0091 #endif /* XIM_t */
0092 
0093 #ifdef FS_t
0094 #define TRANS(func) _FSTrans##func
0095 #ifdef XTRANSDEBUG
0096 static const char *__xtransname = "_FSTrans";
0097 #endif
0098 #endif /* FS_t */
0099 
0100 #ifdef FONT_t
0101 #define TRANS(func) _FontTrans##func
0102 #ifdef XTRANSDEBUG
0103 static const char *__xtransname = "_FontTrans";
0104 #endif
0105 #endif /* FONT_t */
0106 
0107 #ifdef ICE_t
0108 #define TRANS(func) _IceTrans##func
0109 #ifdef XTRANSDEBUG
0110 static const char *__xtransname = "_IceTrans";
0111 #endif
0112 #endif /* ICE_t */
0113 
0114 #if !defined(TRANS)
0115 #define TRANS(func) _XTrans##func
0116 #ifdef XTRANSDEBUG
0117 static const char *__xtransname = "_XTrans";
0118 #endif
0119 #endif /* !TRANS */
0120 
0121 #ifdef __clang__
0122 #pragma clang diagnostic pop
0123 #endif
0124 
0125 /*
0126  * Create a single address structure that can be used wherever
0127  * an address structure is needed. struct sockaddr is not big enough
0128  * to hold a sockadd_un, so we create this definition to have a single
0129  * structure that is big enough for all the structures we might need.
0130  *
0131  * This structure needs to be independent of the socket/TLI interface used.
0132  */
0133 
0134 /* Temporary workaround for consumers whose configure scripts were
0135    generated with pre-1.6 versions of xtrans.m4 */
0136 #if defined(IPv6) && !defined(HAVE_STRUCT_SOCKADDR_STORAGE)
0137 #define HAVE_STRUCT_SOCKADDR_STORAGE
0138 #endif
0139 
0140 #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
0141 typedef struct sockaddr_storage Xtransaddr;
0142 #else
0143 #define XTRANS_MAX_ADDR_LEN 128 /* large enough to hold sun_path */
0144 
0145 typedef struct {
0146     unsigned char   addr[XTRANS_MAX_ADDR_LEN];
0147 } Xtransaddr;
0148 #endif
0149 
0150 #ifdef LONG64
0151 typedef int BytesReadable_t;
0152 #else
0153 typedef long BytesReadable_t;
0154 #endif
0155 
0156 
0157 #if defined(WIN32)
0158 
0159 /*
0160  *      TRANS(Readv) and TRANS(Writev) use struct iovec, normally found
0161  *      in Berkeley systems in <sys/uio.h>.  See the readv(2) and writev(2)
0162  *      manual pages for details.
0163  */
0164 
0165 struct iovec {
0166     caddr_t iov_base;
0167     int iov_len;
0168 };
0169 
0170 #else
0171 #include <sys/uio.h>
0172 #endif
0173 
0174 typedef struct _XtransConnInfo *XtransConnInfo;
0175 
0176 
0177 /*
0178  * Transport Option definitions
0179  */
0180 
0181 #define TRANS_NONBLOCKING   1
0182 #define TRANS_CLOSEONEXEC   2
0183 
0184 
0185 /*
0186  * Return values of Connect (0 is success)
0187  */
0188 
0189 #define TRANS_CONNECT_FAILED    -1
0190 #define TRANS_TRY_CONNECT_AGAIN -2
0191 #define TRANS_IN_PROGRESS   -3
0192 
0193 
0194 /*
0195  * Return values of CreateListener (0 is success)
0196  */
0197 
0198 #define TRANS_CREATE_LISTENER_FAILED    -1
0199 #define TRANS_ADDR_IN_USE       -2
0200 
0201 
0202 /*
0203  * Return values of Accept (0 is success)
0204  */
0205 
0206 #define TRANS_ACCEPT_BAD_MALLOC         -1
0207 #define TRANS_ACCEPT_FAILED             -2
0208 #define TRANS_ACCEPT_MISC_ERROR         -3
0209 
0210 
0211 /*
0212  * ResetListener return values
0213  */
0214 
0215 #define TRANS_RESET_NOOP    1
0216 #define TRANS_RESET_NEW_FD  2
0217 #define TRANS_RESET_FAILURE 3
0218 
0219 
0220 /*
0221  * Function prototypes for the exposed interface
0222  */
0223 
0224 void TRANS(FreeConnInfo) (
0225     XtransConnInfo  /* ciptr */
0226 );
0227 
0228 #ifdef TRANS_CLIENT
0229 
0230 XtransConnInfo TRANS(OpenCOTSClient)(
0231     const char *    /* address */
0232 );
0233 
0234 #endif /* TRANS_CLIENT */
0235 
0236 #ifdef TRANS_SERVER
0237 
0238 XtransConnInfo TRANS(OpenCOTSServer)(
0239     const char *    /* address */
0240 );
0241 
0242 #endif /* TRANS_SERVER */
0243 
0244 #ifdef TRANS_REOPEN
0245 
0246 XtransConnInfo TRANS(ReopenCOTSServer)(
0247     int,        /* trans_id */
0248     int,        /* fd */
0249     const char *    /* port */
0250 );
0251 
0252 int TRANS(GetReopenInfo)(
0253     XtransConnInfo, /* ciptr */
0254     int *,      /* trans_id */
0255     int *,      /* fd */
0256     char **     /* port */
0257 );
0258 
0259 #endif /* TRANS_REOPEN */
0260 
0261 
0262 int TRANS(SetOption)(
0263     XtransConnInfo, /* ciptr */
0264     int,        /* option */
0265     int         /* arg */
0266 );
0267 
0268 #ifdef TRANS_SERVER
0269 
0270 int TRANS(CreateListener)(
0271     XtransConnInfo, /* ciptr */
0272     const char *,   /* port */
0273     unsigned int    /* flags */
0274 );
0275 
0276 int TRANS(Received) (
0277     const char*         /* protocol*/
0278 );
0279 
0280 int TRANS(NoListen) (
0281     const char*         /* protocol*/
0282 );
0283 
0284 int TRANS(Listen) (
0285     const char*         /* protocol*/
0286 );
0287 
0288 int TRANS(IsListening) (
0289     const char*         /* protocol*/
0290 );
0291 
0292 int TRANS(ResetListener)(
0293     XtransConnInfo  /* ciptr */
0294 );
0295 
0296 XtransConnInfo TRANS(Accept)(
0297     XtransConnInfo, /* ciptr */
0298     int *       /* status */
0299 );
0300 
0301 #endif /* TRANS_SERVER */
0302 
0303 #ifdef TRANS_CLIENT
0304 
0305 int TRANS(Connect)(
0306     XtransConnInfo, /* ciptr */
0307     const char *    /* address */
0308 );
0309 
0310 #endif /* TRANS_CLIENT */
0311 
0312 int TRANS(BytesReadable)(
0313     XtransConnInfo, /* ciptr */
0314     BytesReadable_t *   /* pend */
0315 );
0316 
0317 int TRANS(Read)(
0318     XtransConnInfo, /* ciptr */
0319     char *,     /* buf */
0320     int         /* size */
0321 );
0322 
0323 int TRANS(Write)(
0324     XtransConnInfo, /* ciptr */
0325     const char *,   /* buf */
0326     int         /* size */
0327 );
0328 
0329 int TRANS(Readv)(
0330     XtransConnInfo, /* ciptr */
0331     struct iovec *, /* buf */
0332     int         /* size */
0333 );
0334 
0335 int TRANS(Writev)(
0336     XtransConnInfo, /* ciptr */
0337     struct iovec *, /* buf */
0338     int         /* size */
0339 );
0340 
0341 int TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close);
0342 
0343 int TRANS(RecvFd) (XtransConnInfo ciptr);
0344 
0345 int TRANS(Disconnect)(
0346     XtransConnInfo  /* ciptr */
0347 );
0348 
0349 int TRANS(Close)(
0350     XtransConnInfo  /* ciptr */
0351 );
0352 
0353 int TRANS(CloseForCloning)(
0354     XtransConnInfo  /* ciptr */
0355 );
0356 
0357 int TRANS(IsLocal)(
0358     XtransConnInfo  /* ciptr */
0359 );
0360 
0361 int TRANS(GetPeerAddr)(
0362     XtransConnInfo, /* ciptr */
0363     int *,      /* familyp */
0364     int *,      /* addrlenp */
0365     Xtransaddr **   /* addrp */
0366 );
0367 
0368 int TRANS(GetConnectionNumber)(
0369     XtransConnInfo  /* ciptr */
0370 );
0371 
0372 #ifdef TRANS_SERVER
0373 
0374 int TRANS(MakeAllCOTSServerListeners)(
0375     const char *,   /* port */
0376     int *,      /* partial */
0377     int *,      /* count_ret */
0378     XtransConnInfo **   /* ciptrs_ret */
0379 );
0380 
0381 #endif /* TRANS_SERVER */
0382 
0383 
0384 /*
0385  * Function Prototypes for Utility Functions.
0386  */
0387 
0388 #ifdef X11_t
0389 
0390 int TRANS(ConvertAddress)(
0391     int *,      /* familyp */
0392     int *,      /* addrlenp */
0393     Xtransaddr **   /* addrp */
0394 );
0395 
0396 #endif /* X11_t */
0397 
0398 #ifdef ICE_t
0399 
0400 char *
0401 TRANS(GetMyNetworkId)(
0402     XtransConnInfo  /* ciptr */
0403 );
0404 
0405 char *
0406 TRANS(GetPeerNetworkId)(
0407     XtransConnInfo  /* ciptr */
0408 );
0409 
0410 #endif /* ICE_t */
0411 
0412 int
0413 TRANS(GetHostname) (
0414     char *  /* buf */,
0415     int     /* maxlen */
0416 );
0417 
0418 #if defined(WIN32) && defined(TCPCONN)
0419 int TRANS(WSAStartup)();
0420 #endif
0421 
0422 #endif /* _XTRANS_H_ */