summaryrefslogtreecommitdiffstats
path: root/src/net-proxy.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net-proxy.h')
-rw-r--r--src/net-proxy.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/net-proxy.h b/src/net-proxy.h
new file mode 100644
index 0000000..bb5da7b
--- /dev/null
+++ b/src/net-proxy.h
@@ -0,0 +1,59 @@
+
+#ifndef NET_PROXY_H
+#define NET_PROXY_H
+
+#include <sys/select.h>
+
+enum {
+ TSNIF_NP_UDP_CLIENT = 0x1,
+ TSNIF_NP_UDP_SERVER = 0x2,
+ TSNIF_NP_TCP_CLIENT = 0x4,
+ TSNIF_NP_TCP_SERVER = 0x8,
+};
+
+enum {
+ TSNIF_NP_PROT_UDP,
+ TSNIF_NP_PROT_TCP,
+ TSNIF_NP_PROT_MAX,
+};
+
+#define TSNIF_NP_CLIENT (TSNIF_NP_UDP_CLIENT | TSNIF_NP_TCP_CLIENT)
+#define TSNIF_NP_UDP (TSNIF_NP_UDP_CLIENT | TSNIF_NP_UDP_SERVER)
+#define TSNIF_NP_TCP (TSNIF_NP_TCP_CLIENT | TSNIF_NP_TCP_SERVER)
+
+struct tsnif_np_args {
+ char *host;
+ int port;
+ int flags;
+};
+
+struct tsnif_np_handle {
+ int fd_udp;
+ int fd_tcp;
+ int flags;
+};
+
+struct tsnif_handle;
+struct trans_msg;
+
+typedef int(*init_server_t)(struct tsnif_handle*, struct tsnif_np_args *args);
+typedef int(*init_client_t)(struct tsnif_handle*, struct tsnif_np_args *args);
+typedef int(*close_t)(struct tsnif_handle*);
+typedef int(*send_t)(struct tsnif_handle*, struct trans_msg *msg);
+typedef int(*process_t)(struct tsnif_handle*);
+
+struct tsnif_np_prot {
+ init_server_t init_server;
+ init_client_t init_client;
+ close_t close;
+ send_t send;
+ process_t process;
+};
+
+int tsnif_np_init(struct tsnif_handle *h, struct tsnif_np_args *np);
+int tsnif_np_fd(struct tsnif_handle *h, fd_set *set);
+int tsnif_np_process(struct tsnif_handle *h, fd_set *set);
+int tsnif_np_close(struct tsnif_handle *h);
+int tsnif_np_send(struct tsnif_handle *h, struct trans_msg *msg);
+
+#endif /* NET_PROXY_H */