summaryrefslogtreecommitdiff
path: root/accel-pptpd/triton/triton.h
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-08-03 13:28:53 +0400
committerKozlov Dmitry <dima@server>2010-08-03 13:28:53 +0400
commit5a2d6079eba1c7e2a9479cb10d714b5a97bbfe4f (patch)
treee72134e47e1491580af15e3eccbba451f13fdd42 /accel-pptpd/triton/triton.h
parentba8e1a64e75930a161afac9048e7d03b7f880644 (diff)
downloadaccel-ppp-5a2d6079eba1c7e2a9479cb10d714b5a97bbfe4f.tar.gz
accel-ppp-5a2d6079eba1c7e2a9479cb10d714b5a97bbfe4f.zip
initiating work on accel-pptpd, replacement of modified poptop
Diffstat (limited to 'accel-pptpd/triton/triton.h')
-rw-r--r--accel-pptpd/triton/triton.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/accel-pptpd/triton/triton.h b/accel-pptpd/triton/triton.h
new file mode 100644
index 0000000..b726076
--- /dev/null
+++ b/accel-pptpd/triton/triton.h
@@ -0,0 +1,78 @@
+#ifndef TRITON_H
+#define TRITON_H
+
+#include <sys/time.h>
+
+struct triton_md_handler_t
+{
+ int fd;
+ int twait;
+ void *pd;
+
+ void (*read)(struct triton_md_handler_t *h);
+ void (*write)(struct triton_md_handler_t *h);
+ void (*timeout)(struct triton_md_handler_t *h);
+};
+
+#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);
+int triton_md_wait(struct triton_md_handler_t *h);
+int triton_md_wait2(int fd,int mode,int timeout);
+
+struct triton_timer_t
+{
+ struct timeval expire_tv;
+ int period;
+ void *pd;
+ int active;
+
+ int (*expire)(struct triton_timer_t*);
+};
+
+void triton_timer_add(struct triton_timer_t*);
+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,...);
+
+typedef void (*triton_event_func)(void);
+void triton_event_register_handler(int ev_id,triton_event_func,int argc,...);
+void triton_event_unregister_handler(int ev_id,triton_event_func);
+void triton_event_fire(int ev_id,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);
+
+#ifdef USE_CORO
+#define DEF_COROUTINE_STACK 64*1024
+typedef void (*triton_coroutine_func)(void*);
+long int triton_coroutine_create(int stack_size,triton_coroutine_func func,void *arg,int run);
+void triton_coroutine_delete(long int id);
+void triton_coroutine_wakeup(long int id);
+void triton_coroutine_schedule();
+int triton_coroutine_schedule_timeout(int msec);
+#endif
+
+#define TRITON_OK 0
+#define TRITON_ERR_NOCOMP -1
+#define TRITON_ERR_NOSUPP -2
+#define TRITON_ERR_NOINTF -3
+#define TRITON_ERR_EXISTS -4
+#define TRITON_ERR_NOCHAN -5
+#define TRITON_ERR_NOMSG -6
+#define TRITON_ERR_BUSY -5
+
+int triton_init(const char *conf_file);
+int triton_run(int (*post_init)(void*),void *arg);
+
+#endif