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