diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2018-05-06 22:22:47 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2018-05-06 22:22:47 +0200 |
commit | 14d2b4d0134ac00a6262d5c8229ffe0d3b5ecd48 (patch) | |
tree | 1803619405ed6733390198db2f322746eb31accd /src/forward.h | |
parent | 9653d78388348ebd47b820a0d9d95bbd885973a0 (diff) |
POTD skeleton #43.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/forward.h')
-rw-r--r-- | src/forward.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/forward.h b/src/forward.h index 60c7500..1676c1b 100644 --- a/src/forward.h +++ b/src/forward.h @@ -15,8 +15,12 @@ typedef struct fwd_callbacks { on_shutdown_cb on_shutdown; } fwd_callbacks; +typedef enum forward_type { + FT_NONE = 0, FT_CLIENT, FT_SERVER +} forward_type; + typedef struct forward_ctx { - pthread_t self; + forward_type fwd_type; fwd_callbacks fwd_cbs; psocket sock; char host_buf[NI_MAXHOST], service_buf[NI_MAXSERV]; @@ -26,12 +30,15 @@ typedef struct forward_ctx { int fwd_init_ctx(forward_ctx **ctx, init_cb init_fn); -int fwd_setup(forward_ctx *ctx, const char *host, const char *port); +int fwd_setup_client(forward_ctx *ctx, const char *host, const char *port); + +int fwd_setup_server(forward_ctx *ctx, const char *listen_addr, + const char *listen_port); int fwd_validate_ctx(const forward_ctx *ctx); int fwd_connect_sock(forward_ctx *ctx, psocket *fwd_client); -int fwd_listen_fd(forward_ctx *ctx, int fwd_fd); +int fwd_listen_sock(forward_ctx *ctx, psocket *fwd_server); #endif |