objc2_system_configuration/generated/SCNetwork.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2_core_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkflagstransientconnection?language=objc)
10pub const kSCNetworkFlagsTransientConnection: c_uint = 1 << 0;
11/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkflagsreachable?language=objc)
12pub const kSCNetworkFlagsReachable: c_uint = 1 << 1;
13/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkflagsconnectionrequired?language=objc)
14pub const kSCNetworkFlagsConnectionRequired: c_uint = 1 << 2;
15/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkflagsconnectionautomatic?language=objc)
16pub const kSCNetworkFlagsConnectionAutomatic: c_uint = 1 << 3;
17/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkflagsinterventionrequired?language=objc)
18pub const kSCNetworkFlagsInterventionRequired: c_uint = 1 << 4;
19/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkflagsislocaladdress?language=objc)
20pub const kSCNetworkFlagsIsLocalAddress: c_uint = 1 << 16;
21/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkflagsisdirect?language=objc)
22pub const kSCNetworkFlagsIsDirect: c_uint = 1 << 17;
23
24/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkconnectionflags?language=objc)
25pub type SCNetworkConnectionFlags = u32;
26
27/// Determines if the given network address is
28/// reachable using the current network configuration.
29///
30/// Note: this API has been deprecated but you can
31/// get equivalent results with :
32/// <pre>
33/// SCNetworkReachabilityRef target;
34/// SCNetworkReachabilityFlags flags = 0;
35/// Boolean ok;
36///
37/// target = SCNetworkReachabilityCreateWithAddress(NULL, address);
38/// ok = SCNetworkReachabilityGetFlags(target,
39/// &flags
40/// );
41/// CFRelease(target);
42/// </pre>
43///
44/// Parameter `address`: The network address of the desired host.
45///
46/// Parameter `addrlen`: The length, in bytes, of the address.
47///
48/// Parameter `flags`: A pointer to memory that will be filled with a
49/// set of SCNetworkConnectionFlags detailing the reachability
50/// of the specified address.
51///
52/// Returns: Returns TRUE if the network connection flags are valid;
53/// FALSE if the status could not be determined.
54///
55/// # Safety
56///
57/// - `address` must be a valid pointer.
58/// - `flags` must be a valid pointer.
59#[cfg(feature = "libc")]
60#[deprecated = "No longer supported"]
61#[inline]
62pub unsafe extern "C-unwind" fn SCNetworkCheckReachabilityByAddress(
63 address: NonNull<libc::sockaddr>,
64 addrlen: libc::socklen_t,
65 flags: NonNull<SCNetworkConnectionFlags>,
66) -> bool {
67 extern "C-unwind" {
68 fn SCNetworkCheckReachabilityByAddress(
69 address: NonNull<libc::sockaddr>,
70 addrlen: libc::socklen_t,
71 flags: NonNull<SCNetworkConnectionFlags>,
72 ) -> Boolean;
73 }
74 let ret = unsafe { SCNetworkCheckReachabilityByAddress(address, addrlen, flags) };
75 ret != 0
76}
77
78/// Determines if the given network host or node name is
79/// reachable using the current network configuration.
80///
81/// Note: this API has been deprecated but you can
82/// get equivalent results with :
83/// <pre>
84/// SCNetworkReachabilityRef target;
85/// SCNetworkReachabilityFlags flags = 0;
86/// Boolean ok;
87///
88/// target = SCNetworkReachabilityCreateWithName(NULL, name);
89/// ok = SCNetworkReachabilityGetFlags(target,
90/// &flags
91/// );
92/// CFRelease(target);
93/// </pre>
94///
95/// Parameter `nodename`: The node name of the desired host. This name would
96/// be the same as that passed to the gethostbyname(3) or
97/// getaddrinfo(3) functions.
98///
99/// Parameter `flags`: A pointer to memory that will be filled with a
100/// set of SCNetworkConnectionFlags detailing the reachability
101/// of the specified node name.
102///
103/// Returns: Returns TRUE if the network connection flags are valid;
104/// FALSE if the status could not be determined.
105///
106/// # Safety
107///
108/// - `nodename` must be a valid pointer.
109/// - `flags` must be a valid pointer.
110#[deprecated = "No longer supported"]
111#[inline]
112pub unsafe extern "C-unwind" fn SCNetworkCheckReachabilityByName(
113 nodename: NonNull<c_char>,
114 flags: NonNull<SCNetworkConnectionFlags>,
115) -> bool {
116 extern "C-unwind" {
117 fn SCNetworkCheckReachabilityByName(
118 nodename: NonNull<c_char>,
119 flags: NonNull<SCNetworkConnectionFlags>,
120 ) -> Boolean;
121 }
122 let ret = unsafe { SCNetworkCheckReachabilityByName(nodename, flags) };
123 ret != 0
124}
125
126/// Sends a notification to interested configuration agents
127/// to have them immediately retry their configuration over a
128/// particular network interface.
129///
130/// Note: This function must be invoked by root (uid == 0).
131///
132/// Parameter `ifName`: The BSD name of the network interface, such as
133/// CFSTR("en0").
134///
135/// Returns: Returns TRUE if the notification was sent; FALSE otherwise.
136#[deprecated = "No longer supported"]
137#[inline]
138pub extern "C-unwind" fn SCNetworkInterfaceRefreshConfiguration(if_name: &CFString) -> bool {
139 extern "C-unwind" {
140 fn SCNetworkInterfaceRefreshConfiguration(if_name: &CFString) -> Boolean;
141 }
142 let ret = unsafe { SCNetworkInterfaceRefreshConfiguration(if_name) };
143 ret != 0
144}