From 2c217afe0879d28ea2e6716dcadfd23ca168e288 Mon Sep 17 00:00:00 2001 From: elianalf <62831776+elianalf@users.noreply.github.com> Date: Tue, 14 May 2024 10:53:31 +0200 Subject: [PATCH 1/3] Refs #20849: Add max_message_size property policy docs Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --- code/DDSCodeTester.cpp | 32 +++++++-- code/XMLTester.xml | 36 ++++++++++ .../non_consolidated_qos.rst | 69 +++++++++++++++++++ 3 files changed, 132 insertions(+), 5 deletions(-) diff --git a/code/DDSCodeTester.cpp b/code/DDSCodeTester.cpp index f0c4a33c0..be1434340 100644 --- a/code/DDSCodeTester.cpp +++ b/code/DDSCodeTester.cpp @@ -903,6 +903,28 @@ void dds_domain_examples() "unicast"); //!-- } + + { + // MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT + eprosima::fastrtps::rtps::RTPSParticipantAttributes part_attributes; + + // Set maximum number of bytes of the datagram to be sent + part_attributes.properties.properties().emplace_back( + "fastdds.max_message_size", + "1200"); + //!-- + } + + { + // MAX_MESSAGE_SIZE_PROPERTY_WRITER + eprosima::fastrtps::rtps::WriterAttributes writer_attributes; + + // Set maximum number of bytes of the datagram to be sent + writer_attributes.endpoint.properties.properties().emplace_back( + "fastdds.max_message_size", + "1200"); + //!-- + } } //DOMAINPARTICIPANTLISTENER-DISCOVERY-CALLBACKS @@ -4986,10 +5008,10 @@ void dynamictypes_examples() sequence_member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->create_type( type_descriptor)->build()); */ - + // Add the sequence member to the struct struct_builder->add_member(sequence_member_descriptor); - + sequence_member_descriptor = traits::make_shared(); sequence_member_descriptor->name("short_sequence"); sequence_member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->create_sequence_type( @@ -5027,7 +5049,7 @@ void dynamictypes_examples() int16_t out_simple_value; sequence_data->set_int16_value(2, in_simple_value); sequence_data->get_int16_value(out_simple_value, 2); - + data->return_loaned_value(sequence_data); //!-- } @@ -5080,7 +5102,7 @@ void dynamictypes_examples() int32_t out_simple_value; array_data->set_int32_value(2, in_simple_value); array_data->get_int32_value(out_simple_value, 2); - + data->return_loaned_value(array_data); //!-- } @@ -5351,7 +5373,7 @@ void dynamictypes_examples() // Get the loan for the bitset member DynamicData::_ref_type bitset_data = data->loan_value(data->get_member_id_by_name("my_bitset")); - // Set and retrieve bitfield values + // Set and retrieve bitfield values int16_t in_value {2}; int16_t out_value; bitset_data->set_int16_value(bitset_data->get_member_id_by_name("d"), in_value); diff --git a/code/XMLTester.xml b/code/XMLTester.xml index 970b93161..97a58c744 100644 --- a/code/XMLTester.xml +++ b/code/XMLTester.xml @@ -3232,6 +3232,42 @@ --> <--> +MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT<--> + + + + + + + + fastdds.max_message_size + 1200 + + + + + +<--> + +MAX_MESSAGE_SIZE_PROPERTY_WRITER<--> + + + + + + + fastdds.max_message_size + 1200 + + + + +<--> + FASTDDS_STATISTICS_MODULE<--> diff --git a/docs/fastdds/property_policies/non_consolidated_qos.rst b/docs/fastdds/property_policies/non_consolidated_qos.rst index 7b0e14656..06809ab0c 100644 --- a/docs/fastdds/property_policies/non_consolidated_qos.rst +++ b/docs/fastdds/property_policies/non_consolidated_qos.rst @@ -351,3 +351,72 @@ The behavior regarding this can be configured using the property ``fastdds.shm.e :language: xml :start-after: XML-SHM-ENFORCE-META-TRAFFIC :end-before: <--> + +.. _property_max_message_size: + +Maximum Message Size +^^^^^^^^^^^^^^^^^^^^ + +It is possible to set the maximum number of bytes of an RTPS datagram sent by an RTPSParticipant. +The value can be set in the RTPSParticipant properties or in the RTPSWriter properties. + +.. list-table:: + :header-rows: 1 + :align: left + + * - PropertyPolicyQos name + - PropertyPolicyQos value + - Default value + * - ``"fastdds.max_message_size"`` + - ``int32_t`` + - ``"4294967295"`` + +.. tabs:: + + .. tab:: C++ + + .. literalinclude:: /../code/DDSCodeTester.cpp + :language: c++ + :start-after: // MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT + :end-before: //!-- + :dedent: 6 + + .. tab:: XML + + .. literalinclude:: /../code/XMLTester.xml + :language: xml + :start-after: MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT<--> + :end-before: <--> + :lines: 2,4-16 + +.. list-table:: + :header-rows: 1 + :align: left + + * - PropertyPolicyQos name + - PropertyPolicyQos value + - Default value + * - ``"fastdds.max_message_size"`` + - ``int32_t`` + - ``"4294967295"`` + +.. tabs:: + + .. tab:: C++ + + .. literalinclude:: /../code/DDSCodeTester.cpp + :language: c++ + :start-after: // MAX_MESSAGE_SIZE_PROPERTY_WRITER + :end-before: //!-- + :dedent: 6 + + .. tab:: XML + + .. literalinclude:: /../code/XMLTester.xml + :language: xml + :start-after: MAX_MESSAGE_SIZE_PROPERTY_WRITER<--> + :end-before: <--> + :lines: 2,4-14 + +.. note:: + An invalid value of ``fastdds.max_message_size`` results in an exception. From fd0303c33bdc72bb4d718dff9cffa72a8db3e042 Mon Sep 17 00:00:00 2001 From: elianalf <62831776+elianalf@users.noreply.github.com> Date: Thu, 16 May 2024 16:28:40 +0200 Subject: [PATCH 2/3] Refs 20849: Apply suggestions Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --- code/DDSCodeTester.cpp | 8 ++--- code/XMLTester.xml | 4 +-- .../non_consolidated_qos.rst | 33 +++++++++---------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/code/DDSCodeTester.cpp b/code/DDSCodeTester.cpp index be1434340..68067e964 100644 --- a/code/DDSCodeTester.cpp +++ b/code/DDSCodeTester.cpp @@ -906,10 +906,10 @@ void dds_domain_examples() { // MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT - eprosima::fastrtps::rtps::RTPSParticipantAttributes part_attributes; + DomainParticipantQos pqos; // Set maximum number of bytes of the datagram to be sent - part_attributes.properties.properties().emplace_back( + pqos.properties().properties().emplace_back( "fastdds.max_message_size", "1200"); //!-- @@ -917,10 +917,10 @@ void dds_domain_examples() { // MAX_MESSAGE_SIZE_PROPERTY_WRITER - eprosima::fastrtps::rtps::WriterAttributes writer_attributes; + DataWriterQos wqos; // Set maximum number of bytes of the datagram to be sent - writer_attributes.endpoint.properties.properties().emplace_back( + wqos.properties().properties().emplace_back( "fastdds.max_message_size", "1200"); //!-- diff --git a/code/XMLTester.xml b/code/XMLTester.xml index 97a58c744..9855496f4 100644 --- a/code/XMLTester.xml +++ b/code/XMLTester.xml @@ -3240,7 +3240,7 @@ - + fastdds.max_message_size 1200 @@ -3258,7 +3258,7 @@ - + fastdds.max_message_size 1200 diff --git a/docs/fastdds/property_policies/non_consolidated_qos.rst b/docs/fastdds/property_policies/non_consolidated_qos.rst index 06809ab0c..f6b958fc1 100644 --- a/docs/fastdds/property_policies/non_consolidated_qos.rst +++ b/docs/fastdds/property_policies/non_consolidated_qos.rst @@ -357,8 +357,17 @@ The behavior regarding this can be configured using the property ``fastdds.shm.e Maximum Message Size ^^^^^^^^^^^^^^^^^^^^ -It is possible to set the maximum number of bytes of an RTPS datagram sent by an RTPSParticipant. -The value can be set in the RTPSParticipant properties or in the RTPSWriter properties. +One common requirement is the differentiation between the maximum size of received and sent datagrams. +This capability is especially important in scenarios where a system might need to handle large incoming +data sizes but should restrict the size of the data it sends to prevent overwhelming network resources +or complying with network traffic policies. The primary attribute for controlling datagram size is +`maxMessageSize`, which sets the upper limit for both the size of datagrams that can be received and +those that can be sent. For applications that need to restrict the size of outgoing datagrams without +changing the size of incoming ones, it's possible to set the new property ``fastdds.max_message_size``. +This property allows for the specific configuration of the maximum number of bytes for datagrams that +are sent. By configuring this property to a value lower than the smallest `maxMessageSize` across all +transports, applications can achieve a lower sending limit while maintaining the ability to receive +larger datagrams. .. list-table:: :header-rows: 1 @@ -368,9 +377,13 @@ The value can be set in the RTPSParticipant properties or in the RTPSWriter prop - PropertyPolicyQos value - Default value * - ``"fastdds.max_message_size"`` - - ``int32_t`` + - ``uint32_t`` - ``"4294967295"`` +.. note:: + An invalid value of ``fastdds.max_message_size`` would log an error, + and the default value will be used. + .. tabs:: .. tab:: C++ @@ -389,17 +402,6 @@ The value can be set in the RTPSParticipant properties or in the RTPSWriter prop :end-before: <--> :lines: 2,4-16 -.. list-table:: - :header-rows: 1 - :align: left - - * - PropertyPolicyQos name - - PropertyPolicyQos value - - Default value - * - ``"fastdds.max_message_size"`` - - ``int32_t`` - - ``"4294967295"`` - .. tabs:: .. tab:: C++ @@ -417,6 +419,3 @@ The value can be set in the RTPSParticipant properties or in the RTPSWriter prop :start-after: MAX_MESSAGE_SIZE_PROPERTY_WRITER<--> :end-before: <--> :lines: 2,4-14 - -.. note:: - An invalid value of ``fastdds.max_message_size`` results in an exception. From 8e81d333e623cf16dff82c250bf239eefd7e8e8a Mon Sep 17 00:00:00 2001 From: elianalf <62831776+elianalf@users.noreply.github.com> Date: Fri, 17 May 2024 09:55:54 +0200 Subject: [PATCH 3/3] Refs #20849: Apply suggestions Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --- code/XMLTester.xml | 2 +- .../non_consolidated_qos.rst | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/code/XMLTester.xml b/code/XMLTester.xml index 9855496f4..cc8c3b8c6 100644 --- a/code/XMLTester.xml +++ b/code/XMLTester.xml @@ -3258,7 +3258,7 @@ - + fastdds.max_message_size 1200 diff --git a/docs/fastdds/property_policies/non_consolidated_qos.rst b/docs/fastdds/property_policies/non_consolidated_qos.rst index f6b958fc1..17d91f7bb 100644 --- a/docs/fastdds/property_policies/non_consolidated_qos.rst +++ b/docs/fastdds/property_policies/non_consolidated_qos.rst @@ -360,14 +360,15 @@ Maximum Message Size One common requirement is the differentiation between the maximum size of received and sent datagrams. This capability is especially important in scenarios where a system might need to handle large incoming data sizes but should restrict the size of the data it sends to prevent overwhelming network resources -or complying with network traffic policies. The primary attribute for controlling datagram size is -`maxMessageSize`, which sets the upper limit for both the size of datagrams that can be received and -those that can be sent. For applications that need to restrict the size of outgoing datagrams without -changing the size of incoming ones, it's possible to set the new property ``fastdds.max_message_size``. +or complying with network traffic policies. +The primary attribute for controlling datagram size is `maxMessageSize`, which sets the upper limit +for both the size of datagrams that can be received and those that can be sent. +Property ``fastdds.max_message_size`` allows restricting the size of outgoing datagrams without +changing the size of incoming ones. This property allows for the specific configuration of the maximum number of bytes for datagrams that -are sent. By configuring this property to a value lower than the smallest `maxMessageSize` across all -transports, applications can achieve a lower sending limit while maintaining the ability to receive -larger datagrams. +are sent. +By configuring this property to a value lower than the smallest `maxMessageSize` across all transports, +applications can achieve a lower sending limit while maintaining the ability to receive larger datagrams. .. list-table:: :header-rows: 1 @@ -384,6 +385,11 @@ larger datagrams. An invalid value of ``fastdds.max_message_size`` would log an error, and the default value will be used. +.. _setting_max_message_size_participant: + +Setting ``fastdds.max_message_size`` At Participant Level +""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + .. tabs:: .. tab:: C++ @@ -402,6 +408,11 @@ larger datagrams. :end-before: <--> :lines: 2,4-16 +.. _setting_max_message_size_writer: + +Setting ``fastdds.max_message_size`` At Writer Level +"""""""""""""""""""""""""""""""""""""""""""""""""""" + .. tabs:: .. tab:: C++