NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::KeyLocator Class Reference

#include <key-locator.hpp>

Classes

class  Error
 

Public Member Functions

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

Friends

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

Detailed Description

Definition at line 30 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 46 of file key-locator.cpp.

◆ KeyLocator() [3/3]

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

Construct from wire encoding.

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

References wireDecode().

Member Function Documentation

◆ wireEncode() [1/2]

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

◆ wireEncode() [2/2]

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

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

References ndn::Block::hasWire().

◆ 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 91 of file key-locator.cpp.

References clear(), ndn::Block::elements(), ndn::Block::elements_begin(), ndn::tlv::KeyDigest, ndn::tlv::KeyLocator, ndn::tlv::Name, NDN_THROW, ndn::Block::parse(), and ndn::Block::type().

Referenced by KeyLocator().

◆ empty()

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

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

References clear(), getKeyDigest(), getName(), getType(), setKeyDigest(), and setName().

◆ getType()

uint32_t ndn::KeyLocator::getType ( ) const

◆ clear()

KeyLocator & ndn::KeyLocator::clear ( )

Reset KeyLocator to its default-constructed state.

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

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

References ndn::Block::reset().

Referenced by empty(), and wireDecode().

◆ getName()

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

Get nested Name element.

Exceptions
Errorif type is not tlv::Name

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

References NDN_THROW.

Referenced by empty(), and ndn::security::v2::getKeyLocatorName().

◆ setName()

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

Set nested Name element.

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

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

References ndn::Block::reset().

Referenced by empty().

◆ getKeyDigest()

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

Get nested KeyDigest element.

Exceptions
Errorif type is not tlv::KeyDigest

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

References NDN_THROW.

Referenced by empty().

◆ 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 174 of file key-locator.cpp.

References ndn::tlv::KeyDigest, NDN_THROW, ndn::Block::reset(), ndn::to_string(), and ndn::Block::type().

Referenced by empty().

◆ 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 185 of file key-locator.cpp.

References ndn::tlv::KeyDigest, ndn::encoding::makeBinaryBlock(), and ndn::Block::reset().

Friends And Related Function Documentation

◆ operator==

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

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

◆ operator!=

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

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

◆ operator<<

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

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


The documentation for this class was generated from the following files: