1: /*
2: * Copyright (c) 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)if_imphost.h 1.2 (2.11BSD) 1997/1/19
7: */
8:
9: /*
10: * Host structure used with IMP's.
11: * Used to hold outgoing packets which
12: * would exceed allowed RFNM count.
13: *
14: * These structures are packed into
15: * mbuf's and kept as small as possible.
16: */
17: struct host {
18: struct mbuf *h_q; /* holding queue */
19: struct in_addr h_addr; /* host's address */
20: u_char h_qcnt; /* size of holding q */
21: u_char h_timer; /* used to stay off deletion */
22: u_char h_rfnm; /* # outstanding rfnm's */
23: u_char h_flags; /* see below */
24: };
25:
26: /*
27: * A host structure is kept around (even when there are no
28: * references to it) for a spell to avoid constant reallocation
29: * and also to reflect IMP status back to sites which aren't
30: * directly connected to the IMP. When structures are marked
31: * free, a timer is started; when the timer expires the structure
32: * is scavenged.
33: */
34: #define HF_INUSE 0x1
35: #define HF_DEAD (1<<IMPTYPE_HOSTDEAD)
36: #define HF_UNREACH (1<<IMPTYPE_HOSTUNREACH)
37:
38: #define HOSTTIMER 128 /* keep structure around awhile */
39:
40: /*
41: * Host structures, as seen inside an mbuf.
42: * Hashing on the host address is used to
43: * select an index into the first mbuf. Collisions
44: * are then resolved by searching successive
45: * mbuf's at the same index. Reclamation is done
46: * automatically at the time a structure is free'd.
47: */
48: #define HPMBUF ((MLEN - sizeof(int)) / sizeof(struct host))
49: #define HOSTHASH(a) (((a).s_addr>>8) % HPMBUF)
50:
51: /*
52: * In-line expansions for queuing operations on
53: * host message holding queue. Queue is maintained
54: * as circular list with the head pointing to the
55: * last message in the queue.
56: */
57: #define HOST_ENQUE(hp, m) { \
58: register struct mbuf *n; \
59: (hp)->h_qcnt++; \
60: if ((n = (hp)->h_q) == 0) \
61: (hp)->h_q = (m)->m_act = (m); \
62: else { \
63: (m)->m_act = n->m_act; \
64: (hp)->h_q = n->m_act = (m); \
65: } \
66: }
67: #define HOST_DEQUE(hp, m) { \
68: if ((m) = (hp)->h_q) { \
69: if ((m)->m_act == (m)) \
70: (hp)->h_q = 0; \
71: else { \
72: (m) = (m)->m_act; \
73: (hp)->h_q->m_act = (m)->m_act; \
74: } \
75: (hp)->h_qcnt--; \
76: (m)->m_act = 0; \
77: } \
78: }
79:
80: struct hmbuf {
81: int hm_count; /* # of struct's in use */
82: struct host hm_hosts[HPMBUF]; /* data structures proper */
83: };
84:
85: #if defined(KERNEL) && defined(SUPERVISOR)
86: struct host *hostlookup();
87: struct host *hostenter();
88: struct mbuf *hostdeque();
89: #endif
Defined struct's
hmbuf
defined in line
80; used 18 times
host
defined in line
17; used 32 times
Defined macros
Usage of this include