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 Types

enum  Type { KeyLocator_None = 65535, KeyLocator_Name = 0, KeyLocator_KeyDigest = 1, KeyLocator_Unknown = 255 }
 

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...
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder) const
 prepend wire encoding More...
 
const BlockwireEncode () const
 
void wireDecode (const Block &wire)
 decode from wire encoding More...
 
bool empty () const
 
Type getType () const
 
KeyLocatorclear ()
 clear KeyLocator More...
 
const NamegetName () const
 get Name element More...
 
KeyLocatorsetName (const Name &name)
 set Name element More...
 
const BlockgetKeyDigest () const
 get KeyDigest element More...
 
KeyLocatorsetKeyDigest (const Block &keyDigest)
 set KeyDigest element More...
 
KeyLocatorsetKeyDigest (const ConstBufferPtr &keyDigest)
 set KeyDigest value More...
 
bool operator== (const KeyLocator &other) const
 
bool operator!= (const KeyLocator &other) const
 

Detailed Description

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

Member Enumeration Documentation

◆ Type

Enumerator
KeyLocator_None 

indicates KeyLocator is empty (internal use only)

KeyLocator_Name 

indicates KeyLocator contains a Name

KeyLocator_KeyDigest 

indicates KeyLocator contains a KeyDigest

KeyLocator_Unknown 

indicates KeyLocator contains an unknown element

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

Constructor & Destructor Documentation

◆ KeyLocator() [1/3]

ndn::KeyLocator::KeyLocator ( )

construct an empty KeyLocator

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

◆ KeyLocator() [2/3]

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

construct from wire encoding

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

References wireDecode().

◆ KeyLocator() [3/3]

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

construct from Name

Note
implicit conversion is permitted

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

References setName().

Member Function Documentation

◆ wireEncode() [1/2]

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

prepend wire encoding

Parameters
encoderEncodingBuffer or Estimator

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

References ndn::tlv::KeyLocator, KeyLocator_KeyDigest, KeyLocator_Name, KeyLocator_None, and ndn::Name::wireEncode().

Referenced by ndn::Interest::matchesData(), operator==(), ndn::Selectors::wireEncode(), and ndn::SignatureInfo::wireEncode().

◆ wireEncode() [2/2]

const Block & ndn::KeyLocator::wireEncode ( ) const
Returns
wire encoding

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

References ndn::Block::hasWire().

Referenced by operator==().

◆ wireDecode()

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

decode from wire encoding

Exceptions
Errorouter TLV type is not KeyLocator
Note
No error is thrown for unrecognized inner TLV, but type becomes KeyLocator_Unknown.

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

References ndn::Block::elements(), ndn::Block::elements_begin(), ndn::tlv::KeyDigest, ndn::tlv::KeyLocator, KeyLocator_KeyDigest, KeyLocator_Name, KeyLocator_None, KeyLocator_Unknown, ndn::tlv::Name, ndn::Block::parse(), ndn::Block::type(), and ndn::Name::wireDecode().

Referenced by KeyLocator(), ndn::Selectors::wireDecode(), and ndn::SignatureInfo::wireDecode().

◆ empty()

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

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

References KeyLocator_None.

Referenced by ndn::Selectors::empty(), and ndn::Interest::matchesData().

◆ getType()

Type ndn::KeyLocator::getType ( ) const
inline

◆ clear()

KeyLocator & ndn::KeyLocator::clear ( )

clear KeyLocator

type becomes KeyLocator_None

Returns
self

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

References ndn::Name::clear(), KeyLocator_None, and ndn::Block::reset().

Referenced by setKeyDigest(), and setName().

◆ getName()

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

get Name element

Exceptions
Errorif type is not KeyLocator_Name

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

References KeyLocator_Name.

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

◆ setName()

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

set Name element

type becomes KeyLocator_Name

Returns
self

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

References clear(), and KeyLocator_Name.

Referenced by KeyLocator().

◆ getKeyDigest()

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

get KeyDigest element

Exceptions
Errorif type is not KeyLocator_KeyDigest

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

References KeyLocator_KeyDigest.

Referenced by ndn::operator<<().

◆ setKeyDigest() [1/2]

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

set KeyDigest element

type becomes KeyLocator_KeyDigest

Exceptions
Errorif Block type is not KeyDigest
Returns
self

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

References clear(), ndn::tlv::KeyDigest, KeyLocator_KeyDigest, and ndn::Block::type().

Referenced by setKeyDigest().

◆ setKeyDigest() [2/2]

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

set KeyDigest value

type becomes KeyLocator_KeyDigest

Returns
self

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

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

◆ operator==()

bool ndn::KeyLocator::operator== ( const KeyLocator other) const

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

References wireEncode().

Referenced by operator!=().

◆ operator!=()

bool ndn::KeyLocator::operator!= ( const KeyLocator other) const
inline

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

References operator==().


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