SNode.C
Loading...
Searching...
No Matches
SocketConnection.h
Go to the documentation of this file.
1/*
2 * SNode.C - a slim toolkit for network communication
3 * Copyright (C) Volker Christian <me@vchrist.at>
4 * 2020, 2021, 2022, 2023, 2024, 2025
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef CORE_SOCKET_STREAM_LEGACY_SOCKETCONNECTION_H
21#define CORE_SOCKET_STREAM_LEGACY_SOCKETCONNECTION_H
22
23#include "core/socket/stream/SocketConnection.h" // IWYU pragma: export
24#include "core/socket/stream/legacy/SocketReader.h" // IWYU pragma: export
25#include "core/socket/stream/legacy/SocketWriter.h" // IWYU pragma: export
26
27#ifndef DOXYGEN_SHOULD_SKIP_THIS
28
29#include <cstddef>
30
31#endif /* DOXYGEN_SHOULD_SKIP_THIS */
32
33namespace core::socket::stream::legacy {
34
35 template <typename PhysicalSocketT>
36 class SocketConnection final
37 : public core::socket::stream::
38 SocketConnectionT<PhysicalSocketT, core::socket::stream::legacy::SocketReader, core::socket::stream::legacy::SocketWriter> {
39 private:
40 using Super = core::socket::stream::
41 SocketConnectionT<PhysicalSocketT, core::socket::stream::legacy::SocketReader, core::socket::stream::legacy::SocketWriter>;
42
43 using PhysicalSocket = PhysicalSocketT;
44 using SocketReader = typename Super::SocketReader;
45 using SocketWriter = typename Super::SocketWriter;
46
47 public:
48 using SocketAddress = typename Super::SocketAddress;
49
50 SocketConnection(const std::string& instanceName,
51 PhysicalSocket&& physicalSocket,
52 const std::function<void(SocketConnection*)>& onDisconnect,
53 const std::string& configuredServer,
54 const SocketAddress& localAddress,
55 const SocketAddress& remoteAddress,
56 const utils::Timeval& readTimeout,
57 const utils::Timeval& writeTimeout,
58 std::size_t readBlockSize,
59 std::size_t writeBlockSize,
60 const utils::Timeval& terminateTimeout);
61
62 template <typename PhysicalSocket, typename Config>
63 friend class SocketAcceptor;
64
65 template <typename PhysicalSocket, typename Config>
66 friend class SocketConnector;
67 };
68
69} // namespace core::socket::stream::legacy
70
71#endif // CORE_SOCKET_STREAM_LEGACY_SOCKETCONNECTION_H
SocketConnection(const std::string &instanceName, PhysicalSocket &&physicalSocket, const std::function< void(SocketConnection *)> &onDisconnect, const std::string &configuredServer, const SocketAddress &localAddress, const SocketAddress &remoteAddress, const utils::Timeval &readTimeout, const utils::Timeval &writeTimeout, std::size_t readBlockSize, std::size_t writeBlockSize, const utils::Timeval &terminateTimeout)
int main(int argc, char *argv[])
Definition Config.h:37