]> rtime.felk.cvut.cz Git - can-usb1.git/blob - ulan/host/libs4c/ulevloop/ul_evp_sysvpoll.h
Initializing repo
[can-usb1.git] / ulan / host / libs4c / ulevloop / ul_evp_sysvpoll.h
1 /*******************************************************************
2   uLan Utilities Library - C library of basic reusable constructions
3
4   ul_evpollint.h        - monitoring of open file handles
5
6   (C) Copyright 2006 by Pavel Pisa - Originator
7
8   The uLan utilities library can be used, copied and modified under
9   next licenses
10     - GPL - GNU General Public License
11     - LGPL - GNU Lesser General Public License
12     - MPL - Mozilla Public License
13     - and other licenses added by project originators
14   Code can be modified and re-distributed under any combination
15   of the above listed licenses. If contributor does not agree with
16   some of the licenses, he/she can delete appropriate line.
17   Warning, if you delete all lines, you are not allowed to
18   distribute source code and/or binaries utilizing code.
19
20   See files COPYING and README for details.
21
22  *******************************************************************/
23
24 #ifndef _UL_EVPOLLINT_H
25 #define _UL_EVPOLLINT_H
26
27 #include "ul_utdefs.h"
28
29 #include <string.h>
30
31 #include "ul_evpoll.h"
32 #include <ul_list.h>
33 #include <ul_htimer.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #define UL_EVPSIMPLE_ARMED    0x01
40 #define UL_EVPSIMPLE_ONCE     0x02
41 #define UL_EVPSIMPLE_TIMED    0x04
42 #define UL_EVPSIMPLE_TIMEOUT  0x08
43 #define UL_EVPSIMPLE_PERIODIC 0x10
44
45 typedef struct ul_evptrig_data_t {
46   unsigned flags;
47   unsigned what_events;
48
49   ul_evfd_t      fd;
50   int            idx;
51
52   ul_htim_diff_t timeout;
53   ul_htim_node_t htim;
54
55   ul_list_node_t list_node;
56
57   ul_evptrig_t *trig_ptr;
58
59 } ul_evptrig_simple_t;
60
61 typedef struct ul_evpbase_simple_t {
62   ul_evpbase_t base;
63
64   ul_evptrig_simple_t **trig_array;
65   struct pollfd *pollfd_array;
66   int pollfd_count;
67   int pollfd_capacity;
68
69   int need_resync:1;
70   int time_next_expire_fl:1;
71   int quit_loop:1;
72
73   int            activefd_count;
74   ul_list_head_t active_list;
75   ul_list_head_t idle_list;
76
77   ul_htim_time_t time_act;
78   ul_htim_time_t time_next_expire;
79   ul_htim_queue_t htim_queue;
80
81 } ul_evpbase_simple_t;
82
83
84 UL_LIST_CUST_DEC(ul_evpsimple_active, ul_evpbase_simple_t, ul_evptrig_simple_t,
85                 active_list, list_node)
86
87 UL_LIST_CUST_DEC(ul_evpsimple_idle, ul_evpbase_simple_t, ul_evptrig_simple_t,
88                 idle_list, list_node)
89
90 extern const ul_evpoll_ops_t ul_evpoll_ops_simple;
91
92 #ifdef __cplusplus
93 } /* extern "C"*/
94 #endif
95
96 #endif /* _UL_EVPOLLINT_H */