X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink_internal.h;h=011075079e86473166c17a1dd28bfb389ff0325f;hb=HEAD;hp=6a433b608cbb7d1585bc32171feb7f217c6a5c40;hpb=a27bebb24d4072ef66d8640a3c988f1b883e309e;p=meshlink diff --git a/src/meshlink_internal.h b/src/meshlink_internal.h index 6a433b60..b57f212c 100644 --- a/src/meshlink_internal.h +++ b/src/meshlink_internal.h @@ -140,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; @@ -158,7 +159,6 @@ struct meshlink_handle { int netns; bool default_blacklist; - bool discovery; // Whether mDNS discovery is enabled or not bool inviter_commits_first; // Configuration @@ -172,18 +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; // mDNS discovery - io_t pfroute_io; - int *discovery_ifaces; - struct discovery_address *discovery_addresses; - int discovery_iface_count; - int discovery_address_count; - io_t discovery_sockets[2]; + 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; @@ -246,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) {