summaryrefslogtreecommitdiff
path: root/node/Node.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-01-09 15:55:07 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-01-09 15:55:07 -0800
commitd5528e4e9a35d7f1c88a373b99c7b31a03eccd5a (patch)
treebe0f8ef8e494f88329e411edf2e832b4748abdda /node/Node.cpp
parentdbd577c6b0a6d984452d04415733c275ba6577a4 (diff)
downloadinfinitytier-d5528e4e9a35d7f1c88a373b99c7b31a03eccd5a.tar.gz
infinitytier-d5528e4e9a35d7f1c88a373b99c7b31a03eccd5a.zip
Wire up VERB_USER_MESSAGE in core.
Diffstat (limited to 'node/Node.cpp')
-rw-r--r--node/Node.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index ed60817f..32d41305 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -473,6 +473,20 @@ void Node::clearLocalInterfaceAddresses()
_directPaths.clear();
}
+int Node::sendUserMessage(uint64_t dest,uint64_t typeId,const void *data,unsigned int len)
+{
+ try {
+ Packet outp(Address(dest),RR->identity.address(),Packet::VERB_USER_MESSAGE);
+ outp.append(typeId);
+ outp.append(data,len);
+ outp.compress();
+ RR->sw->send(outp,true);
+ return 1;
+ } catch ( ... ) {
+ return 0;
+ }
+}
+
void Node::setRole(uint64_t ztAddress,ZT_PeerRole role)
{
RR->topology->setUpstream(Address(ztAddress),(role == ZT_PEER_ROLE_UPSTREAM));
@@ -992,6 +1006,15 @@ void ZT_Node_clearLocalInterfaceAddresses(ZT_Node *node)
} catch ( ... ) {}
}
+int ZT_Node_sendUserMessage(ZT_Node *node,uint64_t dest,uint64_t typeId,const void *data,unsigned int len)
+{
+ try {
+ return reinterpret_cast<ZeroTier::Node *>(node)->sendUserMessage(dest,typeId,data,len);
+ } catch ( ... ) {
+ return 0;
+ }
+}
+
void ZT_Node_setRole(ZT_Node *node,uint64_t ztAddress,ZT_PeerRole role)
{
try {