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/usr.sbin/atm/atmarpd/atmarp_var.h,v 1.3 1999/08/28 01:15:31 peter Exp $
27 * @(#) $DragonFly: src/usr.sbin/atm/atmarpd/atmarp_var.h,v 1.3 2003/11/03 19:31:35 eirikn Exp $
32 * Server Cache Synchronization Protocol (SCSP) Support
33 * ----------------------------------------------------
35 * SCSP-ATMARP server interface: control blocks
39 #ifndef _ATMARP_ATMARP_VAR_H
40 #define _ATMARP_ATMARP_VAR_H
51 * Operational constants
53 #define ATMARP_DIR "/tmp"
54 #define ATMARP_SOCK_PREFIX "AA_"
55 #define ATMARP_CACHE_INTERVAL 50
56 #define ATMARP_PERM_INTERVAL 600
57 #define ATMARP_KEEPALIVE_INTERVAL 5
61 * Macros for manipulating ATMARP tables and entries
63 #define ATMARP_HASHSIZ 19 /* Hash table size */
65 #define ATMARP_HASH(ip) ((u_long)(ip) % ATMARP_HASHSIZ)
67 #define ATMARP_ADD(ai, aa) \
70 h = &ai->ai_arptbl[ATMARP_HASH((aa)->aa_dstip.s_addr)]; \
71 LINK2TAIL((aa), Atmarp, *h, aa_next); \
74 #define ATMARP_DELETE(ai, aa) \
77 h = &ai->ai_arptbl[ATMARP_HASH((aa)->aa_dstip.s_addr)]; \
78 UNLINK((aa), Atmarp, *h, aa_next); \
81 #define ATMARP_LOOKUP(ai, ip, aa) \
83 for ((aa) = (ai)->ai_arptbl[ATMARP_HASH(ip)]; \
84 (aa); (aa) = (aa)->aa_next) { \
85 if ((aa)->aa_dstip.s_addr == (ip)) \
92 * Macro to compare originator ID structures
94 #define OID_EQUAL(id1, id2) \
95 (((id1)->id_len == (id2)->id_len) && \
96 (bcmp((caddr_t)(id1)->id, \
100 #define KEY_EQUAL(key1, key2) \
101 (((key1)->key_len == (key2)->key_len) && \
102 (bcmp((caddr_t)(key1)->key, \
103 (caddr_t)(key2)->key, \
104 (key1)->key_len) == 0))
108 * Interface entry for ATMARP SCSP interface daemon
111 struct atmarp_intf
*ai_next
; /* Next chained I/F */
112 char ai_intf
[IFNAMSIZ
]; /* Network I/F name */
113 struct in_addr ai_ip_addr
; /* IP address */
114 struct in_addr ai_subnet_mask
; /* Subnet mask */
115 int ai_mtu
; /* IP MTU */
116 Atm_addr ai_atm_addr
; /* ATM address */
117 Atm_addr ai_atm_subaddr
; /* ATM subaddress */
118 int ai_scsp_sock
; /* Socket to SCSP */
119 Harp_timer ai_keepalive_t
; /* Keepalive timer */
120 char *ai_scsp_sockname
; /* Socket name */
121 u_char ai_state
; /* Interface state */
123 struct atmarp
*ai_arptbl
[ATMARP_HASHSIZ
]; /* ARP cache */
125 typedef struct atmarp_intf Atmarp_intf
;
127 #define AI_STATE_NULL 0
128 #define AI_STATE_UP 1
132 * Super-LIS control block for ATMARP server daemon
135 struct atmarp_slis
*as_next
; /* Next super-LIS */
136 char *as_name
; /* Name of super-LIS */
137 int as_cnt
; /* LIS count */
138 Atmarp_intf
*as_intfs
; /* List of intfs */
140 typedef struct atmarp_slis Atmarp_slis
;
144 * ATMARP cache entry format
147 struct atmarp
*aa_next
; /* Hash chain link */
148 struct in_addr aa_dstip
; /* Destination IP addr */
149 Atm_addr aa_dstatm
; /* Destination ATM addr */
150 Atm_addr aa_dstatmsub
; /* Destination ATM subaddr */
151 struct scsp_ckey aa_key
; /* SCSP cache key */
152 struct scsp_id aa_oid
; /* SCSP originator ID */
153 long aa_seq
; /* SCSP sequence no. */
154 Atmarp_intf
*aa_intf
; /* Interface for entry */
155 u_char aa_flags
; /* Flags (see below) */
156 u_char aa_origin
; /* Entry origin */
157 char aa_mark
; /* Mark */
159 typedef struct atmarp Atmarp
;
164 #define AAF_PERM 0x01 /* Entry is permanent */
165 #define AAF_SERVER 0x02 /* Entry is for the server */
172 extern int atmarp_debug_mode
;
173 extern int atmarp_max_socket
;
174 extern Atmarp_intf
*atmarp_intf_head
;
175 extern Atmarp_slis
*atmarp_slis_head
;
176 extern FILE *atmarp_log_file
;
180 * Function definitions
183 /* atmarp_config.c */
184 extern int atmarp_cfg_netif(char *);
188 extern void atmarp_log(const int, const char *, ...);
190 extern void atmarp_log(int, char *, va_alist
);
192 extern void atmarp_mem_err(char *);
195 extern int atmarp_scsp_cache(Atmarp_intf
*, Scsp_if_msg
*);
196 extern int atmarp_scsp_update(Atmarp
*, int);
197 extern int atmarp_scsp_update_in(Atmarp_intf
*,
199 extern int atmarp_scsp_read(Atmarp_intf
*);
200 extern int atmarp_scsp_out(Atmarp_intf
*, char *, int);
201 extern int atmarp_scsp_connect(Atmarp_intf
*);
202 extern void atmarp_scsp_close(Atmarp_intf
*);
203 extern int atmarp_scsp_disconnect(Atmarp_intf
*);
206 extern Atmarp_intf
*atmarp_find_intf_sock(int);
207 extern Atmarp_intf
*atmarp_find_intf_name(char *);
208 extern void atmarp_clear_marks();
209 extern int atmarp_is_server(Atmarp_intf
*);
210 extern int atmarp_if_ready(Atmarp_intf
*);
211 extern Atmarp
* atmarp_copy_cache_entry(struct air_arp_rsp
*);
212 extern int atmarp_update_kernel(Atmarp
*);
213 extern void atmarp_get_updated_cache();
214 extern void atmarp_process_cache_entry(struct air_arp_rsp
*);
215 extern void print_atmarp_intf(FILE *, Atmarp_intf
*);
216 extern void print_atmarp_cache(FILE *, Atmarp
*);
217 extern void dump_atmarp_cache(FILE *, Atmarp_intf
*);
218 extern void atmarp_sigint(int);
221 extern void atmarp_cache_timeout(Harp_timer
*);
222 extern void atmarp_perm_timeout(Harp_timer
*);
223 extern void atmarp_keepalive_timeout(Harp_timer
*);
226 #endif /* _ATMARP_ATMARP_VAR_H */