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