Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20086] Methods to configure transport scenarios #4098

Merged
merged 34 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
060dd99
Refs #20020. Added enumeration for possible builtin transports config…
MiguelCompany Nov 29, 2023
5a1276c
Refs #20020. Add method to parse environment variable.
MiguelCompany Nov 29, 2023
25d6cd6
Refs #20020. Cleanup RTPSParticipantAttributes.h.
MiguelCompany Nov 30, 2023
e445608
Refs #20020. Moved default transports configuration into RTPSParticip…
MiguelCompany Nov 30, 2023
3bcda7b
Refs #20020. RTPSParticipantImpl constructor uses private copy of att…
MiguelCompany Nov 30, 2023
838a6ce
Refs #20020. Added support for DEFAULTv6.
MiguelCompany Nov 30, 2023
91201e1
Refs #20020. SHM transport added before UDP.
MiguelCompany Nov 30, 2023
9a76067
Refs #20020. Added support for SHM.
MiguelCompany Dec 1, 2023
2dd2e6b
Refs #20020. Added support for UDPv4.
MiguelCompany Dec 1, 2023
26c22a2
Refs #20020. Added support for UDPv6.
MiguelCompany Dec 1, 2023
d573121
Refs #20020. Factor out duplicated code.
MiguelCompany Dec 4, 2023
bdddf7f
Refs #20020. Added support for LARGE_DATA.
MiguelCompany Dec 4, 2023
eb91274
Refs #20020. Added support for LARGE_DATAv6.
MiguelCompany Dec 4, 2023
88742da
Refs #20020. Added DomainParticipantQos::setup_transports.
MiguelCompany Dec 4, 2023
4aaf8eb
Refs #20020: Add constants for builtin transports
cferreiragonz Dec 5, 2023
b74ae43
Refs #20020: Add XML parser functions for builtin_transports
cferreiragonz Dec 5, 2023
a19b83b
Refs #20020: add builtinTransports to .xsd
cferreiragonz Dec 12, 2023
e84911e
Refs #20020: add mock tests needed
cferreiragonz Dec 12, 2023
1a00a27
Refs #20020: Add builtin transports XML file
cferreiragonz Dec 13, 2023
3d3a614
Refs #20020: Add new API to tests classes
cferreiragonz Dec 13, 2023
75e18c4
Refs #20020: Add Blackbox tests
cferreiragonz Dec 13, 2023
8b2b326
Refs 20020: Rename XML file and EOF
cferreiragonz Dec 13, 2023
d95e32c
Refs #20020: Add unittest test
elianalf Dec 14, 2023
0e9f9b3
Refs #20020: Update versions.md
cferreiragonz Dec 14, 2023
cfedfd0
Refs #20020: Make enum uint16_t
cferreiragonz Dec 15, 2023
4e2cbaf
Refs #20020: Add Parsing test
cferreiragonz Dec 15, 2023
c62e345
Refs #20020: Apply minor changes
cferreiragonz Dec 15, 2023
55622f0
Refs #20020: Remove - in CMakeLists
cferreiragonz Dec 15, 2023
665897d
Refs #20020: Uncrustify
cferreiragonz Dec 15, 2023
5e55413
Refs #20020: Fix .xsd and remove unnecesary mock test
cferreiragonz Dec 17, 2023
ba3b089
Refs #20020: Add implementation for mock test
cferreiragonz Dec 18, 2023
4417584
Refs #20020: Fix windows build
cferreiragonz Dec 18, 2023
b921cf7
Refs #20020: Uncrustify
cferreiragonz Dec 19, 2023
fa333ec
Disable v6 tests for Mac
cferreiragonz Dec 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/fastdds/dds/domain/qos/DomainParticipantQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <string>

#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/rtps/attributes/BuiltinTransports.hpp>
#include <fastdds/rtps/attributes/ThreadSettings.hpp>
#include <fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp>
#include <fastrtps/fastrtps_dll.h>
Expand Down Expand Up @@ -348,6 +349,14 @@ class DomainParticipantQos
return builtin_controllers_sender_thread_;
}

/**
* Provides a way of easily configuring transport related configuration on certain pre-defined scenarios.
*
* @param transports Defines the transport configuration scenario to setup.
*/
RTPS_DllAPI void setup_transports(
rtps::BuiltinTransports transports);

/**
* Setter for the builtin flow controllers sender threads ThreadSettings
*
Expand Down
85 changes: 85 additions & 0 deletions include/fastdds/rtps/attributes/BuiltinTransports.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @file BuiltinTransports.hpp
*/

#ifndef _FASTDDS_RTPS_ATTRIBUTES__BUILTINTRANSPORTS_HPP_
#define _FASTDDS_RTPS_ATTRIBUTES__BUILTINTRANSPORTS_HPP_

#include <ostream>
#include <cstdint>

namespace eprosima {
namespace fastdds {
namespace rtps {

/**
* Defines the kind of transports automatically instantiated upon the creation of a participant
*/
enum class BuiltinTransports : uint16_t
{
NONE = 0, //< No transport will be instantiated
DEFAULT = 1, //< Default value that will instantiate UDPv4 and SHM transports
DEFAULTv6 = 2, //< Instantiate UDPv6 and SHM transports
SHM = 3, //< Instantiate SHM transport only
UDPv4 = 4, //< Instantiate UDPv4 transport only
UDPv6 = 5, //< Instantiate UDPv6 transport only
LARGE_DATA = 6, //< Instantiate SHM, UDPv4 and TCPv4 transports, but UDPv4 is only used for bootstrapping discovery
LARGE_DATAv6 = 7 //< Instantiate SHM, UDPv6 and TCPv6 transports, but UDPv6 is only used for bootstrapping discovery
};

inline std::ostream& operator <<(
std::ostream& output,
BuiltinTransports transports)
{
switch (transports)
{
case BuiltinTransports::NONE:
output << "NONE";
break;
case BuiltinTransports::DEFAULT:
output << "DEFAULT";
break;
case BuiltinTransports::DEFAULTv6:
output << "DEFAULTv6";
break;
case BuiltinTransports::SHM:
output << "SHM";
break;
case BuiltinTransports::UDPv4:
output << "UDPv4";
break;
case BuiltinTransports::UDPv6:
output << "UDPv6";
break;
case BuiltinTransports::LARGE_DATA:
output << "LARGE_DATA";
break;
case BuiltinTransports::LARGE_DATAv6:
output << "LARGE_DATAv6";
break;
default:
output << "UNKNOWN";
break;
}
return output;
}

} // namespace rtps
} // namespace fastdds
} // namespace eprosima

#endif // _FASTDDS_RTPS_ATTRIBUTES__BUILTINTRANSPORTS_HPP_
57 changes: 27 additions & 30 deletions include/fastdds/rtps/attributes/RTPSParticipantAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <memory>
#include <sstream>

#include <fastdds/rtps/attributes/BuiltinTransports.hpp>
#include <fastdds/rtps/attributes/ExternalLocators.hpp>
#include <fastdds/rtps/attributes/PropertyPolicy.h>
#include <fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp>
Expand All @@ -39,14 +40,12 @@
#include <fastrtps/utils/fixed_size_string.hpp>

namespace eprosima {

namespace fastdds {

namespace rtps {

/**
* Struct to define participant types to set participant type parameter property
*@ingroup DISCOVERY_MODULE
* @ingroup DISCOVERY_MODULE
*/
struct ParticipantType
{
Expand All @@ -60,14 +59,13 @@ struct ParticipantType
static constexpr const char* UNKNOWN = "UNKNOWN";
};

} /* namespace rtps */
} /* namespace fastdds */
} // namespace rtps
} // namespace fastdds

namespace fastrtps {
namespace rtps {


//!PDP subclass choice
//! PDP subclass choice
typedef enum DiscoveryProtocol
{
NONE,
Expand Down Expand Up @@ -130,7 +128,7 @@ inline std::ostream& operator <<(
return output;
}

//!Filtering flags when discovering participants
//! Filtering flags when discovering participants
typedef enum ParticipantFilteringFlags : uint32_t
{
NO_FILTER = 0,
Expand Down Expand Up @@ -447,26 +445,17 @@ class BuiltinAttributes

/**
* Class RTPSParticipantAttributes used to define different aspects of a RTPSParticipant.
*@ingroup RTPS_ATTRIBUTES_MODULE
* @ingroup RTPS_ATTRIBUTES_MODULE
*/
class RTPSParticipantAttributes
{
using FlowControllerDescriptorList = std::vector<std::shared_ptr<fastdds::rtps::FlowControllerDescriptor>>;

public:

RTPSParticipantAttributes()
{
setName("RTPSParticipant");
sendSocketBufferSize = 0;
listenSocketBufferSize = 0;
participantID = -1;
useBuiltinTransports = true;
}
RTPSParticipantAttributes() = default;

virtual ~RTPSParticipantAttributes()
{
}
virtual ~RTPSParticipantAttributes() = default;

bool operator ==(
const RTPSParticipantAttributes& b) const
Expand Down Expand Up @@ -497,6 +486,14 @@ class RTPSParticipantAttributes

}

/**
* Provides a way of easily configuring transport related configuration on certain pre-defined scenarios.
*
* @param transports Defines the transport configuration scenario to setup.
*/
RTPS_DllAPI void setup_transports(
fastdds::rtps::BuiltinTransports transports);

/**
* Default list of Unicast Locators to be used for any Endpoint defined inside this RTPSParticipant in the case
* that it was defined with NO UnicastLocators. At least ONE locator should be included in this list.
Expand All @@ -523,12 +520,12 @@ class RTPSParticipantAttributes
* @brief Send socket buffer size for the send resource. Zero value indicates to use default system buffer size.
* Default value: 0.
*/
uint32_t sendSocketBufferSize;
uint32_t sendSocketBufferSize = 0;

/*! Listen socket buffer for all listen resources. Zero value indicates to use default system buffer size.
* Default value: 0.
*/
uint32_t listenSocketBufferSize;
uint32_t listenSocketBufferSize = 0;

//! Optionally allows user to define the GuidPrefix_t
GuidPrefix_t prefix;
Expand All @@ -549,7 +546,7 @@ class RTPSParticipantAttributes
std::vector<octet> userData;

//! Participant ID
int32_t participantID;
int32_t participantID = -1;

/**
* @brief Throughput controller parameters. Leave default for uncontrolled flow.
Expand All @@ -561,8 +558,8 @@ class RTPSParticipantAttributes
//! User defined transports to use alongside or in place of builtins.
std::vector<std::shared_ptr<fastdds::rtps::TransportDescriptorInterface>> userTransports;

//! Set as false to disable the default UDPv4 implementation.
bool useBuiltinTransports;
//! Set as false to disable the creation of the default transports.
bool useBuiltinTransports = true;

//! Holds allocation limits affecting collections managed by a participant.
RTPSParticipantAllocationAttributes allocation;
Expand Down Expand Up @@ -606,11 +603,11 @@ class RTPSParticipantAttributes
private:

//! Name of the participant.
string_255 name;
string_255 name{"RTPSParticipant"};
};

} /* namespace rtps */
} /* namespace fastrtps */
} /* namespace eprosima */
} // namespace rtps
} // namespace fastrtps
} // namespace eprosima

#endif /* _FASTDDS_RTPSPARTICIPANTPARAMETERS_H_ */
#endif // _FASTDDS_RTPSPARTICIPANTPARAMETERS_H_
5 changes: 5 additions & 0 deletions include/fastrtps/xmlparser/XMLParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,11 @@ class XMLParser
RTPS_DllAPI static XMLP_ret getXMLEntityFactoryQos(
tinyxml2::XMLElement& elem,
fastdds::dds::EntityFactoryQosPolicy& entity_factory);

RTPS_DllAPI static XMLP_ret getXMLBuiltinTransports(
tinyxml2::XMLElement* elem,
eprosima::fastdds::rtps::BuiltinTransports* bt,
uint8_t ident);
};

} // namespace xmlparser
Expand Down
5 changes: 5 additions & 0 deletions include/fastrtps/xmlparser/XMLParserCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ extern const char* IP6_TO_SEND;
extern const char* THROUGHPUT_CONT;
extern const char* USER_TRANS;
extern const char* USE_BUILTIN_TRANS;
extern const char* BUILTIN_TRANS;
extern const char* PROPERTIES_POLICY;
extern const char* NAME;
extern const char* REMOTE_LOCATORS;
Expand Down Expand Up @@ -201,6 +202,10 @@ extern const char* UDPv6;
extern const char* TCPv4;
extern const char* TCPv6;
extern const char* SHM;
extern const char* DEFAULT_C;
extern const char* DEFAULTv6;
extern const char* LARGE_DATA;
extern const char* LARGE_DATAv6;
extern const char* INIT_ACKNACK_DELAY;
extern const char* HEARTB_RESP_DELAY;
extern const char* INIT_HEARTB_DELAY;
Expand Down
20 changes: 16 additions & 4 deletions resources/xsd/fastRTPS_profiles.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
├ userTransports [0~1],
| └ transport_id [1~*] [string],
├ useBuiltinTransports [bool],
├ builtinTransports [0~1][string]
├ propertiesPolicy [0~1],
├ allocation [0~1],
├ userData [0~1],
Expand Down Expand Up @@ -163,6 +164,20 @@
</xs:complexType>
</xs:element>
<xs:element name="useBuiltinTransports" type="boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="builtinTransports" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="NONE"/>
<xs:enumeration value="DEFAULT"/>
<xs:enumeration value="DEFAULTv6"/>
<xs:enumeration value="SHM"/>
<xs:enumeration value="UDPv4"/>
<xs:enumeration value="UDPv6"/>
<xs:enumeration value="LARGE_DATA"/>
<xs:enumeration value="LARGE_DATAv6"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="propertiesPolicy" type="propertyPolicyType" minOccurs="0" maxOccurs="1"/>
<xs:element name="allocation" type="rtpsParticipantAllocationAttributesType" minOccurs="0" maxOccurs="1"/>
<xs:element name="userData" type="octectVectorQosPolicyType" minOccurs="0" maxOccurs="1"/>
Expand Down Expand Up @@ -531,9 +546,6 @@
<xs:attribute name="mapMaxLength" type="int32" use="optional"/>
</xs:complexType>




<!--| LOG ELEMENTS |-->
<!--Log consumer:
├ class [string] ("StdoutConsumer" OR "StdoutErrConsumer" OR "FileConsumer"),
Expand Down Expand Up @@ -892,7 +904,7 @@
<xs:union memberTypes="ipv4Address ipv6Address"/>
</xs:simpleType>
</xs:element>
<xs:element name="interface" type="string" maxOccurs="unbounded"/>
<xs:element name="interface" type="string" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
Expand Down
1 change: 1 addition & 0 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ set(${PROJECT_NAME}_source_files
rtps/network/ExternalLocatorsProcessor.cpp
rtps/network/NetworkFactory.cpp
rtps/network/ReceiverResource.cpp
rtps/attributes/RTPSParticipantAttributes.cpp
rtps/participant/RTPSParticipant.cpp
rtps/participant/RTPSParticipantImpl.cpp
rtps/RTPSDomain.cpp
Expand Down
15 changes: 15 additions & 0 deletions src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,27 @@

#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>

#include <fastdds/rtps/attributes/BuiltinTransports.hpp>
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
#include <fastdds/utils/QosConverters.hpp>

namespace eprosima {
namespace fastdds {
namespace dds {

const DomainParticipantQos PARTICIPANT_QOS_DEFAULT;

void DomainParticipantQos::setup_transports(
rtps::BuiltinTransports transports)
{
fastrtps::rtps::RTPSParticipantAttributes attr;
utils::set_attributes_from_qos(attr, *this);

attr.setup_transports(transports);

utils::set_qos_from_attributes(*this, attr);
}

} /* namespace dds */
} /* namespace fastdds */
} /* namespace eprosima */
Loading
Loading