/* * 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_imphost.h 1.2 (2.11BSD) 1997/1/19 */ /* * Host structure used with IMP's. * Used to hold outgoing packets which * would exceed allowed RFNM count. * * These structures are packed into * mbuf's and kept as small as possible. */ struct host { struct mbuf *h_q; /* holding queue */ struct in_addr h_addr; /* host's address */ u_char h_qcnt; /* size of holding q */ u_char h_timer; /* used to stay off deletion */ u_char h_rfnm; /* # outstanding rfnm's */ u_char h_flags; /* see below */ }; /* * A host structure is kept around (even when there are no * references to it) for a spell to avoid constant reallocation * and also to reflect IMP status back to sites which aren't * directly connected to the IMP. When structures are marked * free, a timer is started; when the timer expires the structure * is scavenged. */ #define HF_INUSE 0x1 #define HF_DEAD (1<>8) % HPMBUF) /* * In-line expansions for queuing operations on * host message holding queue. Queue is maintained * as circular list with the head pointing to the * last message in the queue. */ #define HOST_ENQUE(hp, m) { \ register struct mbuf *n; \ (hp)->h_qcnt++; \ if ((n = (hp)->h_q) == 0) \ (hp)->h_q = (m)->m_act = (m); \ else { \ (m)->m_act = n->m_act; \ (hp)->h_q = n->m_act = (m); \ } \ } #define HOST_DEQUE(hp, m) { \ if ((m) = (hp)->h_q) { \ if ((m)->m_act == (m)) \ (hp)->h_q = 0; \ else { \ (m) = (m)->m_act; \ (hp)->h_q->m_act = (m)->m_act; \ } \ (hp)->h_qcnt--; \ (m)->m_act = 0; \ } \ } struct hmbuf { int hm_count; /* # of struct's in use */ struct host hm_hosts[HPMBUF]; /* data structures proper */ }; #if defined(KERNEL) && defined(SUPERVISOR) struct host *hostlookup(); struct host *hostenter(); struct mbuf *hostdeque(); #endif