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.
26 * @(#) $FreeBSD: src/sys/netatm/spans/spans_cls.h,v 1.2 1999/08/28 00:48:49 peter Exp $
27 * @(#) $DragonFly: src/sys/netproto/atm/spans/spans_cls.h,v 1.2 2003/06/17 04:28:49 dillon Exp $
32 * SPANS Signalling Manager
33 * ---------------------------
35 * SPANS Connectionless Datagram Service (CLS) control blocks
39 #ifndef _SPANS_SPANSCLS_H
40 #define _SPANS_SPANSCLS_H
45 #define SPANSARP_AGING (60 * ATM_HZ) /* ARP aging timer */
46 #define SPANSARP_RETRY (3 * ATM_HZ) /* ARP retry timer */
47 #define SPANSARP_MAXAGE 20 /* Max ARP entry age (minutes)*/
48 #define SPANSARP_HASHSIZ 19 /* Hash table size */
52 * SPANS CLS protocol structure. There will be one such structure for
53 * each SPANS signalling instance.
56 struct spanscls *cls_next; /* Next attached cls instance */
57 u_char cls_state; /* Protocol state (see below) */
58 struct spans *cls_spans; /* Spans signalling instance */
59 Atm_connection *cls_conn; /* Connection manager token */
60 struct ip_nif *cls_ipnif; /* IP network interface */
64 * SPANS CLS Protocol States
66 #define CLS_CLOSED 1 /* CLS PVC is closed */
67 #define CLS_OPEN 2 /* CLS PVC is open */
71 * Structure for SPANS ARP mappings. Each of these structures will contain
72 * IP address to SPANS hardware address mappings. There will be one such
73 * structure for each IP address currently in use.
76 struct arpmap sa_arpmap; /* Common entry header */
77 struct spanscls *sa_cls; /* Interface where we learned answer */
78 struct spansarp *sa_next; /* Hash chain */
79 struct spansarp *sa_rnext; /* Retry chain */
80 u_char sa_flags; /* Flags (see below) */
81 u_char sa_origin; /* Origin (see below) */
82 u_short sa_reftime; /* Entry reference time (minutes) */
83 struct ipvcc *sa_ivp; /* IP VCCs waiting for answer */
85 #define sa_dstip sa_arpmap.am_dstip
86 #define sa_dstatm sa_arpmap.am_dstatm
87 #define sa_dstatmsub sa_arpmap.am_dstatmsub
92 #define SAF_VALID ARPF_VALID /* Entry is valid */
93 #define SAF_REFRESH ARPF_REFRESH /* Entry has been refreshed */
94 #define SAF_LOCKED 0x04 /* Entry is locked */
99 #define SAO_PERM ARP_ORIG_PERM /* Entry is permanently installed */
100 #define SAO_LOOKUP 20 /* Learned via lookup */
104 * SPANS CLS Packet Header
106 struct spanscls_hdr {
107 /* IEEE 802.6 MAC header */
108 spans_addr ch_dst; /* Destination SPANS address */
109 spans_addr ch_src; /* Source SPANS address */
110 u_char ch_proto; /* */
111 u_char ch_extlen; /* */
112 u_short ch_bridging; /* */
114 /* LLC SNAP header */
115 u_char ch_dsap; /* Destination SAP */
116 u_char ch_ssap; /* Source SAP */
117 u_char ch_ctl; /* Control field */
118 u_char ch_oui[3]; /* Organizationally Unique Identifier */
119 u_short ch_pid; /* Protocol Identifier */
123 * SPANS ARP Packet Format
125 struct spansarp_hdr {
126 u_short ah_hrd; /* Hardware type (see below) */
127 u_short ah_pro; /* Protocol type */
128 u_char ah_hln; /* Length of hardware address */
129 u_char ah_pln; /* Length of protocol address */
130 u_short ah_op; /* Operation code (see below) */
131 spans_addr ah_sha; /* Source hardware address */
132 u_char ah_spa[4]; /* Source protocol address */
133 spans_addr ah_tha; /* Target hardware address */
134 u_char ah_tpa[4]; /* Target protocol address */
140 #define ARP_SPANS 0x4040
145 #define ARP_REQUEST 1 /* SPANSARP request */
146 #define ARP_REPLY 2 /* SPANSARP response */
148 #define ARP_PACKET_LEN \
149 (sizeof(struct spanscls_hdr) + sizeof(struct spansarp_hdr))
153 * Macros for manipulating SPANS ARP tables and entries
155 #define SPANSARP_HASH(ip) ((u_long)(ip) % SPANSARP_HASHSIZ)
157 #define SPANSARP_ADD(sa) \
159 struct spansarp **h; \
160 h = &spansarp_arptab[SPANSARP_HASH((sa)->sa_dstip.s_addr)]; \
161 LINK2TAIL((sa), struct spansarp, *h, sa_next); \
164 #define SPANSARP_DELETE(sa) \
166 struct spansarp **h; \
167 h = &spansarp_arptab[SPANSARP_HASH((sa)->sa_dstip.s_addr)]; \
168 UNLINK((sa), struct spansarp, *h, sa_next); \
171 #define SPANSARP_LOOKUP(ip, sa) \
173 for ((sa) = spansarp_arptab[SPANSARP_HASH(ip)]; \
174 (sa); (sa) = (sa)->sa_next) { \
175 if ((sa)->sa_dstip.s_addr == (ip)) \
184 extern struct spanscls *spanscls_head;
185 extern struct spanscls_hdr spanscls_hdr;
187 #endif /* ATM_KERNEL */
189 #endif /* _SPANS_SPANSCLS_H */