X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink_internal.h;h=1bf3085c92884975e5abe55c29a193f820d707e9;hb=74e99de094a34556ba912a5e392eda172571eb53;hp=058dfc76c11c85560bc70b9b6121bbe273a8880a;hpb=05c02272e16eb7670b19c596070a1a7cad72e432;p=meshlink diff --git a/src/meshlink_internal.h b/src/meshlink_internal.h index 058dfc76..1bf3085c 100644 --- a/src/meshlink_internal.h +++ b/src/meshlink_internal.h @@ -29,6 +29,8 @@ #include "sockaddr.h" #include "sptps.h" +#include + #define MAXSOCKETS 8 /* Probably overkill... */ typedef struct listen_socket_t { @@ -47,10 +49,18 @@ typedef enum proxytype_t { PROXY_EXEC, } proxytype_t; +typedef struct outpacketqueue { + meshlink_node_t *destination; + const void *data; + unsigned int len; +} outpacketqueue_t; + /// A handle for an instance of MeshLink. struct meshlink_handle { - char *confbase; char *name; + void *priv; + + char *confbase; meshlink_receive_cb_t receive_cb; meshlink_node_status_cb_t node_status_cb; @@ -58,9 +68,13 @@ struct meshlink_handle { meshlink_log_level_t log_level; pthread_t thread; + bool threadstarted; + pthread_mutex_t outpacketqueue_mutex; + pthread_mutex_t nodes_mutex; event_loop_t loop; listen_socket_t listen_socket[MAXSOCKETS]; int listen_sockets; + signal_t datafromapp; struct node_t *self; @@ -71,6 +85,11 @@ struct meshlink_handle { struct list_t *connections; struct list_t *outgoings; + struct list_t *outpacketqueue; + + struct splay_tree_t *past_request_tree; + timeout_t past_request_timeout; + int contradicting_add_edge; int contradicting_del_edge; int sleeptime; @@ -98,9 +117,6 @@ struct meshlink_handle { int pingtimeout; /* seconds to wait for response */ int maxtimeout; - char meshlink_conf[PATH_MAX]; - char hosts_dir[PATH_MAX]; - int sock; sptps_t sptps; char cookie[18], hash[18]; @@ -124,4 +140,7 @@ typedef struct meshlink_packethdr { uint8_t source[16]; } __attribute__ ((__packed__)) meshlink_packethdr_t; +extern void meshlink_send_from_queue(event_loop_t* el,meshlink_handle_t *mesh); + + #endif // MESHLINK_INTERNAL_H