public final class SystemConfiguration
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SystemConfiguration.Function_SCNetworkReachabilitySetCallback |
| Modifier and Type | Method and Description |
|---|---|
static CFDictionaryRef |
CNCopyCurrentNetworkInfo(CFStringRef interfaceName)
[@function] CNCopyCurrentNetworkInfo
|
static CFArrayRef |
CNCopySupportedInterfaces()
[@function] CNCopySupportedInterfaces
|
static byte |
CNMarkPortalOffline(CFStringRef interfaceName)
Deprecated.
|
static byte |
CNMarkPortalOnline(CFStringRef interfaceName)
Deprecated.
|
static byte |
CNSetSupportedSSIDs(CFArrayRef ssidArray)
Deprecated.
|
static CFStringRef |
kCFErrorDomainSystemConfiguration()
[@const] kCFErrorDomainSystemConfiguration
|
static CFStringRef |
kCNNetworkInfoKeyBSSID()
[@constant] kCNNetworkInfoKeyBSSID
|
static CFStringRef |
kCNNetworkInfoKeySSID()
[@constant] kCNNetworkInfoKeySSID
|
static CFStringRef |
kCNNetworkInfoKeySSIDData()
[@constant] kCNNetworkInfoKeySSIDData
|
static CFErrorRef |
SCCopyLastError()
[@function] SCCopyLastError
|
static int |
SCError()
[@function] SCError
|
static java.lang.String |
SCErrorString(int status)
[@function] SCErrorString
|
static SCNetworkReachabilityRef |
SCNetworkReachabilityCreateWithAddress(CFAllocatorRef allocator,
sockaddr address)
[@function] SCNetworkReachabilityCreateWithAddress
|
static SCNetworkReachabilityRef |
SCNetworkReachabilityCreateWithAddressPair(CFAllocatorRef allocator,
sockaddr localAddress,
sockaddr remoteAddress)
[@function] SCNetworkReachabilityCreateWithAddressPair
|
static SCNetworkReachabilityRef |
SCNetworkReachabilityCreateWithName(CFAllocatorRef allocator,
java.lang.String nodename)
[@function] SCNetworkReachabilityCreateWithName
|
static byte |
SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef target,
org.moe.natj.general.ptr.IntPtr flags)
[@function] SCNetworkReachabilityGetFlags
|
static long |
SCNetworkReachabilityGetTypeID()
[@function] SCNetworkReachabilityGetTypeID
|
static byte |
SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef target,
CFRunLoopRef runLoop,
CFStringRef runLoopMode)
[@function] SCNetworkReachabilityScheduleWithRunLoop
|
static byte |
SCNetworkReachabilitySetCallback(SCNetworkReachabilityRef target,
SystemConfiguration.Function_SCNetworkReachabilitySetCallback callout,
SCNetworkReachabilityContext context)
[@function] SCNetworkReachabilitySetCallback
|
static byte |
SCNetworkReachabilitySetDispatchQueue(SCNetworkReachabilityRef target,
NSObject queue)
[@function] SCNetworkReachabilitySetDispatchQueue
|
static byte |
SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef target,
CFRunLoopRef runLoop,
CFStringRef runLoopMode)
[@function] SCNetworkReachabilityUnscheduleFromRunLoop
|
public static SCNetworkReachabilityRef SCNetworkReachabilityCreateWithAddress(CFAllocatorRef allocator, sockaddr address)
Creates a reference to the specified network address. This reference can be used later to monitor the reachability of the target host.
address - The address of the desired host.You must release the returned value.
public static SCNetworkReachabilityRef SCNetworkReachabilityCreateWithAddressPair(CFAllocatorRef allocator, sockaddr localAddress, sockaddr remoteAddress)
Creates a reference to the specified network address. This reference can be used later to monitor the reachability of the target host.
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.You must release the returned value.
public static SCNetworkReachabilityRef SCNetworkReachabilityCreateWithName(CFAllocatorRef allocator, java.lang.String nodename)
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.
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.You must release the returned value.
public static long SCNetworkReachabilityGetTypeID()
Returns the type identifier of all SCNetworkReachability instances.
public static byte SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef target, org.moe.natj.general.ptr.IntPtr flags)
Determines if the given target is reachable using the current network configuration.
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.public static byte SCNetworkReachabilitySetCallback(SCNetworkReachabilityRef target, SystemConfiguration.Function_SCNetworkReachabilitySetCallback callout, SCNetworkReachabilityContext context)
Assigns a client to a target, which receives callbacks when the reachability of the target changes.
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.public static byte SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef target, CFRunLoopRef runLoop, CFStringRef runLoopMode)
Schedules the given target with the given run loop and mode.
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.public static byte SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef target, CFRunLoopRef runLoop, CFStringRef runLoopMode)
Unschedules the given target from the given run loop and mode.
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.public static byte SCNetworkReachabilitySetDispatchQueue(SCNetworkReachabilityRef target, NSObject queue)
Schedule or unschedule callbacks for the given target on the given dispatch queue.
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.public static CFErrorRef SCCopyLastError()
Returns the most recent status or error code generated as the result of calling a System Configuration framework API.
public static int SCError()
Returns the most recent status or error code generated as the result of calling a System Configuration framework API.
public static java.lang.String SCErrorString(int status)
Returns a pointer to the message string associated with the specified status or error number.
status - The status or error number.@Deprecated public static byte CNSetSupportedSSIDs(CFArrayRef ssidArray)
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.
ssidArray - A CFArray of CFStrings of the SSIDs.@Deprecated public static byte CNMarkPortalOnline(CFStringRef interfaceName)
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.
interfaceName - Name of the interface that is now online.@Deprecated public static byte CNMarkPortalOffline(CFStringRef interfaceName)
Tells Captive Network Support that the device is not authenticated on the given network interface.
interfaceName - Name of the interface that is still captive.public static CFArrayRef CNCopySupportedInterfaces()
copies a list of all interfaces CaptiveNetworkSupport is monitoring.
public static CFDictionaryRef CNCopyCurrentNetworkInfo(CFStringRef interfaceName)
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:
interfaceName - Name of the interface you are interested inpublic static CFStringRef kCFErrorDomainSystemConfiguration()
CFError domain associated with errors reported by the SystemConfiguration.framework.
public static CFStringRef kCNNetworkInfoKeySSIDData()
NetworkInfo Dictionary key for SSID in CFData format
public static CFStringRef kCNNetworkInfoKeySSID()
NetworkInfo Dictionary key for SSID in CFString format
public static CFStringRef kCNNetworkInfoKeyBSSID()
NetworkInfo Dictionary key for BSSID in CFString format