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/uni/unisig_proto.c,v 1.5 2000/01/17 20:49:57 mks Exp $
31 * ATM Forum UNI 3.0/3.1 Signalling Manager
32 * ----------------------------------------
34 * Protocol processing module.
38 #include <netatm/kern_include.h>
40 #include <netatm/uni/unisig_var.h>
43 __RCSID("@(#) $FreeBSD: src/sys/netatm/uni/unisig_proto.c,v 1.5 2000/01/17 20:49:57 mks Exp $");
48 * Process a UNISIG timeout
50 * Called when a previously scheduled protocol instance control block
51 * timer expires. This routine passes a timeout event to the UNISIG
52 * signalling manager state machine.
57 * tip pointer to UNISIG timer control block
70 * Back-off to UNISIG control block
72 usp = (struct unisig *)
73 ((caddr_t)tip - (int)(&((struct unisig *)0)->us_time));
75 ATM_DEBUG2("unisig_timer: usp=%p,state=%d\n",
79 * Pass the timeout to the signalling manager state machine
81 (void) unisig_sigmgr_state(usp,
82 UNISIG_SIGMGR_TIMEOUT,
88 * Process a UNISIG VCC timeout
90 * Called when a previously scheduled UNISIG VCCB timer expires.
91 * Processing will based on the current VCC state.
96 * tip pointer to vccb timer control block
104 struct atm_time *tip;
107 struct unisig_vccb *uvp;
110 * Get VCCB and UNISIG control block addresses
112 uvp = (struct unisig_vccb *) ((caddr_t)tip -
113 (int)(&((struct vccb *)0)->vc_time));
114 usp = (struct unisig *)uvp->uv_pif->pif_siginst;
116 ATM_DEBUG3("unisig_vctimer: uvp=%p, sstate=%d, ustate=%d\n",
117 uvp, uvp->uv_sstate, uvp->uv_ustate);
120 * Hand the timeout to the VC finite state machine
122 if (uvp->uv_ustate == VCCU_ABORT) {
124 * If we're aborting, this is an ABORT call
126 (void) unisig_vc_state(usp, uvp, UNI_VC_ABORT_CALL,
127 (struct unisig_msg *) 0);
130 * If we're not aborting, it's a timeout
132 (void) unisig_vc_state(usp, uvp, UNI_VC_TIMEOUT,
133 (struct unisig_msg *) 0);
139 * UNISIG SAAL Control Handler
141 * This is the module which receives data on the UNISIG signalling
142 * channel. Processing is based on the indication received from the
143 * SSCF and the protocol state.
147 * tok session token (pointer to UNISIG protocol control block)
155 unisig_saal_ctl(cmd, tok, a1)
160 struct unisig *usp = tok;
162 ATM_DEBUG4("unisig_upper: usp=%p,state=%d,cmd=%d,a1=0x%lx,\n",
163 usp, usp->us_state, cmd, (u_long)a1);
170 case SSCF_UNI_ESTABLISH_IND:
171 (void) unisig_sigmgr_state(usp,
172 UNISIG_SIGMGR_SSCF_EST_IND,
176 case SSCF_UNI_ESTABLISH_CNF:
177 (void) unisig_sigmgr_state(usp,
178 UNISIG_SIGMGR_SSCF_EST_CNF,
182 case SSCF_UNI_RELEASE_IND:
183 (void) unisig_sigmgr_state(usp,
184 UNISIG_SIGMGR_SSCF_RLS_IND,
188 case SSCF_UNI_RELEASE_CNF:
189 (void) unisig_sigmgr_state(usp,
190 UNISIG_SIGMGR_SSCF_RLS_CNF,
196 "unisig: unknown SAAL cmd: usp=%p, state=%d, cmd=%d\n",
197 usp, usp->us_state, cmd);
203 * UNISIG SAAL Data Handler
205 * This is the module which receives data on the UNISIG signalling
206 * channel. Processing is based on the protocol state.
209 * tok session token (pointer to UNISIG protocol control block)
217 unisig_saal_data(tok, m)
221 struct unisig *usp = tok;
223 ATM_DEBUG3("unisig_saal_data: usp=%p,state=%d,m=%p,\n",
224 usp, usp->us_state, m);
227 * Pass data to signalling manager state machine
229 (void) unisig_sigmgr_state(usp,
230 UNISIG_SIGMGR_SSCF_DATA_IND,
236 * Get Connection's Application/Owner Name
239 * tok UNI signalling connection token (pointer to protocol instance)
242 * addr pointer to string containing our name
249 struct unisig *usp = tok;
251 if (usp->us_proto == ATM_SIG_UNI30)
253 else if (usp->us_proto == ATM_SIG_UNI31)
255 else if (usp->us_proto == ATM_SIG_UNI40)
263 * Process a VCC connection notification
265 * Should never be called.
268 * tok user's connection token (unisig protocol block)
275 unisig_connected(tok)
278 struct unisig *usp = tok;
280 ATM_DEBUG2("unisig_connected: usp=%p,state=%d\n",
284 * Connected routine shouldn't ever get called for a PVC
286 log(LOG_ERR, "unisig: connected notification, usp=%p\n",
292 * Process a VCC closed notification
294 * Called when UNISIG signalling channel is closed.
297 * tok user's connection token (unisig protocol block)
298 * cp pointer to cause structure
305 unisig_cleared(tok, cp)
307 struct t_atm_cause *cp;
309 struct unisig *usp = tok;
311 ATM_DEBUG3("unisig_cleared: usp=%p, state=%d, cause=%d\n",
312 usp, usp->us_state, cp->cause_value);
315 * VCC has been closed. Notify the signalling
316 * manager state machine.
318 (void) unisig_sigmgr_state(usp,
319 UNISIG_SIGMGR_CALL_CLEARED,