Coverage Report

Created: 2022-08-24 06:19

/src/Fast-DDS/include/fastdds/rtps/attributes/EndpointAttributes.h
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 fastdds/rtps/attributes/EndpointAttributes.h
17
 */
18
19
#ifndef _FASTDDS_ENDPOINTATTRIBUTES_H_
20
#define _FASTDDS_ENDPOINTATTRIBUTES_H_
21
22
#include <fastdds/rtps/attributes/ExternalLocators.hpp>
23
#include <fastdds/rtps/attributes/PropertyPolicy.h>
24
#include <fastrtps/qos/QosPolicies.h>
25
26
#include <fastdds/rtps/common/Guid.h>
27
#include <fastdds/rtps/common/Locator.h>
28
#include <fastdds/rtps/common/Types.h>
29
30
#if HAVE_SECURITY
31
#include <fastdds/rtps/security/accesscontrol/EndpointSecurityAttributes.h>
32
#endif  // HAVE_SECURITY
33
34
namespace eprosima {
35
namespace fastrtps {
36
namespace rtps {
37
38
/**
39
 * Structure EndpointAttributes, describing the attributes associated with an RTPS Endpoint.
40
 * @ingroup RTPS_ATTRIBUTES_MODULE
41
 */
42
class EndpointAttributes
43
{
44
public:
45
46
    //! Endpoint kind, default value WRITER
47
    EndpointKind_t endpointKind = EndpointKind_t::WRITER;
48
49
    //! Topic kind, default value NO_KEY
50
    TopicKind_t topicKind = TopicKind_t::NO_KEY;
51
52
    //! Reliability kind, default value BEST_EFFORT
53
    ReliabilityKind_t reliabilityKind = ReliabilityKind_t::BEST_EFFORT;
54
55
    //! Durability kind, default value VOLATILE
56
    DurabilityKind_t durabilityKind = DurabilityKind_t::VOLATILE;
57
58
    //! GUID used for persistence
59
    GUID_t persistence_guid;
60
61
    //! The collection of external locators to use for communication.
62
    fastdds::rtps::ExternalLocators external_unicast_locators;
63
64
    //! Whether locators that don't match with the announced locators should be kept.
65
    bool ignore_non_matching_locators = false;
66
67
    //! Unicast locator list
68
    LocatorList_t unicastLocatorList;
69
70
    //! Multicast locator list
71
    LocatorList_t multicastLocatorList;
72
73
    //! Remote locator list.
74
    LocatorList_t remoteLocatorList;
75
76
    //! Properties
77
    PropertyPolicy properties;
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
            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 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
    DataSharingQosPolicy datasharing_;
171
};
172
173
} /* namespace rtps */
174
} /* namespace fastrtps */
175
} /* namespace eprosima */
176
177
#endif /* _FASTDDS_ENDPOINTATTRIBUTES_H_ */