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 $
27 * @(#) $DragonFly: src/sys/netproto/atm/uni/unisig_proto.c,v 1.2 2003/06/17 04:28:49 dillon 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 * Process a UNISIG timeout
45 * Called when a previously scheduled protocol instance control block
46 * timer expires. This routine passes a timeout event to the UNISIG
47 * signalling manager state machine.
52 * tip pointer to UNISIG timer control block
65 * Back-off to UNISIG control block
67 usp = (struct unisig *)
68 ((caddr_t)tip - (int)(&((struct unisig *)0)->us_time));
70 ATM_DEBUG2("unisig_timer: usp=%p,state=%d\n",
74 * Pass the timeout to the signalling manager state machine
76 (void) unisig_sigmgr_state(usp,
77 UNISIG_SIGMGR_TIMEOUT,
83 * Process a UNISIG VCC timeout
85 * Called when a previously scheduled UNISIG VCCB timer expires.
86 * Processing will based on the current VCC state.
91 * tip pointer to vccb timer control block
102 struct unisig_vccb *uvp;
105 * Get VCCB and UNISIG control block addresses
107 uvp = (struct unisig_vccb *) ((caddr_t)tip -
108 (int)(&((struct vccb *)0)->vc_time));
109 usp = (struct unisig *)uvp->uv_pif->pif_siginst;
111 ATM_DEBUG3("unisig_vctimer: uvp=%p, sstate=%d, ustate=%d\n",
112 uvp, uvp->uv_sstate, uvp->uv_ustate);
115 * Hand the timeout to the VC finite state machine
117 if (uvp->uv_ustate == VCCU_ABORT) {
119 * If we're aborting, this is an ABORT call
121 (void) unisig_vc_state(usp, uvp, UNI_VC_ABORT_CALL,
122 (struct unisig_msg *) 0);
125 * If we're not aborting, it's a timeout
127 (void) unisig_vc_state(usp, uvp, UNI_VC_TIMEOUT,
128 (struct unisig_msg *) 0);
134 * UNISIG SAAL Control Handler
136 * This is the module which receives data on the UNISIG signalling
137 * channel. Processing is based on the indication received from the
138 * SSCF and the protocol state.
142 * tok session token (pointer to UNISIG protocol control block)
150 unisig_saal_ctl(cmd, tok, a1)
155 struct unisig *usp = tok;
157 ATM_DEBUG4("unisig_upper: usp=%p,state=%d,cmd=%d,a1=0x%lx,\n",
158 usp, usp->us_state, cmd, (u_long)a1);
165 case SSCF_UNI_ESTABLISH_IND:
166 (void) unisig_sigmgr_state(usp,
167 UNISIG_SIGMGR_SSCF_EST_IND,
171 case SSCF_UNI_ESTABLISH_CNF:
172 (void) unisig_sigmgr_state(usp,
173 UNISIG_SIGMGR_SSCF_EST_CNF,
177 case SSCF_UNI_RELEASE_IND:
178 (void) unisig_sigmgr_state(usp,
179 UNISIG_SIGMGR_SSCF_RLS_IND,
183 case SSCF_UNI_RELEASE_CNF:
184 (void) unisig_sigmgr_state(usp,
185 UNISIG_SIGMGR_SSCF_RLS_CNF,
191 "unisig: unknown SAAL cmd: usp=%p, state=%d, cmd=%d\n",
192 usp, usp->us_state, cmd);
198 * UNISIG SAAL Data Handler
200 * This is the module which receives data on the UNISIG signalling
201 * channel. Processing is based on the protocol state.
204 * tok session token (pointer to UNISIG protocol control block)
212 unisig_saal_data(tok, m)
216 struct unisig *usp = tok;
218 ATM_DEBUG3("unisig_saal_data: usp=%p,state=%d,m=%p,\n",
219 usp, usp->us_state, m);
222 * Pass data to signalling manager state machine
224 (void) unisig_sigmgr_state(usp,
225 UNISIG_SIGMGR_SSCF_DATA_IND,
231 * Get Connection's Application/Owner Name
234 * tok UNI signalling connection token (pointer to protocol instance)
237 * addr pointer to string containing our name
244 struct unisig *usp = tok;
246 if (usp->us_proto == ATM_SIG_UNI30)
248 else if (usp->us_proto == ATM_SIG_UNI31)
250 else if (usp->us_proto == ATM_SIG_UNI40)
258 * Process a VCC connection notification
260 * Should never be called.
263 * tok user's connection token (unisig protocol block)
270 unisig_connected(tok)
273 struct unisig *usp = tok;
275 ATM_DEBUG2("unisig_connected: usp=%p,state=%d\n",
279 * Connected routine shouldn't ever get called for a PVC
281 log(LOG_ERR, "unisig: connected notification, usp=%p\n",
287 * Process a VCC closed notification
289 * Called when UNISIG signalling channel is closed.
292 * tok user's connection token (unisig protocol block)
293 * cp pointer to cause structure
300 unisig_cleared(tok, cp)
302 struct t_atm_cause *cp;
304 struct unisig *usp = tok;
306 ATM_DEBUG3("unisig_cleared: usp=%p, state=%d, cause=%d\n",
307 usp, usp->us_state, cp->cause_value);
310 * VCC has been closed. Notify the signalling
311 * manager state machine.
313 (void) unisig_sigmgr_state(usp,
314 UNISIG_SIGMGR_CALL_CLEARED,