Coverage Report

Created: 2025-06-13 06:46

/src/Fast-DDS/include/fastdds/rtps/attributes/EndpointAttributes.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 EndpointAttributes.hpp
17
 */
18
19
#ifndef FASTDDS_RTPS_ATTRIBUTES__ENDPOINTATTRIBUTES_HPP
20
#define FASTDDS_RTPS_ATTRIBUTES__ENDPOINTATTRIBUTES_HPP
21
22
#include <fastdds/dds/core/policy/QosPolicies.hpp>
23
#include <fastdds/rtps/attributes/ExternalLocators.hpp>
24
#include <fastdds/rtps/attributes/PropertyPolicy.hpp>
25
#include <fastdds/rtps/common/Guid.hpp>
26
#include <fastdds/rtps/common/LocatorList.hpp>
27
#include <fastdds/rtps/common/Types.hpp>
28
#if HAVE_SECURITY
29
#include <fastdds/rtps/attributes/EndpointSecurityAttributes.hpp>
30
#endif // if HAVE_SECURITY
31
namespace eprosima {
32
namespace fastdds {
33
namespace rtps {
34
35
/**
36
 * Structure EndpointAttributes, describing the attributes associated with an RTPS Endpoint.
37
 * @ingroup RTPS_ATTRIBUTES_MODULE
38
 */
39
class EndpointAttributes
40
{
41
public:
42
43
    //! Endpoint kind, default value WRITER
44
    EndpointKind_t endpointKind = EndpointKind_t::WRITER;
45
46
    //! Topic kind, default value NO_KEY
47
    TopicKind_t topicKind = TopicKind_t::NO_KEY;
48
49
    //! Reliability kind, default value BEST_EFFORT
50
    ReliabilityKind_t reliabilityKind = ReliabilityKind_t::BEST_EFFORT;
51
52
    //! Durability kind, default value VOLATILE
53
    DurabilityKind_t durabilityKind = DurabilityKind_t::VOLATILE;
54
55
    //! GUID used for persistence
56
    GUID_t persistence_guid;
57
58
    //! The collection of external locators to use for communication.
59
    ExternalLocators external_unicast_locators;
60
61
    //! Whether locators that don't match with the announced locators should be kept.
62
    bool ignore_non_matching_locators = false;
63
64
    //! Unicast locator list
65
    LocatorList_t unicastLocatorList;
66
67
    //! Multicast locator list
68
    LocatorList_t multicastLocatorList;
69
70
    //! Remote locator list.
71
    LocatorList_t remoteLocatorList;
72
73
    //! Properties
74
    PropertyPolicy properties;
75
76
    //!Ownership
77
    fastdds::dds::OwnershipQosPolicyKind ownershipKind = fastdds::dds::OwnershipQosPolicyKind::SHARED_OWNERSHIP_QOS;
78
79
    EndpointAttributes()
80
0
    {
81
0
        datasharing_.off();
82
0
    }
83
84
0
    virtual ~EndpointAttributes() = default;
85
86
    /**
87
     * Get the user defined ID
88
     * @return User defined ID
89
     */
90
    inline int16_t getUserDefinedID() const
91
0
    {
92
0
        return m_userDefinedID;
93
0
    }
94
95
    /**
96
     * Get the entity defined ID
97
     * @return Entity ID
98
     */
99
    inline int16_t getEntityID() const
100
0
    {
101
0
        return m_entityID;
102
0
    }
103
104
    /**
105
     * Set the user defined ID
106
     * @param id User defined ID to be set
107
     */
108
    inline void setUserDefinedID(
109
            int16_t id)
110
0
    {
111
0
        m_userDefinedID = id;
112
0
    }
113
114
    /**
115
     * Set the entity ID
116
     * @param id Entity ID to be set
117
     */
118
    inline void setEntityID(
119
            int16_t id)
120
0
    {
121
0
        m_entityID = id;
122
0
    }
123
124
    /**
125
     * Set the DataSharing configuration
126
     * @param cfg Configuration to be set
127
     */
128
    inline void set_data_sharing_configuration(
129
            fastdds::dds::DataSharingQosPolicy cfg)
130
0
    {
131
0
        datasharing_ = cfg;
132
0
    }
133
134
    /**
135
     * Get the DataSharing configuration
136
     * @return Configuration of data sharing
137
     */
138
    inline const fastdds::dds::DataSharingQosPolicy& data_sharing_configuration() const
139
0
    {
140
0
        return datasharing_;
141
0
    }
142
143
#if HAVE_SECURITY
144
    const security::EndpointSecurityAttributes& security_attributes() const
145
    {
146
        return security_attributes_;
147
    }
148
149
    security::EndpointSecurityAttributes& security_attributes()
150
    {
151
        return security_attributes_;
152
    }
153
154
#endif // HAVE_SECURITY
155
156
private:
157
158
    //! User Defined ID, used for StaticEndpointDiscovery, default value -1.
159
    int16_t m_userDefinedID = -1;
160
161
    //! Entity ID, if the user want to specify the EntityID of the enpoint, default value -1.
162
    int16_t m_entityID = -1;
163
164
#if HAVE_SECURITY
165
    //! Security attributes
166
    security::EndpointSecurityAttributes security_attributes_;
167
#endif // HAVE_SECURITY
168
169
    //! Settings for datasharing
170
    fastdds::dds::DataSharingQosPolicy datasharing_;
171
};
172
173
} // namespace rtps
174
} // namespace fastdds
175
} // namespace eprosima
176
177
#endif // FASTDDS_RTPS_ATTRIBUTES__ENDPOINTATTRIBUTES_HPP