91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .java
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-11
  • 語言: Java
  • 標簽: dhcpinfo??

資源簡介

android4.4 DhcpInfoInternal.java

資源截圖

代碼片段和文件信息

/*
?*?Copyright?(C)?2010?The?Android?Open?Source?Project
?*
?*?Licensed?under?the?Apache?License?Version?2.0?(the?“License“);
?*?you?may?not?use?this?file?except?in?compliance?with?the?License.
?*?You?may?obtain?a?copy?of?the?License?at
?*
?*??????http://www.apache.org/licenses/LICENSE-2.0
?*
?*?Unless?required?by?applicable?law?or?agreed?to?in?writing?software
?*?distributed?under?the?License?is?distributed?on?an?“AS?IS“?BASIS
?*?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY?KIND?either?express?or?implied.
?*?See?the?License?for?the?specific?language?governing?permissions?and
?*?limitations?under?the?License.
?*/

package?android.net;

import?android.text.TextUtils;
import?android.util.Log;

import?java.net.Inet4Address;
import?java.net.InetAddress;
import?java.util.ArrayList;
import?java.util.Collection;
import?java.util.Collections;

/**
?*?A?simple?object?for?retrieving?the?results?of?a?DHCP?request.
?*?Replaces?(internally)?the?IPv4-only?DhcpInfo?class.
?*?@hide
?*/
public?class?DhcpInfoInternal?{
????private?final?static?String?TAG?=?“DhcpInfoInternal“;
????public?String?ipAddress;
????public?int?prefixLength;

????public?String?dns1;
????public?String?dns2;

????public?String?serverAddress;
????public?int?leaseDuration;

????/**
?????*?Vendor?specific?information?(from?RFC?2132).
?????*/
????public?String?vendorInfo;

????private?Collection?mRoutes;

????public?DhcpInfoInternal()?{
????????mRoutes?=?new?ArrayList();
????}

????public?void?addRoute(RouteInfo?routeInfo)?{
????????mRoutes.add(routeInfo);
????}

????public?Collection?getRoutes()?{
????????return?Collections.unmodifiableCollection(mRoutes);
????}

????private?int?convertToInt(String?addr)?{
????????if?(addr?!=?null)?{
????????????try?{
????????????????InetAddress?inetAddress?=?NetworkUtils.numericToInetAddress(addr);
????????????????if?(inetAddress?instanceof?Inet4Address)?{
????????????????????return?NetworkUtils.inetAddressToInt((Inet4Address)inetAddress);
????????????????}
????????????}?catch?(IllegalArgumentException?e)?{}
????????}
????????return?0;
????}

????public?DhcpInfo?makeDhcpInfo()?{
????????DhcpInfo?info?=?new?DhcpInfo();
????????info.ipAddress?=?convertToInt(ipAddress);
????????for?(RouteInfo?route?:?mRoutes)?{
????????????if?(route.isDefaultRoute())?{
????????????????info.gateway?=?convertToInt(route.getGateway().getHostAddress());
????????????????break;
????????????}
????????}
????????try?{
????????????InetAddress?inetAddress?=?NetworkUtils.numericToInetAddress(ipAddress);
????????????info.netmask?=?NetworkUtils.prefixLeng

評論

共有 條評論

相關資源