Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Alexander Afanasyev | 2fa5939 | 2016-07-29 17:24:23 -0700 | [diff] [blame] | 3 | * Copyright (c) 2013-2016 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> |
Alexander Afanasyev | 97709c0 | 2016-08-25 19:58:30 -0700 | [diff] [blame] | 26 | #include "../v1/identity-certificate.hpp" |
Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 27 | |
| 28 | namespace ndn { |
| 29 | namespace security { |
| 30 | |
| 31 | class PibImpl; |
| 32 | |
| 33 | /// @brief A handler to search or enumerate certificates of a key. |
| 34 | class CertificateContainer |
| 35 | { |
| 36 | public: |
| 37 | class const_iterator |
| 38 | { |
| 39 | public: |
| 40 | friend class CertificateContainer; |
| 41 | |
| 42 | public: |
Alexander Afanasyev | 2fa5939 | 2016-07-29 17:24:23 -0700 | [diff] [blame] | 43 | v1::IdentityCertificate |
Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 44 | operator*(); |
| 45 | |
| 46 | const_iterator& |
| 47 | operator++(); |
| 48 | |
| 49 | const_iterator |
| 50 | operator++(int); |
| 51 | |
| 52 | bool |
| 53 | operator==(const const_iterator& other); |
| 54 | |
| 55 | bool |
| 56 | operator!=(const const_iterator& other); |
| 57 | |
| 58 | private: |
| 59 | const_iterator(std::set<Name>::const_iterator it, shared_ptr<PibImpl> impl); |
| 60 | |
| 61 | private: |
| 62 | std::set<Name>::const_iterator m_it; |
| 63 | shared_ptr<PibImpl> m_impl; |
| 64 | }; |
| 65 | |
| 66 | typedef const_iterator iterator; |
| 67 | |
| 68 | public: |
| 69 | CertificateContainer(); |
| 70 | |
| 71 | CertificateContainer(std::set<Name>&& certNames, shared_ptr<PibImpl> impl); |
| 72 | |
| 73 | const_iterator |
| 74 | begin() const; |
| 75 | |
| 76 | const_iterator |
| 77 | end() const; |
| 78 | |
| 79 | const_iterator |
| 80 | find(const Name& certName) const; |
| 81 | |
| 82 | size_t |
| 83 | size() const; |
| 84 | |
| 85 | private: |
| 86 | std::set<Name> m_certNames; |
| 87 | shared_ptr<PibImpl> m_impl; |
| 88 | }; |
| 89 | |
| 90 | } // namespace security |
| 91 | } // namespace ndn |
| 92 | |
Alexander Afanasyev | 97709c0 | 2016-08-25 19:58:30 -0700 | [diff] [blame] | 93 | #endif // NDN_SECURITY_PIB_CERTIFICATE_CONTAINER_HPP |