1.\" $OpenBSD: rt_timer_add.9,v 1.4 2014/03/26 14:50:30 mpi Exp $ 2.\" 3.\" Copyright (c) 2011 Bret S. Lambert <blambert@openbsd.org> 4.\" All rights reserved. 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.Dd $Mdocdate: March 26 2014 $ 19.Dt RT_TIMER_ADD 9 20.Os 21.Sh NAME 22.Nm rt_timer_add , 23.Nm rt_timer_remove_all , 24.Nm rt_timer_queue_create , 25.Nm rt_timer_queue_count , 26.Nm rt_timer_queue_change , 27.Nm rt_timer_queue_destroy 28.Nd route timer queues interface 29.Sh SYNOPSIS 30.In net/route.h 31.Ft int 32.Fn rt_timer_add "struct rtentry *rt" \ 33"void (*func)(struct rtentry *, struct rttimer *)" \ 34"struct rttimer_queue *queue" "u_int rtableid" 35.Ft void 36.Fn rt_timer_remove_all "struct rtentry *rt" 37.Ft struct rttimer_queue * 38.Fn rt_timer_queue_create "u_int timeout" 39.Ft unsigned long 40.Fn rt_timer_queue_count "struct rttimer_queue *rtq" 41.Ft void 42.Fn rt_timer_queue_change "struct rttimer_queue *rtq" "long timeout" 43.Ft void 44.Fn rt_timer_queue_destroy "struct rttimer_queue *rtq" 45.Sh DESCRIPTION 46Route timer queues provide a method of queueing routing-related actions to be 47triggered once per second. 48.Bl -tag -width Ds 49.It Fn rt_timer_add "struct rtentry *rt" \ 50"void (*func)(struct rtentry *, struct rttimer *)" \ 51"struct rttimer_queue *queue" "u_int rtableid" 52Schedule 53.Fa func 54to be called on 55.Fa rt 56using the timeout of 57.Fa queue . 58If 59.Fa rt 60already has a call to 61.Fa func 62scheduled on any timer queue, it will be replaced with the new invocation. 63.It Fn rt_timer_remove_all "struct rtentry *rt" 64Remove all timeouts associated with 65.Fa rt 66from all routing timer queues. 67.It Fn rt_timer_queue_create "u_int timeout" 68Create a timer queue with a timeout of 69.Fa timeout 70seconds. 71.It Fn rt_timer_queue_count "struct rtentry *rt" 72Return the number of timers present in the queue 73.Fa rtq . 74.It Fn rt_timer_queue_change "struct rttimer_queue *rtq" "long timeout" 75Set timeout for 76.Fa rtq 77to 78.Fa timeout 79seconds. 80.It Fn rt_timer_queue_destroy "struct rttimer_queue *rtq" 81Remove all timeouts from the routing timer queue 82.Fa rtq , 83execute their associated callback and destroy it. 84.El 85.Sh CONTEXT 86.Fn rt_timer_add , 87.Fn rt_timer_remove_all , 88.Fn rt_timer_queue_create , 89.Fn rt_timer_queue_count , 90.Fn rt_timer_queue_change , 91and 92.Fn rt_timer_queue_destroy 93can be called during autoconf, from process context, or from interrupt context. 94.Sh RETURN VALUES 95.Fn rt_timer_add 96may fail with 97.Er ENOBUFS 98if memory could not be allocated for the timeout. 99.Sh SEE ALSO 100.Xr route 4 , 101.Xr route 9 102