]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/netatm/spans/spans_var.h
This commit was generated by cvs2svn to compensate for changes in r149245,
[FreeBSD/FreeBSD.git] / sys / netatm / spans / spans_var.h
1 /*-
2  *
3  * ===================================
4  * HARP  |  Host ATM Research Platform
5  * ===================================
6  *
7  *
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.
12  *
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.
20  *
21  * Copyright 1994-1998 Network Computing Services, Inc.
22  *
23  * Copies of this Software may be made, however, the above copyright
24  * notice must be reproduced on all copies.
25  *
26  *      @(#) $FreeBSD$
27  *
28  */
29
30 /*
31  * SPANS Signalling Manager
32  * ---------------------------
33  *
34  * Protocol control blocks
35  *
36  */
37
38 #ifndef _SPANS_SPANS_VAR_H
39 #define _SPANS_SPANS_VAR_H
40
41 #ifdef _KERNEL
42
43 #include <vm/uma.h>     /* XXX arr: will remove rsn */
44
45 /*
46  * Constants to indicate the state of the signalling interface
47  */
48 #define SPANS_UNI_UP    1
49 #define SPANS_UNI_DOWN  -1
50
51
52 /*
53  * Structure containing state information for each SPANS protocol
54  * instance.  There will be one instance for each ATM device interface
55  * using the SPANS signalling manager.
56  */
57 struct  spans {
58         struct siginst  sp_inst;        /* Header */
59         struct atm_time sp_time;        /* Timer controls */
60         void            (*sp_lower)     /* Lower command handler */
61                                 (int, void *, int, int);
62         Atm_connection  *sp_conn;       /* Signalling connection */
63         long            sp_s_epoch;     /* Switch epoch */
64         long            sp_h_epoch;     /* Host epoch */
65         u_int           sp_probe_ct;    /* Status_req msgs unanswered */
66         u_int           sp_alloc_vci;   /* Next VCI to allocate */
67         u_int           sp_alloc_vpi;   /* Next VPI to allocate */
68         u_int           sp_min_vci;     /* Lowest VCI to allocate */
69         u_int           sp_max_vci;     /* Highest VCI to allocate */
70         struct spanscls *sp_cls;        /* CLS instance */
71 };
72
73 #define sp_next         sp_inst.si_next
74 #define sp_pif          sp_inst.si_pif
75 #define sp_addr         sp_inst.si_addr
76 #define sp_subaddr      sp_inst.si_subaddr
77 #define sp_vccq         sp_inst.si_vccq
78 #define sp_state        sp_inst.si_state
79 #define sp_ipserv       sp_inst.si_ipserv
80 #endif  /* _KERNEL */
81
82 /*
83  * SPANS Protocol States
84  */
85 #define SPANS_ACTIVE    1               /* Active */
86 #define SPANS_DETACH    2               /* Detach in progress */
87 #define SPANS_INIT      3               /* Initializing */
88 #define SPANS_PROBE     4               /* Exchanging status info */
89
90 #define SPANS_PROBE_INTERVAL    (ATM_HZ)        /* Interval between SPANS_STAT_REQs */
91 #define SPANS_PROBE_THRESH      10              /* Probe time-out threshold */
92 #define SPANS_PROBE_ERR_WAIT    (3 * ATM_HZ)    /* Time to wait if send probe fails */
93
94
95 #ifdef _KERNEL
96 /*
97  * SPANS Virtual Channel Connection control block.  All information
98  * regarding the state of a SPANS-controlled VCC will be recorded here.
99  * There will be one SPANS VCC control block for each SPANS-controlled
100  * VCC.
101  */
102 struct spans_vccb {
103         struct vccb     vcp_hdr;        /* Generic VCCB */
104         u_short         sv_retry;       /* Xmit retry count */
105         spans_atm_conn  sv_conn;        /* SPANS connection info */
106         spans_resrc sv_spans_qos;       /* QoS for VCC */
107         spans_aal       sv_spans_aal;   /* AAL for VCC */
108 };
109
110 #define sv_type         vcp_hdr.vc_type
111 #define sv_proto        vcp_hdr.vc_proto
112 #define sv_sstate       vcp_hdr.vc_sstate
113 #define sv_ustate       vcp_hdr.vc_ustate
114 #define sv_pif          vcp_hdr.vc_pif
115 #define sv_nif          vcp_hdr.vc_nif
116 #define sv_sigelem      vcp_hdr.vc_sigelem
117 #define sv_time         vcp_hdr.vc_time
118 #define sv_vpi          vcp_hdr.vc_vpi
119 #define sv_vci          vcp_hdr.vc_vci
120 #define sv_connvc       vcp_hdr.vc_connvc
121 #define sv_ipdus        vcp_hdr.vc_ipdus
122 #define sv_opdus        vcp_hdr.vc_opdus
123 #define sv_ibytes       vcp_hdr.vc_ibytes
124 #define sv_obytes       vcp_hdr.vc_obytes
125 #define sv_ierrors      vcp_hdr.vc_ierrors
126 #define sv_oerrors      vcp_hdr.vc_oerrors
127 #define sv_tstamp       vcp_hdr.vc_tstamp
128 #define sv_daddr        sv_conn.daddr
129 #define sv_saddr        sv_conn.saddr
130 #define sv_dsap         sv_conn.dsap
131 #define sv_ssap         sv_conn.ssap
132
133 #define SV_MAX_RETRY    3
134 #define SV_TIMEOUT      (ATM_HZ)
135
136 #endif  /* _KERNEL */
137
138
139 /*
140  * SPANS VCC Signalling Protocol States
141  */
142 #define SPANS_VC_NULL           0       /* No state */
143 #define SPANS_VC_ACTIVE         1       /* Active */
144 #define SPANS_VC_ACT_DOWN       2       /* Active - Interface down */
145 #define SPANS_VC_POPEN          3       /* VCC open in progress */
146 #define SPANS_VC_R_POPEN        4       /* VCC rmt open in progress */
147 #define SPANS_VC_OPEN           5       /* VCC open */
148 #define SPANS_VC_CLOSE          6       /* VCC close in progress */
149 #define SPANS_VC_ABORT          7       /* VCC abort in progress */
150 #define SPANS_VC_FREE           8       /* Waiting for user to free resources */
151
152
153 #ifdef _KERNEL
154 /*
155  * Macro to compare two SPANS addresses.  
156  *
157  * Returns 0 if the addresses are equal.
158  */
159 #define spans_addr_cmp(a, b)    \
160         (bcmp((caddr_t)a, (caddr_t)b, sizeof(struct spans_addr)))
161
162 /*
163  * Macro to copy a SPANS address from a to b.  
164  */
165 #define spans_addr_copy(a, b)   \
166         (bcopy((caddr_t)a, (caddr_t)b, sizeof(struct spans_addr)))
167
168
169 /*
170  * Timer macros
171  */
172 #define SPANS_TIMER(s, t)       atm_timeout(&(s)->sp_time, (t), spans_timer)
173 #define SPANS_CANCEL(s) atm_untimeout(&(s)->sp_time)
174 #define SPANS_VC_TIMER(v, t)    atm_timeout(&(v)->vc_time, (t), spans_vctimer)
175 #define SPANS_VC_CANCEL(v)      atm_untimeout(&(v)->vc_time)
176
177
178 /*
179  * Global function declarations
180  */
181 struct ipvcc;
182
183         /* spans_arp.c */
184 int             spansarp_svcout(struct ipvcc *, struct in_addr *);
185 int             spansarp_svcin(struct ipvcc *, Atm_addr *, Atm_addr *);
186 int             spansarp_svcactive(struct ipvcc *);
187 void            spansarp_vcclose(struct ipvcc *);
188 void            spansarp_ipact(struct spanscls *);
189 void            spansarp_ipdact(struct spanscls *);
190 void            spansarp_start(void);
191 void            spansarp_stop(void);
192 void            spansarp_input(struct spanscls *, KBuffer *);
193 int             spansarp_ioctl(int, caddr_t, caddr_t);
194
195         /* spans_cls.c */
196 int             spanscls_start(void);
197 void            spanscls_stop(void);
198 int             spanscls_attach(struct spans *);
199 void            spanscls_detach(struct spans *);
200 void            spanscls_closevc(struct spanscls *, struct t_atm_cause *);
201
202         /* spans_if.c */
203 int             spans_abort(struct vccb *);
204 int             spans_free(struct vccb *);
205
206         /* spans_msg.c */
207 int             spans_send_msg(struct spans *, spans_msg *);
208 int             spans_send_open_req(struct spans *, struct spans_vccb *);
209 int             spans_send_open_rsp(struct spans *,
210                                 struct spans_vccb *,
211                                 spans_result);
212 int             spans_send_close_req(struct spans *,
213                                 struct spans_vccb *);
214 void            spans_rcv_msg(struct spans *, KBuffer *);
215
216         /* spans_print.c */
217 void            spans_print_msg(spans_msg *);
218
219         /* spans_proto.c */
220 void            spans_timer(struct atm_time *);
221 void            spans_vctimer(struct atm_time *);
222 void            spans_upper(int, void *, int, int);
223 void            spans_notify(void *, int, int);
224
225         /* spans_subr.c */
226 int             spans_open_vcc(struct spans *, Atm_connvc *);
227 int             spans_close_vcc(struct spans *, struct spans_vccb *, int);
228 int             spans_clear_vcc(struct spans *, struct spans_vccb *);
229 void            spans_switch_reset(struct spans *, int);
230
231         /* spans_util.c */
232 int             spans_get_spans_sap(Sap_t, spans_sap *);
233 int             spans_get_local_sap(spans_sap, Sap_t *);
234 int             spans_ephemeral_sap(struct spans *);
235 int             spans_get_spans_aal(Aal_t, spans_aal *);
236 int             spans_get_local_aal(spans_aal, Aal_t *);
237 int             spans_verify_vccb(struct spans *, struct spans_vccb *);
238 struct spans_vccb *
239                 spans_find_vpvc(struct spans *, int, int, u_char);
240 struct spans_vccb *
241                 spans_find_conn(struct spans *, struct spans_atm_conn *);
242 spans_vpvc      spans_alloc_vpvc(struct spans *);
243 char *          spans_addr_print(struct spans_addr *);
244 void            spans_dump_buffer(KBuffer *);
245
246
247 /*
248  * External variables
249  */
250 extern struct spans_addr        spans_bcastaddr;
251 extern uma_zone_t               spans_vc_zone;
252 extern uma_zone_t               spans_msg_zone;
253 extern struct t_atm_cause       spans_cause;
254
255 #ifdef SYSCTL_DECL
256 SYSCTL_DECL(_net_harp_spans);
257 #endif
258
259 #endif  /* _KERNEL */
260
261 #endif  /* _SPANS_SPANS_VAR_H */