Skip to content

Commit

Permalink
Methods to configure transport scenarios (#4098)
Browse files Browse the repository at this point in the history
* Refs #20020. Added enumeration for possible builtin transports configuration.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Add method to parse environment variable.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Cleanup RTPSParticipantAttributes.h.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Moved default transports configuration into RTPSParticipantAttributes::setup_transports.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. RTPSParticipantImpl constructor uses private copy of attributes.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Added support for DEFAULTv6.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. SHM transport added before UDP.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Added support for SHM.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Added support for UDPv4.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Added support for UDPv6.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Factor out duplicated code.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Added support for LARGE_DATA.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Added support for LARGE_DATAv6.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020. Added DomainParticipantQos::setup_transports.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #20020: Add constants for builtin transports

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Add XML parser functions for builtin_transports

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: add builtinTransports to .xsd

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: add mock tests needed

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Add builtin transports XML file

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Add new API to tests classes

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Add Blackbox tests

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs 20020: Rename XML file and EOF

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Add unittest test

Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>

* Refs #20020: Update versions.md

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Make enum uint16_t

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Add Parsing test

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Apply minor changes

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Remove - in CMakeLists

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Uncrustify

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Fix .xsd and remove unnecesary mock test

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Add implementation for mock test

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Fix windows build

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20020: Uncrustify

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Disable v6 tests for Mac

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

---------

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>
Co-authored-by: cferreiragonz <carlosferreira@eprosima.com>
Co-authored-by: elianalf <62831776+elianalf@users.noreply.github.com>
(cherry picked from commit 8cbd461)

# Conflicts:
#	include/fastdds/dds/domain/qos/DomainParticipantQos.hpp
#	include/fastdds/rtps/attributes/RTPSParticipantAttributes.h
#	include/fastrtps/xmlparser/XMLParser.h
#	resources/xsd/fastRTPS_profiles.xsd
#	src/cpp/rtps/participant/RTPSParticipantImpl.cpp
#	src/cpp/rtps/xmlparser/XMLElementParser.cpp
#	test/unittest/dynamic_types/CMakeLists.txt
#	test/unittest/statistics/dds/CMakeLists.txt
#	test/unittest/xmlparser/CMakeLists.txt
#	versions.md
  • Loading branch information
MiguelCompany authored and mergify[bot] committed Dec 19, 2023
1 parent d5ec4ca commit 498fd1d
Show file tree
Hide file tree
Showing 32 changed files with 2,693 additions and 60 deletions.
145 changes: 145 additions & 0 deletions include/fastdds/dds/domain/qos/DomainParticipantQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@

#include <string>

<<<<<<< HEAD
=======
#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>
>>>>>>> 8cbd46144 (Methods to configure transport scenarios (#4098))
#include <fastrtps/fastrtps_dll.h>
#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp>
Expand Down Expand Up @@ -321,6 +328,144 @@ class DomainParticipantQos
return flow_controllers_;
}

<<<<<<< HEAD
=======
/**
* Getter for builtin flow controllers sender threads ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& builtin_controllers_sender_thread()
{
return builtin_controllers_sender_thread_;
}

/**
* Getter for builtin flow controllers sender threads ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& builtin_controllers_sender_thread() const
{
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
*
* @param value New ThreadSettings to be set
*/
void builtin_controllers_sender_thread(
const rtps::ThreadSettings& value)
{
builtin_controllers_sender_thread_ = value;
}

/**
* Getter for timed event ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& timed_events_thread()
{
return timed_events_thread_;
}

/**
* Getter for timed event ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& timed_events_thread() const
{
return timed_events_thread_;
}

/**
* Setter for the timed event ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void timed_events_thread(
const rtps::ThreadSettings& value)
{
timed_events_thread_ = value;
}

/**
* Getter for discovery server ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& discovery_server_thread()
{
return discovery_server_thread_;
}

/**
* Getter for discovery server ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& discovery_server_thread() const
{
return discovery_server_thread_;
}

/**
* Setter for the discovery server ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void discovery_server_thread(
const rtps::ThreadSettings& value)
{
discovery_server_thread_ = value;
}

#if HAVE_SECURITY
/**
* Getter for security log ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& security_log_thread()
{
return security_log_thread_;
}

/**
* Getter for security log ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& security_log_thread() const
{
return security_log_thread_;
}

/**
* Setter for the security log ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void security_log_thread(
const rtps::ThreadSettings& value)
{
security_log_thread_ = value;
}

#endif // if HAVE_SECURITY

>>>>>>> 8cbd46144 (Methods to configure transport scenarios (#4098))
private:

//!UserData Qos, implemented in the library.
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_
63 changes: 33 additions & 30 deletions include/fastdds/rtps/attributes/RTPSParticipantAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
#ifndef _FASTDDS_RTPSPARTICIPANTPARAMETERS_H_
#define _FASTDDS_RTPSPARTICIPANTPARAMETERS_H_

<<<<<<< HEAD
=======
#include <memory>
#include <sstream>

#include <fastdds/rtps/attributes/BuiltinTransports.hpp>
>>>>>>> 8cbd46144 (Methods to configure transport scenarios (#4098))
#include <fastdds/rtps/attributes/ExternalLocators.hpp>
#include <fastdds/rtps/attributes/PropertyPolicy.h>
#include <fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp>
Expand All @@ -36,14 +43,12 @@
#include <sstream>

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 @@ -57,14 +62,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 @@ -127,7 +131,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 @@ -440,26 +444,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 All @@ -482,6 +477,14 @@ class RTPSParticipantAttributes
(this->flow_controllers == b.flow_controllers);
}

/**
* 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 @@ -508,12 +511,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 @@ -534,7 +537,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 @@ -546,8 +549,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 All @@ -574,11 +577,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_
Loading

0 comments on commit 498fd1d

Please sign in to comment.