1 /* $NCDId: @(#)Astreams.h,v 1.2 1994/05/02 17:41:16 greg Exp $ */ 2 /* $XConsortium: Xstreams.h,v 1.6 91/07/19 23:22:53 gildea Exp $ */ 3 /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 4 /* Copyright (c) 1988 AT&T */ 5 /* All Rights Reserved */ 6 7 /* 8 * Permission to use, copy, modify, and distribute this software and its 9 * documentation for any purpose and without fee is hereby granted, provided 10 * that the above copyright notice appear in all copies and that both that 11 * copyright notice and this permission notice appear in supporting 12 * documentation, and that the name of AT&T or USL not be used in advertising 13 * or publicity pertaining to distribution of the software without specific, 14 * written prior permission. AT&T and USL make no representations about the 15 * suitability of this software for any purpose. It is provided "as is" 16 * without express or implied warranty. 17 * 18 * AT&T and USL DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 19 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN 20 * NO EVENT SHALL AT&T or USL BE LIABLE FOR ANY SPECIAL, INDIRECT OR 21 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 22 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 23 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 24 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 */ 26 27 28 #ifndef _ASTREAMS_H_ 29 #define _ASTREAMS_H_ 30 /* 31 Xstreams.h (C header file) 32 Acc: 575304412 Tue Apr 26 09:46:52 1988 33 Mod: 574017273 Tue Apr 26 12:14:33 1988 34 Sta: 574017273 Tue Apr 26 12:14:33 1988 35 Owner: 2011 36 Group: 1985 37 Permissions: 644 38 */ 39 /* 40 START USER STAMP AREA 41 */ 42 /* 43 END USER STAMP AREA 44 */ 45 46 47 48 #define MEM_ALLIGN(ptr) ((((unsigned) (ptr + 3)) >> 2) << 2) 49 50 #define CONNECT_TIMEOUT 60 51 #define MAX_AUTO_BUF_LEN 256 52 #define MAX_DISP_DIGITS 20 53 #define MAX_NETS 8 54 55 typedef struct _host { 56 char host_name[32]; 57 int host_len; 58 struct _host *next; 59 } HOST; 60 61 /* 62 * Structure for handling multiple connection requests on the same stream. 63 */ 64 65 struct listenCall { 66 struct t_call *CurrentCall; 67 struct listenCall *NextCall; 68 }; 69 70 struct listenQue { 71 struct listenCall *QueHead; 72 struct listenCall *QueTail; 73 }; 74 75 #define EMPTY(p) (p->QueHead == (struct listenCall *) NULL) 76 77 78 typedef struct { 79 int flags; 80 char type; 81 int display; 82 char *inputbuf; 83 int buflen; 84 int bufptr; 85 int msglen; 86 } IOBUFFER; 87 88 typedef struct { 89 int _nnets; 90 #ifdef SVR4 91 struct netconfig *_net[MAX_NETS]; 92 #else 93 char *_net[MAX_NETS]; 94 #endif 95 struct listenQue FreeList[MAX_NETS]; 96 struct listenQue PendingQue[MAX_NETS]; 97 int _npeers; 98 char **_peer; 99 int *_peerlen; 100 HOST *_validhosts; 101 } networkInfo; 102 103 104 typedef struct _Austream { 105 int (*SetupTheListener)(); 106 int (*ConnectNewClient)(); 107 int (*CallTheListener)(); 108 int (*ReadFromStream)(); 109 int (*BytesCanBeRead)(); 110 int (*WriteToStream)(); 111 int (*CloseStream)(); 112 int (*CreateAddress)(); 113 union ext { 114 int (*NameServer)(); 115 networkInfo *NetInfo; 116 } u; 117 } Austream; 118 119 extern Austream _AusStream[]; 120 121 #define NO_BUFFERING 0 122 #define BUFFERING 1 123 124 /* Network services */ 125 126 #define OpenDaemonConnection 0 127 #define PEER_NAME 1 128 #define PEER_ALLOC 2 129 #define PEER_FREE 3 130 #define ConvertNetAddrToName 4 131 #define ConvertNameToNetAddr 5 132 #define ConvertNameToTliCall 6 133 #define ConvertTliCallToName 7 134 #define ConvertNameToTliBind 8 135 136 #define UNAME_LENGTH 14 137 138 #define Au_LOCAL_STREAM 0 139 #define Au_NAMED_STREAM 1 140 /* Enhanced Application Compatibility Support */ 141 #define Au_SP_STREAM 2 142 /* End Enhanced Application Compatibility Support */ 143 144 #define Au_TLI_STREAM 3 145 #define CLOSED_STREAM -1 146 147 /* 148 The following are defined in X.h. Any changes to FamilyUname 149 should take X.h into consideration. 150 */ 151 /* protocol families */ 152 153 /* 154 155 #define FamilyInternet 0 156 #define FamilyDECnet 1 157 #define FamilyChaos 2 158 159 */ 160 161 #define FamilyUname 3 162 163 #define Au_TCP_PORT 8000 164 165 /* JET - these need to agree with dia/connection.c */ 166 #define NAMED_LISTENER "/dev/Au/Nserver" 167 #define LOCAL_LISTENER "/dev/Au/server" 168 /* Enhanced Application Compatibility Support */ 169 /* End Enhanced Application Compatibility Support */ 170 171 #define NAME_SERVER_NODE "/dev/X/nameserver" 172 173 #define MAX_SIMUL_TLI_CALLS 20 174 175 #define SetupNetworkInfo() _AusStream[Au_LOCAL_STREAM].u.NetInfo = &Network; \ 176 _AusStream[Au_NAMED_STREAM].u.NetInfo = &Network; \ 177 /* Enhanced Application Compatibility Support */ \ 178 /* End Enhanced Application Compatibility Support */ \ 179 _AusStream[Au_TLI_STREAM].u.NameServer = nameserver 180 181 #define NetworkInfo (_AusStream[Au_LOCAL_STREAM].u.NetInfo) 182 #define GetNetworkInfo (*_AusStream[Au_TLI_STREAM].u.NameServer) 183 #define validhosts _AusStream[Au_LOCAL_STREAM].u.NetInfo->_validhosts 184 185 /* 186 * header of messages sent by Au to the nameserver 187 * 1st int: the size of the entire message. 188 * 2nd int: the size of the header itself. 189 * 3rd int: the service number. 190 * 4th int: the display number. 191 * 5th int: the length of the network name. 192 */ 193 194 #define HEADERSIZE (5*sizeof(int)) 195 #endif /* _ASTREAMS_H_ */ 196