From 181369964f501c3c702971b30c82b9e84eed58db Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 27 Mar 2014 18:22:53 -0700 Subject: Make TCP optional, rename port constant. --- node/Constants.hpp | 4 ++-- node/Node.cpp | 4 ++-- node/Node.hpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'node') diff --git a/node/Constants.hpp b/node/Constants.hpp index cf031e64..1b00872d 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -114,9 +114,9 @@ error_no_byte_order_defined; #define ZT_ADDRESS_RESERVED_PREFIX 0xff /** - * Default local port for ZeroTier traffic + * Default local port for ZeroTier UDP traffic */ -#define ZT_DEFAULT_PORT 9993 +#define ZT_DEFAULT_UDP_PORT 9993 /** * Default payload MTU for UDP packets diff --git a/node/Node.cpp b/node/Node.cpp index 20a049bc..913b7400 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -377,8 +377,8 @@ Node::Node(const char *hp,unsigned int udpPort,unsigned int tcpPort,bool resetId } } - impl->udpPort = ((udpPort > 0)&&(udpPort <= 0xffff)) ? udpPort : (unsigned int)ZT_DEFAULT_PORT; - impl->tcpPort = ((tcpPort > 0)&&(tcpPort <= 0xffff)) ? tcpPort : (unsigned int)ZT_DEFAULT_PORT; + impl->udpPort = udpPort & 0xffff; + impl->tcpPort = tcpPort & 0xffff; impl->reasonForTermination = Node::NODE_RUNNING; impl->started = false; impl->running = false; diff --git a/node/Node.hpp b/node/Node.hpp index bf154dc2..ceb4e745 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -153,11 +153,11 @@ public: * The node is not executed until run() is called. * * @param hp Home directory path or NULL for system-wide default for this platform (default: NULL) - * @param udpPort UDP port or 0 for default (9993) (default: 0) - * @param tcpPort TCP port or 0 for default (9993) (default: 0) + * @param udpPort UDP port or 0 to disable (default: 9993) + * @param tcpPort TCP port or 0 to disable (default: 0) * @param resetIdentity If true, delete identity before starting and regenerate (default: false) */ - Node(const char *hp = (const char *)0,unsigned int udpPort = 0,unsigned int tcpPort = 0,bool resetIdentity = false) + Node(const char *hp = (const char *)0,unsigned int udpPort = 9993,unsigned int tcpPort = 0,bool resetIdentity = false) throw(); ~Node(); -- cgit v1.2.3