Coverage Report

Created: 2025-06-13 06:46

/src/Fast-DDS/include/fastdds/rtps/Endpoint.hpp
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
/**
16
 * @file Endpoint.hpp
17
 */
18
19
#ifndef FASTDDS_RTPS__ENDPOINT_HPP
20
#define FASTDDS_RTPS__ENDPOINT_HPP
21
22
#include <fastdds/rtps/attributes/EndpointAttributes.hpp>
23
#include <fastdds/rtps/common/Guid.hpp>
24
#include <fastdds/rtps/common/Locator.hpp>
25
#include <fastdds/rtps/common/Types.hpp>
26
#include <fastdds/rtps/history/IChangePool.hpp>
27
#include <fastdds/rtps/history/IPayloadPool.hpp>
28
#include <fastdds/utils/TimedMutex.hpp>
29
30
namespace eprosima {
31
namespace fastdds {
32
namespace rtps {
33
34
class RTPSParticipantImpl;
35
class ResourceEvent;
36
37
38
/**
39
 * Class Endpoint, all entities of the RTPS network derive from this class.
40
 * Although the RTPSParticipant is also defined as an endpoint in the RTPS specification, in this implementation
41
 * the RTPSParticipant class **does not** inherit from the endpoint class. Each Endpoint object owns a pointer to the
42
 * RTPSParticipant it belongs to.
43
 * @ingroup COMMON_MODULE
44
 */
45
class Endpoint
46
{
47
    friend class RTPSParticipantImpl;
48
49
protected:
50
51
    Endpoint() = default;
52
53
    Endpoint(
54
            RTPSParticipantImpl* pimpl,
55
            const GUID_t& guid,
56
            const EndpointAttributes& att)
57
0
        : mp_RTPSParticipant(pimpl)
58
0
        , m_guid(guid)
59
0
        , m_att(att)
60
0
    {
61
0
    }
62
63
    virtual ~Endpoint()
64
0
    {
65
0
    }
66
67
public:
68
69
    /**
70
     * Get associated GUID
71
     * @return Associated GUID
72
     */
73
    FASTDDS_EXPORTED_API inline const GUID_t& getGuid() const
74
0
    {
75
0
        return m_guid;
76
0
    }
77
78
    /**
79
     * Get mutex
80
     * @return Associated Mutex
81
     */
82
    FASTDDS_EXPORTED_API inline RecursiveTimedMutex& getMutex()
83
0
    {
84
0
        return mp_mutex;
85
0
    }
86
87
    /**
88
     * Get associated attributes
89
     * @return Endpoint attributes
90
     */
91
    FASTDDS_EXPORTED_API inline EndpointAttributes& getAttributes()
92
0
    {
93
0
        return m_att;
94
0
    }
95
96
#if HAVE_SECURITY
97
    bool supports_rtps_protection()
98
    {
99
        return supports_rtps_protection_;
100
    }
101
102
#endif // if HAVE_SECURITY
103
104
protected:
105
106
    //!Pointer to the RTPSParticipant containing this endpoint.
107
    RTPSParticipantImpl* mp_RTPSParticipant;
108
109
    //!Endpoint GUID
110
    const GUID_t m_guid;
111
112
    //!Endpoint Attributes
113
    EndpointAttributes m_att;
114
115
    //!Endpoint Mutex
116
    mutable RecursiveTimedMutex mp_mutex;
117
118
    //!Fixed size of payloads
119
    uint32_t fixed_payload_size_ = 0;
120
121
private:
122
123
    Endpoint& operator =(
124
            const Endpoint&) = delete;
125
126
#if HAVE_SECURITY
127
    bool supports_rtps_protection_ = true;
128
#endif // if HAVE_SECURITY
129
};
130
131
132
} // namespace rtps
133
} // namespace rtps
134
} // namespace eprosima
135
136
#endif //FASTDDS_RTPS__ENDPOINT_HPP