Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Yingdi Yu | 6ee2d36 | 2015-07-16 21:48:05 -0700 | [diff] [blame^] | 3 | * Copyright (c) 2013-2017 Regents of the University of California. |
Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 4 | * |
| 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 Afanasyev | 97709c0 | 2016-08-25 19:58:30 -0700 | [diff] [blame] | 22 | #ifndef NDN_SECURITY_PIB_CERTIFICATE_CONTAINER_HPP |
| 23 | #define NDN_SECURITY_PIB_CERTIFICATE_CONTAINER_HPP |
Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 24 | |
| 25 | #include <set> |
Yingdi Yu | 6ee2d36 | 2015-07-16 21:48:05 -0700 | [diff] [blame^] | 26 | #include "../v2/certificate.hpp" |
Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 27 | |
| 28 | namespace ndn { |
| 29 | namespace security { |
Yingdi Yu | 6ee2d36 | 2015-07-16 21:48:05 -0700 | [diff] [blame^] | 30 | namespace pib { |
Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 31 | |
| 32 | class PibImpl; |
| 33 | |
| 34 | /// @brief A handler to search or enumerate certificates of a key. |
| 35 | class CertificateContainer |
| 36 | { |
| 37 | public: |
| 38 | class const_iterator |
| 39 | { |
| 40 | public: |
| 41 | friend class CertificateContainer; |
| 42 | |
| 43 | public: |
Yingdi Yu | 6ee2d36 | 2015-07-16 21:48:05 -0700 | [diff] [blame^] | 44 | v2::Certificate |
Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 45 | 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 | |
| 69 | public: |
| 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 | |
| 86 | private: |
| 87 | std::set<Name> m_certNames; |
| 88 | shared_ptr<PibImpl> m_impl; |
| 89 | }; |
| 90 | |
Yingdi Yu | 6ee2d36 | 2015-07-16 21:48:05 -0700 | [diff] [blame^] | 91 | } // namespace pib |
| 92 | |
| 93 | using pib::CertificateContainer; |
| 94 | |
Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 95 | } // namespace security |
| 96 | } // namespace ndn |
| 97 | |
Alexander Afanasyev | 97709c0 | 2016-08-25 19:58:30 -0700 | [diff] [blame] | 98 | #endif // NDN_SECURITY_PIB_CERTIFICATE_CONTAINER_HPP |