Remove DhcpInfoInternal
First step in accepting a set of patches. bug:6799630 Change-Id: I6c894c60aeb3022960c2aaa45451bb1dde2b493b
This commit is contained in:
parent
594ea872c8
commit
462e5705c8
4 changed files with 88 additions and 70 deletions
|
|
@ -22,16 +22,17 @@ import java.net.InetAddress;
|
|||
|
||||
/**
|
||||
* A simple object for retrieving the results of a DHCP request.
|
||||
* @deprecated - use LinkProperties - To be removed 11/2013
|
||||
* STOPSHIP - make sure we expose LinkProperties through ConnectivityManager
|
||||
*/
|
||||
public class DhcpInfo implements Parcelable {
|
||||
public int ipAddress;
|
||||
public int gateway;
|
||||
public int netmask;
|
||||
|
||||
public int dns1;
|
||||
public int dns2;
|
||||
|
||||
public int serverAddress;
|
||||
|
||||
public int leaseDuration;
|
||||
|
||||
public DhcpInfo() {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import java.util.Collections;
|
|||
*/
|
||||
public class LinkProperties implements Parcelable {
|
||||
|
||||
String mIfaceName;
|
||||
private String mIfaceName;
|
||||
private Collection<LinkAddress> mLinkAddresses = new ArrayList<LinkAddress>();
|
||||
private Collection<InetAddress> mDnses = new ArrayList<InetAddress>();
|
||||
private Collection<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
|
||||
|
|
@ -181,7 +181,7 @@ public class LinkProperties implements Parcelable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Compares this {@code LinkProperties} interface name against the target
|
||||
* Compares this {@code LinkProperties} interface addresses against the target
|
||||
*
|
||||
* @param target LinkProperties to compare.
|
||||
* @return {@code true} if both are identical, {@code false} otherwise.
|
||||
|
|
@ -365,7 +365,6 @@ public class LinkProperties implements Parcelable {
|
|||
|
||||
/**
|
||||
* Implement the Parcelable interface.
|
||||
* @hide
|
||||
*/
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(getInterfaceName());
|
||||
|
|
@ -394,19 +393,15 @@ public class LinkProperties implements Parcelable {
|
|||
|
||||
/**
|
||||
* Implement the Parcelable interface.
|
||||
* @hide
|
||||
*/
|
||||
public static final Creator<LinkProperties> CREATOR =
|
||||
new Creator<LinkProperties>() {
|
||||
public LinkProperties createFromParcel(Parcel in) {
|
||||
LinkProperties netProp = new LinkProperties();
|
||||
|
||||
String iface = in.readString();
|
||||
if (iface != null) {
|
||||
try {
|
||||
netProp.setInterfaceName(iface);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
netProp.setInterfaceName(iface);
|
||||
}
|
||||
int addressCount = in.readInt();
|
||||
for (int i=0; i<addressCount; i++) {
|
||||
|
|
|
|||
|
|
@ -62,21 +62,21 @@ public class NetworkUtils {
|
|||
* addresses. This call blocks until it obtains a result (either success
|
||||
* or failure) from the daemon.
|
||||
* @param interfaceName the name of the interface to configure
|
||||
* @param ipInfo if the request succeeds, this object is filled in with
|
||||
* @param dhcpResults if the request succeeds, this object is filled in with
|
||||
* the IP address information.
|
||||
* @return {@code true} for success, {@code false} for failure
|
||||
*/
|
||||
public native static boolean runDhcp(String interfaceName, DhcpInfoInternal ipInfo);
|
||||
public native static boolean runDhcp(String interfaceName, DhcpResults dhcpResults);
|
||||
|
||||
/**
|
||||
* Initiate renewal on the Dhcp client daemon. This call blocks until it obtains
|
||||
* a result (either success or failure) from the daemon.
|
||||
* @param interfaceName the name of the interface to configure
|
||||
* @param ipInfo if the request succeeds, this object is filled in with
|
||||
* @param dhcpResults if the request succeeds, this object is filled in with
|
||||
* the IP address information.
|
||||
* @return {@code true} for success, {@code false} for failure
|
||||
*/
|
||||
public native static boolean runDhcpRenew(String interfaceName, DhcpInfoInternal ipInfo);
|
||||
public native static boolean runDhcpRenew(String interfaceName, DhcpResults dhcpResults);
|
||||
|
||||
/**
|
||||
* Shut down the DHCP client daemon.
|
||||
|
|
@ -124,12 +124,9 @@ public class NetworkUtils {
|
|||
* @param inetAddr is an InetAddress corresponding to the IPv4 address
|
||||
* @return the IP address as an integer in network byte order
|
||||
*/
|
||||
public static int inetAddressToInt(InetAddress inetAddr)
|
||||
public static int inetAddressToInt(Inet4Address inetAddr)
|
||||
throws IllegalArgumentException {
|
||||
byte [] addr = inetAddr.getAddress();
|
||||
if (addr.length != 4) {
|
||||
throw new IllegalArgumentException("Not an IPv4 address");
|
||||
}
|
||||
return ((addr[3] & 0xff) << 24) | ((addr[2] & 0xff) << 16) |
|
||||
((addr[1] & 0xff) << 8) | (addr[0] & 0xff);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ public class RouteInfo implements Parcelable {
|
|||
this(null, gateway);
|
||||
}
|
||||
|
||||
public RouteInfo(LinkAddress host) {
|
||||
this(host, null);
|
||||
}
|
||||
|
||||
public static RouteInfo makeHostRoute(InetAddress host) {
|
||||
return makeHostRoute(host, null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue