diff options
| author | Grant Limberg <glimberg@gmail.com> | 2015-04-24 16:48:48 -0700 |
|---|---|---|
| committer | Grant Limberg <glimberg@gmail.com> | 2015-04-24 16:48:48 -0700 |
| commit | 0f808e11df8646e82eb3e178896dc8d88f8d79d3 (patch) | |
| tree | a09e8c27911f73e65ab2ec0ef0068d143d89a72c /node | |
| parent | 1a65a79e57521a0d20d6a2c6d18ab8cf169fcd50 (diff) | |
| parent | ce09e363dc95d801e8707a29a0d585089d6c3d09 (diff) | |
| download | infinitytier-0f808e11df8646e82eb3e178896dc8d88f8d79d3.tar.gz infinitytier-0f808e11df8646e82eb3e178896dc8d88f8d79d3.zip | |
Merge branch 'adamierymenko-dev' into android-jni
Diffstat (limited to 'node')
| -rw-r--r-- | node/BandwidthAccount.hpp | 5 | ||||
| -rw-r--r-- | node/Constants.hpp | 2 | ||||
| -rw-r--r-- | node/IncomingPacket.cpp | 2 | ||||
| -rw-r--r-- | node/Network.cpp | 2 | ||||
| -rw-r--r-- | node/Node.cpp | 8 | ||||
| -rw-r--r-- | node/Node.hpp | 14 | ||||
| -rw-r--r-- | node/Peer.hpp | 3 |
7 files changed, 21 insertions, 15 deletions
diff --git a/node/BandwidthAccount.hpp b/node/BandwidthAccount.hpp index b6ebfa3e..3a6432c4 100644 --- a/node/BandwidthAccount.hpp +++ b/node/BandwidthAccount.hpp @@ -28,10 +28,13 @@ #ifndef ZT_BWACCOUNT_HPP #define ZT_BWACCOUNT_HPP +#include "Constants.hpp" + +#include <algorithm> + #include <stdint.h> #include <math.h> -#include "Constants.hpp" #include "Utils.hpp" #ifdef __WINDOWS__ diff --git a/node/Constants.hpp b/node/Constants.hpp index cefd4863..10c48c20 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -91,7 +91,9 @@ #ifndef __WINDOWS__ #define __WINDOWS__ #endif +#ifndef NOMINMAX #define NOMINMAX +#endif #pragma warning(disable : 4290) #pragma warning(disable : 4996) #pragma warning(disable : 4101) diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 5397d51c..a8d564bb 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -685,7 +685,7 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons outp.append(pid); outp.append(nwid); outp.append((uint16_t)netconfStr.length()); - outp.append(netconfStr.data(),netconfStr.length()); + outp.append(netconfStr.data(),(unsigned int)netconfStr.length()); outp.compress(); if (outp.size() > ZT_PROTO_MAX_PACKET_LENGTH) { TRACE("NETWORK_CONFIG_REQUEST failed: internal error: netconf size %u is too large",(unsigned int)netconfStr.length()); diff --git a/node/Network.cpp b/node/Network.cpp index 08856f02..ddfb01c7 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -437,7 +437,7 @@ void Network::learnBridgeRoute(const MAC &mac,const Address &addr) void Network::learnBridgedMulticastGroup(const MulticastGroup &mg,uint64_t now) { Mutex::Lock _l(_lock); - unsigned long tmp = _multicastGroupsBehindMe.size(); + unsigned long tmp = (unsigned long)_multicastGroupsBehindMe.size(); _multicastGroupsBehindMe[mg] = now; if (tmp != _multicastGroupsBehindMe.size()) _announceMulticastGroups(); diff --git a/node/Node.cpp b/node/Node.cpp index 2ffdeb96..e77a977e 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -60,7 +60,7 @@ Node::Node( ZT1_EventCallback eventCallback, const char *overrideRootTopology) : RR(new RuntimeEnvironment(this)), - _uptr(uptr), + _uPtr(uptr), _dataStoreGetFunction(dataStoreGetFunction), _dataStorePutFunction(dataStorePutFunction), _wirePacketSendFunction(wirePacketSendFunction), @@ -426,7 +426,7 @@ std::string Node::dataStoreGet(const char *name) std::string r; unsigned long olen = 0; do { - long n = _dataStoreGetFunction(reinterpret_cast<ZT1_Node *>(this),_uptr,name,buf,sizeof(buf),r.length(),&olen); + long n = _dataStoreGetFunction(reinterpret_cast<ZT1_Node *>(this),_uPtr,name,buf,sizeof(buf),(unsigned long)r.length(),&olen); if (n <= 0) return std::string(); r.append(buf,n); @@ -454,14 +454,14 @@ void Node::postTrace(const char *module,unsigned int line,const char *fmt,...) Mutex::Lock _l(traceLock); + time_t now = (time_t)(_now / 1000ULL); #ifdef __WINDOWS__ ctime_s(tmp3,sizeof(tmp3),&now); char *nowstr = tmp3; #else - time_t now = (time_t)(_now / 1000ULL); char *nowstr = ctime_r(&now,tmp3); #endif - unsigned long nowstrlen = strlen(nowstr); + unsigned long nowstrlen = (unsigned long)strlen(nowstr); if (nowstr[nowstrlen-1] == '\n') nowstr[--nowstrlen] = (char)0; if (nowstr[nowstrlen-1] == '\r') diff --git a/node/Node.hpp b/node/Node.hpp index f07776da..396e04c0 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -127,7 +127,7 @@ public: { return (_wirePacketSendFunction( reinterpret_cast<ZT1_Node *>(this), - _uptr, + _uPtr, reinterpret_cast<const struct sockaddr_storage *>(&addr), desperation, data, @@ -149,7 +149,7 @@ public: { _virtualNetworkFrameFunction( reinterpret_cast<ZT1_Node *>(this), - _uptr, + _uPtr, nwid, source.toInt(), dest.toInt(), @@ -192,9 +192,9 @@ public: */ inline unsigned int coreDesperation() const throw() { return _coreDesperation; } - inline bool dataStorePut(const char *name,const void *data,unsigned int len,bool secure) { return (_dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),_uptr,name,data,len,(int)secure) == 0); } + inline bool dataStorePut(const char *name,const void *data,unsigned int len,bool secure) { return (_dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),_uPtr,name,data,len,(int)secure) == 0); } inline bool dataStorePut(const char *name,const std::string &data,bool secure) { return dataStorePut(name,(const void *)data.data(),(unsigned int)data.length(),secure); } - inline void dataStoreDelete(const char *name) { _dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),_uptr,name,(const void *)0,0,0); } + inline void dataStoreDelete(const char *name) { _dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),_uPtr,name,(const void *)0,0,0); } std::string dataStoreGet(const char *name); /** @@ -203,7 +203,7 @@ public: * @param ev Event type * @param md Meta-data (default: NULL/none) */ - inline void postEvent(ZT1_Event ev,const void *md = (const void *)0) { _eventCallback(reinterpret_cast<ZT1_Node *>(this),_uptr,ev,md); } + inline void postEvent(ZT1_Event ev,const void *md = (const void *)0) { _eventCallback(reinterpret_cast<ZT1_Node *>(this),_uPtr,ev,md); } /** * Update virtual network port configuration @@ -212,7 +212,7 @@ public: * @param op Configuration operation * @param nc Network configuration */ - inline int configureVirtualNetworkPort(uint64_t nwid,ZT1_VirtualNetworkConfigOperation op,const ZT1_VirtualNetworkConfig *nc) { return _virtualNetworkConfigFunction(reinterpret_cast<ZT1_Node *>(this),_uptr,nwid,op,nc); } + inline int configureVirtualNetworkPort(uint64_t nwid,ZT1_VirtualNetworkConfigOperation op,const ZT1_VirtualNetworkConfig *nc) { return _virtualNetworkConfigFunction(reinterpret_cast<ZT1_Node *>(this),_uPtr,nwid,op,nc); } /** * @return True if we appear to be online @@ -231,7 +231,7 @@ public: private: RuntimeEnvironment *RR; - void *_uptr; + void *_uPtr; // _uptr (lower case) is reserved in Visual Studio :P ZT1_DataStoreGetFunction _dataStoreGetFunction; ZT1_DataStorePutFunction _dataStorePutFunction; diff --git a/node/Peer.hpp b/node/Peer.hpp index d9ed5670..e36b0c7b 100644 --- a/node/Peer.hpp +++ b/node/Peer.hpp @@ -30,6 +30,8 @@ #include <stdint.h> +#include "Constants.hpp" + #include <algorithm> #include <utility> #include <vector> @@ -37,7 +39,6 @@ #include "../include/ZeroTierOne.h" -#include "Constants.hpp" #include "RuntimeEnvironment.hpp" #include "Path.hpp" #include "Address.hpp" |
