1 .\" $NetBSD: rt_timer.9,v 1.10 2003/04/16 13:35:33 wiz Exp $
3 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Kevin M. Lahey of the Numerical Aerospace Simulation Facility,
8 .\" NASA Ames Research Center.
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
19 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 .\" POSSIBILITY OF SUCH DAMAGE.
37 .Nm rt_timer_queue_create ,
38 .Nm rt_timer_queue_change ,
39 .Nm rt_timer_queue_destroy ,
40 .Nm rt_timer_remove_all
41 .Nd route callout functions
44 .Ft "struct rttimer_queue *"
45 .Fn rt_timer_queue_create "time_t timeout"
47 .Fn rt_timer_queue_change "struct rttimer_queue *q" "time_t timeout"
49 .Fn rt_timer_queue_destroy "struct rttimer_queue *q" "int destroy"
51 .Fn rt_timer_add "struct rtentry *rt" \
52 "void(*f)(struct rtentry *, struct rttimer *)" "struct rttimer_queue *q"
54 .Fn rt_timer_remove_all "struct rtentry *rt"
58 functions provide a generic route callout functionality.
59 They allow a function to be called for a route at any time.
60 This was originally intended to be used to remove routes added
61 by path MTU discovery code.
63 For maximum efficiency, a separate queue should be defined for each
65 For example, one queue should be created for the 10 minute path MTU
66 discovery timeouts, another for 20 minute ARP timeouts after 20
68 This permits extremely fast queue manipulations so that the timeout
69 functions remain scalable, even in the face of thousands of route
70 manipulations per minute.
72 It is possible to create only a single timeout queue for all possible
73 timeout values, but doing so is not scalable as queue manipulations
74 become quite expensive if the timeout deltas are not roughly constant.
78 interface provides the following functions:
79 .Bl -tag -width compact
80 .It Fn rt_timer_queue_create "time_t timeout"
81 This function creates a new timer queue with the specified timeout period
84 .It Fn rt_timer_queue_change "rttimer_queue *q" "time_t timeout"
85 This function modifies the timeout period for a timer queue.
86 Any value, including 0, is valid.
87 The next time the timer queue's timeout expires (based on the previous
88 timeout value), all entries which are valid to execute based on the new
89 timeout will be executed, and the new timeout period scheduled.
90 .It Fn rt_timer_queue_destroy "rttimer_queue *q" "int destroy"
91 This function destroys a timeout queue.
92 All entries are removed, and if the
94 argument is non-zero, the timeout action is performed for each entry.
95 .It Fn rt_timer_add "struct rtentry *rt" \
96 "void(*f)(struct rtentry *, struct rttimer *)" "struct rttimer_queue *q"
97 This function adds an entry to a timeout queue.
100 will be called after the timeout period for queue
106 the route will be deleted when the timeout expires.
107 .It Fn rt_timer_remove_all "struct rtentry *rt"
108 This function removes all references to the given route from the
111 This is used when a route is deleted to ensure that no dangling
118 This interface is roughly based on (but, alas, not compatible with) one
119 designed by David Borman of BSDI.
120 This implementation is by Kevin Lahey of the Numerical Aerospace
121 Simulation Facility, NASA Ames Research Center.
125 interface is implemented in
128 .Pa sys/net/route.c .
132 interface appeared in