summaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-22 10:50:15 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-22 10:50:15 +0200
commit31afd2aaaeb76a12e232eab0fb6a550b73948737 (patch)
tree7125a54d09904eef6c558a682cff0a7976529fad /utils.h
parent41dc97f5d0dbcfe4399656c9aabb597f6366ca23 (diff)
Make struct cfg global and make the corresponding changes throughout
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/utils.h b/utils.h
index 3e807bc..ff29d6c 100644
--- a/utils.h
+++ b/utils.h
@@ -49,6 +49,10 @@ struct saddr {
struct list_head list;
};
+struct connection;
+
+typedef void(*connection_cb_t)(struct connection *, bool);
+
struct connection {
struct saddr remote;
struct saddr local;
@@ -56,21 +60,20 @@ struct connection {
struct list_head *addrs;
unsigned next_addr;
- void (*callback)(struct cfg *, struct connection *, bool);
+ connection_cb_t cb;
};
struct uring_task;
-void socket_set_low_latency(struct cfg *cfg, int sfd);
+void socket_set_low_latency(int sfd);
-void connection_set_local(struct cfg *cfg, struct connection *conn, int fd);
+void connection_set_local(struct connection *conn, int fd);
-void connection_set_remote(struct cfg *cfg, struct connection *conn,
- struct saddr *remote);
+void connection_set_remote(struct connection *conn, struct saddr *remote);
-void connect_any(struct cfg *cfg, struct uring_task *task,
+void connect_any(struct uring_task *task,
struct list_head *addrs, struct connection *conn,
- void (*callback)(struct cfg *, struct connection *, bool));
+ connection_cb_t cb);
char *saddr_addr(struct saddr *saddr, char *buf, size_t len);