Yingdi Yu | b8f8b34 | 2015-04-27 11:06:42 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2013-2015 Regents of the University of California. |
| 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 | |
| 22 | #include "pib.hpp" |
| 23 | #include "pib-impl.hpp" |
| 24 | |
| 25 | namespace ndn { |
| 26 | namespace security { |
| 27 | |
| 28 | Pib::Pib(const std::string scheme, const std::string& location, shared_ptr<PibImpl> impl) |
| 29 | : m_scheme(scheme) |
| 30 | , m_location(location) |
| 31 | , m_impl(impl) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | Pib::~Pib() |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | std::string |
| 40 | Pib::getPibLocator() const |
| 41 | { |
| 42 | return m_scheme + ":" + m_location; |
| 43 | } |
| 44 | |
| 45 | void |
| 46 | Pib::setTpmLocator(const std::string& tpmLocator) |
| 47 | { |
| 48 | m_impl->setTpmLocator(tpmLocator); |
| 49 | } |
| 50 | |
| 51 | std::string |
| 52 | Pib::getTpmLocator() const |
| 53 | { |
| 54 | return m_impl->getTpmLocator(); |
| 55 | } |
| 56 | |
| 57 | Identity |
| 58 | Pib::addIdentity(const Name& identity) |
| 59 | { |
| 60 | return Identity(identity, m_impl, true); |
| 61 | } |
| 62 | |
| 63 | void |
| 64 | Pib::removeIdentity(const Name& identity) |
| 65 | { |
| 66 | m_impl->removeIdentity(identity); |
| 67 | } |
| 68 | |
| 69 | Identity |
| 70 | Pib::getIdentity(const Name& identity) |
| 71 | { |
| 72 | return Identity(identity, m_impl, false); |
| 73 | } |
| 74 | |
| 75 | IdentityContainer |
| 76 | Pib::getIdentities() const |
| 77 | { |
| 78 | return IdentityContainer(m_impl->getIdentities(), m_impl); |
| 79 | } |
| 80 | |
| 81 | Identity |
| 82 | Pib::setDefaultIdentity(const Name& identityName) |
| 83 | { |
| 84 | m_impl->setDefaultIdentity(identityName); |
| 85 | return Identity(identityName, m_impl, true); |
| 86 | } |
| 87 | |
| 88 | Identity |
| 89 | Pib::getDefaultIdentity() |
| 90 | { |
| 91 | return Identity(m_impl->getDefaultIdentity(), m_impl, false); |
| 92 | } |
| 93 | |
| 94 | |
| 95 | } // namespace security |
| 96 | } // namespace ndn |