NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
validity-period.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_SECURITY_VALIDITY_PERIOD_HPP
23
#define NDN_SECURITY_VALIDITY_PERIOD_HPP
24
25
#include "../common.hpp"
26
#include "../encoding/tlv.hpp"
27
#include "../encoding/block.hpp"
28
#include "../util/time.hpp"
29
30
namespace
ndn
{
31
namespace
security {
32
33
37
class
ValidityPeriod
38
{
39
public
:
40
class
Error
:
public
tlv::Error
41
{
42
public
:
43
explicit
44
Error
(
const
std::string& what)
45
: tlv::
Error
(what)
46
{
47
}
48
};
49
50
public
:
53
ValidityPeriod
() =
default
;
54
57
explicit
58
ValidityPeriod
(
const
Block
& block);
59
68
ValidityPeriod
(
const
time::system_clock::TimePoint
& notBefore,
69
const
time::system_clock::TimePoint
& notAfter);
70
75
bool
76
isValid
(
const
time::system_clock::TimePoint
& now =
time::system_clock::now
())
const
;
77
86
ValidityPeriod
&
87
setPeriod
(
const
time::system_clock::TimePoint
& notBefore,
88
const
time::system_clock::TimePoint
& notAfter);
89
92
std::pair<time::system_clock::TimePoint, time::system_clock::TimePoint>
93
getPeriod
()
const
;
94
97
template
<encoding::Tag TAG>
98
size_t
99
wireEncode
(
EncodingImpl<TAG>
& encoder)
const
;
100
103
const
Block
&
104
wireEncode
()
const
;
105
109
void
110
wireDecode
(
const
Block
& wire);
111
112
public
:
// EqualityComparable concept
113
bool
114
operator==
(
const
ValidityPeriod
& other)
const
;
115
116
bool
117
operator!=
(
const
ValidityPeriod
& other)
const
;
118
119
private
:
120
typedef
boost::chrono::time_point<time::system_clock, time::seconds> TimePoint;
121
122
TimePoint m_notBefore;
123
TimePoint m_notAfter;
124
125
mutable
Block
m_wire;
126
};
127
128
std::ostream&
129
operator<<
(std::ostream& os,
const
ValidityPeriod
& period);
130
131
}
// namespace security
132
}
// namespace ndn
133
134
#endif // NDN_SECURITY_VALIDITY_PERIOD_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::security::ValidityPeriod::operator!=
bool operator!=(const ValidityPeriod &other) const
Definition:
validity-period.cpp:158
ndn::security::ValidityPeriod::wireEncode
const Block & wireEncode() const
Encode ValidityPeriod into TLV block.
Definition:
validity-period.cpp:76
ndn::security::ValidityPeriod::operator==
bool operator==(const ValidityPeriod &other) const
Definition:
validity-period.cpp:151
ndn::security::ValidityPeriod::ValidityPeriod
ValidityPeriod()=default
Set validity period (UNIX epoch, UNIX epoch) that is always invalid.
ndn::security::ValidityPeriod::Error::Error
Error(const std::string &what)
Definition:
validity-period.hpp:44
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
ndn::security::ValidityPeriod::isValid
bool isValid(const time::system_clock::TimePoint &now=time::system_clock::now()) const
Check if now falls within the validity period.
Definition:
validity-period.cpp:145
ndn::security::ValidityPeriod::setPeriod
ValidityPeriod & setPeriod(const time::system_clock::TimePoint ¬Before, const time::system_clock::TimePoint ¬After)
Set validity period (notBefore, notAfter)
Definition:
validity-period.cpp:128
ndn::security::operator<<
std::ostream & operator<<(std::ostream &os, const AdditionalDescription &other)
Definition:
additional-description.cpp:181
ndn::time::system_clock::now
static time_point now() noexcept
Definition:
time.cpp:45
ndn::security::ValidityPeriod
Abstraction of validity period.
Definition:
validity-period.hpp:37
ndn::security::ValidityPeriod::getPeriod
std::pair< time::system_clock::TimePoint, time::system_clock::TimePoint > getPeriod() const
Get the stored validity period.
Definition:
validity-period.cpp:139
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:45
ndn::time::system_clock::TimePoint
time_point TimePoint
Definition:
time.hpp:78
ndn::security::ValidityPeriod::wireDecode
void wireDecode(const Block &wire)
Decode ValidityPeriod from TLV block.
Definition:
validity-period.cpp:94
ndn::security::ValidityPeriod::Error
Definition:
validity-period.hpp:40
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:50
ndnSIM
ndn-cxx
src
security
validity-period.hpp
Generated on Sat Nov 12 2016 16:02:53 for ndnSIM by
1.8.12