aboutsummaryrefslogtreecommitdiff
path: root/src/pevent.h
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-05-08 00:40:59 +0200
committerToni Uhlig <matzeton@googlemail.com>2018-05-08 00:40:59 +0200
commitdad140b0a494c416532a546fdd034dc27ad05b8c (patch)
tree99471393f2cc5feea300a320f086a91532e4f314 /src/pevent.h
parentbe4352e2bb6ffcc1d548cf9e8cf9f497e2865af0 (diff)
POTD skeleton #45.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/pevent.h')
-rw-r--r--src/pevent.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pevent.h b/src/pevent.h
index da09f59..c7b61e1 100644
--- a/src/pevent.h
+++ b/src/pevent.h
@@ -8,17 +8,25 @@
#define POTD_MAXFD 32
#define POTD_MAXEVENTS 64
+typedef enum forward_state {
+ CON_OK, CON_IN_TERMINATED, CON_OUT_TERMINATED,
+ CON_IN_ERROR, CON_OUT_ERROR
+} forward_state;
+
typedef struct event_ctx {
int epoll_fd;
int active;
struct epoll_event events[POTD_MAXEVENTS];
+ int current_event;
} event_ctx;
-typedef int (*on_event_cb) (int fd, void *user_data);
+typedef int (*on_event_cb) (event_ctx *ev_ctx, int fd, void *user_data);
void event_init(event_ctx **ctx);
+void event_free(event_ctx **ctx);
+
int event_setup(event_ctx *ctx);
int event_add_sock(event_ctx *ctx, psocket *sock);
@@ -27,4 +35,7 @@ int event_add_fd(event_ctx *ctx, int fd);
int event_loop(event_ctx *ctx, on_event_cb on_event, void *user_data);
+forward_state
+event_forward_connection(event_ctx *ctx, int dest_fd);
+
#endif