]> git.meshlink.io Git - meshlink/blobdiff - src/net.h
Add support for opening a MeshLink instance without permanent storage.
[meshlink] / src / net.h
index 0ff313d0bdafd1d7f120082e46413629aad62ab0..74090ce80dbf37507b2dd38cf59770149901c1e6 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -59,15 +59,19 @@ typedef enum packet_type_t {
 #include "list.h"
 
 typedef struct outgoing_t {
-       char *name;
+       struct node_t *node;
+       enum {
+               OUTGOING_START,
+               OUTGOING_CANONICAL,
+               OUTGOING_RECENT,
+               OUTGOING_KNOWN,
+               OUTGOING_END,
+               OUTGOING_NO_KNOWN_ADDRESSES,
+       } state;
        int timeout;
-       struct splay_tree_t *config_tree;
-       struct config_t *cfg;
-       struct addrinfo *ai; // addresses from config files
-       struct addrinfo *aip;
-       struct addrinfo *nai; // addresses known via other online nodes (use free_known_addresses())
        timeout_t ev;
-       struct meshlink_handle *mesh;
+       struct addrinfo *ai;
+       struct addrinfo *aip;
 } outgoing_t;
 
 extern int maxoutbufsize;
@@ -81,6 +85,9 @@ extern bool do_prune;
 #include "connection.h"
 #include "node.h"
 
+extern void init_outgoings(struct meshlink_handle *mesh);
+extern void exit_outgoings(struct meshlink_handle *mesh);
+
 extern void retry_outgoing(struct meshlink_handle *mesh, outgoing_t *);
 extern void handle_incoming_vpn_data(struct event_loop_t *loop, void *, int);
 extern void finish_connecting(struct meshlink_handle *mesh, struct connection_t *);
@@ -97,13 +104,15 @@ extern void load_all_nodes(struct meshlink_handle *mesh);
 extern bool setup_myself_reloadable(struct meshlink_handle *mesh);
 extern bool setup_network(struct meshlink_handle *mesh);
 extern void setup_outgoing_connection(struct meshlink_handle *mesh, struct outgoing_t *);
-extern void try_outgoing_connections(struct meshlink_handle *mesh);
 extern void close_network_connections(struct meshlink_handle *mesh);
 extern int main_loop(struct meshlink_handle *mesh);
 extern void terminate_connection(struct meshlink_handle *mesh, struct connection_t *, bool);
-extern bool node_read_ecdsa_public_key(struct meshlink_handle *mesh, struct node_t *);
+extern bool node_read_public_key(struct meshlink_handle *mesh, struct node_t *);
+extern bool node_read_full(struct meshlink_handle *mesh, struct node_t *);
+extern bool node_read_from_config(struct meshlink_handle *mesh, struct node_t *, const config_t *config);
 extern bool read_ecdsa_public_key(struct meshlink_handle *mesh, struct connection_t *);
 extern bool read_ecdsa_private_key(struct meshlink_handle *mesh);
+extern bool node_write_config(struct meshlink_handle *mesh, struct node_t *);
 extern void send_mtu_probe(struct meshlink_handle *mesh, struct node_t *);
 extern void handle_meta_connection_data(struct meshlink_handle *mesh, struct connection_t *);
 extern void retry(struct meshlink_handle *mesh);