X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink_internal.h;h=84368ee8cac938881897fc1dcc29b12600568128;hb=fa05f996c5500c056a36c1d43e33a407f876643c;hp=f576eb1290a1178c14b02fddc273dd3f601a013c;hpb=6054182c9e208fd0b3f5c6c90f54cb5af75d3f5c;p=meshlink diff --git a/src/meshlink_internal.h b/src/meshlink_internal.h index f576eb12..84368ee8 100644 --- a/src/meshlink_internal.h +++ b/src/meshlink_internal.h @@ -3,7 +3,7 @@ /* meshlink_internal.h -- Internal parts of the public API. - Copyright (C) 2014, 2017 Guus Sliepen + Copyright (C) 2014-2019 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,10 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifdef MESHLINK_H +#error You must not include both meshlink.h and meshlink_internal.h! +#endif + #include "system.h" #include "event.h" @@ -37,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; @@ -64,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. @@ -72,7 +82,7 @@ struct meshlink_handle { void *priv; char *appname; - dev_class_t devclass; + int32_t devclass; char *confbase; FILE *conffile; @@ -84,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; @@ -95,12 +106,12 @@ struct meshlink_handle { struct node_t *self; - struct splay_tree_t *config; struct splay_tree_t *edges; struct splay_tree_t *nodes; struct list_t *connections; struct list_t *outgoings; + struct list_t *submeshes; meshlink_queue_t outpacketqueue; @@ -130,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; @@ -156,6 +168,7 @@ struct meshlink_handle { char *catta_servicetype; int netns; + void *config_key; }; /// A handle for a MeshLink node. @@ -164,6 +177,12 @@ struct meshlink_node { void *priv; }; +/// A handle for a node Sub-Mesh. +struct meshlink_submesh { + const char *name; + void *priv; +}; + /// A channel. struct meshlink_channel { struct node_t *node;