/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachabilityFlags getFlags() { IntPtr ptr = new IntPtr(); getFlags(ptr); return new SCNetworkReachabilityFlags(ptr.get()); } /**
/** * @since Available in iOS 2.0 and later. */ public boolean setCallback(ClientCallback callback) { SCNetworkReachabilityContext context = new SCNetworkReachabilityContext(); context.setInfo(localRefconId); synchronized (callbacks) { callbacks.put(localRefconId, callback); } return setCallback(new FunctionPtr(cbInvoke), context); } /*<methods>*/
/** * @since Available in iOS 2.0 and later. */ public static SCNetworkReachability create(String nodename) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); BytePtr ptr = BytePtr.toBytePtrZ(nodename); SCNetworkReachability reachability = create(null, ptr); reachability.localRefconId = refconId; return reachability; } /**
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(String nodename) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); BytePtr ptr = BytePtr.toBytePtrZ(nodename); long reachability = create(null, ptr); localRefconId = refconId; setHandle(reachability); } /**
public void stopNotifier() { // First stop, any callbacks! reachability.setCallback(null); // Unregister target from the GCD serial dispatch queue. reachability.setDispatchQueue(null); reachabilityObject = null; }
public static NetworkReachability forAddress(InetSocketAddress hostAddress) { return new NetworkReachability(new SCNetworkReachability(hostAddress)); }
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(String nodename) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); BytePtr ptr = BytePtr.toBytePtrZ(nodename); long reachability = create(null, ptr); localRefconId = refconId; setHandle(reachability); } /**
public boolean startNotifier() { // allow start notifier to be called multiple times if (reachabilityObject != null && reachabilityObject == this) { return true; } if (reachability.setCallback(new ClientCallback() { @Override public void invoke(SCNetworkReachability target, SCNetworkReachabilityFlags flags) { reachabilityChanged(flags); } })) { // Set it as our reachability queue, which will retain the queue if (reachability.setDispatchQueue(reachabilitySerialQueue)) { // this should do a retain on ourself, so as long as we're in // notifier mode we shouldn't disappear out from under ourselves reachabilityObject = this; return true; } else { System.err.println(SCStatus.getStatusDescription(SCStatus.getLastStatus())); // Failure - stop any callbacks! reachability.setCallback(null); } } else { System.err.println(SCStatus.getStatusDescription(SCStatus.getLastStatus())); } // if we get here we fail at the internet reachabilityObject = null; return false; }
public static NetworkReachability forHostname(String hostname) { return new NetworkReachability(new SCNetworkReachability(hostname)); }
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(java.net.InetSocketAddress address) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); long reachability; java.net.InetAddress addr = address.getAddress(); if (addr instanceof java.net.Inet4Address) { reachability = create(null, new sockaddr_in(address)); } else if (addr instanceof java.net.Inet6Address) { reachability = create(null, new sockaddr_in6(address)); } else { throw new IllegalArgumentException("address is not a valid IPv4 or IPv6 address!"); } localRefconId = refconId; setHandle(reachability); } /**
public SCNetworkReachabilityFlags getReachabilityFlags() { return reachability.getFlags(); }
/** * @since Available in iOS 2.0 and later. */ public boolean setCallback(ClientCallback callback) { SCNetworkReachabilityContext context = new SCNetworkReachabilityContext(); context.setInfo(localRefconId); synchronized (callbacks) { callbacks.put(localRefconId, callback); } return setCallback(new FunctionPtr(cbInvoke), context); } /*<methods>*/
/** * @since Available in iOS 2.0 and later. */ public static SCNetworkReachability create(java.net.InetSocketAddress address) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); SCNetworkReachability reachability; java.net.InetAddress addr = address.getAddress(); if (addr instanceof java.net.Inet4Address) { reachability = create(null, new sockaddr_in(address)); } else if (addr instanceof java.net.Inet6Address) { reachability = create(null, new sockaddr_in6(address)); } else { throw new IllegalArgumentException("address is not a valid IPv4 or IPv6 address!"); } reachability.localRefconId = refconId; return reachability; } /**
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(java.net.InetSocketAddress address) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); long reachability; java.net.InetAddress addr = address.getAddress(); if (addr instanceof java.net.Inet4Address) { reachability = create(null, new sockaddr_in(address)); } else if (addr instanceof java.net.Inet6Address) { reachability = create(null, new sockaddr_in6(address)); } else { throw new IllegalArgumentException("address is not a valid IPv4 or IPv6 address!"); } localRefconId = refconId; setHandle(reachability); } /**
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachabilityFlags getFlags() { IntPtr ptr = new IntPtr(); getFlags(ptr); return new SCNetworkReachabilityFlags(ptr.get()); } /**
/** * @since Available in iOS 2.0 and later. */ public boolean setCallback(ClientCallback callback) { SCNetworkReachabilityContext context = new SCNetworkReachabilityContext(); context.setInfo(localRefconId); synchronized (callbacks) { callbacks.put(localRefconId, callback); } return setCallback(new FunctionPtr(cbInvoke), context); } /*<methods>*/
/** * @since Available in iOS 2.0 and later. */ public static SCNetworkReachability create(java.net.InetSocketAddress localAddress, java.net.InetSocketAddress remoteAddress) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); Struct<?> l; Struct<?> r; if (localAddress.getAddress() instanceof java.net.Inet4Address) { l = new sockaddr_in(localAddress); } else if (localAddress.getAddress() instanceof java.net.Inet6Address) { l = new sockaddr_in6(localAddress); } else { throw new IllegalArgumentException("localAddress is not a valid IPv4 or IPv6 address!"); } if (remoteAddress.getAddress() instanceof java.net.Inet4Address) { r = new sockaddr_in(remoteAddress); } else if (remoteAddress.getAddress() instanceof java.net.Inet6Address) { r = new sockaddr_in6(remoteAddress); } else { throw new IllegalArgumentException("remoteAddress is not a valid IPv4 or IPv6 address!"); } SCNetworkReachability reachability = create(null, l, r); reachability.localRefconId = refconId; return reachability; } /**
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(java.net.InetSocketAddress localAddress, java.net.InetSocketAddress remoteAddress) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); Struct<?> l; Struct<?> r; if (localAddress.getAddress() instanceof java.net.Inet4Address) { l = new sockaddr_in(localAddress); } else if (localAddress.getAddress() instanceof java.net.Inet6Address) { l = new sockaddr_in6(localAddress); } else { throw new IllegalArgumentException("localAddress is not a valid IPv4 or IPv6 address!"); } if (remoteAddress.getAddress() instanceof java.net.Inet4Address) { r = new sockaddr_in(remoteAddress); } else if (remoteAddress.getAddress() instanceof java.net.Inet6Address) { r = new sockaddr_in6(remoteAddress); } else { throw new IllegalArgumentException("remoteAddress is not a valid IPv4 or IPv6 address!"); } long reachability = create(null, l, r); localRefconId = refconId; setHandle(reachability); } /**
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachabilityFlags getFlags() { IntPtr ptr = new IntPtr(); getFlags(ptr); return new SCNetworkReachabilityFlags(ptr.get()); } /**
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(java.net.InetSocketAddress localAddress, java.net.InetSocketAddress remoteAddress) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); Struct<?> l; Struct<?> r; if (localAddress.getAddress() instanceof java.net.Inet4Address) { l = new sockaddr_in(localAddress); } else if (localAddress.getAddress() instanceof java.net.Inet6Address) { l = new sockaddr_in6(localAddress); } else { throw new IllegalArgumentException("localAddress is not a valid IPv4 or IPv6 address!"); } if (remoteAddress.getAddress() instanceof java.net.Inet4Address) { r = new sockaddr_in(remoteAddress); } else if (remoteAddress.getAddress() instanceof java.net.Inet6Address) { r = new sockaddr_in6(remoteAddress); } else { throw new IllegalArgumentException("remoteAddress is not a valid IPv4 or IPv6 address!"); } long reachability = create(null, l, r); localRefconId = refconId; setHandle(reachability); } /**