blob: 2c78997fb29bf98303c2115297d08f503122ac32 [file] [log] [blame]
Zhiyi Zhangf5246c42017-01-26 09:39:20 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesaventob48bbda2020-07-27 19:41:37 -04002/*
Davide Pesavento0d1d11c2022-04-11 22:11:34 -04003 * Copyright (c) 2017-2022, Regents of the University of California.
Zhiyi Zhangf5246c42017-01-26 09:39:20 -08004 *
5 * This file is part of ndncert, a certificate management system based on NDN.
6 *
7 * ndncert is free software: you can redistribute it and/or modify it under the terms
8 * of the GNU General Public License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * ndncert 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 General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License along with
16 * ndncert, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * See AUTHORS.md for complete list of ndncert authors and contributors.
19 */
20
Zhiyi Zhanga62bf982020-10-26 13:10:02 -070021#ifndef NDNCERT_DETAIL_CA_MEMORY_HPP
22#define NDNCERT_DETAIL_CA_MEMORY_HPP
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080023
Zhiyi Zhangb041d442020-10-22 21:57:11 -070024#include "detail/ca-storage.hpp"
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080025
Davide Pesavento0d1d11c2022-04-11 22:11:34 -040026namespace ndncert::ca {
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080027
28class CaMemory : public CaStorage
29{
30public:
Davide Pesavento0d1d11c2022-04-11 22:11:34 -040031 static const std::string STORAGE_TYPE;
32
33 explicit
34 CaMemory(const Name& caName = "", const std::string& path = "");
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080035
36public:
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070037 RequestState
Zhiyi Zhangc9ada1b2020-10-29 19:13:15 -070038 getRequest(const RequestId& requestId) override;
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080039
40 void
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070041 addRequest(const RequestState& request) override;
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080042
43 void
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070044 updateRequest(const RequestState& request) override;
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080045
46 void
Zhiyi Zhangc9ada1b2020-10-29 19:13:15 -070047 deleteRequest(const RequestId& requestId) override;
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080048
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070049 std::list<RequestState>
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070050 listAllRequests() override;
51
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070052 std::list<RequestState>
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070053 listAllRequests(const Name& caName) override;
54
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080055private:
Zhiyi Zhangc9ada1b2020-10-29 19:13:15 -070056 std::map<RequestId, RequestState> m_requests;
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080057};
58
Davide Pesavento0d1d11c2022-04-11 22:11:34 -040059} // namespace ndncert::ca
Zhiyi Zhangf5246c42017-01-26 09:39:20 -080060
Zhiyi Zhanga62bf982020-10-26 13:10:02 -070061#endif // NDNCERT_DETAIL_CA_MEMORY_HPP