]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink_internal.h
Remove disconnect code from autoconnect because it makes the mesh flapping
[meshlink] / src / meshlink_internal.h
index 2a8b7ebf601b87aab7d5d25df4dc448a6f4020c0..3099d7e2e67a2d52e8e0fd1500af5af84d19575a 100644 (file)
@@ -63,9 +63,10 @@ typedef struct outpacketqueue {
 /// A handle for an instance of MeshLink.
 struct meshlink_handle {
        char *name;
+       void *priv;
+
        char *appname;
        dev_class_t devclass;
-       void *priv;
 
        char *confbase;
 
@@ -74,10 +75,12 @@ struct meshlink_handle {
        meshlink_log_cb_t log_cb;
        meshlink_log_level_t log_level;
 
+       meshlink_channel_accept_cb_t channel_accept_cb;
+
        pthread_t thread;
        bool threadstarted;
        pthread_mutex_t outpacketqueue_mutex;
-       pthread_mutex_t nodes_mutex;
+       pthread_mutex_t mesh_mutex;
        event_loop_t loop;
        listen_socket_t listen_socket[MAXSOCKETS];
        int listen_sockets;
@@ -148,6 +151,13 @@ struct meshlink_node {
        void *priv;
 };
 
+/// A channel.
+struct meshlink_channel {
+       struct utcp_connection *c;
+       struct node_t *node;
+       meshlink_channel_receive_cb_t receive_cb;
+};
+
 /// Header for data packets routed between nodes
 typedef struct meshlink_packethdr {
        uint8_t destination[16];