1.\" $OpenBSD: rt_timer_add.9,v 1.5 2023/06/20 10:59:47 kn 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: June 20 2023 $ 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_get_expire , 25.Nm rt_timer_queue_init , 26.Nm rt_timer_queue_change , 27.Nm rt_timer_queue_flush , 28.Nm rt_timer_queue_count 29.Nd route timer queues interface 30.Sh SYNOPSIS 31.In net/route.h 32.Ft int 33.Fn rt_timer_add "struct rtentry *rt" \ 34"struct rttimer_queue *queue" "u_int rtableid" 35.Ft void 36.Fn rt_timer_remove_all "struct rtentry *rt" 37.Ft time_t 38.Fn rt_timer_get_expire "const struct rtentry *rt" 39.Ft void 40.Fn rt_timer_queue_init "struct rttimer_queue *rtq" "int timeout" \ 41"void (*func)(struct rtentry *, u_int)" 42.Ft void 43.Fn rt_timer_queue_change "struct rttimer_queue *rtq" "int timeout" 44.Ft void 45.Fn rt_timer_queue_flush "struct rttimer_queue *rtq" 46.Ft unsigned long 47.Fn rt_timer_queue_count "struct rttimer_queue *rtq" 48.Sh DESCRIPTION 49The 50.Nm rt_timer 51subsystem queues routing-related functions for asynchronous execution 52in the future. 53.Pp 54.Fn rt_timer_add 55allocates an rttimer_queue 56.Fa rtq 57to be called on 58.Fa rt 59using the timeout of 60.Fa queue . 61If an action already exists, it will be replaced with the new one. 62.Pp 63.Fn rt_timer_remove_all 64removes all timeouts associated with 65.Fa rt 66from all routing timer queues. 67.Pp 68.Fn rt_timer_get_expire 69returns the current expiry time in seconds. 70.Pp 71.Fn rt_timer_queue_init 72creates a timer queue with a timeout of 73.Fa timeout 74seconds. 75.Pp 76.Fn rt_timer_queue_change 77sets the timeout for 78.Fa rtq 79to 80.Fa timeout 81seconds. 82.Pp 83.Fn rt_timer_queue_flush 84removes all timeouts from the routing timer queue 85.Fa rtq , 86executes their associated callback and destroys it. 87.Pp 88.Fn rt_timer_queue_count 89returns the number of timers present in the queue 90.Fa rtq . 91.Sh CONTEXT 92.Fn rt_timer_add , 93.Fn rt_timer_remove_all , 94.Fn rt_timer_get_expire , 95.Fn rt_timer_queue_init , 96.Fn rt_timer_queue_change , 97.Fn rt_timer_queue_flush 98and 99.Fn rt_timer_queue_count 100can be called during autoconf, from process context, or from interrupt context. 101.Sh ERRORS 102.Fn rt_timer_add 103may fail with 104.Er ENOBUFS 105if memory could not be allocated for the timeout. 106.Sh SEE ALSO 107.Xr route 4 , 108.Xr route 9 109