2001-09-04 07:01:50 +04:00
|
|
|
.\" $NetBSD: rt_timer.9,v 1.7 2001/09/04 03:01:50 wiz Exp $
|
1998-04-29 08:17:26 +04:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
.\" All rights reserved.
|
2001-09-04 06:51:15 +04:00
|
|
|
.\"
|
1998-04-29 08:17:26 +04:00
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Kevin M. Lahey of the Numerical Aerospace Simulation Facility,
|
|
|
|
.\" NASA Ames Research Center.
|
2001-09-04 06:51:15 +04:00
|
|
|
.\"
|
1998-04-29 08:17:26 +04:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgment:
|
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
2001-09-04 06:51:15 +04:00
|
|
|
.\"
|
1998-04-29 08:17:26 +04:00
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.Dd April 23, 1998
|
|
|
|
.Dt RT_TIMER 9
|
1999-03-16 03:40:46 +03:00
|
|
|
.Os
|
1998-04-29 08:17:26 +04:00
|
|
|
.Sh NAME
|
2001-09-04 06:51:15 +04:00
|
|
|
.Nm rt_timer ,
|
1998-04-29 08:17:26 +04:00
|
|
|
.Nm rt_timer_add ,
|
|
|
|
.Nm rt_timer_queue_create ,
|
|
|
|
.Nm rt_timer_queue_change ,
|
|
|
|
.Nm rt_timer_queue_destroy ,
|
|
|
|
.Nm rt_timer_remove_all
|
|
|
|
.Nd route callout functions
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Fd #include <net/route.h>
|
|
|
|
.Ft "struct rttimer_queue *"
|
|
|
|
.Fn rt_timer_queue_create "time_t timeout"
|
|
|
|
.Ft void
|
|
|
|
.Fn rt_timer_queue_change "struct rttimer_queue *q" "time_t timeout"
|
|
|
|
.Ft void
|
|
|
|
.Fn rt_timer_queue_destroy "struct rttimer_queue *q" "int destroy"
|
|
|
|
.Ft int
|
|
|
|
.Fn rt_timer_add "struct rtentry *rt" \
|
|
|
|
"void(*f)(struct rtentry *, struct rttimer *)" "struct rttimer_queue *q"
|
|
|
|
.Ft void
|
|
|
|
.Fn rt_timer_remove_all "struct rtentry *rt"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2001-09-04 06:51:15 +04:00
|
|
|
.Nm
|
1998-04-29 08:17:26 +04:00
|
|
|
functions provide a generic route callout functionality.
|
|
|
|
They allow a function to be called for a route at any time.
|
|
|
|
This was originally intended to be used to remove routes added
|
|
|
|
by path MTU discovery code.
|
|
|
|
.Pp
|
|
|
|
For maximum efficiency, a separate queue should be defined for each
|
|
|
|
timeout period. For example, one queue should be created for the
|
|
|
|
10 minute path MTU discovery timeouts, another for 20 minute ARP
|
|
|
|
timeouts after 20 minutes, and so on. This permits extremely fast
|
|
|
|
queue manipulations so that the timeout functions remain scalable,
|
|
|
|
even in the face of thousands of route manipulations per minute.
|
|
|
|
.Pp
|
|
|
|
It is possible to create only a single timeout queue for all possible
|
|
|
|
timeout values, but doing so is not scalable as queue manipulations
|
|
|
|
become quite expensive if the timeout deltas are not roughly constant.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
interface provides the following functions:
|
|
|
|
.Bl -tag -width compact
|
|
|
|
.It Fn rt_timer_queue_create "time_t timeout"
|
|
|
|
This function creates a new timer queue with the specified timeout period
|
|
|
|
.Fa timeout ,
|
|
|
|
expressed in seconds.
|
|
|
|
.It Fn rt_timer_queue_change "rttimer_queue *q" "time_t timeout"
|
|
|
|
This function modifies the timeout period for a timer queue.
|
|
|
|
Any value, including 0, is valid. The next time the timer queue's
|
|
|
|
timeout expires (based on the previous timeout value), all entries
|
|
|
|
which are valid to execute based on the new timeout will be executed,
|
|
|
|
and the new timeout period scheduled.
|
|
|
|
.It Fn rt_timer_queue_destroy "rttimer_queue *q" "int destroy"
|
|
|
|
This function destroys a timeout queue. All entries are removed,
|
|
|
|
and if the
|
|
|
|
.Fa destroy
|
|
|
|
argument is non-zero, the timeout action is performed for each entry.
|
|
|
|
.It Fn rt_timer_add "struct rtentry *rt" \
|
|
|
|
"void(*f)(struct rtentry *, struct rttimer *)" "struct rttimer_queue *q"
|
|
|
|
This function adds an entry to a timeout queue.
|
2001-09-04 06:51:15 +04:00
|
|
|
The function
|
|
|
|
.Fa f
|
1998-04-29 08:17:26 +04:00
|
|
|
will be called after the timeout period for queue
|
2001-09-04 06:51:15 +04:00
|
|
|
.Fa q
|
|
|
|
has elapsed.
|
|
|
|
If
|
|
|
|
.Fa f
|
|
|
|
is NULL
|
1998-04-29 08:17:26 +04:00
|
|
|
the route will be deleted when the timeout expires.
|
|
|
|
.It Fn rt_timer_remove_all "struct rtentry *rt"
|
|
|
|
This function removes all references to the given route from the
|
|
|
|
.Nm
|
|
|
|
subsystem. This is used when a route is deleted to ensure that no
|
|
|
|
dangling references remain.
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
2001-09-04 07:01:50 +04:00
|
|
|
.Xr netstat 1 ,
|
|
|
|
.Xr arp 9
|
1998-04-29 08:17:26 +04:00
|
|
|
.Sh AUTHORS
|
2001-06-11 05:50:48 +04:00
|
|
|
This interface is roughly based on (but, alas, not compatible with) one
|
1998-04-29 08:17:26 +04:00
|
|
|
designed by David Borman of BSDI. This implementation is by Kevin Lahey
|
|
|
|
of the Numerical Aerospace Simulation Facility, NASA Ames Research Center.
|
|
|
|
.Sh CODE REFERENCES
|
|
|
|
The
|
|
|
|
.Nm
|
1998-09-02 09:13:07 +04:00
|
|
|
interface is implemented in
|
|
|
|
.Pa sys/net/route.h
|
|
|
|
and
|
2001-09-04 07:01:50 +04:00
|
|
|
.Pa sys/net/route.c .
|
1998-04-29 08:17:26 +04:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
interface appeared in
|
|
|
|
.Nx 1.4 .
|