diff options
author | Kozlov Dmitry <dima@server> | 2010-10-06 16:55:05 +0400 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-10-06 16:55:05 +0400 |
commit | 45b3c9c5bdd896f51f47e29069e3c030ddb17d51 (patch) | |
tree | cbec5824ffb2eee20b98ad9892a357304384ff01 /accel-pptpd/triton/triton_p.h | |
parent | ba3db9f17477ea4b49c266c5cb50f63f3b074db2 (diff) | |
parent | 01ccd98495c9da1e79f7867bf52416b23f20200d (diff) | |
download | accel-ppp-45b3c9c5bdd896f51f47e29069e3c030ddb17d51.tar.gz accel-ppp-45b3c9c5bdd896f51f47e29069e3c030ddb17d51.zip |
merged branch accel-pptpd
Diffstat (limited to 'accel-pptpd/triton/triton_p.h')
-rw-r--r-- | accel-pptpd/triton/triton_p.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/accel-pptpd/triton/triton_p.h b/accel-pptpd/triton/triton_p.h new file mode 100644 index 00000000..c685051a --- /dev/null +++ b/accel-pptpd/triton/triton_p.h @@ -0,0 +1,105 @@ +#ifndef TRITON_P_H +#define TRITON_P_H + +#include <pthread.h> +#include <sys/epoll.h> +#include <ucontext.h> + +#include "triton.h" +#include "list.h" +#include "spinlock.h" +#include "mempool.h" + +#define CTX_STACK_SIZE 8196 + +struct _triton_thread_t +{ + struct list_head entry; + struct list_head entry2; + pthread_t thread; + int terminate:1; + struct _triton_context_t *ctx; + ucontext_t uctx; +}; + +struct _triton_context_t +{ + struct list_head entry; + struct list_head entry2; + + spinlock_t lock; + struct _triton_thread_t *thread; + + struct list_head handlers; + struct list_head timers; + struct list_head pending_handlers; + struct list_head pending_timers; + struct list_head pending_calls; + + ucontext_t uctx; + + int queued:1; + int sleeping:1; + int wakeup:1; + int need_close:1; + int need_free:1; + int pending:1; + + struct triton_context_t *ud; + void *bf_arg; +}; + +struct _triton_md_handler_t +{ + struct list_head entry; + struct list_head entry2; + struct _triton_context_t *ctx; + struct epoll_event epoll_event; + uint32_t trig_epoll_events; + int pending:1; + int trig_level: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_context_t *ctx; + int fd; + int pending:1; + struct triton_timer_t *ud; +}; + +struct _triton_event_t +{ + struct list_head handlers; +}; + +struct _triton_ctx_call_t +{ + struct list_head entry; + + void *arg; + void (*func)(void *); +}; + +int log_init(void); +int md_init(); +int timer_init(); +int event_init(); + +void md_run(); +void md_terminate(); +void timer_run(); +void timer_terminate(); +struct triton_context_t *default_ctx; +int triton_queue_ctx(struct _triton_context_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,...); +int load_modules(const char *name); + +#endif |