Skip to content

Commit 50fea53

Browse files
committed
Refs #22469: Allow to copyIPv4 between two locators
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
1 parent f6057bc commit 50fea53

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

include/fastdds/utils/IPLocator.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ class IPLocator
102102
const Locator_t& locator,
103103
unsigned char* dest);
104104

105+
//! Copies locator's IPv4.
106+
FASTDDS_EXPORTED_API static bool copyIPv4(
107+
const Locator_t& locator,
108+
Locator_t& dest);
109+
105110
// IPv6
106111
//! Sets locator's IPv6.
107112
FASTDDS_EXPORTED_API static bool setIPv6(

src/cpp/utils/IPLocator.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ bool IPLocator::copyIPv4(
202202
return true;
203203
}
204204

205+
bool IPLocator::copyIPv4(
206+
const Locator_t& locator,
207+
Locator_t& dest)
208+
{
209+
copyIPv4(locator, &(dest.address[12]));
210+
return true;
211+
}
212+
205213
// IPv6
206214
bool IPLocator::setIPv6(
207215
Locator_t& locator,
@@ -996,7 +1004,7 @@ bool IPLocator::copy_address(
9961004

9971005
if (loc1.kind == LOCATOR_KIND_UDPv4 || loc1.kind == LOCATOR_KIND_TCPv4)
9981006
{
999-
copyIPv4(loc1, loc2.address);
1007+
copyIPv4(loc1, loc2);
10001008
return true;
10011009
}
10021010
else if (loc1.kind == LOCATOR_KIND_UDPv6 || loc1.kind == LOCATOR_KIND_TCPv6)

0 commit comments

Comments
 (0)