Safe DDS
eprosima::safedds::transport::Locator Class Reference

Stores remote address information. More...

#include <Locator.hpp>

Public Types

enum class  LocatorKind : int32_t {
  INVALID = -1 , RESERVED = 0 , UDPv4 = 1 , UDPv6 = 2 ,
  ETHERNET = 0x02000000 , CUSTOM = INT32_MAX
}
 Locator.kind values reserved for known transport types. More...
 
using IPv4 = memory::container::Array< uint8_t, 4 >
 Type for IPv4 address. More...
 
using IPv6 = memory::container::Array< uint8_t, ADDRESS_SIZE >
 Type for IPv6 address. More...
 
using MAC = memory::container::Array< uint8_t, MAC_ADDRESS_SIZE >
 Type for MAC address. More...
 

Public Member Functions

ReturnCode get_ipv4 (IPv4 &ipv4) const noexcept
 Getter in Locator::IPv4 format. More...
 
ReturnCode get_mac (MAC &mac) const noexcept
 Getter in Locator::MAC format. More...
 

Static Public Member Functions

static Locator from_ipv4 (const IPv4 &locator_ipv4, uint32_t locator_port) noexcept
 Get Locator from IPv4 address. More...
 
static Locator from_mac (const MAC &mac_address, uint16_t logical_port, uint16_t vlan_id, uint8_t pcp) noexcept
 Get Locator from MAC address, logical port, VLAN ID and PCP. More...
 

Public Attributes

LocatorKind kind
 Kind of locator. More...
 
uint32_t port
 Net port value. More...
 
memory::container::Array< uint8_t, ADDRESS_SIZEaddress
 Net address, size compatible with IPV4 and IPV6. More...
 

Static Public Attributes

constexpr static uint32_t ADDRESS_SIZE = 16
 Size of locator address octet array. More...
 
constexpr static uint32_t MAC_ADDRESS_SIZE = 6
 Size of MAC address octet array. More...
 
constexpr static uint32_t ADDRESS_IPV4_POS_1 = 12
 Address position of first IPv4 octet. More...
 
constexpr static uint32_t ADDRESS_IPV4_POS_2 = 13
 Address position of second IPv4 octet. More...
 
constexpr static uint32_t ADDRESS_IPV4_POS_3 = 14
 Address position of third IPv4 octet. More...
 
constexpr static uint32_t ADDRESS_IPV4_POS_4 = 15
 Address position of fourth IPv4 octet. More...
 
constexpr static uint32_t ADDRESS_MAC_POS_1 = 10
 Address position of first MAC octet. More...
 
constexpr static uint32_t ADDRESS_MAC_POS_2 = 11
 Address position of second MAC octet. More...
 
constexpr static uint32_t ADDRESS_MAC_POS_3 = 12
 Address position of third MAC octet. More...
 
constexpr static uint32_t ADDRESS_MAC_POS_4 = 13
 Address position of fourth MAC octet. More...
 
constexpr static uint32_t ADDRESS_MAC_POS_5 = 14
 Address position of fifth MAC octet. More...
 
constexpr static uint32_t ADDRESS_MAC_POS_6 = 15
 Address position of sixth MAC octet. More...
 
constexpr static uint32_t MAC_POS_1 = 0U
 Position of first MAC octet. More...
 
constexpr static uint32_t MAC_POS_2 = 1U
 Position of second MAC octet. More...
 
constexpr static uint32_t MAC_POS_3 = 2U
 Position of third MAC octet. More...
 
constexpr static uint32_t MAC_POS_4 = 3U
 Position of fourth MAC octet. More...
 
constexpr static uint32_t MAC_POS_5 = 4U
 Position of fifth MAC octet. More...
 
constexpr static uint32_t MAC_POS_6 = 5U
 Position of sixth MAC octet (prevent magic number detection by clang-tidy) More...
 
constexpr static uint16_t VLAN_ID_SHIFT = 20U
 Shift for VLAN ID in port field. More...
 
constexpr static uint16_t VLAN_ID_MASK = 0x0FFFU
 Mask for VLAN ID in port field. More...
 
constexpr static uint16_t VLAN_ID_MAX_VALUE = 4094U
 Maximum value for VLAN ID (12 bits) More...
 
constexpr static uint8_t PCP_SHIFT = 16U
 Shift for Priority Code Point in port field. More...
 
constexpr static uint8_t PCP_MASK = 0x0FU
 Mask for Priority Code Point in port field. More...
 
constexpr static uint8_t PCP_MAX_VALUE = 7U
 Maximum value for Priority Code Point (3 bits) More...
 
static constexpr uint32_t CDR_SERIALIZED_SIZE
 CDR serialized size. More...
 

Detailed Description

Stores remote address information.

Member Typedef Documentation

◆ IPv4

Type for IPv4 address.

◆ IPv6

◆ MAC

Member Enumeration Documentation

◆ LocatorKind

Locator.kind values reserved for known transport types.

Enumerator
INVALID 
RESERVED 
UDPv4 
UDPv6 
ETHERNET 
CUSTOM 

Member Function Documentation

◆ from_ipv4()

static Locator eprosima::safedds::transport::Locator::from_ipv4 ( const IPv4 locator_ipv4,
uint32_t  locator_port 
)
staticnoexcept

Get Locator from IPv4 address.

Parameters
locator_ipv4IPv4 address.
locator_portport number.
Returns
UDPv4 locator.

◆ from_mac()

static Locator eprosima::safedds::transport::Locator::from_mac ( const MAC mac_address,
uint16_t  logical_port,
uint16_t  vlan_id,
uint8_t  pcp 
)
staticnoexcept

Get Locator from MAC address, logical port, VLAN ID and PCP.

Parameters
mac_addressMAC address.
logical_portport number.
vlan_idVLAN ID.
pcpPriority Code Point.
Returns
Ethernet locator.

◆ get_ipv4()

ReturnCode eprosima::safedds::transport::Locator::get_ipv4 ( IPv4 ipv4) const
noexcept

Getter in Locator::IPv4 format.

Parameters
[out]ipv4output ipv4.
Returns
ReturnCode (shall fail if Locator kind is not UDPv4).

◆ get_mac()

ReturnCode eprosima::safedds::transport::Locator::get_mac ( MAC mac) const
noexcept

Getter in Locator::MAC format.

Parameters
[out]macoutput MAC address.
Returns
ReturnCode (shall fail if Locator kind is not ETHERNET).

Member Data Documentation

◆ address

memory::container::Array<uint8_t, ADDRESS_SIZE> eprosima::safedds::transport::Locator::address

Net address, size compatible with IPV4 and IPV6.

◆ ADDRESS_IPV4_POS_1

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_IPV4_POS_1 = 12
staticconstexpr

Address position of first IPv4 octet.

◆ ADDRESS_IPV4_POS_2

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_IPV4_POS_2 = 13
staticconstexpr

Address position of second IPv4 octet.

◆ ADDRESS_IPV4_POS_3

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_IPV4_POS_3 = 14
staticconstexpr

Address position of third IPv4 octet.

◆ ADDRESS_IPV4_POS_4

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_IPV4_POS_4 = 15
staticconstexpr

Address position of fourth IPv4 octet.

◆ ADDRESS_MAC_POS_1

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_MAC_POS_1 = 10
staticconstexpr

Address position of first MAC octet.

◆ ADDRESS_MAC_POS_2

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_MAC_POS_2 = 11
staticconstexpr

Address position of second MAC octet.

◆ ADDRESS_MAC_POS_3

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_MAC_POS_3 = 12
staticconstexpr

Address position of third MAC octet.

◆ ADDRESS_MAC_POS_4

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_MAC_POS_4 = 13
staticconstexpr

Address position of fourth MAC octet.

◆ ADDRESS_MAC_POS_5

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_MAC_POS_5 = 14
staticconstexpr

Address position of fifth MAC octet.

◆ ADDRESS_MAC_POS_6

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_MAC_POS_6 = 15
staticconstexpr

Address position of sixth MAC octet.

◆ ADDRESS_SIZE

constexpr static uint32_t eprosima::safedds::transport::Locator::ADDRESS_SIZE = 16
staticconstexpr

Size of locator address octet array.

◆ CDR_SERIALIZED_SIZE

constexpr uint32_t eprosima::safedds::transport::Locator::CDR_SERIALIZED_SIZE
staticconstexpr
Initial value:
=
portable::safe_sizeof<LocatorKind>() +
portable::safe_sizeof<uint32_t>() +
portable::safe_sizeof<uint8_t>() * ADDRESS_SIZE
constexpr static uint32_t ADDRESS_SIZE
Size of locator address octet array.
Definition: Locator.hpp:39

CDR serialized size.

◆ kind

LocatorKind eprosima::safedds::transport::Locator::kind

Kind of locator.

◆ MAC_ADDRESS_SIZE

constexpr static uint32_t eprosima::safedds::transport::Locator::MAC_ADDRESS_SIZE = 6
staticconstexpr

Size of MAC address octet array.

◆ MAC_POS_1

constexpr static uint32_t eprosima::safedds::transport::Locator::MAC_POS_1 = 0U
staticconstexpr

Position of first MAC octet.

◆ MAC_POS_2

constexpr static uint32_t eprosima::safedds::transport::Locator::MAC_POS_2 = 1U
staticconstexpr

Position of second MAC octet.

◆ MAC_POS_3

constexpr static uint32_t eprosima::safedds::transport::Locator::MAC_POS_3 = 2U
staticconstexpr

Position of third MAC octet.

◆ MAC_POS_4

constexpr static uint32_t eprosima::safedds::transport::Locator::MAC_POS_4 = 3U
staticconstexpr

Position of fourth MAC octet.

◆ MAC_POS_5

constexpr static uint32_t eprosima::safedds::transport::Locator::MAC_POS_5 = 4U
staticconstexpr

Position of fifth MAC octet.

◆ MAC_POS_6

constexpr static uint32_t eprosima::safedds::transport::Locator::MAC_POS_6 = 5U
staticconstexpr

Position of sixth MAC octet (prevent magic number detection by clang-tidy)

◆ PCP_MASK

constexpr static uint8_t eprosima::safedds::transport::Locator::PCP_MASK = 0x0FU
staticconstexpr

Mask for Priority Code Point in port field.

◆ PCP_MAX_VALUE

constexpr static uint8_t eprosima::safedds::transport::Locator::PCP_MAX_VALUE = 7U
staticconstexpr

Maximum value for Priority Code Point (3 bits)

◆ PCP_SHIFT

constexpr static uint8_t eprosima::safedds::transport::Locator::PCP_SHIFT = 16U
staticconstexpr

Shift for Priority Code Point in port field.

◆ port

uint32_t eprosima::safedds::transport::Locator::port

Net port value.

◆ VLAN_ID_MASK

constexpr static uint16_t eprosima::safedds::transport::Locator::VLAN_ID_MASK = 0x0FFFU
staticconstexpr

Mask for VLAN ID in port field.

◆ VLAN_ID_MAX_VALUE

constexpr static uint16_t eprosima::safedds::transport::Locator::VLAN_ID_MAX_VALUE = 4094U
staticconstexpr

Maximum value for VLAN ID (12 bits)

◆ VLAN_ID_SHIFT

constexpr static uint16_t eprosima::safedds::transport::Locator::VLAN_ID_SHIFT = 20U
staticconstexpr

Shift for VLAN ID in port field.


The documentation for this class was generated from the following file: