shill: Service: Provide "Tethering" property

Present a service property that indicates whether the service's
connectivity is likely to be provided via a cellular backhaul.

BUG=chromium:323010
TEST=Unit tests; autotest at https://chromium-review.googlesource.com/178577
Manual: list-services with both an iPhone and Nexus in tethering mode.  Note
that both are listed with "Tethering: Suspected".  After connecting to the
Android phone, the "list-services" shows "Tethering: Confirmed".
CQ-DEPEND=CL:178563

Change-Id: Iefde3a71008a0a3d7e452d740cfa3bbb610b502b
Reviewed-on: https://chromium-review.googlesource.com/178575
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
diff --git a/tethering.h b/tethering.h
new file mode 100644
index 0000000..b35df95
--- /dev/null
+++ b/tethering.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_TETHERING_H_
+#define SHILL_TETHERING_H_
+
+#include <set>
+#include <vector>
+
+#include <base/basictypes.h>
+
+namespace shill {
+
+class Tethering {
+ public:
+  // Modern Android phones in tethering mode provide DHCP option 43 even
+  // without a DHCP client requesting it.  The constant below is the value
+  // that it provides for this propery.
+  static const char kAndroidVendorEncapsulatedOptions[];
+
+  // This 802.11 BSS prefix is provided by many Android-based devices.
+  static const uint8_t kAndroidBSSIDPrefix[];
+
+  // This OUI is provided in 802.11 vendor IEs by many IOS devices in
+  // tethering mode.
+  static const uint32_t kIosOui;
+
+  // This bit, if set in the first octet of a MAC address, indicates that
+  // this address is not assigned by the IEEE, but was generated locally.
+  static const uint8_t kLocallyAdministratedMACBit;
+
+  // Returns whether an 802.11 BSSID is likely to be owned by an Android device.
+  static bool IsAndroidBSSID(const std::vector<uint8_t> &bssid);
+
+  // Returns whether an 802.11 BSSID is a locally-administered address, as
+  // opposed to a unique IEEE-issued address.
+  static bool IsLocallyAdministeredBSSID(const std::vector<uint8_t> &bssid);
+
+  // Returns whether any of the organizationally unique identifiers in
+  // |oui_set| is commonly associated with IOS devices.
+  static bool HasIosOui(const std::set<uint32_t> &oui_set);
+};
+
+}  // namespace shill
+
+#endif  // SHILL_TETHERING_H_