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_var.h,v 1.2 1999/08/28 00:48:52 peter Exp $
27 * @(#) $DragonFly: src/sys/netproto/atm/spans/spans_var.h,v 1.3 2003/08/23 10:06:22 rob Exp $
32 * SPANS Signalling Manager
33 * ---------------------------
35 * Protocol control blocks
39 #ifndef _SPANS_SPANS_VAR_H
40 #define _SPANS_SPANS_VAR_H
44 * Constants to indicate the state of the signalling interface
46 #define SPANS_UNI_UP 1
47 #define SPANS_UNI_DOWN -1
51 * Structure containing state information for each SPANS protocol
52 * instance. There will be one instance for each ATM device interface
53 * using the SPANS signalling manager.
56 struct siginst sp_inst; /* Header */
57 struct atm_time sp_time; /* Timer controls */
58 void (*sp_lower) /* Lower command handler */
59 (int, void *, int, int);
60 Atm_connection *sp_conn; /* Signalling connection */
61 long sp_s_epoch; /* Switch epoch */
62 long sp_h_epoch; /* Host epoch */
63 u_int sp_probe_ct; /* Status_req msgs unanswered */
64 u_int sp_alloc_vci; /* Next VCI to allocate */
65 u_int sp_alloc_vpi; /* Next VPI to allocate */
66 u_int sp_min_vci; /* Lowest VCI to allocate */
67 u_int sp_max_vci; /* Highest VCI to allocate */
68 struct spanscls *sp_cls; /* CLS instance */
71 #define sp_next sp_inst.si_next
72 #define sp_pif sp_inst.si_pif
73 #define sp_addr sp_inst.si_addr
74 #define sp_subaddr sp_inst.si_subaddr
75 #define sp_vccq sp_inst.si_vccq
76 #define sp_state sp_inst.si_state
77 #define sp_ipserv sp_inst.si_ipserv
78 #endif /* ATM_KERNEL */
81 * SPANS Protocol States
83 #define SPANS_ACTIVE 1 /* Active */
84 #define SPANS_DETACH 2 /* Detach in progress */
85 #define SPANS_INIT 3 /* Initializing */
86 #define SPANS_PROBE 4 /* Exchanging status info */
88 #define SPANS_PROBE_INTERVAL (ATM_HZ) /* Interval between SPANS_STAT_REQs */
89 #define SPANS_PROBE_THRESH 10 /* Probe time-out threshold */
90 #define SPANS_PROBE_ERR_WAIT (3 * ATM_HZ) /* Time to wait if send probe fails */
95 * SPANS Virtual Channel Connection control block. All information
96 * regarding the state of a SPANS-controlled VCC will be recorded here.
97 * There will be one SPANS VCC control block for each SPANS-controlled
101 struct vccb vcp_hdr; /* Generic VCCB */
102 u_short sv_retry; /* Xmit retry count */
103 spans_atm_conn sv_conn; /* SPANS connection info */
104 spans_resrc sv_spans_qos; /* QoS for VCC */
105 spans_aal sv_spans_aal; /* AAL for VCC */
108 #define sv_type vcp_hdr.vc_type
109 #define sv_proto vcp_hdr.vc_proto
110 #define sv_sstate vcp_hdr.vc_sstate
111 #define sv_ustate vcp_hdr.vc_ustate
112 #define sv_pif vcp_hdr.vc_pif
113 #define sv_nif vcp_hdr.vc_nif
114 #define sv_sigelem vcp_hdr.vc_sigelem
115 #define sv_time vcp_hdr.vc_time
116 #define sv_vpi vcp_hdr.vc_vpi
117 #define sv_vci vcp_hdr.vc_vci
118 #define sv_connvc vcp_hdr.vc_connvc
119 #define sv_ipdus vcp_hdr.vc_ipdus
120 #define sv_opdus vcp_hdr.vc_opdus
121 #define sv_ibytes vcp_hdr.vc_ibytes
122 #define sv_obytes vcp_hdr.vc_obytes
123 #define sv_ierrors vcp_hdr.vc_ierrors
124 #define sv_oerrors vcp_hdr.vc_oerrors
125 #define sv_tstamp vcp_hdr.vc_tstamp
126 #define sv_daddr sv_conn.daddr
127 #define sv_saddr sv_conn.saddr
128 #define sv_dsap sv_conn.dsap
129 #define sv_ssap sv_conn.ssap
131 #define SV_MAX_RETRY 3
132 #define SV_TIMEOUT (ATM_HZ)
134 #endif /* ATM_KERNEL */
138 * SPANS VCC Signalling Protocol States
140 #define SPANS_VC_NULL 0 /* No state */
141 #define SPANS_VC_ACTIVE 1 /* Active */
142 #define SPANS_VC_ACT_DOWN 2 /* Active - Interface down */
143 #define SPANS_VC_POPEN 3 /* VCC open in progress */
144 #define SPANS_VC_R_POPEN 4 /* VCC rmt open in progress */
145 #define SPANS_VC_OPEN 5 /* VCC open */
146 #define SPANS_VC_CLOSE 6 /* VCC close in progress */
147 #define SPANS_VC_ABORT 7 /* VCC abort in progress */
148 #define SPANS_VC_FREE 8 /* Waiting for user to free resources */
153 * Macro to compare two SPANS addresses.
155 * Returns 0 if the addresses are equal.
157 #define spans_addr_cmp(a, b) \
158 (bcmp((caddr_t)a, (caddr_t)b, sizeof(struct spans_addr)))
161 * Macro to copy a SPANS address from a to b.
163 #define spans_addr_copy(a, b) \
164 (KM_COPY((caddr_t)a, (caddr_t)b, sizeof(struct spans_addr)))
170 #define SPANS_TIMER(s, t) atm_timeout(&(s)->sp_time, (t), spans_timer)
171 #define SPANS_CANCEL(s) atm_untimeout(&(s)->sp_time)
172 #define SPANS_VC_TIMER(v, t) atm_timeout(&(v)->vc_time, (t), spans_vctimer)
173 #define SPANS_VC_CANCEL(v) atm_untimeout(&(v)->vc_time)
177 * Global function declarations
182 int spansarp_svcout (struct ipvcc *, struct in_addr *);
183 int spansarp_svcin (struct ipvcc *, Atm_addr *, Atm_addr *);
184 int spansarp_svcactive (struct ipvcc *);
185 void spansarp_vcclose (struct ipvcc *);
186 void spansarp_ipact (struct spanscls *);
187 void spansarp_ipdact (struct spanscls *);
188 void spansarp_stop (void);
189 void spansarp_input (struct spanscls *, KBuffer *);
190 int spansarp_ioctl (int, caddr_t, caddr_t);
193 int spanscls_start (void);
194 void spanscls_stop (void);
195 int spanscls_attach (struct spans *);
196 void spanscls_detach (struct spans *);
197 void spanscls_closevc (struct spanscls *,
198 struct t_atm_cause *);
201 int spans_abort (struct vccb *);
202 int spans_free (struct vccb *);
205 int spans_send_msg (struct spans *, spans_msg *);
206 int spans_send_open_req (struct spans *,
207 struct spans_vccb *);
208 int spans_send_open_rsp (struct spans *,
211 int spans_send_close_req (struct spans *,
212 struct spans_vccb *);
213 void spans_rcv_msg (struct spans *, KBuffer *);
216 void spans_print_msg (spans_msg *);
219 void spans_timer (struct atm_time *);
220 void spans_vctimer (struct atm_time *);
221 void spans_upper (int, void *, int, int);
222 void spans_notify (void *, int, int);
225 int spans_open_vcc (struct spans *, Atm_connvc *);
226 int spans_close_vcc (struct spans *,
227 struct spans_vccb *, int);
228 int spans_clear_vcc (struct spans *,
229 struct spans_vccb *);
230 void spans_switch_reset (struct spans *, int);
233 int spans_get_spans_sap (Sap_t, spans_sap *);
234 int spans_get_local_sap (spans_sap, Sap_t *);
235 int spans_ephemeral_sap (struct spans *);
236 int spans_get_spans_aal (Aal_t, spans_aal *);
237 int spans_get_local_aal (spans_aal, Aal_t *);
238 int spans_verify_vccb (struct spans *,
239 struct spans_vccb *);
241 spans_find_vpvc (struct spans *, int, int, u_char);
243 spans_find_conn (struct spans *,
244 struct spans_atm_conn *);
245 spans_vpvc spans_alloc_vpvc (struct spans *);
246 char * spans_addr_print (struct spans_addr *);
247 void spans_dump_buffer (KBuffer *);
253 extern struct spans_addr spans_bcastaddr;
254 extern struct sp_info spans_vcpool;
255 extern struct sp_info spans_msgpool;
256 extern struct t_atm_cause spans_cause;
258 #endif /* ATM_KERNEL */
260 #endif /* _SPANS_SPANS_VAR_H */