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/sscf_uni.c,v 1.7.2.1 2001/09/30 22:54:35 kris Exp $
31 * ATM Forum UNI Support
32 * ---------------------
34 * Signalling AAL SSCF at the UNI
38 #include <netatm/kern_include.h>
40 #include <netatm/uni/uni.h>
41 #include <netatm/uni/sscf_uni_var.h>
44 __RCSID("@(#) $FreeBSD: src/sys/netatm/uni/sscf_uni.c,v 1.7.2.1 2001/09/30 22:54:35 kris Exp $");
51 int sscf_uni_vccnt = 0;
56 static int sscf_uni_inst __P((struct stack_defn **, Atm_connvc *));
61 static struct sp_info sscf_uni_pool = {
62 "sscf uni pool", /* si_name */
63 sizeof(struct univcc), /* si_blksiz */
68 static struct stack_defn sscf_uni_service = {
78 static struct t_atm_cause sscf_uni_cause = {
81 T_ATM_CAUSE_TEMPORARY_FAILURE,
87 * Initialize SSCF UNI processing
89 * This will be called during module loading. We will register our stack
90 * service and wait for someone to talk to us.
96 * 0 initialization was successful
97 * errno initialization failed - reason indicated
106 * Register stack service
108 if ((err = atm_stack_register(&sscf_uni_service)) != 0)
117 * Terminate SSCF UNI processing
119 * This will be called just prior to unloading the module from memory. All
120 * signalling instances should have been terminated by now, so we just free
121 * up all of our resources.
129 * 0 termination was successful
130 * errno termination failed - reason indicated
137 * Any connections still exist??
139 if (sscf_uni_vccnt) {
142 * Yes, can't stop yet
148 * Deregister the stack service
150 (void) atm_stack_deregister(&sscf_uni_service);
153 * Free our storage pools
155 atm_release_pool(&sscf_uni_pool);
162 * SSCF_UNI Stack Instantiation
167 * ssp pointer to array of stack definition pointers for connection
168 * ssp[0] points to upper layer's stack service definition
169 * ssp[1] points to this layer's stack service definition
170 * ssp[2] points to lower layer's stack service definition
171 * cvp pointer to connection vcc for this stack
174 * 0 instantiation successful
175 * errno instantiation failed - reason indicated
179 sscf_uni_inst(ssp, cvp)
180 struct stack_defn **ssp;
183 struct stack_defn *sdp_up = ssp[0],
189 ATM_DEBUG2("sscf_uni_inst: ssp=%p, cvp=%p\n", ssp, cvp);
194 if (sdp_low->sd_sap != SAP_SSCOP)
198 * Allocate our control block
200 uvp = (struct univcc *)atm_allocate(&sscf_uni_pool);
204 uvp->uv_ustate = UVU_INST;
205 uvp->uv_lstate = UVL_INST;
206 uvp->uv_connvc = cvp;
207 uvp->uv_toku = sdp_up->sd_toku;
208 uvp->uv_upper = sdp_up->sd_upper;
212 * Store my token into service definition
214 sdp_me->sd_toku = uvp;
217 * Update and save input buffer headroom
220 /* uvp->uv_headin = cvp->cvc_attr.headin; */
223 * Pass instantiation down the stack
225 err = sdp_low->sd_inst(ssp + 1, cvp);
228 * Lower layer instantiation failed, free our resources
230 atm_free((caddr_t)uvp);
236 * Save and update output buffer headroom
238 /* uvp->uv_headout = cvp->cvc_attr.headout; */
242 * Save lower layer's interface info
244 uvp->uv_lower = sdp_low->sd_lower;
245 uvp->uv_tokl = sdp_low->sd_toku;
252 * Abort an SSCF_UNI connection
254 * Called when an unrecoverable or "should never happen" error occurs.
255 * We just log a message and request the signalling manager to abort the
259 * uvp pointer to univcc control block
260 * msg pointer to error message
267 sscf_uni_abort(uvp, msg)
274 log(LOG_ERR, "%s", msg);
277 * Set termination states
279 uvp->uv_ustate = UVU_TERM;
280 uvp->uv_lstate = UVL_TERM;
283 * Tell Connection Manager to abort this connection
285 (void) atm_cm_abort(uvp->uv_connvc, &sscf_uni_cause);
293 * uvp pointer to univcc control block
294 * m pointer to pdu buffer chain
295 * msg pointer to message string
302 sscf_uni_pdu_print(uvp, m, msg)
310 vcp = uvp->uv_connvc->cvc_vcc;
311 snprintf(buf, sizeof(buf), "sscf_uni %s: vcc=(%d,%d)\n",
312 msg, vcp->vc_vpi, vcp->vc_vci);
313 atm_pdu_print(m, buf);