objc2-cf-network 0.3.2

Bindings to the CFNetwork framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2_core_foundation::*;

use crate::*;

/// Returns a CFDictionary containing the current system internet proxy settings.
///
/// Returns: Returns a dictionary containing key-value pairs that represent
/// the current internet proxy settings.  See below for definitions of the keys and
/// values.
/// NULL if no proxy settings have been defined or if an error
/// was encountered.
/// The caller is responsible for releasing the returned dictionary.
#[inline]
pub unsafe extern "C-unwind" fn CFNetworkCopySystemProxySettings(
) -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn CFNetworkCopySystemProxySettings() -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { CFNetworkCopySystemProxySettings() };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// # Safety
///
/// `proxy_settings` generics must be of the correct type.
#[inline]
pub unsafe extern "C-unwind" fn CFNetworkCopyProxiesForURL(
    url: &CFURL,
    proxy_settings: &CFDictionary,
) -> CFRetained<CFArray> {
    extern "C-unwind" {
        fn CFNetworkCopyProxiesForURL(
            url: &CFURL,
            proxy_settings: &CFDictionary,
        ) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { CFNetworkCopyProxiesForURL(url, proxy_settings) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

/// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/cfproxyautoconfigurationresultcallback?language=objc)
pub type CFProxyAutoConfigurationResultCallback =
    Option<unsafe extern "C-unwind" fn(NonNull<c_void>, NonNull<CFArray>, *mut CFError)>;

/// # Safety
///
/// `error` must be a valid pointer or null.
#[inline]
pub unsafe extern "C-unwind" fn CFNetworkCopyProxiesForAutoConfigurationScript(
    proxy_auto_configuration_script: &CFString,
    target_url: &CFURL,
    error: *mut *mut CFError,
) -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn CFNetworkCopyProxiesForAutoConfigurationScript(
            proxy_auto_configuration_script: &CFString,
            target_url: &CFURL,
            error: *mut *mut CFError,
        ) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe {
        CFNetworkCopyProxiesForAutoConfigurationScript(
            proxy_auto_configuration_script,
            target_url,
            error,
        )
    };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// # Safety
///
/// - `cb` must be implemented correctly.
/// - `client_context` must be a valid pointer.
#[inline]
pub unsafe extern "C-unwind" fn CFNetworkExecuteProxyAutoConfigurationScript(
    proxy_auto_configuration_script: &CFString,
    target_url: &CFURL,
    cb: CFProxyAutoConfigurationResultCallback,
    client_context: NonNull<CFStreamClientContext>,
) -> CFRetained<CFRunLoopSource> {
    extern "C-unwind" {
        fn CFNetworkExecuteProxyAutoConfigurationScript(
            proxy_auto_configuration_script: &CFString,
            target_url: &CFURL,
            cb: CFProxyAutoConfigurationResultCallback,
            client_context: NonNull<CFStreamClientContext>,
        ) -> Option<NonNull<CFRunLoopSource>>;
    }
    let ret = unsafe {
        CFNetworkExecuteProxyAutoConfigurationScript(
            proxy_auto_configuration_script,
            target_url,
            cb,
            client_context,
        )
    };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

/// # Safety
///
/// - `cb` must be implemented correctly.
/// - `client_context` must be a valid pointer.
#[inline]
pub unsafe extern "C-unwind" fn CFNetworkExecuteProxyAutoConfigurationURL(
    proxy_auto_config_url: &CFURL,
    target_url: &CFURL,
    cb: CFProxyAutoConfigurationResultCallback,
    client_context: NonNull<CFStreamClientContext>,
) -> CFRetained<CFRunLoopSource> {
    extern "C-unwind" {
        fn CFNetworkExecuteProxyAutoConfigurationURL(
            proxy_auto_config_url: &CFURL,
            target_url: &CFURL,
            cb: CFProxyAutoConfigurationResultCallback,
            client_context: NonNull<CFStreamClientContext>,
        ) -> Option<NonNull<CFRunLoopSource>>;
    }
    let ret = unsafe {
        CFNetworkExecuteProxyAutoConfigurationURL(
            proxy_auto_config_url,
            target_url,
            cb,
            client_context,
        )
    };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxytypekey?language=objc)
    pub static kCFProxyTypeKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxyhostnamekey?language=objc)
    pub static kCFProxyHostNameKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxyportnumberkey?language=objc)
    pub static kCFProxyPortNumberKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxyautoconfigurationurlkey?language=objc)
    pub static kCFProxyAutoConfigurationURLKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxyautoconfigurationjavascriptkey?language=objc)
    pub static kCFProxyAutoConfigurationJavaScriptKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxyusernamekey?language=objc)
    pub static kCFProxyUsernameKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxypasswordkey?language=objc)
    pub static kCFProxyPasswordKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxytypenone?language=objc)
    pub static kCFProxyTypeNone: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxytypehttp?language=objc)
    pub static kCFProxyTypeHTTP: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxytypehttps?language=objc)
    pub static kCFProxyTypeHTTPS: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxytypesocks?language=objc)
    pub static kCFProxyTypeSOCKS: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxytypeftp?language=objc)
    pub static kCFProxyTypeFTP: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxytypeautoconfigurationurl?language=objc)
    pub static kCFProxyTypeAutoConfigurationURL: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxytypeautoconfigurationjavascript?language=objc)
    pub static kCFProxyTypeAutoConfigurationJavaScript: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfproxyautoconfigurationhttpresponsekey?language=objc)
    pub static kCFProxyAutoConfigurationHTTPResponseKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesexceptionslist?language=objc)
    pub static kCFNetworkProxiesExceptionsList: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesexcludesimplehostnames?language=objc)
    pub static kCFNetworkProxiesExcludeSimpleHostnames: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesftpenable?language=objc)
    pub static kCFNetworkProxiesFTPEnable: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesftppassive?language=objc)
    pub static kCFNetworkProxiesFTPPassive: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesftpport?language=objc)
    pub static kCFNetworkProxiesFTPPort: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesftpproxy?language=objc)
    pub static kCFNetworkProxiesFTPProxy: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesgopherenable?language=objc)
    pub static kCFNetworkProxiesGopherEnable: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesgopherport?language=objc)
    pub static kCFNetworkProxiesGopherPort: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesgopherproxy?language=objc)
    pub static kCFNetworkProxiesGopherProxy: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxieshttpenable?language=objc)
    pub static kCFNetworkProxiesHTTPEnable: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxieshttpport?language=objc)
    pub static kCFNetworkProxiesHTTPPort: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxieshttpproxy?language=objc)
    pub static kCFNetworkProxiesHTTPProxy: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxieshttpsenable?language=objc)
    pub static kCFNetworkProxiesHTTPSEnable: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxieshttpsport?language=objc)
    pub static kCFNetworkProxiesHTTPSPort: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxieshttpsproxy?language=objc)
    pub static kCFNetworkProxiesHTTPSProxy: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesrtspenable?language=objc)
    pub static kCFNetworkProxiesRTSPEnable: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesrtspport?language=objc)
    pub static kCFNetworkProxiesRTSPPort: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesrtspproxy?language=objc)
    pub static kCFNetworkProxiesRTSPProxy: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiessocksenable?language=objc)
    pub static kCFNetworkProxiesSOCKSEnable: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiessocksport?language=objc)
    pub static kCFNetworkProxiesSOCKSPort: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiessocksproxy?language=objc)
    pub static kCFNetworkProxiesSOCKSProxy: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesproxyautoconfigenable?language=objc)
    pub static kCFNetworkProxiesProxyAutoConfigEnable: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesproxyautoconfigurlstring?language=objc)
    pub static kCFNetworkProxiesProxyAutoConfigURLString: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesproxyautoconfigjavascript?language=objc)
    pub static kCFNetworkProxiesProxyAutoConfigJavaScript: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfnetworkproxiesproxyautodiscoveryenable?language=objc)
    pub static kCFNetworkProxiesProxyAutoDiscoveryEnable: &'static CFString;
}