summaryrefslogtreecommitdiff
path: root/accel-pptpd/triton/triton.h
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pptpd/triton/triton.h')
-rw-r--r--accel-pptpd/triton/triton.h61
1 files changed, 39 insertions, 22 deletions
diff --git a/accel-pptpd/triton/triton.h b/accel-pptpd/triton/triton.h
index 0e9b73bf..73640219 100644
--- a/accel-pptpd/triton/triton.h
+++ b/accel-pptpd/triton/triton.h
@@ -5,11 +5,13 @@
#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;
@@ -23,11 +25,15 @@ struct triton_ctx_t
struct list_head handlers;
struct list_head timers;
- triton_thread_t *thread;
+ struct triton_thread_t *thread;
struct list_head pending_handlers;
struct list_head pending_timers;
int queued:1;
- int close:1;
+ int need_close:1;
+ int need_free:1;
+
+ void (*close)(struct triton_ctx_t*);
+ void (*free)(struct triton_ctx_t*);
};
struct triton_md_handler_t
@@ -38,7 +44,7 @@ struct triton_md_handler_t
struct list_head entry2;
struct triton_ctx_t *ctx;
struct epoll_event epoll_event;
- uint32_t trig_epoll_event;
+ uint32_t trig_epoll_events;
int pending:1;
//=========
@@ -48,14 +54,16 @@ struct triton_md_handler_t
int (*read)(struct triton_md_handler_t *);
int (*write)(struct triton_md_handler_t *);
- void (*close)(struct triton_md_handler_t *);
//=========
};
struct triton_timer_t
{
struct list_head entry;
- int active;
+ struct list_head entry2;
+ struct epoll_event epoll_event;
+ struct triton_ctx_t *ctx;
+ int fd;
int pending:1;
struct timeval expire_tv;
@@ -63,28 +71,36 @@ struct triton_timer_t
int (*expire)(struct triton_timer_t *);
};
+struct conf_option_t
+{
+ struct list_head entry;
+
+ char *name;
+ char *val;
+};
+
+struct conf_sect_t
+{
+ const char *name;
+ struct list_head items;
+};
+
+void triton_register_ctx(struct triton_ctx_t *);
+void triton_unregister_ctx(struct triton_ctx_t *);
+
#define MD_MODE_READ 1
#define MD_MODE_WRITE 2
void triton_md_register_handler(struct triton_md_handler_t *h);
void triton_md_unregister_handler(struct triton_md_handler_t *h);
-void triton_md_enable_handler(struct triton_md_handler_t *h, int mode);
-void triton_md_disable_handler(struct triton_md_handler_t *h,int mode);
-void triton_md_set_timeout(struct triton_md_handler_t *h, int msec);
+int triton_md_enable_handler(struct triton_md_handler_t *h, int mode);
+int triton_md_disable_handler(struct triton_md_handler_t *h,int mode);
-void triton_timer_add(struct triton_timer_t*);
+int triton_timer_add(struct triton_timer_t*,int abs_time);
+int triton_timer_mod(struct triton_timer_t*,int abs_time);
void triton_timer_del(struct triton_timer_t*);
-typedef void (*triton_ss_func)(void);
-void triton_timer_single_shot1(int twait,triton_ss_func,int argc,...);
-void triton_timer_single_shot2(struct timeval *shot_tv,triton_ss_func,int argc,...);
-void triton_timer_single_shot3(int tv_sec,int tv_usec,triton_ss_func,int argc,...);
-
-int triton_get_int_option(const char *str);
-const char* triton_get_str_option(const char *str);
-double triton_get_double_option(const char *str);
-
-void triton_terminate(void);
-void triton_process_events(void);
+struct conf_sect_t *conf_get_section(const char *name);
+char *conf_get_opt(const char *sect, const char *name);
#define TRITON_OK 0
#define TRITON_ERR_NOCOMP -1
@@ -96,6 +112,7 @@ void triton_process_events(void);
#define TRITON_ERR_BUSY -5
int triton_init(const char *conf_file);
-int triton_run(int (*post_init)(void*),void *arg);
+void triton_run(void);
+void triton_terminate(void);
#endif