Testing - fix bugs in fsx related to 64-bit systems.
[dragonfly.git] / usr.sbin / atm / scspd / scsp_timer.c
blobec91aa3d1b01ec62e0cf6d76dda5cac917c3725f
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/usr.sbin/atm/scspd/scsp_timer.c,v 1.3 1999/08/28 01:15:34 peter Exp $
27 * @(#) $DragonFly: src/usr.sbin/atm/scspd/scsp_timer.c,v 1.4 2004/12/18 22:48:02 swildner Exp $
31 * Server Cache Synchronization Protocol (SCSP) Support
32 * ----------------------------------------------------
34 * Timer processing
38 #include <sys/types.h>
39 #include <sys/param.h>
40 #include <sys/socket.h>
41 #include <net/if.h>
42 #include <netinet/in.h>
43 #include <netatm/queue.h>
44 #include <netatm/atm.h>
45 #include <netatm/atm_if.h>
46 #include <netatm/atm_sap.h>
47 #include <netatm/atm_sys.h>
48 #include <netatm/atm_ioctl.h>
50 #include <errno.h>
51 #include <libatm.h>
52 #include <stdio.h>
53 #include <syslog.h>
55 #include "scsp_msg.h"
56 #include "scsp_if.h"
57 #include "scsp_var.h"
60 * Process an SCSP Open timeout
62 * The open timer is set when an attempt to open a VCC to a DCS fails.
63 * This routine will be called when the timer fires and will retry
64 * the open. Retries can continue indefinitely.
66 * Arguments:
67 * stp pointer to an SCSP timer block
69 * Returns:
70 * None
73 void
74 scsp_open_timeout(Harp_timer *stp)
76 Scsp_dcs *dcsp;
79 * Back off to start of DCS entry
81 dcsp = (Scsp_dcs *) ((caddr_t)stp -
82 (int)(&((Scsp_dcs *)0)->sd_open_t));
85 * Retry the connection
87 if (scsp_dcs_connect(dcsp)) {
89 * Connect failed -- we hope the error was temporary
90 * and set the timer to try again later
92 HARP_TIMER(&dcsp->sd_open_t, SCSP_Open_Interval,
93 scsp_open_timeout);
99 * Process an SCSP Hello timeout
101 * The Hello timer fires every SCSP_HELLO_Interval seconds. This
102 * routine will notify the Hello FSM when the timer fires.
104 * Arguments:
105 * stp pointer to an SCSP timer block
107 * Returns:
108 * None
111 void
112 scsp_hello_timeout(Harp_timer *stp)
114 Scsp_dcs *dcsp;
117 * Back off to start of DCS entry
119 dcsp = (Scsp_dcs *) ((caddr_t)stp -
120 (int)(&((Scsp_dcs *)0)->sd_hello_h_t));
123 * Call the Hello FSM
125 scsp_hfsm(dcsp, SCSP_HFSM_HELLO_T, NULL);
127 return;
132 * Process an SCSP receive timeout
134 * The receive timer is started whenever the Hello FSM receives a
135 * Hello message from its DCS. If the timer fires, it means that no
136 * Hello messages have been received in the DCS's Hello interval.
138 * Arguments:
139 * stp pointer to an SCSP timer block
141 * Returns:
142 * None
145 void
146 scsp_hello_rcv_timeout(Harp_timer *stp)
148 Scsp_dcs *dcsp;
151 * Back off to start of DCS entry
153 dcsp = (Scsp_dcs *) ((caddr_t)stp -
154 (int)(&((Scsp_dcs *)0)->sd_hello_rcv_t));
157 * Call the Hello FSM
159 scsp_hfsm(dcsp, SCSP_HFSM_RCV_T, NULL);
161 return;
166 * Process an SCSP CA retransmit timeout
168 * Arguments:
169 * stp pointer to an SCSP timer block
171 * Returns:
172 * None
175 void
176 scsp_ca_retran_timeout(Harp_timer *stp)
178 Scsp_dcs *dcsp;
181 * Back off to start of DCS entry
183 dcsp = (Scsp_dcs *) ((caddr_t)stp -
184 (int)(&((Scsp_dcs *)0)->sd_ca_rexmt_t));
187 * Call the CA FSM
189 scsp_cafsm(dcsp, SCSP_CAFSM_CA_T, NULL);
191 return;
196 * Process an SCSP CSUS retransmit timeout
198 * Arguments:
199 * stp pointer to an SCSP timer block
201 * Returns:
202 * None
205 void
206 scsp_csus_retran_timeout(Harp_timer *stp)
208 Scsp_dcs *dcsp;
211 * Back off to start of DCS entry
213 dcsp = (Scsp_dcs *) ((caddr_t)stp -
214 (int)(&((Scsp_dcs *)0)->sd_csus_rexmt_t));
217 * Call the CA FSM
219 scsp_cafsm(dcsp, SCSP_CAFSM_CSUS_T, NULL);
221 return;
226 * Process an SCSP CSU Req retransmit timeout
228 * Arguments:
229 * stp pointer to an SCSP timer block
231 * Returns:
232 * None
235 void
236 scsp_csu_req_retran_timeout(Harp_timer *stp)
238 Scsp_csu_rexmt *rxp;
239 Scsp_dcs *dcsp;
242 * Back off to start of CSU Request retransmission entry
244 rxp = (Scsp_csu_rexmt *) ((caddr_t)stp -
245 (int)(&((Scsp_csu_rexmt *)0)->sr_t));
246 dcsp = rxp->sr_dcs;
249 * Call the CA FSM
251 scsp_cafsm(dcsp, SCSP_CAFSM_CSU_T, (void *)rxp);
253 return;