Definition at line 60 of file Reachability.h.
◆ connectionRequired
- (BOOL) connectionRequired |
|
|
|
Definition at line 80 of file Reachability.m.
249{
250 NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
251 SCNetworkReachabilityFlags flags;
252 if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
253 {
254 return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
255 }
256 return NO;
257}
◆ currentReachabilityStatus
- (NetworkStatus) currentReachabilityStatus |
|
|
|
Definition at line 80 of file Reachability.m.
260{
261 NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef");
262 NetworkStatus retVal = NotReachable;
263 SCNetworkReachabilityFlags flags;
264 if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
265 {
266 if (localWiFiRef)
267 {
268 retVal = [self localWiFiStatusForFlags:flags];
269 }
270 else
271 {
272 retVal = [self networkStatusForFlags:flags];
273 }
274 }
275 return retVal;
276}
◆ reachabilityForInternetConnection
Definition at line 80 of file Reachability.m.
169{
170 struct sockaddr_in zeroAddress;
171 bzero(&zeroAddress, sizeof(zeroAddress));
172 zeroAddress.sin_len = sizeof(zeroAddress);
173 zeroAddress.sin_family = AF_INET;
174 return [self reachabilityWithAddress:&zeroAddress];
175}
◆ reachabilityForLocalWiFi
Definition at line 80 of file Reachability.m.
178{
179 struct sockaddr_in localWifiAddress;
180 bzero(&localWifiAddress, sizeof(localWifiAddress));
181 localWifiAddress.sin_len = sizeof(localWifiAddress);
182 localWifiAddress.sin_family = AF_INET;
183
184 localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
185 Reachability *retVal = [
self reachabilityWithAddress:&localWifiAddress];
186 if (retVal != NULL)
187 {
188 retVal->localWiFiRef = YES;
189 }
190 return retVal;
191}
◆ reachabilityWithAddress:
+ (Reachability *) reachabilityWithAddress: |
|
(const struct sockaddr_in *) |
hostAddress |
|
Definition at line 80 of file Reachability.m.
151 :(const struct sockaddr_in *)hostAddress;
152{
153 SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(
154 kCFAllocatorDefault, (const struct sockaddr *)hostAddress);
156 if (reachability != NULL)
157 {
158 retVal = [[[self alloc] init] autorelease];
159 if (retVal != NULL)
160 {
161 retVal->reachabilityRef = reachability;
162 retVal->localWiFiRef = NO;
163 }
164 }
165 return retVal;
166}
◆ reachabilityWithHostName:
+ (Reachability *) reachabilityWithHostName: |
|
(NSString *) |
hostName |
|
Definition at line 80 of file Reachability.m.
134 :(NSString *)hostName;
135{
137 SCNetworkReachabilityRef reachability =
138 SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
139 if (reachability != NULL)
140 {
141 retVal = [[[self alloc] init] autorelease];
142 if (retVal != NULL)
143 {
144 retVal->reachabilityRef = reachability;
145 retVal->localWiFiRef = NO;
146 }
147 }
148 return retVal;
149}
◆ startNotifier
Definition at line 80 of file Reachability.m.
101{
102 BOOL retVal = NO;
103 SCNetworkReachabilityContext context = { 0, self, NULL, NULL, NULL };
104 if (SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
105 {
106 if (SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(),
107 kCFRunLoopDefaultMode))
108 {
109 retVal = YES;
110 }
111 }
112 return retVal;
113}
◆ stopNotifier
Definition at line 80 of file Reachability.m.
116{
117 if (reachabilityRef != NULL)
118 {
119 SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(),
120 kCFRunLoopDefaultMode);
121 }
122}
◆ localWiFiRef
◆ reachabilityRef
- (SCNetworkReachabilityRef) reachabilityRef |
|
protected |
The documentation for this class was generated from the following files: