NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
signature-info.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SIGNATURE_INFO_HPP
23 #define NDN_SIGNATURE_INFO_HPP
24 
25 #include "encoding/tlv.hpp"
26 #include "key-locator.hpp"
28 #include <list>
29 
30 namespace ndn {
31 
33 {
34 public:
35  class Error : public tlv::Error
36  {
37  public:
38  explicit
39  Error(const std::string& what)
40  : tlv::Error(what)
41  {
42  }
43  };
44 
45  SignatureInfo();
46 
47  explicit
49 
50  SignatureInfo(tlv::SignatureTypeValue type, const KeyLocator& keyLocator);
51 
57  explicit
58  SignatureInfo(const Block& block);
59 
61  void
63 
65  int32_t
67  {
68  return m_type;
69  }
70 
72  bool
73  hasKeyLocator() const
74  {
75  return m_hasKeyLocator;
76  }
77 
79  void
80  setKeyLocator(const KeyLocator& keyLocator);
81 
83  void
85 
91  const KeyLocator&
92  getKeyLocator() const;
93 
95  void
96  setValidityPeriod(const security::ValidityPeriod& validityPeriod);
97 
99  void
101 
104  getValidityPeriod() const;
105 
107  void
108  appendTypeSpecificTlv(const Block& block);
109 
115  const Block&
116  getTypeSpecificTlv(uint32_t type) const;
117 
119  template<encoding::Tag TAG>
120  size_t
121  wireEncode(EncodingImpl<TAG>& encoder) const;
122 
124  const Block&
125  wireEncode() const;
126 
128  void
129  wireDecode(const Block& wire);
130 
131 public: // EqualityComparable concept
132  bool
133  operator==(const SignatureInfo& rhs) const;
134 
135  bool
136  operator!=(const SignatureInfo& rhs) const
137  {
138  return !(*this == rhs);
139  }
140 
141 private:
142  int32_t m_type;
143  bool m_hasKeyLocator;
144  KeyLocator m_keyLocator;
145  std::list<Block> m_otherTlvs;
146 
147  mutable Block m_wire;
148 };
149 
150 } // namespace ndn
151 
152 #endif // NDN_SIGNATURE_INFO_HPP
Copyright (c) 2011-2015 Regents of the University of California.
void setSignatureType(tlv::SignatureTypeValue type)
Set SignatureType.
const KeyLocator & getKeyLocator() const
Get KeyLocator.
const Block & getTypeSpecificTlv(uint32_t type) const
Get signature type specific tlv block.
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
const Block & wireEncode() const
Encode to a wire format.
void unsetValidityPeriod()
Unset ValidityPeriod.
void appendTypeSpecificTlv(const Block &block)
Append signature type specific tlv block.
void setKeyLocator(const KeyLocator &keyLocator)
Set KeyLocator.
Abstraction of validity period.
bool operator==(const SignatureInfo &rhs) const
Error(const std::string &what)
bool hasKeyLocator() const
Check if KeyLocator is set.
int32_t getSignatureType() const
Get SignatureType.
bool operator!=(const SignatureInfo &rhs) const
void unsetKeyLocator()
Unset KeyLocator.
void setValidityPeriod(const security::ValidityPeriod &validityPeriod)
Set ValidityPeriod.
void wireDecode(const Block &wire)
Decode from a wire format.
SignatureTypeValue
Definition: tlv.hpp:95
represents an error in TLV encoding or decoding
Definition: tlv.hpp:50
security::ValidityPeriod getValidityPeriod() const
Get ValidityPeriod.