-extern void retry_outgoing(outgoing_t *);
-extern void handle_incoming_vpn_data(int, short, void *);
-extern void finish_connecting(struct connection_t *);
-extern bool do_outgoing_connection(struct connection_t *);
-extern void handle_new_meta_connection(int, short, void *);
-extern int setup_listen_socket(const sockaddr_t *);
-extern int setup_vpn_in_socket(const sockaddr_t *);
-extern void send_packet(struct node_t *, vpn_packet_t *);
-extern void receive_tcppacket(struct connection_t *, const char *, int);
-extern void broadcast_packet(const struct node_t *, vpn_packet_t *);
-extern bool setup_network(void);
-extern void setup_outgoing_connection(struct outgoing_t *);
-extern void try_outgoing_connections(void);
-extern void close_network_connections(void);
-extern int main_loop(void);
-extern void terminate_connection(struct connection_t *, bool);
-extern void flush_queue(struct node_t *);
-extern bool node_read_ecdsa_public_key(struct node_t *);
-extern bool read_ecdsa_public_key(struct connection_t *);
-extern bool read_rsa_public_key(struct connection_t *);
-extern void send_mtu_probe(struct node_t *);
-extern void handle_device_data(int, short, void *);
-extern void handle_meta_connection_data(int, short, void *);
-extern void regenerate_key(void);
-extern void purge(void);
-extern void retry(void);
-extern int reload_configuration(void);
-extern void load_all_subnets(void);
+void init_outgoings(struct meshlink_handle *mesh);
+void exit_outgoings(struct meshlink_handle *mesh);
+
+void retry_outgoing(struct meshlink_handle *mesh, outgoing_t *);
+void handle_incoming_vpn_data(struct event_loop_t *loop, void *, int);
+void finish_connecting(struct meshlink_handle *mesh, struct connection_t *);
+void do_outgoing_connection(struct meshlink_handle *mesh, struct outgoing_t *);
+void handle_new_meta_connection(struct event_loop_t *loop, void *, int);
+int setup_tcp_listen_socket(struct meshlink_handle *mesh, const struct addrinfo *aip) __attribute__((__warn_unused_result__));
+int setup_udp_listen_socket(struct meshlink_handle *mesh, const struct addrinfo *aip) __attribute__((__warn_unused_result__));
+bool send_sptps_data(void *handle, uint8_t type, const void *data, size_t len);
+bool receive_sptps_record(void *handle, uint8_t type, const void *data, uint16_t len) __attribute__((__warn_unused_result__));
+void send_packet(struct meshlink_handle *mesh, struct node_t *, struct vpn_packet_t *);
+char *get_name(struct meshlink_handle *mesh) __attribute__((__warn_unused_result__));
+void load_all_nodes(struct meshlink_handle *mesh);
+bool setup_myself_reloadable(struct meshlink_handle *mesh) __attribute__((__warn_unused_result__));
+bool setup_network(struct meshlink_handle *mesh) __attribute__((__warn_unused_result__));
+void reset_outgoing(struct outgoing_t *);
+void setup_outgoing_connection(struct meshlink_handle *mesh, struct outgoing_t *);
+void close_network_connections(struct meshlink_handle *mesh);
+void main_loop(struct meshlink_handle *mesh);
+void terminate_connection(struct meshlink_handle *mesh, struct connection_t *, bool);
+bool node_read_public_key(struct meshlink_handle *mesh, struct node_t *) __attribute__((__warn_unused_result__));
+bool node_read_from_config(struct meshlink_handle *mesh, struct node_t *, const config_t *config) __attribute__((__warn_unused_result__));
+bool read_ecdsa_public_key(struct meshlink_handle *mesh, struct connection_t *) __attribute__((__warn_unused_result__));
+bool read_ecdsa_private_key(struct meshlink_handle *mesh) __attribute__((__warn_unused_result__));
+bool node_write_config(struct meshlink_handle *mesh, struct node_t *) __attribute__((__warn_unused_result__));
+void send_mtu_probe(struct meshlink_handle *mesh, struct node_t *);
+void handle_meta_connection_data(struct meshlink_handle *mesh, struct connection_t *);
+void retry(struct meshlink_handle *mesh);
+int check_port(struct meshlink_handle *mesh);