Class PDP
Defined in File PDP.h
Inheritance Relationships
Base Type
public eprosima::fastdds::statistics::rtps::IProxyQueryable
(Struct IProxyQueryable)
Derived Type
public eprosima::fastrtps::rtps::PDPSimple
(Class PDPSimple)
Class Documentation
-
class PDP : public eprosima::fastdds::statistics::rtps::IProxyQueryable
Abstract class PDP that implements the basic interfaces for all Participant Discovery implementations It also keeps the Participant Discovery Data and provides interfaces to access it
Subclassed by eprosima::fastrtps::rtps::PDPSimple
Public Functions
-
PDP(BuiltinProtocols *builtin, const RTPSParticipantAllocationAttributes &allocation)
Constructor
- Parameters:
builtin – Pointer to the BuiltinProtocols object.
allocation – Participant allocation parameters.
-
virtual ~PDP()
-
virtual void initializeParticipantProxyData(ParticipantProxyData *participant_data)
-
bool initPDP(RTPSParticipantImpl *part)
Initialize the PDP.
- Parameters:
part – Pointer to the RTPSParticipant.
- Returns:
True on success
-
bool enable()
Enable the Participant Discovery Protocol.
- Returns:
true if enabled correctly, or if already enabled; false otherwise
-
virtual bool init(RTPSParticipantImpl *part) = 0
-
virtual ParticipantProxyData *createParticipantProxyData(const ParticipantProxyData &p, const GUID_t &writer_guid) = 0
Creates an initializes a new participant proxy from a DATA(p) raw info
- Parameters:
p – from DATA msg deserialization
writer_guid – GUID of originating writer
- Returns:
new ParticipantProxyData * or nullptr on failure
-
virtual void announceParticipantState(bool new_change, bool dispose, WriteParams &wparams) = 0
Force the sending of our local DPD to all remote RTPSParticipants and multicast Locators.
- Parameters:
new_change – If true a new change (with new seqNum) is created and sent;If false the last change is re-sent
dispose – sets change kind to NOT_ALIVE_DISPOSED_UNREGISTERED
wparams – allows to identify the change
-
virtual void announceParticipantState(bool new_change, bool dispose = false)
announceParticipantState
method without optional output parameterwparams
.
-
virtual void stopParticipantAnnouncement()
Stop the RTPSParticipantAnnouncement (only used in tests).
-
virtual void resetParticipantAnnouncement()
Reset the RTPSParticipantAnnouncement (only used in tests).
-
ReaderProxyData *addReaderProxyData(const GUID_t &reader_guid, GUID_t &participant_guid, std::function<bool(ReaderProxyData*, bool, const ParticipantProxyData&)> initializer_func)
Add a ReaderProxyData to the correct ParticipantProxyData.
- Parameters:
reader_guid – [in] GUID of the reader to add.
participant_guid – [out] GUID of the ParticipantProxyData where the reader was added.
initializer_func – [in] Function to be called in order to set the data of the ReaderProxyData.
- Returns:
A pointer to the added ReaderProxyData (nullptr if it could not be added).
-
WriterProxyData *addWriterProxyData(const GUID_t &writer_guid, GUID_t &participant_guid, std::function<bool(WriterProxyData*, bool, const ParticipantProxyData&)> initializer_func)
Add a WriterProxyData to the correct ParticipantProxyData.
- Parameters:
writer_guid – [in] GUID of the writer to add.
participant_guid – [out] GUID of the ParticipantProxyData where the writer was added.
initializer_func – [in] Function to be called in order to set the data of the WriterProxyData.
- Returns:
A pointer to the added WriterProxyData (nullptr if it could not be added).
-
bool has_reader_proxy_data(const GUID_t &reader)
This method returns whether a ReaderProxyDataObject exists among the registered RTPSParticipants (including the local RTPSParticipant).
- Parameters:
reader – [in] GUID_t of the reader we are looking for.
- Returns:
True if found.
-
bool lookupReaderProxyData(const GUID_t &reader, ReaderProxyData &rdata)
This method gets a copy of a ReaderProxyData object if it is found among the registered RTPSParticipants (including the local RTPSParticipant).
- Parameters:
reader – [in] GUID_t of the reader we are looking for.
rdata – [out] Reference to the ReaderProxyData object where data is to be returned.
- Returns:
True if found.
-
bool has_writer_proxy_data(const GUID_t &writer)
This method returns whether a WriterProxyData exists among the registered RTPSParticipants (including the local RTPSParticipant).
- Parameters:
writer – [in] GUID_t of the writer we are looking for.
- Returns:
True if found.
-
bool lookupWriterProxyData(const GUID_t &writer, WriterProxyData &wdata)
This method gets a copy of a WriterProxyData object if it is found among the registered RTPSParticipants (including the local RTPSParticipant).
- Parameters:
writer – [in] GUID_t of the writer we are looking for.
wdata – [out] Reference to the WriterProxyData object where data is to be returned.
- Returns:
True if found.
-
bool lookup_participant_name(const GUID_t &guid, string_255 &name)
This method returns the name of a participant if it is found among the registered RTPSParticipants.
- Parameters:
guid – [in] GUID_t of the RTPSParticipant we are looking for.
name – [out] Copy of name on ParticipantProxyData object.
- Returns:
True if found.
-
bool removeReaderProxyData(const GUID_t &reader_guid)
This method removes and deletes a ReaderProxyData object from its corresponding RTPSParticipant.
- Parameters:
reader_guid – [in] GUID_t of the reader to remove.
- Returns:
true if found and deleted.
-
bool removeReaderProxyData(const GUID_t &reader_guid, ReaderDiscoveryInfo::DISCOVERY_STATUS reason)
This method removes and deletes a ReaderProxyData object from its corresponding RTPSParticipant.
- Parameters:
reader_guid – [in] GUID_t of the reader to remove.
reason – [in] Why the reader is being removed (dropped, removed, or ignored)
- Returns:
true if found and deleted.
-
bool removeWriterProxyData(const GUID_t &writer_guid)
This method removes and deletes a WriterProxyData object from its corresponding RTPSParticipant.
- Parameters:
writer_guid – [in] GUID_t of the writer to remove.
- Returns:
true if found and deleted.
-
bool removeWriterProxyData(const GUID_t &writer_guid, WriterDiscoveryInfo::DISCOVERY_STATUS reason)
This method removes and deletes a WriterProxyData object from its corresponding RTPSParticipant.
- Parameters:
writer_guid – [in] GUID_t of the writer to remove.
reason – [in] Why the writer is being removed (dropped, removed, or ignored)
- Returns:
true if found and deleted.
-
virtual bool createPDPEndpoints() = 0
Create the SPDP Writer and Reader
- Returns:
True if correct.
-
virtual void assignRemoteEndpoints(ParticipantProxyData *pdata) = 0
This method assigns remote endpoints to the builtin endpoints defined in this protocol. It also calls the corresponding methods in EDP and WLP.
- Parameters:
pdata – Pointer to the RTPSParticipantProxyData object.
-
virtual void notifyAboveRemoteEndpoints(const ParticipantProxyData &pdata, bool notify_secure_endpoints) = 0
Override to match additional endpoints to PDP. Like EDP or WLP.
- Parameters:
pdata – Pointer to the ParticipantProxyData object.
notify_secure_endpoints – Whether to try notifying secure endpoints.
-
inline virtual bool updateInfoMatchesEDP()
Some PDP classes require EDP matching with update PDP DATAs like EDPStatic
- Returns:
true if EDP endpoinst must be match
-
virtual void removeRemoteEndpoints(ParticipantProxyData *pdata) = 0
Remove remote endpoints from the participant discovery protocol
- Parameters:
pdata – Pointer to the ParticipantProxyData to remove
-
virtual bool remove_remote_participant(const GUID_t &participant_guid, ParticipantDiscoveryInfo::DISCOVERY_STATUS reason)
This method removes a remote RTPSParticipant and all its writers and readers.
- Parameters:
participant_guid – GUID_t of the remote RTPSParticipant.
reason – Why the participant is being removed (dropped, removed, or ignored)
- Returns:
true if correct.
-
const BuiltinAttributes &builtin_attributes() const
This method returns the BuiltinAttributes of the local participant.
- Returns:
const reference to the BuiltinAttributes of the local participant.
-
inline ParticipantProxyData *getLocalParticipantProxyData() const
Get a pointer to the local RTPSParticipant ParticipantProxyData object.
- Returns:
Pointer to the local RTPSParticipant ParticipantProxyData object.
-
inline ResourceLimitedVector<ParticipantProxyData*>::const_iterator ParticipantProxiesBegin()
Get a const_iterator to the beginning of the RTPSParticipant Proxies.
- Returns:
const_iterator.
-
inline ResourceLimitedVector<ParticipantProxyData*>::const_iterator ParticipantProxiesEnd()
Get a const_iterator to the end of the RTPSParticipant Proxies.
- Returns:
const_iterator.
-
inline size_t participant_proxies_number()
Get the number of participant proxies.
- Returns:
size_t.
-
void assert_remote_participant_liveliness(const GuidPrefix_t &remote_guid)
Assert the liveliness of a Remote Participant.
- Parameters:
remote_guid – GuidPrefix_t of the participant whose liveliness is being asserted.
-
inline RTPSParticipantImpl *getRTPSParticipant() const
Get the RTPS participant
- Returns:
RTPS participant
-
inline std::recursive_mutex *getMutex() const
Get the mutex.
- Returns:
Pointer to the Mutex
-
CDRMessage_t get_participant_proxy_data_serialized(Endianness_t endian)
-
ParticipantProxyData *get_participant_proxy_data(const GuidPrefix_t &guid_prefix)
Retrive the ParticipantProxyData of a participant
- Parameters:
guid_prefix – The GUID prefix of the participant of which the proxy data is retrieved
- Returns:
A pointer to the ParticipantProxyData. nullptr if there is no such ParticipantProxyData
-
std::list<eprosima::fastdds::rtps::RemoteServerAttributes> &remote_server_attributes()
Get the list of remote servers to which the client should connect
- Returns:
A reference to the list of RemoteServerAttributes
-
inline ProxyPool<ReaderProxyData> &get_temporary_reader_proxies_pool()
Access the temporary proxy pool for reader proxies
- Returns:
pool reference
-
inline ProxyPool<WriterProxyData> &get_temporary_writer_proxies_pool()
Access the temporary proxy pool for writer proxies
- Returns:
pool reference
-
ReaderAttributes create_builtin_reader_attributes() const
-
WriterAttributes create_builtin_writer_attributes() const
-
inline virtual bool get_serialized_proxy(const GUID_t&, CDRMessage_t*) override
Interface for retrieving the serialized proxy of an entity. This is in the form of a sequence of octets.
- Parameters:
guid – [in] The GUID_t identifying the target entity
msg – [out] Pointer containig the serialized proxy
- Returns:
Whether the operation succeeds or not
Protected Functions
-
ParticipantProxyData *add_participant_proxy_data(const GUID_t &participant_guid, bool with_lease_duration, const ParticipantProxyData *participant_proxy_data = nullptr)
Adds an entry to the collection of participant proxy information. May use one of the entries present in the pool.
- Parameters:
participant_guid – GUID of the participant for which to create the proxy object.
with_lease_duration – indicates whether lease duration event should be created.
participant_proxy_data – The participant proxy data from which the copy is made (if provided)
- Returns:
pointer to the currently inserted entry, nullptr if allocation limits were reached.
-
bool data_matches_with_prefix(const GuidPrefix_t &guid_prefix, const ParticipantProxyData &participant_data)
Checks whether two participant prefixes are equal by calculating the mangled GUID and comparing it with the remote participant prefix.
- Parameters:
guid_prefix – the original desired guid_prefix to compare
participant_data – The participant proxy data to compare against
- Returns:
true when prefixes are equivalent
-
bool lookup_participant_key(const GUID_t &participant_guid, InstanceHandle_t &key)
Gets the key of a participant proxy data.
- Parameters:
participant_guid – [in] GUID of the participant to look for.
key – [out] of the corresponding proxy object.
- Returns:
true when input GUID is found.
-
void announceParticipantState(RTPSWriter &writer, WriterHistory &history, bool new_change, bool dispose = false, WriteParams &wparams = WriteParams::WRITE_PARAM_DEFAULT)
Force the sending of our local DPD to all remote RTPSParticipants and multicast Locators.
- Parameters:
writer – RTPSWriter to use for sending the announcement
history – history where the change should be added
new_change – If true a new change (with new seqNum) is created and sent;If false the last change is re-sent
dispose – sets change kind to NOT_ALIVE_DISPOSED_UNREGISTERED
wparams – allows to identify the change
-
virtual void update_builtin_locators() = 0
Called after creating the builtin endpoints to update the metatraffic unicast locators of BuiltinProtocols
-
void notify_and_maybe_ignore_new_participant(ParticipantProxyData *pdata, bool &should_be_ignored)
Protected Attributes
-
BuiltinProtocols *mp_builtin
Pointer to the builtin protocols object.
-
RTPSParticipantImpl *mp_RTPSParticipant
Pointer to the local RTPSParticipant.
-
BuiltinAttributes m_discovery
Discovery attributes.
-
size_t participant_proxies_number_
Number of participant proxy data objects created.
-
ResourceLimitedVector<ParticipantProxyData*> participant_proxies_
Registered RTPSParticipants (including the local one, that is the first one.)
-
ResourceLimitedVector<ParticipantProxyData*> participant_proxies_pool_
Pool of participant proxy data objects ready for reuse.
-
size_t reader_proxies_number_
Number of reader proxy data objects created.
-
ResourceLimitedVector<ReaderProxyData*> reader_proxies_pool_
Pool of reader proxy data objects ready for reuse.
-
size_t writer_proxies_number_
Number of writer proxy data objects created.
-
ResourceLimitedVector<WriterProxyData*> writer_proxies_pool_
Pool of writer proxy data objects ready for reuse.
-
std::atomic_bool m_hasChangedLocalPDP
Variable to indicate if any parameter has changed.
-
ProxyPool<ReaderProxyData> temp_reader_proxies_
ProxyPool for temporary reader proxies.
-
ProxyPool<WriterProxyData> temp_writer_proxies_
ProxyPool for temporary writer proxies.
-
std::recursive_mutex *mp_mutex
Participant data atomic access assurance.
-
std::mutex callback_mtx_
To protect callbacks (ParticipantProxyData&)
-
std::atomic<bool> enabled_ = {false}
Tell if object is enabled.
Friends
- friend class fastdds::rtps::PDPServerListener
-
PDP(BuiltinProtocols *builtin, const RTPSParticipantAllocationAttributes &allocation)