Fast DDS
Version 3.6.1.0
Fast DDS
Toggle main menu visibility
Loading...
Searching...
No Matches
TCPv4TransportDescriptor.hpp
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
19
20
#ifndef FASTDDS_RTPS_TRANSPORT__TCPV4TRANSPORTDESCRIPTOR_HPP
21
#define FASTDDS_RTPS_TRANSPORT__TCPV4TRANSPORTDESCRIPTOR_HPP
22
23
#include <sstream>
24
25
#include <fastdds/rtps/transport/TCPTransportDescriptor.hpp>
26
#include <fastdds/rtps/common/Types.hpp>
27
28
namespace
eprosima
{
29
namespace
fastdds
{
30
namespace
rtps
{
31
40
struct
TCPv4TransportDescriptor
:
public
TCPTransportDescriptor
41
{
43
virtual
~TCPv4TransportDescriptor
() =
default
;
44
45
virtual
TransportInterface
*
create_transport
()
const override
;
46
48
fastdds::rtps::octet
wan_addr
[4];
49
51
void
set_WAN_address
(
52
fastdds::rtps::octet
o1,
53
fastdds::rtps::octet
o2,
54
fastdds::rtps::octet
o3,
55
fastdds::rtps::octet
o4)
56
{
57
wan_addr
[0] = o1;
58
wan_addr
[1] = o2;
59
wan_addr
[2] = o3;
60
wan_addr
[3] = o4;
61
}
62
64
void
set_WAN_address
(
65
const
std::string& in_address)
66
{
67
std::stringstream ss(in_address);
68
int
a, b, c, d;
//to store the 4 ints
69
char
ch;
//to temporarily store the '.'
70
ss >> a >> ch >> b >> ch >> c >> ch >> d;
71
wan_addr
[0] = (
fastdds::rtps::octet
)a;
72
wan_addr
[1] = (
fastdds::rtps::octet
)b;
73
wan_addr
[2] = (
fastdds::rtps::octet
)c;
74
wan_addr
[3] = (
fastdds::rtps::octet
)d;
75
}
76
78
std::string
get_WAN_address
()
79
{
80
std::stringstream ss;
81
ss << static_cast<int>(
wan_addr
[0]) <<
"."
82
<<
static_cast<
int
>
(
wan_addr
[1]) <<
"."
83
<<
static_cast<
int
>
(
wan_addr
[2]) <<
"."
84
<<
static_cast<
int
>
(
wan_addr
[3]);
85
return
ss.str();
86
}
87
89
FASTDDS_EXPORTED_API
TCPv4TransportDescriptor
();
90
92
FASTDDS_EXPORTED_API
TCPv4TransportDescriptor
(
93
const
TCPv4TransportDescriptor
& t);
94
96
FASTDDS_EXPORTED_API
TCPv4TransportDescriptor
&
operator =
(
97
const
TCPv4TransportDescriptor
& t);
98
100
FASTDDS_EXPORTED_API
bool
operator ==
(
101
const
TCPv4TransportDescriptor
& t)
const
;
102
};
103
104
}
// namespace rtps
105
}
// namespace fastdds
106
}
// namespace eprosima
107
108
#endif
// FASTDDS_RTPS_TRANSPORT__TCPV4TRANSPORTDESCRIPTOR_HPP
eprosima::fastdds::rtps::TransportInterface
Interface against which to implement a transport layer, decoupled from Fast DDS internals.
Definition
TransportInterface.hpp:64
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds::rtps::octet
uint8_t octet
Definition
Types.hpp:83
eprosima::fastdds
eprosima
eProsima namespace.
eprosima::fastdds::rtps::TCPTransportDescriptor::TCPTransportDescriptor
FASTDDS_EXPORTED_API TCPTransportDescriptor()
Constructor.
eprosima::fastdds::rtps::TCPv4TransportDescriptor::TCPv4TransportDescriptor
FASTDDS_EXPORTED_API TCPv4TransportDescriptor(const TCPv4TransportDescriptor &t)
Copy constructor.
eprosima::fastdds::rtps::TCPv4TransportDescriptor::get_WAN_address
std::string get_WAN_address()
Get the public IP address.
Definition
TCPv4TransportDescriptor.hpp:78
eprosima::fastdds::rtps::TCPv4TransportDescriptor::operator=
FASTDDS_EXPORTED_API TCPv4TransportDescriptor & operator=(const TCPv4TransportDescriptor &t)
Copy assignment.
eprosima::fastdds::rtps::TCPv4TransportDescriptor::operator==
FASTDDS_EXPORTED_API bool operator==(const TCPv4TransportDescriptor &t) const
Comparison operator.
eprosima::fastdds::rtps::TCPv4TransportDescriptor::wan_addr
fastdds::rtps::octet wan_addr[4]
Public IP address.
Definition
TCPv4TransportDescriptor.hpp:48
eprosima::fastdds::rtps::TCPv4TransportDescriptor::TCPv4TransportDescriptor
FASTDDS_EXPORTED_API TCPv4TransportDescriptor()
Constructor.
eprosima::fastdds::rtps::TCPv4TransportDescriptor::set_WAN_address
void set_WAN_address(const std::string &in_address)
Set the public IP address.
Definition
TCPv4TransportDescriptor.hpp:64
eprosima::fastdds::rtps::TCPv4TransportDescriptor::~TCPv4TransportDescriptor
virtual ~TCPv4TransportDescriptor()=default
Destructor.
eprosima::fastdds::rtps::TCPv4TransportDescriptor::create_transport
virtual TransportInterface * create_transport() const override
Factory method pattern.
eprosima::fastdds::rtps::TCPv4TransportDescriptor::set_WAN_address
void set_WAN_address(fastdds::rtps::octet o1, fastdds::rtps::octet o2, fastdds::rtps::octet o3, fastdds::rtps::octet o4)
Set the public IP address.
Definition
TCPv4TransportDescriptor.hpp:51
include
fastdds
rtps
transport
TCPv4TransportDescriptor.hpp
Generated on
for