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

Abstraction of validity period. More...

#include <validity-period.hpp>

Classes

class  Error
 

Public Member Functions

 ValidityPeriod ()=default
 Set validity period (UNIX epoch, UNIX epoch) that is always invalid. More...
 
 ValidityPeriod (const Block &block)
 Create validity period from block. More...
 
 ValidityPeriod (const time::system_clock::TimePoint &notBefore, const time::system_clock::TimePoint &notAfter)
 Create validity period (notBefore, notAfter) More...
 
bool isValid (const time::system_clock::TimePoint &now=time::system_clock::now()) const
 Check if now falls within the validity period. More...
 
ValidityPeriodsetPeriod (const time::system_clock::TimePoint &notBefore, const time::system_clock::TimePoint &notAfter)
 Set validity period (notBefore, notAfter) More...
 
std::pair< time::system_clock::TimePoint, time::system_clock::TimePointgetPeriod () const
 Get the stored validity period. More...
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder) const
 Fast encoding or block size estimation. More...
 
const BlockwireEncode () const
 Encode ValidityPeriod into TLV block. More...
 
void wireDecode (const Block &wire)
 Decode ValidityPeriod from TLV block. More...
 
bool operator== (const ValidityPeriod &other) const
 
bool operator!= (const ValidityPeriod &other) const
 

Detailed Description

Abstraction of validity period.

See also
docs/tutorials/certificate-format.rst

Definition at line 37 of file validity-period.hpp.

Constructor & Destructor Documentation

ndn::security::ValidityPeriod::ValidityPeriod ( )
default

Set validity period (UNIX epoch, UNIX epoch) that is always invalid.

Referenced by ndn::security::ValidityPeriod::Error::Error().

ndn::security::ValidityPeriod::ValidityPeriod ( const Block block)
explicit

Create validity period from block.

Definition at line 50 of file validity-period.cpp.

References wireDecode().

ndn::security::ValidityPeriod::ValidityPeriod ( const time::system_clock::TimePoint notBefore,
const time::system_clock::TimePoint notAfter 
)

Create validity period (notBefore, notAfter)

Parameters
notBeforeexclusive beginning of the validity period range
notAfterexclusive end of the validity period range
Note
The supplied time points will be rounded up to the whole seconds:
  • notBefore is rounded up the next whole second
  • notAfter is truncated to the previous whole second

Definition at line 42 of file validity-period.cpp.

Member Function Documentation

bool ndn::security::ValidityPeriod::isValid ( const time::system_clock::TimePoint now = time::system_clock::now()) const

Check if now falls within the validity period.

Parameters
nowTime point to check if it falls within the period
Returns
periodBegin < now and now < periodEnd

Definition at line 145 of file validity-period.cpp.

Referenced by ndn::security::ValidityPeriod::Error::Error().

ValidityPeriod & ndn::security::ValidityPeriod::setPeriod ( const time::system_clock::TimePoint notBefore,
const time::system_clock::TimePoint notAfter 
)

Set validity period (notBefore, notAfter)

Parameters
notBeforeexclusive beginning of the validity period range
notAfterexclusive end of the validity period range
Note
The supplied time points will be rounded up to the whole seconds:
  • notBefore is rounded up the next whole second
  • notAfter is truncated to the previous whole second

Definition at line 128 of file validity-period.cpp.

References ndn::Block::reset().

Referenced by ndn::security::ValidityPeriod::Error::Error().

std::pair< time::system_clock::TimePoint, time::system_clock::TimePoint > ndn::security::ValidityPeriod::getPeriod ( ) const

Get the stored validity period.

Definition at line 139 of file validity-period.cpp.

Referenced by ndn::security::ValidityPeriod::Error::Error(), and ndn::security::operator<<().

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

Encode ValidityPeriod into TLV block.

Definition at line 76 of file validity-period.cpp.

References ndn::Block::hasWire(), and ndn::Block::parse().

Referenced by ndn::security::ValidityPeriod::Error::Error().

bool ndn::security::ValidityPeriod::operator== ( const ValidityPeriod other) const

Definition at line 151 of file validity-period.cpp.

Referenced by ndn::security::ValidityPeriod::Error::Error().

bool ndn::security::ValidityPeriod::operator!= ( const ValidityPeriod other) const

Definition at line 158 of file validity-period.cpp.

Referenced by ndn::security::ValidityPeriod::Error::Error().


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