diff options
Diffstat (limited to 'src/utils.h')
-rw-r--r-- | src/utils.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h new file mode 100644 index 0000000..ce3b2e0 --- /dev/null +++ b/src/utils.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * utils.h | ||
3 | * | ||
4 | * Copyright (C) 2009 Hector Martin <hector@marcansoft.com> | ||
5 | * Copyright (C) 2009 Nikias Bassen <nikias@gmx.li> | ||
6 | * | ||
7 | * This library is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU Lesser General Public License as | ||
9 | * published by the Free Software Foundation, either version 2.1 of the | ||
10 | * License, or (at your option) any later version. | ||
11 | * | ||
12 | * This library is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | */ | ||
21 | |||
22 | #ifndef UTILS_H | ||
23 | #define UTILS_H | ||
24 | |||
25 | #include <poll.h> | ||
26 | #include <plist/plist.h> | ||
27 | |||
28 | enum fdowner { | ||
29 | FD_LISTEN, | ||
30 | FD_CLIENT, | ||
31 | FD_USB | ||
32 | }; | ||
33 | |||
34 | struct fdlist { | ||
35 | int count; | ||
36 | int capacity; | ||
37 | enum fdowner *owners; | ||
38 | struct pollfd *fds; | ||
39 | }; | ||
40 | |||
41 | void fdlist_create(struct fdlist *list); | ||
42 | void fdlist_add(struct fdlist *list, enum fdowner owner, int fd, short events); | ||
43 | void fdlist_free(struct fdlist *list); | ||
44 | void fdlist_reset(struct fdlist *list); | ||
45 | |||
46 | uint64_t mstime64(void); | ||
47 | void get_tick_count(struct timeval * tv); | ||
48 | |||
49 | #endif | ||