Apple80211 private framework

Mat Caughron <[email protected]> Fri, 26 Jul 2002 16:23:52 -0500 (CDT)
Newsgroups gmane.network.wireless.bsd.airtools
Message-ID <[email protected]>
dachb0dens all:

I apologize if this is not 100% on-topic.

Ran across this recently and thought it might come in handy for you folks
who are were looking into dstumbler functionality on OSX.




Mat




/*
 *  Apple80211.h
 *
 *  This is the reverse engineered header for the Apple80211 private framework.
 *  The framework can be found at /System/Library/PrivateFrameworks/Apple80211.framework.
 *  Linking with Apple80211.framework requires CoreFoundation.framework and AppKit.framework.
 *
 *  Note that there is also information in the IORegistry, see
 *   ioreg -c AirPortDriver -w 0
 *
 *  Contributors:
 *  korben - [email protected]
 *  jason - [email protected]
 *  ragge - [email protected]
 *
 *  Last updated by korben on 5/15/2002
 */

 /* ChangeLog:

   2002-05-14 ragge
   Changed argument types and count to procedures
   Added WirelessScan
   Changed name of unknown field to beaconInterval
   Added error values and error return types

   2002-05-15 korben
   Combined ragge's changes with jason's

   2002-05-17 korben
   fixed adhoc and mangaged WINetworkInfoFlags per ragge's request
   Added WirelessEncrypt and WirelessKey declarations
   Updated WirelessJoinWEP and WirelessMakeIBSS comments regarding keys

 */

#ifndef __APPLE_80211__
#define __APPLE_80211__

#include <CoreFoundation/CoreFoundation.h>

/*
	A WirelessContext should be created using WirelessAttach
	before any other Wireless functions are called. WirelessDetach
	is used to dispose of a WirelessContext.
*/
typedef struct __WirelessContext *WirelessContextPtr;

struct WirelessInfo
{
	UInt16	link_qual;     /* Link quality, percent? */
	UInt16	comms_qual;    /* Communication Quality */
	UInt16	signal;        /* Signal level */
	UInt16	noise;         /* Noise level */
	UInt16  port_stat;     /* HERMES_RID_PORTSTAT? (Uncertain about
the meaning of this! 1=off? 2=connetion bad? 3=AdHoc Create? 4=BSS
(Client)? 5=BSS+OutOfRange?) */
	UInt16	client_mode;   /* 1 = BSS, 4 = Create IBSS */
	UInt16	u7;            /* ? */
	UInt16	power;         /* Power on flag */
	UInt16	u9;            /* 0=bad?, 1=ok?, 2=wrong key? */
	UInt8	macAddress[6]; /* MAC address of wireless access point. */
	SInt8	name[34];      /* Name of current (or wanted?) network. */
};
typedef struct WirelessInfo WirelessInfo;
/*
	I'm not sure what most of the values in the WirelessInfo structure
	are for, but here are some examples of the numbers returned:

	With Airport Off:
	0 0 0 0 1 1 0 0 1

	With Airport On:
	72 22 31 9 4 1 0 1 1

	With Computer to Computer Network:
	0 0 0 0 3 4 0 1 1

	- jason
*/


/*
	WINetworkInfoFlags are used in the WirelessNetworkInfo struct
	returned by the WirelessScanSplit function.

	I have seen other flags, but I don't know what they stand for. -
korben

	I think these should probably be bit masks, but I am using what
	korben figured out. - jason
*/
typedef UInt16 WINetworkInfoFlags;
enum
{
	kWINetworkManagedFlag =   0x0001,
	kWINetworkAdhocFlag =     0x0002,
	kWINetworkEncryptedFlag = 0x0010
};

typedef SInt32 WIErr;
enum {
  airpParamErr        = -2013261823, /* 0x88001001 */
  airpNoIOServiceErr  = -2013261822, /* 0x88001002 */
  airpInternalErr     = -2013261821, /* 0x88001003 */
  airpUnk4Err         = -2013261820, /* 0x88001004 */
  airpOutOfMemErr     = -2013261819, /* 0x88001005 */
  airpInternal2Err    = -2013261818, /* 0x88001006 */
  airpUnk7Err         = -2013261817, /* 0x88001007 */
  airpUnk8Err         = -2013261816, /* 0x88001008 */
  airpUnk9Err         = -2013261815, /* 0x88001009 */
  airpUnkaErr         = -2013261814, /* 0x8800100a */
  airpNoPowerErr      = -2013261813  /* 0x8800100b */
};
/* The meaning of these error codes can be wrong, and the list is not
 * complete. In general checking for noErr (0) should be enough */

struct WirelessNetworkInfo
{
	UInt16					channel; /* Channel for
the network. */
	UInt16					noise; /* Noise for the
network. 0 for Adhoc. */
	UInt16					signal; /* Signal strength
of the network. 0 for Adhoc. */
	UInt8					macAddress[6]; /* MAC
address of the wireless access point. */
	UInt16					beaconInterval; /* beacon
interval in milliseconds */
	WINetworkInfoFlags			flags; /* Flags for the
network. */
	UInt16