X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink_internal.h;h=469a05b1aec146e81f0bf3482fcf2405f2c41ccd;hb=b3d36651004e8124d9410e249215997a108473ec;hp=127a9935caf3eee6f00de78cc755ee257a9c831b;hpb=61089eace7d46c28d3e72abbe182f54762bda25f;p=meshlink diff --git a/src/meshlink_internal.h b/src/meshlink_internal.h index 127a9935..469a05b1 100644 --- a/src/meshlink_internal.h +++ b/src/meshlink_internal.h @@ -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; @@ -163,7 +158,6 @@ struct meshlink_handle { int netns; bool default_blacklist; - bool discovery; // Whether Catta is enabled or not bool inviter_commits_first; // Configuration @@ -177,26 +171,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; - - // PFROUTE - io_t pfroute_io; - int *discovery_ifaces; - struct discovery_address *discovery_addresses; - int discovery_iface_count; - int discovery_address_count; + + // 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; @@ -259,6 +250,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) {