Paul Stewart | fa11e28 | 2013-12-02 22:04:25 -0800 | [diff] [blame^] | 1 | // 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 | |
| 7 | using std::set; |
| 8 | using std::vector; |
| 9 | |
| 10 | namespace shill { |
| 11 | |
| 12 | // static |
| 13 | const char Tethering::kAndroidVendorEncapsulatedOptions[] = |
| 14 | "ANDROID_METERED"; |
| 15 | const uint8_t Tethering::kAndroidBSSIDPrefix[] = { 0x02, 0x1a, 0x11 }; |
| 16 | const uint32_t Tethering::kIosOui = 0x0017f2; |
| 17 | const uint8_t Tethering::kLocallyAdministratedMACBit = 0x02; |
| 18 | |
| 19 | // static |
| 20 | bool 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 |
| 29 | bool Tethering::IsLocallyAdministeredBSSID(const vector<uint8_t> &bssid) { |
| 30 | return bssid.size() > 0 && (bssid[0] & kLocallyAdministratedMACBit); |
| 31 | } |
| 32 | |
| 33 | // static |
| 34 | bool Tethering::HasIosOui(const set<uint32_t> &oui_set) { |
| 35 | return oui_set.find(kIosOui) != oui_set.end(); |
| 36 | } |
| 37 | |
| 38 | } // namespace shill |