1104476Ssam/******************************************************************************* 2104476Ssam 3104476Ssam D binding for the interface addresses querying 4139825Simp 5104476Ssam Defines functions getifaddrs/freeifaddrs and the structure 6104476Ssam they operate on. 7104476Ssam 8104476Ssam getifaddrs(3) get interface addresses 9104476Ssam freeifaddrs(3) deallocates the structure returned from getifaddrs 10104476Ssam 11104476Ssam Copyright: Copyright (c) 2016 Sociomantic Labs. All rights reserved. 12275732Sjmg License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). 13275732Sjmg Authors: Nemanja Boric 14104476Ssam 15275732Sjmg*******************************************************************************/ 16275732Sjmg 17275732Sjmgmodule core.sys.linux.ifaddrs; 18275732Sjmg 19104476Ssamimport core.sys.posix.sys.socket; 20104476Ssam 21104476Ssamversion (linux): 22104476Ssamextern (C): 23104476Ssamnothrow: 24104476Ssam@nogc: 25104476Ssam@system: 26104476Ssam 27104476Ssamstruct ifaddrs 28104476Ssam{ 29104476Ssam /// Next item in the list 30104476Ssam ifaddrs* ifa_next; 31104476Ssam /// Name of the interface 32104476Ssam char* ifa_name; 33104476Ssam /// Flags from SIOCGIFFLAGS 34104476Ssam uint ifa_flags; 35104476Ssam /// Address of interface 36292782Sallanjude sockaddr* ifa_addr; 37292782Sallanjude /// Netmask of interface 38292782Sallanjude sockaddr* ifa_netmask; 39104476Ssam 40275732Sjmg union 41104476Ssam { 42104476Ssam /// Broadcast address of the interface 43104476Ssam sockaddr* ifu_broadaddr; 44104476Ssam /// Point-to-point destination addresss 45104476Ssam sockaddr* if_dstaddr; 46104476Ssam } 47104476Ssam 48275732Sjmg /// Address specific data 49158703Spjd void* ifa_data; 50104476Ssam} 51275732Sjmg 52275732Sjmg/// Returns: linked list of ifaddrs structures describing interfaces 53275732Sjmgint getifaddrs(ifaddrs** ); 54104476Ssam/// Frees the linked list returned by getifaddrs 55104476Ssamvoid freeifaddrs(ifaddrs* ); 56104476Ssam