NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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; -*- */
22 #ifndef NDN_SECURITY_ADDITIONAL_DESCRIPTION_HPP
23 #define NDN_SECURITY_ADDITIONAL_DESCRIPTION_HPP
24 
25 #include "../common.hpp"
26 #include "../encoding/tlv.hpp"
27 #include "../encoding/block.hpp"
28 #include <map>
29 
30 namespace ndn {
31 namespace security {
32 
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 
51  typedef std::map<std::string, std::string>::const_iterator const_iterator;
52 
53 public:
54 
58  AdditionalDescription() = default;
59 
63  explicit
64  AdditionalDescription(const Block& block);
65 
66  const std::string&
67  get(const std::string& key) const;
68 
69  void
70  set(const std::string& key, const std::string& value);
71 
72  bool
73  has(const std::string& key) const;
74 
75  size_t
76  size() const
77  {
78  return m_info.size();
79  }
80 
81  iterator
82  begin();
83 
84  iterator
85  end();
86 
87  const_iterator
88  begin() const;
89 
90  const_iterator
91  end() const;
92 
95  template<encoding::Tag TAG>
96  size_t
97  wireEncode(EncodingImpl<TAG>& encoder) const;
98 
101  const Block&
102  wireEncode() const;
103 
107  void
108  wireDecode(const Block& wire);
109 
110 public: // EqualityComparable concept
111 
112  bool
113  operator==(const AdditionalDescription& other) const;
114 
115  bool
116  operator!=(const AdditionalDescription& other) const;
117 
118 private:
119 
120  std::map<std::string, std::string> m_info;
121 
122  mutable Block m_wire;
123 };
124 
125 std::ostream&
126 operator<<(std::ostream& os, const AdditionalDescription& period);
127 
128 } // namespace security
129 } // namespace ndn
130 
131 #endif // NDN_SECURITY_ADDITIONAL_DESCRIPTION_HPP
Copyright (c) 2011-2015 Regents of the University of California.
bool has(const std::string &key) const
AdditionalDescription()=default
Create an empty AdditionalDescription.
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
std::ostream & operator<<(std::ostream &os, const AdditionalDescription &other)
std::map< std::string, std::string >::iterator iterator
Table::const_iterator iterator
Definition: cs-internal.hpp:41
const Block & wireEncode() const
Encode ValidityPeriod into TLV block.
bool operator!=(const AdditionalDescription &other) const
void wireDecode(const Block &wire)
Decode ValidityPeriod from TLV block.
bool operator==(const AdditionalDescription &other) const
Abstraction of AdditionalDescription.
std::map< std::string, std::string >::const_iterator const_iterator
represents an error in TLV encoding or decoding
Definition: tlv.hpp:50