Fast DDS  Version 3.6.1.0
Fast DDS
NetworkInterface.hpp
1 // Copyright 2024 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_TRANSPORT_NETWORK__NETWORKINTERFACE_HPP
20 #define FASTDDS_RTPS_TRANSPORT_NETWORK__NETWORKINTERFACE_HPP
21 
22 #include <string>
23 
24 #include <fastdds/rtps/common/LocatorWithMask.hpp>
25 #include <fastdds/fastdds_dll.hpp>
26 
27 namespace eprosima {
28 namespace fastdds {
29 namespace rtps {
30 
38 {
40  FASTDDS_EXPORTED_API NetworkInterface(
41  const std::string& name);
42 
44  FASTDDS_EXPORTED_API NetworkInterface(
45  const std::string& device,
46  const std::string& ip,
47  const LocatorWithMask& locator);
48 
50  virtual FASTDDS_EXPORTED_API ~NetworkInterface() = default;
51 
53  FASTDDS_EXPORTED_API NetworkInterface(
54  const NetworkInterface& iface) = default;
55 
57  FASTDDS_EXPORTED_API NetworkInterface& operator =(
58  const NetworkInterface& iface) = default;
59 
61  FASTDDS_EXPORTED_API NetworkInterface(
62  NetworkInterface&& iface) = default;
63 
65  FASTDDS_EXPORTED_API NetworkInterface& operator =(
66  NetworkInterface&& iface) = default;
67 
69  FASTDDS_EXPORTED_API bool operator ==(
70  const NetworkInterface& iface) const;
71 
73  std::string name;
74 
76  std::string device;
78  std::string ip;
81 };
82 
83 } // namespace rtps
84 } // namespace fastdds
85 } // namespace eprosima
86 
87 #endif // FASTDDS_RTPS_TRANSPORT_NETWORK__NETWORKINTERFACE_HPP
A Locator with a mask that defines the number of significant bits of its address.
Definition: LocatorWithMask.hpp:35
Structure encapsulating relevant network interface information.
Definition: NetworkInterface.hpp:38
LocatorWithMask locator
IP address with network mask.
Definition: NetworkInterface.hpp:80
FASTDDS_EXPORTED_API NetworkInterface(NetworkInterface &&iface)=default
Move constructor.
FASTDDS_EXPORTED_API NetworkInterface & operator=(const NetworkInterface &iface)=default
Copy assignment.
FASTDDS_EXPORTED_API NetworkInterface(const std::string &name)
Constructor by name.
std::string ip
IP address in string format (includes scope ID in the IPv6 case)
Definition: NetworkInterface.hpp:78
FASTDDS_EXPORTED_API NetworkInterface(const std::string &device, const std::string &ip, const LocatorWithMask &locator)
Constructor by device name, IP address string and locator with mask.
std::string device
Interface device name.
Definition: NetworkInterface.hpp:76
std::string name
Interface device name or IP address in string format (to be filled by the user)
Definition: NetworkInterface.hpp:73
virtual FASTDDS_EXPORTED_API ~NetworkInterface()=default
Destructor.
FASTDDS_EXPORTED_API bool operator==(const NetworkInterface &iface) const
Comparison operator.
FASTDDS_EXPORTED_API NetworkInterface(const NetworkInterface &iface)=default
Copy constructor.