]> git.ipfire.org Git - thirdparty/gcc.git/blame - libphobos/libdruntime/core/sys/darwin/ifaddrs.d
Merge remote-tracking branch 'origin/master' into devel/c++-contracts
[thirdparty/gcc.git] / libphobos / libdruntime / core / sys / darwin / ifaddrs.d
CommitLineData
92dd3e71
IB
1/*******************************************************************************
2
3 Binding for Mac OSX's <ifaddr.h>, expose network interface addresses
4
5 The following functions are present as of Mac OSX 10.15:
6 - getifaddrs(3): get interface addresses
7 - freeifaddrs(3): deallocates the return value of `getifaddrs`
8 - getifmaddrs(3): get multicast group membership
9 - freeifmaddrs(3): deallocates the return value of `getifmaddrs`
10
11 Copyright: Copyright © 2020, The D Language Foundation
12 License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
13 Authors: Daniel Graczer
14
15*******************************************************************************/
16
17module core.sys.darwin.ifaddrs;
18
19version (OSX)
20 version = Darwin;
21else version (iOS)
22 version = Darwin;
23else version (TVOS)
24 version = Darwin;
25else version (WatchOS)
26 version = Darwin;
27
28version (Darwin):
29extern (C):
30nothrow:
31@nogc:
92dd3e71
IB
32
33import core.sys.posix.sys.socket;
34
35///
36struct ifaddrs
37{
38 /// Next item in the list
39 ifaddrs* ifa_next;
40 /// Name of the interface
41 char* ifa_name;
42 /// Flags from SIOCGIFFLAGS
43 uint ifa_flags;
44 /// Address of interface
45 sockaddr* ifa_addr;
46 /// Netmask of interface
47 sockaddr* ifa_netmask;
48 /// Point-to-point destination addresss
49 sockaddr* if_dstaddr;
50 /// Address specific data
51 void* ifa_data;
52}
53
54/// Returns: linked list of ifaddrs structures describing interfaces
55int getifaddrs(ifaddrs**);
56/// Frees the linked list returned by getifaddrs
57void freeifaddrs(ifaddrs*);
58
59///
60struct ifmaddrs
61{
62 /// Pointer to next struct
63 ifmaddrs* ifma_next;
64 /// Interface name (AF_LINK)
65 sockaddr* ifma_name;
66 /// Multicast address
67 sockaddr* ifma_addr;
68 /// Link-layer translation, if any
69 sockaddr* ifma_lladdr;
70}
71
72/// Stores a reference to a linked list of the multicast memberships
73/// on the local machine in the memory referenced by ifmaddrs
74int getifmaddrs(ifmaddrs**);
75/// Frees the list allocated by getifmaddrs
76void freeifmaddrs(ifmaddrs*);