initial checkin of header files

This commit is contained in:
gdr 1997-02-28 04:42:19 +00:00
parent a0b2bf9a39
commit 1192c44843
103 changed files with 11739 additions and 0 deletions

14
HFSinclude/net/dli_var.h Normal file
View File

@ -0,0 +1,14 @@
/*
* Too bad we don't have symlinks for GNO ...
* This file allows a program to use the *proper* name for this
* header file, while allowing the "real" header file to reside on
* a ProDOS volume. This is good for speed and disk integrity,
* and gives a work-around for those sites which don't use HFS.
*
* $Id: dli_var.h,v 1.1 1997/02/28 04:41:52 gdr Exp $
*/
#ifndef _NET_DLI_VAR_H_
#include <net/dli.var.h>
#endif

13
HFSinclude/net/if_arp.h Normal file
View File

@ -0,0 +1,13 @@
/*
* Too bad we don't have symlinks for GNO ...
* This file allows a program to use the *proper* name for this
* header file, while allowing the "real" header file to reside on
* a ProDOS volume. This is good for speed and disk integrity,
* and gives a work-around for those sites which don't use HFS.
*
* $Id: if_arp.h,v 1.1 1997/02/28 04:41:53 gdr Exp $
*/
#ifndef _NET_IF_ARP_H_
#include <net/if.arp.h>
#endif

13
HFSinclude/net/raw_cb.h Normal file
View File

@ -0,0 +1,13 @@
/*
* Too bad we don't have symlinks for GNO ...
* This file allows a program to use the *proper* name for this
* header file, while allowing the "real" header file to reside on
* a ProDOS volume. This is good for speed and disk integrity,
* and gives a work-around for those sites which don't use HFS.
*
* $Id: raw_cb.h,v 1.1 1997/02/28 04:41:53 gdr Exp $
*/
#ifndef _NET_RAW_CB_H_
#include <net/raw.cb.h>
#endif

View File

@ -0,0 +1,13 @@
/*
* Too bad we don't have symlinks for GNO ...
* This file allows a program to use the *proper* name for this
* header file, while allowing the "real" header file to reside on
* a ProDOS volume. This is good for speed and disk integrity,
* and gives a work-around for those sites which don't use HFS.
*
* $Id: in_systm.h,v 1.1 1997/02/28 04:41:59 gdr Exp $
*/
#ifndef _NETINET_IN_SYSTM_H_
#include <netinet/in.systm.h>
#endif

View File

@ -0,0 +1,13 @@
/*
* Too bad we don't have symlinks for GNO ...
* This file allows a program to use the *proper* name for this
* header file, while allowing the "real" header file to reside on
* a ProDOS volume. This is good for speed and disk integrity,
* and gives a work-around for those sites which don't use HFS.
*
* $Id: ioctl_compat.h,v 1.1 1997/02/28 04:41:59 gdr Exp $
*/
#ifndef _SYS_IOCTL_COMPAT_H_
#include <sys/ioctl.compat.h>
#endif

109
include/arpa/ftp.h Normal file
View File

@ -0,0 +1,109 @@
/*
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ftp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ARPA_FTP_H_
#define _ARPA_FTP_H_
/* Definitions for FTP; see RFC-765. */
/*
* Reply codes.
*/
#define PRELIM 1 /* positive preliminary */
#define COMPLETE 2 /* positive completion */
#define CONTINUE 3 /* positive intermediate */
#define TRANSIENT 4 /* transient negative completion */
#define ERROR 5 /* permanent negative completion */
/*
* Type codes
*/
#define TYPE_A 1 /* ASCII */
#define TYPE_E 2 /* EBCDIC */
#define TYPE_I 3 /* image */
#define TYPE_L 4 /* local byte size */
#ifdef FTP_NAMES
char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
#endif
/*
* Form codes
*/
#define FORM_N 1 /* non-print */
#define FORM_T 2 /* telnet format effectors */
#define FORM_C 3 /* carriage control (ASA) */
#ifdef FTP_NAMES
char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
#endif
/*
* Structure codes
*/
#define STRU_F 1 /* file (no record structure) */
#define STRU_R 2 /* record structure */
#define STRU_P 3 /* page structure */
#ifdef FTP_NAMES
char *strunames[] = {"0", "File", "Record", "Page" };
#endif
/*
* Mode types
*/
#define MODE_S 1 /* stream */
#define MODE_B 2 /* block */
#define MODE_C 3 /* compressed */
#ifdef FTP_NAMES
char *modenames[] = {"0", "Stream", "Block", "Compressed" };
#endif
/*
* Record Tokens
*/
#define REC_ESC '\377' /* Record-mode Escape */
#define REC_EOR '\001' /* Record-mode End-of-Record */
#define REC_EOF '\002' /* Record-mode End-of-File */
/*
* Block Header
*/
#define BLK_EOR 0x80 /* Block is End-of-Record */
#define BLK_EOF 0x40 /* Block is End-of-File */
#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
#define BLK_RESTART 0x10 /* Block is Restart Marker */
#define BLK_BYTECOUNT 2 /* Bytes in this block */
#endif /* !_FTP_H_ */

58
include/arpa/inet.h Normal file
View File

@ -0,0 +1,58 @@
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)inet.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ARPA_INET_H_
#define _ARPA_INET_H_
/* External definitions for functions in inet(3) */
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
__BEGIN_DECLS
unsigned long inet_addr __P((const char *));
int inet_aton __P((const char *, struct in_addr *));
unsigned long inet_lnaof __P((struct in_addr));
struct in_addr inet_makeaddr __P((u_long , u_long));
unsigned long inet_netof __P((struct in_addr));
unsigned long inet_network __P((const char *));
char *inet_ntoa __P((struct in_addr));
__END_DECLS
#endif /* !_INET_H_ */

300
include/arpa/nameser.h Normal file
View File

@ -0,0 +1,300 @@
/*
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*
* @(#)nameser.h 8.2 (Berkeley) 2/16/94
* From Id: nameser.h,v 4.9.1.15 1994/07/19 22:51:24 vixie Exp
*/
#ifndef _ARPA_NAMESER_H_
#define _ARPA_NAMESER_H_
#ifndef _SYS_PARAM_H_
#include <sys/param.h>
#endif
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef _MACHINE_ENDIAN_H_
#include <machine/endian.h>
#endif
/*
* revision information. this is the release date in YYYYMMDD format.
* it can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__BIND > 19931104)". do not
* compare for equality; rather, use it to determine whether your resolver
* is new enough to contain a certain feature.
*/
#define __BIND 19950621 /* interface version stamp */
/*
* Define constants based on rfc883
*/
#define PACKETSZ 512 /* maximum packet size */
#define MAXDNAME 256 /* maximum domain name */
#define MAXCDNAME 255 /* maximum compressed domain name */
#define MAXLABEL 63 /* maximum length of domain label */
#define HFIXEDSZ 12 /* #/bytes of fixed data in header */
#define QFIXEDSZ 4 /* #/bytes of fixed data in query */
#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
#define INT32SZ 4 /* for systems without 32-bit ints */
#define INT16SZ 2 /* for systems without 16-bit ints */
#define INADDRSZ 4 /* for sizeof(struct inaddr) != 4 */
/*
* Internet nameserver port number
*/
#define NAMESERVER_PORT 53
/*
* Currently defined opcodes
*/
#define QUERY 0x0 /* standard query */
#define IQUERY 0x1 /* inverse query */
#define STATUS 0x2 /* nameserver status query */
/*#define xxx 0x3 */ /* 0x3 reserved */
#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
#ifdef ALLOW_UPDATES
/* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */
# define UPDATEA 0x9 /* add resource record */
# define UPDATED 0xa /* delete a specific resource record */
# define UPDATEDA 0xb /* delete all named resource record */
# define UPDATEM 0xc /* modify a specific resource record */
# define UPDATEMA 0xd /* modify all named resource record */
# define ZONEINIT 0xe /* initial zone transfer */
# define ZONEREF 0xf /* incremental zone referesh */
#endif
/*
* Currently defined response codes
*/
#define NOERROR 0 /* no error */
#define FORMERR 1 /* format error */
#define SERVFAIL 2 /* server failure */
#define NXDOMAIN 3 /* non existent domain */
#define NOTIMP 4 /* not implemented */
#define REFUSED 5 /* query refused */
#ifdef ALLOW_UPDATES
/* non standard */
# define NOCHANGE 0xf /* update failed to change db */
#endif
/*
* Type values for resources and queries
*/
#define T_A 1 /* host address */
#define T_NS 2 /* authoritative server */
#define T_MD 3 /* mail destination */
#define T_MF 4 /* mail forwarder */
#define T_CNAME 5 /* canonical name */
#define T_SOA 6 /* start of authority zone */
#define T_MB 7 /* mailbox domain name */
#define T_MG 8 /* mail group member */
#define T_MR 9 /* mail rename name */
#define T_NULL 10 /* null resource record */
#define T_WKS 11 /* well known service */
#define T_PTR 12 /* domain name pointer */
#define T_HINFO 13 /* host information */
#define T_MINFO 14 /* mailbox information */
#define T_MX 15 /* mail routing information */
#define T_TXT 16 /* text strings */
#define T_RP 17 /* responsible person */
#define T_AFSDB 18 /* AFS cell database */
#define T_X25 19 /* X_25 calling address */
#define T_ISDN 20 /* ISDN calling address */
#define T_RT 21 /* router */
#define T_NSAP 22 /* NSAP address */
#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */
#define T_SIG 24 /* security signature */
#define T_KEY 25 /* security key */
#define T_PX 26 /* X.400 mail mapping */
#define T_GPOS 27 /* geographical position (withdrawn) */
#define T_AAAA 28 /* IP6 Address */
#define T_LOC 29 /* Location Information */
/* non standard */
#define T_UINFO 100 /* user (finger) information */
#define T_UID 101 /* user ID */
#define T_GID 102 /* group ID */
#define T_UNSPEC 103 /* Unspecified format (binary data) */
/* Query type values which do not appear in resource records */
#define T_AXFR 252 /* transfer zone of authority */
#define T_MAILB 253 /* transfer mailbox records */
#define T_MAILA 254 /* transfer mail agent records */
#define T_ANY 255 /* wildcard match */
/*
* Values for class field
*/
#define C_IN 1 /* the arpa internet */
#define C_CHAOS 3 /* for chaos net (MIT) */
#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */
/* Query class values which do not appear in resource records */
#define C_ANY 255 /* wildcard match */
/*
* Status return codes for T_UNSPEC conversion routines
*/
#define CONV_SUCCESS 0
#define CONV_OVERFLOW (-1)
#define CONV_BADFMT (-2)
#define CONV_BADCKSUM (-3)
#define CONV_BADBUFLEN (-4)
/*
* Structure for query header. The order of the fields is machine- and
* compiler-dependent, depending on the byte/bit order and the layout
* of bit fields. We use bit fields only in int variables, as this
* is all ANSI requires. This requires a somewhat confusing rearrangement.
*/
typedef struct {
unsigned id :16; /* query identification number */
#if BYTE_ORDER == BIG_ENDIAN
/* fields in third byte */
unsigned qr: 1; /* response flag */
unsigned opcode: 4; /* purpose of message */
unsigned aa: 1; /* authoritive answer */
unsigned tc: 1; /* truncated message */
unsigned rd: 1; /* recursion desired */
/* fields in fourth byte */
unsigned ra: 1; /* recursion available */
unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */
unsigned rcode :4; /* response code */
#endif
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
/* fields in third byte */
unsigned rd :1; /* recursion desired */
unsigned tc :1; /* truncated message */
unsigned aa :1; /* authoritive answer */
unsigned opcode :4; /* purpose of message */
unsigned qr :1; /* response flag */
/* fields in fourth byte */
unsigned rcode :4; /* response code */
unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ra :1; /* recursion available */
#endif
/* remaining bytes */
unsigned qdcount :16; /* number of question entries */
unsigned ancount :16; /* number of answer entries */
unsigned nscount :16; /* number of authority entries */
unsigned arcount :16; /* number of resource entries */
} HEADER;
/*
* Defines for handling compressed domain names
*/
#define INDIR_MASK 0xc0
/*
* Structure for passing resource records around.
*/
struct rrec {
int16_t r_zone; /* zone number */
int16_t r_class; /* class number */
int16_t r_type; /* type number */
u_int32_t r_ttl; /* time to live */
int r_size; /* size of data area */
char *r_data; /* pointer to data */
};
extern u_int16_t _getshort __P((const u_char *));
extern u_int32_t _getlong __P((const u_char *));
/*
* Inline versions of get/put short/long. Pointer is advanced.
*
* These macros demonstrate the property of C whereby it can be
* portable or it can be elegant but rarely both.
*/
#define GETSHORT(s, cp) { \
register u_char *t_cp = (u_char *)(cp); \
(s) = ((u_int16_t)t_cp[0] << 8) \
| ((u_int16_t)t_cp[1]) \
; \
(cp) += INT16SZ; \
}
#define GETLONG(l, cp) { \
register u_char *t_cp = (u_char *)(cp); \
(l) = ((u_int32_t)t_cp[0] << 24) \
| ((u_int32_t)t_cp[1] << 16) \
| ((u_int32_t)t_cp[2] << 8) \
| ((u_int32_t)t_cp[3]) \
; \
(cp) += INT32SZ; \
}
#define PUTSHORT(s, cp) { \
register u_int16_t t_s = (u_int16_t)(s); \
register u_char *t_cp = (u_char *)(cp); \
*t_cp++ = t_s >> 8; \
*t_cp = t_s; \
(cp) += INT16SZ; \
}
#define PUTLONG(l, cp) { \
register u_int32_t t_l = (u_int32_t)(l); \
register u_char *t_cp = (u_char *)(cp); \
*t_cp++ = t_l >> 24; \
*t_cp++ = t_l >> 16; \
*t_cp++ = t_l >> 8; \
*t_cp = t_l; \
(cp) += INT32SZ; \
}
#endif /* !_ARPA_NAMESER_H_ */

321
include/arpa/telnet.h Normal file
View File

@ -0,0 +1,321 @@
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)telnet.h 8.2 (Berkeley) 12/15/93
*/
#ifndef _ARPA_TELNET_H_
#define _ARPA_TELNET_H_
/*
* Definitions for the TELNET protocol.
*/
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
#define DO 253 /* please, you use option */
#define WONT 252 /* I won't use option */
#define WILL 251 /* I will use option */
#define SB 250 /* interpret as subnegotiation */
#define GA 249 /* you may reverse the line */
#define EL 248 /* erase the current line */
#define EC 247 /* erase the current character */
#define AYT 246 /* are you there */
#define AO 245 /* abort output--but let prog finish */
#define IP 244 /* interrupt process--permanently */
#define BREAK 243 /* break */
#define DM 242 /* data mark--for connect. cleaning */
#define NOP 241 /* nop */
#define SE 240 /* end sub negotiation */
#define EOR 239 /* end of record (transparent mode) */
#define ABORT 238 /* Abort process */
#define SUSP 237 /* Suspend process */
#define xEOF 236 /* End of file: EOF is already used... */
#define SYNCH 242 /* for telfunc calls */
#ifdef TELCMDS
char *telcmds[] = {
"EOF", "SUSP", "ABORT", "EOR",
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
NULL
};
#else
extern char *telcmds[];
#endif
#define TELCMD_FIRST xEOF
#define TELCMD_LAST IAC
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
(unsigned int)(x) >= TELCMD_FIRST)
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
/* telnet options */
#define TELOPT_BINARY 0 /* 8-bit data path */
#define TELOPT_ECHO 1 /* echo */
#define TELOPT_RCP 2 /* prepare to reconnect */
#define TELOPT_SGA 3 /* suppress go ahead */
#define TELOPT_NAMS 4 /* approximate message size */
#define TELOPT_STATUS 5 /* give status */
#define TELOPT_TM 6 /* timing mark */
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
#define TELOPT_NAOL 8 /* negotiate about output line width */
#define TELOPT_NAOP 9 /* negotiate about output page size */
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
#define TELOPT_XASCII 17 /* extended ascic character set */
#define TELOPT_LOGOUT 18 /* force logout */
#define TELOPT_BM 19 /* byte macro */
#define TELOPT_DET 20 /* data entry terminal */
#define TELOPT_SUPDUP 21 /* supdup protocol */
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
#define TELOPT_SNDLOC 23 /* send location */
#define TELOPT_TTYPE 24 /* terminal type */
#define TELOPT_EOR 25 /* end or record */
#define TELOPT_TUID 26 /* TACACS user identification */
#define TELOPT_OUTMRK 27 /* output marking */
#define TELOPT_TTYLOC 28 /* terminal location number */
#define TELOPT_3270REGIME 29 /* 3270 regime */
#define TELOPT_X3PAD 30 /* X.3 PAD */
#define TELOPT_NAWS 31 /* window size */
#define TELOPT_TSPEED 32 /* terminal speed */
#define TELOPT_LFLOW 33 /* remote flow control */
#define TELOPT_LINEMODE 34 /* Linemode option */
#define TELOPT_XDISPLOC 35 /* X Display Location */
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
#define TELOPT_AUTHENTICATION 37/* Authenticate */
#define TELOPT_ENCRYPT 38 /* Encryption option */
#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
#define TELOPT_EXOPL 255 /* extended-options-list */
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
#ifdef TELOPTS
char *telopts[NTELOPTS+1] = {
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
"ENCRYPT", "NEW-ENVIRON",
NULL
};
#define TELOPT_FIRST TELOPT_BINARY
#define TELOPT_LAST TELOPT_NEW_ENVIRON
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
#endif
/* sub-option qualifiers */
#define TELQUAL_IS 0 /* option is... */
#define TELQUAL_SEND 1 /* send option */
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
#define LFLOW_OFF 0 /* Disable remote flow control */
#define LFLOW_ON 1 /* Enable remote flow control */
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
/*
* LINEMODE suboptions
*/
#define LM_MODE 1
#define LM_FORWARDMASK 2
#define LM_SLC 3
#define MODE_EDIT 0x01
#define MODE_TRAPSIG 0x02
#define MODE_ACK 0x04
#define MODE_SOFT_TAB 0x08
#define MODE_LIT_ECHO 0x10
#define MODE_MASK 0x1f
/* Not part of protocol, but needed to simplify things... */
#define MODE_FLOW 0x0100
#define MODE_ECHO 0x0200
#define MODE_INBIN 0x0400
#define MODE_OUTBIN 0x0800
#define MODE_FORCE 0x1000
#define SLC_SYNCH 1
#define SLC_BRK 2
#define SLC_IP 3
#define SLC_AO 4
#define SLC_AYT 5
#define SLC_EOR 6
#define SLC_ABORT 7
#define SLC_EOF 8
#define SLC_SUSP 9
#define SLC_EC 10
#define SLC_EL 11
#define SLC_EW 12
#define SLC_RP 13
#define SLC_LNEXT 14
#define SLC_XON 15
#define SLC_XOFF 16
#define SLC_FORW1 17
#define SLC_FORW2 18
#define NSLC 18
/*
* For backwards compatability, we define SLC_NAMES to be the
* list of names if SLC_NAMES is not defined.
*/
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", NULL
#ifdef SLC_NAMES
char *slc_names[] = {
SLC_NAMELIST
};
#else
extern char *slc_names[];
#define SLC_NAMES SLC_NAMELIST
#endif
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
#define SLC_NAME(x) slc_names[x]
#define SLC_NOSUPPORT 0
#define SLC_CANTCHANGE 1
#define SLC_VARIABLE 2
#define SLC_DEFAULT 3
#define SLC_LEVELBITS 0x03
#define SLC_FUNC 0
#define SLC_FLAGS 1
#define SLC_VALUE 2
#define SLC_ACK 0x80
#define SLC_FLUSHIN 0x40
#define SLC_FLUSHOUT 0x20
#define OLD_ENV_VAR 1
#define OLD_ENV_VALUE 0
#define NEW_ENV_VAR 0
#define NEW_ENV_VALUE 1
#define ENV_ESC 2
#define ENV_USERVAR 3
/*
* AUTHENTICATION suboptions
*/
/*
* Who is authenticating who ...
*/
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
#define AUTH_WHO_SERVER 1 /* Server authenticating client */
#define AUTH_WHO_MASK 1
/*
* amount of authentication done
*/
#define AUTH_HOW_ONE_WAY 0
#define AUTH_HOW_MUTUAL 2
#define AUTH_HOW_MASK 2
#define AUTHTYPE_NULL 0
#define AUTHTYPE_KERBEROS_V4 1
#define AUTHTYPE_KERBEROS_V5 2
#define AUTHTYPE_SPX 3
#define AUTHTYPE_MINK 4
#define AUTHTYPE_CNT 5
#define AUTHTYPE_TEST 99
#ifdef AUTH_NAMES
char *authtype_names[] = {
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
};
#else
extern char *authtype_names[];
#endif
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
#define AUTHTYPE_NAME(x) authtype_names[x]
/*
* ENCRYPTion suboptions
*/
#define ENCRYPT_IS 0 /* I pick encryption type ... */
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
#define ENCRYPT_REPLY 2 /* Initial setup response */
#define ENCRYPT_START 3 /* Am starting to send encrypted */
#define ENCRYPT_END 4 /* Am ending encrypted */
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
#define ENCRYPT_REQEND 6 /* Request you send encrypting */
#define ENCRYPT_ENC_KEYID 7
#define ENCRYPT_DEC_KEYID 8
#define ENCRYPT_CNT 9
#define ENCTYPE_ANY 0
#define ENCTYPE_DES_CFB64 1
#define ENCTYPE_DES_OFB64 2
#define ENCTYPE_CNT 3
#ifdef ENCRYPT_NAMES
char *encrypt_names[] = {
"IS", "SUPPORT", "REPLY", "START", "END",
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
0,
};
char *enctype_names[] = {
"ANY", "DES_CFB64", "DES_OFB64", 0,
};
#else
extern char *encrypt_names[];
extern char *enctype_names[];
#endif
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
#define ENCRYPT_NAME(x) encrypt_names[x]
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
#define ENCTYPE_NAME(x) enctype_names[x]
#endif /* !_TELNET_H_ */

80
include/arpa/tftp.h Normal file
View File

@ -0,0 +1,80 @@
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tftp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ARPA_TFTP_H_
#define _ARPA_TFTP_H_
/*
* Trivial File Transfer Protocol (IEN-133)
*/
#define SEGSIZE 512 /* data segment size */
/*
* Packet types.
*/
#define RRQ 01 /* read request */
#define WRQ 02 /* write request */
#define DATA 03 /* data packet */
#define ACK 04 /* acknowledgement */
#define ERROR 05 /* error code */
struct tftphdr {
short th_opcode; /* packet type */
union {
short tu_block; /* block # */
short tu_code; /* error code */
char tu_stuff[1]; /* request packet stuff */
} th_u;
char th_data[1]; /* data or error string */
};
#define th_block th_u.tu_block
#define th_code th_u.tu_code
#define th_stuff th_u.tu_stuff
#define th_msg th_data
/*
* Error codes.
*/
#define EUNDEF 0 /* not defined */
#define ENOTFOUND 1 /* file not found */
#define EACCESS 2 /* access violation */
#define ENOSPACE 3 /* disk full or allocation exceeded */
#define EBADOP 4 /* illegal TFTP operation */
#define EBADID 5 /* unknown transfer ID */
#define EEXISTS 6 /* file already exists */
#define ENOUSER 7 /* no such user */
#endif /* !_TFTP_H_ */

403
include/curses.h Normal file
View File

@ -0,0 +1,403 @@
/*
* Copyright (c) 1981, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)curses.h 8.3 (Berkeley) 7/27/94
*/
#ifndef _CURSES_H_
#define _CURSES_H_
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef __stdio__
#include <stdio.h>
#endif
#ifndef _BSD_VA_LIST_
#define _BSD_VA_LIST_ __va_list
#endif
/*
* The following #defines and #includes are present for backward
* compatibility only. They should not be used in future code.
*
* START BACKWARD COMPATIBILITY ONLY.
*/
#ifndef _CURSES_PRIVATE
/* This stuff needed for those pgms which include <sgtty.h> */
/* Undef things manually to avoid redefinition */
#undef USE_OLD_TTY
#undef B0
#undef B50
#undef B75
#undef B110
#undef B134
#undef B150
#undef B200
#undef B300
#undef B600
#undef B1200
#undef B1800
#undef B2400
#undef B4800
#undef B9600
#undef EXTA
#undef EXTB
#undef B57600
#undef B115200
#ifndef _TERMIOS_H_
#include <termios.h>
#endif
#ifndef _SYS_IOCTL_H_
#include <sys/ioctl.h>
#endif
#ifndef _SYS_IOCTL_COMPAT_H_
#include <sys/ioctl.compat.h> /* For sgttyb and related */
#endif
#define bool char
#define reg register
#ifndef TRUE
#define TRUE (1)
#endif
#ifndef FALSE
#define FALSE (0)
#endif
#define _puts(s) tputs(s, 0, __cputchar)
/* Old-style terminal modes access. */
#define baudrate() (cfgetospeed(&__baset))
#define crmode() cbreak()
#define erasechar() (__baset.c_cc[VERASE])
#define killchar() (__baset.c_cc[VKILL])
#define nocrmode() nocbreak()
/* WINDOW structure members name compatibility */
#define _curx curx
#define _cury cury
#define _begx begx
#define _begy begy
#define _maxx maxx
#define _maxy maxy
#define _tty __baset
#endif /* _CURSES_PRIVATE */
extern char GT; /* Gtty indicates tabs. */
extern char NONL; /* Term can't hack LF doing a CR. */
extern char UPPERCASE; /* Terminal is uppercase only. */
extern int My_term; /* Use Def_term regardless. */
extern char *Def_term; /* Default terminal type. */
/* Termcap capabilities. */
extern char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS,
PC, UL, XB, XN, XT, XS, XX;
extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
*DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6,
*K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL,
*KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF,
*SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS,
*VE, *al, *dl, *sf, *sr,
*AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM,
*RIGHT_PARM;
/* END BACKWARD COMPATIBILITY ONLY. */
/* 8-bit ASCII characters. */
#define unctrl(c) __unctrl[(c) & 0xff]
#define unctrllen(ch) __unctrllen[(ch) & 0xff]
extern char *__unctrl[256]; /* Control strings. */
extern char __unctrllen[256]; /* Control strings length. */
/*
* A window an array of __LINE structures pointed to by the 'lines' pointer.
* A line is an array of __LDATA structures pointed to by the 'line' pointer.
*
* IMPORTANT: the __LDATA structure must NOT induce any padding, so if new
* fields are added -- padding fields with *constant values* should ensure
* that the compiler will not generate any padding when storing an array of
* __LDATA structures. This is to enable consistent use of memcmp, and memcpy
* for comparing and copying arrays.
*/
typedef struct {
char ch; /* the actual character */
#define __STANDOUT 0x01 /* Added characters are standout. */
char attr; /* attributes of character */
} __LDATA;
#define __LDATASIZE (sizeof(__LDATA))
typedef struct {
#define __ISDIRTY 0x01 /* Line is dirty. */
#define __ISPASTEOL 0x02 /* Cursor is past end of line */
#define __FORCEPAINT 0x04 /* Force a repaint of the line */
u_int flags;
u_long hash; /* non-BSD */ /* Hash value for the line. */
size_t *firstchp, *lastchp; /* First and last chngd columns ptrs */
size_t firstch, lastch; /* First and last changed columns. */
__LDATA *line; /* Pointer to the line text. */
} __LINE;
typedef struct __window { /* Window structure. */
struct __window *nextp, *orig; /* Subwindows list and parent. */
size_t begy, begx; /* Window home. */
size_t cury, curx; /* Current x, y coordinates. */
size_t maxy, maxx; /* Maximum values for curx, cury. */
short ch_off; /* x offset for firstch/lastch. */
__LINE **lines; /* Array of pointers to the lines */
__LINE *lspace; /* line space (for cleanup) */
__LDATA *wspace; /* window space (for cleanup) */
#define __ENDLINE 0x001 /* End of screen. */
#define __FLUSH 0x002 /* Fflush(stdout) after refresh. */
#define __FULLWIN 0x004 /* Window is a screen. */
#define __IDLINE 0x008 /* Insert/delete sequences. */
#define __SCROLLWIN 0x010 /* Last char will scroll window. */
#define __SCROLLOK 0x020 /* Scrolling ok. */
#define __CLEAROK 0x040 /* Clear on next refresh. */
#define __WSTANDOUT 0x080 /* Standout window */
#define __LEAVEOK 0x100 /* If curser left */
#define __FULLLINE 0x200 /* Line width = terminal width. */
u_int flags;
} WINDOW;
/* Curses external declarations. */
extern WINDOW *curscr; /* Current screen. */
extern WINDOW *stdscr; /* Standard screen. */
typedef struct termios SGTTY;
extern SGTTY __orig_termios; /* Terminal state before curses */
extern SGTTY __baset; /* Our base terminal state */
extern int __tcaction; /* If terminal hardware set. */
extern int __tty_fileno; /* Terminal file descriptor */
extern int COLS; /* Columns on the screen. */
extern int LINES; /* Lines on the screen. */
extern char *ttytype; /* Full name of current terminal. */
#define ERR (0) /* Error return. */
#define OK (1) /* Success return. */
/* Standard screen pseudo functions. */
#define addbytes(s, n) __waddbytes(stdscr, s, n, 0)
#define addch(ch) waddch(stdscr, ch)
#define addnstr(s, n) waddnstr(stdscr, s, n)
#define addstr(s) __waddbytes(stdscr, s, strlen(s), 0)
#define clear() wclear(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
#define delch() wdelch(stdscr)
#define deleteln() wdeleteln(stdscr)
#define erase() werase(stdscr)
#define getch() wgetch(stdscr)
#define getstr(s) wgetstr(stdscr, s)
#define inch() winch(stdscr)
#define insch(ch) winsch(stdscr, ch)
#define insertln() winsertln(stdscr)
#define move(y, x) wmove(stdscr, y, x)
#define refresh() wrefresh(stdscr)
#define standend() wstandend(stdscr)
#define standout() wstandout(stdscr)
#define waddbytes(w, s, n) __waddbytes(w, s, n, 0)
#define waddstr(w, s) __waddbytes(w, s, strlen(s), 0)
/* Standard screen plus movement pseudo functions. */
#define mvaddbytes(y, x, s, n) mvwaddbytes(stdscr, y, x, s, n)
#define mvaddch(y, x, ch) mvwaddch(stdscr, y, x, ch)
#define mvaddnstr(y, x, s, n) mvwaddnstr(stdscr, y, x, s, n)
#define mvaddstr(y, x, s) mvwaddstr(stdscr, y, x, s)
#define mvdelch(y, x) mvwdelch(stdscr, y, x)
#define mvgetch(y, x) mvwgetch(stdscr, y, x)
#define mvgetstr(y, x, s) mvwgetstr(stdscr, y, x, s)
#define mvinch(y, x) mvwinch(stdscr, y, x)
#define mvinsch(y, x, c) mvwinsch(stdscr, y, x, c)
#define mvwaddbytes(w, y, x, s, n) \
(wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0))
#define mvwaddch(w, y, x, ch) \
(wmove(w, y, x) == ERR ? ERR : waddch(w, ch))
#define mvwaddnstr(w, y, x, s, n) \
(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n))
#define mvwaddstr(w, y, x, s) \
(wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, strlen(s), 0))
#define mvwdelch(w, y, x) \
(wmove(w, y, x) == ERR ? ERR : wdelch(w))
#define mvwgetch(w, y, x) \
(wmove(w, y, x) == ERR ? ERR : wgetch(w))
#define mvwgetstr(w, y, x, s) \
(wmove(w, y, x) == ERR ? ERR : wgetstr(w, s))
#define mvwinch(w, y, x) \
(wmove(w, y, x) == ERR ? ERR : winch(w))
#define mvwinsch(w, y, x, c) \
(wmove(w, y, x) == ERR ? ERR : winsch(w, c))
/* Psuedo functions. */
#define clearok(w, bf) \
((bf) ? ((w)->flags |= __CLEAROK) : ((w)->flags &= ~__CLEAROK))
#define flushok(w, bf) \
((bf) ? ((w)->flags |= __FLUSH) : ((w)->flags &= ~__FLUSH))
#define getyx(w, y, x) \
(y) = (w)->cury, (x) = (w)->curx
#define leaveok(w, bf) \
((bf) ? ((w)->flags |= __LEAVEOK) : ((w)->flags &= ~__LEAVEOK))
#define scrollok(w, bf) \
((bf) ? ((w)->flags |= __SCROLLOK) : ((w)->flags &= ~__SCROLLOK))
#define winch(w) \
((w)->lines[(w)->cury]->line[(w)->curx].ch & 0377)
/* Public function prototypes. */
int box __P((WINDOW *, int, int));
int cbreak __P((void));
int delwin __P((WINDOW *));
int echo __P((void));
int endwin __P((void));
char *fullname __P((char *, char *));
char *getcap __P((char *));
int gettmode __P((void));
void idlok __P((WINDOW *, int));
WINDOW *initscr __P((void));
char *longname __P((char *, char *));
int mvcur __P((int, int, int, int));
int mvprintw __P((int, int, const char *, ...));
int mvscanw __P((int, int, const char *, ...));
int mvwin __P((WINDOW *, int, int));
int mvwprintw __P((WINDOW *, int, int, const char *, ...));
int mvwscanw __P((WINDOW *, int, int, const char *, ...));
WINDOW *newwin __P((int, int, int, int));
int nl __P((void));
int nocbreak __P((void));
int noecho __P((void));
int nonl __P((void));
int noraw __P((void));
int overlay __P((WINDOW *, WINDOW *));
int overwrite __P((WINDOW *, WINDOW *));
int printw __P((const char *, ...));
int raw __P((void));
int resetty __P((void));
int savetty __P((void));
int scanw __P((const char *, ...));
int scroll __P((WINDOW *));
int setterm __P((char *));
int sscans __P((WINDOW *, const char *, ...));
WINDOW *subwin __P((WINDOW *, int, int, int, int));
int suspendwin __P((void));
int touchline __P((WINDOW *, int, int, int));
int touchoverlap __P((WINDOW *, WINDOW *));
int touchwin __P((WINDOW *));
int vwprintw __P((WINDOW *, const char *, _BSD_VA_LIST_));
int vwscanw __P((WINDOW *, const char *, _BSD_VA_LIST_));
int waddch __P((WINDOW *, int));
int waddnstr __P((WINDOW *, const char *, int));
int wclear __P((WINDOW *));
int wclrtobot __P((WINDOW *));
int wclrtoeol __P((WINDOW *));
int wdelch __P((WINDOW *));
int wdeleteln __P((WINDOW *));
int werase __P((WINDOW *));
int wgetch __P((WINDOW *));
int wgetstr __P((WINDOW *, char *));
int winsch __P((WINDOW *, int));
int winsertln __P((WINDOW *));
int wmove __P((WINDOW *, int, int));
int wprintw __P((WINDOW *, const char *, ...));
int wrefresh __P((WINDOW *));
int wscanw __P((WINDOW *, const char *, ...));
int wstandend __P((WINDOW *));
int wstandout __P((WINDOW *));
int vwprintw __P((WINDOW *, const char *, _BSD_VA_LIST_));
/* Private functions that are needed for user programs prototypes. */
void __cputchar __P((int));
int _putchar __P((int));
int __waddbytes __P((WINDOW *, const char *, int, int));
/* Private functions. */
#ifdef _CURSES_PRIVATE
void __CTRACE __P((const char *, ...));
u_long __hash __P((char *, int)); /* non-BSD */
void __id_subwins __P((WINDOW *));
int __mvcur __P((int, int, int, int, int));
void __restore_stophandler __P((void));
void __set_stophandler __P((void));
void __set_subwin __P((WINDOW *, WINDOW *));
void __set_scroll_region __P((int, int, int, int));
void __startwin __P((void));
void __stop_signal_handler __P((int, int)); /* non-BSD */
void __swflags __P((WINDOW *));
int __touchline __P((WINDOW *, int, int, int, int));
int __touchwin __P((WINDOW *));
char *__tscroll __P((const char *, int, int));
int __waddch __P((WINDOW *, __LDATA *));
/* Private #defines. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
/* Private externs. */
extern char DB;
extern int __echoit;
extern int __endwin;
extern int __pfast;
extern int __rawmode;
extern int __noqch;
extern int __usecs;
int tputs __P((const char *, int, void (*)(int)));
#else
int tputs __P((const char *, int, int (*)(int)));
#endif
/* Termcap functions. */
int tgetent __P((char *, const char *));
int tgetnum __P((const char *));
int tgetflag __P((const char *));
char *tgetstr __P((const char *, char **));
char *tgoto __P((const char *, int, int));
#endif /* !_CURSES_H_ */

225
include/db.h Normal file
View File

@ -0,0 +1,225 @@
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)db.h 8.4 (Berkeley) 2/21/94
*/
#ifndef _DB_H_
#define _DB_H_
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef _LIMITS_H_
#include <limits.h>
#endif
#define RET_ERROR -1 /* Return values. */
#define RET_SUCCESS 0
#define RET_SPECIAL 1
#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */
typedef u_int32_t pgno_t;
#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */
typedef u_int16_t indx_t;
#define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */
typedef u_int32_t recno_t;
/* Key/data structure -- a Data-Base Thang. */
typedef struct {
void *data; /* data */
size_t size; /* data length */
} DBT;
/* Routine flags. */
#define R_CURSOR 1 /* del, put, seq */
#define __R_UNUSED 2 /* UNUSED */
#define R_FIRST 3 /* seq */
#define R_IAFTER 4 /* put (RECNO) */
#define R_IBEFORE 5 /* put (RECNO) */
#define R_LAST 6 /* seq (BTREE, RECNO) */
#define R_NEXT 7 /* seq */
#define R_NOOVERWRITE 8 /* put */
#define R_PREV 9 /* seq (BTREE, RECNO) */
#define R_SETCURSOR 10 /* put (RECNO) */
#define R_RECNOSYNC 11 /* sync (RECNO) */
typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
/*
* !!!
* The following flags are included in the dbopen(3) call as part of the
* open(2) flags. In order to avoid conflicts with the open flags, start
* at the top of the 16 or 32-bit number space and work our way down. If
* the open flags were significantly expanded in the future, it could be
* a problem. Wish I'd left another flags word in the dbopen call.
*
* !!!
* None of this stuff is implemented yet. The only reason that it's here
* is so that the access methods can skip copying the key/data pair when
* the DB_LOCK flag isn't set.
*/
#if UINT_MAX > 65535
#define DB_LOCK 0x20000000 /* Do locking. */
#define DB_SHMEM 0x40000000 /* Use shared memory. */
#define DB_TXN 0x80000000 /* Do transactions. */
#else
#define DB_LOCK 0x2000 /* Do locking. */
#define DB_SHMEM 0x4000 /* Use shared memory. */
#define DB_TXN 0x8000 /* Do transactions. */
#endif
/* Access method description structure. */
typedef struct __db {
DBTYPE type; /* Underlying db type. */
int (*close) __P((struct __db *));
int (*del) __P((const struct __db *, const DBT *, u_int));
int (*get) __P((const struct __db *, const DBT *, DBT *, u_int));
int (*put) __P((const struct __db *, DBT *, const DBT *, u_int));
int (*seq) __P((const struct __db *, DBT *, DBT *, u_int));
int (*sync) __P((const struct __db *, u_int));
void *internal; /* Access method private. */
int (*fd) __P((const struct __db *));
} DB;
#define BTREEMAGIC 0x053162
#define BTREEVERSION 3
/* Structure used to pass parameters to the btree routines. */
typedef struct {
#define R_DUP 0x01 /* duplicate keys */
u_long flags;
u_int cachesize; /* bytes to cache */
int maxkeypage; /* maximum keys per page */
int minkeypage; /* minimum keys per page */
u_int psize; /* page size */
int (*compare) /* comparison function */
__P((const DBT *, const DBT *));
size_t (*prefix) /* prefix function */
__P((const DBT *, const DBT *));
int lorder; /* byte order */
} BTREEINFO;
#define HASHMAGIC 0x061561
#define HASHVERSION 2
/* Structure used to pass parameters to the hashing routines. */
typedef struct {
u_int bsize; /* bucket size */
u_int ffactor; /* fill factor */
u_int nelem; /* number of elements */
u_int cachesize; /* bytes to cache */
u_int32_t /* hash function */
(*hash) __P((const void *, size_t));
int lorder; /* byte order */
} HASHINFO;
/* Structure used to pass parameters to the record routines. */
typedef struct {
#define R_FIXEDLEN 0x01 /* fixed-length records */
#define R_NOKEY 0x02 /* key not required */
#define R_SNAPSHOT 0x04 /* snapshot the input */
u_long flags;
u_int cachesize; /* bytes to cache */
u_int psize; /* page size */
int lorder; /* byte order */
size_t reclen; /* record length (fixed-length records) */
u_char bval; /* delimiting byte (variable-length records */
char *bfname; /* btree file name */
} RECNOINFO;
#ifdef __DBINTERFACE_PRIVATE
/*
* Little endian <==> big endian 32-bit swap macros.
* M_32_SWAP swap a memory location
* P_32_SWAP swap a referenced memory location
* P_32_COPY swap from one location to another
*/
#define M_32_SWAP(a) { \
u_int32_t _tmp = a; \
((char *)&a)[0] = ((char *)&_tmp)[3]; \
((char *)&a)[1] = ((char *)&_tmp)[2]; \
((char *)&a)[2] = ((char *)&_tmp)[1]; \
((char *)&a)[3] = ((char *)&_tmp)[0]; \
}
#define P_32_SWAP(a) { \
u_int32_t _tmp = *(u_int32_t *)a; \
((char *)a)[0] = ((char *)&_tmp)[3]; \
((char *)a)[1] = ((char *)&_tmp)[2]; \
((char *)a)[2] = ((char *)&_tmp)[1]; \
((char *)a)[3] = ((char *)&_tmp)[0]; \
}
#define P_32_COPY(a, b) { \
((char *)&(b))[0] = ((char *)&(a))[3]; \
((char *)&(b))[1] = ((char *)&(a))[2]; \
((char *)&(b))[2] = ((char *)&(a))[1]; \
((char *)&(b))[3] = ((char *)&(a))[0]; \
}
/*
* Little endian <==> big endian 16-bit swap macros.
* M_16_SWAP swap a memory location
* P_16_SWAP swap a referenced memory location
* P_16_COPY swap from one location to another
*/
#define M_16_SWAP(a) { \
u_int16_t _tmp = a; \
((char *)&a)[0] = ((char *)&_tmp)[1]; \
((char *)&a)[1] = ((char *)&_tmp)[0]; \
}
#define P_16_SWAP(a) { \
u_int16_t _tmp = *(u_int16_t *)a; \
((char *)a)[0] = ((char *)&_tmp)[1]; \
((char *)a)[1] = ((char *)&_tmp)[0]; \
}
#define P_16_COPY(a, b) { \
((char *)&(b))[0] = ((char *)&(a))[1]; \
((char *)&(b))[1] = ((char *)&(a))[0]; \
}
#endif
__BEGIN_DECLS
DB *dbopen __P((const char *, int, int, DBTYPE, const void *));
#ifdef __DBINTERFACE_PRIVATE
DB *__bt_open __P((const char *, int, int, const BTREEINFO *, int));
DB *__hash_open __P((const char *, int, int, const HASHINFO *, int));
DB *__rec_open __P((const char *, int, int, const RECNOINFO *, int));
void __dbpanic __P((DB *dbp));
#endif
__END_DECLS
#endif /* !_DB_H_ */

34
include/defaults.h Normal file
View File

@ -0,0 +1,34 @@
/*************************************************
* Start of GNO v2.0.6 definitions.
*
* $Id: defaults.h,v 1.1 1997/02/28 04:42:01 gdr Exp $
*/
#define __appleiigs__
#define __GNO__
/*
* __ORCAC_VERSION should be:
* undefined for Orca/C earlier than v2.1.0
* 210 for Orca/C v2.1.0 - v2.1.1b1
* 211 for Orca/C v2.1.1b2 and higher
* Note that if you have Orca/C v2.0.x or earlier, it doesn't even
* include this file by default.
*/
#define __ORCAC_VERSION 211
/*
* These should be identically equal. Orca/C headers use one, BSD headers
* use the other. Unfortunately, this construct will miss definitions
* given in source files -- it is only caught on the occ command line.
*/
#if defined(__KeepNamespacePure__) && !defined(_ANSI_SOURCE)
#define _ANSI_SOURCE
#endif
#if defined(_ANSI_SOURCE) && !defined(__KeepNamespacePure__)
#define __KeepNamespacePure__
#endif
/*
* End of GNO v2.0.6 definitions.
*************************************************/

111
include/dirent.h Normal file
View File

@ -0,0 +1,111 @@
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)dirent.h 8.1 (Berkeley) 6/8/93
*/
#ifndef _DIRENT_H_
#define _DIRENT_H_
/*
* The kernel defines the format of directory entries returned by
* the getdirentries(2) system call.
*/
#ifndef _SYS_DIRENT_H_
#include <sys/dirent.h>
#endif
#ifdef _POSIX_SOURCE
typedef void * DIR;
#else
#define d_ino d_fileno /* backward compatibility */
/* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024
/* avoid requirement for <gsos.h> in user code */
#ifdef __LIBC_DIRENT
#define _DATA_T struct dirent *
#define _ENT_T DirEntryRecGS *
#else
#define _DATA_T void *
#define _ENT_T void *
#endif
/* structure describing an open directory. */
typedef struct _dirdesc {
int dd_fd; /* file descriptor associated with directory */
_ENT_T dd_ent; /* libc internal use only! */
_DATA_T dd_data; /* the current entry */
} DIR;
#undef _ENT_T
#undef _DATA_T
#define dirfd(dirp) ((dirp)->dd_fd)
#ifndef NULL
#define NULL (void *) 0L
#endif
#endif /* _POSIX_SOURCE */
#ifndef KERNEL
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
__BEGIN_DECLS
DIR *opendir __P((const char *));
struct dirent *readdir __P((DIR *));
void rewinddir __P((DIR *));
int closedir __P((DIR *));
#ifndef _POSIX_SOURCE
long telldir __P((const DIR *));
void seekdir __P((DIR *, long));
int scandir __P((const char *, struct dirent ***,
int (*)(struct dirent *), int (*)(const void *, const void *)));
int alphasort __P((const void *, const void *));
int alphacasesort __P((const void *, const void *)); /* GNO-specific */
int getdirentries __P((int, char *, int, long *));
#endif /* not POSIX */
__END_DECLS
#endif /* !KERNEL */
#endif /* !_DIRENT_H_ */

68
include/err.h Normal file
View File

@ -0,0 +1,68 @@
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)err.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ERR_H_
#define _ERR_H_
/*
* Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two
* places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
* of them here we may collide with the utility's includes. It's unreasonable
* for utilities to have to include one of them to include err.h, so we get
* _BSD_VA_LIST_ from <machine/ansi.h> and use it.
*/
#ifndef _MACHINE_ANSI_H_
#include <machine/ansi.h>
#endif
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
__dead void err __P((int, const char *, ...)) __dead2;
__dead void verr __P((int, const char *, _BSD_VA_LIST_)) __dead2;
__dead void errx __P((int, const char *, ...)) __dead2;
__dead void verrx __P((int, const char *, _BSD_VA_LIST_)) __dead2;
void warn __P((const char *, ...));
void vwarn __P((const char *, _BSD_VA_LIST_));
void warnx __P((const char *, ...));
void vwarnx __P((const char *, _BSD_VA_LIST_));
void err_set_file __P((void *));
void err_set_exit __P((void (*)__P((int))));
__END_DECLS
#endif /* !_ERR_H_ */

14
include/errno.h Normal file
View File

@ -0,0 +1,14 @@
/*
* Too bad we don't have symlinks for GNO ...
*
* $Id: errno.h,v 1.1 1997/02/28 04:42:01 gdr Exp $
*/
#ifndef _ERRNO_H_
#define _ERRNO_H_
#ifndef _SYS_ERRNO_H_
#include <sys/errno.h>
#endif
#endif

15
include/fcntl.h Normal file
View File

@ -0,0 +1,15 @@
/*
* Too bad we don't have symlinks for GNO ...
*
* $Id: fcntl.h,v 1.1 1997/02/28 04:42:01 gdr Exp $
*/
#ifndef _FCNTL_H_
#define _FCNTL_H_
#ifndef _SYS_FCNTL_H_
#include <sys/fcntl.h>
#endif
#endif

58
include/fnmatch.h Normal file
View File

@ -0,0 +1,58 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _FNMATCH_H_
#define _FNMATCH_H_
#define FNM_NOMATCH 1 /* Match failed. */
#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
#define FNM_PERIOD 0x04 /* Period must be matched by period. */
#ifndef _POSIX_SOURCE
#define FNM_CASEFOLD 0x08 /* Case insensitive match (GNO-specific) */
#endif
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
#ifndef _POSIX_SOURCE
int fnmatch __P((const char *, const char *, int));
#endif
__END_DECLS
#endif /* !_FNMATCH_H_ */

128
include/fts.h Normal file
View File

@ -0,0 +1,128 @@
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)fts.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _FTS_H_
#define _FTS_H_
typedef struct {
struct _ftsent *fts_cur; /* current node */
struct _ftsent *fts_child; /* linked list of children */
struct _ftsent **fts_array; /* sort array */
dev_t fts_dev; /* starting device # */
char *fts_path; /* path for this descent */
int fts_rfd; /* fd for root */
int fts_pathlen; /* sizeof(path) */
int fts_nitems; /* elements in the sort array */
int (*fts_compar)(const void *, const void *);
/* compare function */
#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */
#define FTS_LOGICAL 0x002 /* logical walk */
#define FTS_NOCHDIR 0x004 /* don't change directories */
#define FTS_NOSTAT 0x008 /* don't get stat info */
#define FTS_PHYSICAL 0x010 /* physical walk */
#define FTS_SEEDOT 0x020 /* return dot and dot-dot */
#define FTS_XDEV 0x040 /* don't cross devices */
#define FTS_OPTIONMASK 0x07f /* valid user option mask */
#define FTS_NAMEONLY 0x080 /* (private) child names only */
#define FTS_STOP 0x100 /* (private) unrecoverable error */
int fts_options; /* fts_open options, global flags */
} FTS;
typedef struct _ftsent {
struct _ftsent *fts_cycle; /* cycle node */
struct _ftsent *fts_parent; /* parent directory */
struct _ftsent *fts_link; /* next file in directory */
long fts_number; /* local numeric value */
void *fts_pointer; /* local address value */
char *fts_accpath; /* access path */
char *fts_path; /* root path */
int fts_errno; /* errno for this node */
int fts_symfd; /* fd for symlink */
u_short fts_pathlen; /* strlen(fts_path) */
u_short fts_namelen; /* strlen(fts_name) */
ino_t fts_ino; /* inode */
dev_t fts_dev; /* device */
nlink_t fts_nlink; /* link count */
#define FTS_ROOTPARENTLEVEL -1
#define FTS_ROOTLEVEL 0
short fts_level; /* depth (-1 to N) */
#define FTS_D 1 /* preorder directory */
#define FTS_DC 2 /* directory that causes cycles */
#define FTS_DEFAULT 3 /* none of the above */
#define FTS_DNR 4 /* unreadable directory */
#define FTS_DOT 5 /* dot or dot-dot */
#define FTS_DP 6 /* postorder directory */
#define FTS_ERR 7 /* error; errno is set */
#define FTS_F 8 /* regular file */
#define FTS_INIT 9 /* initialized only */
#define FTS_NS 10 /* stat(2) failed */
#define FTS_NSOK 11 /* no stat(2) requested */
#define FTS_SL 12 /* symbolic link */
#define FTS_SLNONE 13 /* symbolic link without target */
u_short fts_info; /* user flags for FTSENT structure */
#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
u_short fts_flags; /* private flags for FTSENT structure */
#define FTS_AGAIN 1 /* read node again */
#define FTS_FOLLOW 2 /* follow symbolic link */
#define FTS_NOINSTR 3 /* no instructions */
#define FTS_SKIP 4 /* discard node */
u_short fts_instr; /* fts_set() instructions */
struct stat *fts_statp; /* stat(2) information */
char fts_name[1]; /* file name */
} FTSENT;
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
FTSENT *fts_children __P((FTS *, int));
int fts_close __P((FTS *));
FTS *fts_open __P((char * const *, int,
int (*)(const FTSENT **, const FTSENT **)));
FTSENT *fts_read __P((FTS *));
int fts_set __P((FTS *, FTSENT *, int));
__END_DECLS
#endif /* !_FTS_H_ */

92
include/glob.h Normal file
View File

@ -0,0 +1,92 @@
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Guido van Rossum.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)glob.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _GLOB_H_
#define _GLOB_H_
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
struct stat;
typedef struct {
int gl_pathc; /* Count of total paths so far. */
int gl_matchc; /* Count of paths matching pattern. */
int gl_offs; /* Reserved at beginning of gl_pathv. */
int gl_flags; /* Copy of flags parameter to glob. */
char **gl_pathv; /* List of paths matching pattern. */
/* Copy of errfunc parameter to glob. */
int (*gl_errfunc) __P((const char *, int));
/*
* Alternate filesystem access methods for glob; replacement
* versions of closedir(3), readdir(3), opendir(3), stat(2)
* and lstat(2).
*/
void (*gl_closedir) __P((void *));
struct dirent *(*gl_readdir) __P((void *));
void *(*gl_opendir) __P((const char *));
int (*gl_lstat) __P((const char *, struct stat *));
int (*gl_stat) __P((const char *, struct stat *));
} glob_t;
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
#define GLOB_ERR 0x0004 /* Return on error. */
#define GLOB_MARK 0x0008 /* Append / to matching directories. */
#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
#define GLOB_NOSORT 0x0020 /* Don't sort. */
#ifndef _POSIX_SOURCE
#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
#endif
#define GLOB_NOSPACE (-1) /* Malloc call failed. */
#define GLOB_ABEND (-2) /* Unignored error. */
__BEGIN_DECLS
int glob __P((const char *, int, int (*)(const char *, int), glob_t *));
void globfree __P((glob_t *));
__END_DECLS
#endif /* !_GLOB_H_ */

32
include/gno/conf.h Normal file
View File

@ -0,0 +1,32 @@
/*
* conf.h -- Configuration and size constants. Note that most of these
* are meaningless on the IIgs.
*
* $Id: conf.h,v 1.1 1997/02/28 04:42:06 gdr Exp $
*/
#ifndef _GNO_CONF_H_
#define _GNO_CONF_H_
/*
* the following defines can be changed but not deleted
*/
#define NPROC 32 /* max user processes */
/*
* the following defines can be changed or deleted
*/
#define GNOVERSION \
"for GS/OS 3.0 on Apple IIgs (65816) (5/28/91) - Jawaid Bazyar"
#define MESSAGE /* message passing available */
#define NSEM 50 /* total number of semaphores */
#define RTCLOCK /* system has a real-time clock */
#define QUANTUM 100 /* milliseconds a process is allowed
to run without being rescheduled */
#define DEBUG_RESCHED /* if defined, displays information
about the processes being scheduled */
#endif /* _GNO_CONF_H_ */

118
include/gno/gno.h Normal file
View File

@ -0,0 +1,118 @@
/*
* gno/gno.h This collection of declarations are for routines that
* reside in libc, but are Apple IIgs or GNO specific.
*
* $Id: gno.h,v 1.1 1997/02/28 04:42:06 gdr Exp $
*/
#ifndef _GNO_GNO_H_
#define _GNO_GNO_H_
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef __TYPES__
#include <types.h>
#endif
#ifndef _STDLIB_H_
#include <stdlib.h>
#endif
#ifndef udispatch
#define udispatch 0xE10008
#endif
/* Arguments to setdebug(2) -- unverified */
#define dbgGSOS 0x0001
#define dbgPATH 0x0002
#define dbgERROR 0x0004
#define dbgSIG 0x0008
#define dbgSYSCALL 0x0010
#define dbgPBLOCK 0x0020
/* Environment Information */
char * __prognameGS __P((void));
char * buildCmd __P((char * const *));
int buildEnv __P((char * const *));
char * buildPath __P((const char *));
int isRootPath __P((const char *));
int needsgno __P((void));
int setdebug __P((int));
void * setsystemvector __P((void *));
int InstallNetDriver __P((caddr_t netcore, short domain));
void SetGNOQuitRec __P((word pCount, GSStringPtr pathname,
word flags));
#if defined(__ORCAC__) && !defined(__KERN_STATUS)
#define __KERN_STATUS /* conflict with <gno/kerntool.h> */
pascal int kernVersion(void) inline(0x0403, udispatch);
pascal int kernStatus(void) inline(0x0603, udispatch);
#endif
/* Stack Checking */
void _beginStackCheck __P((void));
int _endStackCheck __P((void));
/* String Conversions */
#define GIfree(a) free(a)
#define GOfree(a) free(a)
GSStringPtr __C2GS __P((const char *, GSStringPtr));
GSStringPtr __C2GSMALLOC __P((const char *));
char * __GS2C __P((char *, const GSStringPtr));
char * __GS2CMALLOC __P((const GSStringPtr));
GSStringPtr GIinit __P((word, const char *));
GSStringPtr GIchange __P((GSStringPtr, word, const char *));
ResultBufPtr GOinit __P((word, const char *));
ResultBufPtr GOchange __P((ResultBufPtr, word, const char *));
/* Mapping */
char * _mapPath __P((char *));
GSStringPtr _mapPathGS __P((GSStringPtr));
int _getPathMapping __P((void));
int _setPathMapping __P((int));
mode_t _mapMode2GS __P((mode_t));
mode_t _mapMode2Unix __P((mode_t));
int _getModeEmulation __P((void));
int _setModeEmulation __P((int));
int _mapErr __P((int));
/* Message Passing IPC */
int procsend __P((pid_t, unsigned long));
unsigned long procreceive __P((void));
unsigned long procrecvtim __P((short));
unsigned long procrecvclr __P((void));
/* Job Control */
int tcnewpgrp __P((int));
int tctpgrp __P((int, pid_t));
int settpgrp __P((int));
/* Semaphores */
int scount __P((int));
int screate __P((int));
int sdelete __P((int));
int ssignal __P((int));
int swait __P((int));
/* Timers */
unsigned long alarm10 __P((unsigned long tenths));
/* Network */
int InstallNetDriver __P((void *pr_usrreq, int domain));
/* Kernel Virtual Memory */
#ifdef KERNEL
kvm_t * kvm_open __P((void)); /* non-BSD */
int kvm_close __P((kvm_t *));
struct pentry * kvm_getproc __P((kvm_t *, pid_t));
struct pentry * kvm_nextproc __P((kvm_t *));
int kvm_setproc __P((kvm_t *));
#endif
#endif /* _GNO_GNO_H_ */

90
include/gno/kerntool.h Normal file
View File

@ -0,0 +1,90 @@
/*
* ToolBox interface file for the GNO version 1.0.6 Kernel.
*
* Copyright 1991-1996, Procyon Inc.
*
* $Id: kerntool.h,v 1.1 1997/02/28 04:42:06 gdr Exp $
*/
#ifndef _GNO_KERNTOOL_H_
#define _GNO_KERNTOOL_H_
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef __TYPES__
#include <types.h>
#endif
#ifndef udispatch
#define udispatch 0xE10008
#endif
pascal void kernBootInit(void) inline(0x0103, udispatch);
pascal void kernStartUp(void) inline(0x0203, udispatch);
pascal void kernShutDown(void) inline(0x0303, udispatch);
pascal void kernReset(void) inline(0x0503, udispatch);
#if defined(__ORCAC__) && !defined(__KERN_STATUS)
#define __KERN_STATUS /* conflict with <gno/kerntool.h> */
pascal int kernVersion(void) inline(0x0403, udispatch);
pascal int kernStatus(void) inline(0x0603, udispatch);
#endif
/* 0x0703, 0x0803 undocumented */
pascal int Kgetpid(void) inline(0x0903, udispatch);
pascal int Kkill(int pid, int sig) inline (0x0A03, udispatch);
pascal int Kfork(void *subr) inline(0x0B03, udispatch);
pascal int Kexec(char *filename,char *cmdline) inline(0x0C03, udispatch);
pascal int Kswait(int sem) inline(0x0D03, udispatch);
pascal int Kssignal(int sem) inline(0x0E03, udispatch);
pascal int Kscreate(int count) inline(0x0F03, udispatch);
pascal int Ksdelete(int sem) inline(0x1003, udispatch);
/* kvm 1103 thru 1503 */
pascal void * Ksignal(int sig, void (*func)()) inline(0x1603, udispatch);
pascal int Kwait(union wait *status) inline(0x1703, udispatch);
pascal int Ktcnewpgrp(int fdtty) inline(0x1803, udispatch);
pascal int Ksettpgrp(int fdtty) inline(0x1903, udispatch);
pascal int Ktctpgrp(int fdtty, int pid) inline(0x1A03, udispatch);
pascal longword Ksigsetmask(longword mask) inline(0x1B03, udispatch);
pascal longword Ksigblock(longword mask) inline(0x1C03, udispatch);
# pascal int K_execve(char *filename,char *cmdline)
inline(0x1D03,udispatch);
#pascal longword Kalarm(longword seconds) inline(0x1E03,udispatch);
pascal int Ksetdebug(int code) inline(0x1F03,udispatch);
pascal void * Ksetsystemvector(void *vect) inline(0x2003,udispatch);
pascal int Ksigpause(longword mask) inline(0x2103,udispatch);
pascal int Kdup(int filedes)
Kdup2
Kpipe
Kgetpgrp
Kioctl
Kstat
Kfstat
Klstat
Kgetuid
Kgetgid
Kgeteuid
Kgetegid
Ksetuid
Ksetgid
Kprocsend
Kprocreceive
Krecvclr
Krecvtim
Ksetpgrp
Ktimes
Kpcreate
Kpsend
Kpreceive
Kpdelete
Kpreset
Kpbind
Kpgetport
Kpgetcount
Kscount
Kfork2
#endif /* _GNO_KERNTOOL_H_ */

41
include/gno/kvm.h Normal file
View File

@ -0,0 +1,41 @@
/*
* Kernel VM access routines
* written June 4, 1991 by Jawaid Bazyar
* mod. October 17, 1991 for new call paradigm
* Copyright 1991-1996 Procyon, Inc.
*
* Note that there is absolutely no VM involved here, I simply kept the
* same names as BSD/SunOS for compatibility.
*
* $Id: kvm.h,v 1.1 1997/02/28 04:42:06 gdr Exp $
*/
#ifndef _GNO_KVM_H_
#define _GNO_KVM_H_
#ifndef __TYPES__
#include <types.h>
#endif
#ifndef _GNO_PROC_H_
#include <gno/proc.h>
#endif
struct kvmt {
int procIndex; /* don't futz with this */
int pid; /* you can use this to determine pid */
struct pentry kvm_pent;
};
typedef struct kvmt kvmt;
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
kvmt * kvm_open __P((void));
int kvm_close __P((kvmt *k));
struct pentry * kvmgetproc __P((kvmt *kd, int pid));
struct pentry * kvmnextproc __P((kvmt *kd));
int kvmsetproc __P((kvmt *kd));
#endif /* _GNO_KVM_H_ */

157
include/gno/proc.h Normal file
View File

@ -0,0 +1,157 @@
/*
* Kernel Process table structure
* Copyright 1991-1996 Procyon, Inc.
*
* $Id: proc.h,v 1.1 1997/02/28 04:42:06 gdr Exp $
*/
#ifndef _GNO_PROC_H_
#define _GNO_PROC_H_
#ifndef __TYPES__
#include <types.h>
#endif
#ifndef _SYS_SIGNAL_H_
#include <sys/signal.h>
#endif
/* the various process states are defined here */
#define procUNUSED 0
#define procRUNNING 1
#define procREADY 2
#define procBLOCKED 3
#define procNEW 4
#define procSUSPENDED 5
#define procWAIT 6
#define procWAITSIGCH 7
#define procPAUSED 8
#define procSLEEP 9
#define BLOCKED_RECEIVE 2
#define BLOCKED_PRECEIVE 3
#define SYSERR -1
#define SYSOK 0
#define rtGSOS 0
#define rtPIPE 1
#define rtTTY 2
#define rtSOCKET 3
#define rfPIPEREAD 1 /* read end of the pipe */
#define rfPIPEWRITE 2 /* write end of the pipe */
#define rfCLOSEEXEC 4 /* close this file on an exec() */
#define rfP16NEWL 8 /* special prodos-16 newline mode */
typedef struct fdentry {
word refNum; /* refNum, pipeNum, ttyID, or sockNum */
word refType; /* 0 = GS/OS refnum, 1 = pipe, 2 = tty, 3 = socket */
word refLevel; /* "file level" of the refnum */
word refFlags; /* see flags above */
word NLenableMask; /* these three fields are for newline handling */
word NLnumChars;
void *NLtable;
} fdentry, *fdentryPtr;
typedef struct fdtable {
word fdCount;
word fdLevel;
word fdLevelMode;
word fdTableSize;
fdentry fds[1];
} fdtable, *fdtablePtr;
#define FD_SIZE 32
typedef struct quitStack {
struct quitStack *next;
char data[1];
} quitStack;
/* these flags are set by _execve() and fork() during process creation. */
#define FL_RESOURCE 1 /* does the process have and use a resource fork? */
#define FL_FORKED 2 /* was the process started with fork() ? */
#define FL_COMPLIANT 4 /* is the process fully GNO compliant? */
#define FL_NORMTERM 8 /* did the program terminate via exit()? 1=yes */
#define FL_RESTART 16 /* is the program restartable? (set by QuitGS) */
#define FL_NORESTART 32 /* don't allow this code to restart */
#define FL_QDSTARTUP 64 /* flag set if QDStartUp was called */
#define FL_MSGRECVD 128 /* flag set if there's a send() msg waiting */
#define FL_SELECTING 256 /* this process is 'selecting' */
struct pentry {
int parentpid; /* pid of this process' parent */
int processState;
int userID; /* a GS/OS UserID, used to keep track of memory */
int ttyID; /* driver (not GS/OS) number of i/o port */
word irq_A; /* context information for the process */
word irq_X;
word irq_Y;
word irq_S;
word irq_D;
byte irq_B;
byte irq_B1;
word irq_P;
word irq_state;
word irq_PC;
word irq_K;
int psem; /* semaphoreID process is blocked on */
char **prefix; /* cwd's (GS/OS prefixes 0,1, and 9 */
char *args; /* the command line that invoked the process program */
char **env; /* environment variables for the program */
struct sigrec *siginfo; /* global mask of which signals are blocked */
byte irq_SLTROM;
byte irq_STATEREG;
word lastTool;
longword ticks;
word flags;
fdtablePtr openFiles;
word pgrp;
word exitCode;
void *LInfo;
word stoppedState; /* process state before stoppage */
longword alarmCount;
void *executeHook; /* for a good time call... */
word queueLink;
#ifdef KERNEL
chldInfoPtr waitq; /* where waits wait to be processed */
#else
void *waitq;
#endif
int waitdone;
int flpid;
quitStack *returnStack;
word t2StackPtr;
word p_uid, p_gid;
word p_euid, p_egid;
word SANEwap;
longword msg;
longword childTicks;
unsigned long p_waitvec;
unsigned p_slink;
struct pentry *p_link,*p_rlink;
int p_prio;
/* no unused entries */
};
typedef struct pentry procState, *procStatePtr;
#ifdef KERNEL
struct kernelStruct {
procState procTable[32];
int curProcInd;
int userID;
int mutex;
int timeleft;
int numProcs;
word truepid;
word shutdown;
word gsosDebug;
int floatingPID;
};
typedef struct kernelStruct kernelStruct, *kernelStructPtr;
#endif /* KERNEL */
#endif /* _GNO_PROC_H_ */

46
include/gno/sim.h Normal file
View File

@ -0,0 +1,46 @@
/*
* Serial Interrupt Manager
* C Interface File
* Copyright 1993-1996, Procyon Enterprises Incorporated
*
* Free distribution is hereby granted for use with the SIM tool.
*
* $Id: sim.h,v 1.1 1997/02/28 04:42:06 gdr Exp $
*/
#ifndef _GNO_SIM_H_
#define _GNO_SIM_H_
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
extern int SIMVERSION __P((int *versionPtr));
extern int INSTALLINTVECT __P((int port, unsigned long address));
extern int REMOVEINTVECT __P((int port, unsigned long address));
#define SIMVersion SIMVERSION
#define InstallIntVect INSTALLINTVECT
#define RemoveIntVect REMOVEINTVECT
#define SIMPrinterPort 1
#define SIMModemPort 2
#define SIMIRQ0 3
#define SIMIRQ1 4
#define SIMIRQ2 5
#define SIMIRQ3 6
#define SIMIRQ4 7
#define SIMIRQ5 8
#define SIMIRQ6 9
#define SIMIRQ7 10
#define SIMNoError 0
#define SIMAlreadyInst 1
#define SIMInvalidAddr 2
#define SIMATalkActive 3
#define SIMNotInstalled 4
#define SIMInvalidPort 5
#define SIMNotFound 6
#define SIMNO8259 7
#endif /* _GNO_SIM_H_ */

71
include/grp.h Normal file
View File

@ -0,0 +1,71 @@
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)grp.h 8.2 (Berkeley) 1/21/94
*/
#ifndef _GRP_H_
#define _GRP_H_
#ifndef _POSIX_SOURCE
#define _PATH_GROUP "/etc/group"
#endif
struct group {
char *gr_name; /* group name */
char *gr_passwd; /* group password */
int gr_gid; /* group id */
char **gr_mem; /* group members */
};
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
struct group *getgrgid __P((gid_t));
struct group *getgrnam __P((const char *));
#ifndef _POSIX_SOURCE
struct group *getgrent __P((void));
int setgrent __P((void));
void endgrent __P((void));
void setgrfile __P((const char *));
int setgroupent __P((int));
#endif
__END_DECLS
#endif /* !_GRP_H_ */

46
include/libutil.h Normal file
View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 1995 Peter Wemm <peter@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, is permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. This work was done expressly for inclusion into FreeBSD. Other use
* is permitted provided this notation is included.
* 4. Absolutely no warranty of function or purpose is made by the author
* Peter Wemm.
* 5. Modifications may be freely made to this file providing the above
* conditions are met.
*
* $Id: libutil.h,v 1.1 1997/02/28 04:42:01 gdr Exp $
*/
#ifndef _LIBUTIL_H_
#define _LIBUTIL_H_
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
/* Avoid pulling in all the include files for no need */
struct termios;
struct winsize;
struct utmp;
__BEGIN_DECLS
void setproctitle __P((const char *fmt, ...));
void login __P((struct utmp *ut));
int login_tty __P((int fd));
int logout __P((char *line));
void logwtmp __P((char *line, char *name, char *host));
int openpty __P((int *amaster, int *aslave, char *name,
struct termios *termp, struct winsize *winp));
__END_DECLS
#endif /* !_LIBUTIL_H_ */

69
include/limits.h Normal file
View File

@ -0,0 +1,69 @@
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.2 (Berkeley) 1/4/94
*/
#ifndef _LIMITS_H_
#define _LIMITS_H_
#define _POSIX_ARG_MAX 1024 /* non-POSIX: was 4096 */
#define _POSIX_CHILD_MAX 6
#define _POSIX_LINK_MAX 1 /* non-POSIX */
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#define _POSIX_TZNAME_MAX 3
#define _POSIX2_BC_BASE_MAX 99
#define _POSIX2_BC_DIM_MAX 2048
#define _POSIX2_BC_SCALE_MAX 99
#define _POSIX2_BC_STRING_MAX 1000
#define _POSIX2_EQUIV_CLASS_MAX 2
#define _POSIX2_EXPR_NEST_MAX 32
#define _POSIX2_LINE_MAX 2048
#define _POSIX2_RE_DUP_MAX 255
#ifndef _MACHINE_LIMITS_H_
#include <machine/limits.h>
#endif
#ifndef _SYS_SYSLIMITS_H_
#include <sys/syslimits.h>
#endif
#endif /* !_LIMITS_H_ */

106
include/machine/ansi.h Normal file
View File

@ -0,0 +1,106 @@
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ansi.h 8.2 (Berkeley) 1/4/94
* $Id: ansi.h,v 1.1 1997/02/28 04:42:07 gdr Exp $
*/
#ifndef _MACHINE_ANSI_H_
#define _MACHINE_ANSI_H_
/*
* Types which are fundamental to the implementation and must be declared
* in more than one standard header are defined here. Standard headers
* then use:
* #ifdef _BSD_SIZE_T_
* typedef _BSD_SIZE_T_ size_t;
* #undef _BSD_SIZE_T_
* #endif
*/
#define _BSD_CLOCK_T_ unsigned long /* clock() */
#define _BSD_PTRDIFF_T_ long /* non-BSD */ /* ptr1 - ptr2 */
#define _BSD_SIZE_T_ unsigned long /* non-BSD */ /* sizeof() */
#define _BSD_SSIZE_T_ long /* non-BSD *//* byte count or error */
#define _BSD_TIME_T_ long /* time() */
/*
* Types which are fundamental to the implementation and must be used
* in more than one standard header although they are only declared in
* one (perhaps nonstandard) header are defined here. Standard headers
* use _BSD_XXX_T_ without undef'ing it.
*/
#define _BSD_OFF_T_ long /* non-BSD */ /* file offset */
#define _BSD_PID_T_ short /* non-BSD */ /* process [group] */
#ifndef __va_list__
#define __va_list__
typedef char *__va_list[2];
#endif
#define _BSD_VA_LIST_ __va_list /* non-BSD: was 'char *' */
/*
* Runes (wchar_t) is declared to be an ``int'' instead of the more natural
* ``unsigned long'' or ``long''. Two things are happening here. It is not
* unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
* it looks like 10646 will be a 31 bit standard. This means that if your
* ints cannot hold 32 bits, you will be in trouble. The reason an int was
* chosen over a long is that the is*() and to*() routines take ints (says
* ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you
* lose a bit of ANSI conformance, but your programs will still work.
*
* Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t
* and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains
* defined for ctype.h.
*/
/*
* BSD uses int (32 bit). Orca/C's ints are 16 bits, so there may be
* problems in the future.
*/
#define _BSD_WCHAR_T_ int /* wchar_t */
#define _BSD_RUNE_T_ int /* rune_t */
/*
* Frequencies of the clock ticks reported by clock() and times(). They
* are the same as stathz for bogus historical reasons. They should be
* 1e6 because clock() and times() are implemented using getrusage() and
* there is no good reason why they should be less accurate. There is
* the bad reason that (broken) programs might not like clock_t or
* CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough
* to hold the required 24 hours worth of ticks if the frequency is
* 1000000ul, and ``unsigned long long'' would be nonstandard).
*/
#define _BSD_CLK_TCK_ 60 /* non-BSD */
#define _BSD_CLOCKS_PER_SEC_ 60 /* non-BSD */
#endif /* !_MACHINE_ANSI_H_ */

40
include/machine/endian.h Normal file
View File

@ -0,0 +1,40 @@
/*
* machine/endian.h for the IIgs.
*
* $Id: endian.h,v 1.1 1997/02/28 04:42:07 gdr Exp $
*/
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_ 1
/*
* Define the order of 32-bit words in 64-bit words.
*
* These may cause problems under Orca/C as there is no base 64 bit
* type.
*/
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, 65c816 */
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define BYTE_ORDER LITTLE_ENDIAN
#define ntohl(x) ((0xff & (x)>>24) | (0xff00 & (x)>>8) | \
(0xff0000 & (x)<<8) | (0xff000000 & (x)<<24))
#define ntohs(x) ((0xff & (x)>>8) | (0xff00 & (x)<<8))
#define htonl(x) ntohl(x)
#define htons(x) ntohs(x)
#define NTOHL(x) ntohl(x)
#define NTOHS(x) ntohs(x)
#define HTONL(x) htonl(x)
#define HTONS(x) htons(x)
#endif /* _MACHINE_ENDIAN_H_ */

46
include/machine/limits.h Normal file
View File

@ -0,0 +1,46 @@
/*
* $Id: limits.h,v 1.1 1997/02/28 04:42:07 gdr Exp $
*/
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 1 /* Allow 31 bit UTF2 */
/*
* According to ANSI (section 2.2.4.2), the values below must be usable by
* #if preprocessing directives. Additionally, the expression must have the
* same type as would an expression that is an object of the corresponding
* type converted according to the integral promotions.
*/
#define SCHAR_MAX 127 /* min value for a signed char */
#define SCHAR_MIN (-128) /* max value for a signed char */
#define CHAR_MAX 255u /* max value for a char */
#define CHAR_MIN 0 /* min value for a char */
#define UCHAR_MAX 255u /* max value for an unsigned char */
#define USHRT_MAX 65535u /* max value for an unsigned short */
#define SHRT_MAX 32767 /* max value for a short */
#define SHRT_MIN (-32767-1) /* min value for a short */
#define UINT_MAX 65535u /* max value for an unsigned int */
#define INT_MAX 32767 /* max value for an int */
#define INT_MIN (-32767-1) /* min value for an int */
#define ULONG_MAX 4294967295u /* max value for an unsigned long */
#define LONG_MAX 2147483647 /* max value for a long */
#define LONG_MIN (-2147483647-1) /* min value for a long */
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
#if !defined(_POSIX_SOURCE)
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
#endif /* !_POSIX_SOURCE */
#endif /* !_ANSI_SOURCE */
#endif /* !_MACHINE_LIMITS_H_ */

28
include/machine/param.h Normal file
View File

@ -0,0 +1,28 @@
/*
* machine/param.h
*
* Copyright 1991-1996, Procyon, Inc.
* All Rights Reserved
*
* $Id: param.h,v 1.1 1997/02/28 04:42:07 gdr Exp $
*/
#ifndef _MACHINE_PARAM_H_
#define _MACHINE_PARAM_H_
#define MACHINE "APPLEIIGS"
#ifdef KERNEL /* non-BSD. Obsolete? */
#define DAYSPERNYEAR 365
#define SECSPERDAY 86400L
#endif
/*
* Round p (pointer or byte index) up to a correctly-aligned value
* for all data types (int, long, ...). The result is unsigned int
* and must be cast to any desired pointer type.
*/
#define ALIGNBYTES 0
#define ALIGN(p) p
#endif

39
include/machine/signal.h Normal file
View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 1992-1996, Procyon, Inc.
* This file was pieced together from the BSD manpages and my own
* implementation. The definition of sigmask (with a modification to
* make ANSI happy) was borrowed straight from the BSD signal.h file.
*/
#ifndef _MACHINE_SIGNAL_H_
#define _MACHINE_SIGNAL_H_
typedef int sig_atomic_t;
#ifndef _SYS_WAIT_H_
#include <sys/wait.h>
#endif
typedef struct chldInfo {
struct chldInfo *next;
int pid; /* pid of terminated process */
union wait status; /* exit status of terminated process */
} chldInfo, *chldInfoPtr;
#ifdef KERNEL
#ifndef _SYS_SIGNAL_H_
#include <sys/signal.h>
#endif
struct sigrec {
unsigned long signalmask;
unsigned long sigpending; /* describes which signals are pending */
void (*v_signal[NSIG])(int, int);
unsigned long u_sigmask[NSIG];
unsigned long u_oldmask; /* for sigpause & sigblock */
int sigindex; /* which signal to check next for processing */
};
#endif /* KERNEL */
#endif

86
include/machine/types.h Normal file
View File

@ -0,0 +1,86 @@
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.3 (Berkeley) 1/5/94
* $Id: types.h,v 1.1 1997/02/28 04:42:07 gdr Exp $
*/
#ifndef _MACHTYPES_H_
#define _MACHTYPES_H_
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
typedef struct _physadr {
int r[1];
} *physadr;
#if 1 /* for GNO */
typedef int label_t[13];
#else /* for BSD */
typedef struct label_t {
int val[6];
} label_t;
#endif
#endif
typedef unsigned long vm_offset_t;
typedef unsigned long vm_size_t;
#if (__STDC__ != 1) || defined(_IN_KERNEL) /* GNO-specific */
typedef unsigned short iord_t;
typedef unsigned short pgadr_t;
typedef char swck_t;
typedef unsigned_char use_t;
typedef long ubadr_t;
#define MAXUSE 255
#endif /* (__STDC__ != 1) || defined(_IN_KERNEL) */
/*
* Basic integral types. Omit the typedef if
* not possible for a machine/compiler combination.
*/
#ifdef __STDC__
typedef signed char int8_t;
#else
typedef signed char int8_t;
#endif
typedef unsigned char u_int8_t;
typedef short int16_t;
typedef unsigned short u_int16_t;
typedef long int32_t;
typedef unsigned long u_int32_t;
#if 0
typedef long long int64_t;
typedef unsigned long long u_int64_t;
#endif
#endif /* _MACHTYPES_H_ */

65
include/net/af.h Normal file
View File

@ -0,0 +1,65 @@
#if CMU
/*
**********************************************************************
* Mach Operating System
* Copyright (c) 1986 Carnegie-Mellon University
*
* This software was developed by the Mach operating system
* project at Carnegie-Mellon University's Department of Computer
* Science. Software contributors as of May 1986 include Mike Accetta,
* Robert Baron, William Bolosky, Jonathan Chew, David Golub,
* Glenn Marcy, Richard Rashid, Avie Tevanian and Michael Young.
*
* Some software in these files are derived from sources other
* than CMU. Previous copyright and other source notices are
* preserved below and permission to use such software is
* dependent on licenses from those institutions.
*
* Permission to use the CMU portion of this software for
* any non-commercial research and development purpose is
* granted with the understanding that appropriate credit
* will be given to CMU, the Mach project and its authors.
* The Mach project would appreciate being notified of any
* modifications and of redistribution of this software so that
* bug fixes and enhancements may be distributed to users.
*
* All other rights are reserved to Carnegie-Mellon University.
**********************************************************************
*/
#endif CMU
/*
* Copyright (c) 1980, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)af.h 7.1 (Berkeley) 6/4/86
*/
/*
* Address family routines,
* used in handling generic sockaddr structures.
*
* Hash routine is called
* af_hash(addr, h);
* struct sockaddr *addr; struct afhash *h;
* producing an afhash structure for addr.
*
* Netmatch routine is called
* af_netmatch(addr1, addr2);
* where addr1 and addr2 are sockaddr *. Returns 1 if network
* values match, 0 otherwise.
*/
struct afswitch {
int (*af_hash)();
int (*af_netmatch)();
};
struct afhash {
u_int afh_hosthash;
u_int afh_nethash;
};
#ifdef KERNEL
struct afswitch afswitch[];
#endif

49
include/net/dli.var.h Normal file
View File

@ -0,0 +1,49 @@
/*
* Mach Operating System
* Copyright (c) 1987 Carnegie-Mellon University
* All rights reserved. The CMU software License Agreement specifies
* the terms and conditions for use and redistribution.
*
**********************************************************************
* HISTORY
* 06-May-87 Mike Accetta (mja) at Carnegie-Mellon University
* Created.
* [ V5.1(F10) ]
*
**********************************************************************
*/
/*
* Data-link interface address structure.
*
* The standard interface address header plus a pointer to the DLI protocol
* specific block.
*/
struct dli_ifaddr {
struct ifaddr da_ifa;
#define da_addr da_ifa.ifa_addr
#define da_broadaddr da_ifa.ifa_broadaddr
#define da_ifp da_ifa.ifa_ifp
struct dli_var *da_dlv;
};
/*
* Per-interface data block
*
* Each network device driver which supports this protocol will allocate
* one of these blocks for each network interface with which it is
* configured. The driver will call dli_init() with the appropriate
* parameters to initialize the block and DLI protocol for the interface
* every time that it is initialized.
*/
struct dli_var {
struct dli_ifaddr dlv_da; /* interface address (linked into the */
/* master address list for the interface) */
struct sockproto dlv_rproto; /* protocol of current input packet */
struct sockaddr dlv_rsrc; /* src addr of current input packet */
u_char dlv_hln; /* hardware address length (bytes) */
u_char dlv_lhl; /* local interface header length (bytes) */
};

63
include/net/etherdefs.h Normal file
View File

@ -0,0 +1,63 @@
/*
* Mach Operating System
* Copyright (c) 1987 Carnegie-Mellon University
* All rights reserved. The CMU software License Agreement specifies
* the terms and conditions for use and redistribution.
*/
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
* HISTORY
* 09-Apr-90 Bradley Taylor (btaylor) at NeXT, Inc.
* Created. Originally part of <netinet/if_ether.h>.
*/
#ifndef _ETHERDEFS_
#define _ETHERDEFS_
/*
* Ethernet address - 6 octets
*/
struct ether_addr {
u_char ether_addr_octet[6];
};
/*
* Structure of a 10Mb/s Ethernet header.
*/
struct ether_header {
u_char ether_dhost[6];
u_char ether_shost[6];
u_short ether_type;
};
#define IFTYPE_ETHERNET "10MB Ethernet"
#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
#define ETHERTYPE_IP 0x0800 /* IP protocol */
#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */
#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP (SUN_RPC) */
/*
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
* by an ETHER type (as given above) and then the (variable-length) header.
*/
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
#define ETHERTYPE_NTRAILER 16
#define ETHERHDRSIZE 14
#define ETHERMTU 1500
#define ETHERMIN (60-ETHERHDRSIZE)
#endif /* _ETHERDEFS_ */

70
include/net/if.arp.h Normal file
View File

@ -0,0 +1,70 @@
/*
* Mach Operating System
* Copyright (c) 1987 Carnegie-Mellon University
* All rights reserved. The CMU software License Agreement specifies
* the terms and conditions for use and redistribution.
*/
/*
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)if_arp.h 7.1 (Berkeley) 6/4/86
*/
/*
* HISTORY
* 20-Oct-87 Peter King (king) at NeXT, Inc.
* SUN_RPC: Added Sun's RARP support.
*/
/* @(#)if_arp.h 2.1 88/05/18 4.0NFSSRC SMI; from UCB 7.1 6/5/86 */
/*
* Address Resolution Protocol.
*
* See RFC 826 for protocol description. ARP packets are variable
* in size; the arphdr structure defines the fixed-length portion.
* Protocol type values are the same as those for 10 Mb/s Ethernet.
* It is followed by the variable-sized fields ar_sha, arp_spa,
* arp_tha and arp_tpa in that order, according to the lengths
* specified. Field names used correspond to RFC 826.
*/
struct arphdr {
u_short ar_hrd; /* format of hardware address */
#define ARPHRD_ETHER 1 /* ethernet hardware address */
u_short ar_pro; /* format of protocol address */
u_char ar_hln; /* length of hardware address */
u_char ar_pln; /* length of protocol address */
u_short ar_op; /* one of: */
#define ARPOP_REQUEST 1 /* request to resolve address */
#define ARPOP_REPLY 2 /* response to previous request */
#define REVARP_REQUEST 3 /* Reverse ARP request (SUN_RPC) */
#define REVARP_REPLY 4 /* Reverse ARP reply (SUN_RPC) */
/*
* The remaining fields are variable in size,
* according to the sizes above.
*/
#ifdef notdef
u_char ar_sha[]; /* sender hardware address */
u_char ar_spa[]; /* sender protocol address */
u_char ar_tha[]; /* target hardware address */
u_char ar_tpa[]; /* target protocol address */
#endif
};
/*
* ARP ioctl request
*/
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
int arp_flags; /* flags */
};
/* arp_flags and at_flags field values */
#define ATF_INUSE 0x01 /* entry in use */
#define ATF_COM 0x02 /* completed entry (enaddr valid) */
#define ATF_PERM 0x04 /* permanent entry */
#define ATF_PUBL 0x08 /* publish entry (respond for other host) */
#define ATF_USETRAILERS 0x10 /* has requested trailers */

253
include/net/if.h Normal file
View File

@ -0,0 +1,253 @@
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)if.h 7.1 (Berkeley) 6/4/86
*/
#ifndef _IF_
#define _IF_ 1
/*
* Structures defining a network interface, providing a packet
* transport mechanism (ala level 0 of the PUP protocols).
*
* Each interface accepts output datagrams of a specified maximum
* length, and provides higher level routines with input datagrams
* received from its medium.
*
* Output occurs when the routine if_output is called, with three parameters:
* (*ifp->if_output)(ifp, m, dst)
* Here m is the mbuf chain to be sent and dst is the destination address.
* The output routine encapsulates the supplied datagram if necessary,
* and then transmits it on its medium.
*
* On input, each interface unwraps the data received by it, and either
* places it on the input queue of a internetwork datagram routine
* and posts the associated software interrupt, or passes the datagram to a raw
* packet input routine.
*
* Routines exist for locating interfaces by their addresses
* or for locating a interface on a certain network, as well as more general
* routing and gateway routines maintaining information used to locate
* interfaces. These routines live in the files if.c and route.c
*/
#if NeXT
#include <net/netbuf.h>
#include <net/netif.h>
#endif /* NeXT */
/*
* Structure defining a queue for a network interface.
*
* (Would like to call this struct ``if'', but C isn't PL/1.)
*/
struct ifnet {
char *if_name; /* name, e.g. ``en'' or ``lo'' */
#if NeXT
char *if_type; /* type of interface */
#endif /* NeXT */
short if_unit; /* sub-unit for lower level driver */
short if_mtu; /* maximum transmission unit */
short if_flags; /* up/down, broadcast, etc. */
#if NeXT
#else /* NeXT */
short if_timer; /* time 'til if_watchdog called */
#endif /* NeXT */
int if_metric; /* routing metric (external only) */
#if NeXT
int if_class; /* class of interface */
#endif /* NeXT */
struct ifaddr *if_addrlist; /* linked list of addresses per if */
struct ifqueue {
struct mbuf *ifq_head;
struct mbuf *ifq_tail;
int ifq_len;
int ifq_maxlen;
int ifq_drops;
} if_snd; /* output queue */
/* procedure handles */
int (*if_init)(); /* init routine */
int (*if_output)(); /* output routine */
#if NeXT
int (*if_control)(); /* control routine */
int (*if_input)(); /* input routine */
netbuf_t (*if_getbuf)(); /* get buffer routine */
#else /* NeXT */
int (*if_ioctl)(); /* ioctl routine */
int (*if_reset)(); /* bus reset routine */
int (*if_watchdog)(); /* timer routine */
#endif /* NeXT */
/* generic interface statistics */
int if_ipackets; /* packets received on interface */
int if_ierrors; /* input errors on interface */
int if_opackets; /* packets sent on interface */
int if_oerrors; /* output errors on interface */
int if_collisions; /* collisions on csma interfaces */
#if NeXT
void *if_private; /* private to interface */
#endif /* NeXT */
/* end statistics */
struct ifnet *if_next;
};
#if NeXT
#define IFF_UP 0x1 /* interface is up */
#define IFF_BROADCAST 0x2 /* broadcast address valid */
#define IFF_DEBUG 0x4 /* turn on debugging */
#define IFF_LOOPBACK 0x8 /* is a loopback net */
#define IFF_POINTTOPOINT 0x10 /* interface is point-to-point link */
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
#define IFF_RUNNING 0x40 /* resources allocated */
#define IFF_NOARP 0x80 /* no address resolution protocol */
#define IFF_PROMISC 0x100 /* receive all packets */
#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
#define IFF_DIALUP 0x400 /* For ISDN */
#else /* NeXT */
#endif /* NeXT */
#if NeXT
/* flags set internally only: */
#define IFF_CANTCHANGE (IFF_BROADCAST|IFF_POINTTOPOINT|IFF_RUNNING|IFF_AUTOCONF|IFF_AUTODONE)
#else /* NeXT */
/* flags set internally only: */
#define IFF_CANTCHANGE (IFF_BROADCAST | IFF_POINTTOPOINT | IFF_RUNNING)
#endif /* NeXT */
/*
* Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
* input routines have queues of messages stored on ifqueue structures
* (defined above). Entries are added to and deleted from these structures
* by these macros, which should be called with ipl raised to splimp().
*/
#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen)
#define IF_DROP(ifq) ((ifq)->ifq_drops++)
#define IF_ENQUEUE(ifq, m) { \
(m)->m_act = 0; \
if ((ifq)->ifq_tail == 0) \
(ifq)->ifq_head = m; \
else \
(ifq)->ifq_tail->m_act = m; \
(ifq)->ifq_tail = m; \
(ifq)->ifq_len++; \
}
#define IF_PREPEND(ifq, m) { \
(m)->m_act = (ifq)->ifq_head; \
if ((ifq)->ifq_tail == 0) \
(ifq)->ifq_tail = (m); \
(ifq)->ifq_head = (m); \
(ifq)->ifq_len++; \
}
/*
* Packets destined for level-1 protocol input routines
* have a pointer to the receiving interface prepended to the data.
* IF_DEQUEUEIF extracts and returns this pointer when dequeueing the packet.
* IF_ADJ should be used otherwise to adjust for its presence.
*/
#define IF_ADJ(m) { \
(m)->m_off += sizeof(struct ifnet *); \
(m)->m_len -= sizeof(struct ifnet *); \
if ((m)->m_len == 0) { \
struct mbuf *n; \
MFREE((m), n); \
(m) = n; \
} \
}
#define IF_DEQUEUEIF(ifq, m, ifp) { \
(m) = (ifq)->ifq_head; \
if (m) { \
if (((ifq)->ifq_head = (m)->m_act) == 0) \
(ifq)->ifq_tail = 0; \
(m)->m_act = 0; \
(ifq)->ifq_len--; \
(ifp) = *(mtod((m), struct ifnet **)); \
IF_ADJ(m); \
} \
}
#define IF_DEQUEUE(ifq, m) { \
(m) = (ifq)->ifq_head; \
if (m) { \
if (((ifq)->ifq_head = (m)->m_act) == 0) \
(ifq)->ifq_tail = 0; \
(m)->m_act = 0; \
(ifq)->ifq_len--; \
} \
}
#define IFQ_MAXLEN 50
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
/*
* The ifaddr structure contains information about one address
* of an interface. They are maintained by the different address families,
* are allocated and attached when an address is set, and are linked
* together so all addresses for an interface can be located.
*/
struct ifaddr {
struct sockaddr ifa_addr; /* address of interface */
union {
struct sockaddr ifu_broadaddr;
struct sockaddr ifu_dstaddr;
} ifa_ifu;
#define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */
#define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of p-to-p link */
struct ifnet *ifa_ifp; /* back-pointer to interface */
struct ifaddr *ifa_next; /* next address for interface */
};
/*
* Interface request structure used for socket
* ioctl's. All interface ioctl's must have parameter
* definitions which begin with ifr_name. The
* remainder may be interface specific.
*/
struct ifreq {
#define IFNAMSIZ 16
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct sockaddr ifru_addr;
struct sockaddr ifru_dstaddr;
struct sockaddr ifru_broadaddr;
short ifru_flags;
short ifru_mtu;
u_long ifru_asyncmap; /* For PPP */
int ifru_metric;
caddr_t ifru_data;
} ifr_ifru;
#define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
#define ifr_flags ifr_ifru.ifru_flags /* flags */
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu for PPP*/
#define ifr_asyncmap ifr_ifru.ifru_asyncmap /* async control char map */
#define ifr_metric ifr_ifru.ifru_metric /* metric */
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
};
/*
* Structure used in SIOCGIFCONF request.
* Used to retrieve interface configuration
* for machine (useful for programs which
* must know all networks accessible).
*/
struct ifconf {
int ifc_len; /* size of associated buffer */
union {
caddr_t ifcu_buf;
struct ifreq *ifcu_req;
} ifc_ifcu;
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
};
#include <net/if.arp.h>
#ifdef KERNEL
struct ifqueue rawintrq; /* raw packet input queue */
struct ifnet *ifnet;
struct ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet();
struct ifaddr *ifa_ifwithdstaddr();
#endif /* KERNEL */
#endif /* _IF_ */

36
include/net/netbuf.h Normal file
View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 1990 by NeXT, Inc., All Rights Reserved
*
*/
/*
* Network Buffer API (for kernel use only)
*
* HISTORY
* 09-Apr-90 Bradley Taylor (btaylor) at NeXT, Inc.
* Created.
*/
#ifndef _NETBUF_
#define _NETBUF_
typedef struct { char opaque[1]; } *netbuf_t;
#ifdef KERNEL
extern char *nb_map(netbuf_t nb);
extern netbuf_t nb_alloc(unsigned size);
extern netbuf_t nb_alloc_wrapper(void *data, unsigned size,
void freefunc(void *), void *freefunc_arg);
extern void nb_free(netbuf_t nb);
extern void nb_free_wrapper(netbuf_t nb);
extern unsigned nb_size(netbuf_t nb);
extern int nb_read(netbuf_t nb, unsigned offset, unsigned size, void *target);
extern int nb_write(netbuf_t nb, unsigned offset, unsigned size, void *source);
extern int nb_shrink_top(netbuf_t nb, unsigned size);
extern int nb_grow_top(netbuf_t nb, unsigned size);
extern int nb_shrink_bot(netbuf_t nb, unsigned size);
extern int nb_grow_bot(netbuf_t nb, unsigned size);
#endif /* KERNEL */
#endif /* _NETBUF_ */

150
include/net/netif.h Normal file
View File

@ -0,0 +1,150 @@
/*
* Copyright (C) 1990 by NeXT, Inc., All Rights Reserved
*
*/
/*
* Network Interface API
*
* HISTORY
* 09-Apr-90 Bradley Taylor (btaylor) at NeXT, Inc.
* Created. Some parts originally part of <net/if.h>.
*/
#ifndef _NETIF_
#define _NETIF_
#import <net/netbuf.h>
/*
* BEGIN: BSD copyrighted material
*/
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
*/
#define IFF_UP 0x1 /* interface is up */
#define IFF_BROADCAST 0x2 /* broadcast address valid */
#define IFF_DEBUG 0x4 /* turn on debugging */
#define IFF_LOOPBACK 0x8 /* is a loopback net */
#define IFF_POINTTOPOINT 0x10 /* interface is point-to-point link */
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
#define IFF_RUNNING 0x40 /* resources allocated */
#define IFF_NOARP 0x80 /* no address resolution protocol */
/* next two not supported now, but reserved: */
#define IFF_PROMISC 0x100 /* receive all packets */
#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
#define IFF_D1 0x400 /* For CSLIP */
#define IFF_D2 0x800 /* For CSLIP */
#define IFF_D3 0x1000 /* For CSLIP */
#define IFF_COMPAC IFF_D1 /* For PPP */
#define IFF_COMPPROT 0x2000 /* For PPP */
/*
* END: BSD copyrighted material
*/
#define IFF_AUTOCONF 0x4000 /* Network is autoconfiguring */
#define IFF_AUTODONE 0x8000 /* Network has autoconfigured */
typedef enum netif_class {
NETIFCLASS_REAL = 0,
NETIFCLASS_VIRTUAL = 0x1000,
NETIFCLASS_SNIFFER = 0x2000
} netif_class_t;
#ifdef KERNEL
extern const char IFCONTROL_SETFLAGS[];
extern const char IFCONTROL_SETADDR[];
extern const char IFCONTROL_GETADDR[];
extern const char IFCONTROL_AUTOADDR[];
extern const char IFCONTROL_UNIXIOCTL[];
typedef struct if_ioctl {
unsigned ioctl_command;
void *ioctl_data;
} if_ioctl_t;
typedef struct { char opaque[1]; } *netif_t;
typedef int (*if_input_func_t)(netif_t netif, netif_t realnetif,
netbuf_t nb, void *extra);
typedef int (*if_init_func_t)(netif_t netif);
typedef int (*if_output_func_t)(netif_t netif, netbuf_t nb, void *address);
typedef netbuf_t (*if_getbuf_func_t)(netif_t netif);
typedef int (*if_control_func_t)(netif_t netif, const char *command,
void *data);
typedef void (*if_attach_func_t)(void *private, netif_t realif);
extern int if_output(netif_t netif, netbuf_t packet, void *addr);
extern int if_init(netif_t netif);
extern int if_control(netif_t netif, const char *command, void *data);
extern int if_ioctl(netif_t netif, unsigned command, void *data);
extern netbuf_t if_getbuf(netif_t netif);
extern int if_handle_input(netif_t netif, netbuf_t nb, void *extra);
extern netif_t if_attach(if_init_func_t init_func,
if_input_func_t input_func,
if_output_func_t output_func,
if_getbuf_func_t getbuf_func,
if_control_func_t control_func,
const char *name,
unsigned unit,
const char *type,
unsigned mtu,
unsigned flags,
netif_class_t class,
void *private);
extern void if_registervirtual(if_attach_func_t attach_func, void *private);
extern void if_detach(netif_t);
extern netif_t iflist_first(void);
extern netif_t iflist_next(netif_t);
/*
* Readable attributes
*/
extern const char *if_type(netif_t netif);
extern const char *if_name(netif_t netif);
extern unsigned if_unit(netif_t netif);
extern unsigned if_mtu(netif_t netif);
extern netif_class_t if_class(netif_t netif);
extern void *if_private(netif_t netif);
/*
* Writable attributes
*/
extern unsigned if_flags(netif_t netif);
extern void if_flags_set(netif_t netif, unsigned flags);
extern unsigned if_ipackets(netif_t netif);
extern void if_ipackets_set(netif_t netif, unsigned ipackets);
extern unsigned if_opackets(netif_t netif);
extern void if_opackets_set(netif_t netif, unsigned opackets);
extern unsigned if_oerrors(netif_t netif);
extern void if_oerrors_set(netif_t netif, unsigned oerrors);
extern unsigned if_ierrors(netif_t netif);
extern void if_ierrors_set(netif_t netif, unsigned ierrors);
extern unsigned if_collisions(netif_t netif);
extern void if_collisions_set(netif_t netif, unsigned collisions);
#endif /* KERNEL */
#endif /* _NETIF_ */

67
include/net/netisr.h Normal file
View File

@ -0,0 +1,67 @@
/*
* Mach Operating System
* Copyright (c) 1987 Carnegie-Mellon University
* All rights reserved. The CMU software License Agreement specifies
* the terms and conditions for use and redistribution.
*/
/*
**********************************************************************
* HISTORY
* 5-Nov-87 David Golub (dbg) at Carnegie-Mellon University
* Use kernel-thread for networking code.
*
**********************************************************************
*/
/*
* Copyright (c) 1980, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)netisr.h 7.1 (Berkeley) 6/4/86
*/
#ifdef MACH
/*
* The networking code is a separate kernel task, currently
* bound to the master cpu.
*/
#if defined(KERNEL) && !defined(LOCORE)
int soft_net_wakeup;
#define setsoftnet() (wakeup((caddr_t)&soft_net_wakeup))
#endif defined(KERNEL) && !defined(LOCORE)
#else MACH
/*
* The networking code runs off software interrupts.
*
* You can switch into the network by doing splnet() and return by splx().
* The software interrupt level for the network is higher than the software
* level for the clock (so you can enter the network in routines called
* at timeout time).
*/
#ifdef vax
#define setsoftnet() mtpr(SIRR, 12)
#endif
#endif MACH
/*
* Each ``pup-level-1'' input queue has a bit in a ``netisr'' status
* word which is used to de-multiplex a single software
* interrupt used for scheduling the network code to calls
* on the lowest level routine of each protocol.
*/
#define NETISR_RAW 0 /* same as AF_UNSPEC */
#define NETISR_IP 2 /* same as AF_INET */
#define NETISR_IMP 3 /* same as AF_IMPLINK */
#define NETISR_NS 6 /* same as AF_NS */
#define schednetisr(anisr) { netisr |= 1<<(anisr); setsoftnet(); }
#ifndef LOCORE
#ifdef KERNEL
int netisr; /* scheduling bits for network */
#endif
#endif

78
include/net/raw.cb.h Normal file
View File

@ -0,0 +1,78 @@
/*
* Mach Operating System
* Copyright (c) 1987 Carnegie-Mellon University
* All rights reserved. The CMU software License Agreement specifies
* the terms and conditions for use and redistribution.
*/
/*
* HISTORY
* 26-Sep-89 Morris Meyer (mmeyer) at NeXT
* NFS 4.0 Changes: Back out statistics gathering support.
*
* 13-Aug-87 Peter King (king) at NeXT
* SUN_RPC: Added rcb_cc and rcb_mbcnt for statistics gathering.
* Added RAW_TALLY flag to turn on statistics gathering
*/
/*
* Copyright (c) 1980, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)raw_cb.h 7.1 (Berkeley) 6/4/86
*/
/* @(#)raw_cb.h 2.1 88/05/30 4.0NFSSRC SMI; from UCB 7.1 6/5/86 */
/*
* Raw protocol interface control block. Used
* to tie a socket to the generic raw interface.
*/
struct rawcb {
struct rawcb *rcb_next; /* doubly linked list */
struct rawcb *rcb_prev;
struct socket *rcb_socket; /* back pointer to socket */
struct sockaddr rcb_faddr; /* destination address */
struct sockaddr rcb_laddr; /* socket's address */
struct sockproto rcb_proto; /* protocol family, protocol */
caddr_t rcb_pcb; /* protocol specific stuff */
struct mbuf *rcb_options; /* protocol specific options */
struct route rcb_route; /* routing information */
short rcb_flags;
/* SUN_RPC */
int rcb_cc; /* bytes of rawintr queued data */
int rcb_mbcnt; /* bytes of rawintr queued mbufs */
/* SUN_RPC */
};
/*
* Since we can't interpret canonical addresses,
* we mark an address present in the flags field.
*/
#define RAW_LADDR 01
#define RAW_FADDR 02
#define RAW_DONTROUTE 04 /* no routing, default */
#define RAW_TALLY 0x08 /* tally delivered packets (SUN_RPC) */
#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb)
/*
* Nominal space allocated to a raw socket.
*/
#define RAWSNDQ 2048
#define RAWRCVQ 2048
/*
* Format of raw interface header prepended by
* raw_input after call from protocol specific
* input routine.
*/
struct raw_header {
struct sockproto raw_proto; /* format of packet */
struct sockaddr raw_dst; /* dst address for rawintr */
struct sockaddr raw_src; /* src address for sbappendaddr */
};
#ifdef KERNEL
struct rawcb rawcb; /* head of list */
#endif

95
include/net/route.h Normal file
View File

@ -0,0 +1,95 @@
/*
* Mach Operating System
* Copyright (c) 1987 Carnegie-Mellon University
* All rights reserved. The CMU software License Agreement specifies
* the terms and conditions for use and redistribution.
*/
/*
* Copyright (c) 1980, 1986 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
* @(#)route.h 7.3 (Berkeley) 12/30/87
*/
/*
* Kernel resident routing tables.
*
* The routing tables are initialized when interface addresses
* are set by making entries for all directly connected interfaces.
*/
#if 0
/*
* A route consists of a destination address and a reference
* to a routing entry. These are often held by protocols
* in their control blocks, e.g. inpcb.
*/
struct route {
struct rtentry *ro_rt;
struct sockaddr ro_dst;
};
#endif
/*
* We distinguish between routes to hosts and routes to networks,
* preferring the former if available. For each route we infer
* the interface to use from the gateway address supplied when
* the route was entered. Routes that forward packets through
* gateways are marked so that the output routines know to address the
* gateway rather than the ultimate destination.
*/
struct rtentry {
u_long rt_hash; /* to speed lookups */
struct sockaddr rt_dst; /* key */
struct sockaddr rt_gateway; /* value */
short rt_flags; /* up/down?, host/net */
short rt_refcnt; /* # held references */
u_long rt_use; /* raw # packets forwarded */
struct ifnet *rt_ifp; /* the answer: interface to use */
};
#define RTF_UP 0x1 /* route useable */
#define RTF_GATEWAY 0x2 /* destination is a gateway */
#define RTF_HOST 0x4 /* host entry (net otherwise) */
#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
/*
* Routing statistics.
*/
struct rtstat {
short rts_badredirect; /* bogus redirect calls */
short rts_dynamic; /* routes created by redirects */
short rts_newgateway; /* routes modified by redirects */
short rts_unreach; /* lookups which failed */
short rts_wildcard; /* lookups satisfied by a wildcard */
};
#ifdef KERNEL
#define RTFREE(rt) \
if ((rt)->rt_refcnt == 1) \
rtfree(rt); \
else \
(rt)->rt_refcnt--;
#ifdef GATEWAY
#define RTHASHSIZ 64
#else
#define RTHASHSIZ 8
#endif
#if (RTHASHSIZ & (RTHASHSIZ - 1)) == 0
#define RTHASHMOD(h) ((h) & (RTHASHSIZ - 1))
#else
#define RTHASHMOD(h) ((h) % RTHASHSIZ)
#endif
struct mbuf *rthost[RTHASHSIZ];
struct mbuf *rtnet[RTHASHSIZ];
struct rtstat rtstat;
#endif

149
include/netdb.h Normal file
View File

@ -0,0 +1,149 @@
/*-
* Copyright (c) 1980, 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
* $Id: netdb.h,v 1.1 1997/02/28 04:42:02 gdr Exp $
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#ifndef _NETDB_H_
#define _NETDB_H_
#define _PATH_HEQUIV "/etc/hosts.equiv"
#define _PATH_HOSTS "/etc/hosts"
#define _PATH_NETWORKS "/etc/networks"
#define _PATH_PROTOCOLS "/etc/protocols"
#define _PATH_SERVICES "/etc/services"
extern int h_errno;
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
};
/*
* Assumption here is that a network number
* fits in an unsigned long -- probably a poor one.
*/
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
unsigned long n_net; /* network # */
};
struct servent {
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port # */
char *s_proto; /* protocol to use */
};
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in extern int h_errno).
*/
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
void endhostent __P((void));
void endnetent __P((void));
void endprotoent __P((void));
void endservent __P((void));
struct hostent *gethostbyaddr __P((const char *, int, int));
struct hostent *gethostbyname __P((const char *));
struct hostent *gethostent __P((void));
struct netent *getnetbyaddr __P((long, int)); /* u_long? */
struct netent *getnetbyname __P((const char *));
struct netent *getnetent __P((void));
struct protoent *getprotobyname __P((const char *));
struct protoent *getprotobynumber __P((int));
struct protoent *getprotoent __P((void));
struct servent *getservbyname __P((const char *, const char *));
struct servent *getservbyport __P((int, const char *));
struct servent *getservent __P((void));
void herror __P((const char *));
const char *hstrerror __P((int));
void sethostent __P((int));
/* void sethostfile __P((const char *)); */
void setnetent __P((int));
void setprotoent __P((int));
void setservent __P((int));
__END_DECLS
#endif /* !_NETDB_H_ */

353
include/netinet/in.h Normal file
View File

@ -0,0 +1,353 @@
/*
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in.h 8.3 (Berkeley) 1/3/94
* $Id: in.h,v 1.1 1997/02/28 04:42:11 gdr Exp $
*/
#ifndef _NETINET_IN_H_
#define _NETINET_IN_H_
/*
* Constants and structures defined by the internet system,
* Per RFC 790, September 1981, and numerous additions.
*/
/*
* Protocols
*/
#define IPPROTO_IP 0 /* dummy for IP */
#define IPPROTO_ICMP 1 /* control message protocol */
#define IPPROTO_IGMP 2 /* group mgmt protocol */
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
#define IPPROTO_IPIP 4 /* IP encapsulation in IP */
#define IPPROTO_TCP 6 /* tcp */
#define IPPROTO_EGP 8 /* exterior gateway protocol */
#define IPPROTO_PUP 12 /* pup */
#define IPPROTO_UDP 17 /* user datagram protocol */
#define IPPROTO_IDP 22 /* xns idp */
#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
#define IPPROTO_RSVP 46 /* resource reservation */
#define IPPROTO_EON 80 /* ISO cnlp */
#define IPPROTO_ENCAP 98 /* encapsulation header */
#define IPPROTO_RAW 255 /* raw IP packet */
#define IPPROTO_MAX 256
/*
* Local port number conventions:
* Ports < IPPORT_RESERVED are reserved for
* privileged processes (e.g. root).
* Ports > IPPORT_USERRESERVED are reserved
* for servers, not necessarily privileged.
*/
#define IPPORT_RESERVED 1024
#define IPPORT_USERRESERVED 5000
/*
* Internet address (a structure for historical reasons)
*/
#if 0 /* BSD 4.4 */
struct in_addr {
u_long s_addr;
};
#else /* GNO (also BSD 4.3?) */
struct in_addr {
union {
struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { u_short s_w1,s_w2; } S_un_w;
u_long S_addr;
} S_un;
#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
#define s_host S_un.S_un_b.s_b2 /* host on imp */
#define s_net S_un.S_un_b.s_b1 /* network */
#define s_imp S_un.S_un_w.s_w2 /* imp */
#define s_impno S_un.S_un_b.s_b4 /* imp # */
#define s_lh S_un.S_un_b.s_b3 /* logical host */
};
#endif /* 0 */
/*
* Definitions of bits in internet address integers.
* On subnets, the decomposition of addresses to host and net parts
* is done according to subnet mask, not the masks here.
*/
#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST 0x00ffffff
#define IN_CLASSA_MAX 128
#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST 0x0000ffff
#define IN_CLASSB_MAX 65536
#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST 0x000000ff
#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
#define IN_MULTICAST(i) IN_CLASSD(i)
#define IN_EXPERIMENTAL(i) (((long)(i) & 0xf0000000) == 0xf0000000)
#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000)
#define INADDR_ANY (u_long)0x00000000
#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */
#ifndef KERNEL
#define INADDR_NONE 0xffffffff /* -1 return */
#endif
#define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */
#define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */
#define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */
#define IN_LOOPBACKNET 127 /* official! */
/*
* Socket address, internet style.
*/
struct sockaddr_in {
#if 0 /* BSD */
u_char sin_len;
u_char sin_family;
#else /* GNO */
short sin_family;
#endif
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
/*
* Structure used to describe IP options.
* Used to store options internally, to pass them to a process,
* or to restore options retrieved earlier.
* The ip_dst is used for the first-hop gateway when using a source route
* (this gets put into the header proper).
*/
struct ip_opts {
struct in_addr ip_dst; /* first hop, 0 w/o src rt */
char ip_opts[40]; /* actually variable in size */
};
/*
* Options for use with [gs]etsockopt at the IP level.
* First word of comment is data type; bool is stored in int.
*/
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
#define IP_HDRINCL 2 /* int; header is included with data */
#define IP_TOS 3 /* int; IP type of service and preced. */
#define IP_TTL 4 /* int; IP time to live */
#define IP_TIMETOLIVE IP_TTL
#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */
#define IP_RSVP_ON 15 /* enable RSVP in kernel */
#define IP_RSVP_OFF 16 /* disable RSVP in kernel */
#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */
#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */
/*
* Defaults and limits for options
*/
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
#define IP_MAX_MEMBERSHIPS 20 /* per socket */
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
*/
struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};
/*
* Definitions for inet sysctl operations.
*
* Third level is protocol number.
* Fourth level is desired variable within that protocol.
*/
#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */
#define CTL_IPPROTO_NAMES { \
{ "ip", CTLTYPE_NODE }, \
{ "icmp", CTLTYPE_NODE }, \
{ "igmp", CTLTYPE_NODE }, \
{ "ggp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "tcp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ "egp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "pup", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "udp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "idp", CTLTYPE_NODE }, \
}
/*
* Names for IP sysctl objects
*/
#define IPCTL_FORWARDING 1 /* act as router */
#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
#define IPCTL_DEFTTL 3 /* default TTL */
#ifdef notyet
#define IPCTL_DEFMTU 4 /* default MTU */
#endif
#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */
#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */
#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */
#define IPCTL_SOURCEROUTE 8 /* may perform source routes */
#define IPCTL_MAXID 9
#define IPCTL_NAMES { \
{ 0, 0 }, \
{ "forwarding", CTLTYPE_INT }, \
{ "redirect", CTLTYPE_INT }, \
{ "ttl", CTLTYPE_INT }, \
{ "mtu", CTLTYPE_INT }, \
{ "rtexpire", CTLTYPE_INT }, \
{ "rtminexpire", CTLTYPE_INT }, \
{ "rtmaxcache", CTLTYPE_INT }, \
{ "sourceroute", CTLTYPE_INT }, \
}
/*
* This section contains macros used in GNO that aren't part of BSD.
*/
#ifdef __GNO__
/*
* Port/socket numbers: network standard functions
*/
#define IPPORT_ECHO 7
#define IPPORT_DISCARD 9
#define IPPORT_SYSTAT 11
#define IPPORT_DAYTIME 13
#define IPPORT_NETSTAT 15
#define IPPORT_FTP 21
#define IPPORT_TELNET 23
#define IPPORT_SMTP 25
#define IPPORT_TIMESERVER 37
#define IPPORT_NAMESERVER 42
#define IPPORT_WHOIS 43
#define IPPORT_MTP 57
/*
* Port/socket numbers: host specific functions
*/
#define IPPORT_TFTP 69
#define IPPORT_RJE 77
#define IPPORT_FINGER 79
#define IPPORT_TTYLINK 87
#define IPPORT_SUPDUP 95
/*
* UNIX TCP sockets
*/
#define IPPORT_EXECSERVER 512
#define IPPORT_LOGINSERVER 513
#define IPPORT_CMDSERVER 514
#define IPPORT_EFSSERVER 520
/*
* UNIX UDP sockets
*/
#define IPPORT_BIFFUDP 512
#define IPPORT_WHOSERVER 513
#define IPPORT_ROUTESERVER 520 /* 520+1 also used */
/*
* Link numbers
*/
#define IMPLINK_IP 155
#define IMPLINK_LOWEXPER 156
#define IMPLINK_HIGHEXPER 158
/*
* Define a macro to stuff the loopback address into an Internet address
*/
#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \
(a)->sin_family = AF_INET;}
#endif /* __GNO__ */
#ifdef KERNEL
struct ifnet; struct mbuf; /* forward declarations for Standard C */
#if 0 && defined(__GNO__)
/*
* gdr: Prototypes are needed here, but I have no idea what they are.
* Obsolete?
*/
struct in_addr in_makeaddr __P(());
u_long in_lnaof __P(());
#endif
int in_broadcast __P((struct in_addr, struct ifnet *));
int in_canforward __P((struct in_addr));
int in_cksum __P((struct mbuf *, int));
int in_localaddr __P((struct in_addr));
u_long in_netof __P((struct in_addr));
void in_socktrim __P((struct sockaddr_in *));
char *inet_ntoa __P((struct in_addr)); /* in libkern */
#endif
#endif

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_systm.h 8.1 (Berkeley) 6/10/93
* $Id: in.systm.h,v 1.1 1997/02/28 04:42:11 gdr Exp $
*/
#ifndef _NETINET_IN_SYSTM_H_
#define _NETINET_IN_SYSTM_H_
/*
* Miscellaneous internetwork
* definitions for kernel.
*/
/*
* Network types.
*
* Internally the system keeps counters in the headers with the bytes
* swapped so that VAX instructions will work on them. It reverses
* the bytes before transmission at each protocol level. The n_ types
* represent the types with the bytes in ``high-ender'' order.
*/
typedef u_short n_short; /* short as received from the net */
typedef u_long n_long; /* long as received from the net */
typedef u_long n_time; /* ms since 00:00 GMT, byte rev */
#ifdef KERNEL
n_time iptime __P((void));
#endif
#endif

179
include/netinet/ip.h Normal file
View File

@ -0,0 +1,179 @@
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ip.h 8.1 (Berkeley) 6/10/93
* $Id: ip.h,v 1.1 1997/02/28 04:42:11 gdr Exp $
*/
#ifndef _NETINET_IP_H_
#define _NETINET_IP_H_
/*
* Definitions for internet protocol version 4.
* Per RFC 791, September 1981.
*/
#define IPVERSION 4
/*
* Structure of an internet header, naked of options.
*
* We declare ip_len and ip_off to be short, rather than u_short
* pragmatically since otherwise unsigned comparisons can result
* against negative integers quite easily, and fail in subtle ways.
*/
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
u_char ip_hl:4, /* header length */
ip_v:4; /* version */
#endif
#if BYTE_ORDER == BIG_ENDIAN
u_char ip_v:4, /* version */
ip_hl:4; /* header length */
#endif
u_char ip_tos; /* type of service */
short ip_len; /* total length */
u_short ip_id; /* identification */
short ip_off; /* fragment offset field */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
u_char ip_ttl; /* time to live */
u_char ip_p; /* protocol */
u_short ip_sum; /* checksum */
struct in_addr ip_src,ip_dst; /* source and dest address */
};
#define IP_MAXPACKET 65535 /* maximum packet size */
/*
* Definitions for IP type of service (ip_tos)
*/
#define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
#define IPTOS_MINCOST 0x02
/*
* Definitions for IP precedence (also in ip_tos) (hopefully unused)
*/
#define IPTOS_PREC_NETCONTROL 0xe0
#define IPTOS_PREC_INTERNETCONTROL 0xc0
#define IPTOS_PREC_CRITIC_ECP 0xa0
#define IPTOS_PREC_FLASHOVERRIDE 0x80
#define IPTOS_PREC_FLASH 0x60
#define IPTOS_PREC_IMMEDIATE 0x40
#define IPTOS_PREC_PRIORITY 0x20
#if 1 /* GNO */
#define IPTOS_PREC_ROUTINE 0x10
#else /* BSD */
#define IPTOS_PREC_ROUTINE 0x00
#endif
/*
* Definitions for options.
*/
#define IPOPT_COPIED(o) ((o)&0x80)
#define IPOPT_CLASS(o) ((o)&0x60)
#define IPOPT_NUMBER(o) ((o)&0x1f)
#define IPOPT_CONTROL 0x00
#define IPOPT_RESERVED1 0x20
#define IPOPT_DEBMEAS 0x40
#define IPOPT_RESERVED2 0x60
#define IPOPT_EOL 0 /* end of option list */
#define IPOPT_NOP 1 /* no operation */
#define IPOPT_RR 7 /* record packet route */
#define IPOPT_TS 68 /* timestamp */
#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
#define IPOPT_LSRR 131 /* loose source route */
#define IPOPT_SATID 136 /* satnet id */
#define IPOPT_SSRR 137 /* strict source route */
/*
* Offsets to fields in options other than EOL and NOP.
*/
#define IPOPT_OPTVAL 0 /* option ID */
#define IPOPT_OLEN 1 /* option length */
#define IPOPT_OFFSET 2 /* offset within option */
#define IPOPT_MINOFF 4 /* min value of above */
/*
* Time stamp option structure.
*/
struct ip_timestamp {
u_char ipt_code; /* IPOPT_TS */
u_char ipt_len; /* size of structure (variable) */
u_char ipt_ptr; /* index of current entry */
#if BYTE_ORDER == LITTLE_ENDIAN
u_char ipt_flg:4, /* flags, see below */
ipt_oflw:4; /* overflow counter */
#endif
#if BYTE_ORDER == BIG_ENDIAN
u_char ipt_oflw:4, /* overflow counter */
ipt_flg:4; /* flags, see below */
#endif
union ipt_timestamp {
n_long ipt_time[1];
struct ipt_ta {
struct in_addr ipt_addr;
n_long ipt_time;
} ipt_ta[1];
} ipt_timestamp;
};
/* flag bits for ipt_flg */
#define IPOPT_TS_TSONLY 0 /* timestamps only */
#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
#define IPOPT_TS_PRESPEC 3 /* specified modules only */
/* bits for security (not byte swapped) */
#define IPOPT_SECUR_UNCLASS 0x0000
#define IPOPT_SECUR_CONFID 0xf135
#define IPOPT_SECUR_EFTO 0x789a
#define IPOPT_SECUR_MMMM 0xbc4d
#define IPOPT_SECUR_RESTR 0xaf13
#define IPOPT_SECUR_SECRET 0xd788
#define IPOPT_SECUR_TOPSECRET 0x6bc5
/*
* Internet implementation parameters.
*/
#define MAXTTL 255 /* maximum time to live (seconds) */
#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
#define IPFRAGTTL 60 /* time to live for frags, slowhz */
#define IPTTLDEC 1 /* subtracted when forwarding */
#define IP_MSS 576 /* default maximum segment size */
#endif

122
include/netinet/tcp.h Normal file
View File

@ -0,0 +1,122 @@
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tcp.h 8.1 (Berkeley) 6/10/93
* $Id: tcp.h,v 1.1 1997/02/28 04:42:12 gdr Exp $
*/
#ifndef _NETINET_TCP_H_
#define _NETINET_TCP_H_
typedef u_long tcp_seq;
typedef u_long tcp_cc; /* connection count per rfc1644 */
/*
* TCP header.
* Per RFC 793, September, 1981.
*/
struct tcphdr {
u_short th_sport; /* source port */
u_short th_dport; /* destination port */
tcp_seq th_seq; /* sequence number */
tcp_seq th_ack; /* acknowledgement number */
#if BYTE_ORDER == LITTLE_ENDIAN
u_char th_x2:4, /* (unused) */
th_off:4; /* data offset */
#endif
#if BYTE_ORDER == BIG_ENDIAN
u_char th_off:4, /* data offset */
th_x2:4; /* (unused) */
#endif
u_char th_flags;
#define TH_FIN 0x01
#define TH_SYN 0x02
#define TH_RST 0x04
#define TH_PUSH 0x08
#define TH_ACK 0x10
#define TH_URG 0x20
#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG)
u_short th_win; /* window */
u_short th_sum; /* checksum */
u_short th_urp; /* urgent pointer */
};
#define TCPOPT_EOL 0
#define TCPOPT_NOP 1
#define TCPOPT_MAXSEG 2
#define TCPOLEN_MAXSEG 4
#define TCPOPT_WINDOW 3
#define TCPOLEN_WINDOW 3
#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
#define TCPOLEN_SACK_PERMITTED 2
#define TCPOPT_SACK 5 /* Experimental */
#define TCPOPT_TIMESTAMP 8
#define TCPOLEN_TIMESTAMP 10
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
#define TCPOPT_TSTAMP_HDR \
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
#define TCPOPT_CC 11 /* CC options: RFC-1644 */
#define TCPOPT_CCNEW 12
#define TCPOPT_CCECHO 13
#define TCPOLEN_CC 6
#define TCPOLEN_CC_APPA (TCPOLEN_CC+2)
#define TCPOPT_CC_HDR(ccopt) \
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC)
/*
* Default maximum segment size for TCP.
* With an IP MSS of 576, this is 536,
* but 512 is probably more convenient.
* This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
*/
#define TCP_MSS 512
#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */
#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */
#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr))
/* max space left for options */
/*
* User-settable options (used with setsockopt).
*/
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
#define TCP_MAXSEG 0x02 /* set maximum segment size */
#define TCP_NOPUSH 0x04 /* don't push last block of write */
#define TCP_NOOPT 0x08 /* don't use TCP options */
#endif

84
include/paths.h Normal file
View File

@ -0,0 +1,84 @@
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)paths.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _PATHS_H_
#define _PATHS_H_
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
/* Default search path. */
#define _PATH_DEFPATH "/usr/bin:/bin"
/* All standard utilities path. */
#define _PATH_STDPATH \
"/usr/bin:/bin:/usr/sbin:/sbin:"
#define _PATH_BSHELL "/bin/sh"
#define _PATH_CONSOLE ".ttyco"
#define _PATH_CSHELL "/bin/csh"
#define _PATH_DEVDB "/var/run/dev.db"
#define _PATH_DEVNULL ".null"
#define _PATH_DRUM ".drum"
#define _PATH_FTPUSERS "/etc/ftpusers"
#ifndef _POSIX_SOURCE
#define _PATH_GSHELL "/bin/gsh" /* GNO-specific */
#endif
#define _PATH_KMEM ".kmem"
#define _PATH_MAILDIR "/var/mail"
#define _PATH_MAN "/usr/share/man"
#define _PATH_MEM ".mem"
#define _PATH_NOLOGIN "/etc/nologin"
#define _PATH_SENDMAIL "/usr/sbin/sendmail"
#define _PATH_SHELLS "/etc/shells"
#define _PATH_TTY ".tty"
#define _PATH_UNIX "don't use _PATH_UNIX"
#define _PATH_VI "/usr/bin/vi"
/* Provide trailing slash, since mostly used for building pathnames. */
#define _PATH_DEV "/dev/"
#define _PATH_TMP "/tmp/"
#define _PATH_VARDB "/var/db/"
#define _PATH_VARRUN "/var/run/"
#define _PATH_VARTMP "/var/tmp/"
#define _PATH_YP "/var/yp/"
#define _PATH_UUCPLOCK "/var/spool/lock/"
/* How to get the correct name of the kernel. */
__BEGIN_DECLS
const char *getbootfile __P((void));
__END_DECLS
#endif /* !_PATHS_H_ */

114
include/protocols/talkd.h Normal file
View File

@ -0,0 +1,114 @@
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)talkd.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _PROTOCOLS_TALKD_H_
#define _PROTOCOLS_TALKD_H_
/*
* This describes the protocol used by the talk server and clients.
*
* The talk server acts a repository of invitations, responding to
* requests by clients wishing to rendezvous for the purpose of
* holding a conversation. In normal operation, a client, the caller,
* initiates a rendezvous by sending a CTL_MSG to the server of
* type LOOK_UP. This causes the server to search its invitation
* tables to check if an invitation currently exists for the caller
* (to speak to the callee specified in the message). If the lookup
* fails, the caller then sends an ANNOUNCE message causing the server
* to broadcast an announcement on the callee's login ports requesting
* contact. When the callee responds, the local server uses the
* recorded invitation to respond with the appropriate rendezvous
* address and the caller and callee client programs establish a
* stream connection through which the conversation takes place.
*/
/*
* Client->server request message format.
*/
typedef struct {
u_char vers; /* protocol version */
u_char type; /* request type, see below */
u_char answer; /* not used */
u_char pad;
u_long id_num; /* message id */
struct osockaddr addr; /* old (4.3) style */
struct osockaddr ctl_addr; /* old (4.3) style */
long pid; /* caller's process id */
#define NAME_SIZE 12
char l_name[NAME_SIZE];/* caller's name */
char r_name[NAME_SIZE];/* callee's name */
#define TTY_SIZE 16
char r_tty[TTY_SIZE];/* callee's tty name */
} CTL_MSG;
/*
* Server->client response message format.
*/
typedef struct {
u_char vers; /* protocol version */
u_char type; /* type of request message, see below */
u_char answer; /* respose to request message, see below */
u_char pad;
u_long id_num; /* message id */
struct osockaddr addr; /* address for establishing conversation */
} CTL_RESPONSE;
#define TALK_VERSION 1 /* protocol version */
/* message type values */
#define LEAVE_INVITE 0 /* leave invitation with server */
#define LOOK_UP 1 /* check for invitation by callee */
#define DELETE 2 /* delete invitation by caller */
#define ANNOUNCE 3 /* announce invitation by caller */
/* answer values */
#define SUCCESS 0 /* operation completed properly */
#define NOT_HERE 1 /* callee not logged in */
#define FAILED 2 /* operation failed for unexplained reason */
#define MACHINE_UNKNOWN 3 /* caller's machine name unknown */
#define PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */
#define UNKNOWN_REQUEST 5 /* request has invalid type value */
#define BADVERSION 6 /* request has invalid protocol version */
#define BADADDR 7 /* request has invalid addr value */
#define BADCTLADDR 8 /* request has invalid ctl_addr value */
/*
* Operational parameters.
*/
#define MAX_LIFE 60 /* max time daemon saves invitations */
/* RING_WAIT should be 10's of seconds less than MAX_LIFE */
#define RING_WAIT 30 /* time to wait before resending invitation */
#endif /* !_TALKD_H_ */

134
include/pwd.h Normal file
View File

@ -0,0 +1,134 @@
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)pwd.h 8.2 (Berkeley) 1/21/94
*/
#ifndef _PWD_H_
#define _PWD_H_
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef _POSIX_SOURCE
#define _PATH_PWD "/etc"
#define _PATH_PASSWD "/etc/passwd"
#define _PASSWD "passwd"
#define _PATH_MASTERPASSWD "/etc/master.passwd"
#define _MASTERPASSWD "master.passwd"
#define _PATH_MP_DB "/etc/pwd.db"
#define _MP_DB "pwd.db"
#define _PATH_SMP_DB "/etc/spwd.db"
#define _SMP_DB "spwd.db"
#define _PATH_PWD_MKDB "/usr/sbin/pwd.mkdb"
#define _PW_KEYBYNAME '1' /* stored by name */
#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */
#define _PW_KEYBYUID '3' /* stored by uid */
#define _PW_KEYYPENABLED '4' /* YP is enabled */
#define _PW_KEYYPBYNUM '5' /* special +@netgroup entries */
#define _PASSWORD_EFMT1 '_' /* extended encryption format */
#define _PASSWORD_LEN 128 /* max length, not counting NULL */
#endif
#if 0
/*
* GNO v2.0.4 and earlier -- there is a new (although as yet unimplemented)
* version below.
*/
struct passwd { /* see getpwent(3) */
char *pw_name;
char *pw_passwd;
int pw_uid;
int pw_gid;
int pw_quota;
char *pw_comment;
char *pw_gecos;
char *pw_dir;
char *pw_shell;
};
#else /* 0 */
struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* encrypted password */
int pw_uid; /* user uid */
int pw_gid; /* user gid */
time_t pw_change; /* password change time */
char *pw_class; /* user access class */
char *pw_gecos; /* Honeywell login info (real name) */
char *pw_dir; /* home directory */
char *pw_shell; /* default shell */
time_t pw_expire; /* account expiration */
unsigned long pw_fields; /* internal: fields filled in */
};
/* Mapping from fields to bits for pw_fields. */
#define _PWF(x) (1 << x)
#define _PWF_NAME _PWF(0)
#define _PWF_PASSWD _PWF(1)
#define _PWF_UID _PWF(2)
#define _PWF_GID _PWF(3)
#define _PWF_CHANGE _PWF(4)
#define _PWF_CLASS _PWF(5)
#define _PWF_GECOS _PWF(6)
#define _PWF_DIR _PWF(7)
#define _PWF_SHELL _PWF(8)
#define _PWF_EXPIRE _PWF(9)
#endif /* 0 */
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
struct passwd *getpwuid __P((uid_t));
struct passwd *getpwnam __P((const char *));
#ifndef _POSIX_SOURCE
struct passwd *getpwent __P((void));
int setpassent __P((int));
int setpwent __P((void));
void endpwent __P((void));
#endif
__END_DECLS
#endif /* !_PWD_H_ */

71
include/regexp.h Normal file
View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 1986 by University of Toronto.
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley
* by Henry Spencer.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)regexp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _REGEXP_H_
#define _REGEXP_H_
/*
* Definitions etc. for regexp(3) routines.
*
* Caveat: this is V8 regexp(3) [actually, a reimplementation thereof],
* not the System V one.
*/
#define NSUBEXP 10
typedef struct regexp {
char *startp[NSUBEXP];
char *endp[NSUBEXP];
char regstart; /* Internal use only. */
char reganch; /* Internal use only. */
char *regmust; /* Internal use only. */
int regmlen; /* Internal use only. */
char program[1]; /* Unwarranted chumminess with compiler. */
} regexp;
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
regexp *regcomp __P((const char *));
int regexec __P((const regexp *, const char *));
void regsub __P((const regexp *, const char *, char *));
void regerror __P((const char *));
__END_DECLS
#endif /* !_REGEXP_H_ */

265
include/resolv.h Normal file
View File

@ -0,0 +1,265 @@
/*-
* Copyright (c) 1983, 1987, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
* From Id: resolv.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp
* $Id: resolv.h,v 1.1 1997/02/28 04:42:02 gdr Exp $
*/
#ifndef _RESOLV_H_
#define _RESOLV_H_
#ifndef _SYS_PARAM_H_
#include <sys/param.h>
#endif
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef _ARPA_NAMESER_H_
#include <arpa/nameser.h>
#endif
#ifndef __stdio__
#include <stdio.h>
#endif
/*
* revision information. this is the release date in YYYYMMDD format.
* it can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__RES > 19931104)". do not
* compare for equality; rather, use it to determine whether your resolver
* is new enough to contain a certain feature.
*/
#if 0 /* GNO 2.0.6 still uses the old style */
#define __RES 19950621 /* 'struct state' -- see below */
#else
#undef __RES
#endif
/*
* Resolver configuration file.
* Normally not present, but may contain the address of the
* inital name server(s) to query and the domain search list.
*/
#ifndef _PATH_RESCONF
#define _PATH_RESCONF "/etc/resolv.conf"
#endif
/*
* Global defines and variables for resolver stub.
*/
#define MAXNS 3 /* max # name servers we'll track */
#define MAXDFLSRCH 3 /* # default domain levels to try */
#define MAXDNSRCH 6 /* max # domains in search path */
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
#define RES_TIMEOUT 5 /* min. seconds between retries */
#define MAXRESOLVSORT 10 /* number of net to sort on */
#define RES_MAXNDOTS 15 /* should reflect bit field size */
#ifdef __RES /* GNO 2.0.6 doesn't define this */
struct __res_state {
int retrans; /* retransmition time interval */
int retry; /* number of times to retransmit */
u_long options; /* option flags - see below. */
int nscount; /* number of name servers */
struct sockaddr_in
nsaddr_list[MAXNS]; /* address of name server */
#define nsaddr nsaddr_list[0] /* for backward compatibility */
u_short id; /* current packet id */
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
char defdname[MAXDNAME]; /* default domain */
u_long pfcode; /* RES_PRF_ flags - see below. */
unsigned ndots:4; /* threshold for initial abs. query */
unsigned nsort:4; /* number of elements in sort_list[] */
char unused[3];
struct {
struct in_addr addr;
u_int32_t mask;
} sort_list[MAXRESOLVSORT];
};
#else /* ! __RES */
struct state {
int retrans; /* retransmition time interval */
int retry; /* number of times to retransmit */
long options; /* option flags - see below. */
int nscount; /* number of name servers */
struct sockaddr_in
nsaddr_list[MAXNS]; /* address of name server */
#define nsaddr nsaddr_list[0] /* for backward compatibility */
u_short id; /* current packet id */
char defdname[MAXDNAME]; /* default domain */
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
};
#endif
/*
* Resolver options (keep these in synch with res_debug.c, please)
*/
#define RES_INIT 0x00000001 /* address initialized */
#define RES_DEBUG 0x00000002 /* print debug messages */
#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/
#define RES_USEVC 0x00000008 /* use virtual circuit */
#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
#define RES_IGNTC 0x00000020 /* ignore trucation errors */
#define RES_RECURSE 0x00000040 /* recursion desired */
#define RES_DEFNAMES 0x00000080 /* use default domain name */
#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
#define RES_DNSRCH 0x00000200 /* search up local domain tree */
#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
/*
* Resolver "pfcode" values. Used by dig.
*/
#define RES_PRF_STATS 0x00000001
/* 0x00000002 */
#define RES_PRF_CLASS 0x00000004
#define RES_PRF_CMD 0x00000008
#define RES_PRF_QUES 0x00000010
#define RES_PRF_ANS 0x00000020
#define RES_PRF_AUTH 0x00000040
#define RES_PRF_ADD 0x00000080
#define RES_PRF_HEAD1 0x00000100
#define RES_PRF_HEAD2 0x00000200
#define RES_PRF_TTLID 0x00000400
#define RES_PRF_HEADX 0x00000800
#define RES_PRF_QUERY 0x00001000
#define RES_PRF_REPLY 0x00002000
#define RES_PRF_INIT 0x00004000
/* 0x00008000 */
/* hooks are still experimental as of 4.9.2 */
typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
res_sendhookact;
typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr_in * const *ns,
const u_char **query,
int *querylen,
u_char *ans,
int anssiz,
int *resplen));
typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr_in *ns,
const u_char *query,
int querylen,
u_char *ans,
int anssiz,
int *resplen));
extern struct __res_state _res;
/* Private routines shared between libc/net, named, nslookup and others. */
#define dn_skipname __dn_skipname
#define fp_query __fp_query
#define fp_nquery __fp_nquery
#define hostalias __hostalias
#define putlong __putlong
#define putshort __putshort
#define p_class __p_class
#define p_time __p_time
#define p_type __p_type
#define p_cdnname __p_cdnname
#define p_cdname __p_cdname
#define p_fqname __p_fqname
#define p_rr __p_rr
#define p_option __p_option
#define res_randomid __res_randomid
#define res_isourserver __res_isourserver
#define res_nameinquery __res_nameinquery
#define res_queriesmatch __res_queriesmatch
__BEGIN_DECLS
int __dn_skipname __P((const u_char *, const u_char *));
void __fp_resstat __P((struct __res_state *, FILE *));
void __fp_query __P((const u_char *, FILE *));
void __fp_nquery __P((const u_char *, int, FILE *));
char *__hostalias __P((const char *));
void __putlong __P((u_int32_t, u_char *));
void __putshort __P((u_int16_t, u_char *));
char *__p_time __P((u_int32_t));
void __p_query __P((const u_char *));
const u_char *__p_cdnname __P((const u_char *, const u_char *, int, FILE *));
const u_char *__p_cdname __P((const u_char *, const u_char *, FILE *));
const u_char *__p_fqname __P((const u_char *, const u_char *, FILE *));
const u_char *__p_rr __P((const u_char *, const u_char *, FILE *));
const char *__p_type __P((int));
const char *__p_class __P((int));
const char *__p_option __P((u_long option));
int dn_comp __P((const char *, u_char *, int, u_char **, u_char **));
int dn_expand __P((const u_char *, const u_char *, const u_char *,
char *, int));
int res_init __P((void));
u_int16_t res_randomid __P((void));
int res_query __P((const char *, int, int, u_char *, int));
int res_search __P((const char *, int, int, u_char *, int));
int res_querydomain __P((const char *, const char *, int, int,
u_char *, int));
int res_mkquery __P((int, const char *, int, int, const u_char *, int,
const u_char *, u_char *, int));
int res_send __P((const u_char *, int, u_char *, int));
int res_isourserver __P((const struct sockaddr_in *));
int res_nameinquery __P((const char *, int, int,
const u_char *, const u_char *));
int res_queriesmatch __P((const u_char *, const u_char *,
const u_char *, const u_char *));
__END_DECLS
#endif /* !_RESOLV_H_ */

68
include/rpc/types.h Normal file
View File

@ -0,0 +1,68 @@
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)types.h 1.18 87/07/24 SMI
* from: @(#)types.h 2.3 88/08/15 4.0 RPCSRC
* $Id: types.h,v 1.1 1997/02/28 04:42:13 gdr Exp $
*/
/*
* Rpc additions to <sys/types.h>
*/
#ifndef _RPC_TYPES_H
#define _RPC_TYPES_H
#define bool_t int
#define enum_t int
#define __dontcare__ -1
#ifndef FALSE
# define FALSE (0)
#endif
#ifndef TRUE
# define TRUE (1)
#endif
#ifndef NULL
# define NULL (void *) 0L
#endif
#define mem_alloc(bsize) malloc(bsize)
#define mem_free(ptr, bsize) free(ptr)
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef _SYS_TIME_H_
#include <sys/time.h>
#endif
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK (u_long)0x7F000001
#endif
#endif /* !_RPC_TYPES_H */

21
include/setjmp.h Normal file
View File

@ -0,0 +1,21 @@
/****************************************************************
*
* setjmp.h - nonlocal jump library
*
* February 1989
* Mike Westerfield
*
* Copyright 1989
* Byte Works, Inc.
*
****************************************************************/
#ifndef __setjmp__
#define __setjmp__
typedef int jmp_buf[6];
void longjmp(jmp_buf, int);
int setjmp(jmp_buf);
#endif

49
include/sgtty.h Normal file
View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sgtty.h 8.1 (Berkeley) 6/2/93
*/
#ifndef USE_OLD_TTY
#define USE_OLD_TTY
#endif
#ifndef _SYS_IOCTL_H_
#include <sys/ioctl.h>
#endif
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef _POSIX_SOURCE
int stty __P((int, struct sgttyb *));
int gtty __P((int, struct sgttyb *));
#endif

91
include/signal.h Normal file
View File

@ -0,0 +1,91 @@
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)signal.h 8.3 (Berkeley) 3/30/94
*/
#ifndef _SIGNAL_H_
#define _SIGNAL_H_
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef _SYS_SIGNAL_H_
#include <sys/signal.h>
#endif
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
extern __const char *__const sys_signame[NSIG];
extern __const char *__const sys_siglist[NSIG];
#endif
__BEGIN_DECLS
int raise __P((int));
#ifndef _ANSI_SOURCE
int kill __P((pid_t, int));
int sigaction __P((int, const struct sigaction *, struct sigaction *));
int sigaddset __P((sigset_t *, int));
int sigdelset __P((sigset_t *, int));
int sigemptyset __P((sigset_t *));
int sigfillset __P((sigset_t *));
int sigismember __P((const sigset_t *, int));
int sigpending __P((sigset_t *));
int sigprocmask __P((int, const sigset_t *, sigset_t *));
int sigsuspend __P((const sigset_t *));
#ifndef _POSIX_SOURCE
int killpg __P((pid_t, int));
int sigaltstack __P((const struct sigaltstack *, struct sigaltstack *));
u_long sigblock __P((u_long)); /* non-BSD */
int siginterrupt __P((int, int));
int sigpause __P((u_long)); /* non-BSD */
int sigreturn __P((struct sigcontext *));
u_long sigsetmask __P((u_long)); /* non-BSD */
int sigstack __P((const struct sigstack *, struct sigstack *));
int sigvec __P((int, struct sigvec *, struct sigvec *));
void psignal __P((unsigned int, const char *));
#endif /* !_POSIX_SOURCE */
#endif /* !_ANSI_SOURCE */
__END_DECLS
/* List definitions after function declarations, or Reiser cpp gets upset. */
#define sigaddset(set, signo) (*(set) |= 1 << ((signo) - 1), 0)
#define sigdelset(set, signo) (*(set) &= ~(1 << ((signo) - 1)), 0)
#define sigemptyset(set) (*(set) = 0, 0)
#define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
#define sigismember(set, signo) ((*(set) & (1 << ((signo) - 1))) != 0)
#endif /* !_SIGNAL_H_ */

64
include/stddef.h Normal file
View File

@ -0,0 +1,64 @@
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stddef.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _STDDEF_H_
#define _STDDEF_H_
#ifndef _MACHINE_ANSI_H_
#include <machine/ansi.h>
#endif
typedef _BSD_PTRDIFF_T_ ptrdiff_t;
#ifdef _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
#ifdef _BSD_WCHAR_T_
#ifndef _ANSI_SOURCE
typedef _BSD_WCHAR_T_ rune_t;
#endif
typedef _BSD_WCHAR_T_ wchar_t;
#undef _BSD_WCHAR_T_
#endif
#ifndef NULL
#define NULL 0
#endif
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
#endif /* _STDDEF_H_ */

237
include/stdio.h Normal file
View File

@ -0,0 +1,237 @@
/****************************************************************
*
* stdio.h - input/output facilities
*
* February 1989
* Mike Westerfield
*
* Copyright 1989, 1993
* Byte Works, Inc.
*
****************************************************************/
#ifndef __stdio__
#define __stdio__
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
#ifndef _SYS_SYSLIMITS_H_
#include <sys/syslimits.h>
#endif
/*
* Misc.
*/
#ifndef __va_list__
#define __va_list__
typedef char *__va_list[2];
#endif
#ifndef EOF
#define EOF (-1)
#endif
#ifndef NULL
#define NULL (void *) 0L
#endif
#ifndef __size_t__
#define __size_t__ 1
typedef unsigned long size_t;
#endif
/* seek codes */
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
/*
* Error handling
*/
#if !defined(__KeepNamespacePure__) && !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
extern const int sys_nerr; /* largest index for sys_errlist */
extern const char * const sys_errlist[]; /* error messages */
#endif
/*
* files
*/
typedef struct __file {
struct __file *next; /* next file in linked list */
unsigned char *_ptr, /* next location to write to */
*_base, /* first byte of the buffer */
*_end; /* end of the file buffer */
unsigned long _size, /* size of the file buffer */
_cnt; /* # chars that can be read/writen to buffer */
#if defined(__ORCAC_VERSION) && (__ORCAC_VERSION > 210)
int _pbk[2]; /* put back character; changed in v2.1.1b2 */
#else
#error bad stuff batman
int _pbk; /* put back character */
#endif
unsigned int _flag, /* buffer flags */
_file; /* GS/OS file ID */
} FILE;
#define BUFSIZ 1024 /* default buffer size */
#define _LBUFSIZ 255 /* line buffer size */
#define _IOFBF 0x0001 /* full buffering */
#define _IONBF 0x0002 /* no buffering */
#define _IOLBF 0x0004 /* flush when a \n is written */
#define _IOREAD 0x0008 /* currently reading */
#define _IOWRT 0x0010 /* currently writing */
#define _IORW 0x0020 /* read/write enabled */
#define _IOMYBUF 0x0040 /* buffer was allocated by stdio */
#define _IOEOF 0x0080 /* has an EOF been found? */
#define _IOERR 0x0100 /* has an error occurred? */
#define _IOTEXT 0x0200 /* is this file a text file? */
#define _IOTEMPFILE 0x0400 /* was this file created by tmpfile()? */
extern FILE *stderr; /* standard I/O files */
extern FILE *stdin;
extern FILE *stdout;
#define L_tmpnam 26 /* size of a temp name */
#define TMP_MAX 10000 /* # of unique temp names */
#ifdef __GNO__
#define __max_open OPEN_MAX /* <= OPEN_MAX <sys/syslimits.h> */
#else
#define __max_open 32767 /* Orca Shell: no practical limit */
#endif
#ifndef __KeepNamespacePure__
#define SYS_OPEN __max_open /* max # open files */
#endif
#define FOPEN_MAX __max_open /* max # open files */
#undef __max_open
#define FILENAME_MAX 1024 /* recommended file name length */
/*
* Other types
*/
typedef long fpos_t;
/*
* Functions declared as macros
*/
#ifdef __ORCAC_VERSION /* Orca/C v2.1.0 or later */
#define setbuf(stream,buf) ((buf==NULL) ? (void) __setvbuf(stream,NULL,_IONBF,0l) : (void) __setvbuf(stream,buf,_IOFBF,(size_t) BUFSIZ))
#define setlinebuf(stream) (__setvbuf((stream),NULL,_IOLBF,_LBUFSIZ))
#define rewind(stream) (__fseek((stream),0L,SEEK_SET))
int __fseek(FILE *, long, int);
int __setvbuf(FILE *, char *, int, size_t);
int getc(FILE *);
int putc(int, FILE *);
#else /* __ORCAC_VERSION */
#define getc(p) (fgetc(p))
#define putc(x, p) fputc(x, p)
#define setbuf(stream,buf) ((buf==NULL) ? (void) setvbuf(stream,NULL,_IONBF,0l) : (void) setvbuf(stream,buf,_IOFBF,(size_t) BUFSIZ))
#define setlinebuf(stream) (setvbuf((stream),NULL,_IOLBF,_LBUFSIZ))
#define rewind(stream) (fseek((stream),0L,SEEK_SET))
#endif /* __ORCAC_VERSION */
/*
* Function declarations
*/
void clearerr(FILE *);
int fclose(FILE *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fgetpos(FILE *, fpos_t *);
char *fgets(char *, int, FILE *);
FILE *fopen(const char *, const char *);
int fprintf(FILE *, const char *, ...);
int fputc(int, FILE *);
int fputs(const char *, FILE *);
size_t fread(void *, size_t, size_t, FILE *);
FILE *freopen(const char *, const char *, FILE *);
int fscanf(FILE *, const char *, ...);
int fseek(FILE *, long, int);
int fsetpos(FILE *, const fpos_t *);
long int ftell(FILE *);
size_t fwrite(const void *, size_t, size_t, FILE *);
int getchar(void);
char *gets(char *);
void perror(const char *);
int printf(const char *, ...);
int putchar(int);
int puts(const char *);
int remove(const char *);
int rename(const char *, const char *);
int scanf(const char *, ...);
int setvbuf(FILE *, char *, int, size_t);
int sprintf(char *, const char *, ...);
int sscanf(const char *, const char *, ...);
FILE *tmpfile(void);
char *tmpnam(char *);
int ungetc(int c, FILE *);
int vfprintf(FILE *, const char *, __va_list);
int vprintf(const char *, __va_list);
int vsprintf(char *, const char *, __va_list);
/*
* The remaining functions and macros in this file are GNO-specific
*/
/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
#ifndef _ANSI_SOURCE
#define P_tmpdir "/tmp/"
#endif
/*
* Functions defined in POSIX 1003.1.
*/
#ifndef _ANSI_SOURCE
#define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */
#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */
#define fileno(f) (f->_file)
__BEGIN_DECLS
#ifndef _POSIX_SOURCE
char *cuserid __P((char *)); /* non-BSD */
#endif
char *ctermid __P((char *));
FILE *fdopen __P((int, const char *));
int fileno __P((FILE *));
__END_DECLS
#endif /* not ANSI */
/*
* Routines that are purely local.
*/
#if !defined (_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
__BEGIN_DECLS
char *fgetln __P((FILE *, size_t *));
int fpurge __P((FILE *));
int getw __P((FILE *));
int pclose __P((FILE *));
FILE *popen __P((const char *, const char *));
int putw __P((int, FILE *));
void setbuffer __P((FILE *, char *, int));
char *tempnam __P((const char *, const char *));
int snprintf __P((char *, size_t, const char *, ...));
int vfscanf __P((FILE *, const char *, __va_list));
int vsnprintf __P((char *, size_t, const char *, __va_list));
int vscanf __P((const char *, __va_list));
int vsscanf __P((const char *, const char *, __va_list));
FILE *zopen __P((const char *, const char *, int));
__END_DECLS
#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
#endif /* __stdio__ */

202
include/stdlib.h Normal file
View File

@ -0,0 +1,202 @@
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stdlib.h 8.3 (Berkeley) 2/16/94
*/
#ifndef _STDLIB_H_
#define _STDLIB_H_
#ifndef _MACHINE_ANSI_H_
#include <machine/ansi.h>
#endif
#ifdef _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
#ifdef _BSD_WCHAR_T_
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
typedef _BSD_WCHAR_T_ rune_t;
#endif
typedef _BSD_WCHAR_T_ wchar_t;
#undef _BSD_WCHAR_T_
#endif
typedef struct {
int quot; /* quotient */
int rem; /* remainder */
} div_t;
typedef struct {
long quot; /* quotient */
long rem; /* remainder */
} ldiv_t;
#ifndef NULL
#define NULL (void *) 0L
#endif
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#define RAND_MAX 32767
extern int __mb_cur_max;
#define MB_CUR_MAX __mb_cur_max
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
__dead void
abort __P((void)) __dead2;
__pure int
abs __P((int)) __pure2;
int atexit __P((void (*)(void)));
double atof __P((const char *));
int atoi __P((const char *));
long atol __P((const char *));
void *bsearch __P((const void *, const void *, size_t,
size_t, int (*)(const void *, const void *)));
void *calloc __P((size_t, size_t));
__pure div_t
div __P((int, int)) __pure2;
__dead void
exit __P((int)) __dead2;
void free __P((void *));
char *getenv __P((const char *));
__pure long
labs __P((long)) __pure2;
__pure ldiv_t
ldiv __P((long, long)) __pure2;
void *malloc __P((size_t));
void qsort __P((void *, size_t, size_t,
int (*)(const void *, const void *)));
int rand __P((void));
void *realloc __P((void *, size_t));
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
void rexit __P((int));
#endif
void srand __P((unsigned));
double strtod __P((const char *, char **));
long strtol __P((const char *, char **, int));
unsigned long
strtoul __P((const char *, char **, int));
int system __P((const char *));
int mblen __P((const char *, size_t));
size_t mbstowcs __P((wchar_t *, const char *, size_t));
int wctomb __P((char *, wchar_t));
int mbtowc __P((wchar_t *, const char *, size_t));
size_t wcstombs __P((char *, const wchar_t *, size_t));
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
int putenv __P((const char *));
int setenv __P((const char *, const char *, int));
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
/* GNO-specific routines */
int environInit __P((void)); /* formerly initenv(3) */
void environPop __P((void)); /* formerly popenv(3) */
int environPush __P((void)); /* formerly pushenv(3) */
#endif
double drand48 __P((void));
double erand48 __P((unsigned short[3]));
long jrand48 __P((unsigned short[3]));
void lcong48 __P((unsigned short[7]));
long lrand48 __P((void));
long mrand48 __P((void));
long nrand48 __P((unsigned short[3]));
unsigned short
*seed48 __P((unsigned short[3]));
void srand48 __P((long));
void *alloca __P((size_t)); /* built-in for gcc */
/* getcap(3) functions */
char *getbsize __P((int *, long *));
char *cgetcap __P((char *, char *, int));
int cgetclose __P((void));
int cgetent __P((char **, char **, char *));
int cgetfirst __P((char **, char **));
int cgetmatch __P((char *, char *));
int cgetnext __P((char **, char **));
int cgetnum __P((char *, char *, long *));
int cgetset __P((char *));
int cgetstr __P((char *, char *, char **));
int cgetustr __P((char *, char *, char **));
int daemon __P((int, int));
char *devname __P((int, int));
int getloadavg __P((double [], int));
extern char *optarg; /* getopt(3) external variables */
extern int opterr, optind, optopt;
int getopt __P((int, char * const *, const char *));
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
int getopt_restart __P((void)); /* GNO v2.0.4 backward compatible */
#endif
extern char *suboptarg; /* getsubopt(3) external variable */
int getsubopt __P((char **, char * const *, char **));
char *group_from_gid __P((unsigned long, int));
int heapsort __P((void *, size_t, size_t,
int (*)(const void *, const void *)));
char *initstate __P((unsigned, char *, int));
int mergesort __P((void *, size_t, size_t,
int (*)(const void *, const void *)));
int radixsort __P((const unsigned char **, int, const unsigned char *,
unsigned));
int sradixsort __P((const unsigned char **, int, const unsigned char *,
unsigned));
long random __P((void));
char *realpath __P((const char *, char resolved_path[]));
char *setstate __P((char *));
void srandom __P((unsigned));
char *user_from_uid __P((unsigned long, int));
#ifndef __STRICT_ANSI__
/* non-BSD; uses "long long" and "unsigned long long" */
struct quad_t;
struct quad_t strtoq __P((const char *, char **, int));
struct u_quad_t;
struct u_quad_t strtouq __P((const char *, char **, int));
#endif
void unsetenv __P((const char *));
#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
__END_DECLS
#endif /* !_STDLIB_H_ */

118
include/string.h Normal file
View File

@ -0,0 +1,118 @@
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)string.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _STRING_H_
#define _STRING_H_
#ifndef _MACHINE_ANSI_H_
#include <machine/ansi.h>
#endif
#if defined(_BSD_SIZE_T_) && !defined(__size_t__)
#define __size_t__ 1
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
#ifndef NULL
#define NULL (void *) 0L
#endif
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
void *memchr __P((const void *, int, size_t));
int memcmp __P((const void *, const void *, size_t));
void *memcpy __P((void *, const void *, size_t));
void *memmove __P((void *, const void *, size_t));
void *memset __P((void *, int, size_t));
char *strcat __P((char *, const char *));
char *strchr __P((const char *, int));
int strcmp __P((const char *, const char *));
int strcoll __P((const char *, const char *));
char *strcpy __P((char *, const char *));
size_t strcspn __P((const char *, const char *));
char *strerror __P((int));
size_t strlen __P((const char *));
char *strncat __P((char *, const char *, size_t));
int strncmp __P((const char *, const char *, size_t));
char *strncpy __P((char *, const char *, size_t));
char *strpbrk __P((const char *, const char *));
char *strrchr __P((const char *, int));
size_t strspn __P((const char *, const char *));
char *strstr __P((const char *, const char *));
char *strtok __P((char *, const char *));
size_t strxfrm __P((char *, const char *, size_t));
/* Nonstandard routines */
#ifndef _ANSI_SOURCE
int bcmp __P((const void *, const void *, size_t));
void bcopy __P((const void *, void *, size_t));
void bzero __P((void *, size_t));
int ffs __P((int));
char *index __P((const char *, int));
void *memccpy __P((void *, const void *, int, size_t));
char *rindex __P((const char *, int));
int strcasecmp __P((const char *, const char *));
char *strdup __P((const char *));
void strmode __P((int, char *));
int strncasecmp __P((const char *, const char *, size_t));
char *strsep __P((char **, const char *));
void swab __P((const void *, void *, size_t));
/* These are specific to Orca and GNO. Some should probably use "const" */
char *c2pstr __P((char *));
char *p2cstr __P((char *));
int strpos __P((char *, char));
char *strrpbrk __P((char *, char *));
int strrpos __P((char *, char));
char *strupr __P((char *str));
char *strlwr __P((char *str));
char *strset __P((char *str, char ch));
char *strnset __P((char *str, char ch, unsigned count));
char *strrev __P((char *str));
char *strpblnks __P((char *str));
char *strrpblnks __P((char *str));
char *strpad __P((char *str, char ch, unsigned count));
char *strrpad __P((char *str, char ch, unsigned count));
short stricmp __P((const char *s1, const char *s2));
short strincmp __P((const char *s1, const char *s2, unsigned n));
#endif
__END_DECLS
#endif /* _STRING_H_ */

112
include/sys/cdefs.h Normal file
View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)cdefs.h 8.7 (Berkeley) 1/21/94
* $Id: cdefs.h,v 1.1 1997/02/28 04:42:13 gdr Exp $
*/
#ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS };
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
* in between its arguments. __CONCAT can also concatenate double-quoted
* strings produced by the __STRING macro, but this only works with ANSI C.
*/
#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT1(x,y) x ## y
#define __CONCAT(x,y) __CONCAT1(x,y)
#define __STRING(x) #x
#define __const const /* define reserved names to standard */
#define __signed signed
#define __volatile volatile
#if defined(__cplusplus)
#define __inline inline /* convert to C++ keyword */
#else
#define __inline /* delete GCC keyword */
#endif /* !__cplusplus */
#else /* !(__STDC__ || __cplusplus) */
#define __P(protos) () /* traditional C preprocessor */
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
#ifndef __GNUC__
#define __const /* delete pseudo-ANSI C keywords */
#define __inline
#define __signed
#define __volatile
/*
* In non-ANSI C environments, new programs will want ANSI-only C keywords
* deleted from the program and old programs will want them left alone.
* When using a compiler other than gcc, programs using the ANSI C keywords
* const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
* When using "gcc -traditional", we assume that this is the intent; if
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
*/
#ifndef NO_ANSI_KEYWORDS
#define const /* delete ANSI C keywords */
#define inline
#define signed
#define volatile
#endif /* !NO_ANSI_KEYWORDS */
#endif /* !__GNUC__ */
#endif /* !(__STDC__ || __cplusplus) */
/*
* The original BSD version of this file had additional #defines intended
* for GNU gcc. They have been deleted from the GNO version, and we just
* provide the "short version".
*/
#define __dead
#define __dead2
#define __pure
#define __pure2
#define __attribute__(x)
#endif /* !_SYS_CDEFS_H_ */

84
include/sys/dirent.h Normal file
View File

@ -0,0 +1,84 @@
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)dirent.h 8.1 (Berkeley) 6/2/93
* $Id: dirent.h,v 1.1 1997/02/28 04:42:13 gdr Exp $
*/
#ifndef _SYS_DIRENT_H_
#define _SYS_DIRENT_H_
/*
* The dirent structure defines the format of directory entries returned by
* the getdirentries(2) system call.
*
* A directory entry has a struct dirent at the front of it, containing its
* inode number, the length of the entry, and the length of the name
* contained in the entry. These are followed by the name padded to a 4
* byte boundary with null bytes. All names are guaranteed null terminated.
* The maximum length of a name in a directory is MAXNAMLEN.
*/
struct dirent {
unsigned long d_fileno; /* file number of entry */
unsigned short d_reclen; /* length of this record */
unsigned char d_type; /* file type, see below */
unsigned char d_namlen; /* length of string in d_name */
#ifdef _POSIX_SOURCE
char d_name[255 + 1]; /* name must be no longer than this */
#else
#define MAXNAMLEN 255
char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
#endif
};
/*
* File types
*/
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
/*
* Convert between stat structure types and directory types.
*/
#ifndef __GNO__ /* these haven't been reviewed */
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#define DTTOIF(dirtype) ((dirtype) << 12)
#endif
#endif

180
include/sys/errno.h Normal file
View File

@ -0,0 +1,180 @@
/*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are /*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are y the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)errno.h 8.5 (Berkeley) 1/21/94
* $Id: errno.h,v 1.1 1997/02/28 04:42:14 gdr Exp $
*/
#ifndef _SYS_ERRNO_H_
#define _SYS_ERRNO_H_
#ifndef KERNEL
extern int errno; /* global error number */
#endif
/* These are provided by both the GNO kernel and Orca/Shell */
#define EDOM 1 /* Numerical argument out of domain */
#define ERANGE 2 /* Result too large */
#define ENOMEM 3 /* Cannot allocate memory */
#define ENOENT 4 /* No such file or directory */
#define EIO 5 /* Input/output error */
#define EINVAL 6 /* Invalid argument */
#define EBADF 7 /* Bad file descriptor */
#define EMFILE 8 /* Too many open files */
#define EACCES 9 /* Permission denied -- POSIX */
/* The Orca/C <errno.h> uses */
/* EACCESS for this value, */
/* but that macro conflicts */
/* with <arpa/tftp.h>. */
#define EEXIST 10 /* File exists */
#define ENOSPC 11 /* No space left on device */
/* These are only provided by the GNO kernel. */
#define EPERM 12 /* Operation not permitted */
#define ESRCH 13 /* No such process */
#define EINTR 14 /* Interrupted system call */
#define E2BIG 15 /* Argument list too long */
#define ENOEXEC 16 /* Exec format error */
#define ECHILD 17 /* No child processes */
#define EAGAIN 18 /* Resource temporarily unavailable */
#define ENOTDIR 19 /* Not a directory */
#define ENOTTY 20 /* Inappropriate ioctl for device */
#define EPIPE 21 /* Broken pipe */
#define ESPIPE 22 /* Illegal seek */
#ifndef _POSIX_SOURCE
#define ENOTBLK 23 /* Block device required */
#endif
#define EISDIR 24 /* Is a directory */
/* ipc/network software -- argument errors */
#ifndef _POSIX_SOURCE
#define ENOTSOCK 25 /* Socket operation on non-socket */
#define EDESTADDRREQ 26 /* Destination address required */
#define EMSGSIZE 27 /* Message too long */
#define EPROTOTYPE 28 /* Protocol wrong type for socket */
#define ENOPROTOOPT 29 /* Protocol not available */
#define EPROTONOSUPPORT 30 /* Protocol not supported */
#define ESOCKTNOSUPPORT 31 /* Socket type not supported */
#define EOPNOTSUPP 32 /* Operation not supported on socket */
#define EPFNOSUPPORT 33 /* Protocol family not supported */
#define EAFNOSUPPORT 34 /* Address family not supported by protocol family */
#define EADDRINUSE 35 /* Address already in use */
#define EADDRNOTAVAIL 36 /* Can't assign requested address */
/* ipc/network software -- operational errors */
#define ENETDOWN 37 /* Network is down */
#define ENETUNREACH 38 /* Network is unreachable */
#define ENETRESET 39 /* Network dropped connection on reset */
#define ECONNABORTED 40 /* Software caused connection abort */
#define ECONNRESET 41 /* Connection reset by peer */
#define ENOBUFS 42 /* No buffer space available */
#define EISCONN 43 /* Socket is already connected */
#define ENOTCONN 44 /* Socket is not connected */
#define ESHUTDOWN 45 /* Can't send after socket shutdown */
#define ETOOMANYREFS 46 /* Too many references: can't splice */
#define ETIMEDOUT 47 /* Connection timed out */
#define ECONNREFUSED 48 /* Connection refused */
/* non-blocking and interrupt i/o */
#define EWOULDBLOCK 49 /* Operation would block */
#define EINPROGRESS 50 /* Operation now in progress */
#define EALREADY 51 /* Operation already in progress */
#endif /* _POSIX_SOURCE */
#define EFAULT 52 /* this one should be up top */
#define ENODEV 53 /* this one should be up top */
#ifndef _POSIX_SOURCE
#define EHOSTDOWN 54 /* Host is down */
#define EHOSTUNREACH 55 /* No route to host */
#define ELAST 55 /* Must be equal largest errno */
#endif
/*
* The remainder of these values are not currently used by GNO.
*/
#if 0
#define ENXIO 56 /* Device not configured */
#define EDEADLK 57 /* Resource deadlock avoided */
#define EBUSY 58 /* Device busy */
#define EXDEV 59 /* Cross-device link */
#define ENFILE 60 /* Too many open files in system */
#ifndef _POSIX_SOURCE
#define ETXTBSY 61 /* Text file busy */
#endif
#define EFBIG 62 /* File too large */
#define EROFS 63 /* Read-only file system */
#define EMLINK 64 /* Too many links */
#ifndef _POSIX_SOURCE
#define ELOOP 65 /* Too many levels of symbolic links */
#endif
#define ENAMETOOLONG 66 /* File name too long */
#define ENOTEMPTY 67 /* Directory not empty */
#define ENOLCK 68 /* No locks available */
#define ENOSYS 69 /* Function not implemented */
/* quotas & mush */
#ifndef _POSIX_SOURCE
#define EPROCLIM 70 /* Too many processes */
#define EUSERS 71 /* Too many users */
#define EDQUOT 72 /* Disc quota exceeded */
/* Network File System */
#define ESTALE 73 /* Stale NFS file handle */
#define EREMOTE 74 /* Too many levels of remote in path */
#define EBADRPC 75 /* RPC struct is bad */
#define ERPCMISMATCH 76 /* RPC version wrong */
#define EPROGUNAVAIL 77 /* RPC prog. not avail */
#define EPROGMISMATCH 78 /* Program version wrong */
#define EPROCUNAVAIL 79 /* Bad procedure for program */
#define EFTYPE 80 /* Inappropriate file type or format */
#define EAUTH 81 /* Authentication error */
#define ENEEDAUTH 82 /* Need authenticator */
#define ELAST 82 /* Must be equal largest errno */
#endif /* _POSIX_SOURCE */
#ifdef KERNEL
/* pseudo-errors returned inside kernel to modify return to process */
#define ERESTART -1 /* restart syscall */
#define EJUSTRETURN -2 /* don't modify regs, just return */
#endif
#endif /* 0 */
#endif /* _SYS_ERRNO_H_ */

205
include/sys/fcntl.h Normal file
View File

@ -0,0 +1,205 @@
/*-
* Copyright (c) 1983, 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)fcntl.h 8.3 (Berkeley) 1/21/94
* $Id: fcntl.h,v 1.1 1997/02/28 04:42:14 gdr Exp $
*/
#ifndef _SYS_FCNTL_H_
#define _SYS_FCNTL_H_
/*
* This file includes the definitions for open and fcntl
* described by POSIX for <fcntl.h>; it also includes
* related kernel definitions.
*/
#if !defined(KERNEL) && !defined(_SYS_TYPES_H_)
#include <sys/types.h>
#endif
/*
* File status flags: these are used by open(2), fcntl(2).
* They are also used (indirectly) in the kernel file structure f_flags,
* which is a superset of the open/fcntl flags. Open flags and f_flags
* are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
* Open/fcntl flags begin with O_; kernel-internal flags begin with F.
*/
/* open-only flags */
#define O_RDONLY 0x0001 /* open for reading only */
#define O_WRONLY 0x0002 /* open for writing only */
#define O_RDWR 0x0004 /* open for reading and writing */
#define O_ACCMODE 0x0007 /* mask for above modes */
/*
* Kernel encoding of open mode; separate read and write bits that are
* independently testable: 1 greater than the above.
*
* XXX
* FREAD and FWRITE are excluded from the #ifdef KERNEL so that TIOCFLUSH,
* which was documented to use FREAD/FWRITE, continues to work.
*/
#ifndef _POSIX_SOURCE
#define FREAD 0x0001
#define FWRITE 0x0002
#endif
#define O_NONBLOCK 0x0008 /* no delay */
#define O_APPEND 0x0010 /* set append mode */
#if !defined(_POSIX_SOURCE) && !defined(__GNO__)
/* not yet implemented in GNO */
#define O_SHLOCK conflicts with o_binary /* open with shared file lock */
#define O_EXLOCK conflicts with o_trans /* open with exclusive file lock */
#define O_ASYNC 0x0400 /* signal pgrp when data ready */
#define O_FSYNC 0x0800 /* synchronous writes */
#endif
#define O_CREAT 0x0020 /* create if nonexistant */
#define O_TRUNC 0x0040 /* truncate to zero length */
#define O_EXCL 0x0080 /* error if already exists */
#if defined(KERNEL) && !defined(__GNO__)
/* not used in GNO */
#define FMARK 0x1000 /* mark during gc() */
#define FDEFER 0x2000 /* defer for next gc pass */
#define FHASLOCK 0x4000 /* descriptor holds advisory lock */
#endif
#ifndef _POSIX_SOURCE
#define O_BINARY 0x0100 /* non-POSIX, mostly ignored by GNO */
#define O_TRANS 0x0200 /* GNO specific */
#endif
/* defined by POSIX 1003.1; BSD default, so no bit required */
#define O_NOCTTY 0 /* don't assign controlling terminal */
#ifdef KERNEL
/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
#define FFLAGS(oflags) ((oflags) + 1)
#define OFLAGS(fflags) ((fflags) - 1)
/* bits to save after open */
#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK)
/* bits settable by fcntl(F_SETFL, ...) */
#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK)
#endif
/*
* The O_* flags used to have only F* names, which were used in the kernel
* and by fcntl. We retain the F* names for the kernel f_flags field
* and for backward compatibility for fcntl.
*/
#ifndef _POSIX_SOURCE
#define FAPPEND O_APPEND /* kernel/compat */
#define FASYNC O_ASYNC /* kernel/compat */
#define FFSYNC O_FSYNC /* kernel */
#define FNONBLOCK O_NONBLOCK /* kernel */
#define FNDELAY O_NONBLOCK /* compat */
#define O_NDELAY O_NONBLOCK /* compat */
#endif
/*
* Constants used for fcntl(2)
*/
#ifdef __GNO__
#define F_DUPFD 1 /* duplicate file descriptor */
#else
/* command values */
#define F_DUPFD 0 /* duplicate file descriptor */
#define F_GETFD 1 /* get file descriptor flags */
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
#ifndef _POSIX_SOURCE
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
#endif
#define F_GETLK 7 /* get record locking information */
#define F_SETLK 8 /* set record locking information */
#define F_SETLKW 9 /* F_SETLK; wait if blocked */
/* file descriptor flags (F_GETFD, F_SETFD) */
#define FD_CLOEXEC 1 /* close-on-exec flag */
/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */
#define F_RDLCK 1 /* shared or read lock */
#define F_UNLCK 2 /* unlock */
#define F_WRLCK 3 /* exclusive or write lock */
#ifdef KERNEL
#define F_WAIT 0x010 /* Wait until lock is granted */
#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */
#define F_POSIX 0x040 /* Use POSIX semantics for lock */
#endif
/*
* Advisory file segment locking data type -
* information passed to system by user
*/
struct flock {
off_t l_start; /* starting offset */
off_t l_len; /* len = 0 means until end of file */
pid_t l_pid; /* lock owner */
short l_type; /* lock type: read/write, etc. */
short l_whence; /* type of l_start */
};
#ifndef _POSIX_SOURCE
/* lock operations for flock(2) */
#define LOCK_SH 0x01 /* shared file lock */
#define LOCK_EX 0x02 /* exclusive file lock */
#define LOCK_NB 0x04 /* don't block when locking */
#define LOCK_UN 0x08 /* unlock file */
#endif
#endif /* ! __GNO__ */
#ifndef KERNEL
#ifndef _SYS_CDEFS_H_
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
int open __P((const char *, int, ...));
int creat __P((const char *, mode_t));
int fcntl __P((int, int, ...));
#ifndef _POSIX_SOURCE
int flock __P((int, int));
#endif /* !_POSIX_SOURCE */
__END_DECLS
#endif
#endif /* !_SYS_FCNTL_H_ */

58
include/sys/filio.h Normal file
View File

@ -0,0 +1,58 @@
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)filio.h 8.1 (Berkeley) 3/28/94
* $Id: filio.h,v 1.1 1997/02/28 04:42:14 gdr Exp $
*/
#ifndef _SYS_FILIO_H_
#define _SYS_FILIO_H_
#ifndef _SYS_IOCCOM_H_
#include <sys/ioccom.h>
#endif
/* Generic file-descriptor ioctl's. */
#define FIOCLEX _IO('f', 1) /* set close on exec on fd */
#define FIONCLEX _IO('f', 2) /* remove close on exec */
#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */
#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */
#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */
#define FIOSETOWN _IOW('f', 124, int) /* set owner */
#define FIOGETOWN _IOR('f', 123, int) /* get owner */
#endif /* !_SYS_FILIO_H_ */

67
include/sys/ioccom.h Normal file
View File

@ -0,0 +1,67 @@
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ioccom.h 8.2 (Berkeley) 3/28/94
* $Id: ioccom.h,v 1.1 1997/02/28 04:42:14 gdr Exp $
*/
#ifndef _SYS_IOCCOM_H_
#define _SYS_IOCCOM_H_
/*
* Ioctl's have the command encoded in the lower word, and the size of
* any in or out parameters in the upper word. The high 3 bits of the
* upper word are used to encode the in/out status of the parameter.
*
* IOCPARM_MASK used to be 0x7f in GNO v2.0.4
*/
#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16))
#define IOCGROUP(x) (((x) >> 8) & 0xff)
#define IOCPARM_MAX NBPG /* max size of ioctl, mult. of NBPG */
#define IOC_VOID 0x20000000 /* no parameters */
#define IOC_OUT 0x40000000 /* copy out parameters */
#define IOC_IN 0x80000000 /* copy in parameters */
#define IOC_INOUT (IOC_IN|IOC_OUT)
#define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */
#define _IOC(inout,group,num,len) \
(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
/* this should be _IORW, but stdio got there first */
#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
#endif /* !_SYS_IOCCOM_H_ */

175
include/sys/ioctl.compat.h Normal file
View File

@ -0,0 +1,175 @@
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ioctl_compat.h 8.4 (Berkeley) 1/21/94
* $Id: ioctl.compat.h,v 1.1 1997/02/28 04:42:14 gdr Exp $
*/
#ifndef _SYS_IOCTL_COMPAT_H_
#define _SYS_IOCTL_COMPAT_H_
#ifndef _SYS_TTYCHARS_H_
#include <sys/ttychars.h>
#endif
#ifndef _SYS_TTYDEV_H_
#include <sys/ttydev.h>
#endif
struct tchars {
char t_intrc; /* interrupt */
char t_quitc; /* quit */
char t_startc; /* start output */
char t_stopc; /* stop output */
char t_eofc; /* end-of-file */
char t_brkc; /* input delimiter (like nl) */
};
struct ltchars {
char t_suspc; /* stop process signal */
char t_dsuspc; /* delayed stop process signal */
char t_rprntc; /* reprint line */
char t_flushc; /* flush output (toggles) */
char t_werasc; /* word erase */
char t_lnextc; /* literal next character */
};
/*
* Structure for TIOCGETP and TIOCSETP ioctls.
*/
#ifndef _SGTTYB_
#define _SGTTYB_
struct sgttyb {
char sg_ispeed; /* input speed */
char sg_ospeed; /* output speed */
char sg_erase; /* erase character */
char sg_kill; /* kill character */
short sg_flags; /* mode flags */
};
#endif
#ifdef USE_OLD_TTY
# undef TIOCGETD
# define TIOCGETD _IOR('t', 0, int) /* get line discipline */
# undef TIOCSETD
# define TIOCSETD _IOW('t', 1, int) /* set line discipline */
#else
# define OTIOCGETD _IOR('t', 0, int) /* get line discipline */
# define OTIOCSETD _IOW('t', 1, int) /* set line discipline */
#endif
#define TIOCHPCL _IO('t', 2) /* hang up on last close */
#define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
#define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */
#define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/
#define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */
#define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */
#define TANDEM 0x00000001L /* send stopc on out q full */
#define CBREAK 0x00000002L /* half-cooked mode */
#define LCASE 0x00000004L /* simulate lower case */
#ifdef ECHO /* from <sys/termios.h> */
#undef ECHO
#endif
#define ECHO 0x00000008L /* echo input */
#define CRMOD 0x00000010L /* map \r to \r\n on output */
#define RAW 0x00000020L /* no i/o processing */
#define ODDP 0x00000040L /* get/send odd parity */
#define EVENP 0x00000080L /* get/send even parity */
#define ANYP 0x000000c0L /* get any parity/send none */
#define NLDELAY 0x00000300L