blob: 80d9b72d4eaabd9fb93f967ac2455240ddf285b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package com.android.server.wifi.anqp;
import com.android.server.wifi.hotspot2.Utils;
import java.net.ProtocolException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static com.android.server.wifi.anqp.Constants.BYTE_MASK;
import static com.android.server.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, ByteOrder.BIG_ENDIAN, length));
}
}
public List<Long> getOIs() {
return Collections.unmodifiableList(mOis);
}
@Override
public String toString() {
return "RoamingConsortium{mOis=[" + Utils.roamingConsortiumsToString(mOis) + "]}";
}
}
|