Endpoint.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 Endpoint.h
  16. */
  17. #ifndef _FASTDDS_RTPS_ENDPOINT_H_
  18. #define _FASTDDS_RTPS_ENDPOINT_H_
  19. #include <fastdds/rtps/common/Types.h>
  20. #include <fastdds/rtps/common/Locator.h>
  21. #include <fastdds/rtps/common/Guid.h>
  22. #include <fastdds/rtps/attributes/EndpointAttributes.h>
  23. #include <fastrtps/utils/TimedMutex.hpp>
  24. namespace eprosima {
  25. namespace fastrtps{
  26. namespace rtps {
  27. class RTPSParticipantImpl;
  28. class ResourceEvent;
  29. /**
  30. * Class Endpoint, all entities of the RTPS network derive from this class.
  31. * Although the RTPSParticipant is also defined as an endpoint in the RTPS specification, in this implementation
  32. * the RTPSParticipant class **does not** inherit from the endpoint class. Each Endpoint object owns a pointer to the
  33. * RTPSParticipant it belongs to.
  34. * @ingroup COMMON_MODULE
  35. */
  36. class Endpoint
  37. {
  38. friend class RTPSParticipantImpl;
  39. protected:
  40. Endpoint(
  41. RTPSParticipantImpl* pimpl,
  42. const GUID_t& guid,
  43. const EndpointAttributes& att)
  44. : mp_RTPSParticipant(pimpl)
  45. , m_guid(guid)
  46. , m_att(att)
  47. #if HAVE_SECURITY
  48. ,supports_rtps_protection_(true)
  49. #endif
  50. {
  51. }
  52. virtual ~Endpoint() = default;
  53. public:
  54. /**
  55. * Get associated GUID
  56. * @return Associated GUID
  57. */
  58. RTPS_DllAPI inline const GUID_t& getGuid() const { return m_guid; }
  59. /**
  60. * Get mutex
  61. * @return Associated Mutex
  62. */
  63. RTPS_DllAPI inline RecursiveTimedMutex& getMutex() { return mp_mutex; }
  64. /**
  65. * Get associated attributes
  66. * @return Endpoint attributes
  67. */
  68. RTPS_DllAPI inline EndpointAttributes& getAttributes() { return m_att; }
  69. #if HAVE_SECURITY
  70. bool supports_rtps_protection() { return supports_rtps_protection_; }
  71. #endif
  72. protected:
  73. //!Pointer to the RTPSParticipant containing this endpoint.
  74. RTPSParticipantImpl* mp_RTPSParticipant;
  75. //!Endpoint GUID
  76. const GUID_t m_guid;
  77. //!Endpoint Attributes
  78. EndpointAttributes m_att;
  79. //!Endpoint Mutex
  80. mutable RecursiveTimedMutex mp_mutex;
  81. private:
  82. Endpoint& operator=(const Endpoint&) = delete;
  83. #if HAVE_SECURITY
  84. bool supports_rtps_protection_;
  85. #endif
  86. };
  87. }
  88. } /* namespace rtps */
  89. } /* namespace eprosima */
  90. #endif //_FASTDDS_RTPS_ENDPOINT_H_