1// 2// Copyright (C) 2013 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17#include "shill/tethering.h" 18 19#include <base/macros.h> 20 21using std::set; 22using std::vector; 23 24namespace shill { 25 26// static 27const char Tethering::kAndroidVendorEncapsulatedOptions[] = "ANDROID_METERED"; 28const uint8_t Tethering::kAndroidBSSIDPrefix[] = {0x02, 0x1a, 0x11}; 29const uint32_t Tethering::kIosOui = 0x0017f2; 30const uint8_t Tethering::kLocallyAdministratedMACBit = 0x02; 31 32// static 33bool Tethering::IsAndroidBSSID(const vector<uint8_t>& bssid) { 34 vector<uint8_t> truncated_bssid = bssid; 35 truncated_bssid.resize(arraysize(kAndroidBSSIDPrefix)); 36 return truncated_bssid == vector<uint8_t>( 37 kAndroidBSSIDPrefix, 38 kAndroidBSSIDPrefix + arraysize(kAndroidBSSIDPrefix)); 39} 40 41// static 42bool Tethering::IsLocallyAdministeredBSSID(const vector<uint8_t>& bssid) { 43 return bssid.size() > 0 && (bssid[0] & kLocallyAdministratedMACBit); 44} 45 46// static 47bool Tethering::HasIosOui(const set<uint32_t>& oui_set) { 48 return oui_set.find(kIosOui) != oui_set.end(); 49} 50 51} // namespace shill 52