size_t keylen;
};
+/// Device class traits
+typedef struct {
+ int pinginterval;
+ int pingtimeout;
+ unsigned int min_connects;
+ unsigned int max_connects;
+ int edge_weight;
+} dev_class_traits_t;
+
/// A handle for an instance of MeshLink.
struct meshlink_handle {
// public members
struct splay_tree_t *past_request_tree;
timeout_t past_request_timeout;
+ int connection_burst;
int contradicting_add_edge;
int contradicting_del_edge;
int sleeptime;
+ time_t connection_burst_time;
time_t last_config_check;
+ time_t last_hard_try;
timeout_t pingtimer;
timeout_t periodictimer;
struct connection_t *everyone;
+ int next_pit;
+ int pits[10];
+
// Infrequently used callbacks
meshlink_node_status_cb_t node_status_cb;
+ meshlink_node_pmtu_cb_t node_pmtu_cb;
meshlink_channel_accept_cb_t channel_accept_cb;
meshlink_node_duplicate_cb_t node_duplicate_cb;
meshlink_connection_try_cb_t connection_try_cb;
struct ecdsa *private_key;
struct ecdsa *invitation_key;
- int32_t devclass;
+ dev_class_t devclass;
int invitation_timeout;
- int pinginterval; /* seconds between pings */
- int pingtimeout; /* seconds to wait for response */
int maxtimeout;
+ int udp_choice;
+
+ dev_class_traits_t dev_class_traits[DEV_CLASS_COUNT];
int netns;
// Thread management
pthread_t thread;
+ pthread_cond_t cond;
+ pthread_mutex_t discovery_mutex;
+ pthread_cond_t discovery_cond;
bool threadstarted;
bool discovery_threadstarted;
void *priv;
};
+/// An AIO buffer.
+typedef struct meshlink_aio_buffer {
+ const void *data;
+ int fd;
+ size_t len;
+ size_t done;
+ union {
+ meshlink_aio_cb_t buffer;
+ meshlink_aio_fd_cb_t fd;
+ } cb;
+ void *priv;
+ struct meshlink_aio_buffer *next;
+} meshlink_aio_buffer_t;
+
/// A channel.
struct meshlink_channel {
struct node_t *node;
void *priv;
struct utcp_connection *c;
+ meshlink_aio_buffer_t *aio_send;
+ meshlink_aio_buffer_t *aio_receive;
meshlink_channel_receive_cb_t receive_cb;
meshlink_channel_poll_cb_t poll_cb;
};
extern void meshlink_send_from_queue(event_loop_t *el, meshlink_handle_t *mesh);
extern void update_node_status(meshlink_handle_t *mesh, struct node_t *n);
+extern void update_node_pmtu(meshlink_handle_t *mesh, struct node_t *n);
extern meshlink_log_level_t global_log_level;
extern meshlink_log_cb_t global_log_cb;
-extern int check_port(meshlink_handle_t *mesh);
extern void handle_duplicate_node(meshlink_handle_t *mesh, struct node_t *n);
extern void handle_network_change(meshlink_handle_t *mesh, bool online);
-/// Device class traits
-typedef struct {
- unsigned int min_connects;
- unsigned int max_connects;
- int edge_weight;
-} dev_class_traits_t;
-
-extern dev_class_traits_t dev_class_traits[];
-
#endif