diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp index 0697bfcf823..5e066bc9fdc 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp @@ -37,19 +37,18 @@ #include #include -#include -#include #include #include #include #include +#include #include #include #include #include #include +#include #include -#include #include #include @@ -57,31 +56,6 @@ namespace eprosima { namespace fastdds { namespace rtps { -static void direct_send( - RTPSParticipantImpl* participant, - LocatorList& locators, - std::vector& remote_readers, - CacheChange_t& change, - fastdds::rtps::Endpoint& sender_endpt) -{ - DirectMessageSender sender(participant, &remote_readers, &locators); - RTPSMessageGroup group(participant, &sender_endpt, &sender); - if (!group.add_data(change, false)) - { - EPROSIMA_LOG_ERROR(RTPS_PDP, "Error sending announcement from client to servers"); - } -} - -static void direct_send( - RTPSParticipantImpl* participant, - LocatorList& locators, - CacheChange_t& change) -{ - FakeWriter writer(participant, c_EntityId_SPDPWriter); - std::vector remote_readers; - direct_send(participant, locators, remote_readers, change, writer); -} - PDPClient::PDPClient( BuiltinProtocols* builtin, const RTPSParticipantAllocationAttributes& allocation, diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp index 2177ab6da57..426936a9b45 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -30,7 +31,6 @@ #include #include -#include #include #include #include diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp index daa4ac39a09..d5c27b9a3cc 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp @@ -16,10 +16,12 @@ * @file PDPSimple.cpp * */ + #include #include +#include #include #include #include @@ -28,9 +30,8 @@ #include #include #include - -#include #include + #include #include #include @@ -46,6 +47,7 @@ #include #include #include +#include namespace eprosima { namespace fastdds { diff --git a/src/cpp/utils/DirectSend.hpp b/src/cpp/utils/DirectSend.hpp new file mode 100644 index 00000000000..fad0c23bb9e --- /dev/null +++ b/src/cpp/utils/DirectSend.hpp @@ -0,0 +1,66 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef UTILS__DIRECTSEND_HPP +#define UTILS__DIRECTSEND_HPP + +#include +#include +#include + +#include +#include +#include + + +namespace eprosima { +namespace fastdds { +namespace rtps { + +class Endpoint; +class RTPSParticipantImpl; +struct CacheChange_t; + + +inline void direct_send( + RTPSParticipantImpl* participant, + LocatorList& locators, + std::vector& remote_readers, + CacheChange_t& change, + fastdds::rtps::Endpoint& sender_endpt) +{ + DirectMessageSender sender(participant, &remote_readers, &locators); + RTPSMessageGroup group(participant, &sender_endpt, &sender); + if (!group.add_data(change, false)) + { + EPROSIMA_LOG_ERROR(RTPS_PDP, "Error sending announcement from client to servers"); + } +} + +inline void direct_send( + RTPSParticipantImpl* participant, + LocatorList& locators, + CacheChange_t& change) +{ + FakeWriter writer(participant, c_EntityId_SPDPWriter); + std::vector remote_readers; + direct_send(participant, locators, remote_readers, change, writer); +} + +} // namespace rtps +} // namespace fastdds +} // namespace eprosima + +#endif // UTILS__DIRECTSEND_HPP \ No newline at end of file