SocketTransportDescriptor.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Copyright 2019 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. #ifndef _FASTDDS_SOCKET_TRANSPORT_DESCRIPTOR_H_
  15. #define _FASTDDS_SOCKET_TRANSPORT_DESCRIPTOR_H_
  16. #include <fastdds/rtps/transport/TransportDescriptorInterface.h>
  17. #ifdef _WIN32
  18. #include <cstdint>
  19. #endif
  20. #include <vector>
  21. #include <string>
  22. namespace eprosima{
  23. namespace fastdds{
  24. namespace rtps{
  25. class TransportInterface;
  26. static const uint8_t s_defaultTTL = 1;
  27. /**
  28. * Virtual base class for the data type used to define configuration of transports using sockets.
  29. * @ingroup RTPS_MODULE
  30. * */
  31. struct SocketTransportDescriptor : public TransportDescriptorInterface
  32. {
  33. SocketTransportDescriptor(
  34. uint32_t maximumMessageSize,
  35. uint32_t maximumInitialPeersRange)
  36. : TransportDescriptorInterface(maximumMessageSize, maximumInitialPeersRange)
  37. , sendBufferSize(0)
  38. , receiveBufferSize(0)
  39. , TTL(s_defaultTTL)
  40. {}
  41. SocketTransportDescriptor(const SocketTransportDescriptor& t)
  42. : TransportDescriptorInterface(t)
  43. , sendBufferSize(t.sendBufferSize)
  44. , receiveBufferSize(t.receiveBufferSize)
  45. , TTL(t.TTL)
  46. {}
  47. virtual ~SocketTransportDescriptor(){}
  48. virtual uint32_t min_send_buffer_size() const override { return sendBufferSize; }
  49. //! Length of the send buffer.
  50. uint32_t sendBufferSize;
  51. //! Length of the receive buffer.
  52. uint32_t receiveBufferSize;
  53. //! Allowed interfaces in an IP string format.
  54. std::vector<std::string> interfaceWhiteList;
  55. //! Specified time to live (8bit - 255 max TTL)
  56. uint8_t TTL;
  57. };
  58. } // namespace rtps
  59. } // namespace fastdds
  60. } // namespace eprosima
  61. #endif //_FASTDDS_SOCKET_TRANSPORT_DESCRIPTOR_H_