Class SystemConfiguration


  • public final class SystemConfiguration
    extends java.lang.Object
    • Method Detail

      • SCNetworkReachabilityCreateWithAddress

        public static SCNetworkReachabilityRef SCNetworkReachabilityCreateWithAddress​(CFAllocatorRef allocator,
                                                                                      sockaddr address)
        [@function] SCNetworkReachabilityCreateWithAddress Creates a reference to the specified network address. This reference can be used later to monitor the reachability of the target host.
        Parameters:
        address - The address of the desired host.
        Returns:
        Returns a reference to the new immutable SCNetworkReachabilityRef. You must release the returned value.
      • SCNetworkReachabilityCreateWithAddressPair

        public static SCNetworkReachabilityRef SCNetworkReachabilityCreateWithAddressPair​(CFAllocatorRef allocator,
                                                                                          sockaddr localAddress,
                                                                                          sockaddr remoteAddress)
        [@function] SCNetworkReachabilityCreateWithAddressPair Creates a reference to the specified network address. This reference can be used later to monitor the reachability of the target host.
        Parameters:
        localAddress - The local address associated with a network connection. If NULL, only the remote address is of interest.
        remoteAddress - The remote address associated with a network connection. If NULL, only the local address is of interest.
        Returns:
        Returns a reference to the new immutable SCNetworkReachabilityRef. You must release the returned value.
      • SCNetworkReachabilityCreateWithName

        public static SCNetworkReachabilityRef SCNetworkReachabilityCreateWithName​(CFAllocatorRef allocator,
                                                                                   java.lang.String nodename)
        [@function] SCNetworkReachabilityCreateWithName Creates a reference to the specified network host or node name. This reference can be used later to monitor the reachability of the target host.
        Parameters:
        nodename - The node name of the desired host. This name would be the same as that passed to the gethostbyname(3) or getaddrinfo(3) functions.
        Returns:
        Returns a reference to the new immutable SCNetworkReachabilityRef. You must release the returned value.
      • SCNetworkReachabilityGetTypeID

        public static long SCNetworkReachabilityGetTypeID()
        [@function] SCNetworkReachabilityGetTypeID Returns the type identifier of all SCNetworkReachability instances.
      • SCNetworkReachabilityGetFlags

        public static byte SCNetworkReachabilityGetFlags​(SCNetworkReachabilityRef target,
                                                         org.moe.natj.general.ptr.IntPtr flags)
        [@function] SCNetworkReachabilityGetFlags Determines if the given target is reachable using the current network configuration.
        Parameters:
        target - The network reference associated with the address or name to be checked for reachability.
        flags - A pointer to memory that will be filled with the SCNetworkReachabilityFlags detailing the reachability of the specified target.
        Returns:
        Returns TRUE if the network connection flags are valid; FALSE if the status could not be determined.
      • SCNetworkReachabilitySetCallback

        public static byte SCNetworkReachabilitySetCallback​(SCNetworkReachabilityRef target,
                                                            SystemConfiguration.Function_SCNetworkReachabilitySetCallback callout,
                                                            SCNetworkReachabilityContext context)
        [@function] SCNetworkReachabilitySetCallback Assigns a client to a target, which receives callbacks when the reachability of the target changes.
        Parameters:
        target - The network reference associated with the address or name to be checked for reachability.
        callout - The function to be called when the reachability of the target changes. If NULL, the current client for the target is removed.
        context - The SCNetworkReachabilityContext associated with the callout. The value may be NULL.
        Returns:
        Returns TRUE if the notification client was successfully set.
      • SCNetworkReachabilityScheduleWithRunLoop

        public static byte SCNetworkReachabilityScheduleWithRunLoop​(SCNetworkReachabilityRef target,
                                                                    CFRunLoopRef runLoop,
                                                                    CFStringRef runLoopMode)
        [@function] SCNetworkReachabilityScheduleWithRunLoop Schedules the given target with the given run loop and mode.
        Parameters:
        target - The address or name that is set up for asynchronous notifications. Must be non-NULL.
        runLoop - A reference to a run loop on which the target should be scheduled. Must be non-NULL.
        runLoopMode - The mode on which to schedule the target. Must be non-NULL.
        Returns:
        Returns TRUE if the target is scheduled successfully; FALSE otherwise.
      • SCNetworkReachabilityUnscheduleFromRunLoop

        public static byte SCNetworkReachabilityUnscheduleFromRunLoop​(SCNetworkReachabilityRef target,
                                                                      CFRunLoopRef runLoop,
                                                                      CFStringRef runLoopMode)
        [@function] SCNetworkReachabilityUnscheduleFromRunLoop Unschedules the given target from the given run loop and mode.
        Parameters:
        target - The address or name that is set up for asynchronous notifications. Must be non-NULL.
        runLoop - A reference to a run loop from which the target should be unscheduled. Must be non-NULL.
        runLoopMode - The mode on which to unschedule the target. Must be non-NULL.
        Returns:
        Returns TRUE if the target is unscheduled successfully; FALSE otherwise.
      • SCNetworkReachabilitySetDispatchQueue

        public static byte SCNetworkReachabilitySetDispatchQueue​(SCNetworkReachabilityRef target,
                                                                 NSObject queue)
        [@function] SCNetworkReachabilitySetDispatchQueue Schedule or unschedule callbacks for the given target on the given dispatch queue.
        Parameters:
        target - The address or name that is set up for asynchronous notifications. Must be non-NULL.
        queue - A libdispatch queue to run the callback on. Pass NULL to unschedule callbacks.
        Returns:
        Returns TRUE if the target is scheduled or unscheduled successfully; FALSE otherwise.
      • SCCopyLastError

        public static CFErrorRef SCCopyLastError()
        [@function] SCCopyLastError Returns the most recent status or error code generated as the result of calling a System Configuration framework API.
        Returns:
        Returns the last error encountered.
      • SCError

        public static int SCError()
        [@function] SCError Returns the most recent status or error code generated as the result of calling a System Configuration framework API.
        Returns:
        Returns the last error encountered.
      • SCErrorString

        public static java.lang.String SCErrorString​(int status)
        [@function] SCErrorString Returns a pointer to the message string associated with the specified status or error number.
        Parameters:
        status - The status or error number.
        Returns:
        Returns a pointer to the error message string.
      • CNSetSupportedSSIDs

        @Deprecated
        public static byte CNSetSupportedSSIDs​(CFArrayRef ssidArray)
        Deprecated.
        [@function] CNSetSupportedSSIDs Provides Captive Network Support with an updated list of SSIDs that this application will perform authentication on. Captive Network Support suppresses showing the Web Sheet for a captive Wi-Fi network if that network's SSID is in the specified list. On iOS, the registrations persist until the application is removed from the device. On MacOSX, the registrations persist as long as the application is running.
        Parameters:
        ssidArray - A CFArray of CFStrings of the SSIDs.
        Returns:
        Returns TRUE if the operation succeeded, FALSE otherwise.
      • CNMarkPortalOnline

        @Deprecated
        public static byte CNMarkPortalOnline​(CFStringRef interfaceName)
        Deprecated.
        [@function] CNMarkPortalOnline Tells Captive Network Support that your application has authenticated the device to the network. Captive Network Support will notify the rest of the system that WiFi is now a viable interface.
        Parameters:
        interfaceName - Name of the interface that is now online.
        Returns:
        Returns TRUE if the operation succeeded, FALSE otherwise.
      • CNMarkPortalOffline

        @Deprecated
        public static byte CNMarkPortalOffline​(CFStringRef interfaceName)
        Deprecated.
        [@function] CNMarkPortalOffline Tells Captive Network Support that the device is not authenticated on the given network interface.
        Parameters:
        interfaceName - Name of the interface that is still captive.
        Returns:
        Returns TRUE if the operation succeeded, FALSE otherwise.
      • CNCopySupportedInterfaces

        public static CFArrayRef CNCopySupportedInterfaces()
        [@function] CNCopySupportedInterfaces copies a list of all interfaces CaptiveNetworkSupport is monitoring.
        Returns:
        An array of CFStringRef- BSD interface names. Returns NULL if an error was encountered. You MUST release the returned value.
      • CNCopyCurrentNetworkInfo

        public static CFDictionaryRef CNCopyCurrentNetworkInfo​(CFStringRef interfaceName)
        [@function] CNCopyCurrentNetworkInfo Returns the network information for the specified interface when the requesting application meets one of following 4 requirements -. 1. application is using CoreLocation API and has the user's authorization to access location. 2. application has used the NEHotspotConfiguration API to configure the current Wi-Fi network. 3. application has active VPN configurations installed. 4. application has active NEDNSSettingsManager configurations installed. - An application that is linked against iOS 12.0 SDK and above must have the "com.apple.developer.networking.wifi-info" entitlement. - An application will receive a pseudo network information if it is linked against an SDK before iOS 13.0, and if it fails to meet any of the above requirements. - An application will receive NULL if it is linked against iOS 13.0 SDK (or newer), and if it fails to meet any of the above requirements. - On Mac Catalyst platform, to receive current Wi-Fi network information, an application must have "com.apple.developer.networking.wifi-info" entitlement and user's authorization to access location. Network Information dictionary will contain the following keys, and values:
        Parameters:
        interfaceName - Name of the interface you are interested in
        Returns:
        Network Information dictionary associated with the interface. Returns NULL if an error was encountered. You MUST release the returned value.
      • kCFErrorDomainSystemConfiguration

        public static CFStringRef kCFErrorDomainSystemConfiguration()
        [@const] kCFErrorDomainSystemConfiguration CFError domain associated with errors reported by the SystemConfiguration.framework.
      • kCNNetworkInfoKeySSIDData

        public static CFStringRef kCNNetworkInfoKeySSIDData()
        [@constant] kCNNetworkInfoKeySSIDData NetworkInfo Dictionary key for SSID in CFData format
      • kCNNetworkInfoKeySSID

        public static CFStringRef kCNNetworkInfoKeySSID()
        [@constant] kCNNetworkInfoKeySSID NetworkInfo Dictionary key for SSID in CFString format
      • kCNNetworkInfoKeyBSSID

        public static CFStringRef kCNNetworkInfoKeyBSSID()
        [@constant] kCNNetworkInfoKeyBSSID NetworkInfo Dictionary key for BSSID in CFString format