Debian Codegraph @

xpa/xpap.h

raw symbols SCIP
1 /*
2 * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
3 */
4
5 /*
6 *
7 * xpa.h - include file for the X Public Access mechanism
8 *
9 */
10 #ifndef __xpap_h
11 #define __xpap_h
12
13 #if HAVE_CONFIG_H
14 #include <conf.h>
15 #endif
16
17 /* avoid use of system -- its not secure */
18 #if USE_SPAWN == 0
19 #define USE_LAUNCH 1
20 #endif
21
22 #if HAVE_UNISTD_H
23 #include <unistd.h>
24 #endif
25 #if HAVE_STRING_H
26 #include <string.h>
27 #endif
28 #if HAVE_STDLIB_H
29 #include <stdlib.h>
30 #endif
31 #if HAVE_MALLOC_H
32 #include <malloc.h>
33 #endif
34 #if HAVE_GETOPT_H
35 #include <getopt.h>
36 #endif
37 #if HAVE_SETJMP_H
38 #include <setjmp.h>
39 #endif
40 #if HAVE_PWD_H
41 #include <pwd.h>
42 #endif
43 #include <ctype.h>
44 #include <fcntl.h>
45 #include <errno.h>
46 #include <signal.h>
47 #include <time.h>
48 #include <sys/types.h>
49 #include <sys/time.h>
50 #include <sys/stat.h>
51 #ifdef __STDC__
52 #include <stdarg.h>
53 #else
54 #include <varargs.h>
55 #endif
56 #include <xport.h>
57 #include <tcp.h>
58 #include <word.h>
59 #include <xalloc.h>
60 #include <find.h>
61 #if USE_LAUNCH
62 #include <xlaunch.h>
63 #endif
64 #include <timedconn.h>
65
66 /* [email protected] 2009-09-21 */
67 #if HAVE_MINGW32
68 #ifdef HAVE_ATEXIT
69 #undef HAVE_ATEXIT
70 #endif
71 #endif
72
73 /* make sure socklen_t is available, since some systems don't use it */
74 #ifndef HAVE_SOCKLEN_T
75 #define socklen_t int
76 #endif
77
78 /* the flag for setting non-blocking I/O varies a bit from Unix to Unix */
79 #ifndef O_NONBLOCK
80 #ifdef O_NDELAY
81 #define O_NONBLOCK O_NDELAY
82 #endif
83 #endif
84
85 #if HAVE_MINGW32==0
86 /* we always want to know about errors when a read/write would block */
87 #ifndef EWOULDBLOCK
88 #ifdef EAGAIN
89 #define EWOULDBLOCK EAGAIN
90 #endif
91 #else
92 #ifndef EAGAIN
93 #ifdef EWOULDBLOCK
94 #define EAGAIN EWOULDBLOCK
95 #endif
96 #endif
97 #endif
98 #endif
99
100 /* not all systems define shutdown() params */
101 #ifndef SHUT_RDWR
102 #define SHUT_RDWR 2
103 #endif
104
105 /* cisco routers can clear the URG flag by default, so use in-band */
106 #define USE_KA_OOB 0
107 /* KA_TYPE: 1->only access points, 2->only proxies 3->both */
108 #define DEF_KA_TYPE 2
109
110 /* for listen() routine */
111 #define XPA_MAXLISTEN 1000
112
113 /* status flags for xpa server */
114 #define XPA_STATUS_ACTIVE 1
115 #define XPA_STATUS_FREE 2
116 #define XPA_STATUS_READBUF 4
117 #define XPA_STATUS_ENDBUF 8
118
119 /* status flags for xpa clients */
120 #define XPA_CLIENT_IDLE 0
121 #define XPA_CLIENT_ACTIVE 1
122 #define XPA_CLIENT_PROCESSING 2
123 #define XPA_CLIENT_WAITING 3
124
125 /* server mode flags for receive, send, info */
126 /* crafted so that they are turned on by default */
127 #define XPA_MODE_BUF 1
128 #define XPA_MODE_FILLBUF 2
129 #define XPA_MODE_FREEBUF 4
130 #define XPA_MODE_ACL 8
131
132 /* default modes for receive, send, info */
133 #define XPA_DEF_MODE_REC (XPA_MODE_BUF|XPA_MODE_FILLBUF|XPA_MODE_FREEBUF|XPA_MODE_ACL)
134 #define XPA_DEF_MODE_SEND (XPA_MODE_BUF|XPA_MODE_FREEBUF|XPA_MODE_ACL)
135 #define XPA_DEF_MODE_INFO (XPA_MODE_ACL)
136
137 /* default client info string */
138 #define XPA_DEF_CLIENT_INFO "NONE"
139
140 /* client mode flags */
141 #define XPA_CLIENT_BUF 1
142 #define XPA_CLIENT_FD 2
143 #define XPA_CLIENT_ACK 4
144 #define XPA_CLIENT_VERIFY 8
145
146 /* client select mode flags */
147 #define XPA_CLIENT_SEL_XPA 1
148 #define XPA_CLIENT_SEL_FORK 2
149
150 /* error codes -- these must match the strings in xpaMessbuf in xpa.c */
151 /* always make 0 an OK return */
152 #define XPA_RTN_OK 0
153 #define XPA_RTN_NOAUTH 1
154 #define XPA_RTN_NOCONN 2
155 #define XPA_RTN_NOHOST 3
156 #define XPA_RTN_NOBUF 4
157 #define XPA_RTN_NOCMD 5
158 #define XPA_RTN_NOREC 6
159 #define XPA_RTN_NOSEND 7
160 #define XPA_RTN_NOINFO 8
161 #define XPA_RTN_UNCMD 9
162 #define XPA_RTN_NOCMD2 10
163 #define XPA_RTN_NOTARG 11
164 #define XPA_RTN_NOCMD3 12
165 #define XPA_RTN_NODATA 13
166 #define XPA_RTN_ILLCMD 14
167
168 /* connection methods */
169 #define XPA_INET 1
170 #define XPA_UNIX 2
171
172 /* select loop types */
173 #define XPA_XPA_LOOP 1
174 #define XPA_XT_LOOP 2
175 #define XPA_TCL_LOOP 3
176
177 /* name server management */
178 #define XPA_NSINET "$host:$port"
179 #define XPA_NSPORT 14285
180 #define XPA_NSUNIX "xpans_unix"
181 #define XPA_RETRIES 10
182 #define XPA_NSDELAY 150
183
184 /* access control */
185 #define XPA_ACLS "gisa"
186 #define XPA_ACLFILE "$HOME/acls.xpa"
187 #define XPA_DEFACL "*:* $host +; *:* $localhost +"
188
189 /* port management */
190 #define XPA_DEFPORT 28571
191 #define XPA_PORTFILE "$HOME/ports.xpa"
192
193 /* misc */
194 #define XPA_IOSIZE 4096
195 #define XPA_BIOSIZE 204800
196
197 #ifndef HAVE_CYGWIN
198 #define XPA_CONNECT_TIMEOUT_MODE 1
199 #else
200 /* cygwin does not support interruptible connect(), so we have
201 to use non-blocking connect, which is less portable in general */
202 #define XPA_CONNECT_TIMEOUT_MODE 2
203 #endif
204
205 /* these can be changed by user environment variable */
206 #define XPA_MAXHOSTS 100
207 #define XPA_SHORT_TIMEOUT 15
208 #define XPA_LONG_TIMEOUT 180
209 #define XPA_CONNECT_TIMEOUT 10
210 #define XPA_TMPDIR "/tmp/.xpa"
211 #define XPA_VERBOSITY 1
212 #define XPA_IOCALLSXPA 0
213
214 #define LOCALIP(ip) ((ip==gethostip("$localhost"))||(ip==gethostip("$host")))
215
216 #if HAVE_CYGWIN||HAVE_MINGW32
217 #define XPANSNAME "xpans.exe"
218 #else
219 #define XPANSNAME "xpans"
220 #endif
221
222 #define XPANS_CLASS "XPANS"
223 #define XPANS_NAME "xpans"
224
225 /* for debugging */
226 #define _sp XPALevelSpaces()
227
228 #include <xpa.h>
229
230 #endif /* __xpap.h */