Skip to content

Commit

Permalink
Add customizable transport: ignore participant flags, non-builtin des…
Browse files Browse the repository at this point in the history
…criptors and interface whitelist (#41)

* Add customizable transport: ignore participant flags, non-builtin descriptors and interface whitelist

Signed-off-by: Juan López Fernández <[email protected]>

* Update documentation

Signed-off-by: Juan López Fernández <[email protected]>

---------

Signed-off-by: Juan López Fernández <[email protected]>
  • Loading branch information
juanlofer-eprosima authored Jun 19, 2023
1 parent 1a39208 commit b70d146
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 3 deletions.
6 changes: 6 additions & 0 deletions docs/rst/notes/forthcoming_version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@
###################
Forthcoming Version
###################

Next release will include the following **Configuration features**:

* Support :ref:`Interface Whitelisting <user_manual_configuration_dds__interface_whitelist>`.
* Support :ref:`Custom Transport Descriptors <user_manual_configuration_dds_custom_transport_descriptors>` (UDP or Shared Memory only).
* Support :ref:`Ignore Participant Flags <user_manual_configuration_dds_ignore_participant_flags>`.
5 changes: 2 additions & 3 deletions docs/rst/notes/notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
Notes
#####

..
TODO uncomment when there are forthcoming notes
.. include:: forthcoming_version.rst
.. TODO uncomment when there are forthcoming notes
.. include:: forthcoming_version.rst

Version v0.1.0
==============
Expand Down
65 changes: 65 additions & 0 deletions docs/rst/user_manual/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,71 @@ DDS Domain Id

In order to execute a |spy| instance in a :term:`Domain Id` different than the default (``0``) use tag ``domain``.

.. _user_manual_configuration_dds_ignore_participant_flags:

Ignore Participant Flags
------------------------

A set of discovery traffic filters can be defined in order to add an extra level of isolation.
This configuration option can be set through the ``ignore-participant-flags`` tag:

.. code-block:: yaml
ignore-participant-flags: no_filter # No filter (default)
# or
ignore-participant-flags: filter_different_host # Discovery traffic from another host is discarded
# or
ignore-participant-flags: filter_different_process # Discovery traffic from another process on same host is discarded
# or
ignore-participant-flags: filter_same_process # Discovery traffic from own process is discarded
# or
ignore-participant-flags: filter_different_and_same_process # Discovery traffic from own host is discarded
See `Ignore Participant Flags <https://fast-dds.docs.eprosima.com/en/latest/fastdds/discovery/general_disc_settings.html?highlight=ignore%20flags#ignore-participant-flags>`_ for more information.


.. _user_manual_configuration_dds_custom_transport_descriptors:

Custom Transport Descriptors
----------------------------

By default, |spy| internal participants are created with enabled `UDP <https://fast-dds.docs.eprosima.com/en/latest/fastdds/transport/udp/udp.html>`_ and `Shared Memory <https://fast-dds.docs.eprosima.com/en/latest/fastdds/transport/shared_memory/shared_memory.html>`_ transport descriptors.
The use of one or the other for communication will depend on the specific scenario, and whenever both are viable candidates, the most efficient one (Shared Memory Transport) is automatically selected.
However, a user may desire to force the use of one of the two, which can be accomplished via the ``transport`` configuration tag.

.. code-block:: yaml
transport: builtin # UDP & SHM (default)
# or
transport: udp # UDP only
# or
transport: shm # SHM only
.. warning::

When configured with ``transport: shm``, |spy| will only communicate with applications using Shared Memory Transport exclusively (with disabled UDP transport).


.. _user_manual_configuration_dds__interface_whitelist:

Interface Whitelist
-------------------

Optional tag ``whitelist-interfaces`` allows to limit the network interfaces used by UDP and TCP transport.
This may be useful to only allow communication within the host (note: same can be done with :ref:`user_manual_configuration_dds_ignore_participant_flags`).
Example:

.. code-block:: yaml
whitelist-interfaces:
- "127.0.0.1" # Localhost only
See `Interface Whitelist <https://fast-dds.docs.eprosima.com/en/latest/fastdds/transport/whitelist.html>`_ for more information.

.. warning::

When providing an interface whitelist, external participants with which communication is desired must also be configured with interface whitelisting.

Topic Filtering
---------------

Expand Down
34 changes: 34 additions & 0 deletions fastddsspy_yaml/src/cpp/YamlReaderConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <ddspipe_core/types/topic/dds/DdsTopic.hpp>
#include <ddspipe_core/types/topic/filter/IFilterTopic.hpp>
#include <ddspipe_core/types/topic/filter/WildcardDdsFilterTopic.hpp>
#include <ddspipe_participants/types/address/Address.hpp>

#include <ddspipe_yaml/yaml_configuration_tags.hpp>
#include <ddspipe_yaml/Yaml.hpp>
Expand All @@ -34,6 +35,7 @@ namespace yaml {
using namespace eprosima::ddspipe::core;
using namespace eprosima::ddspipe::core::types;
using namespace eprosima::ddspipe::participants;
using namespace eprosima::ddspipe::participants::types;
using namespace eprosima::ddspipe::yaml;

Configuration::Configuration()
Expand Down Expand Up @@ -147,6 +149,38 @@ void Configuration::load_dds_configuration_(
{
simple_configuration->domain = YamlReader::get<DomainId>(yml, DOMAIN_ID_TAG, version);
}

/////
// Get optional whitelist interfaces
if (YamlReader::is_tag_present(yml, WHITELIST_INTERFACES_TAG))
{
simple_configuration->whitelist = YamlReader::get_set<IpType>(yml, WHITELIST_INTERFACES_TAG,
version);
}

// Optional get Transport protocol
if (YamlReader::is_tag_present(yml, TRANSPORT_DESCRIPTORS_TRANSPORT_TAG))
{
simple_configuration->transport = YamlReader::get<TransportDescriptors>(yml,
TRANSPORT_DESCRIPTORS_TRANSPORT_TAG,
version);
}
else
{
simple_configuration->transport = TransportDescriptors::builtin;
}

// Optional get ignore participant flags
if (YamlReader::is_tag_present(yml, IGNORE_PARTICIPANT_FLAGS_TAG))
{
simple_configuration->ignore_participant_flags = YamlReader::get<IgnoreParticipantFlags>(yml,
IGNORE_PARTICIPANT_FLAGS_TAG,
version);
}
else
{
simple_configuration->ignore_participant_flags = IgnoreParticipantFlags::no_filter;
}
}

void Configuration::load_specs_configuration_(
Expand Down

0 comments on commit b70d146

Please sign in to comment.