1 /**
2  * D header file for POSIX.
3  *
4  * Copyright: Copyright Sean Kelly 2005 - 2009.
5  * License:   $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
6  * Authors:   Sean Kelly
7  * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
8  */
9 
10 /*          Copyright Sean Kelly 2005 - 2009.
11  * Distributed under the Boost Software License, Version 1.0.
12  *    (See accompanying file LICENSE or copy at
13  *          http://www.boost.org/LICENSE_1_0.txt)
14  */
15 module core.sys.posix.net.if_;
16 
17 import core.sys.posix.config;
18 
19 version (OSX)
20     version = Darwin;
21 else version (iOS)
22     version = Darwin;
23 else version (TVOS)
24     version = Darwin;
25 else version (WatchOS)
26     version = Darwin;
27 
28 version (Posix):
29 extern (C) nothrow @nogc:
30 
31 //
32 // Required
33 //
34 /*
35 struct if_nameindex // renamed to if_nameindex_t
36 {
37     uint    if_index;
38     char*   if_name;
39 }
40 
41 IF_NAMESIZE
42 
43 uint            if_nametoindex(const scope char*);
44 char*           if_indextoname(uint, char*);
45 if_nameindex_t* if_nameindex();
46 void            if_freenameindex(if_nameindex_t*);
47 */
48 
49 version (CRuntime_Glibc)
50 {
51     struct if_nameindex_t
52     {
53         uint    if_index;
54         char*   if_name;
55     }
56 
57     enum IF_NAMESIZE = 16;
58 
59     uint            if_nametoindex(const scope char*);
60     char*           if_indextoname(uint, char*);
61     if_nameindex_t* if_nameindex();
62     void            if_freenameindex(if_nameindex_t*);
63 }
64 else version (Darwin)
65 {
66     struct if_nameindex_t
67     {
68         uint    if_index;
69         char*   if_name;
70     }
71 
72     enum IF_NAMESIZE = 16;
73 
74     uint            if_nametoindex(const scope char*);
75     char*           if_indextoname(uint, char*);
76     if_nameindex_t* if_nameindex();
77     void            if_freenameindex(if_nameindex_t*);
78 }
79 else version (FreeBSD)
80 {
81     struct if_nameindex_t
82     {
83         uint    if_index;
84         char*   if_name;
85     }
86 
87     enum IF_NAMESIZE = 16;
88 
89     uint            if_nametoindex(const scope char*);
90     char*           if_indextoname(uint, char*);
91     if_nameindex_t* if_nameindex();
92     void            if_freenameindex(if_nameindex_t*);
93 }
94 else version (NetBSD)
95 {
96     struct if_nameindex_t
97     {
98         uint    if_index;
99         char*   if_name;
100     }
101 
102     enum IF_NAMESIZE = 16;
103 
104     uint            if_nametoindex(const scope char*);
105     char*           if_indextoname(uint, char*);
106     if_nameindex_t* if_nameindex();
107     void            if_freenameindex(if_nameindex_t*);
108 }
109 else version (OpenBSD)
110 {
111     struct if_nameindex_t
112     {
113         uint    if_index;
114         char*   if_name;
115     }
116 
117     enum IF_NAMESIZE = 16;
118 
119     uint            if_nametoindex(const scope char*);
120     char*           if_indextoname(uint, char*);
121     if_nameindex_t* if_nameindex();
122     void            if_freenameindex(if_nameindex_t*);
123 }
124 else version (DragonFlyBSD)
125 {
126     struct if_nameindex_t
127     {
128         uint    if_index;
129         char*   if_name;
130     }
131 
132     enum IF_NAMESIZE = 16;
133 
134     uint            if_nametoindex(const scope char*);
135     char*           if_indextoname(uint, char*);
136     if_nameindex_t* if_nameindex();
137     void            if_freenameindex(if_nameindex_t*);
138 }
139 else version (CRuntime_Bionic)
140 {
141     enum IF_NAMESIZE = 16;
142 
143     uint            if_nametoindex(const scope char*);
144     char*           if_indextoname(uint, char*);
145 }
146 else version (CRuntime_UClibc)
147 {
148     struct if_nameindex_t
149     {
150         uint    if_index;
151         char*   if_name;
152     }
153 
154     enum IF_NAMESIZE = 16;
155 
156     uint            if_nametoindex(const scope char*);
157     char*           if_indextoname(uint, char*);
158     if_nameindex_t* if_nameindex();
159     void            if_freenameindex(if_nameindex_t*);
160 }