blob: e4b47996352013b4246f4ff04e1382e29f4242ff [file] [log] [blame]
Paul Stewartfa11e282013-12-02 22:04:25 -08001// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "shill/tethering.h"
6
7using std::set;
8using std::vector;
9
10namespace shill {
11
12// static
13const char Tethering::kAndroidVendorEncapsulatedOptions[] =
14 "ANDROID_METERED";
15const uint8_t Tethering::kAndroidBSSIDPrefix[] = { 0x02, 0x1a, 0x11 };
16const uint32_t Tethering::kIosOui = 0x0017f2;
17const uint8_t Tethering::kLocallyAdministratedMACBit = 0x02;
18
19// static
20bool Tethering::IsAndroidBSSID(const vector<uint8_t> &bssid) {
21 vector<uint8_t> truncated_bssid = bssid;
22 truncated_bssid.resize(arraysize(kAndroidBSSIDPrefix));
23 return truncated_bssid == vector<uint8_t>(
24 kAndroidBSSIDPrefix,
25 kAndroidBSSIDPrefix + arraysize(kAndroidBSSIDPrefix));
26}
27
28// static
29bool Tethering::IsLocallyAdministeredBSSID(const vector<uint8_t> &bssid) {
30 return bssid.size() > 0 && (bssid[0] & kLocallyAdministratedMACBit);
31}
32
33// static
34bool Tethering::HasIosOui(const set<uint32_t> &oui_set) {
35 return oui_set.find(kIosOui) != oui_set.end();
36}
37
38} // namespace shill