MySQL 8.0.40
Source Code Documentation
|
#include <errno.h>
#include <algorithm>
#include <bitset>
#include <cstring>
#include <set>
#include <netdb.h>
#include "plugin/group_replication/libmysqlgcs/include/mysql/gcs/gcs_group_identifier.h"
#include "plugin/group_replication/libmysqlgcs/include/mysql/gcs/gcs_logging_system.h"
#include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_group_member_information.h"
#include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_networking.h"
#include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_utils.h"
#include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/sock_probe.h"
#include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/sock_probe_ix.h"
Functions | |
bool | is_ipv4_address (const std::string &possible_ip) |
Check if it contains an attempt of having an IP v4 address. More... | |
bool | is_ipv6_address (const std::string &possible_ip) |
Check if it contains an attempt of having an IP v6 address. More... | |
static bool | is_address_localhost (const std::string &address) |
Determines if a given address is an IP localhost address. More... | |
bool | get_local_addresses (Gcs_sock_probe_interface &sock_probe_if, std::map< std::string, int > &addr_to_cidr_bits, bool filter_out_inactive) |
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) |
This function gets all private network addresses and their subnet masks as a string. 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 | 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 | string_to_sockaddr (const std::string &addr, struct sockaddr_storage *sa) |
Given the address as a string, gets the IP encoded as an integer. More... | |
static bool | sock_descriptor_to_sockaddr (int fd, struct sockaddr_storage *sa) |
Returns the address in unsigned integer. More... | |
static bool | sock_descriptor_to_string (int fd, std::string &out) |
This function is a frontend function to inet_ntop. 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... | |
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.
[in] | addr | IP address in X.X.X.X format |
[in] | mask | Network mask associated with the address |
[out] | out_pair | IP address and netmask, in binary format (network byte order) |
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.
[out] | sock_probe | Socket probe interface |
[out] | out | maps IP addresses to subnetmasks |
filter_out_inactive | If set to true, only active interfaces will be added to out |
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.
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.
|
static |
Determines if a given address is an IP localhost address.
[in] | address | a reference to a string containing the address to test |
bool is_ipv4_address | ( | const std::string & | possible_ip | ) |
Check if it contains an attempt of having an IP v4 address.
It does not check for its validity, but only if it contains all authorized characters: numbers and dots.
bool is_ipv6_address | ( | const std::string & | possible_ip | ) |
Check if it contains an attempt of having an IP v6 address.
It does not check for its validity, but it checks if it contains : character
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.
[in] | name | The hostname to translate. |
[out] | ips | The IP addresses after translation. |
bool resolve_ip_addr_from_hostname | ( | std::string | name, |
std::vector< std::string > & | ip | ||
) |
This function translates hostname to all possible IP addresses.
[in] | name | The hostname to translate. |
[out] | ip | The IP addresses after translation. |
|
static |
Returns the address in unsigned integer.
|
static |
This function is a frontend function to inet_ntop.
bool string_to_sockaddr | ( | const std::string & | addr, |
struct sockaddr_storage * | sa | ||
) |
Given the address as a string, gets the IP encoded as an integer.
Try IPv4 first.
Try IPv6.