22 #ifndef NDN_KEY_LOCATOR_HPP
23 #define NDN_KEY_LOCATOR_HPP
26 #include "c/key-types.h"
28 #include "util/change-counter.hpp"
29 #include "lite/key-locator-lite.hpp"
38 : type_((ndn_KeyLocatorType)-1), changeCount_(0)
48 type_ = (ndn_KeyLocatorType)-1;
73 getType()
const {
return type_; }
76 getKeyData()
const {
return keyData_; }
79 getKeyName()
const {
return keyName_.get(); }
82 getKeyName() {
return keyName_.get(); }
85 setType(ndn_KeyLocatorType type)
92 setKeyData(
const Blob& keyData)
99 setKeyName(
const Name &keyName)
101 keyName_.set(keyName);
126 static const KeyLocator&
136 if (keyName_.checkChanged())
139 ++const_cast<KeyLocator*>(
this)->changeCount_;
145 ndn_KeyLocatorType type_;
150 uint64_t changeCount_;
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
static bool canGetFromSignature(const Signature *signature)
If the signature is a type that has a KeyLocator (so that getFromSignature will succeed), return true.
Definition: key-locator.cpp:53
static const KeyLocator & getFromSignature(const Signature *signature)
If the signature is a type that has a KeyLocator, then return it.
Definition: key-locator.cpp:61
A ChangeCounter keeps a target object whose change count is tracked by a local change count...
Definition: change-counter.hpp:37
A KeyLocatorLite holds a type and other info to represent the key which signs a Data packet...
Definition: key-locator-lite.hpp:34
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
void clear()
Clear the keyData and set the type to none.
Definition: key-locator.hpp:46
Definition: key-locator.hpp:35
uint64_t getChangeCount() const
Get the change count, which is incremented each time this object (or a child object) is changed...
Definition: key-locator.hpp:134
void set(const KeyLocatorLite &keyLocatorLite)
Clear this key locator, and set the values by copying from keyLocatorLite.
Definition: key-locator.cpp:42