GCC Code Coverage Report


Directory: ./
File: pdserv/src/TlsSession.h
Date: 2023-11-12 04:06:57
Exec Total Coverage
Lines: 3 3 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * Copyright 2021 Bjarne von Horn (vh at igh dot de)
4 *
5 * This file is part of the pdserv library.
6 *
7 * The pdserv library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation, either version 3 of the License, or (at
10 * your option) any later version.
11 *
12 * The pdserv library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the pdserv library. If not, see <http://www.gnu.org/licenses/>.
19 *
20 *****************************************************************************/
21
22 #ifndef PDSERV_TLSSESSION_H
23 #define PDSERV_TLSSESSION_H
24
25 #include "TLS.h"
26
27 #include <cerrno>
28 #include <cstddef>
29 #include <cstring>
30 #include <memory>
31
32 struct gnutls_session_int;
33
34 namespace PdServ {
35
36 class Session;
37
38 template <typename Parent>
39 108 class TlsSession : public Parent
40 {
41 std::unique_ptr<gnutls_session_int, TlsDeleter> session_;
42 void initial() override;
43 void final() override;
44
45 public:
46 template <typename... Args>
47 54 TlsSession(Args &&...args) : Parent(std::forward<Args>(args)...)
48 54 {}
49
50 ssize_t write(const void *buf, size_t len) override;
51 ssize_t read(void *buf, size_t len) override;
52 };
53
54 } // namespace PdServ
55
56 #endif // PDSERV_TLSSESSION_H
57