2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
15 * Copyright (C) 2020 embedd.ch
16 * Copyright (C) 2020 Felix Fietkau <nbd@nbd.name>
17 * Copyright (C) 2020 John Crispin <john@phrozen.org>
20 #ifndef __APMGR_TIMEOUT_H
21 #define __APMGR_TIMEOUT_H
23 #include <libubox/avl.h>
24 #include <libubox/uloop.h>
26 struct usteer_timeout
{
30 struct usteer_timeout_queue
{
32 struct uloop_timeout timeout
;
33 void (*cb
)(struct usteer_timeout_queue
*q
, struct usteer_timeout
*t
);
37 usteer_timeout_isset(struct usteer_timeout
*t
)
39 return t
->node
.list
.prev
!= NULL
;
42 void usteer_timeout_init(struct usteer_timeout_queue
*q
);
43 void usteer_timeout_set(struct usteer_timeout_queue
*q
, struct usteer_timeout
*t
,
45 void usteer_timeout_cancel(struct usteer_timeout_queue
*q
,
46 struct usteer_timeout
*t
);
47 void usteer_timeout_flush(struct usteer_timeout_queue
*q
);