27#include <sys/sockio.h>
52#include "xdr_gen/xcom_vp.h"
79 struct ifaddrs *ifa_tmp;
93 if ((ifa_tmp->ifa_addr) && ((ifa_tmp->ifa_addr->sa_family == AF_INET) ||
94 (ifa_tmp->ifa_addr->sa_family == AF_INET6))) {
97 ifa_tmp = ifa_tmp->ifa_next;
121 struct ifaddrs *net_if =
nullptr;
130 while (net_if !=
nullptr) {
131 if ((net_if->ifa_addr) && ((net_if->ifa_addr->sa_family == AF_INET) ||
132 (net_if->ifa_addr->sa_family == AF_INET6))) {
139 net_if = net_if->ifa_next;
147 struct ifaddrs *net_if =
nullptr;
154 return net_if !=
nullptr && (net_if->ifa_flags & IFF_UP) &&
155 (net_if->ifa_flags & IFF_RUNNING);
173 if (net_if ==
nullptr) {
178 switch (addr_operation) {
180 *out = (
struct sockaddr *)net_if->ifa_addr;
183 *out = (
struct sockaddr *)net_if->ifa_netmask;
193 return net_if !=
nullptr ? net_if->ifa_name :
nullptr;
#define free(A)
Definition: lexyy.cc:915
static int count
Definition: myisam_ftdump.cc:45
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:927
SockaddrOp
Definition: sock_probe_ix.h:67
@ kSockaddrOpAddress
Definition: sock_probe_ix.h:68
@ kSockaddrOpNetmask
Definition: sock_probe_ix.h:69
static char * get_if_name(sock_probe *s, int count)
Definition: sock_probe_ix.h:190
static bool_t is_if_running(sock_probe *s, int count)
Definition: sock_probe_ix.h:146
static int init_sock_probe(sock_probe *s)
Definition: sock_probe_ix.h:78
static void close_sock_probe(sock_probe *s)
Definition: sock_probe_ix.h:106
static void get_sockaddr_netmask(sock_probe *s, int count, struct sockaddr **out)
Definition: sock_probe_ix.h:163
static struct ifaddrs * get_interface(sock_probe *s, int count)
Definition: sock_probe_ix.h:120
static void get_sockaddr_address(sock_probe *s, int count, struct sockaddr **out)
Definition: sock_probe_ix.h:158
static void get_sockaddr(sock_probe *s, int count, struct sockaddr **out, SockaddrOp addr_operation)
Definition: sock_probe_ix.h:169
static int number_of_interfaces(sock_probe *s)
Definition: sock_probe_ix.h:112
struct sockaddr sockaddr
Definition: sock_probe_win32.h:63
Definition: sock_probe_ix.h:54
int nbr_ifs
Definition: sock_probe_ix.h:55
struct ifaddrs * interfaces
Definition: sock_probe_ix.h:56
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_ret(x, limit, ret)
Definition: xcom_common.h:65