1 /* if_imphost.h 4.4 82/02/21 */ 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 short h_qcnt; /* size of holding q */ 15 u_char h_rfnm; /* # outstanding rfnm's */ 16 u_char h_refcnt; /* reference count */ 17 }; 18 19 /* 20 * Host structures, as seen inside an mbuf. 21 * Hashing on the host address is used to 22 * select an index into the first mbuf. Collisions 23 * are then resolved by searching successive 24 * mbuf's at the same index. Reclamation is done 25 * automatically at the time a structure is free'd. 26 */ 27 #define HPMBUF ((MLEN - sizeof(int)) / sizeof(struct host)) 28 #if vax 29 #define HOSTHASH(a) ((((a).s_addr>>8)+(a).s_net) % HPMBUF) 30 #endif 31 32 /* 33 * In-line expansions for queuing operations on 34 * host message holding queue. Queue is maintained 35 * as circular list with the head pointing to the 36 * last message in the queue. 37 */ 38 #define HOST_ENQUE(hp, m) { \ 39 register struct mbuf *n; \ 40 hp->h_qcnt++; \ 41 if ((n = hp->h_q) == 0) \ 42 hp->h_q = m->m_act = m; \ 43 else { \ 44 m->m_act = n->m_act; \ 45 hp->h_q = n->m_act = m; \ 46 } \ 47 } 48 #define HOST_DEQUE(hp, m) { \ 49 if (m = hp->h_q) { \ 50 if (m->m_act == m) \ 51 hp->h_q = 0; \ 52 else { \ 53 m = m->m_act; \ 54 hp->h_q->m_act = m->m_act; \ 55 } \ 56 hp->h_qcnt--; \ 57 } \ 58 } 59 60 struct hmbuf { 61 int hm_count; /* # of struct's in use */ 62 struct host hm_hosts[HPMBUF]; /* data structures proper */ 63 }; 64 65 #ifdef KERNEL 66 struct host *hostlookup(); 67 struct host *hostenter(); 68 struct mbuf *hostdeque(); 69 #endif 70