summaryrefslogtreecommitdiff
path: root/minecproxy/misc.h
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-23 20:56:22 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-23 20:56:22 +0200
commitea053d96f7e89e053d4af8d39b04c5428760345f (patch)
tree8182ca73675ad3933b0f38cb48a99c69101309b4 /minecproxy/misc.h
parent8c27290245b7bcc7cd2f72f3b4a7562294b43bbe (diff)
Big renaming, move some more functionality to shared lib
Diffstat (limited to 'minecproxy/misc.h')
-rw-r--r--minecproxy/misc.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/minecproxy/misc.h b/minecproxy/misc.h
new file mode 100644
index 0000000..6627913
--- /dev/null
+++ b/minecproxy/misc.h
@@ -0,0 +1,36 @@
+#ifndef foomischfoo
+#define foomischfoo
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <linux/if_packet.h>
+
+#include "utils.h"
+
+void debug_resource_usage();
+
+struct connection;
+
+typedef void(*connection_cb_t)(struct connection *, bool);
+
+struct connection {
+ struct saddr remote;
+ struct saddr local;
+
+ struct list_head *addrs;
+ unsigned next_addr;
+
+ connection_cb_t cb;
+};
+
+void connection_set_local(struct connection *conn, int fd);
+
+void connection_set_remote(struct connection *conn, struct saddr *remote);
+
+void connect_any(struct uring_task *task,
+ struct list_head *addrs, struct connection *conn,
+ connection_cb_t cb);
+
+#endif