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);
111 equals(
const KeyLocator& other)
const;
160 if (keyName_.checkChanged())
163 ++const_cast<KeyLocator*>(
this)->changeCount_;
169 ndn_KeyLocatorType type_;
174 uint64_t changeCount_;
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
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
bool operator==(const KeyLocator &other) const
Check if this is the same key locator as other.
Definition: key-locator.hpp:119
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
bool operator!=(const KeyLocator &other) const
Check if this is not the same key locator as other.
Definition: key-locator.hpp:127
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 Signature is an abstract base class providing methods to work with the signature information in a D...
Definition: signature.hpp:35
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
bool equals(const KeyLocator &other) const
Check if this is the same key locator as other.
Definition: key-locator.cpp:87
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:158
void set(const KeyLocatorLite &keyLocatorLite)
Clear this key locator, and set the values by copying from keyLocatorLite.
Definition: key-locator.cpp:42