1 /* 2 * timer.h a shim layer around osmo timer to use libubox/uloop timers 3 * 4 * Copyright (C) 2023 Alexander Couzens <lynxis@fe80.eu> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the 18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301 USA. 20 */ 21 22 #pragma once 23 24 #include <libubox/uloop.h> 25 26 /* add a simple layer struct to allow to support the *data pointer in libubox */ 27 struct pipe_timer { 28 struct uloop_timeout timeout; 29 void (*cb)(void*); 30 void *data; 31 }; 32 33 /* struct osmo_timer_list -> struct uloop_timeout */ 34 #define osmo_timer_list pipe_timer 35 36 void osmo_timer_setup(struct pipe_timer *timer, void (*cb)(void *data), void *data); 37 void osmo_timer_add(struct pipe_timer *timer); 38 void osmo_timer_schedule(struct pipe_timer *timer, int seconds, int microseconds); 39 void osmo_timer_del(struct pipe_timer *timer); 40 int osmo_timer_pending(const struct pipe_timer *timer); 41 int osmo_timer_remaining(struct pipe_timer *timer, 42 const struct timeval *now, 43 struct timeval *remaining); 44
This page was automatically generated by LXR 0.3.1. • OpenWrt