WLAN API
来源:互联网 发布:淘宝促销活动可以关么? 编辑:程序博客网 时间:2024/06/02 16:06
结构体
WLAN_INTERFACE_INFO_LIST
typedef struct _WLAN_INTERFACE_INFO_LIST { DWORD dwNumberOfItems; DWORD dwIndex; WLAN_INTERFACE_INFO InterfaceInfo[];
} WLAN_INTERFACE_INFO_LIST, *PWLAN_INTERFACE_INFO_LIST;
WLAN_INTERFACE_INFO
typedef struct _WLAN_INTERFACE_INFO { GUID InterfaceGuid; WCHAR strInterfaceDescription[256]; WLAN_INTERFACE_STATE isState;
} WLAN_INTERFACE_INFO, *PWLAN_INTERFACE_INFO;
InterfaceGuid :接口的GUID
strInterfaceDescription :接口的描述信息
isState :包含一个 WLAN_INTERFACE_STATE 值,标示这个接口的当前状态。
WLAN_INTERFACE_STATE
typedef enum _WLAN_INTERFACE_STATE {
wlan_interface_state_not_ready = 0, // The interface is not ready to operate.
wlan_interface_state_connected= 1,// The interface is connected to a network.
wlan_interface_state_ad_hoc_network_formed = 2,// The interface is the first node in an ad hoc network. No peer has connected.
wlan_interface_state_disconnecting = 3, // The interface is disconnecting from the current network.
wlan_interface_state_disconnected= 4, // The interface is not connected to any network.
wlan_interface_state_associating = 5, // The interface is attempting to associate with a network.
wlan_interface_state_discovering = 6, // Auto configuration is discovering the settings for the network.
wlan_interface_state_authenticating= 7 // The interface is in the process of authenticating.
} WLAN_INTERFACE_STATE,*PWLAN_INTERFACE_STATE;
WLAN_INTERFACE_CAPABILITY
typedef struct _WLAN_INTERFACE_CAPABILITY { WLAN_INTERFACE_TYPE interfaceType; BOOL bDot11DSupported; DWORD dwMaxDesiredSsidListSize ; DWORD dwMaxDesiredBssidListSiz e ;DWORD dwNumberOfSupportedPhys; DOT11_PHY_TYPE dot11PhyTypes[WLAN_MAX_PHY_INDEX];
} WLAN_INTERFACE_CAPABILITY, *PWLAN_INTERFACE_CAPABILITY;
网卡工作在osi的最后两层,物理层(PHY)和数据链路层(MAC)。
物理层定义了数据传送与接收所需要的电与光信号、线路状态、时钟基准、数据编码和电路等,并向数据链路层设备提供标准接口。物理层的芯片称之为PHY。
数据链路层则提供寻址机构、数据帧的构建、数据差错检查、传送控制、向网络层提供标准的数据接口等功能。以太网卡中数据链路层的芯片称之为MAC控制器。
很多网卡的这两个部分是做到一起的。
他们之间的关系是pci总线接mac总线,mac接phy,phy接网线
DOT11_PHY_TYPE
枚举类型,PHY类型。
typedef enum _DOT11_PHY_TYPE{
dot11_phy_type_unknown //Specifies an unknown or uninitialized PHY type.
dot11_phy_type_any //Specifies any PHY type.
dot11_phy_type_fhss //Specifies a frequency-hopping spread-spectrum (FHSS) PHY. Bluetooth devices can use FHSS or an adaptation of FHSS.
dot11_phy_type_dsss //Specifies a direct sequence spread spectrum (DSSS) PHY type.
dot11_phy_type_irbaseband //Specifies an infrared (IR) baseband PHY type.
dot11_phy_type_ofdm //Specifies an orthogonal frequency division multiplexing (OFDM) PHY type. 802.11a devices can use OFDM.
dot11_phy_type_hrdsss //Specifies a high-rate DSSS (HRDSSS) PHY type.
dot11_phy_type_erp //Specifies an extended rate PHY type (ERP). 802.11g devices can use ERP.,
dot11_phy_type_ht //Specifies the 802.11n PHY type.
dot11_phy_type_IHV_start //Specifies the start of the range that is used to define PHY types that are developed by an independent hardware vendor (IHV).
dot11_phy_type_IHV_end //Specifies the start of the range that is used to define PHY types that are developed by an independent hardware vendor (IHV).
} DOT11_PHY_TYPE, *PDOT11_PHY_TYPE;
DOT11_BSS_TYPE
枚举类型,用于定义BSS网络的类型
typedef
dot11_BSS_type_infrastructure : 为 infrastructure BSS 网络。
dot11_BSS_type_independent :为independent BSS网络
dot11_BSS_type_any :是 infrastructure 或者 independent BSS网络
infrastructure BSS:
中控型基本服务集 (BSS)是一个包含了一个接入点和一些站点的 802.11 网络。这个接入点将信息送入目标站点或者一个固定网络。
independent BSS:
IBSS(Independent Basic Service Set) 独立基本服务集 。是一种无线拓扑结构,IEEE802.11标准的模式
WLAN_CONNECTION_ATTRIBUTES
typedef struct _WLAN_CONNECTION_ATTRIBUTES { WLAN_INTERFACE_STATE isState; WLAN_CONNECTION_MODE wlanConnectionMode; WCHAR strProfileName[256]; WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttribute s ;WLAN_SECURITY_ATTRIBUTES wlanSecurityAttributes;
} WLAN_CONNECTION_ATTRIBUTES, *PWLAN_CONNECTION_ATTRIBUTES;
wlanAssociationAttribute
profilename. 指定无线网络连接的配置文件名称
association 和 connection 有什么区别????
WLAN_CONNECTION_MODE
枚举类型,连接模式。
typedef enum _WLAN_CONNECTION_MODE{
wlan_connection_mode_profile //A profile will be used to make the connection.
wlan_connection_mode_temporary_profile //A temporary(temporary :临时的) profile will be used to make the connection.
wlan_connection_mode_discovery_secure //Secure discovery will be used to make the connection.
wlan_connection_mode_discovery_unsecure //Unsecure discovery will be used to make the connection.
wlan_connection_mode_auto //A connection will be made automatically, generally using a persistent profile. (persistent :持续不断的)
wlan_connection_mode_invalid //Not used.
}WLAN_CONNECTION_MODE,
WLAN_ASSOCIATION_ATTRIBUTES
结构体,contains association attributes for a connection 。(我的理解就是要连接的网络的属性)
typedef struct _WLAN_ASSOCIATION_ATTRIBUTES { DOT11_SSID dot11Ssid; DOT11_BSS_TYPE dot11BssType; DOT11_MAC_ADDRESS dot11Bssid; DOT11_PHY_TYPE dot11PhyType; ULONG uDot11PhyIndex; WLAN_SIGNAL_QUALITY wlanSignalQuality; USHORT usRxRate; USHORT usTxRate;
} WLAN_ASSOCIATION_ATTRIBUTES, *PWLAN_ASSOCIATION_ATTRIBUTES;
dot11Ssid :SSID 见结构体DOT11_SSID
dot11BssType :网络类型 见结构体 DOT11_BSS_TYPE
DOT11_SSID
结构体,定义接口的SSID.
typedef struct _DOT11_SSID { ULONG uSSIDLength; UCHAR ucSSID[DOT11_SSID_MAX_LENGTH];
} DOT11_SSID, *PDOT11_SSID;
DOT11_BSS_TYPE
typedef enum _DOT11_BSS_TYPE {
dot11_BSS_type_infrastructure
dot11_BSS_type_independent
dot11_BSS_type_any
} DOT11_BSS_TYPE,
WLAN_CONNECTION_PARAMETERS
在使用WlanConnect 这个函数的时候,这个结构体需要作为参数来设定连接属性。
typedef struct _WLAN_CONNECTION_PARAMETERS {WLAN_CONNECTION_MODE wlanConnectionMode; LPCWSTR strProfile; PDOT11_SSID pDot11Ssid; PDOT11_BSSID_LIST pDesiredBssidList; DOT11_BSS_TYPE dot11BssType; DWORD dwFlags;
} WLAN_CONNECTION_PARAMETERS, *PWLAN_CONNECTION_PARAMETERS;
WLAN_AVAILABLE_NETWORK_LIST
结构体,包含可用网络(network)的信息的列表。
typedef struct _WLAN_AVAILABLE_NETWORK_LIST {DWORD dwNumberOfItems; DWORD dwIndex; WLAN_AVAILABLE_NETWORK Network[1];
} WLAN_AVAILABLE_NETWORK_LIST,*PWLAN_AVAILABLE_NETWORK_LIST;
dwNumberOfItems :Network中包含的单元的个数
dwIndex :当前单元的索引,从0开始到dwNumberOfItems-1;
当这个结构体作为参数时用到。用之前必须赋初值。
Network :一个WLAN_AVAILABLE_NETWORK 的列表,包含接口信息。
WLAN_AVAILABLE_NETWORK
结构体,包含可用无线网络(network)单元的信息。
typedef struct _WLAN_AVAILABLE_NETWORK {WCHAR strProfileName[256]; DOT11_SSID dot11Ssid; //SSID DOT11_BSS_TYPE dot11BssType; ULONG uNumberOfBssids; BOOL bNetworkConnectable; WLAN_REASON_CODE wlanNotConnectableReason ; ULONG uNumberOfPhyTypes; DOT11_PHY_TYPE dot11PhyTypes[WLAN_MAX_PHY_TYPE_NUMBER]; BOOL bMorePhyTypes; WLAN_SIGNAL_QUALITY wlanSignalQuality; //信号强度 BOOL bSecurityEnabled; DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorith m ;DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgori thm ;DWORD dwFlags; DWORD dwReserved;
} WLAN_AVAILABLE_NETWORK,
部分API
WlanCloseHandle
函数原型:
函数功能:
参数意义:
返回值:
hClientHandle is NULL or invalid, or pReserved is not NULL.
The handle hClientHandle was not found in the handle table.
Various error codes.
注意:
WlanOpenHandle
函数原型:
DWORD WINAPI WlanOpenHandle( __in DWORD dwClientVersion, PVOID pReserved, __out PDWORDpdwNegotiatedVersion, __out PHANDLE phClientHandle );
函数功能:
参数:
Client version for Wireless LAN API for Windows
Client version for Windows
返回值:
pdwNegotiatedVersion is NULL, phClientHandle is NULL, orpReserved is not NULL.
Failed to allocate memory to create the client context.
Various error codes.
Too many handles have been issued by the server
注意:
WLAN_API_VERSION_MAJOR(_v)
和 WLAN_API_VERSION_MINOR(_v)各自返回较大版本值和较小版本值。可以通过宏定义WLAN_API_MAKE_VERSION(_major, _minor).组装一个版本号。
WlanEnumInterfaces
函数功能:
函数原型:
DWORD WINAPI WlanEnumInterfaces( __in HANDLE hClientHandle, __in PVOID pReserved, __out PWLAN_INTERFACE_INFO_LIST* ppInterfaceList );
参数:
返回值:
hClientHandle is NULL or invalid, pReserved is not NULL, orppInterfaceList is NULL.
The handle hClientHandle was not found in the handle table.
Various error codes.
Failed to allocate memory to create the client context.
注意:
WlanFreeMemory
函数功能:
函数原型:
参数:
注意:
WlanRegisterNotification
函数功能:
函数原型:
参数意义:
WLAN_NOTIFICATION_SOURCE_NONE
Unregisters notifications.
WLAN_NOTIFICATION_SOURCE_ALL
Registers for all notifications, including those generated by the 802.1X module.
WLAN_NOTIFICATION_SOURCE_ACM
Registers for notifications generated by the auto configuration module.
WLAN_NOTIFICATION_SOURCE_MSM
Registers for notifications generated by MSM.
WLAN_NOTIFICATION_SOURCE_SECURITY
Registers for notifications generated by the security module.
WLAN_NOTIFICATION_SOURCE_IHV
Registers for notifications generated by independent hardware vendors (IHV).
WlanGetAvailableNetworkL
函数功能:
函数原型:
参数:
WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_ADHOC_PROFILES
0x00000001
Include all ad-hoc network profiles in the available network list, including profiles that are not visible.
WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_MANUAL_HIDDEN_PROFILES
0x00000002
Include all hidden network profiles in the available network list, including profiles that are not visible.
返回值:
ERROR_INVALID_PARAMETER
hClientHandle is NULL or invalid, pInterfaceGuid is NULL,pReserved is not NULL, ppAvailableNetworkList is NULL, or thedwFlags parameter value is not set to one of the specified values.
ERROR_INVALID_HANDLE
The handle hClientHandle was not found in the handle table.
ERROR_NDIS_DOT11_POWER_STATE_INVALID
The radio for the interface is turned off. There are no available networks when the radio is off.
RPC_STATUS
Various error codes.
ERROR_NOT_ENOUGH_MEMORY
Failed to allocate memory for the query results.
注意:
WlanConnect
函数功能:
函数原型:
参数:
返回值:
ERROR_INVALID_PARAMETER
One of the following conditions occurred:
- hClientHandle is NULL or invalid.
- pInterfaceGuid is NULL.
- pConnectionParameters is NULL.
- The dwFlags member of the structure pointed to bypConnectionParameters is not set to one of the values specified on the WLAN_CONNECTION_PARAMETERSpage.
- The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_discovery_secure or wlan_connection_mode_discovery_unsecure, and thepDot11Ssid member of the same structure is NULL.
- The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_discovery_secure or wlan_connection_mode_discovery_unsecure, and thedot11BssType member of the same structure is set to dot11_BSS_type_any.
- The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_profile, and the strProfile member of the same structure is NULL or the length of the profile exceeds WLAN_MAX_NAME_LENGTH.
- The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_profile, and the strProfile member of the same structure is NULL or the length of the profile is zero.
- The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_invalid.
- The dot11BssType member of the structure pointed to bypConnectionParameters is set to dot11_BSS_type_infrastructure, and the dwFlags member of the same structure is set to WLAN_CONNECTION_ADHOC_JOIN_ONLY.
- The dot11BssType member of the structure pointed to bypConnectionParameters is set to dot11_BSS_type_independent, and the dwFlags member of the same structure is set to WLAN_CONNECTION_HIDDEN_NETWORK.
- The dwFlags member of the structure pointed to bypConnectionParameters is set to WLAN_CONNECTION_IGNORE_PRIVACY_BIT, and either thewlanConnectionMode member of the same structure is not set to wlan_connection_mode_temporary_profile or thedot11BssType member of the same structure is set to dot11_BSS_type_independent.
ERROR_INVALID_HANDLE
The handle hClientHandle was not found in the handle table.
RPC_STATUS
Various error codes.
ERROR_ACCESS_DENIED
The caller does not have sufficient permissions.
注意:
Wireless LAN API for WindowsXP SP2: You can only use WlanConnect to connect to networks on the preferred(优先的) network list. To add a network to the preferred network list, call WlanSetProfile.
- WLAN API
- WLAN API
- 使用Native WLAN API查找无线网络
- WLAN
- WLan
- WLan
- wlan
- wlan
- WLAN API应用介绍(含实例程序)
- 什么是WLAN
- Wlan Web
- wlan mac
- WLAN Roaming
- WLAN组成
- WLAN 基础知识
- WLAN QoS
- WLAN DRIVE
- WLAN QOS
- Python学习进阶(1)——安装与测试
- SVN常用命令
- 软件开发的“三重门”
- Java 10个调试技巧
- 进程1中copy_page_tables中页表项为何设置为只读?
- WLAN API
- iOS应用程序状态切换相关
- 求NS2代码
- 关于算法的一些资料
- 用fis和上线步骤的整理
- osganimationsolid例子
- 黑马程序员——高新技术第一天
- C#图片处理示例(裁剪,缩放,清晰度,水印)
- Eclipse快捷键大全(转载)