/*
 * $Id: types.h,v 1.10 1993/06/04 11:16:15 jraja Exp $
 *
 * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
 *                    Helsinki University of Technology, Finland.
 *                    All rights reserved.
 *
 * HISTORY
 * $Log: types.h,v $
 * Revision 1.10  1993/06/04  11:16:15  jraja
 * Fixes for first public release.
 *
 * Revision 1.9  1993/05/30  08:31:29  too
 * Changed struct selbuf to struct newselbuf and
 * struct selitem to struct newselitem
 *
 * Revision 1.8  1993/05/17  01:02:04  ppessi
 * Changed RCS version
 *
 * Revision 1.7  1993/03/22  04:21:59  ppessi
 * Removed machine/ansi.h --- this is already amiga dependent code..
 *
 * Revision 1.6  93/03/05  12:22:25  12:22:25  jraja (Jarno Tapio Rajahalme)
 * Assed few incomplete structure definitions. 
 * Be sure to include sys/param.h first in all modules.
 * 
 * Revision 1.5  93/03/03  18:31:06  18:31:06  jraja (Jarno Tapio Rajahalme)
 * Removed trailing underscore from SYS_TYPES_H_.
 * 
 * Revision 1.4  93/03/03  15:29:53  15:29:53  jraja (Jarno Tapio Rajahalme)
 * Cleanup. Raised FD_SETSIZE to 64.
 * 
 * Revision 1.3  93/02/23  18:56:02  18:56:02  too (Tomi Ollila)
 * Set FD_SETSIZE to 32 when AMITCP defined
 * 
 * Revision 1.2  93/02/04  18:26:53  18:26:53  jraja (Jarno Tapio Rajahalme)
 * Commented out unnecessary definitions.
 * 
 * Revision 1.1  92/11/20  15:42:50  15:42:50  jraja (Jarno Tapio Rajahalme)
 * Initial revision
 * 
 */

/*-
 * Copyright (c) 1982, 1986, 1991 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	7.17 (Berkeley) 5/6/91
 */

#ifndef SYS_TYPES_H
#define	SYS_TYPES_H

typedef	unsigned char	u_char;
typedef	unsigned short	u_short;
typedef	unsigned int	u_int;
typedef	unsigned long	u_long;
typedef	unsigned short	ushort;		/* Sys V compatibility */

typedef	char *	caddr_t;		/* core address */
typedef	short	pid_t;			/* process id */

#define	NBBY	8		/* number of bits in a byte */

/*
 * Select uses bit masks of file descriptors in longs.  These macros
 * manipulate such bit fields (the filesystem macros use chars).
 * FD_SETSIZE may be defined by the user, but the default here should
 * be enough for most uses.
 */
#ifndef	FD_SETSIZE
#ifndef AMITCP
#define	FD_SETSIZE	256
#else
#define FD_SETSIZE	64
#endif
#endif

typedef long	fd_mask;
#define NFDBITS	(sizeof(fd_mask) * NBBY)	/* bits per mask */

#ifndef howmany
#define	howmany(x, y)	(((x)+((y)-1))/(y))
#endif

typedef	struct fd_set {
	fd_mask	fds_bits[howmany(FD_SETSIZE, NFDBITS)];
} fd_set;

#define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define	FD_ZERO(p)	bzero((char *)(p), sizeof(*(p)))

#if defined(__STDC__) && defined(KERNEL)
/*
 * Forward structure declarations for function prototypes.
 * We include the common structures that cross subsystem boundaries here;
 * others are mostly used in the same place that the structure is defined.
 */
struct mbuf;
struct Library;
struct SocketBase;
struct arpcom;
struct arptab;
struct ifaddr;
struct ifnet;
struct ifqueue;
struct in_addr;
struct in_ifaddr;
struct inpcb;
struct ip;
struct ipasfrag;
struct ipq;
struct mbuf;
struct protosw;
struct radix_node;
struct radix_node_head;
struct rawcb;
struct route;
struct rt_metrics;
struct rtentry;
struct newselbuf;
struct newselitem;
struct sockaddr;
struct sockaddr_in;
struct sockbuf;
struct socket;
struct sockproto;
struct tcpcb;
struct tcpiphdr;
struct timeval;
struct uio;
struct walkarg;

#endif

#endif /* !SYS_TYPES_H */

