All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | List of all members
ndn::ValidityPeriod Class Reference

A ValidityPeriod is used in a Data packet's SignatureInfo and represents the begin and end times of a certificate's validity period. More...

#include <validity-period.hpp>

Public Member Functions

 ValidityPeriod ()
 Create a default ValidityPeriod where the period is not specified.
 
 ValidityPeriod (MillisecondsSince1970 notBefore, MillisecondsSince1970 notAfter)
 Create a ValidityPeriod with the given period. More...
 
bool hasPeriod () const
 Check if the period has been set. More...
 
MillisecondsSince1970 getNotBefore () const
 Get the beginning of the validity period range. More...
 
MillisecondsSince1970 getNotAfter () const
 Get the end of the validity period range. More...
 
void clear ()
 Reset to a default ValidityPeriod where the period is not specified.
 
ValidityPeriodsetPeriod (MillisecondsSince1970 notBefore, MillisecondsSince1970 notAfter)
 Set the validity period. More...
 
bool equals (const ValidityPeriod &other) const
 Check if this is the same validity period as other. More...
 
bool isValid (MillisecondsSince1970 time=-1.0) const
 Check if the time falls within the validity period. More...
 
uint64_t getChangeCount () const
 Get the change count, which is incremented each time this object is changed. More...
 
void get (ValidityPeriodLite &validityPeriodLite) const
 Set validityPeriodLite to point to the values in this meta info object, without copying any memory. More...
 
void set (const ValidityPeriodLite &validityPeriodLite)
 Clear this meta info, and set the values by copying from validityPeriodLite. More...
 

Static Public Member Functions

static bool canGetFromSignature (const Signature *signature)
 If the signature is a type that has a ValidityPeriod (so that getFromSignature will succeed), return true. More...
 
static ValidityPeriodgetFromSignature (Signature *signature)
 If the signature is a type that has a ValidityPeriod, then return it. More...
 
static const ValidityPeriodgetFromSignature (const Signature *signature)
 

Detailed Description

A ValidityPeriod is used in a Data packet's SignatureInfo and represents the begin and end times of a certificate's validity period.

Constructor & Destructor Documentation

ndn::ValidityPeriod::ValidityPeriod ( MillisecondsSince1970  notBefore,
MillisecondsSince1970  notAfter 
)
inline

Create a ValidityPeriod with the given period.

Parameters
notBeforeThe beginning of the validity period range as milliseconds since Jan 1, 1970 UTC. Note that this is rounded up to the nearest whole second.
notAfterThe end of the validity period range as milliseconds since Jan 1, 1970 UTC. Note that this is rounded down to the nearest whole second.

Member Function Documentation

bool ndn::ValidityPeriod::canGetFromSignature ( const Signature signature)
static

If the signature is a type that has a ValidityPeriod (so that getFromSignature will succeed), return true.

Note: This is a static method of ValidityPeriod instead of a method of Signature so that the Signature base class does not need to be overloaded with all the different kinds of information that various signature algorithms may use.

Parameters
signatureAn object of a subclass of Signature.
Returns
True if the signature is a type that has a ValidityPeriod, otherwise false.
bool ndn::ValidityPeriod::equals ( const ValidityPeriod other) const
inline

Check if this is the same validity period as other.

Parameters
otherThe other ValidityPeriod to compare with.
Returns
True if the validity periods are equal.
void ndn::ValidityPeriod::get ( ValidityPeriodLite validityPeriodLite) const
inline

Set validityPeriodLite to point to the values in this meta info object, without copying any memory.

WARNING: The resulting pointers in validityPeriodLite are invalid after a further use of this object which could reallocate memory.

Parameters
validityPeriodLiteThe ValidityPeriodLite object which receives the values.
uint64_t ndn::ValidityPeriod::getChangeCount ( ) const
inline

Get the change count, which is incremented each time this object is changed.

Returns
The change count.
ValidityPeriod & ndn::ValidityPeriod::getFromSignature ( Signature signature)
static

If the signature is a type that has a ValidityPeriod, then return it.

Otherwise throw an error.

Parameters
signatureAn object of a subclass of Signature.
Returns
The signature's ValidityPeriod. It is an error if signature doesn't have a ValidityPeriod.
MillisecondsSince1970 ndn::ValidityPeriod::getNotAfter ( ) const
inline

Get the end of the validity period range.

Returns
The time as milliseconds since Jan 1, 1970 UTC.
MillisecondsSince1970 ndn::ValidityPeriod::getNotBefore ( ) const
inline

Get the beginning of the validity period range.

Returns
The time as milliseconds since Jan 1, 1970 UTC.
bool ndn::ValidityPeriod::hasPeriod ( ) const
inline

Check if the period has been set.

Returns
True if the period has been set, false if the period is not specified (after calling the default constructor or clear).
bool ndn::ValidityPeriod::isValid ( MillisecondsSince1970  time = -1.0) const

Check if the time falls within the validity period.

Parameters
time(optional) The time to check as milliseconds since Jan 1, 1970 UTC. If omitted, use the current time.
Returns
True if the beginning of the validity period is less than or equal to time and time is less than or equal to the end of the validity period.
void ndn::ValidityPeriod::set ( const ValidityPeriodLite validityPeriodLite)
inline

Clear this meta info, and set the values by copying from validityPeriodLite.

Parameters
validityPeriodLiteA ValidityPeriodLite object.
ValidityPeriod& ndn::ValidityPeriod::setPeriod ( MillisecondsSince1970  notBefore,
MillisecondsSince1970  notAfter 
)
inline

Set the validity period.

Parameters
notBeforeThe beginning of the validity period range as milliseconds since Jan 1, 1970 UTC. Note that this is rounded up to the nearest whole second.
notAfterThe end of the validity period range as milliseconds since Jan 1, 1970 UTC. Note that this is rounded down to the nearest whole second.
Returns
This ValidityPeriod so that you can chain calls to update values.

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