udphole

Basic UDP wormhole proxy
git clone git://git.finwo.net/app/udphole
Log | Files | Refs | README | LICENSE

scheduler.h (596B)


      1 #ifndef UDPHOLE_SCHEDULER_H
      2 #define UDPHOLE_SCHEDULER_H
      3 
      4 #include <stdint.h>
      5 #include <sys/select.h>
      6 
      7 #define SCHED_RUNNING 0
      8 #define SCHED_DONE    1
      9 #define SCHED_ERROR   2
     10 
     11 struct pt_task;
     12 
     13 typedef int (*pt_task_fn)(int64_t timestamp, struct pt_task *task);
     14 
     15 typedef struct pt_task {
     16   struct pt_task *next;
     17   pt_task_fn      func;
     18   void           *udata;
     19   char            is_active;
     20   int             maxfd;
     21 } pt_task_t;
     22 
     23 int sched_create(pt_task_fn fn, void *udata);
     24 int sched_remove(pt_task_t *task);
     25 int sched_main(void);
     26 
     27 int sched_has_data(int *in_fds);
     28 
     29 #endif  // UDPHOLE_SCHEDULER_H