diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-01-09 15:55:07 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-01-09 15:55:07 -0800 |
| commit | d5528e4e9a35d7f1c88a373b99c7b31a03eccd5a (patch) | |
| tree | be0f8ef8e494f88329e411edf2e832b4748abdda /include | |
| parent | dbd577c6b0a6d984452d04415733c275ba6577a4 (diff) | |
| download | infinitytier-d5528e4e9a35d7f1c88a373b99c7b31a03eccd5a.tar.gz infinitytier-d5528e4e9a35d7f1c88a373b99c7b31a03eccd5a.zip | |
Wire up VERB_USER_MESSAGE in core.
Diffstat (limited to 'include')
| -rw-r--r-- | include/ZeroTierOne.h | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/include/ZeroTierOne.h b/include/ZeroTierOne.h index 21544b96..8b1ee0ac 100644 --- a/include/ZeroTierOne.h +++ b/include/ZeroTierOne.h @@ -393,7 +393,17 @@ enum ZT_Event * * Meta-data: C string, TRACE message */ - ZT_EVENT_TRACE = 5 + ZT_EVENT_TRACE = 5, + + /** + * VERB_USER_MESSAGE received + * + * These are generated when a VERB_USER_MESSAGE packet is received via + * ZeroTier VL1. + * + * Meta-data: ZT_UserMessage structure + */ + ZT_EVENT_USER_MESSAGE = 6 }; /** @@ -407,6 +417,32 @@ enum ZT_RelayPolicy }; /** + * User message used with ZT_EVENT_USER_MESSAGE + */ +typedef struct +{ + /** + * ZeroTier address of sender (least significant 40 bits) + */ + uint64_t origin; + + /** + * User message type ID + */ + uint64_t typeId; + + /** + * User message data (not including type ID) + */ + const void *data; + + /** + * Length of data in bytes + */ + unsigned int length; +} ZT_UserMessage; + +/** * Current node status */ typedef struct @@ -1854,6 +1890,20 @@ int ZT_Node_addLocalInterfaceAddress(ZT_Node *node,const struct sockaddr_storage void ZT_Node_clearLocalInterfaceAddresses(ZT_Node *node); /** + * Send a VERB_USER_MESSAGE to another ZeroTier node + * + * There is no delivery guarantee here. Failure can occur if the message is + * too large or if dest is not a valid ZeroTier address. + * + * @param dest Destination ZeroTier address + * @param typeId VERB_USER_MESSAGE type ID + * @param data Payload data to attach to user message + * @param len Length of data in bytes + * @return Boolean: non-zero on success, zero on failure + */ +int ZT_Node_sendUserMessage(ZT_Node *node,uint64_t dest,uint64_t typeId,const void *data,unsigned int len); + +/** * Set peer role * * Right now this can only be used to set a peer to either LEAF or |
