X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink_internal.h;h=15edba9ab9a1bf1c3452635c888dac1abe8bb9c7;hb=HEAD;hp=011075079e86473166c17a1dd28bfb389ff0325f;hpb=a23ddd4f4e273b2ed68fe173b4faa69aadc98756;p=meshlink diff --git a/src/meshlink_internal.h b/src/meshlink_internal.h index 01107507..b57f212c 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; @@ -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; @@ -67,6 +63,7 @@ struct meshlink_open_params { const void *key; size_t keylen; + meshlink_storage_policy_t storage_policy; }; /// Device class traits @@ -143,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; @@ -161,7 +159,6 @@ struct meshlink_handle { int netns; bool default_blacklist; - bool discovery; // Whether Catta is enabled or not bool inviter_commits_first; // Configuration @@ -170,23 +167,28 @@ struct meshlink_handle { void *config_key; char *external_address_url; struct list_t *invitation_addresses; + meshlink_storage_policy_t storage_policy; // 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; @@ -249,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) {