Skip to content

Commit

Permalink
Refs #21266: Add corrections
Browse files Browse the repository at this point in the history
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
  • Loading branch information
Carlosespicur committed Jul 8, 2024
1 parent fe4b235 commit 4d79da4
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 35 deletions.
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ add_subdirectory(cpp/custom_payload_pool)
add_subdirectory(cpp/dds)
add_subdirectory(cpp/delivery_mechanisms)
add_subdirectory(cpp/discovery_server)
add_subdirectory(cpp/dds_security)
add_subdirectory(cpp/security)
add_subdirectory(cpp/hello_world)
add_subdirectory(cpp/rtps)
add_subdirectory(cpp/xtypes)
3 changes: 1 addition & 2 deletions examples/cpp/discovery_server/ClientPublisherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
#include <fastdds/rtps/transport/UDPv4TransportDescriptor.hpp>
#include <fastdds/rtps/transport/UDPv6TransportDescriptor.hpp>

#include "DiscoveryServerPublisher.h"
#include "types/HelloWorldPubSubTypes.hpp"
#include "HelloWorldPubSubTypes.hpp"

using namespace eprosima::fastdds::dds;

Expand Down
3 changes: 1 addition & 2 deletions examples/cpp/discovery_server/ClientSubscriberApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
#include "CLIParser.hpp"
#include "Application.hpp"

#include "DiscoveryServerSubscriber.h"
#include "types/HelloWorldPubSubTypes.hpp"
#include "HelloWorldPubSubTypes.hpp"

using namespace eprosima::fastdds::dds;

Expand Down
5 changes: 0 additions & 5 deletions examples/cpp/discovery_server/ServerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
*
*/

<<<<<<< HEAD:examples/cpp/discovery_server/ServerApp.cpp
#include "ServerApp.hpp"
=======
>>>>>>> cb54401dd (Refs #21266: Update fastdds examples guards and namespaces):examples/cpp/dds/DiscoveryServerExample/DiscoveryServerServer.cpp

#include <condition_variable>
#include <stdexcept>
Expand All @@ -36,8 +33,6 @@
#include <fastdds/rtps/transport/UDPv4TransportDescriptor.hpp>
#include <fastdds/rtps/transport/UDPv6TransportDescriptor.hpp>

#include "DiscoveryServerServer.h"

using namespace eprosima::fastdds::dds;

namespace eprosima {
Expand Down
9 changes: 6 additions & 3 deletions examples/cpp/security/CLIParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@ class CLIParser
struct entity_config
{
uint16_t samples = 0;
uint32_t interval = 100; // milliseconds
};
struct publisher_config : entity_config
{
uint32_t interval = 1000;
};

//! Configuration structure for the application
struct security_config
{
CLIParser::EntityKind entity = CLIParser::EntityKind::UNDEFINED;
entity_config pub_config;
publisher_config pub_config;
entity_config sub_config;
};

Expand All @@ -68,7 +71,7 @@ class CLIParser
static void print_help(
uint8_t return_code)
{
std::cout << "Usage: security <entity> [options]" << std::endl;
std::cout << "Usage: security <entity> [options]" << std::endl;
std::cout << "" << std::endl;
std::cout << "Entities:" << std::endl;
std::cout << " publisher Run a publisher entity" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/security/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

cmake_minimum_required(VERSION 3.20)

project(fastdds_secure_hello_world_example VERSION 1 LANGUAGES CXX)
project(fastdds_security_example VERSION 1 LANGUAGES CXX)

# Find requirements
if(NOT fastcdr_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/security/PublisherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace examples {
namespace security {

PublisherApp::PublisherApp(
const CLIParser::entity_config& config,
const CLIParser::publisher_config& config,
const std::string& topic_name)
: participant_(nullptr)
, publisher_(nullptr)
Expand Down
8 changes: 4 additions & 4 deletions examples/cpp/security/PublisherApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*
*/

#ifndef FASTDDS_EXAMPLES_CPP_SECURITY__HELLO_WORLD_PUBLISHER_APP_HPP
#define FASTDDS_EXAMPLES_CPP_SECURITY__HELLO_WORLD_PUBLISHER_APP_HPP
#ifndef FASTDDS_EXAMPLES_CPP_SECURITY__PUBLISHER_APP_HPP
#define FASTDDS_EXAMPLES_CPP_SECURITY__PUBLISHER_APP_HPP

#include <condition_variable>

Expand All @@ -42,7 +42,7 @@ class PublisherApp : public Application, public DataWriterListener
public:

PublisherApp(
const CLIParser::entity_config& config,
const CLIParser::publisher_config& config,
const std::string& topic_name);

~PublisherApp();
Expand Down Expand Up @@ -97,4 +97,4 @@ class PublisherApp : public Application, public DataWriterListener
} // namespace fastdds
} // namespace eprosima

#endif /* FASTDDS_EXAMPLES_CPP_SECURITY__HELLO_WORLD_PUBLISHER_APP_HPP */
#endif /* FASTDDS_EXAMPLES_CPP_SECURITY__PUBLISHER_APP_HPP */
7 changes: 3 additions & 4 deletions examples/cpp/security/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Secure Hello world example
# Security example

The *eProsima Fast DDS hello world* example is a simple application intended to demonstrate a basic DDS deployment with security builtin plugins.
The *eProsima Fast DDS security* example is a simple application intended to demonstrate a basic DDS deployment with security builtin plugins.

This example is part of the suite of examples designed by eProsima that aims to illustrate the features and possible configurations of DDS deployments through *eProsima Fast DDS*.

In this case, the *secure hello world* example describes the simplest deployment of a Fast DDS publisher and subscriber using the DDS Security specification.
In this case, the *security* example describes the simplest deployment of a Fast DDS publisher and subscriber using the DDS Security specification.

* [Description of the example](#description-of-the-example)
* [Run the example](#run-the-example)
* [Wait-set subscriber](#wait-set-subscriber)
* [XML profile playground](#xml-profile-playground)

## Description of the example
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/security/SubscriberApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

/**
* @file ListenerSubscriber.cpp
* @file SubscriberApp.cpp
*
*/

Expand Down
6 changes: 3 additions & 3 deletions examples/cpp/security/SubscriberApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*
*/

#ifndef FASTDDS_EXAMPLES_CPP_SECURITY__HELLO_WORLD_SUBSCRIBER_APP_HPP
#define FASTDDS_EXAMPLES_CPP_SECURITY__HELLO_WORLD_SUBSCRIBER_APP_HPP
#ifndef FASTDDS_EXAMPLES_CPP_SECURITY__SUBSCRIBER_APP_HPP
#define FASTDDS_EXAMPLES_CPP_SECURITY__SUBSCRIBER_APP_HPP

#include <condition_variable>

Expand Down Expand Up @@ -95,4 +95,4 @@ class SubscriberApp : public Application, public DataReaderListener
} // namespace fastdds
} // namespace eprosima

#endif /* FASTDDS_EXAMPLES_CPP_SECURITY__HELLO_WORLD_SUBSCRIBER_APP_HPP */
#endif /* FASTDDS_EXAMPLES_CPP_SECURITY__SUBSCRIBER_APP_HPP */
14 changes: 7 additions & 7 deletions examples/cpp/security/hello_world_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
<!-- Configure DDS:Auth:PKI-DH plugin -->
<property>
<name>dds.sec.auth.builtin.PKI-DH.identity_ca</name>
<value>file://maincacert.pem</value>
<value>file://certs/maincacert.pem</value>
</property>
<property>
<name>dds.sec.auth.builtin.PKI-DH.identity_certificate</name>
<value>file://partcert.pem</value>
<value>file://certs/partcert.pem</value>
</property>
<property>
<name>dds.sec.auth.builtin.PKI-DH.identity_crl</name>
<value>file://crl.pem</value>
<value>file://certs/crl.pem</value>
</property>
<property>
<name>dds.sec.auth.builtin.PKI-DH.private_key</name>
<value>file://partkey.pem</value>
<value>file://certs/partkey.pem</value>
</property>
<property>
<name>dds.sec.auth.builtin.PKI-DH.password</name>
Expand All @@ -45,15 +45,15 @@
<!-- Configure DDS:Access:Permissions plugin -->
<property>
<name>dds.sec.access.builtin.Access-Permissions.permissions_ca</name>
<value>file://maincacet.pem</value>
<value>file://certs/maincacet.pem</value>
</property>
<property>
<name>dds.sec.access.builtin.Access-Permissions.governance</name>
<value>file://governance.smime</value>
<value>file://certs/governance.smime</value>
</property>
<property>
<name>dds.sec.access.builtin.Access-Permissions.permissions</name>
<value>file://permissions.smime</value>
<value>file://certs/permissions.smime</value>
</property>
</properties>

Expand Down
13 changes: 13 additions & 0 deletions test/examples/security.compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
version: "3"

services:
subscriber:
image: @DOCKER_IMAGE_NAME@
volumes:
- @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@
- @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@
@TINYXML2_LIB_DIR_COMPOSE_VOLUME@
environment:
# TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@
EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/security
FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/security/hello_world_profile.xml
command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/security@FILE_EXTENSION@ subscriber --samples 10"

subscriber-publisher:
image: @DOCKER_IMAGE_NAME@
volumes:
Expand Down
2 changes: 1 addition & 1 deletion versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Forthcoming
* Calling `DataReader::return_loan` returns `ReturnCode_t::RETCODE_OK` both for empty sequences and for sequences that were not loaned.
* Refactor examples:
* Hello world example with wait-sets and environment XML profiles.
* Secured hello world example with environment XML profiles.
* Security example with environment XML profiles.
* Configuration example that condenses multiple QoS examples. Multiple configurations allowed through argument parsing.
* Custom payload pool example that uses a user-defined payload pool instead of the default
* X-Types example with dynamic type discovery and Hello world example compatibility.
Expand Down

0 comments on commit 4d79da4

Please sign in to comment.