22 #ifndef NDN_KEY_LOCATOR_HPP
23 #define NDN_KEY_LOCATOR_HPP
26 #include "c/key-types.h"
28 #include "util/change-counter.hpp"
39 : type_((ndn_KeyLocatorType)-1), keyNameType_((ndn_KeyNameType)-1), changeCount_(0)
49 type_ = (ndn_KeyLocatorType)-1;
50 keyNameType_ = (ndn_KeyNameType)-1;
72 getType()
const {
return type_; }
75 getKeyData()
const {
return keyData_; }
78 getKeyName()
const {
return keyName_.get(); }
81 getKeyName() {
return keyName_.get(); }
91 setType(ndn_KeyLocatorType
type)
105 setKeyName(
const Name &
keyName)
107 keyName_.set(keyName);
154 if (keyName_.checkChanged())
157 ++const_cast<KeyLocator*>(
this)->changeCount_;
163 ndn_KeyLocatorType type_;
175 ndn_KeyNameType keyNameType_;
176 uint64_t changeCount_;
Copyright (C) 2013-2015 Regents of the University of California.
Definition: common.hpp:35
struct ndn_Blob keyData
A Blob whose value is a pointer to a pre-allocated buffer for the key data as follows: If type is ndn...
Definition: key-types.h:53
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:58
static const KeyLocator & getFromSignature(const Signature *signature)
If the signature is a type that has a KeyLocator, then return it.
Definition: key-locator.cpp:65
ndn_KeyLocatorType type
-1 for none
Definition: key-types.h:52
A ChangeCounter keeps a target object whose change count is tracked by a local change count...
Definition: change-counter.hpp:37
ndn_KeyNameType keyNameType
The type of data for keyName, -1 for none.
Definition: key-types.h:64
An ndn_KeyLocator holds the type of key locator and related data.
Definition: key-types.h:51
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:42
A Signature is an abstract base class providing methods to work with the signature information in a D...
Definition: signature.hpp:36
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:47
struct ndn_Name keyName
The key name (only used if type is ndn_KeyLocatorType_KEYNAME.)
Definition: key-types.h:62
void set(const struct ndn_KeyLocator &keyLocatorStruct)
Clear this key locator, and set the values by copying from the ndn_KeyLocator struct.
Definition: key-locator.cpp:43
Definition: key-locator.hpp:36
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:152
void DEPRECATED_IN_NDN_CPP setKeyNameType(ndn_KeyNameType keyNameType)
Definition: key-locator.hpp:117
ndn_KeyNameType DEPRECATED_IN_NDN_CPP getKeyNameType() const
Definition: key-locator.hpp:88