Annotation of libwww/Library/src/wwwsys.html, revision 2.3
2.2 timbl 1: <HEADER>
2: <TITLE>System dependencies in the W3 library</TITLE>
3: <NEXTID N="4">
4: </HEADER>
5: <BODY>
6: <H1>System Dependencies</H1>System-system differences for TCP
7: include files and macros. This file
8: includes for each system the files
9: necessary for network and file I/O.
10: <H3>Authors</H3>
11: <DL>
12: <DT>TBL
13: <DD> Tim Berners-Lee, W3 project,
14: CERN, <timbl@info.cern.ch>
15: <DT>EvA
16: <DD> Eelco van Asperen <evas@cs.few.eur.nl>
17: <DT>MA
18: <DD> Marc Andreesen NCSA
19: <DT>AT
20: <DD> Aleksandar Totic (atotic@ncsa.uiuc.edu)
21: </DL>
22:
23: <H3>History:</H3>
24: <DL>
25: <DT>22 Feb 91
26: <DD> Written (TBL) as part of
27: the WWW library.
28: <DT>16 Jan 92
29: <DD> PC code from EvA
30: <DT>22 Apr 93
31: <DD> Merged diffs bits from
32: xmosaic release
33: </DL>
34:
2.1 timbl 35: <PRE>
36: #ifndef TCP_H
37: #define TCP_H
38:
2.2 timbl 39: </PRE>
40: <H2>Default values</H2>These values may be reset and altered
41: by system-specific sections later
42: on. there are also a bunch of <A
43: NAME=z2 HREF="#z1">defaults
2.3 ! timbl 44: at the end</A> .
2.2 timbl 45: <PRE>/* Default values of those: */
2.1 timbl 46: #define NETCLOSE close /* Routine to close a TCP-IP socket */
47: #define NETREAD read /* Routine to read from a TCP-IP socket */
48: #define NETWRITE write /* Routine to write to a TCP-IP socket */
49:
50: /* Unless stated otherwise, */
2.2 timbl 51: #define SELECT /* Can handle >1 channel. */
2.1 timbl 52: #define GOT_SYSTEM /* Can call shell with string */
53:
54: #ifdef unix
55: #define GOT_PIPE
56: #endif
57: #ifdef VM
58: #define GOT_PIPE /* Of sorts */
59: #endif
60:
61: #ifdef DECNET
62: typedef struct sockaddr_dn SockA; /* See netdnet/dn.h or custom vms.h */
63: #else /* Internet */
64: typedef struct sockaddr_in SockA; /* See netinet/in.h */
65: #endif
66:
67:
2.2 timbl 68: </PRE>
69: <H2>Macintosh - Think-C</H2>Think-C is one development environment
70: on the Mac.<P>
71: We recommend that you compile with
72: 4-byte ints to be compatible with
73: MPW C. We used Tom Milligan's s_socket
74: library which was written for 4 byte
75: int, and the MacTCP library assumes
76: 4-byte int.
77: <PRE>#ifdef THINK_C
2.1 timbl 78: #undef GOT_SYSTEM
79: #define DEBUG /* Can't put it on the CC command line */
80: #define NO_UNIX_IO /* getuid() missing */
81: #define NO_GETPID /* getpid() does not exist */
82: #define NO_GETWD /* getwd() does not exist */
83:
84: #undef NETCLOSE /* Routine to close a TCP-IP socket */
85: #undef NETREAD /* Routine to read from a TCP-IP socket */
86: #undef NETWRITE /* Routine to write to a TCP-IP socket */
87: #define NETCLOSE s_close /* Routine to close a TCP-IP socket */
88: #define NETREAD s_read /* Routine to read from a TCP-IP socket */
89: #define NETWRITE s_write /* Routine to write to a TCP-IP socket */
90:
91: #define bind s_bind /* Funny names presumably to prevent clashes */
92: #define connect s_connect
93: #define accept s_accept
94: #define listen s_listen
95: #define socket s_socket
96: #define getsockname s_getsockname
97:
98: /* The function prototype checking is better than the include files
99: */
100:
101: extern s_close(int s);
102: extern s_read(int s, char *buffer, int buflen);
103: extern s_write(int s, const char *buffer, int buflen);
104:
105: extern bind(int s, struct sockaddr *name, int namelen);
106: extern accept(int s, struct sockaddr *addr, int *addrlen);
107: extern listen(int s, int qlen);
108: extern connect(int s, struct sockaddr *addr, int addrlen);
109:
110: extern s_socket(int domain, int type, int protocol);
111: extern s_getsockname(int s, struct sockaddr *name, int *namelen);
112: extern struct hostent *gethostent(const char * name);
113: extern unsigned long inet_addr(const char * name);
114:
115: #endif /* THINK_C */
116:
117:
2.2 timbl 118: </PRE>
119: <H2>Macintosh - MPW</H2>MPW is one development environment
120: on the Mac.<P>
121: This entry was created by Aleksandar
122: Totic (atotic@ncsa.uiuc.edu) this
123: file is compatible with sockets package
124: released by NCSA. One major conflict
125: is that this library redefines write/read/etc
126: as macros. In some of HTML code
127: these macros get executed when they
128: should not be. Such files should
129: define NO_SOCKET_DEFS on top. This
130: is a temporary hack.
131: <PRE>#ifdef applec /* MPW */
132: #undef GOT_SYSTEM
133: #define DEBUG /* Can't put it on the CC command line */
134: #define NO_UNIX_IO /* getuid() missing
135: */
136: #define NO_GETPID /* getpid() does not exist
137: */
138: #define NO_GETWD /* getwd() does not exist
139: */
140:
141: #undef NETCLOSE /* Routine to close a TCP-IP socket */
142: #undef NETREAD /* Routine to read from a TCP-IP socket */
143: #undef NETWRITE /* Routine to write to a TCP-IP socket */
144: #define NETCLOSE s_close /* Routine to close a TCP-IP socket */
145: #define NETREAD s_read /* Routine to read from a TCP-IP socket */
146: #define NETWRITE s_write /* Routine to write to a TCP-IP socket */
147: #define _ANSI_SOURCE
148: #define GUI
149: #define LINEFEED 10
150: #define ANON_FTP_HOSTNAME
151: #ifndef NO_SOCKET_DEFS
152: #include <MacSockDefs.h>
153: #endif
154:
155: #include <socket.ext.h>
156: #include <string.h>
157:
158: #endif /* MPW */
159:
160:
161:
2.1 timbl 162: #ifndef STDIO_H
2.2 timbl 163: #include <stdio.h>
2.1 timbl 164: #define STDIO_H
165: #endif
166:
2.2 timbl 167: </PRE>
168: <H2>IBM RS600</H2>
169: <PRE>/* On the IBM RS-6000, AIX is almost Unix.
2.1 timbl 170: ** But AIX must be defined in the makefile.
171: */
2.2 timbl 172: #ifdef _AIX
173: #define AIX
174: #endif
2.1 timbl 175: #ifdef AIX
176: #define unix
177: #endif
178:
2.2 timbl 179: /* AIX 3.2
180: ** -------
181: */
182:
183: #ifdef _IBMR2
184: #define USE_DIRENT
185: #endif
186:
187:
188: </PRE>
189: <H2>IBM VM-CMS, VM-XA Mainframes</H2>
190: <PRE>/* MVS is compiled as for VM. MVS has no unix-style I/O
2.1 timbl 191: ** The command line compile options seem to come across in
192: ** lower case.
193: **
2.2 timbl 194: ** See also lots of VM stuff lower down.
2.1 timbl 195: */
196: #ifdef mvs
197: #define MVS
198: #endif
199:
200: #ifdef MVS
201: #define VM
202: #endif
203:
204: #ifdef NEWLIB
205: #pragma linkage(newlib,OS) /* Enables recursive NEWLIB */
206: #endif
207:
208: /* VM doesn't have a built-in predefined token, so we cheat: */
209: #ifndef VM
2.2 timbl 210: #include <string.h> /* For bzero etc - not VM */
211: #endif
212:
213: /* Note: All include file names must have 8 chars max (+".h")
214: **
215: ** Under VM, compile with "(DEF=VM,SHORT_NAMES,DEBUG)"
216: **
217: ** Under MVS, compile with "NOMAR DEF(MVS)" to get rid of 72 char margin
218: ** System include files TCPIP and COMMMAC neeed line number removal(!)
219: */
220:
221: #ifdef VM /* or MVS -- see above. */
222: #define NOT_ASCII /* char type is not ASCII */
223: #define NO_UNIX_IO /* Unix I/O routines are not supported */
224: #define NO_GETPID /* getpid() does not exist */
225: #define NO_GETWD /* getwd() does not exist */
226: #ifndef SHORT_NAMES
227: #define SHORT_NAMES /* 8 character uniqueness for globals */
228: #endif
229: #include <manifest.h>
230: #include <bsdtypes.h>
231: #include <stdefs.h>
232: #include <socket.h>
233: #include <in.h>
234: #include <inet.h>
235: #include <netdb.h>
236: #include <errno.h> /* independent */
237: extern char asciitoebcdic[], ebcdictoascii[];
238: #define TOASCII(c) (c=='\n' ? 10 : ebcdictoascii[c])
239: #define FROMASCII(c) (c== 10 ? '\n' : asciitoebcdic[c])
240: #include <bsdtime.h>
241: #include <time.h>
242: #include <string.h>
243: #define INCLUDES_DONE
244: #define TCP_INCLUDES_DONE
2.1 timbl 245: #endif
246:
247:
2.2 timbl 248: </PRE>
249: <H2>IBM-PC running MS-DOS with SunNFS
250: for TCP/IP</H2>This code thanks to Eelco van Asperen
2.3 ! timbl 251: <evas@cs.few.eur.nl>
! 252: <PRE>#ifdef PCNFS
! 253: #include <sys/types.h>
2.2 timbl 254: #include <string.h>
255: #include <errno.h> /* independent */
256: #include <sys/time.h> /* independent */
257: #include <sys/stat.h>
258: #include <fcntl.h> /* In place of sys/param and sys/file */
259: #define INCLUDES_DONE
260: #define FD_SET(fd,pmask) (*(unsigned*)(pmask)) |= (1<<(fd))
261: #define FD_CLR(fd,pmask) (*(unsigned*)(pmask)) &= ~(1<<(fd))
262: #define FD_ZERO(pmask) (*(unsigned*)(pmask))=0
263: #define FD_ISSET(fd,pmask) (*(unsigned*)(pmask) & (1<<(fd)))
264: #endif /* PCNFS */
265:
266:
267:
268: </PRE>
269: <H2>VAX/VMS</H2>
270: <PRE>/* Under VMS, there are many versions of TCP-IP. Define one if you
2.1 timbl 271: ** do not use Digital's UCX product:
272: **
273: ** UCX DEC's "Ultrix connection" (default)
274: ** WIN_TCP From Wollongong, now GEC software.
275: ** MULTINET From SRI, now from TGV Inv.
276: ** DECNET Cern's TCP socket emulation over DECnet
277: **
278: ** The last three do not interfere with the unix i/o library, and so they
279: ** need special calls to read, write and close sockets. In these cases the
280: ** socket number is a VMS channel number, so we make the @@@ HORRIBLE @@@
281: ** assumption that a channel number will be greater than 10 but a
2.2 timbl 282: ** unix file descriptor less than 10. It works.
2.1 timbl 283: */
284: #ifdef vms
285: #ifdef WIN_TCP
286: #undef NETREAD
287: #undef NETWRITE
288: #undef NETCLOSE
2.2 timbl 289: #define NETREAD(s,b,l) ((s)>10 ? netread((s),(b),(l)) : read((s),(b),(l)))
290: #define NETWRITE(s,b,l) ((s)>10 ? netwrite((s),(b),(l)) : write((s),(b),(l)))
291: #define NETCLOSE(s) ((s)>10 ? netclose(s) : close(s))
2.1 timbl 292: #endif
293:
294: #ifdef MULTINET
295: #undef NETCLOSE
296: #undef NETREAD
297: #undef NETWRITE
2.2 timbl 298: #define NETREAD(s,b,l) ((s)>10 ? socket_read((s),(b),(l)) : read((s),(b),(l)))
299: #define NETWRITE(s,b,l) ((s)>10 ? socket_write((s),(b),(l)) : \
2.1 timbl 300: write((s),(b),(l)))
2.2 timbl 301: #define NETCLOSE(s) ((s)>10 ? socket_close(s) : close(s))
2.1 timbl 302: #endif
303:
304: #ifdef DECNET
305: #undef SELECT /* not supported */
306: #undef NETREAD
307: #undef NETWRITE
308: #undef NETCLOSE
2.2 timbl 309: #define NETREAD(s,b,l) ((s)>10 ? recv((s),(b),(l),0) : read((s),(b),(l)))
310: #define NETWRITE(s,b,l) ((s)>10 ? send((s),(b),(l),0) : write((s),(b),(l)))
311: #define NETCLOSE(s) ((s)>10 ? socket_close(s) : close(s))
2.1 timbl 312: #endif /* Decnet */
313:
314: /* Certainly this works for UCX and Multinet; not tried for Wollongong
315: */
316: #ifdef MULTINET
317: #include "multinet_root:[multinet.include.sys]types.h"
318: #include "multinet_root:[multinet.include]errno.h"
319: #include "multinet_root:[multinet.include.sys]time.h"
320: #else
321: #include types
322: #include errno
323: #include time
324: #endif /* multinet */
325:
326: #include string
327:
328: #ifndef STDIO_H
329: #include stdio
330: #define STDIO_H
331: #endif
332:
333: #include file
334:
335: #ifndef DECNET /* Why is it used at all ? Types conflict with "types.h" */
336: #include unixio
337: #endif
338:
339: #define INCLUDES_DONE
340:
341: #ifdef MULTINET /* Include from standard Multinet directories */
342: #include "multinet_root:[multinet.include.sys]socket.h"
343: #ifdef __TIME_LOADED /* defined by sys$library:time.h */
344: #define __TIME /* to avoid double definitions in next file */
345: #endif
346: #include "multinet_root:[multinet.include.netinet]in.h"
347: #include "multinet_root:[multinet.include.arpa]inet.h"
348: #include "multinet_root:[multinet.include]netdb.h"
349:
350: #else /* not multinet */
351: #ifdef DECNET
352: #include "types.h" /* for socket.h */
353: #include "socket.h"
354: #include "dn"
355: #include "dnetdb"
356: /* #include "vms.h" */
357:
358: #else /* UCX or WIN */
359: #include socket
360: #include in
361: #include inet
362: #include netdb
363:
364: #endif /* not DECNET */
365: #endif /* of Multinet or other TCP includes */
366:
367: #define TCP_INCLUDES_DONE
368:
369: #endif /* vms */
370:
371:
372:
2.2 timbl 373: </PRE>
374: <H2>SCO ODT unix version</H2>
375: <PRE>
376: #ifdef sco
377: #include <sys/fcntl.h>
378: #define USE_DIRENT
2.1 timbl 379: #endif
380:
2.2 timbl 381: </PRE>
382: <H2>MIPS unix</H2>
383: <PRE>/* Mips hack (bsd4.3/sysV mixture...) */
2.1 timbl 384:
385: #ifdef mips
386: extern int errno;
387: #endif
388:
2.2 timbl 389:
390: </PRE>
391: <H2>Regular BSD unix versions</H2>These are a default unix where not
392: already defined specifically.
393: <PRE>#ifndef INCLUDES_DONE
394: #include <sys/types.h>
395: /* #include <streams/streams.h> not ultrix */
396: #include <string.h>
397:
398: #include <errno.h> /* independent */
399: #include <sys/time.h> /* independent */
400: #include <sys/stat.h>
401: #include <sys/param.h>
402: #include <sys/file.h> /* For open() etc */
2.1 timbl 403: #define INCLUDES_DONE
404: #endif /* Normal includes */
405:
2.2 timbl 406: /* Directory reading stuff - BSD or SYS V
407: */
2.1 timbl 408: #ifdef unix /* if this is to compile on a UNIX machine */
409: #define GOT_READ_DIR 1 /* if directory reading functions are available */
2.2 timbl 410: #ifdef USE_DIRENT /* sys v version */
411: #include <dirent.h>
412: #define direct dirent
413: #else
414: #include <sys/dir.h>
2.1 timbl 415: #endif
2.2 timbl 416: #if defined(sun) && defined(__svr4__)
417: #include <sys/fcntl.h>
418: #include <limits.h>
419: #endif
420: #endif
2.1 timbl 421:
2.2 timbl 422: </PRE>
423: <H2><A
424: NAME=z1>Defaults</A></H2>
425: <H3>Include files for TCP</H3>
426: <PRE>#ifndef TCP_INCLUDES_DONE
427: #include <sys/socket.h>
428: #include <netinet/in.h>
429: #ifndef __hpux /* this may or may not be good -marc */
430: #include <arpa/inet.h> /* Must be after netinet/in.h */
431: #endif
432: #include <netdb.h>
2.1 timbl 433: #endif /* TCP includes */
434:
435:
2.2 timbl 436: </PRE>
437: <H3>Macros for manipulating masks for
438: select()</H3>
439: <PRE>#ifdef SELECT
2.1 timbl 440: #ifndef FD_SET
441: typedef unsigned int fd_set;
2.2 timbl 442: #define FD_SET(fd,pmask) (*(pmask)) |= (1<<(fd))
443: #define FD_CLR(fd,pmask) (*(pmask)) &= ~(1<<(fd))
2.1 timbl 444: #define FD_ZERO(pmask) (*(pmask))=0
2.2 timbl 445: #define FD_ISSET(fd,pmask) (*(pmask) & (1<<(fd)))
2.1 timbl 446: #endif /* FD_SET */
447: #endif /* SELECT */
448:
2.2 timbl 449: </PRE>
450: <H3><A
451: NAME=z0>M</A> acros for converting characters</H3>
452: <PRE>#ifndef TOASCII
2.1 timbl 453: #define TOASCII(c) (c)
454: #define FROMASCII(c) (c)
455: #endif
456:
2.2 timbl 457: #endif /* TCP_H */
458:
459:
2.1 timbl 460:
2.3 ! timbl 461: </PRE>end of system-specific file</BODY>
Webmaster