1: /*
   2:  * Copyright (c) 1982, 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	7.1 (Berkeley) 6/4/86
   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: #if vax
  50: #define HOSTHASH(a) ((((a).s_addr>>24)+(a).s_addr) % HPMBUF)
  51: #endif
  52: 
  53: /*
  54:  * In-line expansions for queuing operations on
  55:  * host message holding queue.  Queue is maintained
  56:  * as circular list with the head pointing to the
  57:  * last message in the queue.
  58:  */
  59: #define HOST_ENQUE(hp, m) { \
  60:     register struct mbuf *n; \
  61:     (hp)->h_qcnt++; \
  62:     if ((n = (hp)->h_q) == 0) \
  63:         (hp)->h_q = (m)->m_act = (m); \
  64:     else { \
  65:         (m)->m_act = n->m_act; \
  66:         (hp)->h_q = n->m_act = (m); \
  67:     } \
  68: }
  69: #define HOST_DEQUE(hp, m) { \
  70:     if ((m) = (hp)->h_q) { \
  71:         if ((m)->m_act == (m)) \
  72:             (hp)->h_q = 0; \
  73:         else { \
  74:             (m) = (m)->m_act; \
  75:             (hp)->h_q->m_act = (m)->m_act; \
  76:         } \
  77:         (hp)->h_qcnt--; \
  78:         (m)->m_act = 0; \
  79:     } \
  80: }
  81: 
  82: struct hmbuf {
  83:     int hm_count;       /* # of struct's in use */
  84:     struct  host hm_hosts[HPMBUF];  /* data structures proper */
  85: };
  86: 
  87: #ifdef KERNEL
  88: struct host *hostlookup();
  89: struct host *hostenter();
  90: struct mbuf *hostdeque();
  91: #endif

Defined struct's

hmbuf defined in line 82; used 18 times
host defined in line 17; used 32 times

Defined macros

HF_DEAD defined in line 35; used 2 times
HF_INUSE defined in line 34; used 7 times
HF_UNREACH defined in line 36; used 1 times
HOSTHASH defined in line 50; used 2 times
HOSTTIMER defined in line 38; used 3 times
HOST_DEQUE defined in line 69; used 1 times
HOST_ENQUE defined in line 59; used 1 times
HPMBUF defined in line 48; used 4 times

Usage of this include

Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 868
Valid CSS Valid XHTML 1.0 Strict