Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / geolocation / osx_wifi.h
blobcef998b91d955f1605cc55adfbe39a3703848105
1 // Copyright (c) 2012 The Chromium 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.
5 // The remainder of this file is copied from the Gears project:
6 // http://code.google.com/p/gears/source/browse/trunk/gears/geolocation/osx_wifi.h
8 // The contents of this file are taken from Apple80211.h from the iStumbler
9 // project (http://www.istumbler.net). This project is released under the BSD
10 // license with the following restrictions.
12 // Copyright (c) 02006, Alf Watt (alf@istumbler.net). All rights reserved.
14 // Redistribution and use in source and binary forms, with or without
15 // modification, are permitted provided that the following conditions
16 // are met:
18 // * Redistributions of source code must retain the above copyright
19 // notice, this list of conditions and the following disclaimer.
21 // * Redistributions in binary form must reproduce the above copyright
22 // notice, this list of conditions and the following disclaimer in the
23 // documentation and/or other materials provided with the distribution.
25 // * Neither the name of iStumbler nor the names of its contributors may be
26 // used to endorse or promote products derived from this software without
27 // specific prior written permission.
29 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
30 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
31 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
32 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
33 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
34 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
35 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
36 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
37 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 // This is the reverse engineered header for the Apple80211 private framework.
42 // The framework can be found at
43 // /System/Library/PrivateFrameworks/Apple80211.framework.
45 #ifndef CONTENT_BROWSER_GEOLOCATION_OSX_WIFI_H_
46 #define CONTENT_BROWSER_GEOLOCATION_OSX_WIFI_H_
48 #include <CoreFoundation/CoreFoundation.h>
50 extern "C" {
52 typedef SInt32 WIErr;
54 // A WirelessContext should be created using WirelessAttach
55 // before any other Wireless functions are called. WirelessDetach
56 // is used to dispose of a WirelessContext.
57 struct WirelessContext;
59 // WirelessAttach
61 // This should be called before all other wireless functions.
62 typedef WIErr (*WirelessAttachFunction)(WirelessContext** outContext,
63 const UInt32);
65 // WirelessDetach
67 // This should be called after all other wireless functions.
68 typedef WIErr (*WirelessDetachFunction)(WirelessContext* inContext);
70 typedef UInt16 WINetworkInfoFlags;
72 struct WirelessNetworkInfo
74 UInt16 channel; // Channel for the network.
75 SInt16 noise; // Noise for the network. 0 for Adhoc.
76 SInt16 signal; // Signal strength of the network. 0 for Adhoc.
77 UInt8 macAddress[6]; // MAC address of the wireless access point.
78 UInt16 beaconInterval; // Beacon interval in milliseconds
79 WINetworkInfoFlags flags; // Flags for the network
80 UInt16 nameLen;
81 SInt8 name[32];
84 // WirelessScanSplit
86 // WirelessScanSplit scans for available wireless networks. It will allocate 2
87 // CFArrays to store a list of managed and adhoc networks. The arrays hold
88 // CFData objects which contain WirelessNetworkInfo structures.
90 // Note: An adhoc network created on the computer the scan is running on will
91 // not be found. WirelessGetInfo can be used to find info about a local adhoc
92 // network.
94 // If stripDups != 0 only one bases tation for each SSID will be returned.
95 typedef WIErr (*WirelessScanSplitFunction)(WirelessContext* inContext,
96 CFArrayRef* apList,
97 CFArrayRef* adhocList,
98 const UInt32 stripDups);
100 } // extern "C"
102 #endif // CONTENT_BROWSER_GEOLOCATION_OSX_WIFI_H_