Java Code Examples for android.net.LinkProperties#getRoutes()
The following examples show how to use
android.net.LinkProperties#getRoutes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OffloadController.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public void removeDownstreamInterface(String ifname) { final LinkProperties lp = mDownstreams.remove(ifname); if (lp == null) return; if (!started()) return; for (RouteInfo route : lp.getRoutes()) { if (shouldIgnoreDownstreamRoute(route)) continue; mHwInterface.removeDownstreamPrefix(ifname, route.getDestination().toString()); } }
Example 2
Source File: IPv6TetheringCoordinator.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private static LinkProperties getIPv6OnlyLinkProperties(LinkProperties lp) { final LinkProperties v6only = new LinkProperties(); if (lp == null) { return v6only; } // NOTE: At this time we don't copy over any information about any // stacked links. No current stacked link configuration has IPv6. v6only.setInterfaceName(lp.getInterfaceName()); v6only.setMtu(lp.getMtu()); for (LinkAddress linkAddr : lp.getLinkAddresses()) { if (linkAddr.isGlobalPreferred() && linkAddr.getPrefixLength() == 64) { v6only.addLinkAddress(linkAddr); } } for (RouteInfo routeInfo : lp.getRoutes()) { final IpPrefix destination = routeInfo.getDestination(); if ((destination.getAddress() instanceof Inet6Address) && (destination.getPrefixLength() <= 64)) { v6only.addRoute(routeInfo); } } for (InetAddress dnsServer : lp.getDnsServers()) { if (isIPv6GlobalAddress(dnsServer)) { // For now we include ULAs. v6only.addDnsServer(dnsServer); } } v6only.setDomains(lp.getDomains()); return v6only; }
Example 3
Source File: DnsServersDetector.java From androdns with Apache License 2.0 | 5 votes |
/** * Returns true if the specified link properties have any default route * @param linkProperties * @return true if the specified link properties have default route or false otherwise */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) private boolean linkPropertiesHasDefaultRoute(LinkProperties linkProperties) { for (RouteInfo route : linkProperties.getRoutes()) { if (route.isDefaultRoute()) { return true; } } return false; }
Example 4
Source File: AndroidUsingLinkProperties.java From Pix-Art-Messenger with GNU General Public License v3.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static boolean hasDefaultRoute(LinkProperties linkProperties) { for (RouteInfo route : linkProperties.getRoutes()) { if (route.isDefaultRoute()) { return true; } } return false; }
Example 5
Source File: AndroidUsingLinkProperties.java From Conversations with GNU General Public License v3.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static boolean hasDefaultRoute(LinkProperties linkProperties) { for(RouteInfo route: linkProperties.getRoutes()) { if (route.isDefaultRoute()) { return true; } } return false; }