blob: eba765eb158c439db49cb9ab38ede49775f80699 [file] [log] [blame]
Yingdi Yub8f8b342015-04-27 11:06:42 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Yingdi Yu6ee2d362015-07-16 21:48:05 -07003 * Copyright (c) 2013-2017 Regents of the University of California.
Yingdi Yub8f8b342015-04-27 11:06:42 -07004 *
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
Alexander Afanasyev97709c02016-08-25 19:58:30 -070022#ifndef NDN_SECURITY_PIB_CERTIFICATE_CONTAINER_HPP
23#define NDN_SECURITY_PIB_CERTIFICATE_CONTAINER_HPP
Yingdi Yub8f8b342015-04-27 11:06:42 -070024
25#include <set>
Yingdi Yu6ee2d362015-07-16 21:48:05 -070026#include "../v2/certificate.hpp"
Yingdi Yub8f8b342015-04-27 11:06:42 -070027
28namespace ndn {
29namespace security {
Yingdi Yu6ee2d362015-07-16 21:48:05 -070030namespace pib {
Yingdi Yub8f8b342015-04-27 11:06:42 -070031
32class PibImpl;
33
34/// @brief A handler to search or enumerate certificates of a key.
35class CertificateContainer
36{
37public:
38 class const_iterator
39 {
40 public:
41 friend class CertificateContainer;
42
43 public:
Yingdi Yu6ee2d362015-07-16 21:48:05 -070044 v2::Certificate
Yingdi Yub8f8b342015-04-27 11:06:42 -070045 operator*();
46
47 const_iterator&
48 operator++();
49
50 const_iterator
51 operator++(int);
52
53 bool
54 operator==(const const_iterator& other);
55
56 bool
57 operator!=(const const_iterator& other);
58
59 private:
60 const_iterator(std::set<Name>::const_iterator it, shared_ptr<PibImpl> impl);
61
62 private:
63 std::set<Name>::const_iterator m_it;
64 shared_ptr<PibImpl> m_impl;
65 };
66
67 typedef const_iterator iterator;
68
69public:
70 CertificateContainer();
71
72 CertificateContainer(std::set<Name>&& certNames, shared_ptr<PibImpl> impl);
73
74 const_iterator
75 begin() const;
76
77 const_iterator
78 end() const;
79
80 const_iterator
81 find(const Name& certName) const;
82
83 size_t
84 size() const;
85
86private:
87 std::set<Name> m_certNames;
88 shared_ptr<PibImpl> m_impl;
89};
90
Yingdi Yu6ee2d362015-07-16 21:48:05 -070091} // namespace pib
92
93using pib::CertificateContainer;
94
Yingdi Yub8f8b342015-04-27 11:06:42 -070095} // namespace security
96} // namespace ndn
97
Alexander Afanasyev97709c02016-08-25 19:58:30 -070098#endif // NDN_SECURITY_PIB_CERTIFICATE_CONTAINER_HPP