diff options
author | Kozlov Dmitry <dima@server> | 2010-09-03 14:00:45 +0400 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-09-03 14:00:45 +0400 |
commit | 935c25b34dba5d22372de3f792dd806db6d729a8 (patch) | |
tree | 2d4916ec75b5750f8ee0b8f06dbb1fc55e9f6add /accel-pptpd/triton/triton_p.h | |
parent | b43d224c8a306ff54bbb913c5aab891f82541f6e (diff) | |
download | accel-ppp-935c25b34dba5d22372de3f792dd806db6d729a8.tar.gz accel-ppp-935c25b34dba5d22372de3f792dd806db6d729a8.zip |
rewrited triton library
Diffstat (limited to 'accel-pptpd/triton/triton_p.h')
-rw-r--r-- | accel-pptpd/triton/triton_p.h | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/accel-pptpd/triton/triton_p.h b/accel-pptpd/triton/triton_p.h index 385f3558..24850bfd 100644 --- a/accel-pptpd/triton/triton_p.h +++ b/accel-pptpd/triton/triton_p.h @@ -1,8 +1,66 @@ #ifndef TRITON_P_H #define TRITON_P_H +#include <pthread.h> +#include <sys/epoll.h> + #include "triton.h" #include "list.h" +#include "spinlock.h" + +struct _triton_thread_t +{ + struct list_head entry; + struct list_head entry2; + pthread_t thread; + int terminate:1; + struct _triton_ctx_t *ctx; +}; + +struct _triton_ctx_t +{ + struct list_head entry; + struct list_head entry2; + spinlock_t lock; + struct list_head handlers; + struct list_head timers; + + struct _triton_thread_t *thread; + struct list_head pending_handlers; + struct list_head pending_timers; + int queued:1; + int need_close:1; + int need_free:1; + + struct triton_ctx_t *ud; +}; + +struct _triton_md_handler_t +{ + struct list_head entry; + struct list_head entry2; + struct _triton_ctx_t *ctx; + struct epoll_event epoll_event; + uint32_t trig_epoll_events; + int pending:1; + struct triton_md_handler_t *ud; +}; + +struct _triton_timer_t +{ + struct list_head entry; + struct list_head entry2; + struct epoll_event epoll_event; + struct _triton_ctx_t *ctx; + int fd; + int pending:1; + struct triton_timer_t *ud; +}; + +typedef void * mempool_t; +mempool_t *mempool_create(int size); +void *mempool_alloc(mempool_t*); +void mempool_free(void*); int log_init(void); int md_init(); @@ -12,8 +70,8 @@ int timer_init(); void timer_run(); void timer_terminate(); struct triton_ctx_t *default_ctx; -int triton_queue_ctx(struct triton_ctx_t*); -void triton_thread_wakeup(struct triton_thread_t*); +int triton_queue_ctx(struct _triton_ctx_t*); +void triton_thread_wakeup(struct _triton_thread_t*); int conf_load(const char *fname); void triton_log_error(const char *fmt,...); void triton_log_debug(const char *fmt,...); |