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/uni/uniip_var.h,v 1.2 1999/08/28 00:49:04 peter Exp $
27 * @(#) $DragonFly: src/sys/netproto/atm/uni/uniip_var.h,v 1.3 2003/08/23 10:06:22 rob Exp $
32 * ATM Forum UNI Support
33 * ---------------------
35 * IP interface control blocks
39 #ifndef _UNI_UNIIP_VAR_H
40 #define _UNI_UNIIP_VAR_H
44 * UNI IP network interface structure. There will be one such structure for
45 * each IP network interface attached via a UNI signalling instance.
48 struct uniip
*uip_next
; /* Next attached IP interface */
49 struct ip_nif
*uip_ipnif
; /* IP network interface */
50 u_char uip_flags
; /* Interface flags (see below) */
52 /* ATMARP (RFC1577) */
53 u_char uip_arpstate
; /* ARP interface state (see below) */
54 struct arpmap uip_arpsvrmap
; /* ATMARP server map info */
55 struct ipvcc
*uip_arpsvrvcc
; /* ATMARP server's VCC */
56 int uip_nprefix
; /* Count of IP prefixes (server only) */
57 struct uniarp_prf
*uip_prefix
; /* Array of IP prefixes (server only) */
58 struct atm_time uip_arptime
; /* ARP timer controls */
60 #define uip_arpsvrip uip_arpsvrmap.am_dstip
61 #define uip_arpsvratm uip_arpsvrmap.am_dstatm
62 #define uip_arpsvrsub uip_arpsvrmap.am_dstatmsub
63 #endif /* ATM_KERNEL */
68 #define UIF_IFADDR 0x01 /* Interface address is set */
71 * UNI ARP Interface States
73 #define UIAS_NOTCONF 1 /* Not configured */
74 #define UIAS_SERVER_ACTIVE 2 /* Server - active */
75 #define UIAS_CLIENT_PADDR 3 /* Client - pending ATM address */
76 #define UIAS_CLIENT_POPEN 4 /* Client - pending server vcc open */
77 #define UIAS_CLIENT_REGISTER 5 /* Client - registering with server */
78 #define UIAS_CLIENT_ACTIVE 6 /* Client - active */
83 * Structure for allowable IP prefixes for ATMARP server registration
86 struct in_addr upf_addr
; /* Prefix address */
87 struct in_addr upf_mask
; /* Prefix mask */
92 * UNI ARP protocol constants
94 #define UNIARP_AGING (60 * ATM_HZ) /* Aging timer tick */
95 #define UNIARP_HASHSIZ 19 /* Hash table size */
96 #define UNIARP_REGIS_REFRESH (15 * 60 * ATM_HZ)
97 /* Client registration refresh timer */
98 #define UNIARP_REGIS_RETRY (60 * ATM_HZ)
99 /* Client registration retry timer */
100 #define UNIARP_ARP_RETRY (3 * ATM_HZ) /* ARP command retry timer */
101 #define UNIARP_CLIENT_AGE 12 /* Client validation timeout */
102 #define UNIARP_CLIENT_RETRY 3 /* Client validation retrys */
103 #define UNIARP_SERVER_AGE 17 /* Server validation timeout */
104 #define UNIARP_SERVER_RETRY 3 /* Server validation retrys */
105 #define UNIARP_RETRY_AGE 1 /* Retry timeout */
106 #define UNIARP_REVALID_AGE 2 /* Revalidation timeout */
107 #define UNIARP_MIN_REFRESH 10 /* Minimum entry refresh time */
111 * Structure for ATMARP mappings. Each of these structures will contain
112 * IP address to ATM hardware address mappings. There will be one such
113 * structure for each IP address and for each unresolved ATM address
117 struct arpmap ua_arpmap
; /* Common entry header */
118 struct uniip
*ua_intf
; /* Interface where we learned answer */
119 struct uniarp
*ua_next
; /* Hash chain link */
120 u_char ua_flags
; /* Flags (see below) */
121 u_char ua_origin
; /* Source of mapping (see below) */
122 u_char ua_retry
; /* Retry counter */
123 u_char ua_aging
; /* Aging timeout value (minutes) */
124 struct ipvcc
*ua_ivp
; /* Head of IP VCC chain */
125 struct atm_time ua_time
; /* Timer controls */
127 #define ua_dstip ua_arpmap.am_dstip
128 #define ua_dstatm ua_arpmap.am_dstatm
129 #define ua_dstatmsub ua_arpmap.am_dstatmsub
130 #endif /* ATM_KERNEL */
135 #define UAF_VALID ARPF_VALID /* Entry is valid */
136 #define UAF_REFRESH ARPF_REFRESH /* Entry has been refreshed */
137 #define UAF_LOCKED 0x04 /* Entry is locked */
138 #define UAF_USED 0x08 /* Entry has been used recently */
141 * UNIARP Entry Origin
143 * The origin values are ranked according to the source precedence.
144 * Larger values are more preferred.
146 #define UAO_LOCAL 100 /* Local address */
147 #define UAO_PERM ARP_ORIG_PERM /* Permanently installed */
148 #define UAO_REGISTER 40 /* Learned via client registration */
149 #define UAO_SCSP 30 /* Learned via SCSP */
150 #define UAO_LOOKUP 20 /* Learned via server lookup */
151 #define UAO_PEER_RSP 15 /* Learned from peer - inarp rsp */
152 #define UAO_PEER_REQ 10 /* Learned from peer - inarp req */
155 * ATMARP/InATMARP Packet Format
158 u_short ah_hrd
; /* Hardware type (see below) */
159 u_short ah_pro
; /* Protocol type */
160 u_char ah_shtl
; /* Type/len of source ATM address */
161 u_char ah_sstl
; /* Type/len of source ATM subaddress */
162 u_short ah_op
; /* Operation code (see below) */
163 u_char ah_spln
; /* Length of source protocol address */
164 u_char ah_thtl
; /* Type/len of target ATM address */
165 u_char ah_tstl
; /* Type/len of target ATM subaddress */
166 u_char ah_tpln
; /* Length of target protocol address */
168 /* Variable size fields */
169 u_char ah_sha
[]; /* Source ATM address */
170 u_char ah_ssa
[]; /* Source ATM subaddress */
171 u_char ah_spa
[]; /* Source protocol address */
172 u_char ah_tha
[]; /* Target ATM subaddress */
173 u_char ah_tsa
[]; /* Target ATM address */
174 u_char ah_tpa
[]; /* Target protocol subaddress */
181 #define ARP_ATMFORUM 19
186 #define ARP_REQUEST 1 /* ATMARP request */
187 #define ARP_REPLY 2 /* ATMARP response */
188 #define INARP_REQUEST 8 /* InATMARP request */
189 #define INARP_REPLY 9 /* InATMARP response */
190 #define ARP_NAK 10 /* ATMARP negative ack */
195 #define ARP_TL_TMASK 0x40 /* Type mask */
196 #define ARP_TL_NSAPA 0x00 /* Type = ATM Forum NSAPA */
197 #define ARP_TL_E164 0x40 /* Type = E.164 */
198 #define ARP_TL_LMASK 0x3f /* Length mask */
205 #define UNIIP_ARP_TIMER(s, t) atm_timeout(&(s)->uip_arptime, (t), uniarp_iftimeout)
206 #define UNIIP_ARP_CANCEL(s) atm_untimeout(&(s)->uip_arptime)
207 #define UNIARP_TIMER(s, t) atm_timeout(&(s)->ua_time, (t), uniarp_timeout)
208 #define UNIARP_CANCEL(s) atm_untimeout(&(s)->ua_time)
212 * Macros for manipulating UNIARP tables and entries
214 #define UNIARP_HASH(ip) ((u_long)(ip) % UNIARP_HASHSIZ)
216 #define UNIARP_ADD(ua) \
219 h = &uniarp_arptab[UNIARP_HASH((ua)->ua_dstip.s_addr)]; \
220 LINK2TAIL((ua), struct uniarp, *h, ua_next); \
223 #define UNIARP_DELETE(ua) \
226 h = &uniarp_arptab[UNIARP_HASH((ua)->ua_dstip.s_addr)]; \
227 UNLINK((ua), struct uniarp, *h, ua_next); \
230 #define UNIARP_LOOKUP(ip, ua) \
232 for ((ua) = uniarp_arptab[UNIARP_HASH(ip)]; \
233 (ua); (ua) = (ua)->ua_next) { \
234 if ((ua)->ua_dstip.s_addr == (ip)) \
241 * Global UNIARP Statistics
244 u_long uas_rcvdrop
; /* Input packets dropped */
251 extern struct uniip
*uniip_head
;
252 extern struct ip_serv uniip_ipserv
;
253 extern struct uniarp
*uniarp_arptab
[];
254 extern struct uniarp
*uniarp_nomaptab
;
255 extern struct uniarp
*uniarp_pvctab
;
256 extern struct sp_info uniarp_pool
;
257 extern struct atm_time uniarp_timer
;
258 extern int uniarp_print
;
259 extern Atm_endpoint uniarp_endpt
;
260 extern struct uniarp_stat uniarp_stat
;
264 * Global function declarations
267 int uniarp_start (void);
268 void uniarp_stop (void);
269 void uniarp_ipact (struct uniip
*);
270 void uniarp_ipdact (struct uniip
*);
271 void uniarp_ifaddr (struct siginst
*);
272 void uniarp_iftimeout (struct atm_time
*);
273 int uniarp_ioctl (int, caddr_t
, caddr_t
);
274 caddr_t
uniarp_getname (void *);
277 int uniarp_cache_svc (struct uniip
*, struct in_addr
*,
278 Atm_addr
*, Atm_addr
*, u_int
);
279 void uniarp_cache_pvc (struct ipvcc
*, struct in_addr
*,
280 Atm_addr
*, Atm_addr
*);
281 int uniarp_validate_ip (struct uniip
*, struct in_addr
*,
285 void uniarp_cpcs_data (void *, KBuffer
*);
286 void uniarp_pdu_print (struct ipvcc
*, KBuffer
*, char *);
288 /* uniarp_output.c */
289 int uniarp_arp_req (struct uniip
*, struct in_addr
*);
290 int uniarp_arp_rsp (struct uniip
*, struct arpmap
*,
291 struct in_addr
*, Atm_addr
*,
292 Atm_addr
*, struct ipvcc
*);
293 int uniarp_arp_nak (struct uniip
*, KBuffer
*, struct ipvcc
*);
294 int uniarp_inarp_req (struct uniip
*, Atm_addr
*,
295 Atm_addr
*, struct ipvcc
*);
296 int uniarp_inarp_rsp (struct uniip
*, struct in_addr
*,
297 Atm_addr
*, Atm_addr
*, struct ipvcc
*);
300 void uniarp_timeout (struct atm_time
*);
301 void uniarp_aging (struct atm_time
*);
304 int uniarp_pvcopen (struct ipvcc
*);
305 int uniarp_svcout (struct ipvcc
*, struct in_addr
*);
306 int uniarp_svcin (struct ipvcc
*, Atm_addr
*, Atm_addr
*);
307 int uniarp_svcactive (struct ipvcc
*);
308 void uniarp_vcclose (struct ipvcc
*);
309 void uniarp_connected (void *);
310 void uniarp_cleared (void *, struct t_atm_cause
*);
313 int uniip_start (void);
314 int uniip_stop (void);
317 #endif /* ATM_KERNEL */
319 #endif /* _UNI_UNIIP_VAR_H */