Permalink
Browse files

Updates & MacOS compatibility

Made the class completely api compatible with Apples (I haven't
specifically tested the additional cases I have added as I don't use
them).

Class should be Mac (Cocoa) compatible now
  • Loading branch information...
1 parent 9f32bf3 commit f884b08ccfe8207b7765bbd92ab63168f5b8cd96 @tonymillion committed Nov 21, 2011
Showing with 187 additions and 66 deletions.
  1. +22 −0 Reachability.h
  2. +165 −66 Reachability.m
View
@@ -28,6 +28,13 @@
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
+#import <sys/socket.h>
+#import <netinet/in.h>
+#import <netinet6/in6.h>
+#import <arpa/inet.h>
+#import <ifaddrs.h>
+#import <netdb.h>
+
extern NSString *const kReachabilityChangedNotification;
typedef enum
@@ -57,6 +64,8 @@ typedef void (^NetworkUnreachable)(Reachability * reachability);
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
++(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
++(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
@@ -67,6 +76,19 @@ typedef void (^NetworkUnreachable)(Reachability * reachability);
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
+// WWAN may be available, but not active until a connection has been established.
+// WiFi may require a connection for VPN on Demand.
+-(BOOL)isConnectionRequired; // Identical DDG variant.
+-(BOOL)connectionRequired; // Apple's routine.
+// Dynamic, on demand connection?
+-(BOOL)isConnectionOnDemand;
+// Is user intervention required?
+-(BOOL)isInterventionRequired;
+
-(NetworkStatus)currentReachabilityStatus;
+-(SCNetworkReachabilityFlags)reachabilityFlags;
+-(NSString*)currentReachabilityString;
+-(NSString*)currentReachabilityFlags;
+
@end
Oops, something went wrong.

0 comments on commit f884b08

Please sign in to comment.