NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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 }
32 
33 namespace ndn {
34 
35 class OID
36 {
37 public:
38  OID()
39  {
40  }
41 
42  explicit
43  OID(const char* oid);
44 
45  explicit
46  OID(const std::string& oid);
47 
48  explicit
49  OID(const std::vector<int>& oid)
50  : m_oid(oid)
51  {
52  }
53 
54  const std::vector<int>&
56  {
57  return m_oid;
58  }
59 
60  void
61  setIntegerList(const std::vector<int>& value)
62  {
63  m_oid = value;
64  }
65 
66  std::string
67  toString() const;
68 
69  bool
70  operator==(const OID& oid) const
71  {
72  return equal(oid);
73  }
74 
75  bool
76  operator!=(const OID& oid) const
77  {
78  return !equal(oid);
79  }
80 
81  void
82  encode(CryptoPP::BufferedTransformation& out) const;
83 
84  void
85  decode(CryptoPP::BufferedTransformation& in);
86 
87 
88 private:
89  void
90  construct(const std::string& value);
91 
92  bool
93  equal(const OID& oid) const;
94 
95 private:
96  std::vector<int> m_oid;
97 };
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 }
107 
108 }
109 
110 #endif // NDN_ENCODING_OID_HPP
bool operator!=(const OID &oid) const
Definition: oid.hpp:76
Copyright (c) 2011-2015 Regents of the University of California.
OID()
Definition: oid.hpp:38
Copyright (c) 2013-2014 Regents of the University of California.
Definition: oid.hpp:29
void setIntegerList(const std::vector< int > &value)
Definition: oid.hpp:61
const OID ATTRIBUTE_NAME("2.5.4.41")
Definition: oid.hpp:105
const std::vector< int > & getIntegerList() const
Definition: oid.hpp:55
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
OID(const std::vector< int > &oid)
Definition: oid.hpp:49
Definition: oid.hpp:35
bool operator==(const OID &oid) const
Definition: oid.hpp:70
const OID ECDSA("1.2.840.10045.2.1")
Definition: oid.hpp:102
const OID RSA("1.2.840.113549.1.1.1")
Definition: oid.hpp:101