in Source/TNLCommunicationAgent.m [832:886]
static TNLNetworkReachabilityStatus _NetworkReachabilityStatusFromFlags(TNLNetworkReachabilityFlags flags)
{
if (tnl_available_ios_12) {
const TNLNetworkReachabilityMask mask = flags;
if (TNL_BITMASK_EXCLUDES_FLAGS(mask, TNLNetworkReachabilityMaskPathStatusSatisfied)) {
return TNLNetworkReachabilityNotReachable;
}
if (TNL_BITMASK_INTERSECTS_FLAGS(mask, TNLNetworkReachabilityMaskPathIntefaceTypeWifi)) {
return TNLNetworkReachabilityReachableViaEthernet;
}
if (TNL_BITMASK_INTERSECTS_FLAGS(mask, TNLNetworkReachabilityMaskPathIntefaceTypeWired)) {
return TNLNetworkReachabilityReachableViaEthernet;
}
if (TNL_BITMASK_INTERSECTS_FLAGS(mask, TNLNetworkReachabilityMaskPathIntefaceTypeCellular)) {
return TNLNetworkReachabilityReachableViaWWAN;
}
// "Other" happens when using VPN or other tunneling protocol.
// On iOS/tvOS/watchOS devices: WiFi or Wired or Cellular would have been hit above.
// On Mac and iOS Simulator: WiFi or Wired will _NOT_ be provide in the flags so, even though we coerce to WiFi in this case on Mac, presume Ethernet if we get here.
if (TNL_BITMASK_INTERSECTS_FLAGS(mask, TNLNetworkReachabilityMaskPathIntefaceTypeOther)) {
return TNLNetworkReachabilityReachableViaEthernet;
}
return TNLNetworkReachabilityUndetermined;
}
if (TNL_BITMASK_EXCLUDES_FLAGS(flags, kSCNetworkReachabilityFlagsReachable)) {
return TNLNetworkReachabilityNotReachable;
}
#if TARGET_OS_IOS
if (TNL_BITMASK_INTERSECTS_FLAGS(flags, kSCNetworkReachabilityFlagsIsWWAN)) {
return TNLNetworkReachabilityReachableViaWWAN;
}
#endif
if (TNL_BITMASK_EXCLUDES_FLAGS(flags, kSCNetworkReachabilityFlagsConnectionRequired)) {
return TNLNetworkReachabilityReachableViaEthernet;
}
if (TNL_BITMASK_EXCLUDES_FLAGS(flags, kSCNetworkReachabilityFlagsInterventionRequired)) {
if (TNL_BITMASK_INTERSECTS_FLAGS(flags, kSCNetworkReachabilityFlagsConnectionOnDemand)) {
return TNLNetworkReachabilityReachableViaEthernet;
}
if (TNL_BITMASK_INTERSECTS_FLAGS(flags, kSCNetworkReachabilityFlagsConnectionOnTraffic)) {
return TNLNetworkReachabilityReachableViaEthernet;
}
}
return TNLNetworkReachabilityNotReachable;
}