MySQL  8.0.22
Source Code Documentation
sock_probe_win32.cc File Reference

Utility functions to check if a network address or name matches an interface on the machine we are running on. More...

#include <windows.h>
#include <assert.h>
#include <errno.h>
#include <iphlpapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include "xcom/node_no.h"
#include "xcom/simset.h"
#include "xcom/sock_probe.h"
#include "xcom/task.h"
#include "xcom/task_debug.h"
#include "xcom/task_net.h"
#include "xcom/task_os.h"
#include "xcom/xcom_base.h"
#include "xcom/xcom_common.h"
#include "xcom/xcom_memory.h"
#include "xcom/xcom_profile.h"
#include "xcom/xcom_transport.h"
#include "xdr_gen/xcom_vp.h"

Classes

struct  sock_probe
 
struct  interface_info
 

Macros

#define FD_SETSIZE   256
 
#define BSD_COMP
 
#define WORKING_BUFFER_SIZE   1024 * 1024
 

Typedefs

typedef struct sockaddr_in SOCKADDR_IN
 
typedef struct sockaddr sockaddr
 
typedef struct in_addr in_addr
 
typedef struct sock_probe sock_probe
 
typedef enum SockaddrOp SockaddrOp
 
typedef struct interface_info interface_info
 

Enumerations

enum  SockaddrOp { kSockaddrOpAddress = 0, kSockaddrOpNetmask, kSockaddrOpAddress = 0, kSockaddrOpNetmask }
 

Functions

static int init_sock_probe (sock_probe *s)
 
static void close_sock_probe (sock_probe *s)
 
static int number_of_interfaces (sock_probe *s)
 
static bool_t is_if_running (sock_probe *s, int count)
 
static interface_info get_interface (sock_probe *s, int count)
 
static void get_sockaddr (sock_probe *s, int count, struct sockaddr **out, SockaddrOp addr_operation)
 Get the sockaddr object that pertains to a certain interface index Depending of the addr_operation parameter value, it can be from: More...
 
static void get_sockaddr_address (sock_probe *s, int count, struct sockaddr **out)
 
static void get_sockaddr_netmask (sock_probe *s, int count, struct sockaddr **out)
 
static char * get_if_name (sock_probe *s, int count)
 

Detailed Description

Utility functions to check if a network address or name matches an interface on the machine we are running on.

This is useful to deduce the node number from a list of network addresses or names. The node number is the index of the list element which matches.

Macro Definition Documentation

◆ BSD_COMP

#define BSD_COMP

◆ FD_SETSIZE

#define FD_SETSIZE   256

◆ WORKING_BUFFER_SIZE

#define WORKING_BUFFER_SIZE   1024 * 1024

Typedef Documentation

◆ in_addr

typedef struct in_addr in_addr

◆ interface_info

◆ sock_probe

typedef struct sock_probe sock_probe

◆ sockaddr

typedef struct sockaddr sockaddr

◆ SOCKADDR_IN

typedef struct sockaddr_in SOCKADDR_IN

◆ SockaddrOp

typedef enum SockaddrOp SockaddrOp

Enumeration Type Documentation

◆ SockaddrOp

enum SockaddrOp
Enumerator
kSockaddrOpAddress 
kSockaddrOpNetmask 
kSockaddrOpAddress 
kSockaddrOpNetmask 

Function Documentation

◆ close_sock_probe()

static void close_sock_probe ( sock_probe s)
static

◆ get_if_name()

static char* get_if_name ( sock_probe s,
int  count 
)
static

◆ get_interface()

static interface_info get_interface ( sock_probe s,
int  count 
)
static

◆ get_sockaddr()

static void get_sockaddr ( sock_probe s,
int  count,
struct sockaddr **  out,
SockaddrOp  addr_operation 
)
static

Get the sockaddr object that pertains to a certain interface index Depending of the addr_operation parameter value, it can be from:

  • Netmask
  • Physical Address
Parameters
san initialized sock_probe structure
countthe interface index to return
outthe return value sockaddr. NULL in case of error.
addr_operationeither request the sockaddr for the physical address or for a netmask

◆ get_sockaddr_address()

static void get_sockaddr_address ( sock_probe s,
int  count,
struct sockaddr **  out 
)
static

◆ get_sockaddr_netmask()

static void get_sockaddr_netmask ( sock_probe s,
int  count,
struct sockaddr **  out 
)
static

◆ init_sock_probe()

static int init_sock_probe ( sock_probe s)
static

◆ is_if_running()

static bool_t is_if_running ( sock_probe s,
int  count 
)
static

◆ number_of_interfaces()

static int number_of_interfaces ( sock_probe s)
static