Line data Source code
1 : /********************************************************************************
2 : * Copyright (c) 2025 Accenture
3 : *
4 : * This program and the accompanying materials are made available under the
5 : * terms of the Apache License Version 2.0 which is available at
6 : * https://www.apache.org/licenses/LICENSE-2.0
7 : *
8 : * SPDX-License-Identifier: Apache-2.0
9 : ********************************************************************************/
10 :
11 : /**
12 : * \ingroup doip
13 : */
14 : #pragma once
15 :
16 : #include "doip/server/DoIpServerTransportConnection.h"
17 :
18 : #include <etl/ipool.h>
19 :
20 : #include <cstdint>
21 :
22 : namespace tcp
23 : {
24 : class AbstractSocket;
25 : }
26 :
27 : namespace doip
28 : {
29 : class DoIpServerTransportConnectionConfig;
30 :
31 : /**
32 : * Interface for creation of a potentially derived transport connection.
33 : * \tparam T class for transport connection instances, derived from DoIpServerTransportConnection
34 : */
35 : template<class T>
36 : class IDoIpServerTransportConnectionCreator
37 : {
38 : public:
39 : /**
40 : * Create a transport connection instance within already allocated memory.
41 : * \param memory reference to allocated memory
42 : * \param socketGroupId identifier of socket group the connection belongs to
43 : * \param socket reference to socket to use
44 : * \param diagnosticSendJobBlockPool reference to block pool for diagnostic send jobs
45 : * \param protocolSendJobBlockPool reference to block pool for other protocol send jobs
46 : * \param config reference to connection configuration
47 : */
48 : virtual DoIpServerTransportConnection& createConnection(
49 : T* memory,
50 : uint8_t socketGroupId,
51 : ::tcp::AbstractSocket& socket,
52 : ::etl::ipool& diagnosticSendJobBlockPool,
53 : ::etl::ipool& protocolSendJobBlockPool,
54 : DoIpServerTransportConnectionConfig const& config,
55 : DoIpTcpConnection::ConnectionType type)
56 : = 0;
57 :
58 : protected:
59 1 : IDoIpServerTransportConnectionCreator() = default;
60 1 : IDoIpServerTransportConnectionCreator(IDoIpServerTransportConnectionCreator const&) = default;
61 1 : IDoIpServerTransportConnectionCreator(IDoIpServerTransportConnectionCreator&&) = default;
62 1 : IDoIpServerTransportConnectionCreator& operator=(IDoIpServerTransportConnectionCreator&&)
63 : = default;
64 : ~IDoIpServerTransportConnectionCreator() = default;
65 1 : IDoIpServerTransportConnectionCreator& operator=(IDoIpServerTransportConnectionCreator const&)
66 : = default;
67 : };
68 :
69 : } // namespace doip
|