Revert "Initial Passpoint code."
This reverts commit 2eba02a112.
Change-Id: I11da074b8d8990fc01faac3586fd3488f76af326
This commit is contained in:
766
api/current.txt
766
api/current.txt
@@ -18139,772 +18139,6 @@ package android.net.wifi {
|
||||
|
||||
}
|
||||
|
||||
package android.net.wifi.anqp {
|
||||
|
||||
public abstract class ANQPElement {
|
||||
ctor protected ANQPElement(android.net.wifi.anqp.Constants.ANQPElementType);
|
||||
method public android.net.wifi.anqp.Constants.ANQPElementType getID();
|
||||
}
|
||||
|
||||
public class ANQPFactory {
|
||||
ctor public ANQPFactory();
|
||||
method public static java.util.List<android.net.wifi.anqp.ANQPElement> parsePayload(java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
}
|
||||
|
||||
public class CapabilityListElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public CapabilityListElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.Constants.ANQPElementType[] getCapabilities();
|
||||
}
|
||||
|
||||
public class CivicLocationElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public CivicLocationElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.Locale getLocale();
|
||||
method public android.net.wifi.anqp.CivicLocationElement.LocationType getLocationType();
|
||||
method public java.util.Map<android.net.wifi.anqp.CivicLocationElement.CAType, java.lang.String> getValues();
|
||||
field public static final int ADDITIONAL_CODE = 32; // 0x20
|
||||
field public static final int ADDITIONAL_LOCATION = 22; // 0x16
|
||||
field public static final int BLOCK = 5; // 0x5
|
||||
field public static final int BRANCH_ROAD = 36; // 0x24
|
||||
field public static final int BUILDING = 25; // 0x19
|
||||
field public static final int CITY = 3; // 0x3
|
||||
field public static final int COUNTY_DISTRICT = 2; // 0x2
|
||||
field public static final int DIVISION_BOROUGH = 4; // 0x4
|
||||
field public static final int FLOOR = 27; // 0x1b
|
||||
field public static final int HOUSE_NUMBER = 19; // 0x13
|
||||
field public static final int HOUSE_NUMBER_SUFFIX = 20; // 0x14
|
||||
field public static final int LANDMARK = 21; // 0x15
|
||||
field public static final int LANGUAGE = 0; // 0x0
|
||||
field public static final int LEADING_STREET_SUFFIX = 17; // 0x11
|
||||
field public static final int NAME = 23; // 0x17
|
||||
field public static final int POSTAL_COMMUNITY = 30; // 0x1e
|
||||
field public static final int POSTAL_ZIP = 24; // 0x18
|
||||
field public static final int PO_BOX = 31; // 0x1f
|
||||
field public static final int PRIMARY_ROAD = 34; // 0x22
|
||||
field public static final int RESERVED = 255; // 0xff
|
||||
field public static final int ROAD_SECTION = 35; // 0x23
|
||||
field public static final int ROOM = 28; // 0x1c
|
||||
field public static final int SCRIPT = 128; // 0x80
|
||||
field public static final int SEAT_DESK = 33; // 0x21
|
||||
field public static final int STATE_PROVINCE = 1; // 0x1
|
||||
field public static final int STREET_DIRECTION = 16; // 0x10
|
||||
field public static final int STREET_GROUP = 6; // 0x6
|
||||
field public static final int STREET_NAME_POST_MOD = 39; // 0x27
|
||||
field public static final int STREET_NAME_PRE_MOD = 38; // 0x26
|
||||
field public static final int STREET_SUFFIX = 18; // 0x12
|
||||
field public static final int SUB_BRANCH_ROAD = 37; // 0x25
|
||||
field public static final int TYPE = 29; // 0x1d
|
||||
field public static final int UNIT = 26; // 0x1a
|
||||
}
|
||||
|
||||
public static final class CivicLocationElement.CAType extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.CivicLocationElement.CAType valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.CivicLocationElement.CAType[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType AdditionalCode;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType AdditionalLocation;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Block;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType BranchRoad;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Building;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType City;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType CountyDistrict;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType DivisionBorough;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Floor;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType HouseNumber;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType HouseNumberSuffix;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Landmark;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Language;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType LeadingStreetSuffix;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Name;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType POBox;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType PostalCommunity;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType PostalZIP;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType PrimaryRoad;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Reserved;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType RoadSection;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Room;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Script;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType SeatDesk;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType StateProvince;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType StreetDirection;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType StreetGroup;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType StreetNamePostMod;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType StreetNamePreMod;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType StreetSuffix;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType SubBranchRoad;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Type;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.CAType Unit;
|
||||
}
|
||||
|
||||
public static final class CivicLocationElement.LocationType extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.CivicLocationElement.LocationType valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.CivicLocationElement.LocationType[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.LocationType Client;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.LocationType DHCPServer;
|
||||
enum_constant public static final android.net.wifi.anqp.CivicLocationElement.LocationType NwkElement;
|
||||
}
|
||||
|
||||
public class Constants {
|
||||
ctor public Constants();
|
||||
method public static long getInteger(java.nio.ByteBuffer, int);
|
||||
method public static java.lang.String getPrefixedString(java.nio.ByteBuffer, int, java.nio.charset.Charset) throws java.net.ProtocolException;
|
||||
method public static java.lang.String getString(java.nio.ByteBuffer, int, java.nio.charset.Charset) throws java.net.ProtocolException;
|
||||
method public static java.lang.String getString(java.nio.ByteBuffer, int, java.nio.charset.Charset, boolean) throws java.net.ProtocolException;
|
||||
method public static android.net.wifi.anqp.Constants.ANQPElementType mapANQPElement(int);
|
||||
method public static android.net.wifi.anqp.Constants.ANQPElementType mapHS20Element(int);
|
||||
method public static java.lang.String toHexString(byte[]);
|
||||
field public static final int ANQP_3GPP_NETWORK = 264; // 0x108
|
||||
field public static final int ANQP_CAPABILITY_LIST = 257; // 0x101
|
||||
field public static final int ANQP_CIVIC_LOC = 266; // 0x10a
|
||||
field public static final int ANQP_DOM_NAME = 268; // 0x10c
|
||||
field public static final int ANQP_EMERGENCY_ALERT = 269; // 0x10d
|
||||
field public static final int ANQP_EMERGENCY_NAI = 271; // 0x10f
|
||||
field public static final int ANQP_EMERGENCY_NUMBER = 259; // 0x103
|
||||
field public static final int ANQP_GEO_LOC = 265; // 0x109
|
||||
field public static final int ANQP_IP_ADDR_AVAILABILITY = 262; // 0x106
|
||||
field public static final int ANQP_LOC_URI = 267; // 0x10b
|
||||
field public static final int ANQP_NAI_REALM = 263; // 0x107
|
||||
field public static final int ANQP_NEIGHBOR_REPORT = 272; // 0x110
|
||||
field public static final int ANQP_NWK_AUTH_TYPE = 260; // 0x104
|
||||
field public static final int ANQP_QUERY_LIST = 256; // 0x100
|
||||
field public static final int ANQP_ROAMING_CONSORTIUM = 261; // 0x105
|
||||
field public static final int ANQP_TDLS_CAP = 270; // 0x10e
|
||||
field public static final int ANQP_VENDOR_SPEC = 56797; // 0xdddd
|
||||
field public static final int ANQP_VENUE_NAME = 258; // 0x102
|
||||
field public static final int BYTES_IN_INT = 4; // 0x4
|
||||
field public static final int BYTES_IN_SHORT = 2; // 0x2
|
||||
field public static final int BYTE_MASK = 255; // 0xff
|
||||
field public static final int HS20Type = 17; // 0x11
|
||||
field public static final int HS20_OI_LENGTH = 3; // 0x3
|
||||
field public static final int HS20_VID = 5271450; // 0x506f9a
|
||||
field public static final int HS_CAPABILITY_LIST = 2; // 0x2
|
||||
field public static final int HS_CONN_CAPABILITY = 5; // 0x5
|
||||
field public static final int HS_FRIENDLY_NAME = 3; // 0x3
|
||||
field public static final int HS_ICON_FILE = 11; // 0xb
|
||||
field public static final int HS_ICON_REQUEST = 10; // 0xa
|
||||
field public static final int HS_NAI_HOME_REALM_QUERY = 6; // 0x6
|
||||
field public static final int HS_OPERATING_CLASS = 7; // 0x7
|
||||
field public static final int HS_OSU_PROVIDERS = 8; // 0x8
|
||||
field public static final int HS_QUERY_LIST = 1; // 0x1
|
||||
field public static final int HS_WAN_METRICS = 4; // 0x4
|
||||
field public static final long INT_MASK = 4294967295L; // 0xffffffffL
|
||||
field public static final int SHORT_MASK = 65535; // 0xffff
|
||||
}
|
||||
|
||||
public static final class Constants.ANQPElementType extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.Constants.ANQPElementType valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.Constants.ANQPElementType[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQP3GPPNetwork;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPCapabilityList;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPCivicLoc;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPDomName;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPEmergencyAlert;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPEmergencyNAI;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPEmergencyNumber;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPGeoLoc;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPIPAddrAvailability;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPLocURI;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPNAIRealm;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPNeighborReport;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPNwkAuthType;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPQueryList;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPRoamingConsortium;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPTDLSCap;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPVendorSpec;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType ANQPVenueName;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSCapabilityList;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSConnCapability;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSFriendlyName;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSIconFile;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSIconRequest;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSNAIHomeRealmQuery;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSOSUProviders;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSOperatingclass;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSQueryList;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.ANQPElementType HSWANMetrics;
|
||||
}
|
||||
|
||||
public static final class Constants.IconStatus extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.Constants.IconStatus valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.Constants.IconStatus[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.IconStatus FileNotFound;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.IconStatus Success;
|
||||
enum_constant public static final android.net.wifi.anqp.Constants.IconStatus Unspecified;
|
||||
}
|
||||
|
||||
public class DomainNameElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public DomainNameElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<java.lang.String> getDomains();
|
||||
}
|
||||
|
||||
public class EmergencyNumberElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public EmergencyNumberElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<java.lang.String> getNumbers();
|
||||
}
|
||||
|
||||
public class GEOLocationElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public GEOLocationElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.GEOLocationElement.RealValue getAltitude();
|
||||
method public android.net.wifi.anqp.GEOLocationElement.AltitudeType getAltitudeType();
|
||||
method public android.net.wifi.anqp.GEOLocationElement.Datum getDatum();
|
||||
method public android.net.wifi.anqp.GEOLocationElement.RealValue getLatitude();
|
||||
method public android.net.wifi.anqp.GEOLocationElement.RealValue getLongitude();
|
||||
}
|
||||
|
||||
public static final class GEOLocationElement.AltitudeType extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.GEOLocationElement.AltitudeType valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.GEOLocationElement.AltitudeType[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.GEOLocationElement.AltitudeType Floors;
|
||||
enum_constant public static final android.net.wifi.anqp.GEOLocationElement.AltitudeType Meters;
|
||||
enum_constant public static final android.net.wifi.anqp.GEOLocationElement.AltitudeType Unknown;
|
||||
}
|
||||
|
||||
public static final class GEOLocationElement.Datum extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.GEOLocationElement.Datum valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.GEOLocationElement.Datum[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.GEOLocationElement.Datum NAD83Land;
|
||||
enum_constant public static final android.net.wifi.anqp.GEOLocationElement.Datum NAD83Water;
|
||||
enum_constant public static final android.net.wifi.anqp.GEOLocationElement.Datum Unknown;
|
||||
enum_constant public static final android.net.wifi.anqp.GEOLocationElement.Datum WGS84;
|
||||
}
|
||||
|
||||
public static class GEOLocationElement.RealValue {
|
||||
ctor public GEOLocationElement.RealValue(double);
|
||||
ctor public GEOLocationElement.RealValue(double, int);
|
||||
method public int getResolution();
|
||||
method public double getValue();
|
||||
method public boolean isResolutionSet();
|
||||
}
|
||||
|
||||
public class GenericBlobElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public GenericBlobElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer);
|
||||
method public byte[] getData();
|
||||
}
|
||||
|
||||
public class GenericStringElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public GenericStringElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.lang.String getM_text();
|
||||
}
|
||||
|
||||
public class HSCapabilityListElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public HSCapabilityListElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.Constants.ANQPElementType[] getCapabilities();
|
||||
}
|
||||
|
||||
public class HSConnectionCapabilityElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public HSConnectionCapabilityElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<android.net.wifi.anqp.HSConnectionCapabilityElement.ProtocolTuple> getStatusList();
|
||||
}
|
||||
|
||||
public static final class HSConnectionCapabilityElement.ProtoStatus extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.HSConnectionCapabilityElement.ProtoStatus valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.HSConnectionCapabilityElement.ProtoStatus[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.HSConnectionCapabilityElement.ProtoStatus Closed;
|
||||
enum_constant public static final android.net.wifi.anqp.HSConnectionCapabilityElement.ProtoStatus Open;
|
||||
enum_constant public static final android.net.wifi.anqp.HSConnectionCapabilityElement.ProtoStatus Unknown;
|
||||
}
|
||||
|
||||
public static class HSConnectionCapabilityElement.ProtocolTuple {
|
||||
method public int getPort();
|
||||
method public int getProtocol();
|
||||
method public android.net.wifi.anqp.HSConnectionCapabilityElement.ProtoStatus getStatus();
|
||||
}
|
||||
|
||||
public class HSFriendlyNameElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public HSFriendlyNameElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<android.net.wifi.anqp.I18Name> getNames();
|
||||
}
|
||||
|
||||
public class HSIconFileElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public HSIconFileElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public byte[] getIconData();
|
||||
method public android.net.wifi.anqp.HSIconFileElement.StatusCode getStatusCode();
|
||||
method public java.lang.String getType();
|
||||
}
|
||||
|
||||
public static final class HSIconFileElement.StatusCode extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.HSIconFileElement.StatusCode valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.HSIconFileElement.StatusCode[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.HSIconFileElement.StatusCode FileNotFound;
|
||||
enum_constant public static final android.net.wifi.anqp.HSIconFileElement.StatusCode Success;
|
||||
enum_constant public static final android.net.wifi.anqp.HSIconFileElement.StatusCode Unspecified;
|
||||
}
|
||||
|
||||
public class HSOsuProvidersElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public HSOsuProvidersElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<android.net.wifi.anqp.OSUProvider> getProviders();
|
||||
method public java.lang.String getSSID();
|
||||
}
|
||||
|
||||
public class HSWanMetricsElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public HSWanMetricsElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public int getDlLoad();
|
||||
method public long getDlSpeed();
|
||||
method public int getLMD();
|
||||
method public android.net.wifi.anqp.HSWanMetricsElement.LinkStatus getStatus();
|
||||
method public int getUlLoad();
|
||||
method public long getUlSpeed();
|
||||
method public boolean isCapped();
|
||||
method public boolean isSymmetric();
|
||||
}
|
||||
|
||||
public static final class HSWanMetricsElement.LinkStatus extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.HSWanMetricsElement.LinkStatus valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.HSWanMetricsElement.LinkStatus[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.HSWanMetricsElement.LinkStatus Down;
|
||||
enum_constant public static final android.net.wifi.anqp.HSWanMetricsElement.LinkStatus Reserved;
|
||||
enum_constant public static final android.net.wifi.anqp.HSWanMetricsElement.LinkStatus Test;
|
||||
enum_constant public static final android.net.wifi.anqp.HSWanMetricsElement.LinkStatus Up;
|
||||
}
|
||||
|
||||
public class I18Name {
|
||||
ctor public I18Name(java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.Locale getLocale();
|
||||
method public java.lang.String getText();
|
||||
}
|
||||
|
||||
public class IPAddressTypeAvailabilityElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public IPAddressTypeAvailabilityElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability getV4Availability();
|
||||
method public android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv6Availability getV6Availability();
|
||||
}
|
||||
|
||||
public static final class IPAddressTypeAvailabilityElement.IPv4Availability extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability DoubleNAT;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability NotAvailable;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability PortRestricted;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability PortRestrictedAndDoubleNAT;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability PortRestrictedAndSingleNAT;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability Public;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability SingleNATA;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv4Availability Unknown;
|
||||
}
|
||||
|
||||
public static final class IPAddressTypeAvailabilityElement.IPv6Availability extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv6Availability valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv6Availability[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv6Availability Available;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv6Availability NotAvailable;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv6Availability Reserved;
|
||||
enum_constant public static final android.net.wifi.anqp.IPAddressTypeAvailabilityElement.IPv6Availability Unknown;
|
||||
}
|
||||
|
||||
public class IconInfo {
|
||||
ctor public IconInfo(java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.lang.String getFileName();
|
||||
method public int getHeight();
|
||||
method public java.lang.String getIconType();
|
||||
method public java.util.Locale getLocale();
|
||||
method public int getWidth();
|
||||
}
|
||||
|
||||
public class NAIRealmData {
|
||||
ctor public NAIRealmData(java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<android.net.wifi.anqp.eap.EAPMethod> getEAPMethods();
|
||||
method public java.util.List<java.lang.String> getRealms();
|
||||
}
|
||||
|
||||
public class NAIRealmElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public NAIRealmElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<android.net.wifi.anqp.NAIRealmData> getRealmData();
|
||||
}
|
||||
|
||||
public class NetworkAuthenticationTypeElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public NetworkAuthenticationTypeElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<android.net.wifi.anqp.NetworkAuthenticationTypeElement.NetworkAuthentication> getAuthenticationTypes();
|
||||
}
|
||||
|
||||
public static class NetworkAuthenticationTypeElement.NetworkAuthentication {
|
||||
method public android.net.wifi.anqp.NetworkAuthenticationTypeElement.NwkAuthTypeEnum getType();
|
||||
method public java.lang.String getURL();
|
||||
}
|
||||
|
||||
public static final class NetworkAuthenticationTypeElement.NwkAuthTypeEnum extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.NetworkAuthenticationTypeElement.NwkAuthTypeEnum valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.NetworkAuthenticationTypeElement.NwkAuthTypeEnum[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.NetworkAuthenticationTypeElement.NwkAuthTypeEnum DNSRedirection;
|
||||
enum_constant public static final android.net.wifi.anqp.NetworkAuthenticationTypeElement.NwkAuthTypeEnum HTTPRedirection;
|
||||
enum_constant public static final android.net.wifi.anqp.NetworkAuthenticationTypeElement.NwkAuthTypeEnum OnLineEnrollment;
|
||||
enum_constant public static final android.net.wifi.anqp.NetworkAuthenticationTypeElement.NwkAuthTypeEnum Reserved;
|
||||
enum_constant public static final android.net.wifi.anqp.NetworkAuthenticationTypeElement.NwkAuthTypeEnum TermsAndConditions;
|
||||
}
|
||||
|
||||
public class OSUProvider {
|
||||
ctor public OSUProvider(java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<android.net.wifi.anqp.IconInfo> getIcons();
|
||||
method public java.util.List<android.net.wifi.anqp.I18Name> getNames();
|
||||
method public java.util.List<android.net.wifi.anqp.OSUProvider.OSUMethod> getOSUMethods();
|
||||
method public java.lang.String getOSUServer();
|
||||
method public java.lang.String getOsuNai();
|
||||
method public java.util.List<android.net.wifi.anqp.I18Name> getServiceDescriptions();
|
||||
}
|
||||
|
||||
public static final class OSUProvider.OSUMethod extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.OSUProvider.OSUMethod valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.OSUProvider.OSUMethod[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.OSUProvider.OSUMethod OmaDm;
|
||||
enum_constant public static final android.net.wifi.anqp.OSUProvider.OSUMethod SoapXml;
|
||||
}
|
||||
|
||||
public class RoamingConsortiumElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public RoamingConsortiumElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.List<java.lang.Long> getOIs();
|
||||
}
|
||||
|
||||
public class ThreeGPPNetworkElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public ThreeGPPNetworkElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer);
|
||||
method public byte[] getData();
|
||||
}
|
||||
|
||||
public class VenueNameElement extends android.net.wifi.anqp.ANQPElement {
|
||||
ctor public VenueNameElement(android.net.wifi.anqp.Constants.ANQPElementType, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.VenueNameElement.VenueGroup getGroup();
|
||||
method public java.util.List<android.net.wifi.anqp.I18Name> getNames();
|
||||
method public android.net.wifi.anqp.VenueNameElement.VenueType getType();
|
||||
}
|
||||
|
||||
public static final class VenueNameElement.VenueGroup extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.VenueNameElement.VenueGroup valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.VenueNameElement.VenueGroup[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Assembly;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Business;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Educational;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup FactoryIndustrial;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Institutional;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Mercantile;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Outdoor;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Reserved;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Residential;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Storage;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Unspecified;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup UtilityMiscellaneous;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueGroup Vehicular;
|
||||
}
|
||||
|
||||
public static final class VenueNameElement.VenueType extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.VenueNameElement.VenueType valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.VenueNameElement.VenueType[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Airplane;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType AlcoholAndDrugRehabilitationCenter;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Amphitheater;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType AmusementPark;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Arena;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType AttorneyOffice;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType AutomobileOrTruck;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType AutomotiveServiceStation;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Bank;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Bar;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType BoardingHouse;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Bus;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType BusStop;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType CityPark;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType CoffeeShop;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType ConventionCenter;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType DoctorDentistoffice;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Dormitory;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType EmergencyCoordinationCenter;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Factory;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Ferry;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType FireStation;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType GasStation;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType GroceryMarket;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType GroupHome;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Hospital;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType HotelMotel;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Kiosk;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Library;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType LongTermCareFacility;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType MotorBike;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType MuniMeshNetwork;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Museum;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType PassengerTerminal;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType PlaceOfWorship;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType PoliceStation;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType PostOffice;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType PrisonJail;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType PrivateResidence;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType ProfessionalOffice;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType ResearchDevelopmentFacility;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Reserved;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType RestArea;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Restaurant;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType RetailStore;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType SchoolPrimary;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType SchoolSecondary;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType ShipOrBoat;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType ShoppingMall;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Stadium;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Theater;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType TrafficControl;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Train;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UniversityCollege;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType Unspecified;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedAssembly;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedBusiness;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedEducational;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedFactoryIndustrial;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedInstitutional;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedMercantile;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedOutdoor;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedResidential;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedStorage;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType UnspecifiedUtilityMiscellaneous;
|
||||
enum_constant public static final android.net.wifi.anqp.VenueNameElement.VenueType ZooOrAquarium;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.net.wifi.anqp.eap {
|
||||
|
||||
public abstract interface AuthParam {
|
||||
method public abstract android.net.wifi.anqp.eap.EAP.AuthInfoID getAuthInfoID();
|
||||
}
|
||||
|
||||
public class Credential implements android.net.wifi.anqp.eap.AuthParam {
|
||||
ctor public Credential(android.net.wifi.anqp.eap.EAP.AuthInfoID, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.eap.EAP.AuthInfoID getAuthInfoID();
|
||||
method public android.net.wifi.anqp.eap.Credential.CredType getCredType();
|
||||
}
|
||||
|
||||
public static final class Credential.CredType extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.eap.Credential.CredType valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.eap.Credential.CredType[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType Anonymous;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType Certificate;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType HWToken;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType NFC;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType None;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType Reserved;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType SIM;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType Softoken;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType USIM;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType Username;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.Credential.CredType VendorSpecific;
|
||||
}
|
||||
|
||||
public abstract class EAP {
|
||||
ctor public EAP();
|
||||
method public static android.net.wifi.anqp.eap.EAP.EAPMethodID mapEAPMethod(int);
|
||||
field public static final int CredentialType = 5; // 0x5
|
||||
field public static final int EAP_3Com = 24; // 0x18
|
||||
field public static final int EAP_AKA = 23; // 0x17
|
||||
field public static final int EAP_AKAPrim = 50; // 0x32
|
||||
field public static final int EAP_ActiontecWireless = 35; // 0x23
|
||||
field public static final int EAP_EKE = 53; // 0x35
|
||||
field public static final int EAP_FAST = 43; // 0x2b
|
||||
field public static final int EAP_GPSK = 51; // 0x33
|
||||
field public static final int EAP_HTTPDigest = 38; // 0x26
|
||||
field public static final int EAP_IKEv2 = 49; // 0x31
|
||||
field public static final int EAP_KEA = 11; // 0xb
|
||||
field public static final int EAP_KEA_VALIDATE = 12; // 0xc
|
||||
field public static final int EAP_LEAP = 17; // 0x11
|
||||
field public static final int EAP_Link = 45; // 0x2d
|
||||
field public static final int EAP_MD5 = 4; // 0x4
|
||||
field public static final int EAP_MOBAC = 42; // 0x2a
|
||||
field public static final int EAP_MSCHAPv2 = 26; // 0x1a
|
||||
field public static final int EAP_OTP = 5; // 0x5
|
||||
field public static final int EAP_PAX = 46; // 0x2e
|
||||
field public static final int EAP_PEAP = 29; // 0x1d
|
||||
field public static final int EAP_POTP = 32; // 0x20
|
||||
field public static final int EAP_PSK = 47; // 0x2f
|
||||
field public static final int EAP_PWD = 52; // 0x34
|
||||
field public static final int EAP_RSA = 9; // 0x9
|
||||
field public static final int EAP_SAKE = 48; // 0x30
|
||||
field public static final int EAP_SIM = 18; // 0x12
|
||||
field public static final int EAP_SPEKE = 41; // 0x29
|
||||
field public static final int EAP_TEAP = 55; // 0x37
|
||||
field public static final int EAP_TLS = 13; // 0xd
|
||||
field public static final int EAP_TTLS = 21; // 0x15
|
||||
field public static final int EAP_ZLXEAP = 44; // 0x2c
|
||||
field public static final int ExpandedEAPMethod = 1; // 0x1
|
||||
field public static final int ExpandedInnerEAPMethod = 4; // 0x4
|
||||
field public static final int InnerAuthEAPMethodType = 3; // 0x3
|
||||
field public static final int NonEAPInnerAuthType = 2; // 0x2
|
||||
field public static final int TunneledEAPMethodCredType = 6; // 0x6
|
||||
field public static final int VendorSpecific = 221; // 0xdd
|
||||
}
|
||||
|
||||
public static final class EAP.AuthInfoID extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.eap.EAP.AuthInfoID valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.eap.EAP.AuthInfoID[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.AuthInfoID CredentialType;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.AuthInfoID ExpandedEAPMethod;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.AuthInfoID ExpandedInnerEAPMethod;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.AuthInfoID InnerAuthEAPMethodType;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.AuthInfoID NonEAPInnerAuthType;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.AuthInfoID TunneledEAPMethodCredType;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.AuthInfoID Undefined;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.AuthInfoID VendorSpecific;
|
||||
}
|
||||
|
||||
public static final class EAP.EAPMethodID extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.eap.EAP.EAPMethodID valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.eap.EAP.EAPMethodID[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_3Com;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_AKA;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_AKAPrim;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_ActiontecWireless;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_EKE;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_FAST;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_GPSK;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_HTTPDigest;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_IKEv2;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_KEA;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_KEA_VALIDATE;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_LEAP;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_Link;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_MD5;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_MOBAC;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_MSCHAPv2;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_OTP;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_PAX;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_PEAP;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_POTP;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_PSK;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_PWD;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_RSA;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_SAKE;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_SIM;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_SPEKE;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_TEAP;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_TLS;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_TTLS;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.EAP.EAPMethodID EAP_ZLXEAP;
|
||||
}
|
||||
|
||||
public class EAPMethod {
|
||||
ctor public EAPMethod(java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public java.util.Map<android.net.wifi.anqp.eap.EAP.AuthInfoID, java.util.Set<android.net.wifi.anqp.eap.AuthParam>> getAuthParams();
|
||||
method public android.net.wifi.anqp.eap.EAP.EAPMethodID getEAPMethodID();
|
||||
method public boolean matchesAuthParams(android.net.wifi.anqp.eap.EAPMethod);
|
||||
}
|
||||
|
||||
public class ExpandedEAPMethod implements android.net.wifi.anqp.eap.AuthParam {
|
||||
ctor public ExpandedEAPMethod(android.net.wifi.anqp.eap.EAP.AuthInfoID, java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.eap.EAP.AuthInfoID getAuthInfoID();
|
||||
method public int getVendorID();
|
||||
method public long getVendorType();
|
||||
}
|
||||
|
||||
public class InnerAuthEAP implements android.net.wifi.anqp.eap.AuthParam {
|
||||
ctor public InnerAuthEAP(java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.eap.EAP.AuthInfoID getAuthInfoID();
|
||||
method public android.net.wifi.anqp.eap.EAP.EAPMethodID getEAPMethodID();
|
||||
}
|
||||
|
||||
public class NonEAPInnerAuth implements android.net.wifi.anqp.eap.AuthParam {
|
||||
ctor public NonEAPInnerAuth(java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.eap.EAP.AuthInfoID getAuthInfoID();
|
||||
method public android.net.wifi.anqp.eap.NonEAPInnerAuth.NonEAPType getType();
|
||||
}
|
||||
|
||||
public static final class NonEAPInnerAuth.NonEAPType extends java.lang.Enum {
|
||||
method public static android.net.wifi.anqp.eap.NonEAPInnerAuth.NonEAPType valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.anqp.eap.NonEAPInnerAuth.NonEAPType[] values();
|
||||
enum_constant public static final android.net.wifi.anqp.eap.NonEAPInnerAuth.NonEAPType CHAP;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.NonEAPInnerAuth.NonEAPType MSCHAP;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.NonEAPInnerAuth.NonEAPType MSCHAPv2;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.NonEAPInnerAuth.NonEAPType PAP;
|
||||
enum_constant public static final android.net.wifi.anqp.eap.NonEAPInnerAuth.NonEAPType Reserved;
|
||||
}
|
||||
|
||||
public class VendorSpecificAuth implements android.net.wifi.anqp.eap.AuthParam {
|
||||
ctor public VendorSpecificAuth(java.nio.ByteBuffer) throws java.net.ProtocolException;
|
||||
method public android.net.wifi.anqp.eap.EAP.AuthInfoID getAuthInfoID();
|
||||
method public byte[] getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.net.wifi.hotspot2 {
|
||||
|
||||
public class ANQPData {
|
||||
ctor public ANQPData(java.util.List<android.net.wifi.anqp.ANQPElement>);
|
||||
method public java.util.List<android.net.wifi.anqp.ANQPElement> getANQPElements();
|
||||
}
|
||||
|
||||
public class NetworkInfo {
|
||||
ctor public NetworkInfo(java.lang.String, java.lang.String, long, android.net.wifi.hotspot2.NetworkInfo.Ant, boolean, android.net.wifi.anqp.VenueNameElement.VenueGroup, android.net.wifi.anqp.VenueNameElement.VenueType, android.net.wifi.hotspot2.NetworkInfo.HSRelease, int, long[]);
|
||||
method public int getAnqpDomainID();
|
||||
method public android.net.wifi.hotspot2.NetworkInfo.Ant getAnt();
|
||||
method public long getBSSID();
|
||||
method public java.lang.String getHESSID();
|
||||
method public android.net.wifi.hotspot2.NetworkInfo.HSRelease getHSRelease();
|
||||
method public long[] getRoamingConsortiums();
|
||||
method public java.lang.String getSSID();
|
||||
method public android.net.wifi.anqp.VenueNameElement.VenueGroup getVenueGroup();
|
||||
method public android.net.wifi.anqp.VenueNameElement.VenueType getVenueType();
|
||||
method public boolean isInternet();
|
||||
}
|
||||
|
||||
public static final class NetworkInfo.Ant extends java.lang.Enum {
|
||||
method public static android.net.wifi.hotspot2.NetworkInfo.Ant valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.hotspot2.NetworkInfo.Ant[] values();
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.Ant ChargeablePublic;
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.Ant EmergencyOnly;
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.Ant FreePublic;
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.Ant Personal;
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.Ant Private;
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.Ant PrivateWithGuest;
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.Ant TestOrExperimental;
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.Ant Wildcard;
|
||||
}
|
||||
|
||||
public static final class NetworkInfo.HSRelease extends java.lang.Enum {
|
||||
method public static android.net.wifi.hotspot2.NetworkInfo.HSRelease valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.hotspot2.NetworkInfo.HSRelease[] values();
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.HSRelease R1;
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.HSRelease R2;
|
||||
enum_constant public static final android.net.wifi.hotspot2.NetworkInfo.HSRelease Unknown;
|
||||
}
|
||||
|
||||
public class NetworkKey {
|
||||
ctor public NetworkKey(java.lang.String, long, int);
|
||||
method public int getANQPDomainID();
|
||||
method public long getBSSID();
|
||||
method public java.lang.String getSSID();
|
||||
}
|
||||
|
||||
public final class PasspointMatch extends java.lang.Enum {
|
||||
method public static android.net.wifi.hotspot2.PasspointMatch valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.hotspot2.PasspointMatch[] values();
|
||||
enum_constant public static final android.net.wifi.hotspot2.PasspointMatch Declined;
|
||||
enum_constant public static final android.net.wifi.hotspot2.PasspointMatch HomeProvider;
|
||||
enum_constant public static final android.net.wifi.hotspot2.PasspointMatch Incomplete;
|
||||
enum_constant public static final android.net.wifi.hotspot2.PasspointMatch None;
|
||||
enum_constant public static final android.net.wifi.hotspot2.PasspointMatch RoamingProvider;
|
||||
}
|
||||
|
||||
public class SelectionManager {
|
||||
ctor public SelectionManager(java.util.List<android.net.wifi.hotspot2.pps.HomeSP>);
|
||||
method public android.net.wifi.hotspot2.NetworkInfo findNetwork(android.net.wifi.hotspot2.NetworkInfo);
|
||||
method public void notifyANQPResponse(android.net.wifi.hotspot2.NetworkInfo, java.util.List<android.net.wifi.anqp.ANQPElement>);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.net.wifi.hotspot2.pps {
|
||||
|
||||
public class DomainMatcher {
|
||||
ctor public DomainMatcher(java.util.List<java.lang.String>, java.util.List<java.util.List<java.lang.String>>);
|
||||
method public android.net.wifi.hotspot2.pps.DomainMatcher.Match isSubDomain(java.util.List<java.lang.String>);
|
||||
}
|
||||
|
||||
public static final class DomainMatcher.Match extends java.lang.Enum {
|
||||
method public static android.net.wifi.hotspot2.pps.DomainMatcher.Match valueOf(java.lang.String);
|
||||
method public static final android.net.wifi.hotspot2.pps.DomainMatcher.Match[] values();
|
||||
enum_constant public static final android.net.wifi.hotspot2.pps.DomainMatcher.Match None;
|
||||
enum_constant public static final android.net.wifi.hotspot2.pps.DomainMatcher.Match Primary;
|
||||
enum_constant public static final android.net.wifi.hotspot2.pps.DomainMatcher.Match Secondary;
|
||||
}
|
||||
|
||||
public class HomeSP {
|
||||
ctor public HomeSP(java.util.Map<java.lang.String, java.lang.String>, java.lang.String, java.util.Set<java.lang.Long>, java.util.Set<java.lang.String>, java.util.Set<java.lang.Long>, java.util.List<java.lang.Long>, java.lang.String, java.lang.String, java.util.Map<android.net.wifi.anqp.eap.EAP.EAPMethodID, android.net.wifi.anqp.eap.EAPMethod>);
|
||||
method public android.net.wifi.hotspot2.PasspointMatch match(android.net.wifi.hotspot2.NetworkInfo, java.util.List<android.net.wifi.anqp.ANQPElement>);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.net.wifi.p2p {
|
||||
|
||||
public class WifiP2pConfig implements android.os.Parcelable {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
/**
|
||||
* Base class for an IEEE802.11u ANQP element.
|
||||
*/
|
||||
public abstract class ANQPElement {
|
||||
private final Constants.ANQPElementType mID;
|
||||
|
||||
protected ANQPElement(Constants.ANQPElementType id) {
|
||||
mID = id;
|
||||
}
|
||||
|
||||
public Constants.ANQPElementType getID() {
|
||||
return mID;
|
||||
}
|
||||
}
|
||||
@@ -1,213 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Set;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.*;
|
||||
|
||||
/**
|
||||
* Factory to build a collection of 802.11u ANQP elements from a byte buffer.
|
||||
*/
|
||||
public class ANQPFactory {
|
||||
|
||||
public static ByteBuffer buildQueryRequest(Set<ANQPElementType> elements, ByteBuffer target) {
|
||||
List<ANQPElementType> list = new ArrayList<ANQPElementType>(elements);
|
||||
Collections.sort(list);
|
||||
|
||||
ListIterator<ANQPElementType> elementIterator = list.listIterator();
|
||||
|
||||
target.order(ByteOrder.LITTLE_ENDIAN);
|
||||
target.putShort((short) Constants.ANQP_QUERY_LIST);
|
||||
int lenPos = target.position();
|
||||
target.putShort((short) 0);
|
||||
|
||||
while (elementIterator.hasNext()) {
|
||||
Integer id = Constants.getANQPElementID(elementIterator.next());
|
||||
if (id != null) {
|
||||
target.putShort(id.shortValue());
|
||||
} else {
|
||||
elementIterator.previous();
|
||||
}
|
||||
}
|
||||
target.putShort(lenPos, (short) (target.position() - lenPos - BYTES_IN_SHORT));
|
||||
|
||||
// Start a new vendor specific element for HS2.0 elements:
|
||||
if (elementIterator.hasNext()) {
|
||||
target.putShort((short) ANQP_VENDOR_SPEC);
|
||||
int vsLenPos = target.position();
|
||||
target.putShort((short) 0);
|
||||
|
||||
target.putInt(Constants.HS20_PREFIX);
|
||||
target.put((byte) Constants.HS_QUERY_LIST);
|
||||
target.put((byte) 0);
|
||||
|
||||
while (elementIterator.hasNext()) {
|
||||
ANQPElementType elementType = elementIterator.next();
|
||||
Integer id = Constants.getHS20ElementID(elementType);
|
||||
if (id == null) {
|
||||
throw new RuntimeException("Unmapped ANQPElementType: " + elementType);
|
||||
} else {
|
||||
target.put(id.byteValue());
|
||||
}
|
||||
}
|
||||
target.putShort(vsLenPos, (short) (target.position() - vsLenPos - BYTES_IN_SHORT));
|
||||
}
|
||||
|
||||
target.flip();
|
||||
return target;
|
||||
}
|
||||
|
||||
public static ByteBuffer buildHomeRealmRequest(List<String> realmNames, ByteBuffer target) {
|
||||
target.order(ByteOrder.LITTLE_ENDIAN);
|
||||
target.putShort((short) ANQP_VENDOR_SPEC);
|
||||
int lenPos = target.position();
|
||||
target.putShort((short) 0);
|
||||
|
||||
target.putInt(Constants.HS20_PREFIX);
|
||||
target.put((byte) Constants.HS_NAI_HOME_REALM_QUERY);
|
||||
target.put((byte) 0);
|
||||
|
||||
target.put((byte) realmNames.size());
|
||||
for (String realmName : realmNames) {
|
||||
target.put((byte) UTF8_INDICATOR);
|
||||
byte[] octets = realmName.getBytes(StandardCharsets.UTF_8);
|
||||
target.put((byte) octets.length);
|
||||
target.put(octets);
|
||||
}
|
||||
target.putShort(lenPos, (short) (target.position() - lenPos - BYTES_IN_SHORT));
|
||||
|
||||
target.flip();
|
||||
return target;
|
||||
}
|
||||
|
||||
public static ByteBuffer buildIconRequest(String fileName, ByteBuffer target) {
|
||||
target.order(ByteOrder.LITTLE_ENDIAN);
|
||||
target.putShort((short) ANQP_VENDOR_SPEC);
|
||||
int lenPos = target.position();
|
||||
target.putShort((short) 0);
|
||||
|
||||
target.putInt(Constants.HS20_PREFIX);
|
||||
target.put((byte) Constants.HS_ICON_REQUEST);
|
||||
target.put((byte) 0);
|
||||
|
||||
target.put(fileName.getBytes(StandardCharsets.UTF_8));
|
||||
target.putShort(lenPos, (short) (target.position() - lenPos - BYTES_IN_SHORT));
|
||||
|
||||
target.flip();
|
||||
return target;
|
||||
}
|
||||
|
||||
public static List<ANQPElement> parsePayload(ByteBuffer payload) throws ProtocolException {
|
||||
payload.order(ByteOrder.LITTLE_ENDIAN);
|
||||
List<ANQPElement> elements = new ArrayList<ANQPElement>();
|
||||
while (payload.hasRemaining()) {
|
||||
elements.add(buildElement(payload));
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
private static ANQPElement buildElement(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() < 4)
|
||||
throw new ProtocolException("Runt payload: " + payload.remaining());
|
||||
|
||||
int infoIDNumber = payload.getShort() & SHORT_MASK;
|
||||
ANQPElementType infoID = Constants.mapANQPElement(infoIDNumber);
|
||||
if (infoID == null) {
|
||||
throw new ProtocolException("Bad info ID: " + infoIDNumber);
|
||||
}
|
||||
int length = payload.getShort() & SHORT_MASK;
|
||||
|
||||
if (payload.remaining() < length) {
|
||||
throw new ProtocolException("Truncated payload");
|
||||
}
|
||||
|
||||
ByteBuffer elementPayload = payload.duplicate();
|
||||
payload.position(payload.position() + length);
|
||||
elementPayload.limit(elementPayload.position() + length);
|
||||
|
||||
switch (infoID) {
|
||||
case ANQPCapabilityList:
|
||||
return new CapabilityListElement(infoID, elementPayload);
|
||||
case ANQPVenueName:
|
||||
return new VenueNameElement(infoID, elementPayload);
|
||||
case ANQPEmergencyNumber:
|
||||
return new EmergencyNumberElement(infoID, elementPayload);
|
||||
case ANQPNwkAuthType:
|
||||
return new NetworkAuthenticationTypeElement(infoID, elementPayload);
|
||||
case ANQPRoamingConsortium:
|
||||
return new RoamingConsortiumElement(infoID, elementPayload);
|
||||
case ANQPIPAddrAvailability:
|
||||
return new IPAddressTypeAvailabilityElement(infoID, elementPayload);
|
||||
case ANQPNAIRealm:
|
||||
return new NAIRealmElement(infoID, elementPayload);
|
||||
case ANQP3GPPNetwork:
|
||||
return new ThreeGPPNetworkElement(infoID, elementPayload);
|
||||
case ANQPGeoLoc:
|
||||
return new GEOLocationElement(infoID, elementPayload);
|
||||
case ANQPCivicLoc:
|
||||
return new CivicLocationElement(infoID, elementPayload);
|
||||
case ANQPLocURI:
|
||||
return new GenericStringElement(infoID, elementPayload);
|
||||
case ANQPDomName:
|
||||
return new DomainNameElement(infoID, elementPayload);
|
||||
case ANQPEmergencyAlert:
|
||||
return new GenericStringElement(infoID, elementPayload);
|
||||
case ANQPTDLSCap:
|
||||
return new GenericBlobElement(infoID, elementPayload);
|
||||
case ANQPEmergencyNAI:
|
||||
return new GenericStringElement(infoID, elementPayload);
|
||||
case ANQPNeighborReport:
|
||||
return new GenericBlobElement(infoID, elementPayload);
|
||||
case ANQPVendorSpec:
|
||||
if (elementPayload.remaining() > 5) {
|
||||
int oi = elementPayload.getInt();
|
||||
if (oi != Constants.HS20_PREFIX) {
|
||||
return null;
|
||||
}
|
||||
int subType = elementPayload.get() & BYTE_MASK;
|
||||
elementPayload.get();
|
||||
return buildHS20Element(subType, elementPayload);
|
||||
} else {
|
||||
return new GenericBlobElement(infoID, elementPayload);
|
||||
}
|
||||
default:
|
||||
throw new ProtocolException("Unknown element ID: " + infoID);
|
||||
}
|
||||
}
|
||||
|
||||
private static ANQPElement buildHS20Element(int subType, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
|
||||
ANQPElementType infoID = Constants.mapHS20Element(subType);
|
||||
|
||||
if (infoID == null) {
|
||||
throw new ProtocolException("Bad HS20 info ID: " + subType);
|
||||
}
|
||||
|
||||
switch (infoID) {
|
||||
case HSCapabilityList:
|
||||
return new HSCapabilityListElement(infoID, payload);
|
||||
case HSFriendlyName:
|
||||
return new HSFriendlyNameElement(infoID, payload);
|
||||
case HSWANMetrics:
|
||||
return new HSWanMetricsElement(infoID, payload);
|
||||
case HSConnCapability:
|
||||
return new HSConnectionCapabilityElement(infoID, payload);
|
||||
case HSOperatingclass:
|
||||
return new GenericBlobElement(infoID, payload);
|
||||
case HSOSUProviders:
|
||||
return new HSOsuProvidersElement(infoID, payload);
|
||||
case HSIconFile:
|
||||
return new HSIconFileElement(infoID, payload);
|
||||
default:
|
||||
throw new ProtocolException("Unknown HS20 sub type: " + subType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.ANQPElementType;
|
||||
import static android.net.wifi.anqp.Constants.BYTES_IN_SHORT;
|
||||
import static android.net.wifi.anqp.Constants.SHORT_MASK;
|
||||
|
||||
/**
|
||||
* The ANQP Capability List element, 802.11-2012 section 8.4.4.3
|
||||
*/
|
||||
public class CapabilityListElement extends ANQPElement {
|
||||
private final ANQPElementType[] mCapabilities;
|
||||
|
||||
public CapabilityListElement(ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
if ((payload.remaining() & 1) == 1)
|
||||
throw new ProtocolException("Odd length");
|
||||
mCapabilities = new ANQPElementType[payload.remaining() / BYTES_IN_SHORT];
|
||||
|
||||
int index = 0;
|
||||
while (payload.hasRemaining()) {
|
||||
int capID = payload.getShort() & SHORT_MASK;
|
||||
ANQPElementType capability = Constants.mapANQPElement(capID);
|
||||
if (capability == null)
|
||||
throw new ProtocolException("Unknown capability: " + capID);
|
||||
mCapabilities[index++] = capability;
|
||||
}
|
||||
}
|
||||
|
||||
public ANQPElementType[] getCapabilities() {
|
||||
return mCapabilities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CapabilityListElement{" +
|
||||
"mCapabilities=" + Arrays.toString(mCapabilities) +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* The Civic Location ANQP Element, IEEE802.11-2012 section 8.4.4.13
|
||||
*/
|
||||
public class CivicLocationElement extends ANQPElement {
|
||||
public enum LocationType {DHCPServer, NwkElement, Client}
|
||||
|
||||
private static final int GEOCONF_CIVIC4 = 99;
|
||||
private static final int RFC4776 = 0; // Table 8-77, 1=vendor specific
|
||||
|
||||
private final LocationType mLocationType;
|
||||
private final Locale mLocale;
|
||||
private final Map<CAType, String> mValues;
|
||||
|
||||
public CivicLocationElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
if (payload.remaining() < 6) {
|
||||
throw new ProtocolException("Runt civic location:" + payload.remaining());
|
||||
}
|
||||
|
||||
int locType = payload.get() & BYTE_MASK;
|
||||
if (locType != RFC4776) {
|
||||
throw new ProtocolException("Bad Civic location type: " + locType);
|
||||
}
|
||||
|
||||
int locSubType = payload.get() & BYTE_MASK;
|
||||
if (locSubType != GEOCONF_CIVIC4) {
|
||||
throw new ProtocolException("Unexpected Civic location sub-type: " + locSubType +
|
||||
" (cannot handle sub elements)");
|
||||
}
|
||||
|
||||
int length = payload.get() & BYTE_MASK;
|
||||
if (length > payload.remaining()) {
|
||||
throw new ProtocolException("Invalid CA type length: " + length);
|
||||
}
|
||||
|
||||
int what = payload.get() & BYTE_MASK;
|
||||
mLocationType = what < LocationType.values().length ? LocationType.values()[what] : null;
|
||||
|
||||
mLocale = Locale.forLanguageTag(Constants.getString(payload, 2, StandardCharsets.US_ASCII));
|
||||
|
||||
mValues = new HashMap<CAType, String>();
|
||||
while (payload.hasRemaining()) {
|
||||
int caTypeNumber = payload.get() & BYTE_MASK;
|
||||
CAType caType = s_caTypes.get(caTypeNumber);
|
||||
|
||||
int caValLen = payload.get() & BYTE_MASK;
|
||||
if (caValLen > payload.remaining()) {
|
||||
throw new ProtocolException("Bad CA value length: " + caValLen);
|
||||
}
|
||||
byte[] caValOctets = new byte[caValLen];
|
||||
payload.get(caValOctets);
|
||||
|
||||
if (caType != null) {
|
||||
mValues.put(caType, new String(caValOctets, StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LocationType getLocationType() {
|
||||
return mLocationType;
|
||||
}
|
||||
|
||||
public Locale getLocale() {
|
||||
return mLocale;
|
||||
}
|
||||
|
||||
public Map<CAType, String> getValues() {
|
||||
return Collections.unmodifiableMap(mValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CivicLocationElement{" +
|
||||
"mLocationType=" + mLocationType +
|
||||
", mLocale=" + mLocale +
|
||||
", mValues=" + mValues +
|
||||
'}';
|
||||
}
|
||||
|
||||
private static final Map<Integer, CAType> s_caTypes = new HashMap<Integer, CAType>();
|
||||
|
||||
public static final int LANGUAGE = 0;
|
||||
public static final int STATE_PROVINCE = 1;
|
||||
public static final int COUNTY_DISTRICT = 2;
|
||||
public static final int CITY = 3;
|
||||
public static final int DIVISION_BOROUGH = 4;
|
||||
public static final int BLOCK = 5;
|
||||
public static final int STREET_GROUP = 6;
|
||||
public static final int STREET_DIRECTION = 16;
|
||||
public static final int LEADING_STREET_SUFFIX = 17;
|
||||
public static final int STREET_SUFFIX = 18;
|
||||
public static final int HOUSE_NUMBER = 19;
|
||||
public static final int HOUSE_NUMBER_SUFFIX = 20;
|
||||
public static final int LANDMARK = 21;
|
||||
public static final int ADDITIONAL_LOCATION = 22;
|
||||
public static final int NAME = 23;
|
||||
public static final int POSTAL_ZIP = 24;
|
||||
public static final int BUILDING = 25;
|
||||
public static final int UNIT = 26;
|
||||
public static final int FLOOR = 27;
|
||||
public static final int ROOM = 28;
|
||||
public static final int TYPE = 29;
|
||||
public static final int POSTAL_COMMUNITY = 30;
|
||||
public static final int PO_BOX = 31;
|
||||
public static final int ADDITIONAL_CODE = 32;
|
||||
public static final int SEAT_DESK = 33;
|
||||
public static final int PRIMARY_ROAD = 34;
|
||||
public static final int ROAD_SECTION = 35;
|
||||
public static final int BRANCH_ROAD = 36;
|
||||
public static final int SUB_BRANCH_ROAD = 37;
|
||||
public static final int STREET_NAME_PRE_MOD = 38;
|
||||
public static final int STREET_NAME_POST_MOD = 39;
|
||||
public static final int SCRIPT = 128;
|
||||
public static final int RESERVED = 255;
|
||||
|
||||
public enum CAType {
|
||||
Language,
|
||||
StateProvince,
|
||||
CountyDistrict,
|
||||
City,
|
||||
DivisionBorough,
|
||||
Block,
|
||||
StreetGroup,
|
||||
StreetDirection,
|
||||
LeadingStreetSuffix,
|
||||
StreetSuffix,
|
||||
HouseNumber,
|
||||
HouseNumberSuffix,
|
||||
Landmark,
|
||||
AdditionalLocation,
|
||||
Name,
|
||||
PostalZIP,
|
||||
Building,
|
||||
Unit,
|
||||
Floor,
|
||||
Room,
|
||||
Type,
|
||||
PostalCommunity,
|
||||
POBox,
|
||||
AdditionalCode,
|
||||
SeatDesk,
|
||||
PrimaryRoad,
|
||||
RoadSection,
|
||||
BranchRoad,
|
||||
SubBranchRoad,
|
||||
StreetNamePreMod,
|
||||
StreetNamePostMod,
|
||||
Script,
|
||||
Reserved
|
||||
}
|
||||
|
||||
static {
|
||||
s_caTypes.put(LANGUAGE, CAType.Language);
|
||||
s_caTypes.put(STATE_PROVINCE, CAType.StateProvince);
|
||||
s_caTypes.put(COUNTY_DISTRICT, CAType.CountyDistrict);
|
||||
s_caTypes.put(CITY, CAType.City);
|
||||
s_caTypes.put(DIVISION_BOROUGH, CAType.DivisionBorough);
|
||||
s_caTypes.put(BLOCK, CAType.Block);
|
||||
s_caTypes.put(STREET_GROUP, CAType.StreetGroup);
|
||||
s_caTypes.put(STREET_DIRECTION, CAType.StreetDirection);
|
||||
s_caTypes.put(LEADING_STREET_SUFFIX, CAType.LeadingStreetSuffix);
|
||||
s_caTypes.put(STREET_SUFFIX, CAType.StreetSuffix);
|
||||
s_caTypes.put(HOUSE_NUMBER, CAType.HouseNumber);
|
||||
s_caTypes.put(HOUSE_NUMBER_SUFFIX, CAType.HouseNumberSuffix);
|
||||
s_caTypes.put(LANDMARK, CAType.Landmark);
|
||||
s_caTypes.put(ADDITIONAL_LOCATION, CAType.AdditionalLocation);
|
||||
s_caTypes.put(NAME, CAType.Name);
|
||||
s_caTypes.put(POSTAL_ZIP, CAType.PostalZIP);
|
||||
s_caTypes.put(BUILDING, CAType.Building);
|
||||
s_caTypes.put(UNIT, CAType.Unit);
|
||||
s_caTypes.put(FLOOR, CAType.Floor);
|
||||
s_caTypes.put(ROOM, CAType.Room);
|
||||
s_caTypes.put(TYPE, CAType.Type);
|
||||
s_caTypes.put(POSTAL_COMMUNITY, CAType.PostalCommunity);
|
||||
s_caTypes.put(PO_BOX, CAType.POBox);
|
||||
s_caTypes.put(ADDITIONAL_CODE, CAType.AdditionalCode);
|
||||
s_caTypes.put(SEAT_DESK, CAType.SeatDesk);
|
||||
s_caTypes.put(PRIMARY_ROAD, CAType.PrimaryRoad);
|
||||
s_caTypes.put(ROAD_SECTION, CAType.RoadSection);
|
||||
s_caTypes.put(BRANCH_ROAD, CAType.BranchRoad);
|
||||
s_caTypes.put(SUB_BRANCH_ROAD, CAType.SubBranchRoad);
|
||||
s_caTypes.put(STREET_NAME_PRE_MOD, CAType.StreetNamePreMod);
|
||||
s_caTypes.put(STREET_NAME_POST_MOD, CAType.StreetNamePostMod);
|
||||
s_caTypes.put(SCRIPT, CAType.Script);
|
||||
s_caTypes.put(RESERVED, CAType.Reserved);
|
||||
}
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ANQP related constants (802.11-2012)
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
public static final int BYTE_MASK = 0xff;
|
||||
public static final int SHORT_MASK = 0xffff;
|
||||
public static final long INT_MASK = 0xffffffffL;
|
||||
public static final int BYTES_IN_SHORT = 2;
|
||||
public static final int BYTES_IN_INT = 4;
|
||||
|
||||
public static final int HS20_PREFIX = 0x119a6f50; // Note that is represented as a LE int
|
||||
public static final int UTF8_INDICATOR = 1;
|
||||
|
||||
public enum IconStatus {Success, FileNotFound, Unspecified}
|
||||
|
||||
public static final int ANQP_QUERY_LIST = 256;
|
||||
public static final int ANQP_CAPABILITY_LIST = 257;
|
||||
public static final int ANQP_VENUE_NAME = 258;
|
||||
public static final int ANQP_EMERGENCY_NUMBER = 259;
|
||||
public static final int ANQP_NWK_AUTH_TYPE = 260;
|
||||
public static final int ANQP_ROAMING_CONSORTIUM = 261;
|
||||
public static final int ANQP_IP_ADDR_AVAILABILITY = 262;
|
||||
public static final int ANQP_NAI_REALM = 263;
|
||||
public static final int ANQP_3GPP_NETWORK = 264;
|
||||
public static final int ANQP_GEO_LOC = 265;
|
||||
public static final int ANQP_CIVIC_LOC = 266;
|
||||
public static final int ANQP_LOC_URI = 267;
|
||||
public static final int ANQP_DOM_NAME = 268;
|
||||
public static final int ANQP_EMERGENCY_ALERT = 269;
|
||||
public static final int ANQP_TDLS_CAP = 270;
|
||||
public static final int ANQP_EMERGENCY_NAI = 271;
|
||||
public static final int ANQP_NEIGHBOR_REPORT = 272;
|
||||
public static final int ANQP_VENDOR_SPEC = 56797;
|
||||
|
||||
public static final int HS_QUERY_LIST = 1;
|
||||
public static final int HS_CAPABILITY_LIST = 2;
|
||||
public static final int HS_FRIENDLY_NAME = 3;
|
||||
public static final int HS_WAN_METRICS = 4;
|
||||
public static final int HS_CONN_CAPABILITY = 5;
|
||||
public static final int HS_NAI_HOME_REALM_QUERY = 6;
|
||||
public static final int HS_OPERATING_CLASS = 7;
|
||||
public static final int HS_OSU_PROVIDERS = 8;
|
||||
public static final int HS_ICON_REQUEST = 10;
|
||||
public static final int HS_ICON_FILE = 11;
|
||||
|
||||
public enum ANQPElementType {
|
||||
ANQPQueryList,
|
||||
ANQPCapabilityList,
|
||||
ANQPVenueName,
|
||||
ANQPEmergencyNumber,
|
||||
ANQPNwkAuthType,
|
||||
ANQPRoamingConsortium,
|
||||
ANQPIPAddrAvailability,
|
||||
ANQPNAIRealm,
|
||||
ANQP3GPPNetwork,
|
||||
ANQPGeoLoc,
|
||||
ANQPCivicLoc,
|
||||
ANQPLocURI,
|
||||
ANQPDomName,
|
||||
ANQPEmergencyAlert,
|
||||
ANQPTDLSCap,
|
||||
ANQPEmergencyNAI,
|
||||
ANQPNeighborReport,
|
||||
ANQPVendorSpec,
|
||||
HSQueryList,
|
||||
HSCapabilityList,
|
||||
HSFriendlyName,
|
||||
HSWANMetrics,
|
||||
HSConnCapability,
|
||||
HSNAIHomeRealmQuery,
|
||||
HSOperatingclass,
|
||||
HSOSUProviders,
|
||||
HSIconRequest,
|
||||
HSIconFile
|
||||
}
|
||||
|
||||
private static final Map<Integer, ANQPElementType> sAnqpMap = new HashMap<Integer, ANQPElementType>();
|
||||
private static final Map<Integer, ANQPElementType> sHs20Map = new HashMap<Integer, ANQPElementType>();
|
||||
private static final Map<ANQPElementType, Integer> sRevAnqpmap = new HashMap<ANQPElementType, Integer>();
|
||||
private static final Map<ANQPElementType, Integer> sRevHs20map = new HashMap<ANQPElementType, Integer>();
|
||||
|
||||
static {
|
||||
sAnqpMap.put(ANQP_QUERY_LIST, ANQPElementType.ANQPQueryList);
|
||||
sAnqpMap.put(ANQP_CAPABILITY_LIST, ANQPElementType.ANQPCapabilityList);
|
||||
sAnqpMap.put(ANQP_VENUE_NAME, ANQPElementType.ANQPVenueName);
|
||||
sAnqpMap.put(ANQP_EMERGENCY_NUMBER, ANQPElementType.ANQPEmergencyNumber);
|
||||
sAnqpMap.put(ANQP_NWK_AUTH_TYPE, ANQPElementType.ANQPNwkAuthType);
|
||||
sAnqpMap.put(ANQP_ROAMING_CONSORTIUM, ANQPElementType.ANQPRoamingConsortium);
|
||||
sAnqpMap.put(ANQP_IP_ADDR_AVAILABILITY, ANQPElementType.ANQPIPAddrAvailability);
|
||||
sAnqpMap.put(ANQP_NAI_REALM, ANQPElementType.ANQPNAIRealm);
|
||||
sAnqpMap.put(ANQP_3GPP_NETWORK, ANQPElementType.ANQP3GPPNetwork);
|
||||
sAnqpMap.put(ANQP_GEO_LOC, ANQPElementType.ANQPGeoLoc);
|
||||
sAnqpMap.put(ANQP_CIVIC_LOC, ANQPElementType.ANQPCivicLoc);
|
||||
sAnqpMap.put(ANQP_LOC_URI, ANQPElementType.ANQPLocURI);
|
||||
sAnqpMap.put(ANQP_DOM_NAME, ANQPElementType.ANQPDomName);
|
||||
sAnqpMap.put(ANQP_EMERGENCY_ALERT, ANQPElementType.ANQPEmergencyAlert);
|
||||
sAnqpMap.put(ANQP_TDLS_CAP, ANQPElementType.ANQPTDLSCap);
|
||||
sAnqpMap.put(ANQP_EMERGENCY_NAI, ANQPElementType.ANQPEmergencyNAI);
|
||||
sAnqpMap.put(ANQP_NEIGHBOR_REPORT, ANQPElementType.ANQPNeighborReport);
|
||||
sAnqpMap.put(ANQP_VENDOR_SPEC, ANQPElementType.ANQPVendorSpec);
|
||||
|
||||
sHs20Map.put(HS_QUERY_LIST, ANQPElementType.HSQueryList);
|
||||
sHs20Map.put(HS_CAPABILITY_LIST, ANQPElementType.HSCapabilityList);
|
||||
sHs20Map.put(HS_FRIENDLY_NAME, ANQPElementType.HSFriendlyName);
|
||||
sHs20Map.put(HS_WAN_METRICS, ANQPElementType.HSWANMetrics);
|
||||
sHs20Map.put(HS_CONN_CAPABILITY, ANQPElementType.HSConnCapability);
|
||||
sHs20Map.put(HS_NAI_HOME_REALM_QUERY, ANQPElementType.HSNAIHomeRealmQuery);
|
||||
sHs20Map.put(HS_OPERATING_CLASS, ANQPElementType.HSOperatingclass);
|
||||
sHs20Map.put(HS_OSU_PROVIDERS, ANQPElementType.HSOSUProviders);
|
||||
sHs20Map.put(HS_ICON_REQUEST, ANQPElementType.HSIconRequest);
|
||||
sHs20Map.put(HS_ICON_FILE, ANQPElementType.HSIconFile);
|
||||
|
||||
for (Map.Entry<Integer, ANQPElementType> entry : sAnqpMap.entrySet()) {
|
||||
sRevAnqpmap.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
for (Map.Entry<Integer, ANQPElementType> entry : sHs20Map.entrySet()) {
|
||||
sRevHs20map.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
public static ANQPElementType mapANQPElement(int id) {
|
||||
return sAnqpMap.get(id);
|
||||
}
|
||||
|
||||
public static ANQPElementType mapHS20Element(int id) {
|
||||
return sHs20Map.get(id);
|
||||
}
|
||||
|
||||
public static Integer getANQPElementID(ANQPElementType elementType) {
|
||||
return sRevAnqpmap.get(elementType);
|
||||
}
|
||||
|
||||
public static Integer getHS20ElementID(ANQPElementType elementType) {
|
||||
return sRevHs20map.get(elementType);
|
||||
}
|
||||
|
||||
public static long getInteger(ByteBuffer payload, int size) {
|
||||
byte[] octets = new byte[size];
|
||||
payload.get(octets);
|
||||
long value = 0;
|
||||
for (int n = octets.length - 1; n >= 0; n--) {
|
||||
value = (value << Byte.SIZE) | (octets[n] & BYTE_MASK);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static String getPrefixedString(ByteBuffer payload, int lengthLength, Charset charset)
|
||||
throws ProtocolException {
|
||||
if (payload.remaining() < lengthLength) {
|
||||
throw new ProtocolException("Runt string: " + payload.remaining());
|
||||
}
|
||||
return getString(payload, (int) getInteger(payload, lengthLength), charset, false);
|
||||
}
|
||||
|
||||
public static String getString(ByteBuffer payload, int length, Charset charset)
|
||||
throws ProtocolException {
|
||||
return getString(payload, length, charset, false);
|
||||
}
|
||||
|
||||
public static String getString(ByteBuffer payload, int length, Charset charset, boolean useNull)
|
||||
throws ProtocolException {
|
||||
if (length > payload.remaining()) {
|
||||
throw new ProtocolException("Bad string length: " + length);
|
||||
}
|
||||
if (useNull && length == 0) {
|
||||
return null;
|
||||
}
|
||||
byte[] octets = new byte[length];
|
||||
return new String(octets, charset);
|
||||
}
|
||||
|
||||
public static String toHexString(byte[] data) {
|
||||
StringBuilder sb = new StringBuilder(data.length * 3);
|
||||
|
||||
boolean first = true;
|
||||
for (byte b : data) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
sb.append(' ');
|
||||
}
|
||||
sb.append(String.format("%02x", b & BYTE_MASK));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The Domain Name ANQP Element, IEEE802.11-2012 section 8.4.4.15
|
||||
*/
|
||||
public class DomainNameElement extends ANQPElement {
|
||||
private final List<String> mDomains;
|
||||
|
||||
public DomainNameElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
mDomains = new ArrayList<String>();
|
||||
|
||||
while (payload.hasRemaining()) {
|
||||
// Use latin-1 to decode for now - safe for ASCII and retains encoding
|
||||
mDomains.add(Constants.getPrefixedString(payload, 1, StandardCharsets.ISO_8859_1));
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getDomains() {
|
||||
return Collections.unmodifiableList(mDomains);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DomainNameElement{" +
|
||||
"mDomains=" + mDomains +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The Emergency Number ANQP Element, IEEE802.11-2012 section 8.4.4.5
|
||||
*/
|
||||
public class EmergencyNumberElement extends ANQPElement {
|
||||
private final List<String> mNumbers;
|
||||
|
||||
public EmergencyNumberElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
mNumbers = new ArrayList<String>();
|
||||
|
||||
while (payload.hasRemaining()) {
|
||||
mNumbers.add(Constants.getPrefixedString(payload, 1, StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getNumbers() {
|
||||
return mNumbers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EmergencyNumberElement{" +
|
||||
"mNumbers=" + mNumbers +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,314 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* Holds an AP Geospatial Location ANQP Element, as specified in IEEE802.11-2012 section
|
||||
* 8.4.4.12.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Section 8.4.2.24.10 of the IEEE802.11-2012 specification refers to RFC-3825 for the format of the
|
||||
* Geospatial location information. RFC-3825 has subsequently been obsoleted by RFC-6225 which
|
||||
* defines the same basic binary format for the DHCPv4 payload except that a few unused bits of the
|
||||
* Datum field have been reserved for other uses.
|
||||
* </p>
|
||||
* <p/>
|
||||
* <p>
|
||||
* RFC-3825 defines a resolution field for each of latitude, longitude and altitude as "the number
|
||||
* of significant bits" of precision in the respective values and implies through examples and
|
||||
* otherwise that the non-significant bits should be simply disregarded and the range of values are
|
||||
* calculated as the numeric interval obtained by varying the range of "insignificant bits" between
|
||||
* its extremes. As a simple example, consider the value 33 as a simple 8-bit number with three
|
||||
* significant bits: 33 is 00100001 binary and the leading 001 are the significant bits. With the
|
||||
* above definition, the range of numbers are [32,63] with 33 asymmetrically located at the low end
|
||||
* of the interval. In a more realistic setting an instrument, such as a GPS, would most likely
|
||||
* deliver measurements with a gaussian distribution around the exact value, meaning it is more
|
||||
* reasonable to assume the value as a "center" value with a symmetric uncertainty interval.
|
||||
* RFC-6225 redefines the "resolution" from RFC-3825 with an "uncertainty" value with these
|
||||
* properties, which is also the definition suggested here.
|
||||
* </p>
|
||||
* <p/>
|
||||
* <p>
|
||||
* The res fields provides the resolution as the exponent to a power of two,
|
||||
* e.g. 8 means 2^8 = +/- 256, 0 means 2^0 = +/- 1 and -7 means 2^-7 +/- 0.00781250.
|
||||
* Unknown resolution is indicated by not setting the respective resolution field in the RealValue.
|
||||
* </p>
|
||||
*/
|
||||
public class GEOLocationElement extends ANQPElement {
|
||||
public enum AltitudeType {Unknown, Meters, Floors}
|
||||
|
||||
public enum Datum {Unknown, WGS84, NAD83Land, NAD83Water}
|
||||
|
||||
private static final int ELEMENT_ID = 123; // ???
|
||||
private static final int GEO_LOCATION_LENGTH = 16;
|
||||
|
||||
private static final int LL_FRACTION_SIZE = 25;
|
||||
private static final int LL_WIDTH = 34;
|
||||
private static final int ALT_FRACTION_SIZE = 8;
|
||||
private static final int ALT_WIDTH = 30;
|
||||
private static final int RES_WIDTH = 6;
|
||||
private static final int ALT_TYPE_WIDTH = 4;
|
||||
private static final int DATUM_WIDTH = 8;
|
||||
|
||||
private final RealValue mLatitude;
|
||||
private final RealValue mLongitude;
|
||||
private final RealValue mAltitude;
|
||||
private final AltitudeType mAltitudeType;
|
||||
private final Datum mDatum;
|
||||
|
||||
public static class RealValue {
|
||||
private final double mValue;
|
||||
private final boolean mResolutionSet;
|
||||
private final int mResolution;
|
||||
|
||||
public RealValue(double value) {
|
||||
mValue = value;
|
||||
mResolution = Integer.MIN_VALUE;
|
||||
mResolutionSet = false;
|
||||
}
|
||||
|
||||
public RealValue(double value, int resolution) {
|
||||
mValue = value;
|
||||
mResolution = resolution;
|
||||
mResolutionSet = true;
|
||||
}
|
||||
|
||||
public double getValue() {
|
||||
return mValue;
|
||||
}
|
||||
|
||||
public boolean isResolutionSet() {
|
||||
return mResolutionSet;
|
||||
}
|
||||
|
||||
public int getResolution() {
|
||||
return mResolution;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(String.format("%f", mValue));
|
||||
if (mResolutionSet) {
|
||||
sb.append("+/-2^").append(mResolution);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public GEOLocationElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
payload.get();
|
||||
int locLength = payload.get() & BYTE_MASK;
|
||||
|
||||
if (locLength != GEO_LOCATION_LENGTH) {
|
||||
throw new ProtocolException("GeoLocation length field value " + locLength +
|
||||
" incorrect, expected 16");
|
||||
}
|
||||
if (payload.remaining() != GEO_LOCATION_LENGTH) {
|
||||
throw new ProtocolException("Bad buffer length " + payload.remaining() +
|
||||
", expected 16");
|
||||
}
|
||||
|
||||
ReverseBitStream reverseBitStream = new ReverseBitStream(payload);
|
||||
|
||||
int rawLatRes = (int) reverseBitStream.sliceOff(RES_WIDTH);
|
||||
double latitude =
|
||||
fixToFloat(reverseBitStream.sliceOff(LL_WIDTH), LL_FRACTION_SIZE, LL_WIDTH);
|
||||
|
||||
mLatitude = rawLatRes != 0 ?
|
||||
new RealValue(latitude, bitsToAbsResolution(rawLatRes, LL_WIDTH,
|
||||
LL_FRACTION_SIZE)) :
|
||||
new RealValue(latitude);
|
||||
|
||||
int rawLonRes = (int) reverseBitStream.sliceOff(RES_WIDTH);
|
||||
double longitude =
|
||||
fixToFloat(reverseBitStream.sliceOff(LL_WIDTH), LL_FRACTION_SIZE, LL_WIDTH);
|
||||
|
||||
mLongitude = rawLonRes != 0 ?
|
||||
new RealValue(longitude, bitsToAbsResolution(rawLonRes, LL_WIDTH,
|
||||
LL_FRACTION_SIZE)) :
|
||||
new RealValue(longitude);
|
||||
|
||||
int altType = (int) reverseBitStream.sliceOff(ALT_TYPE_WIDTH);
|
||||
mAltitudeType = altType < AltitudeType.values().length ?
|
||||
AltitudeType.values()[altType] :
|
||||
AltitudeType.Unknown;
|
||||
|
||||
int rawAltRes = (int) reverseBitStream.sliceOff(RES_WIDTH);
|
||||
double altitude = fixToFloat(reverseBitStream.sliceOff(ALT_WIDTH), ALT_FRACTION_SIZE,
|
||||
ALT_WIDTH);
|
||||
|
||||
mAltitude = rawAltRes != 0 ?
|
||||
new RealValue(altitude, bitsToAbsResolution(rawAltRes, ALT_WIDTH,
|
||||
ALT_FRACTION_SIZE)) :
|
||||
new RealValue(altitude);
|
||||
|
||||
int datumValue = (int) reverseBitStream.sliceOff(DATUM_WIDTH);
|
||||
mDatum = datumValue < Datum.values().length ? Datum.values()[datumValue] : Datum.Unknown;
|
||||
}
|
||||
|
||||
public RealValue getLatitude() {
|
||||
return mLatitude;
|
||||
}
|
||||
|
||||
public RealValue getLongitude() {
|
||||
return mLongitude;
|
||||
}
|
||||
|
||||
public RealValue getAltitude() {
|
||||
return mAltitude;
|
||||
}
|
||||
|
||||
public AltitudeType getAltitudeType() {
|
||||
return mAltitudeType;
|
||||
}
|
||||
|
||||
public Datum getDatum() {
|
||||
return mDatum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GEOLocationElement{" +
|
||||
"mLatitude=" + mLatitude +
|
||||
", mLongitude=" + mLongitude +
|
||||
", mAltitude=" + mAltitude +
|
||||
", mAltitudeType=" + mAltitudeType +
|
||||
", mDatum=" + mDatum +
|
||||
'}';
|
||||
}
|
||||
|
||||
private static class ReverseBitStream {
|
||||
|
||||
private final byte[] mOctets;
|
||||
private int mBitoffset;
|
||||
|
||||
private ReverseBitStream(ByteBuffer octets) {
|
||||
mOctets = new byte[octets.remaining()];
|
||||
octets.get(mOctets);
|
||||
}
|
||||
|
||||
private long sliceOff(int bits) {
|
||||
final int bn = mBitoffset + bits;
|
||||
int remaining = bits;
|
||||
long value = 0;
|
||||
|
||||
while (mBitoffset < bn) {
|
||||
int sbit = mBitoffset & 0x7; // Bit #0 is MSB, inclusive
|
||||
int octet = mBitoffset >>> 3;
|
||||
|
||||
// Copy the minimum of what's to the right of sbit
|
||||
// and how much more goes to the target
|
||||
int width = Math.min(Byte.SIZE - sbit, remaining);
|
||||
|
||||
value = (value << width) | getBits(mOctets[octet], sbit, width);
|
||||
|
||||
mBitoffset += width;
|
||||
remaining -= width;
|
||||
}
|
||||
|
||||
System.out.printf(" - Sliced off %d bits: %x\n", bits, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
private static int getBits(byte b, int b0, int width) {
|
||||
int mask = (1 << width) - 1;
|
||||
return (b >> (Byte.SIZE - b0 - width)) & mask;
|
||||
}
|
||||
}
|
||||
|
||||
private static class BitStream {
|
||||
|
||||
private final byte[] data;
|
||||
private int bitOffset; // bit 0 is MSB of data[0]
|
||||
|
||||
private BitStream(int octets) {
|
||||
data = new byte[octets];
|
||||
}
|
||||
|
||||
private void append(long value, int width) {
|
||||
System.out.printf("Appending %x:%d\n", value, width);
|
||||
for (int sbit = width - 1; sbit >= 0; ) {
|
||||
int b0 = bitOffset >>> 3;
|
||||
int dbit = bitOffset & 0x7;
|
||||
|
||||
int shr = sbit - 7 + dbit;
|
||||
int dmask = 0xff >>> dbit;
|
||||
|
||||
if (shr >= 0) {
|
||||
data[b0] = (byte) ((data[b0] & ~dmask) | ((value >>> shr) & dmask));
|
||||
bitOffset += Byte.SIZE - dbit;
|
||||
sbit -= Byte.SIZE - dbit;
|
||||
} else {
|
||||
data[b0] = (byte) ((data[b0] & ~dmask) | ((value << -shr) & dmask));
|
||||
bitOffset += sbit + 1;
|
||||
sbit = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] getOctets() {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
static double fixToFloat(long value, int fractionSize, int width) {
|
||||
long sign = 1L << (width - 1);
|
||||
if ((value & sign) != 0) {
|
||||
value = -value;
|
||||
return -(double) (value & (sign - 1)) / (double) (1L << fractionSize);
|
||||
} else {
|
||||
return (double) (value & (sign - 1)) / (double) (1L << fractionSize);
|
||||
}
|
||||
}
|
||||
|
||||
private static long floatToFix(double value, int fractionSize, int width) {
|
||||
return Math.round(value * (1L << fractionSize)) & ((1L << width) - 1);
|
||||
}
|
||||
|
||||
private static final double LOG2_FACTOR = 1.0 / Math.log(2.0);
|
||||
|
||||
/**
|
||||
* Convert an absolute variance value into absolute resolution representation,
|
||||
* where the variance = 2^resolution.
|
||||
*
|
||||
* @param variance The absolute variance
|
||||
* @return the absolute resolution.
|
||||
*/
|
||||
private static int getResolution(double variance) {
|
||||
return (int) Math.ceil(Math.log(variance) * LOG2_FACTOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an absolute resolution, into the "number of significant bits" for the given fixed
|
||||
* point notation as defined in RFC-3825 and refined in RFC-6225.
|
||||
*
|
||||
* @param resolution absolute resolution given as 2^resolution.
|
||||
* @param fieldWidth Full width of the fixed point number used to represent the value.
|
||||
* @param fractionBits Number of fraction bits in the fixed point number used to represent the
|
||||
* value.
|
||||
* @return The number of "significant bits".
|
||||
*/
|
||||
private static int absResolutionToBits(int resolution, int fieldWidth, int fractionBits) {
|
||||
return fieldWidth - fractionBits - 1 - resolution;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the protocol definition of "number of significant bits" into an absolute resolution.
|
||||
*
|
||||
* @param bits The number of "significant bits" from the binary protocol.
|
||||
* @param fieldWidth Full width of the fixed point number used to represent the value.
|
||||
* @param fractionBits Number of fraction bits in the fixed point number used to represent the
|
||||
* value.
|
||||
* @return The absolute resolution given as 2^resolution.
|
||||
*/
|
||||
private static int bitsToAbsResolution(long bits, int fieldWidth, int fractionBits) {
|
||||
return fieldWidth - fractionBits - 1 - (int) bits;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* ANQP Element to hold a raw, unparsed, octet blob
|
||||
*/
|
||||
public class GenericBlobElement extends ANQPElement {
|
||||
private final byte[] mData;
|
||||
|
||||
public GenericBlobElement(Constants.ANQPElementType infoID, ByteBuffer payload) {
|
||||
super(infoID);
|
||||
mData = new byte[payload.remaining()];
|
||||
payload.get(mData);
|
||||
}
|
||||
|
||||
public byte[] getData() {
|
||||
return mData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Element ID " + getID() + ": " + Constants.toHexString(mData);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* ANQP Element to hold a generic (UTF-8 decoded) character string
|
||||
*/
|
||||
public class GenericStringElement extends ANQPElement {
|
||||
private final String mText;
|
||||
|
||||
public GenericStringElement(Constants.ANQPElementType infoID, ByteBuffer payload) throws ProtocolException {
|
||||
super(infoID);
|
||||
mText = Constants.getString(payload, payload.remaining(), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public String getM_text() {
|
||||
return mText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Element ID " + getID() + ": '" + mText + "'";
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* The HS Capability list vendor specific ANQP Element,
|
||||
* Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00,
|
||||
* section 4.2
|
||||
*/
|
||||
public class HSCapabilityListElement extends ANQPElement {
|
||||
private final Constants.ANQPElementType[] mCapabilities;
|
||||
|
||||
public HSCapabilityListElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
mCapabilities = new Constants.ANQPElementType[payload.remaining()];
|
||||
|
||||
int index = 0;
|
||||
while (payload.hasRemaining()) {
|
||||
int capID = payload.get() & BYTE_MASK;
|
||||
Constants.ANQPElementType capability = Constants.mapANQPElement(capID);
|
||||
if (capability == null)
|
||||
throw new ProtocolException("Unknown capability: " + capID);
|
||||
mCapabilities[index++] = capability;
|
||||
}
|
||||
}
|
||||
|
||||
public Constants.ANQPElementType[] getCapabilities() {
|
||||
return mCapabilities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HSCapabilityListElement{" +
|
||||
"mCapabilities=" + Arrays.toString(mCapabilities) +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
import static android.net.wifi.anqp.Constants.SHORT_MASK;
|
||||
|
||||
/**
|
||||
* The Connection Capability vendor specific ANQP Element,
|
||||
* Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00,
|
||||
* section 4.5
|
||||
*/
|
||||
public class HSConnectionCapabilityElement extends ANQPElement {
|
||||
|
||||
public enum ProtoStatus {Closed, Open, Unknown}
|
||||
|
||||
private final List<ProtocolTuple> mStatusList;
|
||||
|
||||
public static class ProtocolTuple {
|
||||
private final int mProtocol;
|
||||
private final int mPort;
|
||||
private final ProtoStatus mStatus;
|
||||
|
||||
private ProtocolTuple(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() < 4) {
|
||||
throw new ProtocolException("Runt protocol tuple: " + payload.remaining());
|
||||
}
|
||||
mProtocol = payload.get() & BYTE_MASK;
|
||||
mPort = payload.getShort() & SHORT_MASK;
|
||||
int statusNumber = payload.get() & BYTE_MASK;
|
||||
mStatus = statusNumber < ProtoStatus.values().length ?
|
||||
ProtoStatus.values()[statusNumber] :
|
||||
null;
|
||||
}
|
||||
|
||||
public int getProtocol() {
|
||||
return mProtocol;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return mPort;
|
||||
}
|
||||
|
||||
public ProtoStatus getStatus() {
|
||||
return mStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProtocolTuple{" +
|
||||
"mProtocol=" + mProtocol +
|
||||
", mPort=" + mPort +
|
||||
", mStatus=" + mStatus +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public HSConnectionCapabilityElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
mStatusList = new ArrayList<ProtocolTuple>();
|
||||
while (payload.hasRemaining()) {
|
||||
mStatusList.add(new ProtocolTuple(payload));
|
||||
}
|
||||
}
|
||||
|
||||
public List<ProtocolTuple> getStatusList() {
|
||||
return Collections.unmodifiableList(mStatusList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HSConnectionCapabilityElement{" +
|
||||
"mStatusList=" + mStatusList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The Operator Friendly Name vendor specific ANQP Element,
|
||||
* Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00,
|
||||
* section 4.3
|
||||
*/
|
||||
public class HSFriendlyNameElement extends ANQPElement {
|
||||
private final List<I18Name> mNames;
|
||||
|
||||
public HSFriendlyNameElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
mNames = new ArrayList<I18Name>();
|
||||
|
||||
while (payload.hasRemaining()) {
|
||||
mNames.add(new I18Name(payload));
|
||||
}
|
||||
}
|
||||
|
||||
public List<I18Name> getNames() {
|
||||
return Collections.unmodifiableList(mNames);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HSFriendlyNameElement{" +
|
||||
"mNames=" + mNames +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
import static android.net.wifi.anqp.Constants.SHORT_MASK;
|
||||
|
||||
/**
|
||||
* The Icon Binary File vendor specific ANQP Element,
|
||||
* Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00,
|
||||
* section 4.11
|
||||
*/
|
||||
public class HSIconFileElement extends ANQPElement {
|
||||
|
||||
public enum StatusCode {Success, FileNotFound, Unspecified}
|
||||
|
||||
private final StatusCode mStatusCode;
|
||||
private final String mType;
|
||||
private final byte[] mIconData;
|
||||
|
||||
public HSIconFileElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
if (payload.remaining() < 4) {
|
||||
throw new ProtocolException("Truncated icon file: " + payload.remaining());
|
||||
}
|
||||
|
||||
int statusID = payload.get() & BYTE_MASK;
|
||||
mStatusCode = statusID < StatusCode.values().length ? StatusCode.values()[statusID] : null;
|
||||
mType = Constants.getString(payload, 1, StandardCharsets.US_ASCII);
|
||||
|
||||
int dataLength = payload.getShort() & SHORT_MASK;
|
||||
mIconData = new byte[dataLength];
|
||||
payload.get(mIconData);
|
||||
}
|
||||
|
||||
public StatusCode getStatusCode() {
|
||||
return mStatusCode;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return mType;
|
||||
}
|
||||
|
||||
public byte[] getIconData() {
|
||||
return mIconData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HSIconFileElement{" +
|
||||
"mStatusCode=" + mStatusCode +
|
||||
", mType='" + mType + '\'' +
|
||||
", mIconData=" + mIconData.length + " bytes }";
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* The OSU Providers List vendor specific ANQP Element,
|
||||
* Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00,
|
||||
* section 4.8
|
||||
*/
|
||||
public class HSOsuProvidersElement extends ANQPElement {
|
||||
private final String mSSID;
|
||||
private final List<OSUProvider> mProviders;
|
||||
|
||||
public HSOsuProvidersElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
mSSID = Constants.getPrefixedString(payload, 1, StandardCharsets.UTF_8);
|
||||
int providerCount = payload.get() & BYTE_MASK;
|
||||
|
||||
mProviders = new ArrayList<OSUProvider>(providerCount);
|
||||
|
||||
while (providerCount > 0) {
|
||||
mProviders.add(new OSUProvider(payload));
|
||||
providerCount--;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSSID() {
|
||||
return mSSID;
|
||||
}
|
||||
|
||||
public List<OSUProvider> getProviders() {
|
||||
return Collections.unmodifiableList(mProviders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HSOsuProvidersElement{" +
|
||||
"mSSID='" + mSSID + '\'' +
|
||||
", mProviders=" + mProviders +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
import static android.net.wifi.anqp.Constants.INT_MASK;
|
||||
import static android.net.wifi.anqp.Constants.SHORT_MASK;
|
||||
|
||||
/**
|
||||
* The WAN Metrics vendor specific ANQP Element,
|
||||
* Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00,
|
||||
* section 4.4
|
||||
*/
|
||||
public class HSWanMetricsElement extends ANQPElement {
|
||||
|
||||
public enum LinkStatus {Reserved, Up, Down, Test}
|
||||
|
||||
private final LinkStatus mStatus;
|
||||
private final boolean mSymmetric;
|
||||
private final boolean mCapped;
|
||||
private final long mDlSpeed;
|
||||
private final long mUlSpeed;
|
||||
private final int mDlLoad;
|
||||
private final int mUlLoad;
|
||||
private final int mLMD;
|
||||
|
||||
public HSWanMetricsElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
if (payload.remaining() != 13) {
|
||||
throw new ProtocolException("Bad WAN metrics length: " + payload.remaining());
|
||||
}
|
||||
|
||||
int status = payload.get() & BYTE_MASK;
|
||||
mStatus = LinkStatus.values()[status & 0x03];
|
||||
mSymmetric = (status & 0x04) != 0;
|
||||
mCapped = (status & 0x08) != 0;
|
||||
mDlSpeed = payload.getInt() & INT_MASK;
|
||||
mUlSpeed = payload.getInt() & INT_MASK;
|
||||
mDlLoad = payload.get() & BYTE_MASK;
|
||||
mUlLoad = payload.get() & BYTE_MASK;
|
||||
mLMD = payload.getShort() & SHORT_MASK;
|
||||
}
|
||||
|
||||
public LinkStatus getStatus() {
|
||||
return mStatus;
|
||||
}
|
||||
|
||||
public boolean isSymmetric() {
|
||||
return mSymmetric;
|
||||
}
|
||||
|
||||
public boolean isCapped() {
|
||||
return mCapped;
|
||||
}
|
||||
|
||||
public long getDlSpeed() {
|
||||
return mDlSpeed;
|
||||
}
|
||||
|
||||
public long getUlSpeed() {
|
||||
return mUlSpeed;
|
||||
}
|
||||
|
||||
public int getDlLoad() {
|
||||
return mDlLoad;
|
||||
}
|
||||
|
||||
public int getUlLoad() {
|
||||
return mUlLoad;
|
||||
}
|
||||
|
||||
public int getLMD() {
|
||||
return mLMD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HSWanMetricsElement{" +
|
||||
"mStatus=" + mStatus +
|
||||
", mSymmetric=" + mSymmetric +
|
||||
", mCapped=" + mCapped +
|
||||
", mDlSpeed=" + mDlSpeed +
|
||||
", mUlSpeed=" + mUlSpeed +
|
||||
", mDlLoad=" + mDlLoad +
|
||||
", mUlLoad=" + mUlLoad +
|
||||
", mLMD=" + mLMD +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Locale;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* A generic Internationalized name used in ANQP elements as specified in 802.11-2012 and
|
||||
* "Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00"
|
||||
*/
|
||||
public class I18Name {
|
||||
private static final int LANG_CODE_LENGTH = 3;
|
||||
|
||||
private final Locale mLocale;
|
||||
private final String mText;
|
||||
|
||||
public I18Name(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() < 4) {
|
||||
throw new ProtocolException("Truncated I18Name: " + payload.remaining());
|
||||
}
|
||||
int nameLength = payload.get() & BYTE_MASK;
|
||||
if (nameLength < 3) {
|
||||
throw new ProtocolException("Runt I18Name: " + nameLength);
|
||||
}
|
||||
String language = Constants.getString(payload, LANG_CODE_LENGTH, StandardCharsets.US_ASCII);
|
||||
mLocale = Locale.forLanguageTag(language);
|
||||
mText = Constants.getString(payload, nameLength - LANG_CODE_LENGTH, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public Locale getLocale() {
|
||||
return mLocale;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return mText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return mText + ':' + mLocale.getLanguage();
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* The IP Address Type availability ANQP Element, IEEE802.11-2012 section 8.4.4.9
|
||||
*/
|
||||
public class IPAddressTypeAvailabilityElement extends ANQPElement {
|
||||
public enum IPv4Availability {
|
||||
NotAvailable, Public, PortRestricted, SingleNATA, DoubleNAT,
|
||||
PortRestrictedAndSingleNAT, PortRestrictedAndDoubleNAT, Unknown
|
||||
}
|
||||
|
||||
public enum IPv6Availability {NotAvailable, Available, Unknown, Reserved}
|
||||
|
||||
private final IPv4Availability mV4Availability;
|
||||
private final IPv6Availability mV6Availability;
|
||||
|
||||
public IPAddressTypeAvailabilityElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
if (payload.remaining() != 1)
|
||||
throw new ProtocolException("Bad IP Address Type Availability length: " +
|
||||
payload.remaining());
|
||||
|
||||
int ipField = payload.get();
|
||||
mV6Availability = IPv6Availability.values()[ipField & 0x3];
|
||||
|
||||
ipField = (ipField >> 2) & 0x3f;
|
||||
mV4Availability = ipField <= IPv4Availability.values().length ?
|
||||
IPv4Availability.values()[ipField] :
|
||||
IPv4Availability.Unknown;
|
||||
}
|
||||
|
||||
public IPv4Availability getV4Availability() {
|
||||
return mV4Availability;
|
||||
}
|
||||
|
||||
public IPv6Availability getV6Availability() {
|
||||
return mV6Availability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IPAddressTypeAvailabilityElement{" +
|
||||
"mV4Availability=" + mV4Availability +
|
||||
", mV6Availability=" + mV6Availability +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Locale;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.SHORT_MASK;
|
||||
|
||||
/**
|
||||
* The Icons available OSU Providers sub field, as specified in
|
||||
* Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00,
|
||||
* section 4.8.1.4
|
||||
*/
|
||||
public class IconInfo {
|
||||
private final int mWidth;
|
||||
private final int mHeight;
|
||||
private final Locale mLocale;
|
||||
private final String mIconType;
|
||||
private final String mFileName;
|
||||
|
||||
public IconInfo(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() < 9) {
|
||||
throw new ProtocolException("Truncated icon meta data");
|
||||
}
|
||||
|
||||
mWidth = payload.getShort() & SHORT_MASK;
|
||||
mHeight = payload.getShort() & SHORT_MASK;
|
||||
mLocale = Locale.forLanguageTag(Constants.getString(payload, 3, StandardCharsets.US_ASCII));
|
||||
mIconType = Constants.getPrefixedString(payload, 1, StandardCharsets.US_ASCII);
|
||||
mFileName = Constants.getPrefixedString(payload, 1, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
public Locale getLocale() {
|
||||
return mLocale;
|
||||
}
|
||||
|
||||
public String getIconType() {
|
||||
return mIconType;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return mFileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IconInfo{" +
|
||||
"mWidth=" + mWidth +
|
||||
", mHeight=" + mHeight +
|
||||
", mLocale=" + mLocale +
|
||||
", mIconType='" + mIconType + '\'' +
|
||||
", mFileName='" + mFileName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import android.net.wifi.anqp.eap.EAPMethod;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
import static android.net.wifi.anqp.Constants.SHORT_MASK;
|
||||
import static android.net.wifi.anqp.Constants.UTF8_INDICATOR;
|
||||
|
||||
/**
|
||||
* The NAI Realm Data ANQP sub-element, IEEE802.11-2012 section 8.4.4.10 figure 8-418
|
||||
*/
|
||||
public class NAIRealmData {
|
||||
private final List<String> mRealms;
|
||||
private final List<EAPMethod> mEAPMethods;
|
||||
|
||||
public NAIRealmData(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() < 5) {
|
||||
throw new ProtocolException("Runt payload: " + payload.remaining());
|
||||
}
|
||||
|
||||
int length = payload.getShort() & SHORT_MASK;
|
||||
if (length > payload.remaining()) {
|
||||
throw new ProtocolException("Invalid data length: " + length);
|
||||
}
|
||||
boolean utf8 = (payload.get() & 1) == UTF8_INDICATOR;
|
||||
|
||||
String realm = Constants.getPrefixedString(payload, 1, utf8 ?
|
||||
StandardCharsets.UTF_8 :
|
||||
StandardCharsets.US_ASCII);
|
||||
String[] realms = realm.split(";");
|
||||
mRealms = new ArrayList<String>();
|
||||
for (String realmElement : realms) {
|
||||
if (realmElement.length() > 0) {
|
||||
mRealms.add(realmElement);
|
||||
}
|
||||
}
|
||||
|
||||
int methodCount = payload.get() & BYTE_MASK;
|
||||
mEAPMethods = new ArrayList<EAPMethod>(methodCount);
|
||||
while (methodCount > 0) {
|
||||
mEAPMethods.add(new EAPMethod(payload));
|
||||
methodCount--;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getRealms() {
|
||||
return Collections.unmodifiableList(mRealms);
|
||||
}
|
||||
|
||||
public List<EAPMethod> getEAPMethods() {
|
||||
return Collections.unmodifiableList(mEAPMethods);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NAIRealmData{" +
|
||||
"mRealms='" + mRealms + '\'' +
|
||||
", mEAPMethods=" + mEAPMethods +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTES_IN_SHORT;
|
||||
import static android.net.wifi.anqp.Constants.SHORT_MASK;
|
||||
|
||||
/**
|
||||
* The NAI Realm ANQP Element, IEEE802.11-2012 section 8.4.4.10
|
||||
*/
|
||||
public class NAIRealmElement extends ANQPElement {
|
||||
private final List<NAIRealmData> mRealmData;
|
||||
|
||||
public NAIRealmElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
if (!payload.hasRemaining()) {
|
||||
mRealmData = Collections.emptyList();
|
||||
return;
|
||||
}
|
||||
|
||||
if (payload.remaining() < BYTES_IN_SHORT) {
|
||||
throw new ProtocolException("Runt NAI Realm: " + payload.remaining());
|
||||
}
|
||||
|
||||
int count = payload.getShort() & SHORT_MASK;
|
||||
mRealmData = new ArrayList<NAIRealmData>(count);
|
||||
while (count > 0) {
|
||||
mRealmData.add(new NAIRealmData(payload));
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
public List<NAIRealmData> getRealmData() {
|
||||
return Collections.unmodifiableList(mRealmData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NAIRealmElement{" +
|
||||
"mRealmData=" + mRealmData +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* The Network Authentication Type ANQP Element, IEEE802.11-2012 section 8.4.4.6
|
||||
*/
|
||||
public class NetworkAuthenticationTypeElement extends ANQPElement {
|
||||
|
||||
private final List<NetworkAuthentication> m_authenticationTypes;
|
||||
|
||||
public enum NwkAuthTypeEnum {
|
||||
TermsAndConditions,
|
||||
OnLineEnrollment,
|
||||
HTTPRedirection,
|
||||
DNSRedirection,
|
||||
Reserved
|
||||
}
|
||||
|
||||
public static class NetworkAuthentication {
|
||||
private final NwkAuthTypeEnum m_type;
|
||||
private final String m_url;
|
||||
|
||||
private NetworkAuthentication(NwkAuthTypeEnum type, String url) {
|
||||
m_type = type;
|
||||
m_url = url;
|
||||
}
|
||||
|
||||
public NwkAuthTypeEnum getType() {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
public String getURL() {
|
||||
return m_url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NetworkAuthentication{" +
|
||||
"m_type=" + m_type +
|
||||
", m_url='" + m_url + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public NetworkAuthenticationTypeElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
|
||||
super(infoID);
|
||||
|
||||
m_authenticationTypes = new ArrayList<NetworkAuthentication>();
|
||||
|
||||
while (payload.hasRemaining()) {
|
||||
int typeNumber = payload.get() & BYTE_MASK;
|
||||
NwkAuthTypeEnum type;
|
||||
type = typeNumber >= NwkAuthTypeEnum.values().length ?
|
||||
NwkAuthTypeEnum.Reserved :
|
||||
NwkAuthTypeEnum.values()[typeNumber];
|
||||
|
||||
m_authenticationTypes.add(new NetworkAuthentication(type,
|
||||
Constants.getPrefixedString(payload, 2, StandardCharsets.UTF_8)));
|
||||
}
|
||||
}
|
||||
|
||||
public List<NetworkAuthentication> getAuthenticationTypes() {
|
||||
return Collections.unmodifiableList(m_authenticationTypes);
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
import static android.net.wifi.anqp.Constants.SHORT_MASK;
|
||||
|
||||
/**
|
||||
* An OSU Provider, as specified in
|
||||
* Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00,
|
||||
* section 4.8.1
|
||||
*/
|
||||
public class OSUProvider {
|
||||
|
||||
public enum OSUMethod {OmaDm, SoapXml}
|
||||
|
||||
private final List<I18Name> mNames;
|
||||
private final String mOSUServer;
|
||||
private final List<OSUMethod> mOSUMethods;
|
||||
private final List<IconInfo> mIcons;
|
||||
private final String mOsuNai;
|
||||
private final List<I18Name> mServiceDescriptions;
|
||||
|
||||
public OSUProvider(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() < 11) {
|
||||
throw new ProtocolException("Truncated OSU provider: " + payload.remaining());
|
||||
}
|
||||
|
||||
int length = payload.getShort() & SHORT_MASK;
|
||||
int namesLength = payload.getShort() & SHORT_MASK;
|
||||
|
||||
ByteBuffer namesBuffer = payload.duplicate();
|
||||
namesBuffer.limit(namesBuffer.position() + namesLength);
|
||||
payload.position(payload.position() + namesLength);
|
||||
|
||||
mNames = new ArrayList<I18Name>();
|
||||
|
||||
while (namesBuffer.hasRemaining()) {
|
||||
mNames.add(new I18Name(namesBuffer));
|
||||
}
|
||||
|
||||
mOSUServer = Constants.getPrefixedString(payload, 1, StandardCharsets.UTF_8);
|
||||
int methodLength = payload.get() & BYTE_MASK;
|
||||
mOSUMethods = new ArrayList<OSUMethod>(methodLength);
|
||||
while (methodLength > 0) {
|
||||
int methodID = payload.get() & BYTE_MASK;
|
||||
mOSUMethods.add(methodID < OSUMethod.values().length ?
|
||||
OSUMethod.values()[methodID] :
|
||||
null);
|
||||
methodLength--;
|
||||
}
|
||||
|
||||
int iconsLength = payload.getShort() & SHORT_MASK;
|
||||
ByteBuffer iconsBuffer = payload.duplicate();
|
||||
iconsBuffer.limit(iconsBuffer.position() + iconsLength);
|
||||
payload.position(payload.position() + iconsLength);
|
||||
|
||||
mIcons = new ArrayList<IconInfo>();
|
||||
|
||||
while (iconsBuffer.hasRemaining()) {
|
||||
mIcons.add(new IconInfo(iconsBuffer));
|
||||
}
|
||||
|
||||
mOsuNai = Constants.getString(payload, 1, StandardCharsets.UTF_8, true);
|
||||
|
||||
int descriptionsLength = payload.getShort() & SHORT_MASK;
|
||||
ByteBuffer descriptionsBuffer = payload.duplicate();
|
||||
descriptionsBuffer.limit(descriptionsBuffer.position() + descriptionsLength);
|
||||
payload.position(payload.position() + descriptionsLength);
|
||||
|
||||
mServiceDescriptions = new ArrayList<I18Name>();
|
||||
|
||||
while (descriptionsBuffer.hasRemaining()) {
|
||||
mServiceDescriptions.add(new I18Name(descriptionsBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
public List<I18Name> getNames() {
|
||||
return mNames;
|
||||
}
|
||||
|
||||
public String getOSUServer() {
|
||||
return mOSUServer;
|
||||
}
|
||||
|
||||
public List<OSUMethod> getOSUMethods() {
|
||||
return mOSUMethods;
|
||||
}
|
||||
|
||||
public List<IconInfo> getIcons() {
|
||||
return mIcons;
|
||||
}
|
||||
|
||||
public String getOsuNai() {
|
||||
return mOsuNai;
|
||||
}
|
||||
|
||||
public List<I18Name> getServiceDescriptions() {
|
||||
return mServiceDescriptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OSUProvider{" +
|
||||
"mNames=" + mNames +
|
||||
", mOSUServer='" + mOSUServer + '\'' +
|
||||
", mOSUMethods=" + mOSUMethods +
|
||||
", mIcons=" + mIcons +
|
||||
", mOsuNai='" + mOsuNai + '\'' +
|
||||
", mServiceDescriptions=" + mServiceDescriptions +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
import static android.net.wifi.anqp.Constants.getInteger;
|
||||
|
||||
/**
|
||||
* The Roaming Consortium ANQP Element, IEEE802.11-2012 section 8.4.4.7
|
||||
*/
|
||||
public class RoamingConsortiumElement extends ANQPElement {
|
||||
|
||||
private final List<Long> mOis;
|
||||
|
||||
public RoamingConsortiumElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
mOis = new ArrayList<Long>();
|
||||
|
||||
while (payload.hasRemaining()) {
|
||||
int length = payload.get() & BYTE_MASK;
|
||||
if (length > payload.remaining()) {
|
||||
throw new ProtocolException("Bad OI length: " + length);
|
||||
}
|
||||
mOis.add(getInteger(payload, length));
|
||||
}
|
||||
}
|
||||
|
||||
public List<Long> getOIs() {
|
||||
return Collections.unmodifiableList(mOis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RoamingConsortiumElement{" +
|
||||
"mOis=" + mOis +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* The 3GPP Cellular Network ANQP Element, IEEE802.11-2012 section 8.4.4.11
|
||||
*/
|
||||
public class ThreeGPPNetworkElement extends ANQPElement {
|
||||
|
||||
private final byte[] mData;
|
||||
|
||||
public ThreeGPPNetworkElement(Constants.ANQPElementType infoID, ByteBuffer payload) {
|
||||
super(infoID);
|
||||
mData = new byte[payload.remaining()];
|
||||
payload.get(mData);
|
||||
}
|
||||
|
||||
public byte[] getData() {
|
||||
return mData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ThreeGPPNetworkElement{" +
|
||||
"mData=" + Constants.toHexString(mData) +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
package android.net.wifi.anqp;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* The Venue Name ANQP Element, IEEE802.11-2012 section 8.4.4.4
|
||||
*/
|
||||
public class VenueNameElement extends ANQPElement {
|
||||
private final VenueGroup mGroup;
|
||||
private final VenueType mType;
|
||||
private final List<I18Name> mNames;
|
||||
|
||||
private static final Map<VenueGroup, Integer> s_groupBases =
|
||||
new EnumMap<VenueGroup, Integer>(VenueGroup.class);
|
||||
|
||||
public VenueNameElement(Constants.ANQPElementType infoID, ByteBuffer payload)
|
||||
throws ProtocolException {
|
||||
super(infoID);
|
||||
|
||||
if (payload.remaining() < 2)
|
||||
throw new ProtocolException("Runt Venue Name");
|
||||
|
||||
int group = payload.get() & BYTE_MASK;
|
||||
int type = payload.get() & BYTE_MASK;
|
||||
|
||||
if (group >= VenueGroup.values().length) {
|
||||
mGroup = VenueGroup.Reserved;
|
||||
mType = VenueType.Reserved;
|
||||
} else {
|
||||
mGroup = VenueGroup.values()[group];
|
||||
type += s_groupBases.get(mGroup);
|
||||
if (type >= VenueType.values().length) {
|
||||
mType = VenueType.Reserved;
|
||||
} else {
|
||||
mType = VenueType.values()[type];
|
||||
}
|
||||
}
|
||||
|
||||
mNames = new ArrayList<I18Name>();
|
||||
while (payload.hasRemaining()) {
|
||||
mNames.add(new I18Name(payload));
|
||||
}
|
||||
}
|
||||
|
||||
public VenueGroup getGroup() {
|
||||
return mGroup;
|
||||
}
|
||||
|
||||
public VenueType getType() {
|
||||
return mType;
|
||||
}
|
||||
|
||||
public List<I18Name> getNames() {
|
||||
return Collections.unmodifiableList(mNames);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VenueNameElement{" +
|
||||
"m_group=" + mGroup +
|
||||
", m_type=" + mType +
|
||||
", m_names=" + mNames +
|
||||
'}';
|
||||
}
|
||||
|
||||
public enum VenueGroup {
|
||||
Unspecified,
|
||||
Assembly,
|
||||
Business,
|
||||
Educational,
|
||||
FactoryIndustrial,
|
||||
Institutional,
|
||||
Mercantile,
|
||||
Residential,
|
||||
Storage,
|
||||
UtilityMiscellaneous,
|
||||
Vehicular,
|
||||
Outdoor,
|
||||
Reserved
|
||||
}
|
||||
|
||||
public enum VenueType {
|
||||
Unspecified,
|
||||
|
||||
UnspecifiedAssembly,
|
||||
Arena,
|
||||
Stadium,
|
||||
PassengerTerminal,
|
||||
Amphitheater,
|
||||
AmusementPark,
|
||||
PlaceOfWorship,
|
||||
ConventionCenter,
|
||||
Library,
|
||||
Museum,
|
||||
Restaurant,
|
||||
Theater,
|
||||
Bar,
|
||||
CoffeeShop,
|
||||
ZooOrAquarium,
|
||||
EmergencyCoordinationCenter,
|
||||
|
||||
UnspecifiedBusiness,
|
||||
DoctorDentistoffice,
|
||||
Bank,
|
||||
FireStation,
|
||||
PoliceStation,
|
||||
PostOffice,
|
||||
ProfessionalOffice,
|
||||
ResearchDevelopmentFacility,
|
||||
AttorneyOffice,
|
||||
|
||||
UnspecifiedEducational,
|
||||
SchoolPrimary,
|
||||
SchoolSecondary,
|
||||
UniversityCollege,
|
||||
|
||||
UnspecifiedFactoryIndustrial,
|
||||
Factory,
|
||||
|
||||
UnspecifiedInstitutional,
|
||||
Hospital,
|
||||
LongTermCareFacility,
|
||||
AlcoholAndDrugRehabilitationCenter,
|
||||
GroupHome,
|
||||
PrisonJail,
|
||||
|
||||
UnspecifiedMercantile,
|
||||
RetailStore,
|
||||
GroceryMarket,
|
||||
AutomotiveServiceStation,
|
||||
ShoppingMall,
|
||||
GasStation,
|
||||
|
||||
UnspecifiedResidential,
|
||||
PrivateResidence,
|
||||
HotelMotel,
|
||||
Dormitory,
|
||||
BoardingHouse,
|
||||
|
||||
UnspecifiedStorage,
|
||||
|
||||
UnspecifiedUtilityMiscellaneous,
|
||||
|
||||
AutomobileOrTruck,
|
||||
Airplane,
|
||||
Bus,
|
||||
Ferry,
|
||||
ShipOrBoat,
|
||||
Train,
|
||||
MotorBike,
|
||||
|
||||
UnspecifiedOutdoor,
|
||||
MuniMeshNetwork,
|
||||
CityPark,
|
||||
RestArea,
|
||||
TrafficControl,
|
||||
BusStop,
|
||||
Kiosk,
|
||||
|
||||
Reserved
|
||||
}
|
||||
|
||||
private static final VenueType[] PerGroup =
|
||||
{
|
||||
VenueType.Unspecified,
|
||||
VenueType.UnspecifiedAssembly,
|
||||
VenueType.UnspecifiedBusiness,
|
||||
VenueType.UnspecifiedEducational,
|
||||
VenueType.UnspecifiedFactoryIndustrial,
|
||||
VenueType.UnspecifiedInstitutional,
|
||||
VenueType.UnspecifiedMercantile,
|
||||
VenueType.UnspecifiedResidential,
|
||||
VenueType.UnspecifiedStorage,
|
||||
VenueType.UnspecifiedUtilityMiscellaneous,
|
||||
VenueType.AutomobileOrTruck,
|
||||
VenueType.UnspecifiedOutdoor,
|
||||
null
|
||||
};
|
||||
|
||||
static {
|
||||
int index = 0;
|
||||
for (VenueType venue : PerGroup) {
|
||||
s_groupBases.put(VenueGroup.values()[index++], venue.ordinal());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package android.net.wifi.anqp.eap;
|
||||
|
||||
/**
|
||||
* An Authentication parameter, part of the NAI Realm ANQP element, specified in
|
||||
* IEEE802.11-2012 section 8.4.4.10, table 8-188
|
||||
*/
|
||||
public interface AuthParam {
|
||||
public EAP.AuthInfoID getAuthInfoID();
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package android.net.wifi.anqp.eap;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* An EAP authentication parameter, IEEE802.11-2012, table 8-188
|
||||
*/
|
||||
public class Credential implements AuthParam {
|
||||
|
||||
public enum CredType {
|
||||
Reserved,
|
||||
SIM,
|
||||
USIM,
|
||||
NFC,
|
||||
HWToken,
|
||||
Softoken,
|
||||
Certificate,
|
||||
Username,
|
||||
None,
|
||||
Anonymous,
|
||||
VendorSpecific}
|
||||
|
||||
private final EAP.AuthInfoID mAuthInfoID;
|
||||
private final CredType mCredType;
|
||||
|
||||
public Credential(EAP.AuthInfoID infoID, ByteBuffer payload) throws ProtocolException {
|
||||
mAuthInfoID = infoID;
|
||||
|
||||
if (payload.remaining() != 1) {
|
||||
throw new ProtocolException("Bad length: " + payload.remaining());
|
||||
}
|
||||
|
||||
int typeID = payload.get() & BYTE_MASK;
|
||||
mCredType = typeID < CredType.values().length ?
|
||||
CredType.values()[typeID] :
|
||||
CredType.Reserved;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EAP.AuthInfoID getAuthInfoID() {
|
||||
return mAuthInfoID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return mAuthInfoID.hashCode() * 31 + mCredType.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object thatObject) {
|
||||
if (thatObject == this) {
|
||||
return true;
|
||||
} else if (thatObject == null || thatObject.getClass() != AuthParam.class) {
|
||||
return false;
|
||||
} else {
|
||||
return ((Credential) thatObject).getCredType() == getCredType();
|
||||
}
|
||||
}
|
||||
|
||||
public CredType getCredType() {
|
||||
return mCredType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Credential{" +
|
||||
"mAuthInfoID=" + mAuthInfoID +
|
||||
", mCredType=" + mCredType +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
package android.net.wifi.anqp.eap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* EAP Related constants for the ANQP NAIRealm element, IEEE802.11-2012 section 8.4.4.10
|
||||
*/
|
||||
public abstract class EAP {
|
||||
|
||||
private static final Map<Integer, EAPMethodID> s_eapIds = new HashMap<Integer, EAPMethodID>();
|
||||
|
||||
public static final int EAP_MD5 = 4;
|
||||
public static final int EAP_OTP = 5;
|
||||
public static final int EAP_RSA = 9;
|
||||
public static final int EAP_KEA = 11;
|
||||
public static final int EAP_KEA_VALIDATE = 12;
|
||||
public static final int EAP_TLS = 13;
|
||||
public static final int EAP_LEAP = 17;
|
||||
public static final int EAP_SIM = 18;
|
||||
public static final int EAP_TTLS = 21;
|
||||
public static final int EAP_AKA = 23;
|
||||
public static final int EAP_3Com = 24;
|
||||
public static final int EAP_MSCHAPv2 = 26;
|
||||
public static final int EAP_PEAP = 29;
|
||||
public static final int EAP_POTP = 32;
|
||||
public static final int EAP_ActiontecWireless = 35;
|
||||
public static final int EAP_HTTPDigest = 38;
|
||||
public static final int EAP_SPEKE = 41;
|
||||
public static final int EAP_MOBAC = 42;
|
||||
public static final int EAP_FAST = 43;
|
||||
public static final int EAP_ZLXEAP = 44;
|
||||
public static final int EAP_Link = 45;
|
||||
public static final int EAP_PAX = 46;
|
||||
public static final int EAP_PSK = 47;
|
||||
public static final int EAP_SAKE = 48;
|
||||
public static final int EAP_IKEv2 = 49;
|
||||
public static final int EAP_AKAPrim = 50;
|
||||
public static final int EAP_GPSK = 51;
|
||||
public static final int EAP_PWD = 52;
|
||||
public static final int EAP_EKE = 53;
|
||||
public static final int EAP_TEAP = 55;
|
||||
|
||||
public enum EAPMethodID {
|
||||
EAP_MD5,
|
||||
EAP_OTP,
|
||||
EAP_RSA,
|
||||
EAP_KEA,
|
||||
EAP_KEA_VALIDATE,
|
||||
EAP_TLS,
|
||||
EAP_LEAP,
|
||||
EAP_SIM,
|
||||
EAP_TTLS,
|
||||
EAP_AKA,
|
||||
EAP_3Com,
|
||||
EAP_MSCHAPv2,
|
||||
EAP_PEAP,
|
||||
EAP_POTP,
|
||||
EAP_ActiontecWireless,
|
||||
EAP_HTTPDigest,
|
||||
EAP_SPEKE,
|
||||
EAP_MOBAC,
|
||||
EAP_FAST,
|
||||
EAP_ZLXEAP,
|
||||
EAP_Link,
|
||||
EAP_PAX,
|
||||
EAP_PSK,
|
||||
EAP_SAKE,
|
||||
EAP_IKEv2,
|
||||
EAP_AKAPrim,
|
||||
EAP_GPSK,
|
||||
EAP_PWD,
|
||||
EAP_EKE,
|
||||
EAP_TEAP
|
||||
}
|
||||
|
||||
public static final int ExpandedEAPMethod = 1;
|
||||
public static final int NonEAPInnerAuthType = 2;
|
||||
public static final int InnerAuthEAPMethodType = 3;
|
||||
public static final int ExpandedInnerEAPMethod = 4;
|
||||
public static final int CredentialType = 5;
|
||||
public static final int TunneledEAPMethodCredType = 6;
|
||||
public static final int VendorSpecific = 221;
|
||||
|
||||
public enum AuthInfoID {
|
||||
Undefined,
|
||||
ExpandedEAPMethod,
|
||||
NonEAPInnerAuthType,
|
||||
InnerAuthEAPMethodType,
|
||||
ExpandedInnerEAPMethod,
|
||||
CredentialType,
|
||||
TunneledEAPMethodCredType,
|
||||
VendorSpecific
|
||||
}
|
||||
|
||||
static {
|
||||
s_eapIds.put(EAP_MD5, EAPMethodID.EAP_MD5);
|
||||
s_eapIds.put(EAP_OTP, EAPMethodID.EAP_OTP);
|
||||
s_eapIds.put(EAP_RSA, EAPMethodID.EAP_RSA);
|
||||
s_eapIds.put(EAP_KEA, EAPMethodID.EAP_KEA);
|
||||
s_eapIds.put(EAP_KEA_VALIDATE, EAPMethodID.EAP_KEA_VALIDATE);
|
||||
s_eapIds.put(EAP_TLS, EAPMethodID.EAP_TLS);
|
||||
s_eapIds.put(EAP_LEAP, EAPMethodID.EAP_LEAP);
|
||||
s_eapIds.put(EAP_SIM, EAPMethodID.EAP_SIM);
|
||||
s_eapIds.put(EAP_TTLS, EAPMethodID.EAP_TTLS);
|
||||
s_eapIds.put(EAP_AKA, EAPMethodID.EAP_AKA);
|
||||
s_eapIds.put(EAP_3Com, EAPMethodID.EAP_3Com);
|
||||
s_eapIds.put(EAP_MSCHAPv2, EAPMethodID.EAP_MSCHAPv2);
|
||||
s_eapIds.put(EAP_PEAP, EAPMethodID.EAP_PEAP);
|
||||
s_eapIds.put(EAP_POTP, EAPMethodID.EAP_POTP);
|
||||
s_eapIds.put(EAP_ActiontecWireless, EAPMethodID.EAP_ActiontecWireless);
|
||||
s_eapIds.put(EAP_HTTPDigest, EAPMethodID.EAP_HTTPDigest);
|
||||
s_eapIds.put(EAP_SPEKE, EAPMethodID.EAP_SPEKE);
|
||||
s_eapIds.put(EAP_MOBAC, EAPMethodID.EAP_MOBAC);
|
||||
s_eapIds.put(EAP_FAST, EAPMethodID.EAP_FAST);
|
||||
s_eapIds.put(EAP_ZLXEAP, EAPMethodID.EAP_ZLXEAP);
|
||||
s_eapIds.put(EAP_Link, EAPMethodID.EAP_Link);
|
||||
s_eapIds.put(EAP_PAX, EAPMethodID.EAP_PAX);
|
||||
s_eapIds.put(EAP_PSK, EAPMethodID.EAP_PSK);
|
||||
s_eapIds.put(EAP_SAKE, EAPMethodID.EAP_SAKE);
|
||||
s_eapIds.put(EAP_IKEv2, EAPMethodID.EAP_IKEv2);
|
||||
s_eapIds.put(EAP_AKAPrim, EAPMethodID.EAP_AKAPrim);
|
||||
s_eapIds.put(EAP_GPSK, EAPMethodID.EAP_GPSK);
|
||||
s_eapIds.put(EAP_PWD, EAPMethodID.EAP_PWD);
|
||||
s_eapIds.put(EAP_EKE, EAPMethodID.EAP_EKE);
|
||||
s_eapIds.put(EAP_TEAP, EAPMethodID.EAP_TEAP);
|
||||
}
|
||||
|
||||
public static EAPMethodID mapEAPMethod(int methodID) {
|
||||
return s_eapIds.get(methodID);
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
package android.net.wifi.anqp.eap;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* An EAP Method, part of the NAI Realm ANQP element, specified in
|
||||
* IEEE802.11-2012 section 8.4.4.10, figure 8-420
|
||||
*/
|
||||
public class EAPMethod {
|
||||
private final EAP.EAPMethodID mEAPMethodID;
|
||||
private final Map<EAP.AuthInfoID, Set<AuthParam>> mAuthParams;
|
||||
|
||||
public EAPMethod(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() < 3) {
|
||||
throw new ProtocolException("Runt EAP Method: " + payload.remaining());
|
||||
}
|
||||
|
||||
int length = payload.get() & BYTE_MASK;
|
||||
int methodID = payload.get() & BYTE_MASK;
|
||||
int count = payload.get() & BYTE_MASK;
|
||||
|
||||
mEAPMethodID = EAP.mapEAPMethod(methodID);
|
||||
mAuthParams = new EnumMap<EAP.AuthInfoID, Set<AuthParam>>(EAP.AuthInfoID.class);
|
||||
|
||||
int realCount = 0;
|
||||
|
||||
ByteBuffer paramPayload = payload.duplicate();
|
||||
paramPayload.limit(paramPayload.position() + length);
|
||||
payload.position(payload.position() + length);
|
||||
while (paramPayload.hasRemaining()) {
|
||||
int id = paramPayload.get() & BYTE_MASK;
|
||||
|
||||
EAP.AuthInfoID authInfoID;
|
||||
|
||||
if (id == EAP.VendorSpecific) {
|
||||
authInfoID = EAP.AuthInfoID.VendorSpecific;
|
||||
} else if (id <= EAP.AuthInfoID.TunneledEAPMethodCredType.ordinal() && id > 0) {
|
||||
authInfoID = EAP.AuthInfoID.values()[id];
|
||||
} else {
|
||||
throw new ProtocolException("Unknown auth parameter ID: " + id);
|
||||
}
|
||||
|
||||
switch (authInfoID) {
|
||||
case ExpandedEAPMethod:
|
||||
addAuthParam(new ExpandedEAPMethod(authInfoID, paramPayload));
|
||||
break;
|
||||
case NonEAPInnerAuthType:
|
||||
addAuthParam(new NonEAPInnerAuth(paramPayload));
|
||||
break;
|
||||
case InnerAuthEAPMethodType:
|
||||
addAuthParam(new InnerAuthEAP(paramPayload));
|
||||
break;
|
||||
case ExpandedInnerEAPMethod:
|
||||
addAuthParam(new ExpandedEAPMethod(authInfoID, paramPayload));
|
||||
break;
|
||||
case CredentialType:
|
||||
addAuthParam(new Credential(authInfoID, paramPayload));
|
||||
break;
|
||||
case TunneledEAPMethodCredType:
|
||||
addAuthParam(new Credential(authInfoID, paramPayload));
|
||||
break;
|
||||
case VendorSpecific:
|
||||
addAuthParam(new VendorSpecificAuth(paramPayload));
|
||||
break;
|
||||
}
|
||||
|
||||
realCount++;
|
||||
}
|
||||
if (realCount != count)
|
||||
throw new ProtocolException("Invalid parameter count: " + realCount +
|
||||
", expected " + count);
|
||||
}
|
||||
|
||||
private void addAuthParam(AuthParam param) {
|
||||
Set<AuthParam> authParams = mAuthParams.get(param.getAuthInfoID());
|
||||
if (authParams == null) {
|
||||
authParams = new HashSet<AuthParam>();
|
||||
mAuthParams.put(param.getAuthInfoID(), authParams);
|
||||
}
|
||||
authParams.add(param);
|
||||
}
|
||||
|
||||
public Map<EAP.AuthInfoID, Set<AuthParam>> getAuthParams() {
|
||||
return Collections.unmodifiableMap(mAuthParams);
|
||||
}
|
||||
|
||||
public EAP.EAPMethodID getEAPMethodID() {
|
||||
return mEAPMethodID;
|
||||
}
|
||||
|
||||
public boolean matchesAuthParams(EAPMethod other) {
|
||||
for (Map.Entry<EAP.AuthInfoID, Set<AuthParam>> entry : other.getAuthParams().entrySet()) {
|
||||
|
||||
Set<AuthParam> myParams = mAuthParams.get(entry.getKey());
|
||||
if (myParams == null)
|
||||
continue;
|
||||
|
||||
Set<AuthParam> otherParams = entry.getValue();
|
||||
|
||||
Set<AuthParam> iterationSet;
|
||||
Set<AuthParam> seekSet;
|
||||
if (myParams.size() >= otherParams.size()) {
|
||||
seekSet = myParams;
|
||||
iterationSet = otherParams;
|
||||
} else {
|
||||
seekSet = otherParams;
|
||||
iterationSet = myParams;
|
||||
}
|
||||
|
||||
for (AuthParam param : iterationSet) {
|
||||
if (seekSet.contains(param)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EAPMethod{" +
|
||||
"mEAPMethodID=" + mEAPMethodID +
|
||||
", mAuthParams=" + mAuthParams +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package android.net.wifi.anqp.eap;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.INT_MASK;
|
||||
import static android.net.wifi.anqp.Constants.getInteger;
|
||||
|
||||
/**
|
||||
* An EAP authentication parameter, IEEE802.11-2012, table 8-188
|
||||
*/
|
||||
public class ExpandedEAPMethod implements AuthParam {
|
||||
|
||||
private final EAP.AuthInfoID m_authInfoID;
|
||||
private final int m_vendorID;
|
||||
private final long m_vendorType;
|
||||
|
||||
public ExpandedEAPMethod(EAP.AuthInfoID authInfoID, ByteBuffer payload) throws ProtocolException {
|
||||
m_authInfoID = authInfoID;
|
||||
if (payload.remaining() != 7) {
|
||||
throw new ProtocolException("Bad length: " + payload.remaining());
|
||||
}
|
||||
|
||||
m_vendorID = (int) getInteger(payload, 3);
|
||||
m_vendorType = payload.getInt() & INT_MASK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EAP.AuthInfoID getAuthInfoID() {
|
||||
return m_authInfoID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (m_authInfoID.hashCode() * 31 + m_vendorID) * 31 + (int) m_vendorType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object thatObject) {
|
||||
if (thatObject == this) {
|
||||
return true;
|
||||
} else if (thatObject == null || thatObject.getClass() != ExpandedEAPMethod.class) {
|
||||
return false;
|
||||
} else {
|
||||
ExpandedEAPMethod that = (ExpandedEAPMethod) thatObject;
|
||||
return that.getVendorID() == getVendorID() && that.getVendorType() == getVendorType();
|
||||
}
|
||||
}
|
||||
|
||||
public int getVendorID() {
|
||||
return m_vendorID;
|
||||
}
|
||||
|
||||
public long getVendorType() {
|
||||
return m_vendorType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ExpandedEAPMethod{" +
|
||||
"m_authInfoID=" + m_authInfoID +
|
||||
", m_vendorID=" + m_vendorID +
|
||||
", m_vendorType=" + m_vendorType +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package android.net.wifi.anqp.eap;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* An EAP authentication parameter, IEEE802.11-2012, table 8-188
|
||||
*/
|
||||
public class InnerAuthEAP implements AuthParam {
|
||||
|
||||
private final EAP.EAPMethodID mEapMethodID;
|
||||
|
||||
public InnerAuthEAP(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() != 1) {
|
||||
throw new ProtocolException("Bad length: " + payload.remaining());
|
||||
}
|
||||
|
||||
int typeID = payload.get() & BYTE_MASK;
|
||||
mEapMethodID = EAP.mapEAPMethod(typeID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EAP.AuthInfoID getAuthInfoID() {
|
||||
return EAP.AuthInfoID.InnerAuthEAPMethodType;
|
||||
}
|
||||
|
||||
public EAP.EAPMethodID getEAPMethodID() {
|
||||
return mEapMethodID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return mEapMethodID.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object thatObject) {
|
||||
if (thatObject == this) {
|
||||
return true;
|
||||
} else if (thatObject == null || thatObject.getClass() != InnerAuthEAP.class) {
|
||||
return false;
|
||||
} else {
|
||||
return ((InnerAuthEAP) thatObject).getEAPMethodID() == getEAPMethodID();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InnerAuthEAP{" +
|
||||
"EapMethodID=" + mEapMethodID +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package android.net.wifi.anqp.eap;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* An EAP authentication parameter, IEEE802.11-2012, table 8-188
|
||||
*/
|
||||
public class NonEAPInnerAuth implements AuthParam {
|
||||
|
||||
public enum NonEAPType {Reserved, PAP, CHAP, MSCHAP, MSCHAPv2}
|
||||
|
||||
private final NonEAPType mType;
|
||||
|
||||
public NonEAPInnerAuth(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() != 1) {
|
||||
throw new ProtocolException("Bad length: " + payload.remaining());
|
||||
}
|
||||
|
||||
int typeID = payload.get() & BYTE_MASK;
|
||||
mType = typeID < NonEAPType.values().length ?
|
||||
NonEAPType.values()[typeID] :
|
||||
NonEAPType.Reserved;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EAP.AuthInfoID getAuthInfoID() {
|
||||
return EAP.AuthInfoID.NonEAPInnerAuthType;
|
||||
}
|
||||
|
||||
public NonEAPType getType() {
|
||||
return mType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return mType.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object thatObject) {
|
||||
if (thatObject == this) {
|
||||
return true;
|
||||
} else if (thatObject == null || thatObject.getClass() != NonEAPInnerAuth.class) {
|
||||
return false;
|
||||
} else {
|
||||
return ((NonEAPInnerAuth) thatObject).getType() == getType();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NonEAPInnerAuth{" +
|
||||
"mType=" + mType +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package android.net.wifi.anqp.eap;
|
||||
|
||||
import android.net.wifi.anqp.Constants;
|
||||
|
||||
import java.net.ProtocolException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.BYTE_MASK;
|
||||
|
||||
/**
|
||||
* An EAP authentication parameter, IEEE802.11-2012, table 8-188
|
||||
*/
|
||||
public class VendorSpecificAuth implements AuthParam {
|
||||
|
||||
private final byte[] mData;
|
||||
|
||||
public VendorSpecificAuth(ByteBuffer payload) throws ProtocolException {
|
||||
if (payload.remaining() < 1 || payload.remaining() > 256) {
|
||||
throw new ProtocolException("Bad length: " + payload.remaining());
|
||||
}
|
||||
|
||||
int length = payload.get() & BYTE_MASK;
|
||||
if (length > payload.remaining()) {
|
||||
throw new ProtocolException("Excessive length: " + length);
|
||||
}
|
||||
mData = new byte[length];
|
||||
payload.get(mData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EAP.AuthInfoID getAuthInfoID() {
|
||||
return EAP.AuthInfoID.VendorSpecific;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(mData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object thatObject) {
|
||||
if (thatObject == this) {
|
||||
return true;
|
||||
} else if (thatObject == null || thatObject.getClass() != VendorSpecificAuth.class) {
|
||||
return false;
|
||||
} else {
|
||||
return Arrays.equals(((VendorSpecificAuth) thatObject).getData(), getData());
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getData() {
|
||||
return mData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VendorSpecificAuth{" +
|
||||
"mData=" + Constants.toHexString(mData) +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package android.net.wifi.hotspot2;
|
||||
|
||||
import android.net.wifi.anqp.ANQPElement;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by jannq on 1/21/15.
|
||||
*/
|
||||
public class ANQPData {
|
||||
private final List<ANQPElement> mANQPElements;
|
||||
private final long mCtime;
|
||||
private volatile long mAtime;
|
||||
|
||||
public ANQPData( List<ANQPElement> ANQPElements ) {
|
||||
mANQPElements = Collections.unmodifiableList( ANQPElements );
|
||||
mCtime = System.currentTimeMillis();
|
||||
mAtime = mCtime;
|
||||
}
|
||||
|
||||
public List<ANQPElement> getANQPElements() {
|
||||
mAtime = System.currentTimeMillis();
|
||||
return mANQPElements;
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
package android.net.wifi.hotspot2;
|
||||
|
||||
import android.net.wifi.anqp.VenueNameElement;
|
||||
|
||||
/**
|
||||
* Created by jannq on 1/20/15.
|
||||
*/
|
||||
public class NetworkInfo {
|
||||
|
||||
public enum Ant {
|
||||
Private,
|
||||
PrivateWithGuest,
|
||||
ChargeablePublic,
|
||||
FreePublic,
|
||||
Personal,
|
||||
EmergencyOnly,
|
||||
TestOrExperimental,
|
||||
Wildcard
|
||||
}
|
||||
|
||||
public enum HSRelease {
|
||||
R1,
|
||||
R2,
|
||||
Unknown
|
||||
}
|
||||
|
||||
// General identifiers:
|
||||
private final String mSSID;
|
||||
private final String mHESSID;
|
||||
private final long mBSSID;
|
||||
|
||||
// BSS Load element:
|
||||
private final int mStationCount;
|
||||
private final int mChannelUtilization;
|
||||
private final int mCapacity;
|
||||
|
||||
/*
|
||||
* From Interworking element:
|
||||
* mAnt non null indicates the presence of Interworking, i.e. 802.11u
|
||||
* mVenueGroup and mVenueType may be null if not present in the Interworking element.
|
||||
*/
|
||||
private final Ant mAnt;
|
||||
private final boolean mInternet;
|
||||
private final VenueNameElement.VenueGroup mVenueGroup;
|
||||
private final VenueNameElement.VenueType mVenueType;
|
||||
|
||||
/*
|
||||
* From HS20 Indication element:
|
||||
* mHSRelease is null only if the HS20 Indication element was not present.
|
||||
* mAnqpDomainID is set to -1 if not present in the element.
|
||||
*/
|
||||
private final HSRelease mHSRelease;
|
||||
private final int mAnqpDomainID;
|
||||
|
||||
/*
|
||||
* From beacon:
|
||||
* mRoamingConsortiums is either null, if the element was not present, or is an array of
|
||||
* 1, 2 or 3 longs in which the roaming consortium values occupy the LSBs.
|
||||
*/
|
||||
private final long[] mRoamingConsortiums;
|
||||
|
||||
public NetworkInfo(String SSID,
|
||||
String HESSID,
|
||||
long BSSID,
|
||||
int stationCount,
|
||||
int channelUtilization,
|
||||
int capacity,
|
||||
Ant ant,
|
||||
boolean internet,
|
||||
VenueNameElement.VenueGroup venueGroup,
|
||||
VenueNameElement.VenueType venueType,
|
||||
HSRelease HSRelease,
|
||||
int anqpDomainID,
|
||||
long[] roamingConsortiums) {
|
||||
mSSID = SSID;
|
||||
mHESSID = HESSID;
|
||||
mBSSID = BSSID;
|
||||
mStationCount = stationCount;
|
||||
mChannelUtilization = channelUtilization;
|
||||
mCapacity = capacity;
|
||||
mAnt = ant;
|
||||
mInternet = internet;
|
||||
mVenueGroup = venueGroup;
|
||||
mVenueType = venueType;
|
||||
mHSRelease = HSRelease;
|
||||
mAnqpDomainID = anqpDomainID;
|
||||
mRoamingConsortiums = roamingConsortiums;
|
||||
}
|
||||
|
||||
public String getSSID() {
|
||||
return mSSID;
|
||||
}
|
||||
|
||||
public String getHESSID() {
|
||||
return mHESSID;
|
||||
}
|
||||
|
||||
public long getBSSID() {
|
||||
return mBSSID;
|
||||
}
|
||||
|
||||
public int getStationCount() {
|
||||
return mStationCount;
|
||||
}
|
||||
|
||||
public int getChannelUtilization() {
|
||||
return mChannelUtilization;
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
return mCapacity;
|
||||
}
|
||||
|
||||
public Ant getAnt() {
|
||||
return mAnt;
|
||||
}
|
||||
|
||||
public boolean isInternet() {
|
||||
return mInternet;
|
||||
}
|
||||
|
||||
public VenueNameElement.VenueGroup getVenueGroup() {
|
||||
return mVenueGroup;
|
||||
}
|
||||
|
||||
public VenueNameElement.VenueType getVenueType() {
|
||||
return mVenueType;
|
||||
}
|
||||
|
||||
public HSRelease getHSRelease() {
|
||||
return mHSRelease;
|
||||
}
|
||||
|
||||
public int getAnqpDomainID() {
|
||||
return mAnqpDomainID;
|
||||
}
|
||||
|
||||
public long[] getRoamingConsortiums() {
|
||||
return mRoamingConsortiums;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package android.net.wifi.hotspot2;
|
||||
|
||||
/**
|
||||
* Created by jannq on 1/20/15.
|
||||
*/
|
||||
public class NetworkKey {
|
||||
private final String mSSID;
|
||||
private final long mBSSID;
|
||||
private final int mANQPDomainID;
|
||||
|
||||
public NetworkKey(String SSID, long BSSID, int ANQPDomainID) {
|
||||
mSSID = SSID;
|
||||
mBSSID = BSSID;
|
||||
mANQPDomainID = ANQPDomainID;
|
||||
}
|
||||
|
||||
public String getSSID() {
|
||||
return mSSID;
|
||||
}
|
||||
|
||||
public long getBSSID() {
|
||||
return mBSSID;
|
||||
}
|
||||
|
||||
public int getANQPDomainID() {
|
||||
return mANQPDomainID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
NetworkKey that = (NetworkKey) o;
|
||||
|
||||
if (mANQPDomainID != that.mANQPDomainID) return false;
|
||||
if (mBSSID != that.mBSSID) return false;
|
||||
if (!mSSID.equals(that.mSSID)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = mSSID.hashCode();
|
||||
result = 31 * result + (int) (mBSSID ^ (mBSSID >>> 32));
|
||||
result = 31 * result + mANQPDomainID;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package android.net.wifi.hotspot2;
|
||||
|
||||
/**
|
||||
* Created by jannq on 1/21/15.
|
||||
*/
|
||||
public enum PasspointMatch {
|
||||
HomeProvider,
|
||||
RoamingProvider,
|
||||
Incomplete,
|
||||
None,
|
||||
Declined
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
package android.net.wifi.hotspot2;
|
||||
|
||||
import android.net.wifi.anqp.ANQPElement;
|
||||
import android.net.wifi.hotspot2.pps.HomeSP;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by jannq on 1/20/15.
|
||||
*/
|
||||
public class SelectionManager {
|
||||
private final List<HomeSP> mHomeSPs;
|
||||
private final Map<NetworkKey,ANQPData> mANQPCache;
|
||||
private final Map<NetworkKey,NetworkInfo> mPendingANQP;
|
||||
private final List<ScoredNetwork> mScoredNetworks;
|
||||
|
||||
private static class ScoredNetwork implements Comparable<ScoredNetwork> {
|
||||
private final PasspointMatch mMatch;
|
||||
private final NetworkInfo mNetworkInfo;
|
||||
|
||||
private ScoredNetwork(PasspointMatch match, NetworkInfo networkInfo) {
|
||||
mMatch = match;
|
||||
mNetworkInfo = networkInfo;
|
||||
// !!! Further score on BSS Load, ANT, "Internet" and HSRelease
|
||||
}
|
||||
|
||||
public PasspointMatch getMatch() {
|
||||
return mMatch;
|
||||
}
|
||||
|
||||
public NetworkInfo getNetworkInfo() {
|
||||
return mNetworkInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( ScoredNetwork other ) {
|
||||
if ( getMatch() == other.getMatch() ) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return getMatch().ordinal() > other.getMatch().ordinal() ? 1 : -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SelectionManager( List<HomeSP> homeSPs ) {
|
||||
mHomeSPs = homeSPs;
|
||||
mANQPCache = new HashMap<NetworkKey,ANQPData>();
|
||||
mPendingANQP = new HashMap<NetworkKey, NetworkInfo>();
|
||||
mScoredNetworks = new ArrayList<ScoredNetwork>();
|
||||
}
|
||||
|
||||
public NetworkInfo findNetwork( NetworkInfo networkInfo ) {
|
||||
|
||||
NetworkKey networkKey = new NetworkKey( networkInfo.getSSID(), networkInfo.getBSSID(), networkInfo.getAnqpDomainID() );
|
||||
ANQPData anqpData = mANQPCache.get( networkKey );
|
||||
List<ANQPElement> anqpElements = anqpData != null ? anqpData.getANQPElements() : null;
|
||||
for ( HomeSP homeSP : mHomeSPs ) {
|
||||
PasspointMatch match = homeSP.match( networkInfo, anqpElements );
|
||||
if ( match == PasspointMatch.HomeProvider || match == PasspointMatch.RoamingProvider ) {
|
||||
mScoredNetworks.add( new ScoredNetwork( match, networkInfo ) );
|
||||
}
|
||||
else if ( match == PasspointMatch.Incomplete && networkInfo.getAnt() != null ) {
|
||||
mPendingANQP.put(networkKey, networkInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// !!! Should really return a score-sorted list.
|
||||
Collections.sort( mScoredNetworks );
|
||||
if ( ! mScoredNetworks.isEmpty() &&
|
||||
mScoredNetworks.get( 0 ).getMatch() == PasspointMatch.HomeProvider ) {
|
||||
return mScoredNetworks.get( 0 ).getNetworkInfo();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyANQPResponse( NetworkInfo networkInfo, List<ANQPElement> anqpElements ) {
|
||||
NetworkKey networkKey = new NetworkKey( networkInfo.getSSID(), networkInfo.getBSSID(), networkInfo.getAnqpDomainID() );
|
||||
mPendingANQP.remove( networkKey );
|
||||
mANQPCache.put( networkKey, new ANQPData( anqpElements ) );
|
||||
|
||||
for ( HomeSP homeSP : mHomeSPs ) {
|
||||
PasspointMatch match = homeSP.match( networkInfo, anqpElements );
|
||||
if ( match == PasspointMatch.HomeProvider || match == PasspointMatch.RoamingProvider ) {
|
||||
mScoredNetworks.add( new ScoredNetwork( match, networkInfo ) );
|
||||
}
|
||||
else if ( match == PasspointMatch.Declined ) {
|
||||
Iterator<ScoredNetwork> scoredNetworkIterator = mScoredNetworks.iterator();
|
||||
while ( scoredNetworkIterator.hasNext() ) {
|
||||
ScoredNetwork scoredNetwork = scoredNetworkIterator.next();
|
||||
if ( scoredNetwork.getNetworkInfo().getBSSID() == networkInfo.getBSSID() &&
|
||||
scoredNetwork.getNetworkInfo().getSSID().equals( networkInfo.getSSID() ) ) {
|
||||
scoredNetworkIterator.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort( mScoredNetworks );
|
||||
if ( ! mScoredNetworks.isEmpty() &&
|
||||
mScoredNetworks.get( 0 ).getMatch() == PasspointMatch.HomeProvider ) {
|
||||
// Kill mPendingANQP?
|
||||
// Connect to mScoredNetworks.get( 0 ).getNetworkInfo()?
|
||||
}
|
||||
}
|
||||
|
||||
private void sendANQPQuery( NetworkInfo network ) {
|
||||
if ( network.getHSRelease() != null ) {
|
||||
// Query for 802.11u + potential HS2.0 elements
|
||||
}
|
||||
else if ( network.getAnt() != null ) {
|
||||
// !!! Query for 802.11u
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package android.net.wifi.hotspot2.pps;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by jannq on 1/21/15.
|
||||
*/
|
||||
public class DomainMatcher {
|
||||
|
||||
public enum Match { None, Primary, Secondary }
|
||||
|
||||
private final Label mRoot;
|
||||
|
||||
private static class Label {
|
||||
private final Map<String,Label> mSubDomains;
|
||||
private final Match mMatch;
|
||||
|
||||
private Label( Match match ) {
|
||||
mMatch = match;
|
||||
mSubDomains = match == Match.None ? null : new HashMap<String,Label>();
|
||||
}
|
||||
|
||||
private void addDomain( Iterator<String> labels, Match match ) {
|
||||
String labelName = labels.next();
|
||||
if ( labels.hasNext() ) {
|
||||
Label subLabel = new Label( Match.None );
|
||||
mSubDomains.put( labelName, subLabel );
|
||||
subLabel.addDomain( labels, match );
|
||||
}
|
||||
else {
|
||||
mSubDomains.put( labelName, new Label( match ) );
|
||||
}
|
||||
}
|
||||
|
||||
private Label getSubLabel( String labelString ) {
|
||||
return mSubDomains.get( labelString );
|
||||
}
|
||||
|
||||
public Match getMatch() {
|
||||
return mMatch;
|
||||
}
|
||||
}
|
||||
|
||||
public DomainMatcher( List<String> primary, List<List<String>> secondary ) {
|
||||
mRoot = new Label( Match.None );
|
||||
for ( List<String> secondaryLabel : secondary ) {
|
||||
mRoot.addDomain( secondaryLabel.iterator(), Match.Secondary );
|
||||
}
|
||||
// Primary overwrites secondary.
|
||||
mRoot.addDomain( primary.iterator(), Match.Primary );
|
||||
}
|
||||
|
||||
public Match isSubDomain( List<String> domain ) {
|
||||
|
||||
Label label = mRoot;
|
||||
for ( String labelString : domain ) {
|
||||
label = label.getSubLabel( labelString );
|
||||
if ( label == null ) {
|
||||
return Match.None;
|
||||
}
|
||||
else if ( label.getMatch() != Match.None ) {
|
||||
return label.getMatch();
|
||||
}
|
||||
}
|
||||
return Match.None; // Domain is a super domain
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
package android.net.wifi.hotspot2.pps;
|
||||
|
||||
import android.net.wifi.anqp.ANQPElement;
|
||||
import android.net.wifi.anqp.DomainNameElement;
|
||||
import android.net.wifi.anqp.HSConnectionCapabilityElement;
|
||||
import android.net.wifi.anqp.HSWanMetricsElement;
|
||||
import android.net.wifi.anqp.IPAddressTypeAvailabilityElement;
|
||||
import android.net.wifi.anqp.NAIRealmData;
|
||||
import android.net.wifi.anqp.NAIRealmElement;
|
||||
import android.net.wifi.anqp.RoamingConsortiumElement;
|
||||
import android.net.wifi.anqp.ThreeGPPNetworkElement;
|
||||
import android.net.wifi.anqp.eap.EAP;
|
||||
import android.net.wifi.anqp.eap.EAPMethod;
|
||||
import android.net.wifi.hotspot2.NetworkInfo;
|
||||
import android.net.wifi.hotspot2.PasspointMatch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static android.net.wifi.anqp.Constants.ANQPElementType;
|
||||
|
||||
/**
|
||||
* Created by jannq on 1/20/15.
|
||||
*/
|
||||
public class HomeSP {
|
||||
private final Map<String, String> mSSIDs; // SSID, HESSID, [0,N]
|
||||
private final DomainMatcher mDomainMatcher;
|
||||
private final Set<Long> mRoamingConsortiums; // [0,N]
|
||||
private final Set<Long> mMatchAnyOIs; // [0,N]
|
||||
private final List<Long> mMatchAllOIs; // [0,N]
|
||||
|
||||
private final Map<EAP.EAPMethodID, EAPMethod> mCredentials;
|
||||
|
||||
// Informational:
|
||||
private final String mFriendlyName; // [1]
|
||||
private final String mIconURL; // [0,1]
|
||||
|
||||
public HomeSP(Map<String, String> ssidMap,
|
||||
/*@NotNull*/ String fqdn,
|
||||
/*@NotNull*/ Set<Long> roamingConsortiums,
|
||||
/*@NotNull*/ Set<String> otherHomePartners,
|
||||
/*@NotNull*/ Set<Long> matchAnyOIs,
|
||||
/*@NotNull*/ List<Long> matchAllOIs,
|
||||
String friendlyName,
|
||||
String iconURL,
|
||||
Map<EAP.EAPMethodID, EAPMethod> credentials) {
|
||||
|
||||
mSSIDs = ssidMap;
|
||||
List<List<String>> otherPartners = new ArrayList<List<String>>(otherHomePartners.size());
|
||||
for (String otherPartner : otherHomePartners) {
|
||||
otherPartners.add(splitDomain(otherPartner));
|
||||
}
|
||||
mDomainMatcher = new DomainMatcher(splitDomain(fqdn), otherPartners);
|
||||
mRoamingConsortiums = roamingConsortiums;
|
||||
mMatchAnyOIs = matchAnyOIs;
|
||||
mMatchAllOIs = matchAllOIs;
|
||||
mFriendlyName = friendlyName;
|
||||
mIconURL = iconURL;
|
||||
mCredentials = credentials;
|
||||
}
|
||||
|
||||
public PasspointMatch match(NetworkInfo networkInfo, List<ANQPElement> anqpElements) {
|
||||
|
||||
if (mSSIDs.containsKey(networkInfo.getSSID())) {
|
||||
String hessid = mSSIDs.get(networkInfo.getSSID());
|
||||
if (hessid == null || networkInfo.getHESSID().equals(hessid)) {
|
||||
return PasspointMatch.HomeProvider;
|
||||
}
|
||||
}
|
||||
|
||||
List<Long> allOIs = null;
|
||||
|
||||
if (networkInfo.getRoamingConsortiums() != null) {
|
||||
allOIs = new ArrayList<Long>();
|
||||
for (long oi : networkInfo.getRoamingConsortiums()) {
|
||||
allOIs.add(oi);
|
||||
}
|
||||
}
|
||||
|
||||
Map<ANQPElementType, ANQPElement> anqpElementMap = null;
|
||||
|
||||
if (anqpElements != null) {
|
||||
anqpElementMap = new EnumMap<ANQPElementType, ANQPElement>(ANQPElementType.class);
|
||||
for (ANQPElement element : anqpElements) {
|
||||
anqpElementMap.put(element.getID(), element);
|
||||
if (element.getID() == ANQPElementType.ANQPRoamingConsortium) {
|
||||
RoamingConsortiumElement rcElement = (RoamingConsortiumElement) element;
|
||||
if (!rcElement.getOIs().isEmpty()) {
|
||||
if (allOIs == null) {
|
||||
allOIs = new ArrayList<Long>(rcElement.getOIs());
|
||||
} else {
|
||||
allOIs.addAll(rcElement.getOIs());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allOIs != null) {
|
||||
if (!mRoamingConsortiums.isEmpty()) {
|
||||
for (long oi : allOIs) {
|
||||
if (mRoamingConsortiums.contains(oi)) {
|
||||
return PasspointMatch.HomeProvider;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!mMatchAnyOIs.isEmpty() || !mMatchAllOIs.isEmpty()) {
|
||||
for (long anOI : allOIs) {
|
||||
|
||||
boolean oneMatchesAll = true;
|
||||
|
||||
for (long spOI : mMatchAllOIs) {
|
||||
if (spOI != anOI) {
|
||||
oneMatchesAll = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (oneMatchesAll) {
|
||||
return PasspointMatch.HomeProvider;
|
||||
}
|
||||
|
||||
if (mMatchAnyOIs.contains(anOI)) {
|
||||
return PasspointMatch.HomeProvider;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (anqpElementMap == null) {
|
||||
return PasspointMatch.Incomplete;
|
||||
}
|
||||
|
||||
DomainNameElement domainNameElement =
|
||||
(DomainNameElement) anqpElementMap.get(ANQPElementType.ANQPDomName);
|
||||
NAIRealmElement naiRealmElement =
|
||||
(NAIRealmElement) anqpElementMap.get(ANQPElementType.ANQPNAIRealm);
|
||||
ThreeGPPNetworkElement threeGPPNetworkElement =
|
||||
(ThreeGPPNetworkElement) anqpElementMap.get(ANQPElementType.ANQP3GPPNetwork);
|
||||
|
||||
// For future policy decisions:
|
||||
IPAddressTypeAvailabilityElement ipAddressAvailabilityElement =
|
||||
(IPAddressTypeAvailabilityElement) anqpElementMap.get(
|
||||
ANQPElementType.ANQPIPAddrAvailability);
|
||||
HSConnectionCapabilityElement hsConnCapElement =
|
||||
(HSConnectionCapabilityElement) anqpElementMap.get(
|
||||
ANQPElementType.HSConnCapability);
|
||||
HSWanMetricsElement hsWanMetricsElement =
|
||||
(HSWanMetricsElement) anqpElementMap.get(ANQPElementType.HSWANMetrics);
|
||||
|
||||
if (domainNameElement != null) {
|
||||
for (String domain : domainNameElement.getDomains()) {
|
||||
DomainMatcher.Match match = mDomainMatcher.isSubDomain(splitDomain(domain));
|
||||
if (match != DomainMatcher.Match.None) {
|
||||
return PasspointMatch.HomeProvider;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ( threeGPPNetworkElement != null ) {
|
||||
!!! Insert matching based on 3GPP credentials here
|
||||
}
|
||||
*/
|
||||
|
||||
if (naiRealmElement != null) {
|
||||
|
||||
for (NAIRealmData naiRealmData : naiRealmElement.getRealmData()) {
|
||||
|
||||
DomainMatcher.Match match = DomainMatcher.Match.None;
|
||||
for (String anRealm : naiRealmData.getRealms()) {
|
||||
match = mDomainMatcher.isSubDomain(splitDomain(anRealm));
|
||||
if (match != DomainMatcher.Match.None) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match != DomainMatcher.Match.None) {
|
||||
if (mCredentials == null) {
|
||||
return PasspointMatch.RoamingProvider;
|
||||
} else {
|
||||
for (EAPMethod anMethod : naiRealmData.getEAPMethods()) {
|
||||
EAPMethod spMethod = mCredentials.get(anMethod.getEAPMethodID());
|
||||
if (spMethod.matchesAuthParams(anMethod)) {
|
||||
return PasspointMatch.RoamingProvider;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return PasspointMatch.None;
|
||||
}
|
||||
|
||||
private static List<String> splitDomain(String domain) {
|
||||
|
||||
if (domain.endsWith("."))
|
||||
domain = domain.substring(0, domain.length() - 1);
|
||||
int at = domain.indexOf('@');
|
||||
if (at >= 0)
|
||||
domain = domain.substring(at + 1);
|
||||
|
||||
String[] labels = domain.split("\\.");
|
||||
LinkedList<String> labelList = new LinkedList<String>();
|
||||
for (String label : labels) {
|
||||
labelList.addFirst(label);
|
||||
}
|
||||
|
||||
return labelList;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user