]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/netatm/uni/unisig_var.h
This commit was generated by cvs2svn to compensate for changes in r158795,
[FreeBSD/FreeBSD.git] / sys / netatm / uni / unisig_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  * ATM Forum UNI 3.0/3.1 Signalling Manager
32  * ----------------------------------------
33  *
34  * Protocol control blocks
35  *
36  */
37
38 #ifndef _UNISIG_VAR_H
39 #define _UNISIG_VAR_H
40
41 #ifndef TRUE
42 #define TRUE    1
43 #define FALSE   0
44 #endif
45
46 #ifdef _KERNEL
47
48 #include <vm/uma.h>
49
50 /*
51  * Structure containing state information for each UNI protocol
52  * instance.  There will be one instance for each ATM device interface
53  * using the UNI signalling manager.
54  */
55 struct  unisig {
56         struct siginst  us_inst;        /* Header */
57         struct atm_time us_time;        /* Timer controls */
58         void            (*us_lower)     /* Lower command handler */
59                                 (int, void *, intptr_t, intptr_t);
60         Atm_connection  *us_conn;       /* Signalling connection */
61         int             us_cref;        /* Call reference allocation */
62         u_int           us_retry;       /* Protocol retry count */
63         u_short         us_headout;     /* Headroom on sig ch output */
64         u_char          us_proto;       /* Signalling version */
65 };
66
67 #define us_next         us_inst.si_next
68 #define us_pif          us_inst.si_pif
69 #define us_addr         us_inst.si_addr
70 #define us_subaddr      us_inst.si_subaddr
71 #define us_vccq         us_inst.si_vccq
72 #define us_state        us_inst.si_state
73 #define us_ipserv       us_inst.si_ipserv
74 #endif  /* _KERNEL */
75
76 /*
77  * Signalling manager states
78  */
79 #define UNISIG_NULL             0
80 #define UNISIG_ADDR_WAIT        1
81 #define UNISIG_INIT             2
82 #define UNISIG_ACTIVE           3
83 #define UNISIG_DETACH           4
84
85 /*
86  * Signalling manager events
87  */
88 #define UNISIG_SIGMGR_TIMEOUT           0
89 #define UNISIG_SIGMGR_SSCF_EST_IND      1
90 #define UNISIG_SIGMGR_SSCF_EST_CNF      2
91 #define UNISIG_SIGMGR_SSCF_RLS_IND      3
92 #define UNISIG_SIGMGR_SSCF_RLS_CNF      4
93 #define UNISIG_SIGMGR_SSCF_DATA_IND     5
94 #define UNISIG_SIGMGR_SSCF_UDATA_IND    6
95 #define UNISIG_SIGMGR_CALL_CLEARED      7
96 #define UNISIG_SIGMGR_DETACH            8
97 #define UNISIG_SIGMGR_ADDR_SET          9
98
99 /*
100  * Signalling manager timer values
101  */
102 #define UNISIG_SSCF_TIMEOUT     (3 * ATM_HZ)
103
104
105 #ifdef _KERNEL
106 /*
107  * UNI Virtual Channel Connection control block.  All information
108  * regarding the state of a UNI-controlled VCC will be recorded here.
109  * There will be one UNI VCC control block for each UNI-controlled
110  * VCC.
111  */
112 struct unisig_vccb {
113         struct vccb     vcp_hdr;        /* Generic VCCB */
114         u_short         uv_retry;       /* Xmit retry count */
115         u_int           uv_call_ref;    /* Q.2931 call reference */
116 };
117
118 #define uv_type         vcp_hdr.vc_type
119 #define uv_proto        vcp_hdr.vc_proto
120 #define uv_sstate       vcp_hdr.vc_sstate
121 #define uv_ustate       vcp_hdr.vc_ustate
122 #define uv_pif          vcp_hdr.vc_pif
123 #define uv_nif          vcp_hdr.vc_nif
124 #define uv_sigelem      vcp_hdr.vc_sigelem
125 #define uv_time         vcp_hdr.vc_time
126 #define uv_vpi          vcp_hdr.vc_vpi
127 #define uv_vci          vcp_hdr.vc_vci
128 #define uv_connvc       vcp_hdr.vc_connvc
129 #define uv_ipdus        vcp_hdr.vc_ipdus
130 #define uv_opdus        vcp_hdr.vc_opdus
131 #define uv_ibytes       vcp_hdr.vc_ibytes
132 #define uv_obytes       vcp_hdr.vc_obytes
133 #define uv_ierrors      vcp_hdr.vc_ierrors
134 #define uv_oerrors      vcp_hdr.vc_oerrors
135 #define uv_tstamp       vcp_hdr.vc_tstamp
136 #endif  /* _KERNEL */
137
138 /*
139  * UNI VCC protocol states.  Taken from The ATM Forum UNI 3.0 (section
140  * 5.2.1.1)
141  */
142 #define UNI_NULL                0       /* No call exists */
143 #define UNI_CALL_INITIATED      1       /* Initiating call */
144 #define UNI_CALL_OUT_PROC       3       /* Outgoing call proceeding */
145 #define UNI_CALL_DELIVERED      4       /* Not supported */
146 #define UNI_CALL_PRESENT        6       /* Call coming in */
147 #define UNI_CALL_RECEIVED       7       /* Not supported */
148 #define UNI_CONNECT_REQUEST     8       /* Call coming in */
149 #define UNI_CALL_IN_PROC        9       /* Incoming call proceeding */
150 #define UNI_ACTIVE              10      /* Call is established */
151 #define UNI_RELEASE_REQUEST     11      /* Clearing call */
152 #define UNI_RELEASE_IND         12      /* Network disconnecting */
153
154 /*
155  * Additional states required for internal management of VCCs
156  */
157 #define UNI_SSCF_RECOV          13      /* Signalling chan recovery */
158 #define UNI_FREE                14      /* Waiting for user to free */
159 #define UNI_PVC_ACTIVE          15      /* PVC Active */
160 #define UNI_PVC_ACT_DOWN        16      /* PVC Active - i/f down */
161
162 /*
163  * UNI VCC events
164  */
165 #define UNI_VC_TIMEOUT          0       /* Timer expired */
166 #define UNI_VC_CALLP_MSG        1       /* CALL PROCEEDING message */
167 #define UNI_VC_CONNECT_MSG      2       /* CONNECT message */
168 #define UNI_VC_CNCTACK_MSG      3       /* CONNECT ACK message */
169 #define UNI_VC_SETUP_MSG        4       /* SETUP message */
170 #define UNI_VC_RELEASE_MSG      5       /* RELEASE message */
171 #define UNI_VC_RLSCMP_MSG       6       /* RELEASE COMPLETE message */
172 #define UNI_VC_STATUS_MSG       7       /* STATUS message */
173 #define UNI_VC_STATUSENQ_MSG    8       /* STATUS ENQ message */
174 #define UNI_VC_ADDP_MSG         9       /* ADD PARTY message */
175 #define UNI_VC_ADDPACK_MSG      10      /* ADD PARTY ACK message */
176 #define UNI_VC_ADDPREJ_MSG      11      /* ADD PARTY REJ message */
177 #define UNI_VC_DROP_MSG         12      /* DROP PARTY message */
178 #define UNI_VC_DROPACK_MSG      13      /* DROP PARTY ACK message */
179 #define UNI_VC_SETUP_CALL       14      /* Setup routine called */
180 #define UNI_VC_ACCEPT_CALL      15      /* Accept call routine called */
181 #define UNI_VC_REJECT_CALL      16      /* Reject call routine called */
182 #define UNI_VC_RELEASE_CALL     17      /* Release routine called */
183 #define UNI_VC_ABORT_CALL       18      /* Abort routine called */
184 #define UNI_VC_SAAL_FAIL        19      /* Signalling AAL failed */
185 #define UNI_VC_SAAL_ESTAB       20      /* Signalling AAL back up */
186
187
188 #ifdef _KERNEL
189 /*
190  * UNI Timer Values.  These values (except for T317) are taken from
191  * The ATM Forum UNI 3.0 (section 5.7.2).
192  */
193 #define UNI_T303        (4 * ATM_HZ)
194 #define UNI_T308        (30 * ATM_HZ)
195 #define UNI_T309        (10 * ATM_HZ)
196 #define UNI_T310        (10 * ATM_HZ)
197 #define UNI_T313        (4 * ATM_HZ)
198 #define UNI_T316        (120 * ATM_HZ)
199 #define UNI_T317        (60 * ATM_HZ)
200 #define UNI_T322        (4 * ATM_HZ)
201 #define UNI_T398        (4 * ATM_HZ)
202 #define UNI_T399        (14 * ATM_HZ)
203
204
205 /*
206  * Timer macros
207  */
208 #define UNISIG_TIMER(s, t)      atm_timeout(&(s)->us_time, (t), unisig_timer)
209 #define UNISIG_CANCEL(s)        atm_untimeout(&(s)->us_time)
210 #define UNISIG_VC_TIMER(v, t)   atm_timeout(&(v)->vc_time, (t), unisig_vctimer)
211 #define UNISIG_VC_CANCEL(v)     atm_untimeout(&(v)->vc_time)
212
213
214 /*
215  * Global function declarations
216  */
217 struct usfmt;
218 struct unisig_msg;
219
220         /* unisig_decode.c */
221 int             usf_dec_msg(struct usfmt *, struct unisig_msg *);
222
223         /* unisig_encode.c */
224 int             usf_enc_msg(struct usfmt *, struct unisig_msg *);
225
226         /* unisig_if.c */
227 int             unisig_start(void);
228 int             unisig_stop(void);
229 int             unisig_free(struct vccb *);
230
231         /* unisig_mbuf.c */
232 int             usf_init(struct usfmt *, struct unisig *, KBuffer *, int, int);
233 int             usf_byte(struct usfmt *, u_char *);
234 int             usf_short(struct usfmt *, u_short *);
235 int             usf_int3(struct usfmt *, u_int *);
236 int             usf_int(struct usfmt *, u_int *);
237 int             usf_ext(struct usfmt *, u_int *);
238 int             usf_count(struct usfmt *);
239 int             usf_byte_mark(struct usfmt *, u_char *, u_char **);
240
241         /* unisig_msg.c */
242 struct          ie_generic;
243 void            unisig_cause_from_attr(struct ie_generic *,
244                                 Atm_attributes *);
245 void            unisig_cause_from_msg(struct ie_generic *,
246                                 struct unisig_msg *, int);
247 int             unisig_send_msg(struct unisig *,
248                                 struct unisig_msg *);
249 int             unisig_send_setup(struct unisig *,
250                                 struct unisig_vccb *);
251 int             unisig_send_release(struct unisig *,
252                                 struct unisig_vccb *,
253                                 struct unisig_msg *,
254                                 int);
255 int             unisig_send_release_complete(struct unisig *,
256                                 struct unisig_vccb *,
257                                 struct unisig_msg *,
258                                 int);
259 int             unisig_send_status(struct unisig *,
260                                 struct unisig_vccb *,
261                                 struct unisig_msg *,
262                                 int);
263 int             unisig_rcv_msg(struct unisig *, KBuffer *);
264
265         /* unisig_print.c */
266 void            usp_print_msg(struct unisig_msg *, int);
267
268         /* unisig_proto.c */
269 void            unisig_timer(struct atm_time *);
270 void            unisig_vctimer(struct atm_time *);
271 void            unisig_saal_ctl(int, void *, void *);
272 void            unisig_saal_data(void *, KBuffer *);
273 caddr_t         unisig_getname(void *);
274 void            unisig_connected(void *);
275 void            unisig_cleared(void *, struct t_atm_cause *);
276
277         /* unisig_sigmgr_state.c */
278 int             unisig_sigmgr_state(struct unisig *, int,
279                                 KBuffer *);
280
281         /* unisig_subr.c */
282 void            unisig_cause_attr_from_user(Atm_attributes *, int);
283 void            unisig_cause_attr_from_ie(Atm_attributes *,
284                                 struct ie_generic *);
285 int             unisig_open_vcc(struct unisig *, Atm_connvc *);
286 int             unisig_close_vcc(struct unisig *,
287                                 struct unisig_vccb *);
288 int             unisig_clear_vcc(struct unisig *,
289                                 struct unisig_vccb *, int);
290 void            unisig_switch_reset(struct unisig *, int);
291 void            unisig_save_attrs(struct unisig *, struct unisig_msg *,
292                                 Atm_attributes *);
293 int             unisig_set_attrs(struct unisig *, struct unisig_msg *,
294                                 Atm_attributes *);
295
296         /* unisig_util.c */
297 void            unisig_free_msg(struct unisig_msg *);
298 int             unisig_verify_vccb(struct unisig *,
299                                 struct unisig_vccb *);
300 struct unisig_vccb *
301                 unisig_find_conn(struct unisig *, u_int);
302 struct unisig_vccb *
303                 unisig_find_vpvc(struct unisig *, int, int,
304                                 u_char);
305 int             unisig_alloc_call_ref(struct unisig *);
306 char *          unisig_addr_print(Atm_addr *);
307 void            unisig_print_mbuf(KBuffer *);
308 void            unisig_print_buffer(KBuffer *);
309
310         /* unisig_vc_state.c */
311 int             unisig_vc_state(struct unisig *,
312                                 struct unisig_vccb *,
313                                 int,
314                                 struct unisig_msg *);
315
316
317 /*
318  * External variables
319  */
320 extern uma_zone_t       unisig_vc_zone;
321 extern uma_zone_t       unisig_msg_zone;
322 extern uma_zone_t       unisig_ie_zone;
323
324 #ifdef SYSCTL_DECL
325 SYSCTL_DECL(_net_harp_uni);
326 #endif
327
328 #endif  /* _KERNEL */
329 #endif  /* _UNISIG_VAR_H */