Skip to content

Commit

Permalink
Refs #22427: New DS_AUTO BuiltinTransport option
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL committed Dec 5, 2024
1 parent de2890a commit bba066a
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 5 deletions.
10 changes: 7 additions & 3 deletions include/fastdds/rtps/attributes/BuiltinTransports.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@ inline bool operator ==(
*/
enum class BuiltinTransports : uint16_t
{
NONE = 0, //< No transport will be instantiated
DEFAULT = 1, //< Default value that will instantiate UDPv4 and SHM transports
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
LARGE_DATAv6 = 7, //< Instantiate SHM, UDPv6 and TCPv6 transports, but UDPv6 is only used for bootstrapping discovery
DS_AUTO = 8 //< Instantiate SHM and TCPv4 transports
};

inline std::ostream& operator <<(
Expand Down Expand Up @@ -144,6 +145,9 @@ inline std::ostream& operator <<(
case BuiltinTransports::LARGE_DATAv6:
output << "LARGE_DATAv6";
break;
case BuiltinTransports::DS_AUTO:
output << "DS_AUTO";
break;
default:
output << "UNKNOWN";
break;
Expand Down
1 change: 1 addition & 0 deletions resources/xsd/fastdds_profiles.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,7 @@
<xs:enumeration value="UDPv6" />
<xs:enumeration value="LARGE_DATA" />
<xs:enumeration value="LARGE_DATAv6" />
<xs:enumeration value="DS_AUTO" />
</xs:restriction>
</xs:simpleType>

Expand Down
28 changes: 28 additions & 0 deletions src/cpp/rtps/attributes/RTPSParticipantAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,28 @@ static void setup_transports_large_datav6(
}
}

static void setup_transports_ds_auto(
RTPSParticipantAttributes& att,
bool intraprocess_only,
const fastdds::rtps::BuiltinTransportsOptions& options)
{
if (!intraprocess_only)
{
setup_large_data_shm_transport(att, options);

auto tcp_transport = create_tcpv4_transport(att, options);
att.userTransports.push_back(tcp_transport);

Locator_t tcp_loc;
tcp_loc.kind = LOCATOR_KIND_TCPv4;
IPLocator::setIPv4(tcp_loc, "0.0.0.0");
IPLocator::setPhysicalPort(tcp_loc, 0);
IPLocator::setLogicalPort(tcp_loc, 0);
att.builtin.metatrafficUnicastLocatorList.push_back(tcp_loc);
att.defaultUnicastLocatorList.push_back(tcp_loc);
}
}

void RTPSParticipantAttributes::setup_transports(
fastdds::rtps::BuiltinTransports transports,
const fastdds::rtps::BuiltinTransportsOptions& options)
Expand Down Expand Up @@ -358,6 +380,12 @@ void RTPSParticipantAttributes::setup_transports(
setup_transports_large_datav6(*this, intraprocess_only, options);
break;

case fastdds::rtps::BuiltinTransports::DS_AUTO:
// This parameter will allow allow the initialization of UDP transports with maxMessageSize > 65500 KB (s_maximumMessageSize)
max_msg_size_no_frag = options.maxMessageSize;
setup_transports_ds_auto(*this, intraprocess_only, options);
break;

default:
EPROSIMA_LOG_ERROR(RTPS_PARTICIPANT,
"Setup for '" << transports << "' transport configuration not yet supported.");
Expand Down
6 changes: 4 additions & 2 deletions src/cpp/rtps/participant/RTPSParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ static void set_builtin_transports_from_env_var(
"UDPv4", BuiltinTransports::UDPv4,
"UDPv6", BuiltinTransports::UDPv6,
"LARGE_DATA", BuiltinTransports::LARGE_DATA,
"LARGE_DATAv6", BuiltinTransports::LARGE_DATAv6))
"LARGE_DATAv6", BuiltinTransports::LARGE_DATAv6,
"DS_AUTO", BuiltinTransports::DS_AUTO))
{
EPROSIMA_LOG_ERROR(RTPS_PARTICIPANT, "Wrong value '" << env_value << "' for environment variable '" <<
env_var_name << "'. Leaving as DEFAULT");
Expand All @@ -140,7 +141,8 @@ static void set_builtin_transports_from_env_var(
"UDPv4", BuiltinTransports::UDPv4,
"UDPv6", BuiltinTransports::UDPv6,
"LARGE_DATA", BuiltinTransports::LARGE_DATA,
"LARGE_DATAv6", BuiltinTransports::LARGE_DATAv6))
"LARGE_DATAv6", BuiltinTransports::LARGE_DATAv6,
"DS_AUTO", BuiltinTransports::DS_AUTO))
{
EPROSIMA_LOG_ERROR(RTPS_PARTICIPANT, "Wrong value '" << env_value << "' for environment variable '" <<
env_var_name << "'. Leaving as DEFAULT");
Expand Down
1 change: 1 addition & 0 deletions src/cpp/xmlparser/XMLElementParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4687,6 +4687,7 @@ XMLP_ret XMLParser::getXMLBuiltinTransports(
<xs:enumeration value="UDPv6" />
<xs:enumeration value="LARGE_DATA" />
<xs:enumeration value="LARGE_DATAv6" />
<xs:enumeration value="DS_AUTO" />
</xs:restriction>
</xs:simpleType>
Expand Down
1 change: 1 addition & 0 deletions src/cpp/xmlparser/XMLParserCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const char* DEFAULT_C = "DEFAULT";
const char* DEFAULTv6 = "DEFAULTv6";
const char* LARGE_DATA = "LARGE_DATA";
const char* LARGE_DATAv6 = "LARGE_DATAv6";
const char* DS_AUTO = "DS_AUTO";
const char* INIT_ACKNACK_DELAY = "initial_acknack_delay";
const char* HEARTB_RESP_DELAY = "heartbeat_response_delay";
const char* INIT_HEARTB_DELAY = "initial_heartbeat_delay";
Expand Down
1 change: 1 addition & 0 deletions src/cpp/xmlparser/XMLParserCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ extern const char* DEFAULT_C;
extern const char* DEFAULTv6;
extern const char* LARGE_DATA;
extern const char* LARGE_DATAv6;
extern const char* DS_AUTO;
extern const char* INIT_ACKNACK_DELAY;
extern const char* HEARTB_RESP_DELAY;
extern const char* INIT_HEARTB_DELAY;
Expand Down
8 changes: 8 additions & 0 deletions test/blackbox/builtin_transports_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,13 @@
</rtps>
</participant>

<participant profile_name="participant_ds_auto">
<domainId>0</domainId>
<rtps>
<name>Participant.builtin_transports_ds_auto</name>
<builtinTransports>DS_AUTO</builtinTransports>
</rtps>
</participant>

</profiles>
</dds>
5 changes: 5 additions & 0 deletions test/blackbox/common/BlackboxTestsTransportCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,11 @@ TEST(ChainingTransportTests, builtin_transports_xml_large_data)
BuiltinTransportsTest::test_xml("builtin_transports_profile.xml", "participant_largedata");
}

TEST(ChainingTransportTests, builtin_transports_xml_ds_auto)
{
BuiltinTransportsTest::test_xml("builtin_transports_profile.xml", "participant_ds_auto");
}

TEST(ChainingTransportTests, builtin_transports_xml_large_data_with_max_msg_size)
{
BuiltinTransportsTest::test_xml("builtin_transports_profile.xml", "participant_largedata_max_msg_size");
Expand Down
1 change: 1 addition & 0 deletions test/unittest/xmlparser/XMLElementParserTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ TEST_F(XMLParserTests, getXMLbuiltinTransports)
bt_list.push_back("UDPv6");
bt_list.push_back("LARGE_DATA");
bt_list.push_back("LARGE_DATAv6");
bt_list.push_back("DS_AUTO");

for (auto test_transport : bt_list)
{
Expand Down

0 comments on commit bba066a

Please sign in to comment.