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/common/IDoIpConnection.h"
17 :
18 : namespace doip
19 : {
20 : /**
21 : * Interface for a DoIP server connection. This is an extended DoIP connection
22 : * that will be given to server message handlers.
23 : */
24 : class IDoIpServerConnection : public IDoIpConnection
25 : {
26 : public:
27 : /**
28 : * Get the source address for this connection.
29 : * \return source address
30 : */
31 : virtual uint16_t getSourceAddress() const = 0;
32 :
33 : /**
34 : * Get the internal source address for this connection (address used for routing).
35 : * \return internal source address
36 : */
37 : virtual uint16_t getInternalSourceAddress() const = 0;
38 :
39 : /**
40 : * Send a NACK message on the connection.
41 : * \param nackCode NACK code as defined in ISO 13400
42 : * \param closeAfterSend true if the connection should close after sending has been done
43 : */
44 : virtual void sendNack(uint8_t nackCode, bool closeAfterSend) = 0;
45 :
46 : protected:
47 174 : IDoIpServerConnection() = default;
48 1 : IDoIpServerConnection(IDoIpServerConnection const&) = default;
49 1 : IDoIpServerConnection(IDoIpServerConnection&&) = default;
50 : IDoIpServerConnection& operator=(IDoIpServerConnection const&) = delete;
51 : IDoIpServerConnection& operator=(IDoIpServerConnection&&) = delete;
52 : ~IDoIpServerConnection() = default;
53 : };
54 :
55 : } // namespace doip
|