Skip to content

Commit

Permalink
Refs #22056: Add PID_HOST_ID to ParameterTypes.hpp
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Nov 5, 2024
1 parent 03bfe8d commit 9f6862f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
1 change: 1 addition & 0 deletions include/fastdds/dds/core/policy/ParameterTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ enum ParameterId_t : uint16_t
/* eProsima Fast DDS extensions */
PID_PRODUCT_VERSION = 0x8000,
PID_PERSISTENCE_GUID = 0x8002,
PID_HOST_ID = 0x8003,
PID_DISABLE_POSITIVE_ACKS = 0x8005,
PID_DATASHARING = 0x8006,
PID_NETWORK_CONFIGURATION_SET = 0x8007,
Expand Down
3 changes: 0 additions & 3 deletions src/cpp/fastdds/core/policy/ParameterList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ namespace eprosima {
namespace fastdds {
namespace dds {

// TODO (Carlos): Move to ParameterTypes.hpp
constexpr ParameterId_t PID_HOST_ID = static_cast<ParameterId_t>(0x8003);

/**
* ParameterList class has static methods to update or read a list of Parameter_t
* @ingroup PARAMETER_MODULE
Expand Down
43 changes: 22 additions & 21 deletions src/cpp/rtps/builtin/data/ParticipantProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,28 @@ bool ParticipantProxyData::readFromCDRMessage(
m_networkConfiguration = p.netconfigSet;
break;
}
case fastdds::dds::PID_HOST_ID:
{
// Ignore custom PID when coming from other vendors
if (c_VendorId_eProsima != m_VendorId)
{
EPROSIMA_LOG_INFO(
RTPS_PROXY_DATA,
"Ignoring custom PID" << pid << " from vendor " << source_vendor_id);
return true;
}

ParameterString_t p(pid, plength);
if (!fastdds::dds::ParameterSerializer<ParameterString_t>::read_from_cdr_message(
p, msg,
plength))
{
return false;
}

m_host_id = p.getName();
break;
}
case fastdds::dds::PID_METATRAFFIC_MULTICAST_LOCATOR:
{
ParameterLocator_t p(pid, plength);
Expand Down Expand Up @@ -849,27 +871,6 @@ bool ParticipantProxyData::readFromCDRMessage(
}
default:
{
if (pid == fastdds::dds::PID_HOST_ID)
{
// Ignore custom PID when coming from other vendors
if (c_VendorId_eProsima != m_VendorId)
{
EPROSIMA_LOG_INFO(
RTPS_PROXY_DATA,
"Ignoring custom PID" << pid << " from vendor " << source_vendor_id);
return true;
}

ParameterString_t p(pid, plength);
if (!fastdds::dds::ParameterSerializer<ParameterString_t>::read_from_cdr_message(
p, msg,
plength))
{
return false;
}

m_host_id = p.getName();
}
break;
}
}
Expand Down
53 changes: 27 additions & 26 deletions src/cpp/rtps/builtin/data/ReaderProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,33 @@ bool ReaderProxyData::readFromCDRMessage(
m_networkConfiguration = p.netconfigSet;
break;
}
case fastdds::dds::PID_HOST_ID:
{
VendorId_t local_vendor_id = source_vendor_id;
if (c_VendorId_Unknown == local_vendor_id)
{
local_vendor_id = ((c_VendorId_Unknown == vendor_id) ? c_VendorId_eProsima : vendor_id);
}

// Ignore custom PID when coming from other vendors
if (c_VendorId_eProsima != local_vendor_id)
{
EPROSIMA_LOG_INFO(RTPS_PROXY_DATA,
"Ignoring custom PID" << pid << " from vendor " << local_vendor_id);
return true;
}

ParameterString_t p(pid, plength);
if (!fastdds::dds::ParameterSerializer<ParameterString_t>::read_from_cdr_message(
p, msg,
plength))
{
return false;
}

m_host_id = p.getName();
break;
}
case fastdds::dds::PID_UNICAST_LOCATOR:
{
ParameterLocator_t p(pid, plength);
Expand Down Expand Up @@ -1121,32 +1148,6 @@ bool ReaderProxyData::readFromCDRMessage(

default:
{
if (pid == fastdds::dds::PID_HOST_ID)
{
VendorId_t local_vendor_id = source_vendor_id;
if (c_VendorId_Unknown == local_vendor_id)
{
local_vendor_id = ((c_VendorId_Unknown == vendor_id) ? c_VendorId_eProsima : vendor_id);
}

// Ignore custom PID when coming from other vendors
if (c_VendorId_eProsima != local_vendor_id)
{
EPROSIMA_LOG_INFO(RTPS_PROXY_DATA,
"Ignoring custom PID" << pid << " from vendor " << local_vendor_id);
return true;
}

ParameterString_t p(pid, plength);
if (!fastdds::dds::ParameterSerializer<ParameterString_t>::read_from_cdr_message(
p, msg,
plength))
{
return false;
}

m_host_id = p.getName();
}
break;
}
}
Expand Down

0 comments on commit 9f6862f

Please sign in to comment.