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/SubscriptionEndpoint.h"
12 :
13 : #include "someip/ServiceDescription.h"
14 :
15 : namespace someip
16 : {
17 138 : SubscriptionEndpoint::SubscriptionEndpoint() : IPEndpoint(), ttl(ttl::INVALID), index(DEFAULT_INDEX)
18 138 : {}
19 :
20 145 : SubscriptionEndpoint::SubscriptionEndpoint(::ip::IPAddress const& ipAddr, uint16_t const port)
21 145 : : IPEndpoint(ipAddr, port), ttl(ttl::INVALID), index(DEFAULT_INDEX)
22 145 : {}
23 :
24 3 : SubscriptionEndpoint::SubscriptionEndpoint(SubscriptionEndpoint const& other)
25 : : ::etl::forward_link<0>(::etl::forward_link<0>())
26 : , IPEndpoint(other)
27 3 : , ttl(other.ttl)
28 3 : , index(other.index)
29 3 : {}
30 :
31 5 : bool SubscriptionEndpoint::isValid() const { return isSet() && (ttl != ttl::INVALID); }
32 :
33 58 : void SubscriptionEndpoint::clear()
34 : {
35 58 : IPEndpoint::clear();
36 58 : ttl = ttl::INVALID;
37 58 : index = DEFAULT_INDEX;
38 58 : }
39 :
40 2 : SubscriptionEndpoint& SubscriptionEndpoint::operator=(SubscriptionEndpoint const& other)
41 : {
42 2 : if (this != &other)
43 : {
44 1 : setAddress(other.getAddress());
45 1 : setPort(other.getPort());
46 1 : ttl = other.ttl;
47 1 : index = other.index;
48 : }
49 2 : return *this;
50 : }
51 :
52 : } // namespace someip
|