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 $
27 * @(#) $DragonFly: src/sys/netproto/atm/uni/sscf_uni.c,v 1.5 2003/08/23 10:06:22 rob Exp $
31 * ATM Forum UNI Support
32 * ---------------------
34 * Signalling AAL SSCF at the UNI
38 #include <netproto/atm/kern_include.h>
41 #include "sscf_uni_var.h"
46 int sscf_uni_vccnt = 0;
51 static int sscf_uni_inst (struct stack_defn **, Atm_connvc *);
56 static struct sp_info sscf_uni_pool = {
57 "sscf uni pool", /* si_name */
58 sizeof(struct univcc), /* si_blksiz */
63 static struct stack_defn sscf_uni_service = {
73 static struct t_atm_cause sscf_uni_cause = {
76 T_ATM_CAUSE_TEMPORARY_FAILURE,
82 * Initialize SSCF UNI processing
84 * This will be called during module loading. We will register our stack
85 * service and wait for someone to talk to us.
91 * 0 initialization was successful
92 * errno initialization failed - reason indicated
101 * Register stack service
103 if ((err = atm_stack_register(&sscf_uni_service)) != 0)
112 * Terminate SSCF UNI processing
114 * This will be called just prior to unloading the module from memory. All
115 * signalling instances should have been terminated by now, so we just free
116 * up all of our resources.
124 * 0 termination was successful
125 * errno termination failed - reason indicated
132 * Any connections still exist??
134 if (sscf_uni_vccnt) {
137 * Yes, can't stop yet
143 * Deregister the stack service
145 (void) atm_stack_deregister(&sscf_uni_service);
148 * Free our storage pools
150 atm_release_pool(&sscf_uni_pool);
157 * SSCF_UNI Stack Instantiation
162 * ssp pointer to array of stack definition pointers for connection
163 * ssp[0] points to upper layer's stack service definition
164 * ssp[1] points to this layer's stack service definition
165 * ssp[2] points to lower layer's stack service definition
166 * cvp pointer to connection vcc for this stack
169 * 0 instantiation successful
170 * errno instantiation failed - reason indicated
174 sscf_uni_inst(ssp, cvp)
175 struct stack_defn **ssp;
178 struct stack_defn *sdp_up = ssp[0],
184 ATM_DEBUG2("sscf_uni_inst: ssp=%p, cvp=%p\n", ssp, cvp);
189 if (sdp_low->sd_sap != SAP_SSCOP)
193 * Allocate our control block
195 uvp = (struct univcc *)atm_allocate(&sscf_uni_pool);
199 uvp->uv_ustate = UVU_INST;
200 uvp->uv_lstate = UVL_INST;
201 uvp->uv_connvc = cvp;
202 uvp->uv_toku = sdp_up->sd_toku;
203 uvp->uv_upper = sdp_up->sd_upper;
207 * Store my token into service definition
209 sdp_me->sd_toku = uvp;
212 * Update and save input buffer headroom
215 /* uvp->uv_headin = cvp->cvc_attr.headin; */
218 * Pass instantiation down the stack
220 err = sdp_low->sd_inst(ssp + 1, cvp);
223 * Lower layer instantiation failed, free our resources
225 atm_free((caddr_t)uvp);
231 * Save and update output buffer headroom
233 /* uvp->uv_headout = cvp->cvc_attr.headout; */
237 * Save lower layer's interface info
239 uvp->uv_lower = sdp_low->sd_lower;
240 uvp->uv_tokl = sdp_low->sd_toku;
247 * Abort an SSCF_UNI connection
249 * Called when an unrecoverable or "should never happen" error occurs.
250 * We just log a message and request the signalling manager to abort the
254 * uvp pointer to univcc control block
255 * msg pointer to error message
262 sscf_uni_abort(uvp, msg)
269 log(LOG_ERR, "%s", msg);
272 * Set termination states
274 uvp->uv_ustate = UVU_TERM;
275 uvp->uv_lstate = UVL_TERM;
278 * Tell Connection Manager to abort this connection
280 (void) atm_cm_abort(uvp->uv_connvc, &sscf_uni_cause);
288 * uvp pointer to univcc control block
289 * m pointer to pdu buffer chain
290 * msg pointer to message string
297 sscf_uni_pdu_print(uvp, m, msg)
305 vcp = uvp->uv_connvc->cvc_vcc;
306 snprintf(buf, sizeof(buf), "sscf_uni %s: vcc=(%d,%d)\n",
307 msg, vcp->vc_vpi, vcp->vc_vci);
308 atm_pdu_print(m, buf);