PDPSimple.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @file PDPSimple.h
  16. *
  17. */
  18. #ifndef _FASTDDS_RTPS_BUILTIN_DISCOVERY_PARTICIPANT_PDPSIMPLE_H_
  19. #define _FASTDDS_RTPS_BUILTIN_DISCOVERY_PARTICIPANT_PDPSIMPLE_H_
  20. #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
  21. #include <fastdds/rtps/builtin/discovery/participant/PDP.h>
  22. namespace eprosima {
  23. namespace fastrtps {
  24. namespace rtps {
  25. class StatelessWriter;
  26. class StatelessReader;
  27. /**
  28. * Class PDPSimple that implements the SimpleRTPSParticipantDiscoveryProtocol as defined in the RTPS specification.
  29. * @ingroup DISCOVERY_MODULE
  30. */
  31. class PDPSimple : public PDP
  32. {
  33. public:
  34. /**
  35. * Constructor
  36. * @param builtin Pointer to the BuiltinProcols object.
  37. * @param allocation Participant allocation parameters.
  38. */
  39. PDPSimple(
  40. BuiltinProtocols* builtin,
  41. const RTPSParticipantAllocationAttributes& allocation);
  42. virtual ~PDPSimple();
  43. /**
  44. * Initialize the PDP.
  45. * @param part Pointer to the RTPSParticipant.
  46. * @return True on success
  47. */
  48. bool init(RTPSParticipantImpl* part) override;
  49. /**
  50. * Creates an initializes a new participant proxy from a DATA(p) raw info
  51. * @param p ParticipantProxyData from DATA msg deserialization
  52. * @param writer_guid GUID of originating writer
  53. * @return new ParticipantProxyData * or nullptr on failure
  54. */
  55. ParticipantProxyData* createParticipantProxyData(
  56. const ParticipantProxyData& p,
  57. const GUID_t& writer_guid) override;
  58. /**
  59. * Some PDP classes require EDP matching with update PDP DATAs like EDPStatic
  60. * @return true if EDP endpoinst must be match
  61. */
  62. bool updateInfoMatchesEDP() override;
  63. /**
  64. * Force the sending of our local DPD to all remote RTPSParticipants and multicast Locators.
  65. * @param new_change If true a new change (with new seqNum) is created and sent; if false the last change is re-sent
  66. * @param dispose Sets change kind to NOT_ALIVE_DISPOSED_UNREGISTERED
  67. * @param wparams allows to identify the change
  68. */
  69. void announceParticipantState(
  70. bool new_change,
  71. bool dispose = false,
  72. WriteParams& wparams = WriteParams::WRITE_PARAM_DEFAULT) override;
  73. /**
  74. * This method assigns remote endpoints to the builtin endpoints defined in this protocol. It also calls
  75. * the corresponding methods in EDP and WLP.
  76. * @param pdata Pointer to the ParticipantProxyData object.
  77. */
  78. void assignRemoteEndpoints(ParticipantProxyData* pdata) override;
  79. /**
  80. * Remove remote endpoints from the participant discovery protocol
  81. * @param pdata Pointer to the ParticipantProxyData to remove
  82. */
  83. void removeRemoteEndpoints(ParticipantProxyData * pdata) override;
  84. /**
  85. * This method notifies EDP and WLP of the existence of a new participant.
  86. * @param pdata
  87. */
  88. void notifyAboveRemoteEndpoints(const ParticipantProxyData& pdata) override;
  89. /**
  90. * Activate a new Remote Endpoint that has been statically discovered.
  91. * @param pguid GUID_t of the participant.
  92. * @param userDefinedId User Defined ID.
  93. * @param kind Kind of endpoint.
  94. */
  95. bool newRemoteEndpointStaticallyDiscovered(
  96. const GUID_t& pguid,
  97. int16_t userDefinedId,
  98. EndpointKind_t kind);
  99. private:
  100. void initializeParticipantProxyData(ParticipantProxyData* participant_data) override;
  101. /**
  102. * Create the SPDP Writer and Reader
  103. * @return True if correct.
  104. */
  105. bool createPDPEndpoints() override;
  106. };
  107. } /* namespace rtps */
  108. } /* namespace fastrtps */
  109. } /* namespace eprosima */
  110. #endif
  111. #endif //_FASTDDS_RTPS_BUILTIN_DISCOVERY_PARTICIPANT_PDPSIMPLE_H_