• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef SHILL_TETHERING_H_
18 #define SHILL_TETHERING_H_
19 
20 #include <stdint.h>
21 
22 #include <set>
23 #include <vector>
24 
25 namespace shill {
26 
27 class Tethering {
28  public:
29   // Modern Android phones in tethering mode provide DHCP option 43 even
30   // without a DHCP client requesting it.  The constant below is the value
31   // that it provides for this propery.
32   static const char kAndroidVendorEncapsulatedOptions[];
33 
34   // This 802.11 BSS prefix is provided by many Android-based devices.
35   static const uint8_t kAndroidBSSIDPrefix[];
36 
37   // This OUI is provided in 802.11 vendor IEs by many IOS devices in
38   // tethering mode.
39   static const uint32_t kIosOui;
40 
41   // This bit, if set in the first octet of a MAC address, indicates that
42   // this address is not assigned by the IEEE, but was generated locally.
43   static const uint8_t kLocallyAdministratedMACBit;
44 
45   // Returns whether an 802.11 BSSID is likely to be owned by an Android device.
46   static bool IsAndroidBSSID(const std::vector<uint8_t>& bssid);
47 
48   // Returns whether an 802.11 BSSID is a locally-administered address, as
49   // opposed to a unique IEEE-issued address.
50   static bool IsLocallyAdministeredBSSID(const std::vector<uint8_t>& bssid);
51 
52   // Returns whether any of the organizationally unique identifiers in
53   // |oui_set| is commonly associated with IOS devices.
54   static bool HasIosOui(const std::set<uint32_t>& oui_set);
55 };
56 
57 }  // namespace shill
58 
59 #endif  // SHILL_TETHERING_H_
60