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.
4
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
7
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.
11//
12// Copyright (c) 02006, Alf Watt (alf@istumbler.net). All rights reserved.
13//
14// Redistribution and use in source and binary forms, with or without
15// modification, are permitted provided that the following conditions
16// are met:
17//
18// * Redistributions of source code must retain the above copyright
19//   notice, this list of conditions and the following disclaimer.
20//
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.
24//
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.
28//
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.
40//
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.
44
45#ifndef CONTENT_BROWSER_GEOLOCATION_OSX_WIFI_H_
46#define CONTENT_BROWSER_GEOLOCATION_OSX_WIFI_H_
47
48#include <CoreFoundation/CoreFoundation.h>
49
50extern "C" {
51
52typedef SInt32 WIErr;
53
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.
57struct WirelessContext;
58
59// WirelessAttach
60//
61// This should be called before all other wireless functions.
62typedef WIErr (*WirelessAttachFunction)(WirelessContext** outContext,
63                                        const UInt32);
64
65// WirelessDetach
66//
67// This should be called after all other wireless functions.
68typedef WIErr (*WirelessDetachFunction)(WirelessContext* inContext);
69
70typedef UInt16 WINetworkInfoFlags;
71
72struct WirelessNetworkInfo
73{
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];
82};
83
84// WirelessScanSplit
85//
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.
89//
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.
93//
94// If stripDups != 0 only one bases tation for each SSID will be returned.
95typedef WIErr (*WirelessScanSplitFunction)(WirelessContext* inContext,
96                                           CFArrayRef* apList,
97                                           CFArrayRef* adhocList,
98                                           const UInt32 stripDups);
99
100}  // extern "C"
101
102#endif  // CONTENT_BROWSER_GEOLOCATION_OSX_WIFI_H_
103