diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 0e40fe8f5..000000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-
-# Default ignored files
-/workspace.xml
\ No newline at end of file
diff --git a/.idea/ZeroTierOne.iml b/.idea/ZeroTierOne.iml
index 44599ced0..f08604bb6 100644
--- a/.idea/ZeroTierOne.iml
+++ b/.idea/ZeroTierOne.iml
@@ -1,4 +1,2 @@
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
deleted file mode 100644
index a55e7a179..000000000
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/dictionaries/api.xml b/.idea/dictionaries/api.xml
index 53167764f..a2babde27 100644
--- a/.idea/dictionaries/api.xml
+++ b/.idea/dictionaries/api.xml
@@ -1,11 +1,9 @@
- apisocket
- nwid
- secrand
- sockaddr
- unmarshals
+ accel
+ certificateofownership
+ multicast
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 146ab09b7..000000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 8822db8f1..79b3c9483 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,7 +1,4 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml
deleted file mode 100644
index 97ad6d2d9..000000000
--- a/.idea/watcherTasks.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/node/AES.hpp b/node/AES.hpp
index d8392bcb0..f03fd48cf 100644
--- a/node/AES.hpp
+++ b/node/AES.hpp
@@ -18,6 +18,8 @@
#include "Utils.hpp"
#include "SHA512.hpp"
+#include
+
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
#include
@@ -31,9 +33,6 @@ extern "C" void zt_crypt_ctr_aesni(const __m128i key[14],const uint8_t iv[16],co
#endif // x64
-#define ZT_AES_KEY_SIZE 32
-#define ZT_AES_BLOCK_SIZE 16
-
namespace ZeroTier {
/**
diff --git a/node/Address.hpp b/node/Address.hpp
index 7634a1c36..053707a4d 100644
--- a/node/Address.hpp
+++ b/node/Address.hpp
@@ -14,11 +14,11 @@
#ifndef ZT_ADDRESS_HPP
#define ZT_ADDRESS_HPP
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
#include
#include
@@ -37,8 +37,7 @@ class Address
{
public:
ZT_ALWAYS_INLINE Address() : _a(0) {}
- ZT_ALWAYS_INLINE Address(const Address &a) : _a(a._a) {}
- ZT_ALWAYS_INLINE Address(uint64_t a) : _a(a & 0xffffffffffULL) {}
+ explicit ZT_ALWAYS_INLINE Address(uint64_t a) : _a(a & 0xffffffffffULL) {}
/**
* @param bits Raw address -- 5 bytes, big-endian byte order
@@ -46,7 +45,6 @@ public:
*/
ZT_ALWAYS_INLINE Address(const void *bits,unsigned int len) { setTo(bits,len); }
- ZT_ALWAYS_INLINE Address &operator=(const Address &a) { _a = a._a; return *this; }
ZT_ALWAYS_INLINE Address &operator=(const uint64_t a) { _a = (a & 0xffffffffffULL); return *this; }
/**
@@ -137,9 +135,9 @@ public:
*/
ZT_ALWAYS_INLINE uint8_t operator[](unsigned int i) const { return (uint8_t)(_a >> (32 - (i * 8))); }
- ZT_ALWAYS_INLINE operator unsigned int() const { return (unsigned int)_a; }
- ZT_ALWAYS_INLINE operator unsigned long() const { return (unsigned long)_a; }
- ZT_ALWAYS_INLINE operator unsigned long long() const { return (unsigned long long)_a; }
+ explicit ZT_ALWAYS_INLINE operator unsigned int() const { return (unsigned int)_a; }
+ explicit ZT_ALWAYS_INLINE operator unsigned long() const { return (unsigned long)_a; }
+ explicit ZT_ALWAYS_INLINE operator unsigned long long() const { return (unsigned long long)_a; }
ZT_ALWAYS_INLINE void zero() { _a = 0; }
diff --git a/node/C25519.cpp b/node/C25519.cpp
index aa9fa66c5..3e05859c3 100644
--- a/node/C25519.cpp
+++ b/node/C25519.cpp
@@ -7,16 +7,11 @@ Derived from public domain code by D. J. Bernstein.
// Modified very slightly for ZeroTier One by Adam Ierymenko
// This code remains in the public domain.
-#include
-#include
-#include
+#include
+#include
-#include "Constants.hpp"
#include "C25519.hpp"
#include "SHA512.hpp"
-#include "Buffer.hpp"
-#include "Hashtable.hpp"
-#include "Mutex.hpp"
#ifdef __WINDOWS__
#pragma warning(disable: 4146)
@@ -28,10 +23,7 @@ Derived from public domain code by D. J. Bernstein.
namespace {
-#define crypto_int32 int32_t
#define crypto_uint32 uint32_t
-#define crypto_int64 int64_t
-#define crypto_uint64 uint64_t
#define crypto_hash_sha512_BYTES 64
//////////////////////////////////////////////////////////////////////////////
diff --git a/node/Capability.hpp b/node/Capability.hpp
index 167b575c2..8606cd5d8 100644
--- a/node/Capability.hpp
+++ b/node/Capability.hpp
@@ -14,9 +14,9 @@
#ifndef ZT_CAPABILITY_HPP
#define ZT_CAPABILITY_HPP
-#include
-#include
-#include
+#include
+#include
+#include
#include "Constants.hpp"
#include "Credential.hpp"
diff --git a/node/CertificateOfMembership.hpp b/node/CertificateOfMembership.hpp
index 81308a216..976c48b47 100644
--- a/node/CertificateOfMembership.hpp
+++ b/node/CertificateOfMembership.hpp
@@ -14,8 +14,8 @@
#ifndef ZT_CERTIFICATEOFMEMBERSHIP_HPP
#define ZT_CERTIFICATEOFMEMBERSHIP_HPP
-#include
-#include
+#include
+#include
#include
#include
diff --git a/node/CertificateOfOwnership.hpp b/node/CertificateOfOwnership.hpp
index 7bdcf9eed..336577767 100644
--- a/node/CertificateOfOwnership.hpp
+++ b/node/CertificateOfOwnership.hpp
@@ -14,10 +14,10 @@
#ifndef ZT_CERTIFICATEOFOWNERSHIP_HPP
#define ZT_CERTIFICATEOFOWNERSHIP_HPP
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include "Constants.hpp"
#include "Credential.hpp"
diff --git a/node/Credential.hpp b/node/Credential.hpp
index 19ca9e009..6edc41fae 100644
--- a/node/Credential.hpp
+++ b/node/Credential.hpp
@@ -18,10 +18,10 @@
#include
#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include "Constants.hpp"
diff --git a/node/Dictionary.hpp b/node/Dictionary.hpp
index 599e5cfde..8099e50e0 100644
--- a/node/Dictionary.hpp
+++ b/node/Dictionary.hpp
@@ -19,7 +19,7 @@
#include "Buffer.hpp"
#include "Address.hpp"
-#include
+#include
namespace ZeroTier {
diff --git a/node/ECC384.cpp b/node/ECC384.cpp
index 2395fb517..d28cf742d 100644
--- a/node/ECC384.cpp
+++ b/node/ECC384.cpp
@@ -4,10 +4,9 @@
// This code is under the BSD 2-clause license, not ZeroTier's license
//////////////////////////////////////////////////////////////////////////////
-#include
-#include
-#include
-#include
+#include
+#include
+#include
#include "Constants.hpp"
#include "ECC384.hpp"
diff --git a/node/Endpoint.hpp b/node/Endpoint.hpp
index baf1e9697..afb26c34b 100644
--- a/node/Endpoint.hpp
+++ b/node/Endpoint.hpp
@@ -14,10 +14,10 @@
#ifndef ZT_ENDPOINT_HPP
#define ZT_ENDPOINT_HPP
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include "Constants.hpp"
#include "InetAddress.hpp"
@@ -53,7 +53,7 @@ public:
ZT_ALWAYS_INLINE const InetAddress *sockaddr() const { return (_t == INETADDR) ? reinterpret_cast(&_v.sa) : nullptr; }
ZT_ALWAYS_INLINE const char *dnsName() const { return (_t == DNSNAME) ? _v.dns.name : nullptr; }
- ZT_ALWAYS_INLINE const int dnsPort() const { return (_t == DNSNAME) ? _v.dns.port : -1; }
+ ZT_ALWAYS_INLINE int dnsPort() const { return (_t == DNSNAME) ? _v.dns.port : -1; }
ZT_ALWAYS_INLINE Address ztAddress() const { return (_t == ZEROTIER) ? Address(_v.zt.a) : Address(); }
ZT_ALWAYS_INLINE const uint8_t *ztIdentityHash() const { return (_t == ZEROTIER) ? _v.zt.idh : nullptr; }
ZT_ALWAYS_INLINE const char *url() const { return (_t == URL) ? _v.url : nullptr; }
@@ -140,7 +140,7 @@ public:
}
++p;
if ((p >= (ZT_ENDPOINT_MAX_NAME_SIZE+1))||(p >= (len-2)))
- return;
+ return -1;
}
_v.dns.port = ((int)data[p++]) << 8;
_v.dns.port |= (int)data[p++];
diff --git a/node/Identity.hpp b/node/Identity.hpp
index c28da306d..6938bf2d4 100644
--- a/node/Identity.hpp
+++ b/node/Identity.hpp
@@ -14,8 +14,8 @@
#ifndef ZT_IDENTITY_HPP
#define ZT_IDENTITY_HPP
-#include
-#include
+#include
+#include
#include "Constants.hpp"
#include "Utils.hpp"
diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp
index 0bd76b7a7..27b7adcb6 100644
--- a/node/IncomingPacket.cpp
+++ b/node/IncomingPacket.cpp
@@ -29,9 +29,8 @@
#include "Revocation.hpp"
#include "Trace.hpp"
-#include
-#include
-#include
+#include
+#include
#include
diff --git a/node/IncomingPacket.hpp b/node/IncomingPacket.hpp
index 1e7219380..3a72d7cc7 100644
--- a/node/IncomingPacket.hpp
+++ b/node/IncomingPacket.hpp
@@ -14,8 +14,6 @@
#ifndef ZT_INCOMINGPACKET_HPP
#define ZT_INCOMINGPACKET_HPP
-#include
-
#include "Packet.hpp"
#include "Path.hpp"
#include "Utils.hpp"
diff --git a/node/InetAddress.hpp b/node/InetAddress.hpp
index 707109a34..5ec3aef1b 100644
--- a/node/InetAddress.hpp
+++ b/node/InetAddress.hpp
@@ -14,9 +14,9 @@
#ifndef ZT_INETADDRESS_HPP
#define ZT_INETADDRESS_HPP
-#include
-#include
-#include
+#include
+#include
+#include
#include "Constants.hpp"
#include "../include/ZeroTierOne.h"
diff --git a/node/MAC.hpp b/node/MAC.hpp
index c60186aa9..9ea4ba8c5 100644
--- a/node/MAC.hpp
+++ b/node/MAC.hpp
@@ -14,9 +14,9 @@
#ifndef ZT_MAC_HPP
#define ZT_MAC_HPP
-#include
-#include
-#include
+#include
+#include
+#include
#include "Constants.hpp"
#include "Utils.hpp"
diff --git a/node/Membership.hpp b/node/Membership.hpp
index 94248f2a5..5c92d5ea4 100644
--- a/node/Membership.hpp
+++ b/node/Membership.hpp
@@ -14,10 +14,11 @@
#ifndef ZT_MEMBERSHIP_HPP
#define ZT_MEMBERSHIP_HPP
-#include
+#include
+
+#include "../include/ZeroTierOne.h"
#include "Constants.hpp"
-#include "../include/ZeroTierOne.h"
#include "Credential.hpp"
#include "Hashtable.hpp"
#include "CertificateOfMembership.hpp"
@@ -97,11 +98,6 @@ public:
return nconf.com.agreesWith(_com); // check timestamp agreement window
}
- /**
- * @return True if this peer has sent us a valid certificate within ZT_PEER_ACTIVITY_TIMEOUT
- */
- inline bool recentlyAssociated(const int64_t now) const { return ((_com)&&((now - _com.timestamp()) < ZT_PEER_ACTIVITY_TIMEOUT)); }
-
/**
* Check whether the peer represented by this Membership owns a given address
*
diff --git a/node/MulticastGroup.hpp b/node/MulticastGroup.hpp
index e3deebdb6..e98c2321a 100644
--- a/node/MulticastGroup.hpp
+++ b/node/MulticastGroup.hpp
@@ -14,7 +14,7 @@
#ifndef ZT_MULTICASTGROUP_HPP
#define ZT_MULTICASTGROUP_HPP
-#include
+#include
#include "Constants.hpp"
#include "MAC.hpp"
diff --git a/node/Mutex.hpp b/node/Mutex.hpp
index 3dc11108a..69b6d4584 100644
--- a/node/Mutex.hpp
+++ b/node/Mutex.hpp
@@ -16,10 +16,11 @@
#include "Constants.hpp"
+#include
+#include
+
#ifdef __UNIX_LIKE__
-#include
-#include
#include
namespace ZeroTier {
@@ -56,7 +57,6 @@ private:
#ifdef __WINDOWS__
-#include
#include
namespace ZeroTier {
diff --git a/node/Network.cpp b/node/Network.cpp
index 8e3732833..8b30c6ae6 100644
--- a/node/Network.cpp
+++ b/node/Network.cpp
@@ -11,10 +11,10 @@
*/
/****/
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include "../include/ZeroTierDebug.h"
diff --git a/node/Network.hpp b/node/Network.hpp
index 744ea8066..43333725f 100644
--- a/node/Network.hpp
+++ b/node/Network.hpp
@@ -14,7 +14,7 @@
#ifndef ZT_NETWORK_HPP
#define ZT_NETWORK_HPP
-#include
+#include
#include "../include/ZeroTierOne.h"
diff --git a/node/NetworkConfig.cpp b/node/NetworkConfig.cpp
index 6b0fe90d4..d94c774f6 100644
--- a/node/NetworkConfig.cpp
+++ b/node/NetworkConfig.cpp
@@ -11,7 +11,7 @@
*/
/****/
-#include
+#include
#include
diff --git a/node/NetworkConfig.hpp b/node/NetworkConfig.hpp
index 8e9acd527..bf069721f 100644
--- a/node/NetworkConfig.hpp
+++ b/node/NetworkConfig.hpp
@@ -14,9 +14,9 @@
#ifndef ZT_NETWORKCONFIG_HPP
#define ZT_NETWORKCONFIG_HPP
-#include
-#include
-#include
+#include
+#include
+#include
#include
#include
diff --git a/node/NetworkController.hpp b/node/NetworkController.hpp
index b344787b8..5c7734430 100644
--- a/node/NetworkController.hpp
+++ b/node/NetworkController.hpp
@@ -14,7 +14,7 @@
#ifndef ZT_NETWORKCONFIGMASTER_HPP
#define ZT_NETWORKCONFIGMASTER_HPP
-#include
+#include
#include "Constants.hpp"
#include "Dictionary.hpp"
diff --git a/node/Node.hpp b/node/Node.hpp
index 6f6fb99e8..bf9696e38 100644
--- a/node/Node.hpp
+++ b/node/Node.hpp
@@ -14,9 +14,9 @@
#ifndef ZT_NODE_HPP
#define ZT_NODE_HPP
-#include
-#include
-#include
+#include
+#include
+#include
#include