X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet.h;h=b1792883382439c2961bb9e1be864f35efc0cd6b;hb=b322126576c52ffbc9a91d818125fc461fa17d1b;hp=d69eabdacab702624afbedcf8c4e21944f9eb746;hpb=7ee885a1f6776be85e5397eda04f75d98ff0b631;p=tinc diff --git a/src/net.h b/src/net.h index d69eabda..b1792883 100644 --- a/src/net.h +++ b/src/net.h @@ -21,11 +21,15 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "system.h" + #include "ipv6.h" #include "cipher.h" #include "digest.h" #include "event.h" +#define EPOLL_MAX_EVENTS_PER_LOOP 32 + #ifdef ENABLE_JUMBOGRAMS #define MTU 9018 /* 9000 bytes payload + 14 bytes ethernet header + 4 bytes VLAN tag */ #else @@ -56,7 +60,7 @@ typedef struct node_id_t { uint8_t x[6]; } node_id_t; -typedef short length_t; +typedef uint16_t length_t; typedef uint32_t seqno_t; #define AF_UNKNOWN 255 @@ -101,12 +105,6 @@ typedef struct vpn_packet_t { #define PKT_MAC 2 #define PKT_PROBE 4 -typedef enum packet_type_t { - PACKET_NORMAL, - PACKET_COMPRESSED, - PACKET_PROBE -} packet_type_t; - typedef struct listen_socket_t { io_t tcp; io_t udp; @@ -121,11 +119,10 @@ typedef struct listen_socket_t { typedef struct outgoing_t { struct node_t *node; int timeout; - struct address_cache_t *address_cache; timeout_t ev; } outgoing_t; -extern list_t *outgoing_list; +extern list_t outgoing_list; extern int maxoutbufsize; extern int seconds_till_retry; @@ -147,6 +144,8 @@ extern io_t unix_socket; extern int keylifetime; extern int udp_rcvbuf; extern int udp_sndbuf; +extern bool udp_rcvbuf_warnings; +extern bool udp_sndbuf_warnings; extern int max_connection_burst; extern int fwmark; extern bool do_prune; @@ -187,11 +186,11 @@ extern void handle_new_meta_connection(void *data, int flags); extern void handle_new_unix_connection(void *data, int flags); extern int setup_listen_socket(const sockaddr_t *sa); extern int setup_vpn_in_socket(const sockaddr_t *sa); -extern bool send_sptps_data(node_t *to, node_t *from, int type, const void *data, size_t len); +extern bool send_sptps_data(struct node_t *to, struct node_t *from, int 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 node_t *n, vpn_packet_t *packet); -extern void receive_tcppacket(struct connection_t *c, const char *buffer, int length); -extern bool receive_tcppacket_sptps(struct connection_t *c, const char *buffer, int length); +extern void receive_tcppacket(struct connection_t *c, const char *buffer, size_t length); +extern bool receive_tcppacket_sptps(struct connection_t *c, const char *buffer, size_t length); extern void broadcast_packet(const struct node_t *n, vpn_packet_t *packet); extern char *get_name(void); extern void device_enable(void); @@ -204,8 +203,6 @@ extern void close_network_connections(void); extern int main_loop(void); extern void terminate_connection(struct connection_t *c, bool report); extern bool node_read_ecdsa_public_key(struct node_t *n); -extern bool read_ecdsa_public_key(struct connection_t *c); -extern bool read_rsa_public_key(struct connection_t *c); extern void handle_device_data(void *data, int flags); extern void handle_meta_connection_data(struct connection_t *c); extern void regenerate_key(void); @@ -214,6 +211,7 @@ extern void retry(void); extern int reload_configuration(void); extern void load_all_nodes(void); extern void try_tx(struct node_t *n, bool mtu); +extern void tarpit(int fd); #ifndef HAVE_MINGW #define closesocket(s) close(s)