Webdar 1.0.0
Web user interface to libdar
ssl_connexion.hpp
1/*********************************************************************/
2// webdar - a web server and interface program to libdar
3// Copyright (C) 2013-2025 Denis Corbin
4//
5// This file is part of Webdar
6//
7// Webdar is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Webdar is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Webdar. If not, see <http://www.gnu.org/licenses/>
19//
20//----
21// to contact the author: dar.linux@free.fr
22/*********************************************************************/
23
24#ifndef SSL_CONNEXION_HPP
25#define SSL_CONNEXION_HPP
26
27#include "my_config.h"
28
29 // C system header files
30
31extern "C"
32{
33#if HAVE_OPENSSL_SSL_H
34#include <openssl/ssl.h>
35#endif
36}
37
38 // C++ system header files
39#include <string>
40
41 // webdar headers
42#include "exceptions.hpp"
43#include "connexion.hpp"
44
46
48
50{
51public:
52
54 ssl_connexion(int fd, SSL_CTX & ctx, const std::string & peerip, unsigned int peerport);
55
57 ssl_connexion(const ssl_connexion & ref) = delete;
58 ssl_connexion(ssl_connexion && ref) noexcept = delete;
59 ssl_connexion & operator = (const ssl_connexion & ref) = delete;
60 ssl_connexion & operator = (ssl_connexion && ref) noexcept = delete;
61
64
65protected:
66
68 virtual void write_impl(const char *a, unsigned int size) override;
69
71 virtual unsigned int read_impl(char *a, unsigned int size, bool blocking) override;
72
73private:
74
75 SSL *ssl;
76
77};
78
79#endif
provides read/write implementation of a socket object
Definition: connexion.hpp:41
provides read/write implementation of a socket object
Definition: ssl_connexion.hpp:50
ssl_connexion(int fd, SSL_CTX &ctx, const std::string &peerip, unsigned int peerport)
constructor: create a new object based on a existing socket filedescriptor
Definition: ssl_connexion.cpp:55
virtual void write_impl(const char *a, unsigned int size) override
inherited from proto_connexion
Definition: ssl_connexion.cpp:102
~ssl_connexion()
destructor
Definition: ssl_connexion.cpp:68
virtual unsigned int read_impl(char *a, unsigned int size, bool blocking) override
inherited from proto_connexion
Definition: ssl_connexion.cpp:73
ssl_connexion(const ssl_connexion &ref)=delete
copy is forbidden, move is allowed