ndn::KeyLocator Class Reference

#include <ndn-cxx/key-locator.hpp>

+ Inheritance diagram for ndn::KeyLocator:
+ Collaboration diagram for ndn::KeyLocator:

Classes

class  Error
 

Public Member Functions

 KeyLocator ()
 Construct an empty KeyLocator. More...
 
 KeyLocator (const Block &wire)
 Construct from wire encoding. More...
 
 KeyLocator (const Name &name)
 Construct from Name. More...
 
KeyLocatorclear ()
 Reset KeyLocator to its default-constructed state. More...
 
bool empty () const
 
const BlockgetKeyDigest () const
 Get nested KeyDigest element. More...
 
const NamegetName () const
 Get nested Name element. More...
 
uint32_t getType () const
 
KeyLocatorsetKeyDigest (const Block &keyDigest)
 Set nested KeyDigest element (whole TLV). More...
 
KeyLocatorsetKeyDigest (const ConstBufferPtr &keyDigest)
 Set nested KeyDigest element value. More...
 
KeyLocatorsetName (const Name &name)
 Set nested Name element. More...
 
void wireDecode (const Block &wire)
 Decode from wire encoding. More...
 
const BlockwireEncode () const
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder) const
 Prepend wire encoding to encoder. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const KeyLocator &kl)
 
bool operator== (const KeyLocator &lhs, const KeyLocator &rhs)
 

Detailed Description

Definition at line 31 of file key-locator.hpp.

Constructor & Destructor Documentation

◆ KeyLocator() [1/3]

ndn::KeyLocator::KeyLocator ( )
default

Construct an empty KeyLocator.

Postcondition
empty() == true

◆ KeyLocator() [2/3]

ndn::KeyLocator::KeyLocator ( const Name name)

Construct from Name.

Note
Implicit conversion is permitted.
Postcondition
getType() == tlv::Name

Definition at line 39 of file key-locator.cpp.

◆ KeyLocator() [3/3]

ndn::KeyLocator::KeyLocator ( const Block wire)
explicit

Construct from wire encoding.

Definition at line 34 of file key-locator.cpp.

Member Function Documentation

◆ clear()

KeyLocator & ndn::KeyLocator::clear ( )

Reset KeyLocator to its default-constructed state.

Postcondition
empty() == true
getType() == tlv::Invalid
Returns
self

Definition at line 129 of file key-locator.cpp.

◆ empty()

bool ndn::KeyLocator::empty ( ) const
inline

Definition at line 76 of file key-locator.hpp.

◆ getKeyDigest()

const Block & ndn::KeyLocator::getKeyDigest ( ) const

Get nested KeyDigest element.

Exceptions
Errorif type is not tlv::KeyDigest

Definition at line 156 of file key-locator.cpp.

◆ getName()

const Name & ndn::KeyLocator::getName ( ) const

Get nested Name element.

Exceptions
Errorif type is not tlv::Name

Definition at line 137 of file key-locator.cpp.

◆ getType()

uint32_t ndn::KeyLocator::getType ( ) const

Definition at line 112 of file key-locator.cpp.

◆ setKeyDigest() [1/2]

KeyLocator & ndn::KeyLocator::setKeyDigest ( const Block keyDigest)

Set nested KeyDigest element (whole TLV).

Postcondition
getType() == tlv::KeyDigest
Exceptions
std::invalid_argumentBlock type is not tlv::KeyDigest
Returns
self

Definition at line 167 of file key-locator.cpp.

◆ setKeyDigest() [2/2]

KeyLocator & ndn::KeyLocator::setKeyDigest ( const ConstBufferPtr keyDigest)

Set nested KeyDigest element value.

Parameters
keyDigestbuffer to use as TLV-VALUE of the nested KeyDigest element.
Postcondition
getType() == tlv::KeyDigest
Returns
self

Definition at line 178 of file key-locator.cpp.

◆ setName()

KeyLocator & ndn::KeyLocator::setName ( const Name name)

Set nested Name element.

Postcondition
getType() == tlv::Name
Returns
self

Definition at line 148 of file key-locator.cpp.

◆ wireDecode()

void ndn::KeyLocator::wireDecode ( const Block wire)

Decode from wire encoding.

Exceptions
Errorouter TLV type is not KeyLocator
Note
No error is raised for an unrecognized nested TLV, but attempting to reencode will throw.

Definition at line 84 of file key-locator.cpp.

◆ wireEncode() [1/2]

const Block & ndn::KeyLocator::wireEncode ( ) const

Definition at line 68 of file key-locator.cpp.

◆ wireEncode() [2/2]

template<encoding::Tag TAG>
size_t ndn::KeyLocator::wireEncode ( EncodingImpl< TAG > &  encoder) const

Prepend wire encoding to encoder.

Definition at line 46 of file key-locator.cpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const KeyLocator kl 
)
friend

Definition at line 142 of file key-locator.hpp.

◆ operator==

bool operator== ( const KeyLocator lhs,
const KeyLocator rhs 
)
friend

Definition at line 137 of file key-locator.hpp.