Line data Source code
1 : /********************************************************************************
2 : * Copyright (c) 2026 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 : #include "someip/NetworkResource.h"
12 :
13 : namespace someip
14 : {
15 : // NOLINTNEXTLINE(cert-err58-cpp): Fine, since default value shall be used.
16 : ::ip::IPAddress const NetworkResource::INVALID_IP = {{0U}};
17 : // NOLINTNEXTLINE(cert-err58-cpp): Fine, since default value shall be used.
18 : ::ip::IPEndpoint const NetworkResource::INVALID_ADDRESS;
19 :
20 212 : bool NetworkResource::isInitialized() const
21 : {
22 212 : return (_pInputBuffer.size() != 0U) && (_pOutputBuffer.size() != 0U) && (_pListener != nullptr);
23 : }
24 :
25 45 : ::etl::span<uint8_t> NetworkResource::getInputBuffer() const
26 : {
27 45 : if (!isInitialized())
28 : {
29 4 : return {};
30 : }
31 :
32 41 : return _pInputBuffer;
33 : }
34 :
35 89 : ::etl::span<uint8_t> NetworkResource::getOutputBuffer() const
36 : {
37 89 : if (!isInitialized())
38 : {
39 4 : return {};
40 : }
41 :
42 85 : return _pOutputBuffer;
43 : }
44 :
45 1 : bool NetworkResource::send(
46 : ::ip::IPEndpoint const& /* remoteEndpoint */, uint32_t const /* length */)
47 : {
48 1 : return false;
49 : }
50 :
51 1 : bool NetworkResource::send(uint32_t const /* length */) { return false; }
52 :
53 : } // namespace someip
|