summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-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
5 files changed, 29 insertions, 2 deletions
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;