system_configuration_sys/
network_configuration.rs

1/* automatically generated by rust-bindgen 0.66.1 */
2
3// Generated using:
4// bindgen 0.66.1
5// macOS SDK 13.3.
6
7use core::ffi::c_void;
8use core_foundation_sys::array::CFArrayRef;
9use core_foundation_sys::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID};
10use core_foundation_sys::dictionary::CFDictionaryRef;
11use core_foundation_sys::runloop::CFRunLoopRef;
12use core_foundation_sys::string::CFStringRef;
13
14use crate::dispatch_queue_t;
15use crate::preferences::SCPreferencesRef;
16use libc::{sockaddr, socklen_t};
17
18pub type __SCNetworkConnection = c_void;
19pub type __SCNetworkInterface = c_void;
20pub type __SCBondStatus = c_void;
21pub type __SCNetworkProtocol = c_void;
22pub type __SCNetworkService = c_void;
23pub type __SCNetworkSet = c_void;
24
25pub type SCNetworkConnectionFlags = u32;
26extern "C" {
27    pub fn SCNetworkCheckReachabilityByAddress(
28        address: *const sockaddr,
29        addrlen: socklen_t,
30        flags: *mut SCNetworkConnectionFlags,
31    ) -> Boolean;
32
33    pub fn SCNetworkCheckReachabilityByName(
34        nodename: *const ::core::ffi::c_char,
35        flags: *mut SCNetworkConnectionFlags,
36    ) -> Boolean;
37
38    pub fn SCNetworkInterfaceRefreshConfiguration(ifName: CFStringRef) -> Boolean;
39}
40pub type SCNetworkConnectionRef = *const __SCNetworkConnection;
41#[repr(C)]
42pub struct SCNetworkConnectionContext {
43    pub version: CFIndex,
44    pub info: *mut ::core::ffi::c_void,
45    pub retain: Option<
46        unsafe extern "C" fn(info: *const ::core::ffi::c_void) -> *const ::core::ffi::c_void,
47    >,
48    pub release: Option<unsafe extern "C" fn(info: *const ::core::ffi::c_void)>,
49    pub copyDescription:
50        Option<unsafe extern "C" fn(info: *const ::core::ffi::c_void) -> CFStringRef>,
51}
52pub type SCNetworkConnectionStatus = i32;
53pub type SCNetworkConnectionCallBack = Option<
54    unsafe extern "C" fn(
55        connection: SCNetworkConnectionRef,
56        status: SCNetworkConnectionStatus,
57        info: *mut ::core::ffi::c_void,
58    ),
59>;
60extern "C" {
61    pub fn SCNetworkConnectionGetTypeID() -> CFTypeID;
62
63    pub fn SCNetworkConnectionCopyUserPreferences(
64        selectionOptions: CFDictionaryRef,
65        serviceID: *mut CFStringRef,
66        userOptions: *mut CFDictionaryRef,
67    ) -> Boolean;
68
69    pub fn SCNetworkConnectionCreateWithServiceID(
70        allocator: CFAllocatorRef,
71        serviceID: CFStringRef,
72        callout: SCNetworkConnectionCallBack,
73        context: *mut SCNetworkConnectionContext,
74    ) -> SCNetworkConnectionRef;
75
76    pub fn SCNetworkConnectionCopyServiceID(connection: SCNetworkConnectionRef) -> CFStringRef;
77
78    pub fn SCNetworkConnectionGetStatus(
79        connection: SCNetworkConnectionRef,
80    ) -> SCNetworkConnectionStatus;
81
82    pub fn SCNetworkConnectionCopyExtendedStatus(
83        connection: SCNetworkConnectionRef,
84    ) -> CFDictionaryRef;
85
86    pub fn SCNetworkConnectionCopyStatistics(connection: SCNetworkConnectionRef)
87        -> CFDictionaryRef;
88
89    pub fn SCNetworkConnectionStart(
90        connection: SCNetworkConnectionRef,
91        userOptions: CFDictionaryRef,
92        linger: Boolean,
93    ) -> Boolean;
94
95    pub fn SCNetworkConnectionStop(
96        connection: SCNetworkConnectionRef,
97        forceDisconnect: Boolean,
98    ) -> Boolean;
99
100    pub fn SCNetworkConnectionCopyUserOptions(
101        connection: SCNetworkConnectionRef,
102    ) -> CFDictionaryRef;
103
104    pub fn SCNetworkConnectionScheduleWithRunLoop(
105        connection: SCNetworkConnectionRef,
106        runLoop: CFRunLoopRef,
107        runLoopMode: CFStringRef,
108    ) -> Boolean;
109
110    pub fn SCNetworkConnectionUnscheduleFromRunLoop(
111        connection: SCNetworkConnectionRef,
112        runLoop: CFRunLoopRef,
113        runLoopMode: CFStringRef,
114    ) -> Boolean;
115
116    pub fn SCNetworkConnectionSetDispatchQueue(
117        connection: SCNetworkConnectionRef,
118        queue: dispatch_queue_t,
119    ) -> Boolean;
120}
121pub type SCNetworkInterfaceRef = *const __SCNetworkInterface;
122extern "C" {
123    pub static kSCNetworkInterfaceType6to4: CFStringRef;
124
125    pub static kSCNetworkInterfaceTypeBluetooth: CFStringRef;
126
127    pub static kSCNetworkInterfaceTypeBond: CFStringRef;
128
129    pub static kSCNetworkInterfaceTypeEthernet: CFStringRef;
130
131    pub static kSCNetworkInterfaceTypeFireWire: CFStringRef;
132
133    pub static kSCNetworkInterfaceTypeIEEE80211: CFStringRef;
134
135    pub static kSCNetworkInterfaceTypeIPSec: CFStringRef;
136
137    pub static kSCNetworkInterfaceTypeIrDA: CFStringRef;
138
139    pub static kSCNetworkInterfaceTypeL2TP: CFStringRef;
140
141    pub static kSCNetworkInterfaceTypeModem: CFStringRef;
142
143    pub static kSCNetworkInterfaceTypePPP: CFStringRef;
144
145    pub static kSCNetworkInterfaceTypePPTP: CFStringRef;
146
147    pub static kSCNetworkInterfaceTypeSerial: CFStringRef;
148
149    pub static kSCNetworkInterfaceTypeVLAN: CFStringRef;
150
151    pub static kSCNetworkInterfaceTypeWWAN: CFStringRef;
152
153    pub static kSCNetworkInterfaceTypeIPv4: CFStringRef;
154
155    pub static kSCNetworkInterfaceIPv4: SCNetworkInterfaceRef;
156}
157pub type SCBondInterfaceRef = SCNetworkInterfaceRef;
158pub type SCBondStatusRef = *const __SCBondStatus;
159pub const kSCBondStatusOK: _bindgen_ty_286 = 0;
160pub const kSCBondStatusLinkInvalid: _bindgen_ty_286 = 1;
161pub const kSCBondStatusNoPartner: _bindgen_ty_286 = 2;
162pub const kSCBondStatusNotInActiveGroup: _bindgen_ty_286 = 3;
163pub const kSCBondStatusUnknown: _bindgen_ty_286 = 999;
164pub type _bindgen_ty_286 = ::core::ffi::c_uint;
165extern "C" {
166    pub static kSCBondStatusDeviceAggregationStatus: CFStringRef;
167
168    pub static kSCBondStatusDeviceCollecting: CFStringRef;
169
170    pub static kSCBondStatusDeviceDistributing: CFStringRef;
171}
172pub type SCNetworkProtocolRef = *const __SCNetworkProtocol;
173pub type SCNetworkServiceRef = *const __SCNetworkService;
174pub type SCNetworkSetRef = *const __SCNetworkSet;
175extern "C" {
176    pub fn SCNetworkInterfaceGetTypeID() -> CFTypeID;
177
178    pub fn SCNetworkInterfaceCopyAll() -> CFArrayRef;
179
180    pub fn SCNetworkInterfaceGetSupportedInterfaceTypes(
181        interface: SCNetworkInterfaceRef,
182    ) -> CFArrayRef;
183
184    pub fn SCNetworkInterfaceGetSupportedProtocolTypes(
185        interface: SCNetworkInterfaceRef,
186    ) -> CFArrayRef;
187
188    pub fn SCNetworkInterfaceCreateWithInterface(
189        interface: SCNetworkInterfaceRef,
190        interfaceType: CFStringRef,
191    ) -> SCNetworkInterfaceRef;
192
193    pub fn SCNetworkInterfaceGetBSDName(interface: SCNetworkInterfaceRef) -> CFStringRef;
194
195    pub fn SCNetworkInterfaceGetConfiguration(interface: SCNetworkInterfaceRef) -> CFDictionaryRef;
196
197    pub fn SCNetworkInterfaceGetExtendedConfiguration(
198        interface: SCNetworkInterfaceRef,
199        extendedType: CFStringRef,
200    ) -> CFDictionaryRef;
201
202    pub fn SCNetworkInterfaceGetHardwareAddressString(
203        interface: SCNetworkInterfaceRef,
204    ) -> CFStringRef;
205
206    pub fn SCNetworkInterfaceGetInterface(
207        interface: SCNetworkInterfaceRef,
208    ) -> SCNetworkInterfaceRef;
209
210    pub fn SCNetworkInterfaceGetInterfaceType(interface: SCNetworkInterfaceRef) -> CFStringRef;
211
212    pub fn SCNetworkInterfaceGetLocalizedDisplayName(
213        interface: SCNetworkInterfaceRef,
214    ) -> CFStringRef;
215
216    pub fn SCNetworkInterfaceSetConfiguration(
217        interface: SCNetworkInterfaceRef,
218        config: CFDictionaryRef,
219    ) -> Boolean;
220
221    pub fn SCNetworkInterfaceSetExtendedConfiguration(
222        interface: SCNetworkInterfaceRef,
223        extendedType: CFStringRef,
224        config: CFDictionaryRef,
225    ) -> Boolean;
226
227    pub fn SCNetworkInterfaceCopyMediaOptions(
228        interface: SCNetworkInterfaceRef,
229        current: *mut CFDictionaryRef,
230        active: *mut CFDictionaryRef,
231        available: *mut CFArrayRef,
232        filter: Boolean,
233    ) -> Boolean;
234
235    pub fn SCNetworkInterfaceCopyMediaSubTypes(available: CFArrayRef) -> CFArrayRef;
236
237    pub fn SCNetworkInterfaceCopyMediaSubTypeOptions(
238        available: CFArrayRef,
239        subType: CFStringRef,
240    ) -> CFArrayRef;
241
242    pub fn SCNetworkInterfaceCopyMTU(
243        interface: SCNetworkInterfaceRef,
244        mtu_cur: *mut ::core::ffi::c_int,
245        mtu_min: *mut ::core::ffi::c_int,
246        mtu_max: *mut ::core::ffi::c_int,
247    ) -> Boolean;
248
249    pub fn SCNetworkInterfaceSetMediaOptions(
250        interface: SCNetworkInterfaceRef,
251        subtype: CFStringRef,
252        options: CFArrayRef,
253    ) -> Boolean;
254
255    pub fn SCNetworkInterfaceSetMTU(
256        interface: SCNetworkInterfaceRef,
257        mtu: ::core::ffi::c_int,
258    ) -> Boolean;
259
260    pub fn SCNetworkInterfaceForceConfigurationRefresh(interface: SCNetworkInterfaceRef)
261        -> Boolean;
262
263    pub fn SCBondInterfaceCopyAll(prefs: SCPreferencesRef) -> CFArrayRef;
264
265    pub fn SCBondInterfaceCopyAvailableMemberInterfaces(prefs: SCPreferencesRef) -> CFArrayRef;
266
267    pub fn SCBondInterfaceCreate(prefs: SCPreferencesRef) -> SCBondInterfaceRef;
268
269    pub fn SCBondInterfaceRemove(bond: SCBondInterfaceRef) -> Boolean;
270
271    pub fn SCBondInterfaceGetMemberInterfaces(bond: SCBondInterfaceRef) -> CFArrayRef;
272
273    pub fn SCBondInterfaceGetOptions(bond: SCBondInterfaceRef) -> CFDictionaryRef;
274
275    pub fn SCBondInterfaceSetMemberInterfaces(
276        bond: SCBondInterfaceRef,
277        members: CFArrayRef,
278    ) -> Boolean;
279
280    pub fn SCBondInterfaceSetLocalizedDisplayName(
281        bond: SCBondInterfaceRef,
282        newName: CFStringRef,
283    ) -> Boolean;
284
285    pub fn SCBondInterfaceSetOptions(
286        bond: SCBondInterfaceRef,
287        newOptions: CFDictionaryRef,
288    ) -> Boolean;
289
290    pub fn SCBondInterfaceCopyStatus(bond: SCBondInterfaceRef) -> SCBondStatusRef;
291
292    pub fn SCNetworkProtocolGetTypeID() -> CFTypeID;
293
294    pub fn SCNetworkProtocolGetConfiguration(protocol: SCNetworkProtocolRef) -> CFDictionaryRef;
295
296    pub fn SCNetworkProtocolGetEnabled(protocol: SCNetworkProtocolRef) -> Boolean;
297
298    pub fn SCNetworkProtocolGetProtocolType(protocol: SCNetworkProtocolRef) -> CFStringRef;
299
300    pub fn SCNetworkProtocolSetConfiguration(
301        protocol: SCNetworkProtocolRef,
302        config: CFDictionaryRef,
303    ) -> Boolean;
304
305    pub fn SCNetworkProtocolSetEnabled(protocol: SCNetworkProtocolRef, enabled: Boolean)
306        -> Boolean;
307
308    pub fn SCNetworkServiceGetTypeID() -> CFTypeID;
309
310    pub fn SCNetworkServiceAddProtocolType(
311        service: SCNetworkServiceRef,
312        protocolType: CFStringRef,
313    ) -> Boolean;
314
315    pub fn SCNetworkServiceCopyAll(prefs: SCPreferencesRef) -> CFArrayRef;
316
317    pub fn SCNetworkServiceCopyProtocols(service: SCNetworkServiceRef) -> CFArrayRef;
318
319    pub fn SCNetworkServiceCreate(
320        prefs: SCPreferencesRef,
321        interface: SCNetworkInterfaceRef,
322    ) -> SCNetworkServiceRef;
323
324    pub fn SCNetworkServiceCopy(
325        prefs: SCPreferencesRef,
326        serviceID: CFStringRef,
327    ) -> SCNetworkServiceRef;
328
329    pub fn SCNetworkServiceEstablishDefaultConfiguration(service: SCNetworkServiceRef) -> Boolean;
330
331    pub fn SCNetworkServiceGetEnabled(service: SCNetworkServiceRef) -> Boolean;
332
333    pub fn SCNetworkServiceGetInterface(service: SCNetworkServiceRef) -> SCNetworkInterfaceRef;
334
335    pub fn SCNetworkServiceGetName(service: SCNetworkServiceRef) -> CFStringRef;
336
337    pub fn SCNetworkServiceCopyProtocol(
338        service: SCNetworkServiceRef,
339        protocolType: CFStringRef,
340    ) -> SCNetworkProtocolRef;
341
342    pub fn SCNetworkServiceGetServiceID(service: SCNetworkServiceRef) -> CFStringRef;
343
344    pub fn SCNetworkServiceRemove(service: SCNetworkServiceRef) -> Boolean;
345
346    pub fn SCNetworkServiceRemoveProtocolType(
347        service: SCNetworkServiceRef,
348        protocolType: CFStringRef,
349    ) -> Boolean;
350
351    pub fn SCNetworkServiceSetEnabled(service: SCNetworkServiceRef, enabled: Boolean) -> Boolean;
352
353    pub fn SCNetworkServiceSetName(service: SCNetworkServiceRef, name: CFStringRef) -> Boolean;
354
355    pub fn SCNetworkSetGetTypeID() -> CFTypeID;
356
357    pub fn SCNetworkSetAddService(set: SCNetworkSetRef, service: SCNetworkServiceRef) -> Boolean;
358
359    pub fn SCNetworkSetContainsInterface(
360        set: SCNetworkSetRef,
361        interface: SCNetworkInterfaceRef,
362    ) -> Boolean;
363
364    pub fn SCNetworkSetCopyAll(prefs: SCPreferencesRef) -> CFArrayRef;
365
366    pub fn SCNetworkSetCopyCurrent(prefs: SCPreferencesRef) -> SCNetworkSetRef;
367
368    pub fn SCNetworkSetCopyServices(set: SCNetworkSetRef) -> CFArrayRef;
369
370    pub fn SCNetworkSetCreate(prefs: SCPreferencesRef) -> SCNetworkSetRef;
371
372    pub fn SCNetworkSetCopy(prefs: SCPreferencesRef, setID: CFStringRef) -> SCNetworkSetRef;
373
374    pub fn SCNetworkSetGetName(set: SCNetworkSetRef) -> CFStringRef;
375
376    pub fn SCNetworkSetGetSetID(set: SCNetworkSetRef) -> CFStringRef;
377
378    pub fn SCNetworkSetGetServiceOrder(set: SCNetworkSetRef) -> CFArrayRef;
379
380    pub fn SCNetworkSetRemove(set: SCNetworkSetRef) -> Boolean;
381
382    pub fn SCNetworkSetRemoveService(set: SCNetworkSetRef, service: SCNetworkServiceRef)
383        -> Boolean;
384
385    pub fn SCNetworkSetSetCurrent(set: SCNetworkSetRef) -> Boolean;
386
387    pub fn SCNetworkSetSetName(set: SCNetworkSetRef, name: CFStringRef) -> Boolean;
388
389    pub fn SCNetworkSetSetServiceOrder(set: SCNetworkSetRef, newOrder: CFArrayRef) -> Boolean;
390}