From 31afd2aaaeb76a12e232eab0fb6a550b73948737 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Mon, 22 Jun 2020 10:50:15 +0200 Subject: Make struct cfg global and make the corresponding changes throughout --- utils.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'utils.h') 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); -- cgit v1.2.3