]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink_internal.h
Speed up reconnections on network interface changes.
[meshlink] / src / meshlink_internal.h
index a650083a337e14a177faac0beb6507cdcbafdb15..b31c16eb1cc3b92fef8bd1373f9c07573a11e2d9 100644 (file)
@@ -41,6 +41,9 @@ static const char meshlink_invitation_label[] = "MeshLink invitation";
 static const char meshlink_tcp_label[] = "MeshLink TCP";
 static const char meshlink_udp_label[] = "MeshLink UDP";
 
+#define MESHLINK_CONFIG_VERSION 1
+#define MESHLINK_INVITATION_VERSION 1
+
 struct CattaServer;
 struct CattaSServiceBrowser;
 struct CattaSimplePoll;
@@ -68,6 +71,9 @@ struct meshlink_open_params {
        dev_class_t devclass;
 
        int netns;
+
+       const void *key;
+       size_t keylen;
 };
 
 /// A handle for an instance of MeshLink.
@@ -76,7 +82,7 @@ struct meshlink_handle {
        void *priv;
 
        char *appname;
-       dev_class_t devclass;
+       int32_t devclass;
 
        char *confbase;
        FILE *conffile;
@@ -88,6 +94,7 @@ struct meshlink_handle {
 
        meshlink_channel_accept_cb_t channel_accept_cb;
        meshlink_node_duplicate_cb_t node_duplicate_cb;
+       meshlink_connection_try_cb_t connection_try_cb;
 
        pthread_t thread;
        bool threadstarted;
@@ -99,7 +106,6 @@ struct meshlink_handle {
 
        struct node_t *self;
 
-       struct splay_tree_t *config;
        struct splay_tree_t *edges;
        struct splay_tree_t *nodes;
 
@@ -135,6 +141,7 @@ struct meshlink_handle {
 
        hash_t *node_udp_cache;
        struct connection_t *everyone;
+       struct ecdsa *private_key;
        struct ecdsa *invitation_key;
        int invitation_timeout;
 
@@ -159,8 +166,10 @@ struct meshlink_handle {
        struct CattaSimplePoll *catta_poll;
        struct CattaSEntryGroup *catta_group;
        char *catta_servicetype;
+       unsigned int catta_interfaces;
 
        int netns;
+       void *config_key;
 };
 
 /// A handle for a MeshLink node.
@@ -197,6 +206,7 @@ extern meshlink_log_level_t global_log_level;
 extern meshlink_log_cb_t global_log_cb;
 extern int check_port(meshlink_handle_t *mesh);
 extern void handle_duplicate_node(meshlink_handle_t *mesh, struct node_t *n);
+extern void handle_network_change(meshlink_handle_t *mesh, bool online);
 
 /// Device class traits
 typedef struct {