src/server/daemon/event.h

changeset 541
1e1fca11aaff
parent 531
9b15b1f72bef
child 542
1327febf99c4
--- a/src/server/daemon/event.h	Sun Aug 11 10:09:20 2024 +0200
+++ b/src/server/daemon/event.h	Sun Aug 11 13:26:17 2024 +0200
@@ -35,6 +35,8 @@
 #ifdef	__cplusplus
 extern "C" {
 #endif
+    
+#define EV_MAX_EVENTS 32
 
 typedef struct EVHandler {
     EventHandler **instances;
@@ -54,6 +56,35 @@
     int ret;
 } EVReturn;
 
+typedef struct EVWatchList EVWatchList;
+typedef void(*evwatchlist_destroyfunc)(EventHandler *h, EVWatchList *item, void *data);
+
+struct EVWatchList {
+    time_t created;
+    time_t expire;
+    evwatchlist_destroyfunc destroy;
+    void *destroydata;
+    EVWatchList *prev;
+    EVWatchList *next;
+};
+
+
+typedef struct EventHandler {
+    /*
+     * return call list
+     */
+    EVReturn fnreturn[EV_MAX_EVENTS];
+    /*
+     * number of fnreturn entries
+     */
+    int numret;
+    
+    EVWatchList *watchlist_begin;
+    EVWatchList *watchlist_end;
+} EventHandler;
+
+
+
 int create_event_handler(EventHandlerConfig *cfg);
 
 int check_event_handler_cfg();
@@ -64,6 +95,11 @@
 
 EventHandler* ev_instance(EVHandler *ev);
 
+void watchlist_add(EVWatchList **begin, EVWatchList **end, EVWatchList *elm);
+void watchlist_remove(EVWatchList **begin, EVWatchList **end, EVWatchList *elm);
+
+void watchlist_check(EventHandler *h, time_t t);
+
 /* implementation in event_$platform */
 EVHandler* evhandler_create(EventHandlerConfig *cfg);
 
@@ -77,6 +113,9 @@
 
 void ev_saf_return(EventHandler *h, Session *sn, Request *rq, int ret);
 
+void ev_watchlist_add(EventHandler *h, EVWatchList *elm);
+void ev_watchlist_remove(EventHandler *h, EVWatchList *elm);
+
 
 #ifdef	__cplusplus
 }

mercurial