NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
prefix-announcement.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2018 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  */
21 
22 #ifndef NDN_CXX_PREFIX_ANNOUNCEMENT_HPP
23 #define NDN_CXX_PREFIX_ANNOUNCEMENT_HPP
24 
26 
27 namespace ndn {
28 
34 {
35 public:
36  class Error : public tlv::Error
37  {
38  public:
39  using tlv::Error::Error;
40  };
41 
48 
53  explicit
55 
58  const optional<Data>&
59  getData() const
60  {
61  return m_data;
62  }
63 
71  const Data&
72  toData(KeyChain& keyChain,
74  optional<uint64_t> version = nullopt) const;
75 
78  const Name&
80  {
81  return m_announcedName;
82  }
83 
89 
92  time::milliseconds
93  getExpiration() const
94  {
95  return m_expiration;
96  }
97 
103  setExpiration(time::milliseconds expiration);
104 
107  optional<security::ValidityPeriod>
109  {
110  return m_validity;
111  }
112 
117  setValidityPeriod(optional<security::ValidityPeriod> validity);
118 
119 private:
120  mutable optional<Data> m_data;
121  Name m_announcedName;
122  time::milliseconds m_expiration = 0_ms;
123  optional<security::ValidityPeriod> m_validity;
124 };
125 
129 bool
130 operator==(const PrefixAnnouncement& lhs, const PrefixAnnouncement& rhs);
131 
132 inline bool
134 {
135  return !(lhs == rhs);
136 }
137 
142 std::ostream&
143 operator<<(std::ostream& os, const PrefixAnnouncement& pa);
144 
145 } // namespace ndn
146 
147 #endif // NDN_CXX_PREFIX_ANNOUNCEMENT_HPP
ndn::PrefixAnnouncement::getData
const optional< Data > & getData() const
Get the Data representing the prefix announcement, if available.
Definition: prefix-announcement.hpp:59
ndn::PrefixAnnouncement::Error
Definition: prefix-announcement.hpp:37
ndn::security::SigningInfo
Signing parameters passed to KeyChain.
Definition: signing-info.hpp:42
ndn::PrefixAnnouncement::toData
const Data & toData(KeyChain &keyChain, const ndn::security::SigningInfo &si=KeyChain::getDefaultSigningInfo(), optional< uint64_t > version=nullopt) const
Create a Data packet representing the prefix announcement, if it does not exist.
Definition: prefix-announcement.cpp:65
ndn::PrefixAnnouncement::PrefixAnnouncement
PrefixAnnouncement()
Construct an empty prefix announcement.
ndn::PrefixAnnouncement::setExpiration
PrefixAnnouncement & setExpiration(time::milliseconds expiration)
Set relative expiration period.
Definition: prefix-announcement.cpp:99
ndn::security::v2::KeyChain::getDefaultSigningInfo
static const SigningInfo & getDefaultSigningInfo()
Definition: key-chain.cpp:149
ndn::PrefixAnnouncement
A prefix announcement object that represents an application's intent of registering a prefix toward i...
Definition: prefix-announcement.hpp:34
ndn::Name
Represents an absolute name.
Definition: name.hpp:44
ndn::PrefixAnnouncement::getValidityPeriod
optional< security::ValidityPeriod > getValidityPeriod() const
Return absolute validity period.
Definition: prefix-announcement.hpp:108
ndn::security::v2::KeyChain
The interface of signing key management.
Definition: key-chain.hpp:47
nonstd::optional_lite::nullopt
const nullopt_t nullopt((nullopt_t::init()))
ndn::Data
Represents a Data packet.
Definition: data.hpp:36
ndn::PrefixAnnouncement::getAnnouncedName
const Name & getAnnouncedName() const
Return announced name.
Definition: prefix-announcement.hpp:79
key-chain.hpp
ndn::operator==
bool operator==(const Data &lhs, const Data &rhs)
Definition: data.cpp:312
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition: data.cpp:322
ndn::name
Definition: name-component-types.hpp:33
ndn::PrefixAnnouncement::setValidityPeriod
PrefixAnnouncement & setValidityPeriod(optional< security::ValidityPeriod > validity)
Set absolute validity period.
Definition: prefix-announcement.cpp:110
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition: tlv.hpp:53
ndn::operator!=
bool operator!=(const Data &lhs, const Data &rhs)
Definition: data.hpp:262
ndn::tlv::Error::Error
Error(const char *expectedType, uint32_t actualType)
Definition: tlv.cpp:27
ndn::PrefixAnnouncement::setAnnouncedName
PrefixAnnouncement & setAnnouncedName(Name name)
Set announced name.
Definition: prefix-announcement.cpp:91
ndn::lp::tlv::PrefixAnnouncement
@ PrefixAnnouncement
Definition: tlv.hpp:52
ndn::PrefixAnnouncement::getExpiration
time::milliseconds getExpiration() const
Return relative expiration period.
Definition: prefix-announcement.hpp:93
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34