1 /*	if_imphost.h	4.2	82/02/12	*/
2 
3 /*
4  * Host structure used with IMP's.
5  * Used to hold outgoing packets which
6  * would exceed allowed RFNM count.
7  *
8  * These structures are packed into
9  * mbuf's and kept as small as possible.
10  */
11 struct host {
12 	struct	mbuf *h_q;		/* holding queue */
13 	struct	in_addr h_addr;		/* host's address */
14 	u_short	h_status;          	/* host status */
15 	u_char	h_rfnm;			/* # outstanding rfnm's */
16 	u_char	h_refcnt;		/* reference count */
17 };
18 
19 #define	HOSTS_DOWN	0		/* host believed down */
20 #define HOSTS_UP	128 		/* host up */
21 
22 /*
23  * Host structures, as seen inside an mbuf.
24  * Hashing on the host address is used to
25  * select an index into the first mbuf.  Collisions
26  * are then resolved by searching successive
27  * mbuf's at the same index.  Reclamation is done
28  * automatically at the time a structure is free'd.
29  */
30 #define	HPMBUF	((MLEN - sizeof(int)) / sizeof(struct host))
31 #define	HOSTHASH(a)	((a.s_addr) % HPMBUF)
32 
33 struct hmbuf {
34 	int	hm_count;		/* # of struct's in use */
35 	struct	host hm_hosts[HPMBUF];	/* data structures proper */
36 };
37 
38 #ifdef KERNEL
39 struct host *hostlookup();
40 struct host *hostenter();
41 #endif
42