824N/A/* $XConsortium: Xstreams.h,v 1.6 91/07/19 23:22:53 gildea Exp $ */
824N/A/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
824N/A/* Copyright (c) 1988 AT&T */
824N/A/* All Rights Reserved */
824N/A
824N/A/*
824N/A * Permission to use, copy, modify, and distribute this software and its
824N/A * documentation for any purpose and without fee is hereby granted, provided
824N/A * that the above copyright notice appear in all copies and that both that
824N/A * copyright notice and this permission notice appear in supporting
824N/A * documentation, and that the name of AT&T or USL not be used in advertising
824N/A * or publicity pertaining to distribution of the software without specific,
824N/A * written prior permission. AT&T and USL make no representations about the
824N/A * suitability of this software for any purpose. It is provided "as is"
824N/A * without express or implied warranty.
824N/A *
824N/A * AT&T and USL DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
824N/A * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
824N/A * NO EVENT SHALL AT&T or USL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
824N/A * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
824N/A * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
824N/A * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
824N/A * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
824N/A */
824N/A/* $XFree86$ */
824N/A
824N/A
824N/A#ifndef _XSTREAMS_H_
824N/A#define _XSTREAMS_H_
824N/A/*
824N/A Xstreams.h (C header file)
824N/A Acc: 575304412 Tue Apr 26 09:46:52 1988
824N/A Mod: 574017273 Tue Apr 26 12:14:33 1988
824N/A Sta: 574017273 Tue Apr 26 12:14:33 1988
824N/A Owner: 2011
824N/A Group: 1985
824N/A Permissions: 644
824N/A*/
824N/A/*
824N/A START USER STAMP AREA
824N/A*/
824N/A/*
824N/A END USER STAMP AREA
824N/A*/
824N/A
824N/A
824N/A
824N/A#define MEM_ALLIGN(ptr) ((((unsigned) (ptr + 3)) >> 2) << 2)
824N/A
824N/A#define CONNECT_TIMEOUT 60
824N/A#define MAX_AUTO_BUF_LEN 256
824N/A#define MAX_DISP_DIGITS 20
824N/A#define MAX_NETS 8
824N/A
824N/Atypedef struct _host {
824N/A char host_name[32];
824N/A int host_len;
824N/A struct _host *next;
824N/A} HOST;
824N/A
824N/A/*
824N/A * Structure for handling multiple connection requests on the same stream.
824N/A */
824N/A
824N/Astruct listenCall {
824N/A struct t_call *CurrentCall;
824N/A struct listenCall *NextCall;
824N/A};
824N/A
824N/Astruct listenQue {
824N/A struct listenCall *QueHead;
824N/A struct listenCall *QueTail;
824N/A};
824N/A
824N/A#define EMPTY(p) (p->QueHead == (struct listenCall *) NULL)
824N/A
824N/A
824N/Atypedef struct {
824N/A int flags;
824N/A char type;
824N/A int display;
824N/A char *inputbuf;
824N/A int buflen;
824N/A int bufptr;
824N/A int msglen;
824N/A } IOBUFFER;
824N/A
824N/Atypedef struct {
824N/A int _nnets;
824N/A#ifdef SVR4
824N/A struct netconfig *_net[MAX_NETS];
824N/A#else
824N/A char *_net[MAX_NETS];
824N/A#endif
824N/A struct listenQue FreeList[MAX_NETS];
824N/A struct listenQue PendingQue[MAX_NETS];
824N/A int _npeers;
824N/A char **_peer;
824N/A int *_peerlen;
824N/A HOST *_validhosts;
824N/A } networkInfo;
824N/A
824N/A
824N/Atypedef struct _Xstream {
824N/A int (*SetupTheListener)();
824N/A int (*ConnectNewClient)();
824N/A int (*CallTheListener)();
824N/A int (*ReadFromStream)();
824N/A int (*BytesCanBeRead)();
824N/A int (*WriteToStream)();
824N/A int (*CloseStream)();
824N/A int (*CreateAddress)();
824N/A union ext {
824N/A int (*NameServer)();
824N/A networkInfo *NetInfo;
824N/A } u;
824N/A } Xstream;
824N/A
824N/A/* old shared libraries have the names already fixed */
824N/A#ifdef USL_COMPAT
824N/A#define _XsStream xstream
824N/A#define _XReadV _readv
824N/A#define _XWriteV _writev
824N/A#define _XSelect XSelect
824N/A#define _XsErrorCall ErrorCall
824N/A#define _XsSetupLocalStream SetupLocalStream
824N/A#define _XsConnectLocalClient ConnectLocalClient
824N/A#define _XsOpenSpServer OpenSpServer
824N/A#define _XsReadLocalStream ReadLocalStream
824N/A#define _XsConnectTliClient ConnectTliClient
824N/A#define _XsSetupTliStrean SetupTliStream
824N/A#define _XsCallTliServer CallTliServer
824N/A#define _XsCallLocalServer CallLocalServer
824N/A#define _XsTypeOfStream TypeOfStream
824N/A#ifdef SVR4
824N/A#define _XsSetupNamedStream SetupNamedStream
824N/A#define _XsSetupSpStream SetupSpStream
824N/A#endif /* SVR4 */
824N/A#endif /* USL_COMPAT */
824N/A
824N/Aextern Xstream _XsStream[];
824N/A
824N/A#define NO_BUFFERING 0
824N/A#define BUFFERING 1
824N/A
824N/A/* Network services */
824N/A
824N/A#define OpenDaemonConnection 0
824N/A#define PEER_NAME 1
824N/A#define PEER_ALLOC 2
824N/A#define PEER_FREE 3
824N/A#define ConvertNetAddrToName 4
824N/A#define ConvertNameToNetAddr 5
824N/A#define ConvertNameToTliCall 6
824N/A#define ConvertTliCallToName 7
824N/A#define ConvertNameToTliBind 8
824N/A
824N/A#define UNAME_LENGTH 14
824N/A
824N/A#define X_LOCAL_STREAM 0
824N/A#define X_NAMED_STREAM 1
824N/A/* Enhanced Application Compatibility Support */
824N/A#define X_SP_STREAM 2
824N/A/* End Enhanced Application Compatibility Support */
824N/A
824N/A#define X_TLI_STREAM 3
824N/A#define CLOSED_STREAM -1
824N/A
824N/A/*
824N/A The following are defined in X.h. Any changes to FamilyUname
824N/A should take X.h into consideration.
824N/A*/
824N/A /* protocol families */
824N/A
824N/A /*
824N/A
824N/A #define FamilyInternet 0
824N/A #define FamilyDECnet 1
824N/A #define FamilyChaos 2
824N/A
824N/A */
824N/A
824N/A#define FamilyUname 3
824N/A
824N/A#define X_TCP_PORT 6000
824N/A
824N/A#define NAMED_LISTENER "/dev/X/Nserver"
824N/A#define LOCAL_LISTENER "/dev/X/server"
824N/A/* Enhanced Application Compatibility Support */
824N/A/* End Enhanced Application Compatibility Support */
824N/A
824N/A#define NAME_SERVER_NODE "/dev/X/nameserver"
824N/A#define XNETSPECDIR "lib/net"
824N/A#define XROOTDIR "/usr/X"
824N/A
824N/A#define MAX_SIMUL_TLI_CALLS 20
824N/A
824N/A#define SetupNetworkInfo() _XsStream[X_LOCAL_STREAM].u.NetInfo = &Network; \
824N/A _XsStream[X_NAMED_STREAM].u.NetInfo = &Network; \
824N/A/* Enhanced Application Compatibility Support */ \
824N/A/* End Enhanced Application Compatibility Support */ \
824N/A _XsStream[X_TLI_STREAM].u.NameServer = nameserver
824N/A
824N/A#define NetworkInfo (_XsStream[X_LOCAL_STREAM].u.NetInfo)
824N/A#define GetNetworkInfo (*_XsStream[X_TLI_STREAM].u.NameServer)
824N/A#define validhosts _XsStream[X_LOCAL_STREAM].u.NetInfo->_validhosts
824N/A
824N/A/*
824N/A * header of messages sent by X to the nameserver
824N/A * 1st int: the size of the entire message.
824N/A * 2nd int: the size of the header itself.
824N/A * 3rd int: the service number.
824N/A * 4th int: the display number.
824N/A * 5th int: the length of the network name.
824N/A */
824N/A
824N/A#define HEADERSIZE (5*sizeof(int))
824N/A#endif /* _XSTREAMS_H_ */