123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471 |
- #ifndef _FASTDDS_RTPSPARTICIPANTPARAMETERS_H_
- #define _FASTDDS_RTPSPARTICIPANTPARAMETERS_H_
- #include <fastdds/rtps/common/Time_t.h>
- #include <fastdds/rtps/common/Locator.h>
- #include <fastdds/rtps/common/PortParameters.h>
- #include <fastdds/rtps/attributes/PropertyPolicy.h>
- #include <fastdds/rtps/flowcontrol/ThroughputControllerDescriptor.h>
- #include <fastdds/rtps/transport/TransportInterface.h>
- #include <fastdds/rtps/resources/ResourceManagement.h>
- #include <fastrtps/utils/fixed_size_string.hpp>
- #include <fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp>
- #include <fastdds/rtps/attributes/ServerAttributes.h>
- #include <memory>
- #include <sstream>
- namespace eprosima {
- namespace fastrtps {
- namespace rtps {
- typedef enum DiscoveryProtocol
- {
- NONE,
-
- SIMPLE,
-
- EXTERNAL,
-
- CLIENT,
- SERVER,
- BACKUP
- } DiscoveryProtocol_t;
- typedef enum ParticipantFilteringFlags : uint32_t
- {
- NO_FILTER = 0,
- FILTER_DIFFERENT_HOST = 0x1,
- FILTER_DIFFERENT_PROCESS = 0x2,
- FILTER_SAME_PROCESS = 0x4
- } ParticipantFilteringFlags_t;
- #define BUILTIN_DATA_MAX_SIZE 512
- class PDP;
- class BuiltinProtocols;
- typedef struct _PDPFactory
- {
-
- PDP* (*CreatePDPInstance)(BuiltinProtocols*);
-
- void (* ReleasePDPInstance)(
- PDP*);
- bool operator ==(
- const struct _PDPFactory& e) const
- {
- return (CreatePDPInstance == e.CreatePDPInstance)
- && (ReleasePDPInstance == e.ReleasePDPInstance);
- }
- } PDPFactory;
- class SimpleEDPAttributes
- {
- public:
-
- bool use_PublicationWriterANDSubscriptionReader;
-
- bool use_PublicationReaderANDSubscriptionWriter;
- #if HAVE_SECURITY
- bool enable_builtin_secure_publications_writer_and_subscriptions_reader;
- bool enable_builtin_secure_subscriptions_writer_and_publications_reader;
- #endif
- SimpleEDPAttributes()
- : use_PublicationWriterANDSubscriptionReader(true)
- , use_PublicationReaderANDSubscriptionWriter(true)
- #if HAVE_SECURITY
- , enable_builtin_secure_publications_writer_and_subscriptions_reader(true)
- , enable_builtin_secure_subscriptions_writer_and_publications_reader(true)
- #endif
- {
- }
- bool operator ==(
- const SimpleEDPAttributes& b) const
- {
- return (this->use_PublicationWriterANDSubscriptionReader == b.use_PublicationWriterANDSubscriptionReader) &&
- #if HAVE_SECURITY
- (this->enable_builtin_secure_publications_writer_and_subscriptions_reader ==
- b.enable_builtin_secure_publications_writer_and_subscriptions_reader) &&
- (this->enable_builtin_secure_subscriptions_writer_and_publications_reader ==
- b.enable_builtin_secure_subscriptions_writer_and_publications_reader) &&
- #endif
- (this->use_PublicationReaderANDSubscriptionWriter == b.use_PublicationReaderANDSubscriptionWriter);
- }
- };
- struct InitialAnnouncementConfig
- {
-
- uint32_t count = 5u;
-
- Duration_t period = { 0, 100000000u };
- bool operator ==(
- const InitialAnnouncementConfig& b) const
- {
- return (count == b.count) && (period == b.period);
- }
- };
- class DiscoverySettings
- {
- public:
-
- DiscoveryProtocol_t discoveryProtocol = DiscoveryProtocol_t::SIMPLE;
-
- bool use_SIMPLE_EndpointDiscoveryProtocol = true;
-
- bool use_STATIC_EndpointDiscoveryProtocol = false;
-
- Duration_t leaseDuration = { 20, 0 };
-
- Duration_t leaseDuration_announcementperiod = { 3, 0 };
-
- InitialAnnouncementConfig initial_announcements;
-
- SimpleEDPAttributes m_simpleEDP;
-
- PDPFactory m_PDPfactory{};
-
- Duration_t discoveryServer_client_syncperiod = { 0, 450 * 1000000};
-
- RemoteServerList_t m_DiscoveryServers;
-
- ParticipantFilteringFlags_t ignoreParticipantFlags = ParticipantFilteringFlags::NO_FILTER;
- DiscoverySettings() = default;
- bool operator ==(
- const DiscoverySettings& b) const
- {
- return (this->discoveryProtocol == b.discoveryProtocol) &&
- (this->use_SIMPLE_EndpointDiscoveryProtocol == b.use_SIMPLE_EndpointDiscoveryProtocol) &&
- (this->use_STATIC_EndpointDiscoveryProtocol == b.use_STATIC_EndpointDiscoveryProtocol) &&
- (this->discoveryServer_client_syncperiod == b.discoveryServer_client_syncperiod) &&
- (this->m_PDPfactory == b.m_PDPfactory) &&
- (this->leaseDuration == b.leaseDuration) &&
- (this->leaseDuration_announcementperiod == b.leaseDuration_announcementperiod) &&
- (this->initial_announcements == b.initial_announcements) &&
- (this->m_simpleEDP == b.m_simpleEDP) &&
- (this->m_staticEndpointXMLFilename == b.m_staticEndpointXMLFilename) &&
- (this->m_DiscoveryServers == b.m_DiscoveryServers) &&
- (this->ignoreParticipantFlags == b.ignoreParticipantFlags);
- }
-
- const char* getStaticEndpointXMLFilename() const
- {
- return m_staticEndpointXMLFilename.c_str();
- }
-
- void setStaticEndpointXMLFilename(
- const char* str)
- {
- m_staticEndpointXMLFilename = std::string(str);
- }
- private:
-
- std::string m_staticEndpointXMLFilename = "";
- };
- class TypeLookupSettings
- {
- public:
-
- bool use_client = false;
-
- bool use_server = false;
- };
- class BuiltinAttributes
- {
- public:
-
- DiscoverySettings discovery_config;
-
- bool use_WriterLivelinessProtocol = true;
-
- TypeLookupSettings typelookup_config;
-
- LocatorList_t metatrafficUnicastLocatorList;
-
- LocatorList_t metatrafficMulticastLocatorList;
-
- LocatorList_t initialPeersList;
-
- MemoryManagementPolicy_t readerHistoryMemoryPolicy =
- MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
-
- uint32_t readerPayloadSize = BUILTIN_DATA_MAX_SIZE;
-
- MemoryManagementPolicy_t writerHistoryMemoryPolicy =
- MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
-
- uint32_t writerPayloadSize = BUILTIN_DATA_MAX_SIZE;
-
- uint32_t mutation_tries = 100u;
-
- bool avoid_builtin_multicast = true;
- BuiltinAttributes() = default;
- virtual ~BuiltinAttributes() = default;
- bool operator ==(
- const BuiltinAttributes& b) const
- {
- return (this->discovery_config == b.discovery_config) &&
- (this->use_WriterLivelinessProtocol == b.use_WriterLivelinessProtocol) &&
- (typelookup_config.use_client == b.typelookup_config.use_client) &&
- (typelookup_config.use_server == b.typelookup_config.use_server) &&
- (this->metatrafficUnicastLocatorList == b.metatrafficUnicastLocatorList) &&
- (this->metatrafficMulticastLocatorList == b.metatrafficMulticastLocatorList) &&
- (this->initialPeersList == b.initialPeersList) &&
- (this->readerHistoryMemoryPolicy == b.readerHistoryMemoryPolicy) &&
- (this->readerPayloadSize == b.readerPayloadSize) &&
- (this->writerHistoryMemoryPolicy == b.writerHistoryMemoryPolicy) &&
- (this->writerPayloadSize == b.writerPayloadSize) &&
- (this->mutation_tries == b.mutation_tries) &&
- (this->avoid_builtin_multicast == b.avoid_builtin_multicast);
- }
- };
- class RTPSParticipantAttributes
- {
- public:
- RTPSParticipantAttributes()
- {
- setName("RTPSParticipant");
- sendSocketBufferSize = 0;
- listenSocketBufferSize = 0;
- participantID = -1;
- useBuiltinTransports = true;
- }
- virtual ~RTPSParticipantAttributes()
- {
- }
- bool operator ==(
- const RTPSParticipantAttributes& b) const
- {
- return (this->name == b.name) &&
- (this->defaultUnicastLocatorList == b.defaultUnicastLocatorList) &&
- (this->defaultMulticastLocatorList == b.defaultMulticastLocatorList) &&
- (this->sendSocketBufferSize == b.sendSocketBufferSize) &&
- (this->listenSocketBufferSize == b.listenSocketBufferSize) &&
- (this->builtin == b.builtin) &&
- (this->port == b.port) &&
- (this->userData == b.userData) &&
- (this->participantID == b.participantID) &&
- (this->throughputController == b.throughputController) &&
- (this->useBuiltinTransports == b.useBuiltinTransports) &&
- (this->properties == b.properties &&
- (this->prefix == b.prefix));
- }
-
- LocatorList_t defaultUnicastLocatorList;
-
- LocatorList_t defaultMulticastLocatorList;
-
- uint32_t sendSocketBufferSize;
-
- uint32_t listenSocketBufferSize;
-
- GuidPrefix_t prefix;
- RTPS_DllAPI inline bool ReadguidPrefix(
- const char* pfx)
- {
- return bool(std::istringstream(pfx) >> prefix);
- }
-
- BuiltinAttributes builtin;
-
- PortParameters port;
-
- std::vector<octet> userData;
-
- int32_t participantID;
-
- ThroughputControllerDescriptor throughputController;
-
- std::vector<std::shared_ptr<fastdds::rtps::TransportDescriptorInterface> > userTransports;
-
- bool useBuiltinTransports;
-
- RTPSParticipantAllocationAttributes allocation;
-
- PropertyPolicy properties;
-
- inline void setName(
- const char* nam)
- {
- name = nam;
- }
-
- inline const char* getName() const
- {
- return name.c_str();
- }
- private:
-
- string_255 name;
- };
- }
- }
- }
- #endif
|