Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:26:38

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 #if defined(IPv6) && defined(AF_INET6)
0135 typedef struct sockaddr_storage Xtransaddr;
0136 #else
0137 #define XTRANS_MAX_ADDR_LEN 128 /* large enough to hold sun_path */
0138 
0139 typedef struct {
0140     unsigned char   addr[XTRANS_MAX_ADDR_LEN];
0141 } Xtransaddr;
0142 #endif
0143 
0144 #ifdef LONG64
0145 typedef int BytesReadable_t;
0146 #else
0147 typedef long BytesReadable_t;
0148 #endif
0149 
0150 
0151 #if defined(WIN32)
0152 
0153 /*
0154  *      TRANS(Readv) and TRANS(Writev) use struct iovec, normally found
0155  *      in Berkeley systems in <sys/uio.h>.  See the readv(2) and writev(2)
0156  *      manual pages for details.
0157  */
0158 
0159 struct iovec {
0160     caddr_t iov_base;
0161     int iov_len;
0162 };
0163 
0164 #else
0165 #include <sys/uio.h>
0166 #endif
0167 
0168 typedef struct _XtransConnInfo *XtransConnInfo;
0169 
0170 
0171 /*
0172  * Transport Option definitions
0173  */
0174 
0175 #define TRANS_NONBLOCKING   1
0176 #define TRANS_CLOSEONEXEC   2
0177 
0178 
0179 /*
0180  * Return values of Connect (0 is success)
0181  */
0182 
0183 #define TRANS_CONNECT_FAILED    -1
0184 #define TRANS_TRY_CONNECT_AGAIN -2
0185 #define TRANS_IN_PROGRESS   -3
0186 
0187 
0188 /*
0189  * Return values of CreateListener (0 is success)
0190  */
0191 
0192 #define TRANS_CREATE_LISTENER_FAILED    -1
0193 #define TRANS_ADDR_IN_USE       -2
0194 
0195 
0196 /*
0197  * Return values of Accept (0 is success)
0198  */
0199 
0200 #define TRANS_ACCEPT_BAD_MALLOC         -1
0201 #define TRANS_ACCEPT_FAILED             -2
0202 #define TRANS_ACCEPT_MISC_ERROR         -3
0203 
0204 
0205 /*
0206  * ResetListener return values
0207  */
0208 
0209 #define TRANS_RESET_NOOP    1
0210 #define TRANS_RESET_NEW_FD  2
0211 #define TRANS_RESET_FAILURE 3
0212 
0213 
0214 /*
0215  * Function prototypes for the exposed interface
0216  */
0217 
0218 void TRANS(FreeConnInfo) (
0219     XtransConnInfo  /* ciptr */
0220 );
0221 
0222 #ifdef TRANS_CLIENT
0223 
0224 XtransConnInfo TRANS(OpenCOTSClient)(
0225     const char *    /* address */
0226 );
0227 
0228 #endif /* TRANS_CLIENT */
0229 
0230 #ifdef TRANS_SERVER
0231 
0232 XtransConnInfo TRANS(OpenCOTSServer)(
0233     const char *    /* address */
0234 );
0235 
0236 #endif /* TRANS_SERVER */
0237 
0238 #ifdef TRANS_REOPEN
0239 
0240 XtransConnInfo TRANS(ReopenCOTSServer)(
0241     int,        /* trans_id */
0242     int,        /* fd */
0243     const char *    /* port */
0244 );
0245 
0246 int TRANS(GetReopenInfo)(
0247     XtransConnInfo, /* ciptr */
0248     int *,      /* trans_id */
0249     int *,      /* fd */
0250     char **     /* port */
0251 );
0252 
0253 #endif /* TRANS_REOPEN */
0254 
0255 
0256 int TRANS(SetOption)(
0257     XtransConnInfo, /* ciptr */
0258     int,        /* option */
0259     int         /* arg */
0260 );
0261 
0262 #ifdef TRANS_SERVER
0263 
0264 int TRANS(CreateListener)(
0265     XtransConnInfo, /* ciptr */
0266     const char *,   /* port */
0267     unsigned int    /* flags */
0268 );
0269 
0270 int TRANS(Received) (
0271     const char*         /* protocol*/
0272 );
0273 
0274 int TRANS(NoListen) (
0275     const char*         /* protocol*/
0276 );
0277 
0278 int TRANS(Listen) (
0279     const char*         /* protocol*/
0280 );
0281 
0282 int TRANS(IsListening) (
0283     const char*         /* protocol*/
0284 );
0285 
0286 int TRANS(ResetListener)(
0287     XtransConnInfo  /* ciptr */
0288 );
0289 
0290 XtransConnInfo TRANS(Accept)(
0291     XtransConnInfo, /* ciptr */
0292     int *       /* status */
0293 );
0294 
0295 #endif /* TRANS_SERVER */
0296 
0297 #ifdef TRANS_CLIENT
0298 
0299 int TRANS(Connect)(
0300     XtransConnInfo, /* ciptr */
0301     const char *    /* address */
0302 );
0303 
0304 #endif /* TRANS_CLIENT */
0305 
0306 int TRANS(BytesReadable)(
0307     XtransConnInfo, /* ciptr */
0308     BytesReadable_t *   /* pend */
0309 );
0310 
0311 int TRANS(Read)(
0312     XtransConnInfo, /* ciptr */
0313     char *,     /* buf */
0314     int         /* size */
0315 );
0316 
0317 int TRANS(Write)(
0318     XtransConnInfo, /* ciptr */
0319     char *,     /* buf */
0320     int         /* size */
0321 );
0322 
0323 int TRANS(Readv)(
0324     XtransConnInfo, /* ciptr */
0325     struct iovec *, /* buf */
0326     int         /* size */
0327 );
0328 
0329 int TRANS(Writev)(
0330     XtransConnInfo, /* ciptr */
0331     struct iovec *, /* buf */
0332     int         /* size */
0333 );
0334 
0335 int TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close);
0336 
0337 int TRANS(RecvFd) (XtransConnInfo ciptr);
0338 
0339 int TRANS(Disconnect)(
0340     XtransConnInfo  /* ciptr */
0341 );
0342 
0343 int TRANS(Close)(
0344     XtransConnInfo  /* ciptr */
0345 );
0346 
0347 int TRANS(CloseForCloning)(
0348     XtransConnInfo  /* ciptr */
0349 );
0350 
0351 int TRANS(IsLocal)(
0352     XtransConnInfo  /* ciptr */
0353 );
0354 
0355 int TRANS(GetPeerAddr)(
0356     XtransConnInfo, /* ciptr */
0357     int *,      /* familyp */
0358     int *,      /* addrlenp */
0359     Xtransaddr **   /* addrp */
0360 );
0361 
0362 int TRANS(GetConnectionNumber)(
0363     XtransConnInfo  /* ciptr */
0364 );
0365 
0366 #ifdef TRANS_SERVER
0367 
0368 int TRANS(MakeAllCOTSServerListeners)(
0369     const char *,   /* port */
0370     int *,      /* partial */
0371     int *,      /* count_ret */
0372     XtransConnInfo **   /* ciptrs_ret */
0373 );
0374 
0375 #endif /* TRANS_SERVER */
0376 
0377 
0378 /*
0379  * Function Prototypes for Utility Functions.
0380  */
0381 
0382 #ifdef X11_t
0383 
0384 int TRANS(ConvertAddress)(
0385     int *,      /* familyp */
0386     int *,      /* addrlenp */
0387     Xtransaddr **   /* addrp */
0388 );
0389 
0390 #endif /* X11_t */
0391 
0392 #ifdef ICE_t
0393 
0394 char *
0395 TRANS(GetMyNetworkId)(
0396     XtransConnInfo  /* ciptr */
0397 );
0398 
0399 char *
0400 TRANS(GetPeerNetworkId)(
0401     XtransConnInfo  /* ciptr */
0402 );
0403 
0404 #endif /* ICE_t */
0405 
0406 int
0407 TRANS(GetHostname) (
0408     char *  /* buf */,
0409     int     /* maxlen */
0410 );
0411 
0412 #if defined(WIN32) && defined(TCPCONN)
0413 int TRANS(WSAStartup)();
0414 #endif
0415 
0416 #endif /* _XTRANS_H_ */