Skip to content

Commit d78fd3d

Browse files
committed
Refs #20629: Review - Make ServerAttributes private
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
1 parent ae3d283 commit d78fd3d

23 files changed

Lines changed: 55 additions & 356 deletions

File tree

examples/cpp/dds/DiscoveryServerExample/common.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#ifndef _EPROSIMA_FASTDDS_EXAMPLES_CPP_DDS_DISCOVERYSERVEREXAMPLE_COMMON_H_
2121
#define _EPROSIMA_FASTDDS_EXAMPLES_CPP_DDS_DISCOVERYSERVEREXAMPLE_COMMON_H_
2222

23-
#include <fastdds/rtps/attributes/ServerAttributes.h>
23+
#include <fastdds/rtps/common/GuidPrefix_t.hpp>
2424
#include <fastdds/utils/IPLocator.h>
2525

2626
enum class TransportKind
@@ -32,19 +32,6 @@ enum class TransportKind
3232
SHM,
3333
};
3434

35-
inline eprosima::fastdds::rtps::GuidPrefix_t get_discovery_server_guid_from_id(
36-
unsigned short id)
37-
{
38-
eprosima::fastdds::rtps::GuidPrefix_t result;
39-
40-
// Get default DS guid and modify the one value expected to be changed
41-
std::istringstream(eprosima::fastdds::rtps::DEFAULT_ROS2_SERVER_GUIDPREFIX) >> result;
42-
result.value[2] =
43-
static_cast<eprosima::fastdds::rtps::octet>(id); // This is done like this in Fast
44-
45-
return result;
46-
}
47-
4835
inline bool is_ip(
4936
const std::string ip_str)
5037
{

include/fastdds/rtps/attributes/RTPSParticipantAttributes.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <fastdds/rtps/attributes/ExternalLocators.hpp>
2929
#include <fastdds/rtps/attributes/PropertyPolicy.h>
3030
#include <fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp>
31-
#include <fastdds/rtps/attributes/ServerAttributes.h>
3231
#include <fastdds/rtps/attributes/ThreadSettings.hpp>
3332
#include <fastdds/rtps/common/Locator.h>
3433
#include <fastdds/rtps/common/PortParameters.h>
@@ -129,6 +128,21 @@ inline std::ostream& operator <<(
129128
return output;
130129
}
131130

131+
/**
132+
* Returns the guidPrefix associated to the given server id
133+
* @param[in] id of the default server whose guidPrefix we want to retrieve
134+
* @param[out] guid reference to the guidPrefix to modify
135+
* @return true if the server guid can be delivered
136+
*/
137+
FASTDDS_EXPORTED_API bool get_server_client_default_guidPrefix(
138+
int id,
139+
fastdds::rtps::GuidPrefix_t& guid);
140+
141+
// Port used if the ros environment variable doesn't specify one
142+
constexpr uint16_t DEFAULT_ROS2_SERVER_PORT = 11811;
143+
// Port used by default for tcp transport
144+
constexpr uint16_t DEFAULT_TCP_SERVER_PORT = 42100;
145+
132146
//! Filtering flags when discovering participants
133147
enum ParticipantFilteringFlags : uint32_t
134148
{

include/fastdds/rtps/participant/RTPSParticipant.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <fastdds/dds/subscriber/qos/ReaderQos.hpp>
2828
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
2929
#include <fastdds/rtps/builtin/data/ContentFilterProperty.hpp>
30+
#include <fastdds/rtps/builtin/data/ParticipantProxyData.hpp>
3031
#include <fastdds/rtps/common/Guid.h>
3132
#include <fastdds/statistics/IListeners.hpp>
3233
#include <fastdds/fastdds_dll.hpp>

include/fastdds/statistics/dds/domain/DomainParticipant.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <fastdds/dds/domain/DomainParticipant.hpp>
2727
#include <fastdds/dds/publisher/qos/DataWriterQos.hpp>
2828
#include <fastdds/fastdds_dll.hpp>
29+
#include <fastdds/rtps/builtin/data/ParticipantProxyData.hpp>
2930

3031
namespace eprosima {
3132
namespace fastdds {

src/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ set(${PROJECT_NAME}_source_files
110110
rtps/attributes/EndpointSecurityAttributes.cpp
111111
rtps/attributes/PropertyPolicy.cpp
112112
rtps/attributes/RTPSParticipantAttributes.cpp
113+
rtps/attributes/ServerAttributes.cpp
113114
rtps/attributes/ThreadSettings.cpp
114115
rtps/attributes/TopicAttributes.cpp
115116
rtps/builtin/BuiltinProtocols.cpp
@@ -136,7 +137,6 @@ set(${PROJECT_NAME}_source_files
136137
rtps/builtin/discovery/participant/PDPServer.cpp
137138
rtps/builtin/discovery/participant/PDPServerListener.cpp
138139
rtps/builtin/discovery/participant/PDPSimple.cpp
139-
rtps/builtin/discovery/participant/ServerAttributes.cpp
140140
rtps/builtin/discovery/participant/timedevent/DSClientEvent.cpp
141141
rtps/builtin/discovery/participant/timedevent/DServerEvent.cpp
142142
rtps/builtin/liveliness/WLP.cpp

src/cpp/rtps/RTPSDomain.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <fastdds/utils/IPLocator.h>
3737
#include <fastdds/utils/md5.h>
3838

39+
#include <rtps/attributes/ServerAttributes.hpp>
3940
#include <rtps/common/GuidUtils.hpp>
4041
#include <rtps/network/utils/external_locators.hpp>
4142
#include <rtps/participant/RTPSParticipantImpl.h>

src/cpp/rtps/builtin/discovery/participant/ServerAttributes.cpp renamed to src/cpp/rtps/attributes/ServerAttributes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
*/
1919

20-
#include <fastdds/rtps/attributes/ServerAttributes.h>
20+
#include <rtps/attributes/ServerAttributes.hpp>
2121

2222
namespace eprosima {
2323
namespace fastdds {

include/fastdds/rtps/attributes/ServerAttributes.h renamed to src/cpp/rtps/attributes/ServerAttributes.hpp

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
1+
// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima).
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
/**
16-
* @file ServerAttributes.h
16+
* @file ServerAttributes.hpp
1717
*
1818
*/
1919

@@ -29,9 +29,9 @@
2929
#include <list>
3030

3131
namespace eprosima {
32-
3332
namespace fastdds {
3433
namespace rtps {
34+
3535
class ParticipantProxyData;
3636

3737
/**
@@ -43,27 +43,27 @@ class RemoteServerAttributes
4343
{
4444
public:
4545

46-
FASTDDS_EXPORTED_API inline bool operator ==(
46+
inline bool operator ==(
4747
const RemoteServerAttributes& r) const
4848
{
4949
return guidPrefix == r.guidPrefix
5050
&& metatrafficUnicastLocatorList == r.metatrafficUnicastLocatorList
5151
&& metatrafficMulticastLocatorList == r.metatrafficMulticastLocatorList;
5252
}
5353

54-
FASTDDS_EXPORTED_API void clear()
54+
void clear()
5555
{
5656
guidPrefix = fastdds::rtps::GuidPrefix_t::unknown();
5757
metatrafficUnicastLocatorList.clear();
5858
metatrafficMulticastLocatorList.clear();
5959
}
6060

61-
FASTDDS_EXPORTED_API fastdds::rtps::GUID_t GetParticipant() const;
61+
fastdds::rtps::GUID_t GetParticipant() const;
6262

63-
FASTDDS_EXPORTED_API fastdds::rtps::GUID_t GetPDPReader() const;
64-
FASTDDS_EXPORTED_API fastdds::rtps::GUID_t GetPDPWriter() const;
63+
fastdds::rtps::GUID_t GetPDPReader() const;
64+
fastdds::rtps::GUID_t GetPDPWriter() const;
6565

66-
FASTDDS_EXPORTED_API inline bool ReadguidPrefix(
66+
inline bool ReadguidPrefix(
6767
const char* pfx)
6868
{
6969
return bool(std::istringstream(pfx) >> guidPrefix);
@@ -92,8 +92,8 @@ typedef std::list<RemoteServerAttributes> RemoteServerList_t;
9292
template<class charT>
9393
struct server_ostream_separators
9494
{
95-
FASTDDS_EXPORTED_API static const charT* list_separator;
96-
FASTDDS_EXPORTED_API static const charT* locator_separator;
95+
static const charT* list_separator;
96+
static const charT* locator_separator;
9797
};
9898

9999
#ifndef _MSC_VER
@@ -133,12 +133,8 @@ std::basic_ostream<charT>& operator <<(
133133
return output;
134134
}
135135

136-
// port used if the ros environment variable doesn't specify one
137-
constexpr uint16_t DEFAULT_ROS2_SERVER_PORT = 11811;
138-
// default server base guidPrefix
136+
// Default server base guidPrefix
139137
const char* const DEFAULT_ROS2_SERVER_GUIDPREFIX = "44.53.00.5f.45.50.52.4f.53.49.4d.41";
140-
// port used by default for tcp transport
141-
constexpr uint16_t DEFAULT_TCP_SERVER_PORT = 42100;
142138

143139
/* Environment variable to specify a semicolon-separated list of locators ([transport]ip:port) that define remote server
144140
* locators. The [transport] specification is optional. The default transport is UDPv4.
@@ -166,7 +162,7 @@ const char* const ROS_SUPER_CLIENT = "ROS_SUPER_CLIENT";
166162
* @param[out] servers_list reference to a LocatorList_t to populate.
167163
* @return true if parsing succeeds, false otherwise (or if the list is empty)
168164
*/
169-
FASTDDS_EXPORTED_API bool load_environment_server_info(
165+
bool load_environment_server_info(
170166
const std::string& list,
171167
LocatorList& servers_list);
172168

@@ -181,30 +177,20 @@ FASTDDS_EXPORTED_API bool load_environment_server_info(
181177
* @param[out] servers_list reference to a LocatorList_t to populate.
182178
* @return true if parsing succeeds, false otherwise
183179
*/
184-
FASTDDS_EXPORTED_API bool load_environment_server_info(
180+
bool load_environment_server_info(
185181
LocatorList& servers_list);
186182

187183
/**
188184
* Get the value of environment variable DEFAULT_ROS2_MASTER_URI
189185
* @return The value of environment variable DEFAULT_ROS2_MASTER_URI. Empty string if the variable is not defined.
190186
*/
191-
FASTDDS_EXPORTED_API const std::string& ros_discovery_server_env();
187+
const std::string& ros_discovery_server_env();
192188

193189
/**
194190
* Get the value of environment variable ROS_SUPER_CLIENT
195191
* @return The value of environment variable ROS_SUPER_CLIENT. False if the variable is not defined.
196192
*/
197-
FASTDDS_EXPORTED_API bool ros_super_client_env();
198-
199-
/**
200-
* Returns the guidPrefix associated to the given server id
201-
* @param[in] id of the default server whose guidPrefix we want to retrieve
202-
* @param[out] guid reference to the guidPrefix to modify
203-
* @return true if the server guid can be delivered
204-
*/
205-
FASTDDS_EXPORTED_API bool get_server_client_default_guidPrefix(
206-
int id,
207-
fastdds::rtps::GuidPrefix_t& guid);
193+
bool ros_super_client_env();
208194

209195
} // rtps
210196
} // fastdds

src/cpp/rtps/builtin/discovery/participant/PDPClient.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define _FASTDDS_RTPS_PDPCLIENT_H_
2222
#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
2323

24+
#include <rtps/attributes/ServerAttributes.hpp>
2425
#include <rtps/builtin/discovery/participant/DS/DiscoveryServerPDPEndpoints.hpp>
2526
#include <rtps/builtin/discovery/participant/DS/DiscoveryServerPDPEndpointsSecure.hpp>
2627
#include <rtps/builtin/discovery/participant/PDP.h>

src/cpp/rtps/builtin/discovery/participant/PDPServer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
#include <string>
2929
#include <vector>
3030

31-
#include <fastdds/rtps/attributes/ServerAttributes.h>
3231
#include <fastdds/rtps/history/History.h>
32+
#include <rtps/attributes/ServerAttributes.hpp>
3333
#include <rtps/builtin/discovery/database/DiscoveryDataBase.hpp>
3434
#include <rtps/builtin/discovery/database/DiscoveryDataFilter.hpp>
3535
#include <rtps/builtin/discovery/participant/DS/DiscoveryServerPDPEndpointsSecure.hpp>

0 commit comments

Comments
 (0)