*/
#ifdef MESHLINK_H
-#error You must not include both meshlink.h and meshlink_internal.h!
+#error You must not include both meshlink-tiny.h and meshlink_internal.h!
#endif
#include "system.h"
#include "event.h"
#include "hash.h"
-#include "meshlink.h"
+#include "meshlink-tiny.h"
#include "meshlink_queue.h"
#include "sockaddr.h"
#include "sptps.h"
#define MESHLINK_CONFIG_VERSION 2
#define MESHLINK_INVITATION_VERSION 2
-typedef struct listen_socket_t {
- struct io_t tcp;
- struct io_t udp;
- sockaddr_t sa;
- sockaddr_t broadcast_sa;
-} listen_socket_t;
-
struct meshlink_open_params {
char *confbase;
char *lock_filename;
// The most important network-related members come first
int reachable;
- int listen_sockets;
- listen_socket_t listen_socket[MAXSOCKETS];
meshlink_receive_cb_t receive_cb;
meshlink_queue_t outpacketqueue;
signal_t datafromapp;
- hash_t *node_udp_cache;
-
struct splay_tree_t *nodes;
- struct splay_tree_t *edges;
struct list_t *connections;
struct list_t *outgoings;
dev_class_t devclass;
- int udp_choice;
-
dev_class_traits_t dev_class_traits[DEV_CLASS_COUNT];
int netns;
pthread_t thread;
pthread_cond_t cond;
bool threadstarted;
-
- // 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;
- pthread_cond_t adns_cond;
- meshlink_queue_t adns_queue;
- meshlink_queue_t adns_done_queue;
- signal_t adns_signal;
};
/// A handle for a MeshLink node.