1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// automatically generated by rust-bindgen

// Generated using:
// bindgen 0.54.0
// macOS SDK 10.15.4.

#![cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal))]
use crate::dispatch_queue_t;
use core_foundation_sys::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID};
use core_foundation_sys::runloop::CFRunLoopRef;
use core_foundation_sys::string::CFStringRef;
use libc::{c_char, c_void, sockaddr};
pub type __SCNetworkReachability = c_void;

pub type SCNetworkReachabilityRef = *const __SCNetworkReachability;
#[repr(C)]
pub struct SCNetworkReachabilityContext {
    pub version: CFIndex,
    pub info: *mut ::core::ffi::c_void,
    pub retain: Option<
        unsafe extern "C" fn(info: *const ::core::ffi::c_void) -> *const ::core::ffi::c_void,
    >,
    pub release: Option<unsafe extern "C" fn(info: *const ::core::ffi::c_void)>,
    pub copyDescription:
        Option<unsafe extern "C" fn(info: *const ::core::ffi::c_void) -> CFStringRef>,
}
pub type SCNetworkReachabilityFlags = u32;
pub const kSCNetworkReachabilityFlagsTransientConnection: _bindgen_ty_64 = 1;
pub const kSCNetworkReachabilityFlagsReachable: _bindgen_ty_64 = 2;
pub const kSCNetworkReachabilityFlagsConnectionRequired: _bindgen_ty_64 = 4;
pub const kSCNetworkReachabilityFlagsConnectionOnTraffic: _bindgen_ty_64 = 8;
pub const kSCNetworkReachabilityFlagsInterventionRequired: _bindgen_ty_64 = 16;
pub const kSCNetworkReachabilityFlagsConnectionOnDemand: _bindgen_ty_64 = 32;
pub const kSCNetworkReachabilityFlagsIsLocalAddress: _bindgen_ty_64 = 65536;
pub const kSCNetworkReachabilityFlagsIsDirect: _bindgen_ty_64 = 131072;
pub const kSCNetworkReachabilityFlagsIsWWAN: _bindgen_ty_64 = 262144;
pub const kSCNetworkReachabilityFlagsConnectionAutomatic: _bindgen_ty_64 = 8;
pub type _bindgen_ty_64 = u32;
pub type SCNetworkReachabilityCallBack = Option<
    unsafe extern "C" fn(
        target: SCNetworkReachabilityRef,
        flags: SCNetworkReachabilityFlags,
        info: *mut ::core::ffi::c_void,
    ),
>;
extern "C" {
    pub fn SCNetworkReachabilityCreateWithAddress(
        allocator: CFAllocatorRef,
        address: *const sockaddr,
    ) -> SCNetworkReachabilityRef;

    pub fn SCNetworkReachabilityCreateWithAddressPair(
        allocator: CFAllocatorRef,
        localAddress: *const sockaddr,
        remoteAddress: *const sockaddr,
    ) -> SCNetworkReachabilityRef;

    pub fn SCNetworkReachabilityCreateWithName(
        allocator: CFAllocatorRef,
        nodename: *const c_char,
    ) -> SCNetworkReachabilityRef;

    pub fn SCNetworkReachabilityGetTypeID() -> CFTypeID;

    pub fn SCNetworkReachabilityGetFlags(
        target: SCNetworkReachabilityRef,
        flags: *mut SCNetworkReachabilityFlags,
    ) -> Boolean;

    pub fn SCNetworkReachabilitySetCallback(
        target: SCNetworkReachabilityRef,
        callout: SCNetworkReachabilityCallBack,
        context: *mut SCNetworkReachabilityContext,
    ) -> Boolean;

    pub fn SCNetworkReachabilityScheduleWithRunLoop(
        target: SCNetworkReachabilityRef,
        runLoop: CFRunLoopRef,
        runLoopMode: CFStringRef,
    ) -> Boolean;

    pub fn SCNetworkReachabilityUnscheduleFromRunLoop(
        target: SCNetworkReachabilityRef,
        runLoop: CFRunLoopRef,
        runLoopMode: CFStringRef,
    ) -> Boolean;

    pub fn SCNetworkReachabilitySetDispatchQueue(
        target: SCNetworkReachabilityRef,
        queue: dispatch_queue_t,
    ) -> Boolean;
}