1*440f990dSkn.\" $OpenBSD: rt_timer_add.9,v 1.5 2023/06/20 10:59:47 kn Exp $ 2351af3c2Smpi.\" 3351af3c2Smpi.\" Copyright (c) 2011 Bret S. Lambert <blambert@openbsd.org> 4351af3c2Smpi.\" All rights reserved. 5351af3c2Smpi.\" 6351af3c2Smpi.\" Permission to use, copy, modify, and distribute this software for any 7351af3c2Smpi.\" purpose with or without fee is hereby granted, provided that the above 8351af3c2Smpi.\" copyright notice and this permission notice appear in all copies. 9351af3c2Smpi.\" 10351af3c2Smpi.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11351af3c2Smpi.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12351af3c2Smpi.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13351af3c2Smpi.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14351af3c2Smpi.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15351af3c2Smpi.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16351af3c2Smpi.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17351af3c2Smpi.\" 18*440f990dSkn.Dd $Mdocdate: June 20 2023 $ 19351af3c2Smpi.Dt RT_TIMER_ADD 9 20351af3c2Smpi.Os 21351af3c2Smpi.Sh NAME 22351af3c2Smpi.Nm rt_timer_add , 23351af3c2Smpi.Nm rt_timer_remove_all , 24*440f990dSkn.Nm rt_timer_get_expire , 25*440f990dSkn.Nm rt_timer_queue_init , 26351af3c2Smpi.Nm rt_timer_queue_change , 27*440f990dSkn.Nm rt_timer_queue_flush , 28*440f990dSkn.Nm rt_timer_queue_count 29351af3c2Smpi.Nd route timer queues interface 30351af3c2Smpi.Sh SYNOPSIS 31351af3c2Smpi.In net/route.h 32351af3c2Smpi.Ft int 33351af3c2Smpi.Fn rt_timer_add "struct rtentry *rt" \ 34351af3c2Smpi"struct rttimer_queue *queue" "u_int rtableid" 35351af3c2Smpi.Ft void 36351af3c2Smpi.Fn rt_timer_remove_all "struct rtentry *rt" 37*440f990dSkn.Ft time_t 38*440f990dSkn.Fn rt_timer_get_expire "const struct rtentry *rt" 39*440f990dSkn.Ft void 40*440f990dSkn.Fn rt_timer_queue_init "struct rttimer_queue *rtq" "int timeout" \ 41*440f990dSkn"void (*func)(struct rtentry *, u_int)" 42*440f990dSkn.Ft void 43*440f990dSkn.Fn rt_timer_queue_change "struct rttimer_queue *rtq" "int timeout" 44*440f990dSkn.Ft void 45*440f990dSkn.Fn rt_timer_queue_flush "struct rttimer_queue *rtq" 46ab94d94cSmpi.Ft unsigned long 47ab94d94cSmpi.Fn rt_timer_queue_count "struct rttimer_queue *rtq" 48351af3c2Smpi.Sh DESCRIPTION 49*440f990dSknThe 50*440f990dSkn.Nm rt_timer 51*440f990dSknsubsystem queues routing-related functions for asynchronous execution 52*440f990dSknin the future. 53*440f990dSkn.Pp 54*440f990dSkn.Fn rt_timer_add 55*440f990dSknallocates an rttimer_queue 56*440f990dSkn.Fa rtq 57351af3c2Smpito be called on 58351af3c2Smpi.Fa rt 59351af3c2Smpiusing the timeout of 60351af3c2Smpi.Fa queue . 61*440f990dSknIf an action already exists, it will be replaced with the new one. 62*440f990dSkn.Pp 63*440f990dSkn.Fn rt_timer_remove_all 64*440f990dSknremoves all timeouts associated with 65ab94d94cSmpi.Fa rt 66ab94d94cSmpifrom all routing timer queues. 67*440f990dSkn.Pp 68*440f990dSkn.Fn rt_timer_get_expire 69*440f990dSknreturns the current expiry time in seconds. 70*440f990dSkn.Pp 71*440f990dSkn.Fn rt_timer_queue_init 72*440f990dSkncreates a timer queue with a timeout of 73351af3c2Smpi.Fa timeout 74351af3c2Smpiseconds. 75*440f990dSkn.Pp 76*440f990dSkn.Fn rt_timer_queue_change 77*440f990dSknsets the timeout for 78351af3c2Smpi.Fa rtq 79351af3c2Smpito 80351af3c2Smpi.Fa timeout 81351af3c2Smpiseconds. 82*440f990dSkn.Pp 83*440f990dSkn.Fn rt_timer_queue_flush 84*440f990dSknremoves all timeouts from the routing timer queue 85ab94d94cSmpi.Fa rtq , 86*440f990dSknexecutes their associated callback and destroys it. 87*440f990dSkn.Pp 88*440f990dSkn.Fn rt_timer_queue_count 89*440f990dSknreturns the number of timers present in the queue 90*440f990dSkn.Fa rtq . 9144275a43Smpi.Sh CONTEXT 9244275a43Smpi.Fn rt_timer_add , 9344275a43Smpi.Fn rt_timer_remove_all , 94*440f990dSkn.Fn rt_timer_get_expire , 95*440f990dSkn.Fn rt_timer_queue_init , 9644275a43Smpi.Fn rt_timer_queue_change , 97*440f990dSkn.Fn rt_timer_queue_flush 9844275a43Smpiand 99*440f990dSkn.Fn rt_timer_queue_count 10044275a43Smpican be called during autoconf, from process context, or from interrupt context. 101*440f990dSkn.Sh ERRORS 102351af3c2Smpi.Fn rt_timer_add 103351af3c2Smpimay fail with 104351af3c2Smpi.Er ENOBUFS 105351af3c2Smpiif memory could not be allocated for the timeout. 106351af3c2Smpi.Sh SEE ALSO 107351af3c2Smpi.Xr route 4 , 108351af3c2Smpi.Xr route 9 109