summaryrefslogtreecommitdiff
path: root/server.h
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-05 14:09:18 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-05 14:09:18 +0200
commitdb66484c4300f5f0e857eff01d15fd3593002a79 (patch)
treea787b9f0da1243ae0391d5931ecb9cb0f29d3ee4 /server.h
Initial commit
Diffstat (limited to 'server.h')
-rw-r--r--server.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/server.h b/server.h
new file mode 100644
index 0000000..d066588
--- /dev/null
+++ b/server.h
@@ -0,0 +1,51 @@
+#ifndef fooserverhfoo
+#define fooserverhfoo
+
+enum server_type {
+ SERVER_TYPE_UNDEFINED,
+ SERVER_TYPE_ANNOUNCE,
+ SERVER_TYPE_PROXY
+};
+
+struct server {
+ enum server_type type;
+ char *name;
+ char *pretty_name;
+ uint16_t announce_port;
+ struct list_head locals;
+ struct list_head remotes;
+ struct list_head proxys;
+ bool running;
+
+ struct uring_task task;
+ char buf[4096];
+ size_t len;
+ struct list_head list;
+};
+
+void server_refdump(struct server *server);
+
+void server_delete(struct cfg *cfg, struct server *scfg);
+
+void server_delete_by_name(struct cfg *cfg, const char *name);
+
+bool server_commit(struct cfg *cfg, struct server *scfg);
+
+bool server_add_remote(struct cfg *cfg, struct server *scfg,
+ struct sockaddr_in46 *remote);
+
+bool server_add_local(struct cfg *cfg, struct server *scfg,
+ struct sockaddr_in46 *local);
+
+bool server_set_port(struct cfg *cfg, struct server *scfg, uint16_t port);
+
+bool server_set_type(struct cfg *cfg, struct server *scfg,
+ enum server_type type);
+
+bool server_set_pretty_name(struct cfg *cfg, struct server *scfg,
+ const char *pretty_name);
+
+struct server *server_new(struct cfg *cfg, const char *name);
+
+#endif
+