mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-31 16:35:26 +00:00
More cleanup of old stuff.
This commit is contained in:
parent
939ab43ceb
commit
6d8e1e8783
@ -35,7 +35,6 @@
|
||||
#include "../node/Utils.hpp"
|
||||
#include "../node/Address.hpp"
|
||||
#include "../node/InetAddress.hpp"
|
||||
#include "../node/NonCopyable.hpp"
|
||||
|
||||
#include "../osdep/OSUtils.hpp"
|
||||
#include "../osdep/Thread.hpp"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#define ZT_MUTEX_HPP
|
||||
|
||||
#include "Constants.hpp"
|
||||
#include "NonCopyable.hpp"
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
|
||||
@ -41,7 +40,7 @@ namespace ZeroTier {
|
||||
#if defined(__GNUC__) && (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
|
||||
|
||||
// Inline ticket lock on x64 systems with GCC and CLANG (Mac, Linux) -- this is really fast as long as locking durations are very short
|
||||
class Mutex : NonCopyable
|
||||
class Mutex
|
||||
{
|
||||
public:
|
||||
Mutex() :
|
||||
@ -67,7 +66,7 @@ public:
|
||||
/**
|
||||
* Uses C++ contexts and constructor/destructor to lock/unlock automatically
|
||||
*/
|
||||
class Lock : NonCopyable
|
||||
class Lock
|
||||
{
|
||||
public:
|
||||
Lock(Mutex &m) :
|
||||
@ -92,6 +91,9 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
Mutex(const Mutex &) {}
|
||||
const Mutex &operator=(const Mutex &) { return *this; }
|
||||
|
||||
uint16_t nextTicket;
|
||||
uint16_t nowServing;
|
||||
};
|
||||
@ -99,7 +101,7 @@ private:
|
||||
#else
|
||||
|
||||
// libpthread based mutex lock
|
||||
class Mutex : NonCopyable
|
||||
class Mutex
|
||||
{
|
||||
public:
|
||||
Mutex()
|
||||
@ -122,7 +124,7 @@ public:
|
||||
pthread_mutex_unlock(&((const_cast <Mutex *> (this))->_mh));
|
||||
}
|
||||
|
||||
class Lock : NonCopyable
|
||||
class Lock
|
||||
{
|
||||
public:
|
||||
Lock(Mutex &m) :
|
||||
@ -147,6 +149,9 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
Mutex(const Mutex &) {}
|
||||
const Mutex &operator=(const Mutex &) { return *this; }
|
||||
|
||||
pthread_mutex_t _mh;
|
||||
};
|
||||
|
||||
@ -164,7 +169,7 @@ private:
|
||||
namespace ZeroTier {
|
||||
|
||||
// Windows critical section based lock
|
||||
class Mutex : NonCopyable
|
||||
class Mutex
|
||||
{
|
||||
public:
|
||||
Mutex()
|
||||
@ -197,7 +202,7 @@ public:
|
||||
(const_cast <Mutex *> (this))->unlock();
|
||||
}
|
||||
|
||||
class Lock : NonCopyable
|
||||
class Lock
|
||||
{
|
||||
public:
|
||||
Lock(Mutex &m) :
|
||||
@ -222,6 +227,9 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
Mutex(const Mutex &) {}
|
||||
const Mutex &operator=(const Mutex &) { return *this; }
|
||||
|
||||
CRITICAL_SECTION _cs;
|
||||
};
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "Constants.hpp"
|
||||
#include "NonCopyable.hpp"
|
||||
#include "Hashtable.hpp"
|
||||
#include "Address.hpp"
|
||||
#include "Mutex.hpp"
|
||||
@ -63,7 +62,7 @@ class Peer;
|
||||
/**
|
||||
* A virtual LAN
|
||||
*/
|
||||
class Network : NonCopyable
|
||||
class Network
|
||||
{
|
||||
friend class SharedPtr<Network>;
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Network Virtualization Everywhere
|
||||
* Copyright (C) 2011-2018 ZeroTier, Inc. https://www.zerotier.com/
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --
|
||||
*
|
||||
* You can be released from the requirements of the license by purchasing
|
||||
* a commercial license. Buying such a license is mandatory as soon as you
|
||||
* develop commercial closed-source software that incorporates or links
|
||||
* directly against ZeroTier software without disclosing the source code
|
||||
* of your own application.
|
||||
*/
|
||||
|
||||
#ifndef ZT_NONCOPYABLE_HPP__
|
||||
#define ZT_NONCOPYABLE_HPP__
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* A simple concept that belongs in the C++ language spec
|
||||
*/
|
||||
class NonCopyable
|
||||
{
|
||||
protected:
|
||||
NonCopyable() {}
|
||||
private:
|
||||
NonCopyable(const NonCopyable&);
|
||||
const NonCopyable& operator=(const NonCopyable&);
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
@ -38,7 +38,6 @@
|
||||
#include "InetAddress.hpp"
|
||||
#include "SharedPtr.hpp"
|
||||
#include "AtomicCounter.hpp"
|
||||
#include "NonCopyable.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
/**
|
||||
@ -53,7 +52,7 @@ class RuntimeEnvironment;
|
||||
/**
|
||||
* A path across the physical network
|
||||
*/
|
||||
class Path : NonCopyable
|
||||
class Path
|
||||
{
|
||||
friend class SharedPtr<Path>;
|
||||
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include "AtomicCounter.hpp"
|
||||
#include "Hashtable.hpp"
|
||||
#include "Mutex.hpp"
|
||||
#include "NonCopyable.hpp"
|
||||
|
||||
#define ZT_PEER_MAX_SERIALIZED_STATE_SIZE (sizeof(Peer) + 32 + (sizeof(Path) * 2))
|
||||
|
||||
@ -58,7 +57,7 @@ namespace ZeroTier {
|
||||
/**
|
||||
* Peer on P2P Network (virtual layer 1)
|
||||
*/
|
||||
class Peer : NonCopyable
|
||||
class Peer
|
||||
{
|
||||
friend class SharedPtr<Peer>;
|
||||
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "Constants.hpp"
|
||||
#include "Mutex.hpp"
|
||||
#include "MAC.hpp"
|
||||
#include "NonCopyable.hpp"
|
||||
#include "Packet.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "InetAddress.hpp"
|
||||
@ -58,7 +57,7 @@ class Peer;
|
||||
* packets from tap devices, and this sends them where they need to go and
|
||||
* wraps/unwraps accordingly. It also handles queues and timeouts and such.
|
||||
*/
|
||||
class Switch : NonCopyable
|
||||
class Switch
|
||||
{
|
||||
public:
|
||||
Switch(const RuntimeEnvironment *renv);
|
||||
|
@ -60,7 +60,6 @@
|
||||
#include <set>
|
||||
#include <atomic>
|
||||
|
||||
#include "../node/NonCopyable.hpp"
|
||||
#include "../node/InetAddress.hpp"
|
||||
#include "../node/Mutex.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
@ -87,7 +86,7 @@ namespace ZeroTier {
|
||||
* On OSes that do not support local port enumeration or where this is not
|
||||
* meaningful, this degrades to binding to wildcard.
|
||||
*/
|
||||
class Binder : NonCopyable
|
||||
class Binder
|
||||
{
|
||||
private:
|
||||
struct _Binding
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "../node/Utils.hpp"
|
||||
#include "../node/SharedPtr.hpp"
|
||||
#include "../node/AtomicCounter.hpp"
|
||||
#include "../node/NonCopyable.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
@ -45,7 +44,7 @@ namespace ZeroTier {
|
||||
/**
|
||||
* A ZT-managed route that used C++ RAII semantics to automatically clean itself up on deallocate
|
||||
*/
|
||||
class ManagedRoute : NonCopyable
|
||||
class ManagedRoute
|
||||
{
|
||||
friend class SharedPtr<ManagedRoute>;
|
||||
|
||||
@ -91,6 +90,9 @@ public:
|
||||
inline const char *device() const { return _device; }
|
||||
|
||||
private:
|
||||
ManagedRoute(const ManagedRoute &) {}
|
||||
inline ManagedRoute &operator=(const ManagedRoute &) { return *this; }
|
||||
|
||||
InetAddress _target;
|
||||
InetAddress _via;
|
||||
InetAddress _systemVia; // for route overrides
|
||||
|
Loading…
x
Reference in New Issue
Block a user