blob: 28ca508bb211d1301a11ce7e9ab90183ef0f4d07 [file] [log] [blame]
Yingdi Yub8f8b342015-04-27 11:06:42 -07001/* -*- 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
25namespace ndn {
26namespace security {
27
28Pib::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
35Pib::~Pib()
36{
37}
38
39std::string
40Pib::getPibLocator() const
41{
42 return m_scheme + ":" + m_location;
43}
44
45void
46Pib::setTpmLocator(const std::string& tpmLocator)
47{
48 m_impl->setTpmLocator(tpmLocator);
49}
50
51std::string
52Pib::getTpmLocator() const
53{
54 return m_impl->getTpmLocator();
55}
56
57Identity
58Pib::addIdentity(const Name& identity)
59{
60 return Identity(identity, m_impl, true);
61}
62
63void
64Pib::removeIdentity(const Name& identity)
65{
66 m_impl->removeIdentity(identity);
67}
68
69Identity
70Pib::getIdentity(const Name& identity)
71{
72 return Identity(identity, m_impl, false);
73}
74
75IdentityContainer
76Pib::getIdentities() const
77{
78 return IdentityContainer(m_impl->getIdentities(), m_impl);
79}
80
81Identity
82Pib::setDefaultIdentity(const Name& identityName)
83{
84 m_impl->setDefaultIdentity(identityName);
85 return Identity(identityName, m_impl, true);
86}
87
88Identity
89Pib::getDefaultIdentity()
90{
91 return Identity(m_impl->getDefaultIdentity(), m_impl, false);
92}
93
94
95} // namespace security
96} // namespace ndn