fetch.9: Minor fixes.
[dragonfly.git] / sys / netproto / atm / uni / unisig_proto.c
blob17d552c25ab6dbc771607e4cf141b5f0cede1c4e
1 /*
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.
49 * Called at splnet.
51 * Arguments:
52 * tip pointer to UNISIG timer control block
54 * Returns:
55 * none
58 void
59 unisig_timer(struct atm_time *tip)
61 struct unisig *usp;
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",
70 usp, usp->us_state);
73 * Pass the timeout to the signalling manager state machine
75 unisig_sigmgr_state(usp,
76 UNISIG_SIGMGR_TIMEOUT,
77 NULL);
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.
87 * Called at splnet.
89 * Arguments:
90 * tip pointer to vccb timer control block
92 * Returns:
93 * none
96 void
97 unisig_vctimer(struct atm_time *tip)
99 struct unisig *usp;
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,
120 NULL);
121 } else {
123 * If we're not aborting, it's a timeout
125 unisig_vc_state(usp, uvp, UNI_VC_TIMEOUT,
126 NULL);
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.
138 * Arguments:
139 * cmd command code
140 * tok session token (pointer to UNISIG protocol control block)
141 * a1 argument 1
143 * Returns:
144 * none
147 void
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);
156 * Process command
158 switch (cmd) {
160 case SSCF_UNI_ESTABLISH_IND:
161 unisig_sigmgr_state(usp,
162 UNISIG_SIGMGR_SSCF_EST_IND,
163 NULL);
164 break;
166 case SSCF_UNI_ESTABLISH_CNF:
167 unisig_sigmgr_state(usp,
168 UNISIG_SIGMGR_SSCF_EST_CNF,
169 NULL);
170 break;
172 case SSCF_UNI_RELEASE_IND:
173 unisig_sigmgr_state(usp,
174 UNISIG_SIGMGR_SSCF_RLS_IND,
175 NULL);
176 break;
178 case SSCF_UNI_RELEASE_CNF:
179 unisig_sigmgr_state(usp,
180 UNISIG_SIGMGR_SSCF_RLS_CNF,
181 NULL);
182 break;
184 default:
185 log(LOG_ERR,
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.
198 * Arguments:
199 * tok session token (pointer to UNISIG protocol control block)
200 * m pointer to data
202 * Returns:
203 * none
206 void
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
226 * Arguments:
227 * tok UNI signalling connection token (pointer to protocol instance)
229 * Returns:
230 * addr pointer to string containing our name
233 caddr_t
234 unisig_getname(void *tok)
236 struct unisig *usp = tok;
238 if (usp->us_proto == ATM_SIG_UNI30)
239 return ("UNI3.0");
240 else if (usp->us_proto == ATM_SIG_UNI31)
241 return ("UNI3.1");
242 else if (usp->us_proto == ATM_SIG_UNI40)
243 return ("UNI4.0");
244 else
245 return ("UNI");
250 * Process a VCC connection notification
252 * Should never be called.
254 * Arguments:
255 * tok user's connection token (unisig protocol block)
257 * Returns:
258 * none
261 void
262 unisig_connected(void *tok)
264 struct unisig *usp = tok;
266 ATM_DEBUG2("unisig_connected: usp=%p,state=%d\n",
267 usp, usp->us_state);
270 * Connected routine shouldn't ever get called for a PVC
272 log(LOG_ERR, "unisig: connected notification, usp=%p\n",
273 usp);
278 * Process a VCC closed notification
280 * Called when UNISIG signalling channel is closed.
282 * Arguments:
283 * tok user's connection token (unisig protocol block)
284 * cp pointer to cause structure
286 * Returns:
287 * none
290 void
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,
304 NULL);