Class PDP

Inheritance Relationships

Derived Type

Class Documentation

class PDP

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 BuiltinProcols object.

  • allocationParticipant 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 = false, WriteParams &wparams = WriteParams::WRITE_PARAM_DEFAULT)

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 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
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_guidGUID_t of the reader to remove.

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_guidGUID_t of the wtiter to remove.

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) = 0

Override to match additional endpoints to PDP. Like EDP or WLP.

Parameters

pdata – Pointer to the ParticipantProxyData object.

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_guidGUID_t of the remote RTPSParticipant.

  • reason – Why the participant is being removed (dropped vs removed)

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()

Get a pointer to the local RTPSParticipant ParticipantProxyData object.

Returns

Pointer to the local RTPSParticipant ParticipantProxyData object.

inline EDP *getEDP()

Get a pointer to the EDP object.

Returns

pointer to the EDP 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.

void assert_remote_participant_liveliness(const GuidPrefix_t &remote_guid)

Assert the liveliness of a Remote Participant.

Parameters

remote_guidGuidPrefix_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

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 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.

Protected Attributes

BuiltinProtocols *mp_builtin

Pointer to the builtin protocols object.

RTPSParticipantImpl *mp_RTPSParticipant

Pointer to the local RTPSParticipant.

BuiltinAttributes m_discovery

Discovery attributes.

RTPSWriter *mp_PDPWriter

Pointer to the PDPWriter.

RTPSReader *mp_PDPReader

Pointer to the PDPReader.

EDP *mp_EDP

Pointer to the EDP object.

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.

ReaderListener *mp_listener

Listener for the SPDP messages.

WriterHistory *mp_PDPWriterHistory

WriterHistory.

std::shared_ptr<ITopicPayloadPool> writer_payload_pool_

Writer payload pool.

ReaderHistory *mp_PDPReaderHistory

Reader History.

std::shared_ptr<ITopicPayloadPool> reader_payload_pool_

Reader payload pool.

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