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