]> git.meshlink.io Git - meshlink/blobdiff - src/net.h
Add meshlink_set_canonical_address().
[meshlink] / src / net.h
index d2a60bcf685c858ef079f59b8d1b76305b609722..04bd55a50a0a5ff42fc50d2f314738f32d6b58a6 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -1,6 +1,9 @@
+#ifndef MESHLINK_NET_H
+#define MESHLINK_NET_H
+
 /*
     net.h -- header for net.c
-    Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+    Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -17,9 +20,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __MESHLINK_NET_H__
-#define __MESHLINK_NET_H__
-
 #include "event.h"
 #include "sockaddr.h"
 
@@ -37,8 +37,8 @@
 
 typedef struct vpn_packet_t {
        struct {
-               unsigned int probe:1;
-               unsigned int tcp:1;
+               unsigned int probe: 1;
+               unsigned int tcp: 1;
        };
        uint16_t len;           /* the actual number of bytes in the `data' field */
        uint8_t data[MAXSIZE];
@@ -60,8 +60,16 @@ typedef enum packet_type_t {
 
 typedef struct outgoing_t {
        char *name;
-       int timeout;
        struct splay_tree_t *config_tree;
+       int timeout;
+       enum {
+               OUTGOING_START,
+               OUTGOING_CANONICAL,
+               OUTGOING_RECENT,
+               OUTGOING_KNOWN,
+               OUTGOING_END,
+               OUTGOING_NO_KNOWN_ADDRESSES,
+       } state;
        struct config_t *cfg;
        struct addrinfo *ai;
        struct addrinfo *aip;
@@ -71,7 +79,6 @@ typedef struct outgoing_t {
 
 extern int maxoutbufsize;
 extern int addressfamily;
-extern unsigned replaywin;
 
 extern int keylifetime;
 extern int max_connection_burst;
@@ -91,7 +98,6 @@ extern int setup_vpn_in_socket(struct meshlink_handle *mesh, const sockaddr_t *)
 extern bool send_sptps_data(void *handle, uint8_t type, const void *data, size_t len);
 extern bool receive_sptps_record(void *handle, uint8_t type, const void *data, uint16_t len);
 extern void send_packet(struct meshlink_handle *mesh, struct node_t *, struct vpn_packet_t *);
-extern void receive_tcppacket(struct meshlink_handle *mesh, struct connection_t *, const char *, int);
 extern void broadcast_packet(struct meshlink_handle *mesh, const struct node_t *, struct vpn_packet_t *);
 extern char *get_name(struct meshlink_handle *mesh);
 extern void load_all_nodes(struct meshlink_handle *mesh);
@@ -111,8 +117,6 @@ extern void retry(struct meshlink_handle *mesh);
 
 #ifndef HAVE_MINGW
 #define closesocket(s) close(s)
-#else
-extern CRITICAL_SECTION mutex;
 #endif
 
-#endif /* __MESHLINK_NET_H__ */
+#endif