blob: 5ad10d9833f56f08a0eb0e12f929cddd84623174 [file] [log] [blame]
Zhiyi Zhang91c846b2017-04-12 14:16:31 -07001/* -*- 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 Zhang91c846b2017-04-12 14:16:31 -07004 *
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_SQLITE_HPP
22#define NDNCERT_DETAIL_CA_SQLITE_HPP
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070023
Zhiyi Zhangb041d442020-10-22 21:57:11 -070024#include "detail/ca-storage.hpp"
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070025
26struct sqlite3;
27
Davide Pesavento0d1d11c2022-04-11 22:11:34 -040028namespace ndncert::ca {
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070029
30class CaSqlite : public CaStorage
31{
32public:
Davide Pesavento0d1d11c2022-04-11 22:11:34 -040033 static const std::string STORAGE_TYPE;
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070034
35 explicit
Zhiyi Zhangd1d9f5a2020-10-05 18:04:23 -070036 CaSqlite(const Name& caName, const std::string& path = "");
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070037
Davide Pesavento0dc02012021-11-23 22:55:03 -050038 ~CaSqlite() override;
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070039
40public:
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070041 RequestState
Zhiyi Zhangc9ada1b2020-10-29 19:13:15 -070042 getRequest(const RequestId& requestId) override;
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070043
44 void
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070045 addRequest(const RequestState& request) override;
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070046
47 void
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070048 updateRequest(const RequestState& request) override;
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070049
50 void
Zhiyi Zhangc9ada1b2020-10-29 19:13:15 -070051 deleteRequest(const RequestId& requestId) override;
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070052
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070053 std::list<RequestState>
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070054 listAllRequests() override;
55
Zhiyi Zhang32d4b4e2020-10-28 22:10:49 -070056 std::list<RequestState>
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070057 listAllRequests(const Name& caName) override;
58
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070059private:
60 sqlite3* m_database;
61};
62
Davide Pesavento0d1d11c2022-04-11 22:11:34 -040063} // namespace ndncert::ca
Zhiyi Zhang91c846b2017-04-12 14:16:31 -070064
Zhiyi Zhanga62bf982020-10-26 13:10:02 -070065#endif // NDNCERT_DETAIL_CA_SQLITE_HPP