$search
00001 #ifndef APPLE80211_H 00002 #define APPLE80211_H 00003 00004 /* 00005 * Apple80211 framework definitions 00006 * This is an undocumented interface and the definitions here are based on 00007 * information from MacStumbler (http://www.macstumbler.com/Apple80211.h) and 00008 * whatever related information can be found with google and experiments ;-). 00009 */ 00010 00011 typedef struct __WirelessRef *WirelessRef; 00012 typedef SInt32 WirelessError; 00013 #define errWirelessNoError 0 00014 00015 typedef struct WirelessInfo { 00016 UInt16 link_qual; 00017 UInt16 comms_qual; 00018 UInt16 signal; 00019 UInt16 noise; 00020 UInt16 port_stat; 00021 UInt16 client_mode; 00022 UInt16 res1; 00023 UInt16 power; 00024 UInt16 res2; 00025 UInt8 bssID[6]; 00026 UInt8 ssid[34]; 00027 } WirelessInfo; 00028 00029 typedef struct WirelessInfo2 { 00030 /* TODO - these are probably not in correct order or complete */ 00031 WirelessInfo info1; 00032 UInt8 macAddress[6]; 00033 } WirelessInfo2; 00034 00035 typedef struct WirelessNetworkInfo { 00036 UInt16 channel; 00037 UInt16 noise; 00038 UInt16 signal; 00039 UInt8 bssid[6]; 00040 UInt16 beacon_int; 00041 UInt16 capability; 00042 UInt16 ssid_len; 00043 UInt8 ssid[32]; 00044 } WirelessNetworkInfo; 00045 00046 typedef int wirelessKeyType; /* TODO */ 00047 00048 int WirelessIsAvailable(void); 00049 WirelessError WirelessAttach(WirelessRef *ref, UInt32 res); 00050 WirelessError WirelessDetach(WirelessRef ref); 00051 WirelessError WirelessPrivate(WirelessRef ref, void *in_ptr, int in_bytes, 00052 void *out_ptr, int out_bytes); 00053 WirelessError WirelessSetEnabled(WirelessRef ref, UInt8 enabled); 00054 WirelessError WirelessGetEnabled(WirelessRef ref, UInt8 *enabled); 00055 WirelessError WirelessSetPower(WirelessRef ref, UInt8 power); 00056 WirelessError WirelessGetPower(WirelessRef ref, UInt8 *power); 00057 WirelessError WirelessGetInfo(WirelessRef ref, WirelessInfo *info); 00058 WirelessError WirelessGetInfo2(WirelessRef ref, WirelessInfo2 *info); 00059 WirelessError WirelessScan(WirelessRef ref, CFArrayRef *results, 00060 UInt32 strip_dups); 00061 WirelessError WirelessScanSplit(WirelessRef ref, CFArrayRef *ap_results, 00062 CFArrayRef *ibss_results, UInt32 strip_dups); 00063 WirelessError WirelessDirectedScan(WirelessRef ref, CFArrayRef *results, 00064 UInt32 strip_dups, CFStringRef ssid); 00065 WirelessError WirelessDirectedScan2(WirelessRef ref, CFDataRef ssid, 00066 UInt32 strip_dups, CFArrayRef *results); 00067 WirelessError WirelessJoin(WirelessRef ref, CFStringRef ssid); 00068 WirelessError WirelessJoinWEP(WirelessRef ref, CFStringRef ssid, 00069 CFStringRef passwd); 00070 WirelessError WirelessJoin8021x(WirelessRef ref, CFStringRef ssid); 00071 /* 00072 * Set WEP key 00073 * ref: wireless reference from WirelessAttach() 00074 * type: ? 00075 * key_idx: 0..3 00076 * key_len: 13 for WEP-104 or 0 for clearing the key 00077 * key: Pointer to the key or %NULL if key_len = 0 00078 */ 00079 WirelessError WirelessSetKey(WirelessRef ref, wirelessKeyType type, 00080 int key_idx, int key_len, 00081 const unsigned char *key); 00082 /* 00083 * Set WPA key (e.g., PMK for 4-way handshake) 00084 * ref: wireless reference from WirelessAttach() 00085 * type: 0..4; 1 = PMK 00086 * key_len: 16, 32, or 0 00087 * key: Pointer to the key or %NULL if key_len = 0 00088 */ 00089 WirelessError WirelessSetWPAKey(WirelessRef ref, wirelessKeyType type, 00090 int key_len, const unsigned char *key); 00091 WirelessError WirelessAssociate(WirelessRef ref, int type, CFDataRef ssid, 00092 CFStringRef key); 00093 WirelessError WirelessAssociate2(WirelessRef ref, CFDictionaryRef scan_res, 00094 CFStringRef key); 00095 WirelessError WirelessDisassociate(WirelessRef ref); 00096 00097 /* 00098 * Get a copy of scan results for the given SSID 00099 * The returned dictionary includes following entries: 00100 * beaconInterval: CFNumber(kCFNumberSInt32Type) 00101 * SSID: CFData buffer of the SSID 00102 * isWPA: CFNumber(kCFNumberSInt32Type); 0 = not used, 1 = WPA, -128 = WPA2 00103 * name: Name of the network (SSID string) 00104 * BSSID: CFData buffer of the BSSID 00105 * channel: CFNumber(kCFNumberSInt32Type) 00106 * signal: CFNumber(kCFNumberSInt32Type) 00107 * appleIE: CFData 00108 * WPSNOPINRequired: CFBoolean 00109 * noise: CFNumber(kCFNumberSInt32Type) 00110 * capability: CFNumber(kCFNumberSInt32Type) 00111 * uniCipher: CFArray of CFNumber(kCFNumberSInt32Type) 00112 * appleIE_Version: CFNumber(kCFNumberSInt32Type) 00113 * appleIE_Robust: CFBoolean 00114 * WPSConfigured: CFBoolean 00115 * scanWasDirected: CFBoolean 00116 * appleIE_Product: CFNumber(kCFNumberSInt32Type) 00117 * authModes: CFArray of CFNumber(kCFNumberSInt32Type) 00118 * multiCipher: CFNumber(kCFNumberSInt32Type) 00119 */ 00120 CFDictionaryRef WirelessSafeDirectedScanCopy(WirelessRef ref, CFDataRef ssid); 00121 00122 /* 00123 * Get information about the current association 00124 * The returned dictionary includes following entries: 00125 * keyData: CFData buffer of the key (e.g., 32-octet PSK) 00126 * multiCipher: CFNumber(kCFNumberSInt32Type); 0 = none, 5 = CCMP? 00127 * channel: CFNumber(kCFNumberSInt32Type) 00128 * isIBSS: CFBoolean 00129 * authMode: CFNumber(kCFNumberSInt32Type); 2 = WPA-Personal; 3 = open, 00130 * 129 = WPA2-Enterprise 00131 * isWPA: CFNumber(kCFNumberSInt32Type); 0 = not used, 1 = WPA, -128 == WPA2 00132 * SSID: CFData buffer of the SSID 00133 * cipherMode: CFNumber(kCFNumberSInt32Type); 0 = none, 4 = CCMP? 00134 */ 00135 CFDictionaryRef WirelessGetAssociationInfo(WirelessRef ref); 00136 00137 WirelessError WirelessConfigure(WirelessRef ref); 00138 00139 /* 00140 * Get ASP information 00141 * The returned dictionary includes following entries: 00142 * Version: version number (e.g., 3.0) 00143 * Channel: channel (e.g., 1) 00144 * Vendor: vendor (e.g., 2) 00145 */ 00146 CFDictionaryRef WirelessGetInfoASP(void); 00147 00148 /* 00149 * Get a copy of the interface dictionary 00150 * The returned dictionary has a key,value pairs for wireless interfaces. 00151 * The key is the interface name and the value is the driver identifier, e.g., 00152 * en1: com.apple.driver.AirPort.Atheros 00153 */ 00154 CFDictionaryRef WirelessCopyInterfaceDict(void); 00155 00156 #endif /* APPLE80211_H */