NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
additional-description.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_SECURITY_V2_ADDITIONAL_DESCRIPTION_HPP
23 #define NDN_SECURITY_V2_ADDITIONAL_DESCRIPTION_HPP
24 
27 #include "ndn-cxx/encoding/tlv.hpp"
28 
29 #include <map>
30 
31 namespace ndn {
32 namespace security {
33 namespace v2 {
34 
40 {
41 public:
42  class Error : public tlv::Error
43  {
44  public:
45  using tlv::Error::Error;
46  };
47 
49  typedef std::map<std::string, std::string>::const_iterator const_iterator;
50 
51 public:
55  AdditionalDescription() = default;
56 
60  explicit
61  AdditionalDescription(const Block& block);
62 
63  const std::string&
64  get(const std::string& key) const;
65 
66  void
67  set(const std::string& key, const std::string& value);
68 
69  bool
70  has(const std::string& key) const;
71 
72  size_t
73  size() const
74  {
75  return m_info.size();
76  }
77 
78  bool
79  empty() const
80  {
81  return m_info.empty();
82  }
83 
84  iterator
85  begin();
86 
87  iterator
88  end();
89 
91  begin() const;
92 
94  end() const;
95 
98  template<encoding::Tag TAG>
99  size_t
100  wireEncode(EncodingImpl<TAG>& encoder) const;
101 
104  const Block&
105  wireEncode() const;
106 
110  void
111  wireDecode(const Block& wire);
112 
113 public: // EqualityComparable concept
114  bool
115  operator==(const AdditionalDescription& other) const;
116 
117  bool
118  operator!=(const AdditionalDescription& other) const;
119 
120 private:
121  std::map<std::string, std::string> m_info;
122 
123  mutable Block m_wire;
124 };
125 
127 
128 std::ostream&
129 operator<<(std::ostream& os, const AdditionalDescription& period);
130 
131 } // namespace v2
132 
134 
135 } // namespace security
136 } // namespace ndn
137 
138 #endif // NDN_SECURITY_V2_ADDITIONAL_DESCRIPTION_HPP
bool has(const std::string &key) const
Copyright (c) 2011-2015 Regents of the University of California.
std::map< std::string, std::string >::const_iterator const_iterator
Abstraction of AdditionalDescription.
void wireDecode(const Block &wire)
Decode ValidityPeriod from TLV block.
Represents a TLV element of NDN packet format.
Definition: block.hpp:42
void set(const std::string &key, const std::string &value)
std::map< std::string, std::string >::iterator iterator
const Block & wireEncode() const
Encode ValidityPeriod into TLV block.
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(AdditionalDescription)
const std::string & get(const std::string &key) const
bool operator==(const AdditionalDescription &other) const
Table::const_iterator iterator
Definition: cs-internal.hpp:41
import common constructs for ndn-cxx library internal use
AdditionalDescription()=default
Create an empty AdditionalDescription.
std::ostream & operator<<(std::ostream &os, const AdditionalDescription &other)
bool operator!=(const AdditionalDescription &other) const
represents an error in TLV encoding or decoding
Definition: tlv.hpp:52