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#[cfg(feature = "libc")]
55#[deprecated = "No longer supported"]
56#[inline]
57pub unsafe extern "C-unwind" fn SCNetworkCheckReachabilityByAddress(
58 address: NonNull<libc::sockaddr>,
59 addrlen: libc::socklen_t,
60 flags: NonNull<SCNetworkConnectionFlags>,
61) -> bool {
62 extern "C-unwind" {
63 fn SCNetworkCheckReachabilityByAddress(
64 address: NonNull<libc::sockaddr>,
65 addrlen: libc::socklen_t,
66 flags: NonNull<SCNetworkConnectionFlags>,
67 ) -> Boolean;
68 }
69 let ret = unsafe { SCNetworkCheckReachabilityByAddress(address, addrlen, flags) };
70 ret != 0
71}
72
73/// Determines if the given network host or node name is
74/// reachable using the current network configuration.
75///
76/// Note: this API has been deprecated but you can
77/// get equivalent results with :
78/// <pre>
79/// SCNetworkReachabilityRef target;
80/// SCNetworkReachabilityFlags flags = 0;
81/// Boolean ok;
82///
83/// target = SCNetworkReachabilityCreateWithName(NULL, name);
84/// ok = SCNetworkReachabilityGetFlags(target,
85/// &flags
86/// );
87/// CFRelease(target);
88/// </pre>
89///
90/// Parameter `nodename`: The node name of the desired host. This name would
91/// be the same as that passed to the gethostbyname(3) or
92/// getaddrinfo(3) functions.
93///
94/// Parameter `flags`: A pointer to memory that will be filled with a
95/// set of SCNetworkConnectionFlags detailing the reachability
96/// of the specified node name.
97///
98/// Returns: Returns TRUE if the network connection flags are valid;
99/// FALSE if the status could not be determined.
100#[deprecated = "No longer supported"]
101#[inline]
102pub unsafe extern "C-unwind" fn SCNetworkCheckReachabilityByName(
103 nodename: NonNull<c_char>,
104 flags: NonNull<SCNetworkConnectionFlags>,
105) -> bool {
106 extern "C-unwind" {
107 fn SCNetworkCheckReachabilityByName(
108 nodename: NonNull<c_char>,
109 flags: NonNull<SCNetworkConnectionFlags>,
110 ) -> Boolean;
111 }
112 let ret = unsafe { SCNetworkCheckReachabilityByName(nodename, flags) };
113 ret != 0
114}
115
116/// Sends a notification to interested configuration agents
117/// to have them immediately retry their configuration over a
118/// particular network interface.
119///
120/// Note: This function must be invoked by root (uid == 0).
121///
122/// Parameter `ifName`: The BSD name of the network interface, such as
123/// CFSTR("en0").
124///
125/// Returns: Returns TRUE if the notification was sent; FALSE otherwise.
126#[deprecated = "No longer supported"]
127#[inline]
128pub unsafe extern "C-unwind" fn SCNetworkInterfaceRefreshConfiguration(if_name: &CFString) -> bool {
129 extern "C-unwind" {
130 fn SCNetworkInterfaceRefreshConfiguration(if_name: &CFString) -> Boolean;
131 }
132 let ret = unsafe { SCNetworkInterfaceRefreshConfiguration(if_name) };
133 ret != 0
134}