Webdar 1.0.0
Web user interface to libdar
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 CONNEXION_HPP
25#define CONNEXION_HPP
26
27#include "my_config.h"
28
29 // C++ system header files
30#include <string>
31
32 // webdar headers
33#include "exceptions.hpp"
34#include "proto_connexion.hpp"
35
37
39
41{
42public:
43
45 connexion(int fd, const std::string & peerip, unsigned int peerport);
46
48 connexion(const connexion & ref) = delete;
49 connexion(connexion && ref) noexcept = delete;
50 connexion & operator = (const connexion & ref) = delete;
51 connexion & operator = (connexion && ref) noexcept = delete;
52
54 ~connexion();
55
56protected:
57
59 virtual void write_impl(const char *a, unsigned int size) override;
60
62 virtual unsigned int read_impl(char *a, unsigned int size, bool blocking) override;
63
64
65private:
66
67 int filedesc;
68
70 void fermeture();
71
72};
73
74#endif
provides read/write implementation of a socket object
Definition: connexion.hpp:41
~connexion()
destructor
Definition: connexion.cpp:61
connexion(const connexion &ref)=delete
forbidding copy constuctor and assignment operator
virtual unsigned int read_impl(char *a, unsigned int size, bool blocking) override
inherited from proto_connexion
Definition: connexion.cpp:74
virtual void write_impl(const char *a, unsigned int size) override
inherited from proto_connexion
Definition: connexion.cpp:108
connexion(int fd, const std::string &peerip, unsigned int peerport)
constructor: create a new object based on a existing socket filedescriptor
Definition: connexion.cpp:55
buffers data from a TCP connexion, this is a pure virtual class
Definition: proto_connexion.hpp:41