Skip to content

Commit 1d026ce

Browse files
committed
Refs #21711: RTPSParticipant get_subscription/publication_info() implementation
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
1 parent 9a8179f commit 1d026ce

3 files changed

Lines changed: 67 additions & 6 deletions

File tree

src/cpp/rtps/participant/RTPSParticipant.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,17 @@ std::vector<fastdds::rtps::TransportNetmaskFilterInfo> RTPSParticipant::get_netm
202202
}
203203

204204
bool RTPSParticipant::get_publication_info(
205-
fastdds::dds::builtin::PublicationBuiltinTopicData&,
206-
const GUID_t&) const
205+
fastdds::dds::builtin::PublicationBuiltinTopicData& data,
206+
const GUID_t& writer_guid) const
207207
{
208-
return false;
208+
return mp_impl->get_publication_info(data, writer_guid);
209209
}
210210

211211
bool RTPSParticipant::get_subscription_info(
212-
fastdds::dds::builtin::SubscriptionBuiltinTopicData&,
213-
const GUID_t&) const
212+
fastdds::dds::builtin::SubscriptionBuiltinTopicData& data,
213+
const GUID_t& reader_guid) const
214214
{
215-
return false;
215+
return mp_impl->get_subscription_info(data, reader_guid);
216216
}
217217

218218
#if HAVE_SECURITY

src/cpp/rtps/participant/RTPSParticipantImpl.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include <fastrtps/utils/Semaphore.h>
5959
#include <fastrtps/xmlparser/XMLProfileManager.h>
6060

61+
#include <rtps/builtin/data/ProxyDataConverters.hpp>
6162
#include <rtps/builtin/discovery/participant/PDPClient.h>
6263
#include <rtps/builtin/discovery/participant/PDPServer.hpp>
6364
#include <rtps/history/BasicPayloadPool.hpp>
@@ -2939,6 +2940,40 @@ std::vector<fastdds::rtps::TransportNetmaskFilterInfo> RTPSParticipantImpl::get_
29392940
return m_network_Factory.netmask_filter_info();
29402941
}
29412942

2943+
bool RTPSParticipantImpl::get_publication_info(
2944+
fastdds::dds::builtin::PublicationBuiltinTopicData& data,
2945+
const GUID_t& writer_guid) const
2946+
{
2947+
bool ret = false;
2948+
WriterProxyData wproxy_data(m_att.allocation.locators.max_unicast_locators,
2949+
m_att.allocation.locators.max_multicast_locators);
2950+
2951+
if (mp_builtinProtocols->mp_PDP->lookupWriterProxyData(writer_guid, wproxy_data))
2952+
{
2953+
from_proxy_to_builtin(wproxy_data, data);
2954+
ret = true;
2955+
}
2956+
2957+
return ret;
2958+
}
2959+
2960+
bool RTPSParticipantImpl::get_subscription_info(
2961+
fastdds::dds::builtin::SubscriptionBuiltinTopicData& data,
2962+
const GUID_t& reader_guid) const
2963+
{
2964+
bool ret = false;
2965+
ReaderProxyData rproxy_data(m_att.allocation.locators.max_unicast_locators,
2966+
m_att.allocation.locators.max_multicast_locators);
2967+
2968+
if (mp_builtinProtocols->mp_PDP->lookupReaderProxyData(reader_guid, rproxy_data))
2969+
{
2970+
from_proxy_to_builtin(rproxy_data, data);
2971+
ret = true;
2972+
}
2973+
2974+
return ret;
2975+
}
2976+
29422977
#ifdef FASTDDS_STATISTICS
29432978

29442979
bool RTPSParticipantImpl::register_in_writer(

src/cpp/rtps/participant/RTPSParticipantImpl.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ namespace dds {
9191
namespace builtin {
9292

9393
class TypeLookupManager;
94+
struct PublicationBuiltinTopicData;
95+
struct SubscriptionBuiltinTopicData;
9496

9597
} // namespace builtin
9698
} // namespace dds
@@ -1128,6 +1130,30 @@ class RTPSParticipantImpl
11281130
*/
11291131
std::vector<fastdds::rtps::TransportNetmaskFilterInfo> get_netmask_filter_info() const;
11301132

1133+
/**
1134+
* @brief Fills the provided PublicationBuiltinTopicData with the information of the
1135+
* writer identified by writer_guid.
1136+
*
1137+
* @param[out] data PublicationBuiltinTopicData to fill.
1138+
* @param[in] writer_guid GUID of the writer to get the information from.
1139+
* @return True if the writer was found and the data was filled.
1140+
*/
1141+
bool get_publication_info(
1142+
fastdds::dds::builtin::PublicationBuiltinTopicData& data,
1143+
const GUID_t& writer_guid) const;
1144+
1145+
/**
1146+
* @brief Fills the provided SubscriptionBuiltinTopicData with the information of the
1147+
* reader identified by reader_guid.
1148+
*
1149+
* @param[out] data SubscriptionBuiltinTopicData to fill.
1150+
* @param[in] reader_guid GUID of the reader to get the information from.
1151+
* @return True if the reader was found and the data was filled.
1152+
*/
1153+
bool get_subscription_info(
1154+
fastdds::dds::builtin::SubscriptionBuiltinTopicData& data,
1155+
const GUID_t& reader_guid) const;
1156+
11311157
template <EndpointKind_t kind, octet no_key, octet with_key>
11321158
static bool preprocess_endpoint_attributes(
11331159
const EntityId_t& entity_id,

0 commit comments

Comments
 (0)