Loading...
Searching...
No Matches
access-manager.hpp
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014-2022, Regents of the University of California
4 *
5 * NAC library is free software: you can redistribute it and/or modify it under the
6 * terms of the GNU Lesser General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option) any later version.
8 *
9 * NAC library is distributed in the hope that it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
12 *
13 * You should have received copies of the GNU General Public License and GNU Lesser
14 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
15 * <http://www.gnu.org/licenses/>.
16 *
17 * See AUTHORS.md for complete list of NAC library authors and contributors.
18 */
19
20#ifndef NDN_NAC_ACCESS_MANAGER_HPP
21#define NDN_NAC_ACCESS_MANAGER_HPP
22
23#include "common.hpp"
24
25#include <ndn-cxx/face.hpp>
26
27namespace ndn::nac {
28
39{
40public:
41 class Error : public std::runtime_error
42 {
43 public:
44 using std::runtime_error::runtime_error;
45 };
46
47public:
67 AccessManager(const Identity& identity, const Name& dataset,
68 KeyChain& keyChain, Face& face);
69
75 Data
76 addMember(const Certificate& memberCert);
77
78 // void
79 // addMemberWithKey(const Name& keyName);
80
81 // void
82 // addMemberWithIdentity(const Name& identityName);
83
87 void
88 removeMember(const Name& identity);
89
90public: // accessor interface for published data packets
91
94 size_t
95 size() const
96 {
97 return m_ims.size();
98 }
99
105 InMemoryStorage::const_iterator
106 begin() const
107 {
108 return m_ims.begin();
109 }
110
116 InMemoryStorage::const_iterator
117 end() const
118 {
119 return m_ims.end();
120 }
121
122private:
123 Identity m_identity;
124 Key m_nacKey;
125 KeyChain& m_keyChain;
126 Face& m_face;
127
128 InMemoryStoragePersistent m_ims; // for KEK and KDKs
129 ScopedRegisteredPrefixHandle m_kekReg;
130 ScopedRegisteredPrefixHandle m_kdkReg;
131};
132
133} // namespace ndn::nac
134
135#endif // NDN_NAC_ACCESS_MANAGER_HPP
InMemoryStorage::const_iterator end() const
Returns end iterator of the in-memory storage ordered by name with digest.
Data addMember(const Certificate &memberCert)
Authorize a member identified by its certificate memberCert to decrypt data under the policy.
InMemoryStorage::const_iterator begin() const
Returns begin iterator of the in-memory storage ordered by name with digest.
void removeMember(const Name &identity)
Remove member with name identity from the group.