def _interfaces():
 ifaddrs = ifaddrs_p()
 if (getifaddrs(pointer(ifaddrs)) < 0):
  raise OSError()
 results = []
 try:
  while ifaddrs:
   if ifaddrs[0].ifa_addr:
    family = ifaddrs[0].ifa_addr[0].sin_family
    if (family == AF_INET):
     addr = cast(ifaddrs[0].ifa_addr, POINTER(sockaddr_in))
    elif (family == AF_INET6):
     addr = cast(ifaddrs[0].ifa_addr, POINTER(sockaddr_in6))
    else:
     addr = None
    if addr:
     packed = ''.join(map(chr, addr[0].sin_addr.in_addr[:]))
     packed = _maybeCleanupScopeIndex(family, packed)
     results.append((ifaddrs[0].ifa_name, family, inet_ntop(family, packed)))
   ifaddrs = ifaddrs[0].ifa_next
 finally:
  freeifaddrs(ifaddrs)
 return results

def _interfaces ( ) : ifaddrs = ifaddrs_p ( ) if ( getifaddrs ( pointer ( ifaddrs ) ) < 0 ) : raise OSError ( ) results = [ ] try : while ifaddrs : if ifaddrs [ 0 ] . ifa_addr : family = ifaddrs [ 0 ] . ifa_addr [ 0 ] . sin_family if ( family == AF_INET ) : addr = cast ( ifaddrs [ 0 ] . ifa_addr , POINTER ( sockaddr_in ) ) elif ( family == AF_INET6 ) : addr = cast ( ifaddrs [ 0 ] . ifa_addr , POINTER ( sockaddr_in6 ) ) else : addr = None if addr : packed = '' . join ( map ( chr , addr [ 0 ] . sin_addr . in_addr [ : ] ) ) packed = _maybeCleanupScopeIndex ( family , packed ) results . append ( ( ifaddrs [ 0 ] . ifa_name , family , inet_ntop ( family , packed ) ) ) ifaddrs = ifaddrs [ 0 ] . ifa_next finally : freeifaddrs ( ifaddrs ) return results
call c{getifaddrs(3)} and return a list of tuples of interface name .