1 /******************************************************************************* 2 3 D binding for the interface addresses querying 4 5 Defines functions getifaddrs/freeifaddrs and the structure 6 they operate on. 7 8 getifaddrs(3) get interface addresses 9 freeifaddrs(3) deallocates the structure returned from getifaddrs 10 11 Copyright: Copyright (c) 2016 Sociomantic Labs. All rights reserved. 12 License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). 13 Authors: Nemanja Boric 14 15 *******************************************************************************/ 16 17 module core.sys.linux.ifaddrs; 18 19 import core.sys.posix.sys.socket; 20 21 version (linux): 22 extern (C): 23 nothrow: 24 @nogc: 25 @system: 26 27 struct ifaddrs 28 { 29 /// Next item in the list 30 ifaddrs* ifa_next; 31 /// Name of the interface 32 char* ifa_name; 33 /// Flags from SIOCGIFFLAGS 34 uint ifa_flags; 35 /// Address of interface 36 sockaddr* ifa_addr; 37 /// Netmask of interface 38 sockaddr* ifa_netmask; 39 40 union 41 { 42 /// Broadcast address of the interface 43 sockaddr* ifu_broadaddr; 44 /// Point-to-point destination addresss 45 sockaddr* if_dstaddr; 46 } 47 48 /// Address specific data 49 void* ifa_data; 50 } 51 52 /// Returns: linked list of ifaddrs structures describing interfaces 53 int getifaddrs(ifaddrs** ); 54 /// Frees the linked list returned by getifaddrs 55 void freeifaddrs(ifaddrs* ); 56