NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
oid.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_ENCODING_OID_HPP
23 #define NDN_ENCODING_OID_HPP
24 
25 #include "../common.hpp"
26 
27 #include <vector>
28 
29 namespace CryptoPP {
30 class BufferedTransformation;
31 } // namespace CryptoPP
32 
33 namespace ndn {
34 
35 class Oid
36 {
37 public:
38  Oid() = default;
39 
40  explicit
41  Oid(const char* oid);
42 
43  explicit
44  Oid(const std::string& oid);
45 
46  explicit
47  Oid(const std::vector<int>& oid)
48  : m_oid(oid)
49  {
50  }
51 
52  const std::vector<int>&
54  {
55  return m_oid;
56  }
57 
58  void
59  setIntegerList(const std::vector<int>& value)
60  {
61  m_oid = value;
62  }
63 
64  std::string
65  toString() const;
66 
67  bool
68  operator==(const Oid& oid) const
69  {
70  return equal(oid);
71  }
72 
73  bool
74  operator!=(const Oid& oid) const
75  {
76  return !equal(oid);
77  }
78 
79  void
80  encode(CryptoPP::BufferedTransformation& out) const;
81 
82  void
83  decode(CryptoPP::BufferedTransformation& in);
84 
85 
86 private:
87  bool
88  equal(const Oid& oid) const;
89 
90 private:
91  std::vector<int> m_oid;
92 };
93 
97 typedef Oid OID;
98 
99 namespace oid {
100 // crypto algorithm
101 extern const Oid RSA;
102 extern const Oid ECDSA;
103 
104 // certificate entries
105 extern const Oid ATTRIBUTE_NAME;
106 } // namespace oid
107 
108 } // namespace ndn
109 
110 #endif // NDN_ENCODING_OID_HPP
const Oid ECDSA("1.2.840.10045.2.1")
Definition: oid.hpp:102
Copyright (c) 2011-2015 Regents of the University of California.
const std::vector< int > & getIntegerList() const
Definition: oid.hpp:53
Copyright (c) 2013-2016 Regents of the University of California.
Definition: oid.hpp:29
const Oid ATTRIBUTE_NAME("2.5.4.41")
Definition: oid.hpp:105
std::string toString(const system_clock::TimePoint &timePoint, const std::string &format, const std::locale &locale)
Convert time point to string with specified format.
Definition: time.cpp:162
const Oid RSA("1.2.840.113549.1.1.1")
Definition: oid.hpp:101
Oid(const std::vector< int > &oid)
Definition: oid.hpp:47
Oid OID
Definition: oid.hpp:97
void setIntegerList(const std::vector< int > &value)
Definition: oid.hpp:59
Definition: oid.hpp:35
bool operator!=(const Oid &oid) const
Definition: oid.hpp:74
bool operator==(const Oid &oid) const
Definition: oid.hpp:68