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.5 2006/01/14 13:36:39 swildner Exp $
31 * ATM Forum UNI 3.0/3.1 Signalling Manager
32 * ----------------------------------------
34 * Protocol processing module.
38 #include <netproto/atm/kern_include.h>
40 #include "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
59 unisig_timer(struct atm_time
*tip
)
64 * Back-off to UNISIG control block
66 usp
= (struct unisig
*)
67 ((caddr_t
)tip
- (int)(&((struct unisig
*)0)->us_time
));
69 ATM_DEBUG2("unisig_timer: usp=%p,state=%d\n",
73 * Pass the timeout to the signalling manager state machine
75 unisig_sigmgr_state(usp
,
76 UNISIG_SIGMGR_TIMEOUT
,
82 * Process a UNISIG VCC timeout
84 * Called when a previously scheduled UNISIG VCCB timer expires.
85 * Processing will based on the current VCC state.
90 * tip pointer to vccb timer control block
97 unisig_vctimer(struct atm_time
*tip
)
100 struct unisig_vccb
*uvp
;
103 * Get VCCB and UNISIG control block addresses
105 uvp
= (struct unisig_vccb
*) ((caddr_t
)tip
-
106 (int)(&((struct vccb
*)0)->vc_time
));
107 usp
= (struct unisig
*)uvp
->uv_pif
->pif_siginst
;
109 ATM_DEBUG3("unisig_vctimer: uvp=%p, sstate=%d, ustate=%d\n",
110 uvp
, uvp
->uv_sstate
, uvp
->uv_ustate
);
113 * Hand the timeout to the VC finite state machine
115 if (uvp
->uv_ustate
== VCCU_ABORT
) {
117 * If we're aborting, this is an ABORT call
119 unisig_vc_state(usp
, uvp
, UNI_VC_ABORT_CALL
,
123 * If we're not aborting, it's a timeout
125 unisig_vc_state(usp
, uvp
, UNI_VC_TIMEOUT
,
132 * UNISIG SAAL Control Handler
134 * This is the module which receives data on the UNISIG signalling
135 * channel. Processing is based on the indication received from the
136 * SSCF and the protocol state.
140 * tok session token (pointer to UNISIG protocol control block)
148 unisig_saal_ctl(int cmd
, void *tok
, void *a1
)
150 struct unisig
*usp
= tok
;
152 ATM_DEBUG4("unisig_upper: usp=%p,state=%d,cmd=%d,a1=0x%lx,\n",
153 usp
, usp
->us_state
, cmd
, (u_long
)a1
);
160 case SSCF_UNI_ESTABLISH_IND
:
161 unisig_sigmgr_state(usp
,
162 UNISIG_SIGMGR_SSCF_EST_IND
,
166 case SSCF_UNI_ESTABLISH_CNF
:
167 unisig_sigmgr_state(usp
,
168 UNISIG_SIGMGR_SSCF_EST_CNF
,
172 case SSCF_UNI_RELEASE_IND
:
173 unisig_sigmgr_state(usp
,
174 UNISIG_SIGMGR_SSCF_RLS_IND
,
178 case SSCF_UNI_RELEASE_CNF
:
179 unisig_sigmgr_state(usp
,
180 UNISIG_SIGMGR_SSCF_RLS_CNF
,
186 "unisig: unknown SAAL cmd: usp=%p, state=%d, cmd=%d\n",
187 usp
, usp
->us_state
, cmd
);
193 * UNISIG SAAL Data Handler
195 * This is the module which receives data on the UNISIG signalling
196 * channel. Processing is based on the protocol state.
199 * tok session token (pointer to UNISIG protocol control block)
207 unisig_saal_data(void *tok
, KBuffer
*m
)
209 struct unisig
*usp
= tok
;
211 ATM_DEBUG3("unisig_saal_data: usp=%p,state=%d,m=%p,\n",
212 usp
, usp
->us_state
, m
);
215 * Pass data to signalling manager state machine
217 unisig_sigmgr_state(usp
,
218 UNISIG_SIGMGR_SSCF_DATA_IND
,
224 * Get Connection's Application/Owner Name
227 * tok UNI signalling connection token (pointer to protocol instance)
230 * addr pointer to string containing our name
234 unisig_getname(void *tok
)
236 struct unisig
*usp
= tok
;
238 if (usp
->us_proto
== ATM_SIG_UNI30
)
240 else if (usp
->us_proto
== ATM_SIG_UNI31
)
242 else if (usp
->us_proto
== ATM_SIG_UNI40
)
250 * Process a VCC connection notification
252 * Should never be called.
255 * tok user's connection token (unisig protocol block)
262 unisig_connected(void *tok
)
264 struct unisig
*usp
= tok
;
266 ATM_DEBUG2("unisig_connected: usp=%p,state=%d\n",
270 * Connected routine shouldn't ever get called for a PVC
272 log(LOG_ERR
, "unisig: connected notification, usp=%p\n",
278 * Process a VCC closed notification
280 * Called when UNISIG signalling channel is closed.
283 * tok user's connection token (unisig protocol block)
284 * cp pointer to cause structure
291 unisig_cleared(void *tok
, struct t_atm_cause
*cp
)
293 struct unisig
*usp
= tok
;
295 ATM_DEBUG3("unisig_cleared: usp=%p, state=%d, cause=%d\n",
296 usp
, usp
->us_state
, cp
->cause_value
);
299 * VCC has been closed. Notify the signalling
300 * manager state machine.
302 unisig_sigmgr_state(usp
,
303 UNISIG_SIGMGR_CALL_CLEARED
,