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
Copyright (c) 2011-2015 Regents of the University of California.
The interface of signing key management.
Definition: key-chain.hpp:46
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition: data.cpp:322
PrefixAnnouncement & setValidityPeriod(optional< security::ValidityPeriod > validity)
Set absolute validity period.
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.
bool operator!=(const Data &lhs, const Data &rhs)
Definition: data.hpp:262
Signing parameters passed to KeyChain.
A prefix announcement object that represents an application's intent of registering a prefix toward i...
PrefixAnnouncement & setExpiration(time::milliseconds expiration)
Set relative expiration period.
static const SigningInfo & getDefaultSigningInfo()
Definition: key-chain.cpp:150
const Name & getAnnouncedName() const
Return announced name.
Represents an absolute name.
Definition: name.hpp:43
PrefixAnnouncement & setAnnouncedName(Name name)
Set announced name.
optional< security::ValidityPeriod > getValidityPeriod() const
Return absolute validity period.
bool operator==(const Data &lhs, const Data &rhs)
Definition: data.cpp:313
PrefixAnnouncement()
Construct an empty prefix announcement.
time::milliseconds getExpiration() const
Return relative expiration period.
const optional< Data > & getData() const
Get the Data representing the prefix announcement, if available.
Represents a Data packet.
Definition: data.hpp:35
const nullopt_t nullopt((nullopt_t::init()))
represents an error in TLV encoding or decoding
Definition: tlv.hpp:52