version 1.9, 2014/01/29 14:16:54
|
version 1.10.10.2, 2014/11/17 22:38:09
|
Line 242 e_gethostbyname(const char *psHost, u_short port, sock
|
Line 242 e_gethostbyname(const char *psHost, u_short port, sock
|
|
|
if (*psHost != '/') { |
if (*psHost != '/') { |
/* resolver */ |
/* resolver */ |
if (!addr->sa.sa_family) | host = gethostbyname2(psHost, !strchr(psHost, ':') ? AF_INET : AF_INET6); |
host = gethostbyname(psHost); | |
else | |
host = gethostbyname2(psHost, addr->sa.sa_family); | |
if (!host) { |
if (!host) { |
elwix_SetErr(EINVAL, "Resolver #%d - %s", h_errno, hstrerror(h_errno)); |
elwix_SetErr(EINVAL, "Resolver #%d - %s", h_errno, hstrerror(h_errno)); |
return NULL; |
return NULL; |
Line 445 e_getnet(const char *net)
|
Line 442 e_getnet(const char *net)
|
* |
* |
* @ifname = interface name |
* @ifname = interface name |
* @addr = if addr is !=NULL then set this for new address |
* @addr = if addr is !=NULL then set this for new address |
* return: NULL error or !=NULL get ethernet address | * return: NULL error or !=NULL get ethernet address should be e_free() |
*/ |
*/ |
ether_addr_t * |
ether_addr_t * |
e_ether_addr(const char *ifname, ether_addr_t * __restrict addr) |
e_ether_addr(const char *ifname, ether_addr_t * __restrict addr) |
Line 472 e_ether_addr(const char *ifname, ether_addr_t * __rest
|
Line 469 e_ether_addr(const char *ifname, ether_addr_t * __rest
|
freeifaddrs(ifa); |
freeifaddrs(ifa); |
|
|
return a; |
return a; |
|
} |
|
|
|
/* |
|
* e_get1stiface() - Get first interface of host |
|
* |
|
* @szIface = interface string buffer |
|
* @iflen = size of interface buffer |
|
* return: -1 error or 0 ok |
|
*/ |
|
int |
|
e_get1stiface(char *szIface, int iflen) |
|
{ |
|
struct ifaddrs *ifa; |
|
|
|
if (!szIface || !iflen) |
|
return -1; |
|
|
|
getifaddrs(&ifa); |
|
strlcpy(szIface, ifa->ifa_name, iflen); |
|
freeifaddrs(ifa); |
|
return 0; |
} |
} |