summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-23 22:46:04 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-23 22:46:04 -0700
commit668c428051706e33a1d5a411a1b446ca865a4854 (patch)
tree07c80e0e5b750efb3da385e89d3e27ead83a5ce6
parent10fc164fcbdeb678e224019d860738d016b6f030 (diff)
downloadinfinitytier-668c428051706e33a1d5a411a1b446ca865a4854.tar.gz
infinitytier-668c428051706e33a1d5a411a1b446ca865a4854.zip
Basic RPC stuff in Packet and PacketDecoder for RPC service support.
-rw-r--r--Makefile.mac5
-rw-r--r--node/NodeConfig.cpp2
-rw-r--r--node/Packet.cpp1
-rw-r--r--node/Packet.hpp21
-rw-r--r--node/PacketDecoder.cpp6
-rw-r--r--node/PacketDecoder.hpp1
6 files changed, 30 insertions, 6 deletions
diff --git a/Makefile.mac b/Makefile.mac
index bace24b2..5f6283ba 100644
--- a/Makefile.mac
+++ b/Makefile.mac
@@ -13,10 +13,7 @@ STRIP=strip
#STRIP=echo
CXXFLAGS=$(CFLAGS) -fno-rtti
-
-# We statically link against libcrypto since Apple has apparently decided
-# to deprecate it and may remove it in future OS releases.
-LIBS=ext/bin/libcrypto/mac-x86_combined/libcrypto.a
+LIBS=-lcrypto
include objects.mk
diff --git a/node/NodeConfig.cpp b/node/NodeConfig.cpp
index 925b056b..1a84b6b7 100644
--- a/node/NodeConfig.cpp
+++ b/node/NodeConfig.cpp
@@ -237,7 +237,7 @@ void NodeConfig::_CBcontrolPacketHandler(UdpSocket *sock,void *arg,const InetAdd
sock->send(remoteAddr,p->data(),p->size(),-1);
}
} catch ( ... ) {
- TRACE("exception handling control bus packet from %s",remoteAddr.toString.c_str());
+ TRACE("exception handling control bus packet from %s",remoteAddr.toString().c_str());
}
}
diff --git a/node/Packet.cpp b/node/Packet.cpp
index d12f396d..bce80bf1 100644
--- a/node/Packet.cpp
+++ b/node/Packet.cpp
@@ -42,6 +42,7 @@ const char *Packet::verbString(Verb v)
case VERB_FRAME: return "FRAME";
case VERB_MULTICAST_FRAME: return "MULTICAST_FRAME";
case VERB_MULTICAST_LIKE: return "MULTICAST_LIKE";
+ case VERB_RPC: return "RPC";
}
return "(unknown)";
}
diff --git a/node/Packet.hpp b/node/Packet.hpp
index 5ccfae45..13361497 100644
--- a/node/Packet.hpp
+++ b/node/Packet.hpp
@@ -463,7 +463,26 @@ public:
*
* No OK or ERROR is generated.
*/
- VERB_MULTICAST_FRAME = 9
+ VERB_MULTICAST_FRAME = 9,
+
+ /* Call a plugin via RPC:
+ * <[1] length of function name>
+ * <[...] function name>
+ * [<[2] length of argument>]
+ * [<[...] argument>]
+ * [... additional length/argument pairs ...]
+ *
+ * This generates ERROR_NOT_FOUND if the specified function was not
+ * found. Otherwise it generates an OK message. The OK message has
+ * the same format as the request, except arguments are replaced
+ * by results.
+ *
+ * This can be used to implement simple RPC. No retransmission or
+ * other guarantees are made, so it behaves like UDP-based RPC
+ * protocols. Plugins are typically run by supernodes and are used
+ * to implement network lookup and other services.
+ */
+ VERB_RPC = 10
};
/**
diff --git a/node/PacketDecoder.cpp b/node/PacketDecoder.cpp
index 810e30a7..e081fa8e 100644
--- a/node/PacketDecoder.cpp
+++ b/node/PacketDecoder.cpp
@@ -102,6 +102,8 @@ bool PacketDecoder::tryDecode(const RuntimeEnvironment *_r)
return _doMULTICAST_LIKE(_r,peer);
case Packet::VERB_MULTICAST_FRAME:
return _doMULTICAST_FRAME(_r,peer);
+ case Packet::VERB_RPC:
+ return _doRPC(_r,peer);
default:
// This might be something from a new or old version of the protocol.
// Technically it passed HMAC so the packet is still valid, but we
@@ -538,4 +540,8 @@ bool PacketDecoder::_doMULTICAST_FRAME(const RuntimeEnvironment *_r,const Shared
return true;
}
+bool PacketDecoder::_doRPC(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer)
+{
+}
+
} // namespace ZeroTier
diff --git a/node/PacketDecoder.hpp b/node/PacketDecoder.hpp
index e595d326..82bf9aee 100644
--- a/node/PacketDecoder.hpp
+++ b/node/PacketDecoder.hpp
@@ -122,6 +122,7 @@ private:
bool _doFRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
bool _doMULTICAST_LIKE(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
bool _doMULTICAST_FRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
+ bool _doRPC(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
uint64_t _receiveTime;
Demarc::Port _localPort;