All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ndn::Tlv Namespace Reference

Namespace defining NDN-TLV related constants and procedures. More...

Namespaces

 FaceManagement
 

Data Structures

class  Error
 

Enumerations

enum  {
  Interest = 5, Data = 6, Name = 7, NameComponent = 8,
  Selectors = 9, Nonce = 10, Scope = 11, InterestLifetime = 12,
  MinSuffixComponents = 13, MaxSuffixComponents = 14, PublisherPublicKeyLocator = 15, Exclude = 16,
  ChildSelector = 17, MustBeFresh = 18, Any = 19, MetaInfo = 20,
  Content = 21, SignatureInfo = 22, SignatureValue = 23, ContentType = 24,
  FreshnessPeriod = 25, FinalBlockId = 26, SignatureType = 27, KeyLocator = 28,
  KeyLocatorDigest = 29, AppPrivateBlock1 = 128, AppPrivateBlock2 = 32767
}
 
enum  SignatureType { DigestSha256 = 0, SignatureSha256WithRsa = 1 }
 
enum  ConentType { ContentType_Default = 0, ContentType_Link = 1, ContentType_Key = 2 }
 

Functions

template<class InputIterator >
bool readVarNumber (InputIterator &begin, const InputIterator &end, uint64_t &number)
 Read VAR-NUMBER in NDN-TLV encoding. More...
 
template<class InputIterator >
bool readType (InputIterator &begin, const InputIterator &end, uint32_t &type)
 Read TLV Type. More...
 
template<class InputIterator >
uint64_t readVarNumber (InputIterator &begin, const InputIterator &end)
 Read VAR-NUMBER in NDN-TLV encoding. More...
 
template<class InputIterator >
uint32_t readType (InputIterator &begin, const InputIterator &end)
 Read TLV Type. More...
 
size_t sizeOfVarNumber (uint64_t varNumber)
 Get number of bytes necessary to hold value of VAR-NUMBER. More...
 
size_t writeVarNumber (std::ostream &os, uint64_t varNumber)
 Write VAR-NUMBER to the specified stream. More...
 
template<class InputIterator >
uint64_t readNonNegativeInteger (size_t size, InputIterator &begin, const InputIterator &end)
 Read nonNegativeInteger in NDN-TLV encoding. More...
 
size_t sizeOfNonNegativeInteger (uint64_t varNumber)
 Get number of bytes necessary to hold value of nonNegativeInteger. More...
 
size_t writeNonNegativeInteger (std::ostream &os, uint64_t varNumber)
 Write nonNegativeInteger to the specified stream. More...
 
template<>
bool readVarNumber< std::istream_iterator< uint8_t > > (std::istream_iterator< uint8_t > &begin, const std::istream_iterator< uint8_t > &end, uint64_t &value)
 
template<>
uint64_t readNonNegativeInteger< std::istream_iterator< uint8_t > > (size_t size, std::istream_iterator< uint8_t > &begin, const std::istream_iterator< uint8_t > &end)
 

Detailed Description

Namespace defining NDN-TLV related constants and procedures.

Enumeration Type Documentation

anonymous enum
Enumerator
Interest 
Data 
Name 
NameComponent 
Selectors 
Nonce 
Scope 
InterestLifetime 
MinSuffixComponents 
MaxSuffixComponents 
PublisherPublicKeyLocator 
Exclude 
ChildSelector 
MustBeFresh 
Any 
MetaInfo 
Content 
SignatureInfo 
SignatureValue 
ContentType 
FreshnessPeriod 
FinalBlockId 
SignatureType 
KeyLocator 
KeyLocatorDigest 
AppPrivateBlock1 
AppPrivateBlock2 

Definition at line 35 of file tlv.hpp.

Enumerator
ContentType_Default 
ContentType_Link 
ContentType_Key 

Definition at line 71 of file tlv.hpp.

Enumerator
DigestSha256 
SignatureSha256WithRsa 

Definition at line 66 of file tlv.hpp.

Function Documentation

template<class InputIterator >
uint64_t ndn::Tlv::readNonNegativeInteger ( size_t  size,
InputIterator &  begin,
const InputIterator &  end 
)
inline

Read nonNegativeInteger in NDN-TLV encoding.

This call will throw ndn::Tlv::Error (aka std::runtime_error) if number cannot be read

Note that after call finished, begin will point to the first byte after the read VAR-NUMBER

How many bytes will be read is directly controlled by the size parameter, which can be either 1, 2, 4, or 8. If the value of size is different, then an exception will be thrown.

Definition at line 372 of file tlv.hpp.

template<>
uint64_t ndn::Tlv::readNonNegativeInteger< std::istream_iterator< uint8_t > > ( size_t  size,
std::istream_iterator< uint8_t > &  begin,
const std::istream_iterator< uint8_t > &  end 
)
inline

Definition at line 417 of file tlv.hpp.

template<class InputIterator >
bool ndn::Tlv::readType ( InputIterator &  begin,
const InputIterator &  end,
uint32_t &  type 
)
inline

Read TLV Type.

Parameters
[in]beginBegin (pointer or iterator) of the buffer
[in]endEnd (pointer or iterator) of the buffer
[out]numberRead type number
Exceptions
Thiscall never throws exception

This call is largely equivalent to tlv::readVarNumber, but exception will be thrown if type is larger than 2^32-1 (type in this library is implemented as uint32_t)

Definition at line 227 of file tlv.hpp.

template<class InputIterator >
uint32_t ndn::Tlv::readType ( InputIterator &  begin,
const InputIterator &  end 
)
inline

Read TLV Type.

Exceptions
Thiscall will throw ndn::Tlv::Error (aka std::runtime_error) if number cannot be read

This call is largely equivalent to tlv::readVarNumber, but exception will be thrown if type is larger than 2^32-1 (type in this library is implemented as uint32_t)

Definition at line 315 of file tlv.hpp.

template<class InputIterator >
bool ndn::Tlv::readVarNumber ( InputIterator &  begin,
const InputIterator &  end,
uint64_t &  number 
)
inline

Read VAR-NUMBER in NDN-TLV encoding.

Parameters
[in]beginBegin (pointer or iterator) of the buffer
[in]endEnd (pointer or iterator) of the buffer
[out]numberRead number
Exceptions
Thiscall never throws exception
Returns
true if number successfully read from input, false otherwise

Definition at line 182 of file tlv.hpp.

template<class InputIterator >
uint64_t ndn::Tlv::readVarNumber ( InputIterator &  begin,
const InputIterator &  end 
)
inline

Read VAR-NUMBER in NDN-TLV encoding.

Exceptions
Thiscall will throw ndn::Tlv::Error (aka std::runtime_error) if number cannot be read

Note that after call finished, begin will point to the first byte after the read VAR-NUMBER

Definition at line 242 of file tlv.hpp.

template<>
bool ndn::Tlv::readVarNumber< std::istream_iterator< uint8_t > > ( std::istream_iterator< uint8_t > &  begin,
const std::istream_iterator< uint8_t > &  end,
uint64_t &  value 
)
inline

Definition at line 257 of file tlv.hpp.

size_t ndn::Tlv::sizeOfNonNegativeInteger ( uint64_t  varNumber)
inline

Get number of bytes necessary to hold value of nonNegativeInteger.

Definition at line 481 of file tlv.hpp.

size_t ndn::Tlv::sizeOfVarNumber ( uint64_t  varNumber)
inline

Get number of bytes necessary to hold value of VAR-NUMBER.

Definition at line 327 of file tlv.hpp.

size_t ndn::Tlv::writeNonNegativeInteger ( std::ostream &  os,
uint64_t  varNumber 
)
inline

Write nonNegativeInteger to the specified stream.

Definition at line 499 of file tlv.hpp.

size_t ndn::Tlv::writeVarNumber ( std::ostream &  os,
uint64_t  varNumber 
)
inline

Write VAR-NUMBER to the specified stream.

Definition at line 344 of file tlv.hpp.