aliyun-oss-react-native

OSSReachability.h 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. Copyright (C) 2016 Apple Inc. All Rights Reserved.
  3. See LICENSE.txt for this sample’s licensing information
  4. Abstract:
  5. Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
  6. */
  7. #import <Foundation/Foundation.h>
  8. #import <SystemConfiguration/SystemConfiguration.h>
  9. #import <netinet/in.h>
  10. typedef enum : NSInteger {
  11. OSSNotReachable = 0,
  12. OSSReachableViaWiFi,
  13. OSSReachableViaWWAN
  14. } OSSNetworkStatus;
  15. #pragma mark IPv6 Support
  16. //Reachability fully support IPv6. For full details, see ReadMe.md.
  17. extern NSString *ossReachabilityChangedNotification;
  18. @interface OSSReachability : NSObject
  19. /*!
  20. * Use to check the reachability of a given host name.
  21. */
  22. + (instancetype)reachabilityWithHostName:(NSString *)hostName;
  23. /*!
  24. * Use to check the reachability of a given IP address.
  25. */
  26. + (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress;
  27. /*!
  28. * Checks whether the default route is available. Should be used by applications that do not connect to a particular host.
  29. */
  30. + (instancetype)reachabilityForInternetConnection;
  31. #pragma mark reachabilityForLocalWiFi
  32. //reachabilityForLocalWiFi has been removed from the sample. See ReadMe.md for more information.
  33. //+ (instancetype)reachabilityForLocalWiFi;
  34. /*!
  35. * Start listening for reachability notifications on the current run loop.
  36. */
  37. - (BOOL)startNotifier;
  38. - (void)stopNotifier;
  39. - (OSSNetworkStatus)currentReachabilityStatus;
  40. /*!
  41. * WWAN may be available, but not active until a connection has been established. WiFi may require a connection for VPN on Demand.
  42. */
  43. - (BOOL)connectionRequired;
  44. @end