Fast DDS  Version 3.6.1.0
Fast DDS
RTPSParticipant.hpp
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 
19 #ifndef FASTDDS_RTPS_PARTICIPANT__RTPSPARTICIPANT_HPP
20 #define FASTDDS_RTPS_PARTICIPANT__RTPSPARTICIPANT_HPP
21 
22 #include <cstdint>
23 #include <cstdlib>
24 #include <memory>
25 
26 #include <fastdds/dds/core/ReturnCode.hpp>
27 #include <fastdds/dds/publisher/qos/WriterQos.hpp>
28 #include <fastdds/dds/subscriber/qos/ReaderQos.hpp>
29 #include <fastdds/rtps/attributes/RTPSParticipantAttributes.hpp>
30 #include <fastdds/rtps/builtin/data/ContentFilterProperty.hpp>
31 #include <fastdds/rtps/builtin/data/ParticipantBuiltinTopicData.hpp>
32 #include <fastdds/rtps/common/Guid.hpp>
33 #include <fastdds/statistics/IListeners.hpp>
34 #include <fastdds/fastdds_dll.hpp>
35 
36 namespace eprosima {
37 
38 #ifdef FASTDDS_STATISTICS
39 
40 namespace fastdds {
41 namespace statistics {
42 
43 class MonitorServiceStatusData;
44 
45 namespace rtps {
46 
47 struct IStatusQueryable;
48 struct IStatusObserver;
49 
50 } // namespace rtps
51 } // namespace statistics
52 } // namespace fastdds
53 
54 #endif //FASTDDS_STATISTICS
55 
56 namespace fastdds {
57 namespace rtps {
58 
60 class RTPSParticipantImpl;
61 class RTPSParticipantListener;
62 class RTPSWriter;
63 class RTPSReader;
65 struct TopicDescription;
66 class EndpointAttributes;
67 class WriterAttributes;
68 class ReaderAttributes;
69 class ResourceEvent;
70 class WLP;
71 
76 class FASTDDS_EXPORTED_API RTPSParticipant
77 {
78  friend class RTPSParticipantImpl;
79  friend class RTPSDomain;
80  friend class RTPSDomainImpl;
81 
82 private:
83 
89  RTPSParticipantImpl* pimpl);
90 
91  virtual ~RTPSParticipant();
92 
93 public:
94 
96  const GUID_t& getGuid() const;
97 
100 
101  // //!Method to loose the next change (ONLY FOR TEST). //TODO remove this method because is only for testing
102  // void loose_next_change();
103 
106 
109 
120  const GUID_t& pguid,
121  int16_t userDefinedId);
131  const GUID_t& pguid,
132  int16_t userDefinedId);
133 
138  uint32_t getRTPSParticipantID() const;
139 
150  RTPSWriter* rtps_writer,
151  const TopicDescription& topic,
152  const fastdds::dds::WriterQos& qos);
153 
164  RTPSWriter* rtps_writer,
165  const TopicDescription& topic,
166  const PublicationBuiltinTopicData& pub_builtin_topic_data);
167 
179  RTPSReader* rtps_reader,
180  const TopicDescription& topic,
181  const fastdds::dds::ReaderQos& qos,
182  const ContentFilterProperty* content_filter = nullptr);
183 
195  RTPSReader* rtps_reader,
196  const TopicDescription& topic,
197  const SubscriptionBuiltinTopicData& sub_builtin_topic_data,
198  const ContentFilterProperty* content_filter = nullptr);
199 
205  const RTPSParticipantAttributes& patt);
206 
214  RTPSWriter* rtps_writer,
215  const fastdds::dds::WriterQos& wqos);
216 
225  RTPSReader* rtps_reader,
226  const fastdds::dds::ReaderQos& rqos,
227  const ContentFilterProperty* content_filter = nullptr);
228 
233  std::vector<std::string> getParticipantNames() const;
234 
240 
244  uint32_t getMaxMessageSize() const;
245 
249  uint32_t getMaxDataSize() const;
250 
251  ResourceEvent& get_resource_event() const;
252 
257  WLP* wlp() const;
258 
266  EntityId_t& entityId);
267 
272  std::function<bool(const std::string&)>&& check_type);
273 
279  RTPSParticipantListener* listener);
280 
284  uint32_t get_domain_id() const;
285 
289  void enable();
290 
298  const GuidPrefix_t& participant_guid);
299 
307  const GUID_t& writer_guid);
308 
316  const GUID_t& reader_guid);
317 
323  std::vector<TransportNetmaskFilterInfo> get_netmask_filter_info() const;
324 
335  const GUID_t& writer_guid) const;
336 
347  const GUID_t& reader_guid) const;
348 
349 #if HAVE_SECURITY
350 
356  bool is_security_enabled_for_writer(
357  const WriterAttributes& writer_attributes);
358 
364  bool is_security_enabled_for_reader(
365  const ReaderAttributes& reader_attributes);
366 
367 #endif // if HAVE_SECURITY
368 
369 #ifdef FASTDDS_STATISTICS
370 
377  bool add_statistics_listener(
378  std::shared_ptr<fastdds::statistics::IListener> listener,
379  uint32_t kind);
380 
387  bool remove_statistics_listener(
388  std::shared_ptr<fastdds::statistics::IListener> listener,
389  uint32_t kind);
390 
396  void set_enabled_statistics_writers_mask(
397  uint32_t enabled_writers);
398 
409  const fastdds::statistics::rtps::IStatusObserver* create_monitor_service(
410  fastdds::statistics::rtps::IStatusQueryable& status_queryable);
411 
420  bool create_monitor_service();
421 
430  bool is_monitor_service_created() const;
431 
439  bool enable_monitor_service() const;
440 
449  bool disable_monitor_service() const;
450 
459  bool fill_discovery_data_from_cdr_message(
462 
471  bool fill_discovery_data_from_cdr_message(
474 
483  bool fill_discovery_data_from_cdr_message(
486 
487 #endif // FASTDDS_STATISTICS
488 
489 protected:
490 
492  RTPSParticipantImpl* mp_impl;
493 
494 };
495 
496 } // namespace rtps
497 } // namespace rtps
498 } // namespace eprosima
499 
500 #endif // FASTDDS_RTPS_PARTICIPANT__RTPSPARTICIPANT_HPP
Definition: ReaderQos.hpp:38
Definition: WriterQos.hpp:38
Information about the content filter being applied by a reader.
Definition: ContentFilterProperty.hpp:36
Class RTPSDomain,it manages the creation and destruction of RTPSParticipant RTPSWriter and RTPSReader...
Definition: RTPSDomain.hpp:56
Class RTPSParticipantAttributes used to define different aspects of a RTPSParticipant.
Definition: RTPSParticipantAttributes.hpp:429
Class RTPSParticipant, contains the public API for a RTPSParticipant.
Definition: RTPSParticipant.hpp:77
dds::ReturnCode_t register_reader(RTPSReader *rtps_reader, const TopicDescription &topic, const SubscriptionBuiltinTopicData &sub_builtin_topic_data, const ContentFilterProperty *content_filter=nullptr)
Register a Reader in the BuiltinProtocols.
dds::ReturnCode_t register_writer(RTPSWriter *rtps_writer, const TopicDescription &topic, const PublicationBuiltinTopicData &pub_builtin_topic_data)
Register a Writer in the BuiltinProtocols.
bool get_publication_info(fastdds::rtps::PublicationBuiltinTopicData &data, const GUID_t &writer_guid) const
Fills the provided publication discovery data with the information of the writer identified by writer...
bool ignore_reader(const GUID_t &reader_guid)
Ignore all messages coming from the RTPSReader.
WLP * wlp() const
A method to retrieve the built-in writer liveliness protocol.
uint32_t getMaxMessageSize() const
Retrieves the maximum message size.
bool register_writer(RTPSWriter *rtps_writer, const TopicDescription &topic, const fastdds::dds::WriterQos &qos)
Register a Writer in the BuiltinProtocols.
bool ignore_participant(const GuidPrefix_t &participant_guid)
Ignore all messages coming from the RTPSParticipant.
bool update_writer(RTPSWriter *rtps_writer, const fastdds::dds::WriterQos &wqos)
Update local writer QoS.
void enable()
This operation enables the RTPSParticipantImpl.
bool get_new_entity_id(EntityId_t &entityId)
Fills a new entityId if set to unknown, or checks if a entity already exists with that entityId in ot...
bool ignore_writer(const GUID_t &writer_guid)
Ignore all messages coming from the RTPSWriter.
bool get_subscription_info(fastdds::rtps::SubscriptionBuiltinTopicData &data, const GUID_t &reader_guid) const
Fills the provided subscription discovery data with the information of the reader identified by reade...
RTPSParticipantImpl * mp_impl
Pointer to the implementation.
Definition: RTPSParticipant.hpp:492
const GUID_t & getGuid() const
Get the GUID_t of the RTPSParticipant.
bool newRemoteReaderDiscovered(const GUID_t &pguid, int16_t userDefinedId)
Indicate the Participant that you have discovered a new Remote Reader.
void stopRTPSParticipantAnnouncement()
Stop the RTPSParticipant announcement period. //TODO remove this method because is only for testing.
bool newRemoteWriterDiscovered(const GUID_t &pguid, int16_t userDefinedId)
Indicate the Participant that you have discovered a new Remote Writer.
const RTPSParticipantAttributes & get_attributes() const
Get a reference of the current state of the RTPSParticipantParameters.
ResourceEvent & get_resource_event() const
std::vector< TransportNetmaskFilterInfo > get_netmask_filter_info() const
Returns registered transports' netmask filter information (transport's netmask filter kind and allowl...
bool update_reader(RTPSReader *rtps_reader, const fastdds::dds::ReaderQos &rqos, const ContentFilterProperty *content_filter=nullptr)
Update local reader QoS.
uint32_t get_domain_id() const
Retrieves the DomainId.
uint32_t getMaxDataSize() const
Retrieves the maximum data size.
std::vector< std::string > getParticipantNames() const
Returns a list with the participant names.
bool register_reader(RTPSReader *rtps_reader, const TopicDescription &topic, const fastdds::dds::ReaderQos &qos, const ContentFilterProperty *content_filter=nullptr)
Register a Reader in the BuiltinProtocols.
void resetRTPSParticipantAnnouncement()
Reset the RTPSParticipant announcement period. //TODO remove this method because is only for testing.
void set_check_type_function(std::function< bool(const std::string &)> &&check_type)
Allows setting a function to check if a type is already known by the top level API participant.
void set_listener(RTPSParticipantListener *listener)
Modifies the participant listener.
void announceRTPSParticipantState()
Force the announcement of the RTPSParticipant state.
void update_attributes(const RTPSParticipantAttributes &patt)
Update participant attributes.
uint32_t getRTPSParticipantID() const
Get the Participant ID.
Class RTPSParticipantListener with virtual method that the user can overload to respond to certain ev...
Definition: RTPSParticipantListener.hpp:40
Class RTPSReader, manages the reception of data from its matched writers.
Definition: RTPSReader.hpp:54
Class RTPSWriter, manages the sending of data to the readers.
Definition: RTPSWriter.hpp:62
Class ReaderAttributes, to define the attributes of a RTPSReader.
Definition: ReaderAttributes.hpp:59
Class WriterAttributes, defining the attributes of a RTPSWriter.
Definition: WriterAttributes.hpp:76
rtps::SubscriptionBuiltinTopicData SubscriptionBuiltinTopicData
Definition: SubscriptionBuiltinTopicData.hpp:28
int32_t ReturnCode_t
Definition: DDSReturnCode.hpp:59
rtps::PublicationBuiltinTopicData PublicationBuiltinTopicData
Definition: PublicationBuiltinTopicData.hpp:28
Structure EntityId_t, entity id part of GUID_t.
Definition: EntityId_t.hpp:77
Structure GUID_t, entity identifier, unique in DDS-RTPS Domain.
Definition: Guid.hpp:40
Structure GuidPrefix_t, Guid Prefix of GUID_t.
Definition: GuidPrefix_t.hpp:37
Definition: ParticipantBuiltinTopicData.hpp:36
Structure PublicationBuiltinTopicData, contains the information on a discovered publication.
Definition: PublicationBuiltinTopicData.hpp:48
Structure SubscriptionBuiltinTopicData, contains the information on a discovered subscription.
Definition: SubscriptionBuiltinTopicData.hpp:47
Structure TopicDescription, used to register an endpoint on a topic.
Definition: TopicDescription.hpp:35
Definition: monitorservice_types.idl:126