Skip to content

Commit

Permalink
Refs #20508: Solve conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Jesus Perez <[email protected]>
  • Loading branch information
jepemi authored and JesusPoderoso committed Mar 23, 2024
1 parent a01c1a2 commit b8d7702
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions test/unittest/transport/TCPv6Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,88 @@ TEST_F(TCPv6Tests, add_logical_port_on_send_resource_creation)
}
}

/*
TEST_F(TCPv6Tests, send_and_receive_between_both_secure_ports)
{
eprosima::fastdds::dds::Log::SetVerbosity(eprosima::fastdds::dds::Log::Kind::Info);
using TLSOptions = TCPTransportDescriptor::TLSConfig::TLSOptions;
using TLSVerifyMode = TCPTransportDescriptor::TLSConfig::TLSVerifyMode;
TCPv6TransportDescriptor recvDescriptor;
recvDescriptor.add_listener_port(g_default_port);
recvDescriptor.apply_security = true;
recvDescriptor.tls_config.password = "testkey";
recvDescriptor.tls_config.cert_chain_file = "mainpubcert.pem";
recvDescriptor.tls_config.private_key_file = "mainpubkey.pem";
recvDescriptor.tls_config.verify_file = "maincacert.pem";
// Server doesn't accept clients without certs
recvDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER | TLSVerifyMode::VERIFY_FAIL_IF_NO_PEER_CERT;
recvDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS);
recvDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE);
recvDescriptor.tls_config.add_option(TLSOptions::NO_COMPRESSION);
recvDescriptor.tls_config.add_option(TLSOptions::NO_SSLV2);
recvDescriptor.tls_config.add_option(TLSOptions::NO_SSLV3);
TCPv6Transport receiveTransportUnderTest(recvDescriptor);
receiveTransportUnderTest.init();
TCPv6TransportDescriptor sendDescriptor;
sendDescriptor.apply_security = true;
sendDescriptor.tls_config.password = "testkey";
sendDescriptor.tls_config.cert_chain_file = "mainsubcert.pem";
sendDescriptor.tls_config.private_key_file = "mainsubkey.pem";
sendDescriptor.tls_config.verify_file = "maincacert.pem";
sendDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER;
sendDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS);
sendDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE);
sendDescriptor.tls_config.add_option(TLSOptions::NO_COMPRESSION);
sendDescriptor.tls_config.add_option(TLSOptions::NO_SSLV2);
sendDescriptor.tls_config.add_option(TLSOptions::NO_SSLV3);
TCPv6Transport sendTransportUnderTest(sendDescriptor);
sendTransportUnderTest.init();
Locator_t inputLocator;
inputLocator.kind = LOCATOR_KIND_TCPv6;
inputLocator.port = g_default_port;
IPLocator::setIPv4(inputLocator, "::1");
IPLocator::setLogicalPort(inputLocator, 7410);
Locator_t outputLocator;
outputLocator.kind = LOCATOR_KIND_TCPv6;
IPLocator::setIPv4(outputLocator, "::1");
outputLocator.port = g_default_port;
IPLocator::setLogicalPort(outputLocator, 7410);
{
MockReceiverResource receiver(receiveTransportUnderTest, inputLocator);
MockMessageReceiver *msg_recv = dynamic_cast<MockMessageReceiver*>(receiver.CreateMessageReceiver());
ASSERT_TRUE(receiveTransportUnderTest.IsInputChannelOpen(inputLocator));
ASSERT_TRUE(sendTransportUnderTest.OpenOutputChannel(outputLocator));
octet message[5] = { 'H','e','l','l','o' };
Semaphore sem;
std::function<void()> recCallback = [&]()
{
EXPECT_EQ(memcmp(message, msg_recv->data, 5), 0);
sem.post();
};
};
msg_recv->setCallback(recCallback);
auto sendThreadFunction = [&]()
{
EXPECT_TRUE(transportUnderTest.send(message, 5, outputChannelLocator, multicastLocator));
};
senderThread.reset(new std::thread(sendThreadFunction));
std::this_thread::sleep_for(std::chrono::milliseconds(1));
senderThread->join();
sem.wait();
ASSERT_TRUE(transportUnderTest.CloseOutputChannel(outputChannelLocator));
}
*/
#endif // ifndef __APPLE__

void TCPv6Tests::HELPER_SetDescriptorDefaults()
Expand Down

0 comments on commit b8d7702

Please sign in to comment.