MySQL 9.1.0
Source Code Documentation
gcs_xcom_networking.h File Reference

Go to the source code of this file.

Classes

class  Gcs_sock_probe_interface
 Interface to decouple XCom sock_probe implementation to allow unit testing. More...
 
class  Gcs_sock_probe_interface_impl
 
class  Gcs_ip_allowlist_entry
 Base abstract class for the allowlist entries. More...
 
struct  Gcs_ip_allowlist_entry_pointer_comparator
 
class  Gcs_ip_allowlist_entry_ip
 Implementation of Gcs_ip_allowlist_entry to use with raw IP addresses in format X.X.X.X/XX. More...
 
class  Gcs_ip_allowlist_entry_hostname
 Implementation of Gcs_ip_allowlist_entry to use with hostnames. More...
 
class  Gcs_ip_allowlist
 
class  Gcs_ip_allowlist::Atomic_lock_guard
 

Functions

bool get_local_addresses (Gcs_sock_probe_interface &sock_probe, std::map< std::string, int > &out, bool filter_out_inactive=false)
 This function gets all network addresses on this host and their subnet masks as a string. More...
 
bool get_local_private_addresses (std::map< std::string, int > &out, bool filter_out_inactive=false)
 This function gets all private network addresses and their subnet masks as a string. More...
 
bool resolve_all_ip_addr_from_hostname (std::string name, std::vector< std::pair< sa_family_t, std::string > > &ips)
 This function translates hostnames to all possible IP addresses. More...
 
bool resolve_ip_addr_from_hostname (std::string name, std::vector< std::string > &ip)
 This function translates hostname to all possible IP addresses. More...
 
bool get_address_for_allowlist (std::string addr, std::string mask, std::pair< std::vector< unsigned char >, std::vector< unsigned char > > &out_pair)
 Converts an address in string format (X.X.X.X/XX) into network octet format. More...
 

Function Documentation

◆ get_address_for_allowlist()

bool get_address_for_allowlist ( std::string  addr,
std::string  mask,
std::pair< std::vector< unsigned char >, std::vector< unsigned char > > &  out_pair 
)

Converts an address in string format (X.X.X.X/XX) into network octet format.

Parameters
[in]addrIP address in X.X.X.X format
[in]maskNetwork mask associated with the address
[out]out_pairIP address and netmask, in binary format (network byte order)
Returns
false on success, true otherwise.

◆ get_local_addresses()

bool get_local_addresses ( Gcs_sock_probe_interface sock_probe,
std::map< std::string, int > &  out,
bool  filter_out_inactive = false 
)

This function gets all network addresses on this host and their subnet masks as a string.

Parameters
[out]sock_probeSocket probe interface
[out]outmaps IP addresses to subnetmasks
filter_out_inactiveIf set to true, only active interfaces will be added to out
Returns
false on success, true otherwise.

◆ get_local_private_addresses()

bool get_local_private_addresses ( std::map< std::string, int > &  out,
bool  filter_out_inactive 
)

This function gets all private network addresses and their subnet masks as a string.

IPv4 only. (SOCK_STREAM only)

Parameters
[out]outmaps IP addresses to subnetmasks
filter_out_inactiveIf set to true, only active interfaces will be added to out
Returns
false on success, true otherwise.

In the Internet addressing architecture, a private network is a network that uses private IP address space. Both, the IPv4 and the IPv6 specifications define private addressing ranges. These addresses are commonly used for local area networks (LANs) in residential, office, and enterprise environments. Private IP address spaces were originally defined in an effort to delay IPv4 address exhaustion.

◆ resolve_all_ip_addr_from_hostname()

bool resolve_all_ip_addr_from_hostname ( std::string  name,
std::vector< std::pair< sa_family_t, std::string > > &  ips 
)

This function translates hostnames to all possible IP addresses.

Parameters
[in]nameThe hostname to translate.
[out]ipsThe IP addresses after translation.
Returns
false on success, true otherwise.

◆ resolve_ip_addr_from_hostname()

bool resolve_ip_addr_from_hostname ( std::string  name,
std::vector< std::string > &  ip 
)

This function translates hostname to all possible IP addresses.

Parameters
[in]nameThe hostname to translate.
[out]ipThe IP addresses after translation.
Returns
false on success, true otherwise.