Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
tonymillion committed Nov 21, 2011
1 parent 9f32bf3 commit f884b08
Show file tree
Hide file tree
Showing 2 changed files with 187 additions and 66 deletions.
22 changes: 22 additions & 0 deletions Reachability.h
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand All @@ -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

0 comments on commit f884b08

Please sign in to comment.