34 unsigned char _message_counter[24];
40 unsigned char _key[32];
46 unsigned char _pubkey[32];
86 ZyreNode(
const std::string& uuid,
const std::string& name,
const std::string& deviceClass,
const std::string& address)
87 :
BasicNode(uuid, name, deviceClass), _address(address), _online(false) { }
133 void SetKeys(
unsigned char* k,
unsigned char* pk)
136 memcpy(_pubkey, pk, 32);
146 return _message_counter;
174 for (
int i = 23; i >= 0; i--)
if (++const_cast <ZyreNode*>(
this)->_message_counter[i])
break;
183 memcpy(const_cast <ZyreNode*>(
this)->_message_counter, c, 24);
193 std::ostringstream stream;
194 stream <<
"online=" << (_online ?
"true" :
"false") <<
", " 195 <<
"address=" << _address;
ZyreNode(const std::string &uuid, const std::string &name, const std::string &deviceClass, const std::string &address)
Construct a new ZyreNode object.
void SetVerified()
Set the verified status of the node.
A Node as discovered by the Zyre protocol.
bool IsOnline() const override
Is the Node currently online?
void IncrementCtr() const
Increment the nonce counter the node.
std::atomic< bool > _online
Is the Node currently online?
void SetKeys(unsigned char *k, unsigned char *pk)
Set the shared cryptographic key and the public key of the node.
const std::string & GetAddress() const
Get the IP address of the node.
void SetCtr(unsigned char *c) const
Set the nonce (counter)
void SetOnline(bool online)
Mark the Node as online or offline.
std::string _address
IP address of the node.
const bool GetVerified() const
Is the node verified?
const unsigned char * GetKey() const
Get the shared cryptographic key of the node.
virtual std::string GetDescription() const override
Get a user-readable description of the node.
std::atomic< bool > _verified
Is the Node verified?
friend ZyreEndpoint
Only ZyreEdpoint can manage these objects.
const unsigned char * GetPubKey() const
Get the public key of the node.
const unsigned char * GetCtr() const
Get the nonce counter of the node.
A simple Node with a UUID.