58#include "xdr_gen/xcom_vp.h"
60#define WORKING_BUFFER_SIZE 1024 * 1024
86 ULONG
flags = GAA_FLAG_INCLUDE_PREFIX, family = AF_UNSPEC, out_buflen = 0;
88 PIP_ADAPTER_ADDRESSES curr_addresses;
100 GetAdaptersAddresses(family,
flags,
nullptr, s->
addresses, &out_buflen);
103 while (curr_addresses) {
104 PIP_ADAPTER_UNICAST_ADDRESS_LH curr_unicast_address;
107 if (curr_addresses->OperStatus == IfOperStatusUp)
STRLIT(
"UP");
110 curr_unicast_address = curr_addresses->FirstUnicastAddress;
111 while (curr_unicast_address) {
112 if (curr_unicast_address->Address.lpSockaddr->sa_family == AF_INET ||
113 curr_unicast_address->Address.lpSockaddr->sa_family == AF_INET6) {
116 curr_unicast_address = curr_unicast_address->Next;
119 curr_addresses = curr_addresses->Next;
122 return retval != NO_ERROR;
161 PIP_ADAPTER_ADDRESSES curr_addresses = s->
addresses;
162 while (curr_addresses && (i <=
count)) {
163 PIP_ADAPTER_UNICAST_ADDRESS_LH curr_unicast_address =
164 curr_addresses->FirstUnicastAddress;
165 while (curr_unicast_address && (i <=
count)) {
166 if (curr_unicast_address->Address.lpSockaddr->sa_family == AF_INET ||
167 curr_unicast_address->Address.lpSockaddr->sa_family == AF_INET6) {
174 curr_unicast_address = curr_unicast_address->Next;
177 curr_addresses = curr_addresses->Next;
212 switch (addr_operation) {
230 struct sockaddr_in *out_value =
231 (
struct sockaddr_in *)
xcom_malloc(
sizeof(
struct sockaddr_in));
232 ConvertLengthToIpv4Mask(
234 &out_value->sin_addr.s_addr);
235 *out = (
struct sockaddr *)out_value;
238 struct sockaddr_in6 *out_value =
239 (
struct sockaddr_in6 *)
xcom_calloc(1,
sizeof(
struct sockaddr_in6));
241 i > 0; i -= 8, ++j) {
242 out_value->sin6_addr.s6_addr[j] =
243 i >= 8 ? 0xff : (ULONG)((0xffU << (8 - i)));
245 *out = (
struct sockaddr *)out_value;
#define IFDBG(mask, body)
Definition: gcs_debug.h:279
@ D_TRANSPORT
Definition: gcs_debug.h:178
#define STRLIT(x)
Definition: gcs_debug.h:316
static int flags[50]
Definition: hp_test1.cc:40
#define free(A)
Definition: lexyy.cc:915
static int count
Definition: myisam_ftdump.cc:45
SockaddrOp
Definition: sock_probe_ix.h:67
SockaddrOp
Definition: sock_probe_win32.h:79
@ kSockaddrOpAddress
Definition: sock_probe_win32.h:80
@ kSockaddrOpNetmask
Definition: sock_probe_win32.h:81
#define WORKING_BUFFER_SIZE
Definition: sock_probe_win32.h:60
static char * get_if_name(sock_probe *s, int count)
Definition: sock_probe_win32.h:263
static int init_sock_probe(sock_probe *s)
Definition: sock_probe_win32.h:85
struct sockaddr_in SOCKADDR_IN
Definition: sock_probe_win32.h:62
static void close_sock_probe(sock_probe *s)
Definition: sock_probe_win32.h:126
struct sockaddr sockaddr
Definition: sock_probe_win32.h:63
static void get_sockaddr_netmask(sock_probe *s, int count, struct sockaddr **out)
Definition: sock_probe_win32.h:258
static bool_t is_if_running(sock_probe *s, int)
Definition: sock_probe_win32.h:140
static interface_info get_interface(sock_probe *s, int count)
Definition: sock_probe_win32.h:154
struct interface_info interface_info
Definition: sock_probe_win32.h:152
static void get_sockaddr_address(sock_probe *s, int count, struct sockaddr **out)
Definition: sock_probe_win32.h:253
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 pa...
Definition: sock_probe_win32.h:197
static int number_of_interfaces(sock_probe *s)
Definition: sock_probe_win32.h:132
struct in_addr in_addr
Definition: sock_probe_win32.h:65
Definition: sock_probe_win32.h:148
PIP_ADAPTER_ADDRESSES network_interface
Definition: sock_probe_win32.h:149
PIP_ADAPTER_UNICAST_ADDRESS_LH network_address
Definition: sock_probe_win32.h:150
Definition: sock_probe_ix.h:54
PIP_ADAPTER_ADDRESSES addresses
Definition: sock_probe_win32.h:73
int number_of_interfaces
Definition: sock_probe_win32.h:74
Rudimentary task system in portable C, based on Tom Duff's switch-based coroutine trick and a stack o...
int bool_t
Definition: types.h:35
#define idx_check_fail(x, limit)
Definition: xcom_common.h:71
static void * xcom_malloc(size_t size)
Definition: xcom_memory.h:46
static void * xcom_calloc(size_t nmemb, size_t size)
Definition: xcom_memory.h:54