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

[20493] Extend LARGE_DATA configuration options #4444

Merged
merged 34 commits into from
Mar 7, 2024
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
0c6fba9
Refs #20493: Add Builtin config options
cferreiragonz Feb 21, 2024
e790c71
Refs #20493: Overload of RTPS API
cferreiragonz Feb 21, 2024
087cd02
Refs #20493: Update old methods with options parameter
cferreiragonz Feb 21, 2024
13f9349
Refs #20493: Overload of DomainParticipantQos API
cferreiragonz Feb 21, 2024
d9c52e9
Refs #20493: Make builtin-options const
cferreiragonz Feb 21, 2024
b001553
Refs #20493: Add Env.var. parser
cferreiragonz Feb 22, 2024
f94cea3
Refs #20493: Increase maximum msg_size of TCP
cferreiragonz Feb 22, 2024
22b29f4
Refs #20493: Add blackbox tests
cferreiragonz Feb 22, 2024
91d7fe1
Refs #20493: Add Participant unittests
cferreiragonz Feb 22, 2024
b1f19a1
Refs #20493: Add units parser to utils
cferreiragonz Feb 23, 2024
d51ff94
Refs #20493: Update xsd shcema
cferreiragonz Feb 23, 2024
dd6c3e9
Refs #20493: Update XML parser with attributes and new format
cferreiragonz Feb 23, 2024
a343200
Refs #20493: Update XML Tests
cferreiragonz Feb 23, 2024
b082b71
Refs #20493: Add xml tests to blackbox tests
cferreiragonz Feb 23, 2024
2915a23
Refs #20493: change to_uppercase() method to fix windows build
cferreiragonz Feb 26, 2024
f492df5
Refs #20493: Uncrustify
cferreiragonz Feb 26, 2024
e911ed6
Refs #20493: Update transport initialization with max_msg_size_no_frag
cferreiragonz Feb 27, 2024
19ed038
Refs #20493: Update QosPolicies to include max_msg_no_frag
cferreiragonz Feb 27, 2024
163d008
Refs #20493: Correct and add Env.var tests
cferreiragonz Feb 27, 2024
8c9467f
Refs #20493: Improve doxygen and use XML::ERROR type
cferreiragonz Feb 28, 2024
5d7bb65
Refs #20493: Uncrustify and try to fix windows again
cferreiragonz Feb 28, 2024
0bfe00f
Refs #20493: fix doxygen
cferreiragonz Feb 29, 2024
6576962
Refs #20493: Use int in toupper and move includes
cferreiragonz Feb 29, 2024
f5d5b47
Refs #20493: tcp_negotiation_timeout in BuiltinTransportOptions
cferreiragonz Mar 1, 2024
2b5756c
Refs #20493: Timeout in Env.var.
cferreiragonz Mar 1, 2024
957ce6a
Refs #20493: Timeout in XML
cferreiragonz Mar 1, 2024
d1b2abb
Refs #20493: Tests for timeout and improvements
cferreiragonz Mar 1, 2024
93bba2a
Refs #20493: Uncrustify
cferreiragonz Mar 1, 2024
1de045c
Refs #20493: Update XML schema to accept mode in complex type
JesusPoderoso Mar 4, 2024
ece2aea
Refs #20493: Update test XML according to XSD update
JesusPoderoso Mar 4, 2024
a0f3a36
Refs #20493: Update unit test XML snippets according to XSD update
JesusPoderoso Mar 4, 2024
b07eae6
Refs #20493: Update XMLParser to accept new schema
cferreiragonz Mar 4, 2024
4ee3a43
Refs #20493: Apply suggestions
cferreiragonz Mar 4, 2024
a72bc9a
Refs #20493: Abort use of std::toupper()
cferreiragonz Mar 6, 2024
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
8 changes: 8 additions & 0 deletions include/fastdds/dds/core/policy/QosPolicies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2747,6 +2747,7 @@ class TransportConfigQos : public QosPolicy
, use_builtin_transports(true)
, send_socket_buffer_size(0)
, listen_socket_buffer_size(0)
, max_msg_size_no_frag(0)
{
}

Expand All @@ -2763,6 +2764,7 @@ class TransportConfigQos : public QosPolicy
(this->send_socket_buffer_size == b.send_socket_buffer_size) &&
(this->listen_socket_buffer_size == b.listen_socket_buffer_size) &&
(this->builtin_transports_reception_threads_ == b.builtin_transports_reception_threads_) &&
(this->max_msg_size_no_frag == b.max_msg_size_no_frag) &&
QosPolicy::operator ==(b);
}

Expand Down Expand Up @@ -2791,6 +2793,12 @@ class TransportConfigQos : public QosPolicy

//! Thread settings for the builtin transports reception threads
rtps::ThreadSettings builtin_transports_reception_threads_;

/*! Maximum message size used to avoid fragmentation, set ONLY in LARGE_DATA. If this value is
* not zero, the network factory will allow the initialization of UDP transports with maxMessageSize
* higher than 65500K.
*/
cferreiragonz marked this conversation as resolved.
Show resolved Hide resolved
uint32_t max_msg_size_no_frag;
};

//! Qos Policy to configure the endpoint
Expand Down
7 changes: 5 additions & 2 deletions include/fastdds/dds/domain/qos/DomainParticipantQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,15 @@ class DomainParticipantQos
}

/**
* Provides a way of easily configuring transport related configuration on certain pre-defined scenarios.
* Provides a way of easily configuring transport related configuration on certain pre-defined scenarios with
* certain options.
*
* @param transports Defines the transport configuration scenario to setup.
* @param options Defines the options to be used in the transport configuration.
*/
RTPS_DllAPI void setup_transports(
rtps::BuiltinTransports transports);
rtps::BuiltinTransports transports,
const rtps::BuiltinTransportsOptions& options = rtps::BuiltinTransportsOptions());

/**
* Setter for the builtin flow controllers sender threads ThreadSettings
Expand Down
73 changes: 73 additions & 0 deletions include/fastdds/rtps/attributes/BuiltinTransports.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,84 @@

#include <ostream>
#include <cstdint>
#include <fastdds/rtps/transport/TransportInterface.h>

#include <fastrtps/fastrtps_dll.h>

namespace eprosima {
namespace fastdds {
namespace rtps {


/**
* @brief Options for configuring the built-in transports when using LARGE_DATA mode.
*/
struct RTPS_DllAPI BuiltinTransportsOptions
{
//! Whether to use non-blocking send operation.
bool non_blocking_send = false;

/**
* @brief The maximum message size to be used.
*
* It specifies the maximum message size that will be used by the Network Factory
* to register every transport.
*
*/
uint32_t maxMessageSize = fastdds::rtps::s_maximumMessageSize;

/**
* @brief The value used to configure the send and receive fuffer sizes of the sockets.
*
* It specifies the value that will be used to configure the send and receive buffer sizes of the sockets
* used by the transports created with the builtin transports.
* Zero value indicates to use default system buffer size.
*
*/
JesusPoderoso marked this conversation as resolved.
Show resolved Hide resolved
uint32_t sockets_buffer_size = 0;

/**
* @brief Time to wait for logical port negotiation (ms).
*
* It specifies the value that will be used to configure the honomym attribute of the TCPTransportDescriptor used.
* It only takes effect if the LARGE_DATA mode is used.
* Zero value means no waiting (default).
*
*/
uint32_t tcp_negotiation_timeout = 0;
};

/**
* @brief Equal to operator.
*
* @param bto1 Left hand side BuiltinTransportsOptions being compared.
* @param bto2 Right hand side BuiltinTransportsOptions being compared.
* @return true if \c bto1 is equal to \c bto2.
* @return false otherwise.
*/
inline bool operator ==(
const BuiltinTransportsOptions& bto1,
const BuiltinTransportsOptions& bto2)
{
if (bto1.non_blocking_send != bto2.non_blocking_send)
{
return false;
}
if (bto1.maxMessageSize != bto2.maxMessageSize)
{
return false;
}
if (bto1.sockets_buffer_size != bto2.sockets_buffer_size)
{
return false;
}
if (bto1.tcp_negotiation_timeout != bto2.tcp_negotiation_timeout)
{
return false;
}
return true;
}

/**
* Defines the kind of transports automatically instantiated upon the creation of a participant
*/
Expand Down
13 changes: 11 additions & 2 deletions include/fastdds/rtps/attributes/RTPSParticipantAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,15 @@ class RTPSParticipantAttributes
}

/**
* Provides a way of easily configuring transport related configuration on certain pre-defined scenarios.
* Provides a way of easily configuring transport related configuration on certain pre-defined scenarios with
* certain options.
*
* @param transports Defines the transport configuration scenario to setup.
* @param options Defines the options to be used in the transport configuration.
*/
RTPS_DllAPI void setup_transports(
fastdds::rtps::BuiltinTransports transports);
fastdds::rtps::BuiltinTransports transports,
const fastdds::rtps::BuiltinTransportsOptions& options = fastdds::rtps::BuiltinTransportsOptions());

/**
* Default list of Unicast Locators to be used for any Endpoint defined inside this RTPSParticipant in the case
Expand Down Expand Up @@ -600,6 +603,12 @@ class RTPSParticipantAttributes
fastdds::rtps::ThreadSettings security_log_thread;
#endif // if HAVE_SECURITY

/*! Maximum message size used to avoid fragmentation, set ONLY in LARGE_DATA. If this value is
* not zero, the network factory will allow the initialization of UDP transports with maxMessageSize
* higher than 65500K.
*/
uint32_t max_msg_size_no_frag = 0;

private:

//! Name of the participant.
Expand Down
6 changes: 4 additions & 2 deletions include/fastdds/rtps/transport/ChainingTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ class ChainingTransport : public TransportInterface
/*!
* Initialize the low-level transport. This method will prepare all the internals of the transport.
* @param properties Optional policy to specify additional parameters of the created transport.
* @param max_msg_size_no_frag Optional maximum message size to avoid 65500 KB fragmentation limit.
* @return True when the transport was correctly initialized.
*/
RTPS_DllAPI bool init(
const fastrtps::rtps::PropertyPolicy* properties = nullptr) override
const fastrtps::rtps::PropertyPolicy* properties = nullptr,
const uint32_t& max_msg_size_no_frag = 0) override
{
return low_level_transport_->init(properties);
return low_level_transport_->init(properties, max_msg_size_no_frag);
}

/*!
Expand Down
4 changes: 3 additions & 1 deletion include/fastdds/rtps/transport/TransportInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ class RTPS_DllAPI TransportInterface
/**
* Initialize this transport. This method will prepare all the internals of the transport.
* @param properties Optional policy to specify additional parameters of the created transport.
* @param max_msg_size_no_frag Optional maximum message size to avoid 65500 KB fragmentation limit.
* @return True when the transport was correctly initialized.
*/
virtual bool init(
const fastrtps::rtps::PropertyPolicy* properties = nullptr) = 0;
const fastrtps::rtps::PropertyPolicy* properties = nullptr,
const uint32_t& max_msg_size_no_frag = 0) = 0;

/**
* Must report whether the input channel associated to this locator is open. Channels must either be
Expand Down
52 changes: 52 additions & 0 deletions include/fastrtps/utils/UnitsParser.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2024 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 UnitsParser.hpp
*/

#ifndef _FASTDDS_UTILS_UNITS_PARSER_HPP_
#define _FASTDDS_UTILS_UNITS_PARSER_HPP_

#include <string>

namespace eprosima {
namespace fastdds {
namespace dds {
namespace utils {

/**
* Converts the string to uppercase.
*
* @param[in] st String to convert
*/
inline void to_uppercase(
std::string& st) noexcept;

/**
* Converts a numeric value with units to bytes.
*
* @param[in] value Numeric value to convert
* @param[in] units Units to use for the conversion
* @return The value in bytes
*/
uint32_t parse_value_and_units(
std::string& value,
std::string units);
cferreiragonz marked this conversation as resolved.
Show resolved Hide resolved

} /* namespace utils */
} /* namespace dds */
} /* namespace fastdds */
} /* namespace eprosima */
#endif /* _FASTDDS_UTILS_UNITS_PARSER_HPP_ */
1 change: 1 addition & 0 deletions include/fastrtps/xmlparser/XMLParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ class XMLParser
RTPS_DllAPI static XMLP_ret getXMLBuiltinTransports(
tinyxml2::XMLElement* elem,
eprosima::fastdds::rtps::BuiltinTransports* bt,
eprosima::fastdds::rtps::BuiltinTransportsOptions* bt_opts,
uint8_t ident);
};

Expand Down
3 changes: 3 additions & 0 deletions include/fastrtps/xmlparser/XMLParserCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ extern const char* THROUGHPUT_CONT;
extern const char* USER_TRANS;
extern const char* USE_BUILTIN_TRANS;
extern const char* BUILTIN_TRANS;
extern const char* MAX_MSG_SIZE_LARGE_DATA;
extern const char* SOCKETS_SIZE_LARGE_DATA;
extern const char* NON_BLOCKING_LARGE_DATA;
extern const char* PROPERTIES_POLICY;
extern const char* NAME;
extern const char* REMOTE_LOCATORS;
Expand Down
52 changes: 37 additions & 15 deletions resources/xsd/fastRTPS_profiles.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
├ userTransports [0~1],
| └ transport_id [1~*] [string],
├ useBuiltinTransports [bool],
├ builtinTransports [0~1][string]
├ builtinTransports [0~1],
├ propertiesPolicy [0~1],
├ allocation [0~1],
├ userData [0~1],
Expand Down Expand Up @@ -164,20 +164,7 @@
</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="builtinTransports" type="builtinTransportsType" minOccurs="0" maxOccurs="1"/>
<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 All @@ -195,6 +182,25 @@
<xs:attribute name="is_default_profile" type="boolean" use="optional"/>
</xs:complexType>

<!--Builtin Transports Enum Type:
| ╠ att. max_msg_size [string],
| ╠ att. sockets_size [string],
| ╠ att. non_blocking [string],
| ╚ att. tcp_negotiation_timeout [string]
|
└ (raw_data) [string]-->

<xs:complexType name="builtinTransportsType">
<xs:simpleContent>
<xs:extension base="builtinTransportKind">
<xs:attribute name="max_msg_size" type="string" use="optional"/>
<xs:attribute name="sockets_size" type="string" use="optional"/>
<xs:attribute name="non_blocking" type="boolean" use="optional"/>
<xs:attribute name="tcp_negotiation_timeout" type="uint32" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<!--Data writer / publisher:
| ╠ att. profile_name [string] REQ,
| ╚ att. is_default_profile [bool],
Expand Down Expand Up @@ -1797,6 +1803,22 @@
</xs:complexType>


<!--Builtin Transport Kind list Type:
└ builtinTransport [1]-->
<xs:simpleType name="builtinTransportKind">
<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>


<!--| PRIMITIVE TYPES DEFINITION |-->
<!--Primitive Types from Fast DDS docs-->
<xs:simpleType name="primitiveTypes">
Expand Down
1 change: 1 addition & 0 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ set(${PROJECT_NAME}_source_files
utils/SystemInfo.cpp
utils/TimedConditionVariable.cpp
utils/string_convert.cpp
utils/UnitsParser.cpp

dds/core/types.cpp
dds/core/Exception.cpp
Expand Down
5 changes: 3 additions & 2 deletions src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ namespace dds {
const DomainParticipantQos PARTICIPANT_QOS_DEFAULT;

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

attr.setup_transports(transports);
attr.setup_transports(transports, options);

utils::set_qos_from_attributes(*this, attr);
}
Expand Down
2 changes: 2 additions & 0 deletions src/cpp/fastdds/utils/QosConverters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void set_qos_from_attributes(
qos.transport().use_builtin_transports = attr.useBuiltinTransports;
qos.transport().send_socket_buffer_size = attr.sendSocketBufferSize;
qos.transport().listen_socket_buffer_size = attr.listenSocketBufferSize;
qos.transport().max_msg_size_no_frag = attr.max_msg_size_no_frag;
qos.name() = attr.getName();
qos.flow_controllers() = attr.flow_controllers;
qos.builtin_controllers_sender_thread() = attr.builtin_controllers_sender_thread;
Expand Down Expand Up @@ -200,6 +201,7 @@ void set_attributes_from_qos(
attr.useBuiltinTransports = qos.transport().use_builtin_transports;
attr.sendSocketBufferSize = qos.transport().send_socket_buffer_size;
attr.listenSocketBufferSize = qos.transport().listen_socket_buffer_size;
attr.max_msg_size_no_frag = qos.transport().max_msg_size_no_frag;
attr.userData = qos.user_data().data_vec();
attr.flow_controllers = qos.flow_controllers();
attr.builtin_controllers_sender_thread = qos.builtin_controllers_sender_thread();
Expand Down
Loading
Loading