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;
int netns;
bool default_blacklist;
- bool discovery; // Whether mDNS discovery is enabled or not
bool inviter_commits_first;
// Configuration
// 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;
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) {