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