Program Listing for File SocketTransportDescriptor.h

Return to documentation for file (/tmp/ws/src/fastrtps/include/fastdds/rtps/transport/SocketTransportDescriptor.h)

// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef _FASTDDS_SOCKET_TRANSPORT_DESCRIPTOR_H_
#define _FASTDDS_SOCKET_TRANSPORT_DESCRIPTOR_H_

#include <fastdds/rtps/transport/TransportDescriptorInterface.h>

#include <cstdint>
#include <vector>
#include <string>

namespace eprosima {
namespace fastdds {
namespace rtps {

constexpr uint8_t s_defaultTTL = 1;

struct SocketTransportDescriptor : public TransportDescriptorInterface
{
    SocketTransportDescriptor(
            uint32_t maximumMessageSize,
            uint32_t maximumInitialPeersRange)
        : TransportDescriptorInterface(maximumMessageSize, maximumInitialPeersRange)
        , sendBufferSize(0)
        , receiveBufferSize(0)
        , TTL(s_defaultTTL)
    {
    }

    SocketTransportDescriptor(
            const SocketTransportDescriptor& t) = default;

    SocketTransportDescriptor& operator =(
            const SocketTransportDescriptor& t) = default;

    virtual ~SocketTransportDescriptor() = default;

    virtual uint32_t min_send_buffer_size() const override
    {
        return sendBufferSize;
    }

    bool operator ==(
            const SocketTransportDescriptor& t) const
    {
        return (this->sendBufferSize == t.min_send_buffer_size() &&
               this->receiveBufferSize == t.receiveBufferSize &&
               this->interfaceWhiteList == t.interfaceWhiteList &&
               this->TTL == t.TTL &&
               TransportDescriptorInterface::operator ==(t));
    }

    uint32_t sendBufferSize;
    uint32_t receiveBufferSize;
    std::vector<std::string> interfaceWhiteList;
    uint8_t TTL;
};

} // namespace rtps
} // namespace fastdds
} // namespace eprosima

#endif //_FASTDDS_SOCKET_TRANSPORT_DESCRIPTOR_H_