]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink_internal.h
Never automatically try to bind to ports >= 32768.
[meshlink] / src / meshlink_internal.h
index 6cbe6093f42258f84ecb5b0c133b7d2018965ffa..b57f212c5fdf6569243c2256497f8e11f5514d6f 100644 (file)
@@ -45,11 +45,6 @@ static const char meshlink_udp_label[] = "MeshLink UDP";
 #define MESHLINK_CONFIG_VERSION 2
 #define MESHLINK_INVITATION_VERSION 2
 
-struct CattaServer;
-struct CattaSServiceBrowser;
-struct CattaSimplePoll;
-struct CattaSEntryGroup;
-
 typedef struct listen_socket_t {
        struct io_t tcp;
        struct io_t udp;
@@ -59,6 +54,7 @@ typedef struct listen_socket_t {
 
 struct meshlink_open_params {
        char *confbase;
+       char *lock_filename;
        char *appname;
        char *name;
        dev_class_t devclass;
@@ -144,6 +140,7 @@ struct meshlink_handle {
        meshlink_connection_try_cb_t connection_try_cb;
        meshlink_error_cb_t error_cb;
        meshlink_blacklisted_cb_t blacklisted_cb;
+       meshlink_thread_status_cb_t thread_status_cb;
 
        // Mesh parameters
        char *appname;
@@ -162,7 +159,6 @@ struct meshlink_handle {
        int netns;
 
        bool default_blacklist;
-       bool discovery;         // Whether Catta is enabled or not
        bool inviter_commits_first;
 
        // Configuration
@@ -176,19 +172,23 @@ struct meshlink_handle {
        // Thread management
        pthread_t thread;
        pthread_cond_t cond;
-       pthread_mutex_t discovery_mutex;
-       pthread_cond_t discovery_cond;
        bool threadstarted;
-       bool discovery_threadstarted;
 
-       // Catta
-       pthread_t discovery_thread;
-       struct CattaServer *catta_server;
-       struct CattaSServiceBrowser *catta_browser;
-       struct CattaSimplePoll *catta_poll;
-       struct CattaSEntryGroup *catta_group;
-       char *catta_servicetype;
-       unsigned int catta_interfaces;
+       // mDNS discovery
+       struct {
+               bool enabled;
+               io_t pfroute_io;
+               int *ifaces;
+               struct discovery_address *addresses;
+               int iface_count;
+               int address_count;
+               io_t sockets[2];
+               time_t last_update;
+#ifdef __APPLE__
+               pthread_t thread;
+               void *runloop;
+#endif
+       } discovery;
 
        // ADNS
        pthread_t adns_thread;
@@ -251,6 +251,7 @@ extern meshlink_log_cb_t global_log_cb;
 void handle_duplicate_node(meshlink_handle_t *mesh, struct node_t *n);
 void handle_network_change(meshlink_handle_t *mesh, bool online);
 void call_error_cb(meshlink_handle_t *mesh, meshlink_errno_t meshlink_errno);
+void channel_receive(meshlink_handle_t *mesh, meshlink_node_t *node, const void *data, size_t len);
 
 /// Per-instance PRNG
 static inline int prng(meshlink_handle_t *mesh, uint64_t max) {