3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
31 * SPANS Signalling Manager
32 * ---------------------------
34 * SPANS Connectionless Datagram Service (CLS) control blocks
38 #ifndef _SPANS_SPANSCLS_H
39 #define _SPANS_SPANSCLS_H
44 #define SPANSARP_AGING (60 * ATM_HZ) /* ARP aging timer */
45 #define SPANSARP_RETRY (3 * ATM_HZ) /* ARP retry timer */
46 #define SPANSARP_MAXAGE 20 /* Max ARP entry age (minutes)*/
47 #define SPANSARP_HASHSIZ 19 /* Hash table size */
51 * SPANS CLS protocol structure. There will be one such structure for
52 * each SPANS signalling instance.
55 struct spanscls *cls_next; /* Next attached cls instance */
56 u_char cls_state; /* Protocol state (see below) */
57 struct spans *cls_spans; /* Spans signalling instance */
58 Atm_connection *cls_conn; /* Connection manager token */
59 struct ip_nif *cls_ipnif; /* IP network interface */
63 * SPANS CLS Protocol States
65 #define CLS_CLOSED 1 /* CLS PVC is closed */
66 #define CLS_OPEN 2 /* CLS PVC is open */
70 * Structure for SPANS ARP mappings. Each of these structures will contain
71 * IP address to SPANS hardware address mappings. There will be one such
72 * structure for each IP address currently in use.
75 struct arpmap sa_arpmap; /* Common entry header */
76 struct spanscls *sa_cls; /* Interface where we learned answer */
77 struct spansarp *sa_next; /* Hash chain */
78 struct spansarp *sa_rnext; /* Retry chain */
79 u_char sa_flags; /* Flags (see below) */
80 u_char sa_origin; /* Origin (see below) */
81 u_short sa_reftime; /* Entry reference time (minutes) */
82 struct ipvcc *sa_ivp; /* IP VCCs waiting for answer */
84 #define sa_dstip sa_arpmap.am_dstip
85 #define sa_dstatm sa_arpmap.am_dstatm
86 #define sa_dstatmsub sa_arpmap.am_dstatmsub
91 #define SAF_VALID ARPF_VALID /* Entry is valid */
92 #define SAF_REFRESH ARPF_REFRESH /* Entry has been refreshed */
93 #define SAF_LOCKED 0x04 /* Entry is locked */
98 #define SAO_PERM ARP_ORIG_PERM /* Entry is permanently installed */
99 #define SAO_LOOKUP 20 /* Learned via lookup */
103 * SPANS CLS Packet Header
105 struct spanscls_hdr {
106 /* IEEE 802.6 MAC header */
107 spans_addr ch_dst; /* Destination SPANS address */
108 spans_addr ch_src; /* Source SPANS address */
109 u_char ch_proto; /* */
110 u_char ch_extlen; /* */
111 u_short ch_bridging; /* */
113 /* LLC SNAP header */
114 u_char ch_dsap; /* Destination SAP */
115 u_char ch_ssap; /* Source SAP */
116 u_char ch_ctl; /* Control field */
117 u_char ch_oui[3]; /* Organizationally Unique Identifier */
118 u_short ch_pid; /* Protocol Identifier */
122 * SPANS ARP Packet Format
124 struct spansarp_hdr {
125 u_short ah_hrd; /* Hardware type (see below) */
126 u_short ah_pro; /* Protocol type */
127 u_char ah_hln; /* Length of hardware address */
128 u_char ah_pln; /* Length of protocol address */
129 u_short ah_op; /* Operation code (see below) */
130 spans_addr ah_sha; /* Source hardware address */
131 u_char ah_spa[4]; /* Source protocol address */
132 spans_addr ah_tha; /* Target hardware address */
133 u_char ah_tpa[4]; /* Target protocol address */
139 #define ARP_SPANS 0x4040
144 #define ARP_REQUEST 1 /* SPANSARP request */
145 #define ARP_REPLY 2 /* SPANSARP response */
147 #define ARP_PACKET_LEN \
148 (sizeof(struct spanscls_hdr) + sizeof(struct spansarp_hdr))
152 * Macros for manipulating SPANS ARP tables and entries
154 #define SPANSARP_HASH(ip) ((u_long)(ip) % SPANSARP_HASHSIZ)
156 #define SPANSARP_ADD(sa) \
158 struct spansarp **h; \
159 h = &spansarp_arptab[SPANSARP_HASH((sa)->sa_dstip.s_addr)]; \
160 LINK2TAIL((sa), struct spansarp, *h, sa_next); \
163 #define SPANSARP_DELETE(sa) \
165 struct spansarp **h; \
166 h = &spansarp_arptab[SPANSARP_HASH((sa)->sa_dstip.s_addr)]; \
167 UNLINK((sa), struct spansarp, *h, sa_next); \
170 #define SPANSARP_LOOKUP(ip, sa) \
172 for ((sa) = spansarp_arptab[SPANSARP_HASH(ip)]; \
173 (sa); (sa) = (sa)->sa_next) { \
174 if ((sa)->sa_dstip.s_addr == (ip)) \
183 extern struct spanscls *spanscls_head;
184 extern struct spanscls_hdr spanscls_hdr;
188 #endif /* _SPANS_SPANSCLS_H */