summaryrefslogtreecommitdiff
path: root/accel-pptpd/triton/triton.h
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-09-03 14:00:45 +0400
committerKozlov Dmitry <dima@server>2010-09-03 14:00:45 +0400
commit935c25b34dba5d22372de3f792dd806db6d729a8 (patch)
tree2d4916ec75b5750f8ee0b8f06dbb1fc55e9f6add /accel-pptpd/triton/triton.h
parentb43d224c8a306ff54bbb913c5aab891f82541f6e (diff)
downloadaccel-ppp-935c25b34dba5d22372de3f792dd806db6d729a8.tar.gz
accel-ppp-935c25b34dba5d22372de3f792dd806db6d729a8.zip
rewrited triton library
Diffstat (limited to 'accel-pptpd/triton/triton.h')
-rw-r--r--accel-pptpd/triton/triton.h63
1 files changed, 9 insertions, 54 deletions
diff --git a/accel-pptpd/triton/triton.h b/accel-pptpd/triton/triton.h
index 2cc4edb4..2543a234 100644
--- a/accel-pptpd/triton/triton.h
+++ b/accel-pptpd/triton/triton.h
@@ -2,79 +2,35 @@
#define TRITON_H
#include <sys/time.h>
-#include <pthread.h>
-#include <sys/epoll.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;
-
+ const void *tpd; // triton private data, don't touch!
void (*close)(struct triton_ctx_t*);
void (*free)(struct triton_ctx_t*);
};
struct triton_md_handler_t
{
- //triton part
- //==========
- 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;
- //=========
-
- //user part
- //=========
+ const void *tpd; // triton private data, don't touch!
int fd;
-
int (*read)(struct triton_md_handler_t *);
int (*write)(struct triton_md_handler_t *);
- //=========
};
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;
-
+ const void *tpd; // triton private data, don't touch!
struct timeval expire_tv;
int period;
- int (*expire)(struct triton_timer_t *);
+ void (*expire)(struct triton_timer_t *);
};
struct conf_option_t
{
struct list_head entry;
-
char *name;
char *val;
};
@@ -90,14 +46,14 @@ 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_register_handler(struct triton_ctx_t *, struct triton_md_handler_t *);
void triton_md_unregister_handler(struct triton_md_handler_t *h);
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);
-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*);
+int triton_timer_add(struct triton_ctx_t *ctx, 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 *);
struct conf_sect_t *conf_get_section(const char *name);
char *conf_get_opt(const char *sect, const char *name);
@@ -117,6 +73,7 @@ void triton_terminate(void);
#define __init __attribute__((constructor))
+#define __export __attribute__((visibility("default")))
#undef offsetof
#ifdef __compiler_offsetof
@@ -129,6 +86,4 @@ void triton_terminate(void);
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
-#define __export __attribute__((visibility("default")))
-
#endif