/*
***************************************************************************
* Ralink Tech Inc.
* 4F, No. 2 Technology 5th Rd.
* Science-based Industrial Park
* Hsin-chu, Taiwan, R.O.C.
*
* (c) Copyright 2002-2006, Ralink Technology, Inc.
*
* All rights reserved. Ralink's source code is an unpublished work and the
* use of a copyright notice does not imply otherwise. This source code
* contains confidential trade secret material of Ralink Tech. Any attemp
* or participation in deciphering, decoding, reverse engineering or in any
* way altering the source code is stricitly prohibited, unless the prior
* written consent of Ralink Technology, Inc. is obtained.
***************************************************************************
Module Name:
wsc.c
Abstract:
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Paul Lin 06-08-08 Initial
Snowpin Lee 06-09-12 Do modifications and Add APIs for AP
Snowpin Lee 07-04-19 Do modifications and Add APIs for STA
Snowpin Lee 07-05-17 Do modifications and Add APIs for AP Client
*/
#include "rt_config.h"
#ifdef WSC_INCLUDED
#include "wsc_tlv.h"
/*#ifdef LINUX */
/*#include <net/iw_handler.h> */
/*#endif*/
#define WSC_UPNP_MSG_TIMEOUT (150 * OS_HZ)
#define RTMP_WSC_NLMSG_SIGNATURE_LEN 8
#define MAX_WEPKEYNAME_LEN 20
#define MAX_WEPKEYTYPE_LEN 20
#ifndef PF_NOFREEZE
#define PF_NOFREEZE 0
#endif
char WSC_MSG_SIGNATURE[]={"RAWSCMSG"};
extern UCHAR WPS_OUI[];
extern UCHAR RALINK_OUI[];
#ifdef IWSC_SUPPORT
extern UCHAR IWSC_OUI[];
#endif // IWSC_SUPPORT //
#if defined(__ECOS) && defined(BRANCH_ADV)
extern int CFG_set(int id, void *val);
extern int CFG_str2id(char * var);
extern int CFG_commit(int id);
#else
#define CFG_set(a, b) {}
#define CFG_str2id(a) {}
#define CFG_commit(a) {}
#endif /*__ECOS && BRANCH_ADV */
UINT8 WPS_DH_G_VALUE[1] = {0x02};
UINT8 WPS_DH_P_VALUE[192] =
{
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xC9, 0x0F, 0xDA, 0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A_Wsc_Pri_Dev_Type[8] = {0x00, 0x01, 0x00, 0x50, 0xf2, 0x04, 0x00, 0x01};
#ifdef CONFIG_AP_SUPPORT
UCHAR AP_Wsc_Pri_Dev_Type[8] = {0x00, 0x06, 0x00, 0x50, 0xf2, 0x04, 0x00, 0x01};
VOID WscDelWPARetryTimer(
IN PRTMP_ADAPTER pAd);
#ifdef APCLI_SUPPORT
VOID WscApCliLinkDown(
IN PRTMP_ADAPTER pAd,
IN PWSC_CTRL pWscControl);
#endif /* APCLI_SUPPORT */
#endif /* CONFIG_AP_SUPPORT */
BOOLEAN WscCheckNonce(
IN PRTMP_ADAPTER pAdapter,
IN MLME_QUEUE_ELEM *Elem,
IN BOOLEAN bFlag,
IN PWSC_CTRL pWscControl);
VOID WscEapActionDisabled(
IN PRTMP_ADAPTER pAdapter,
IN PWSC_CTRL pWscControl);
VOID WscGetConfigErrFromNack(
IN PRTMP_ADAPTER pAdapter,
IN MLME_QUEUE_ELEM *pElem,
OUT USHORT *pConfigError);
INT WscSetAuthMode(
IN PRTMP_ADAPTER pAd,
IN UCHAR CurOpMode,
IN UCHAR apidx,
IN PSTRING arg);
INT WscSetEncrypType(
IN PRTMP_ADAPTER pAd,
IN UCHAR CurOpMode,
IN UCHAR apidx,
IN PSTRING arg);
VOID WscSendNACK(
IN PRTMP_ADAPTER pAdapter,
IN MAC_TABLE_ENTRY *pEntry,
IN PWSC_CTRL pWscControl);
static INT wsc_write_dat_file_thread(IN ULONG data);
#ifdef CONFIG_STA_SUPPORT
VOID WscLinkDown(
IN PRTMP_ADAPTER pAd);
#endif /* CONFIG_STA_SUPPORT */
VOID WscDelListEntryByMAC(
PLIST_HEADER pWscEnList,
IN PUCHAR pMacAddr);
NDIS_802_11_AUTHENTICATION_MODE WscGetAuthMode(
IN USHORT authFlag);
NDIS_802_11_WEP_STATUS WscGetWepStatus(
IN USHORT encryFlag);
/*
Standard UUID generation procedure. The UUID format generated by this function is base on UUID std. version 1.
It's a 16 bytes, one-time global unique number. and can show in string format like this:
550e8400-e29b-41d4-a716-446655440000
The format of uuid is:
uuid = <time_low> "-"
<time_mid> "-"
<time_high_and_version> "-"
<clock_seq_high_and_reserved>
<clock_seq_low> "-"
<node>
time_low = 4*<hex_octet>
time_mid = 2*<hex_octet>
time_high_and_version = 2*<hex_octet>
clock_seq_high_and_reserved = <hex_octet>
clock_seq_low = <hex_octet>
node = 6*<hex_octet>
hex_octet = <hex_digit> <hex_digit>
hex_digit = "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"
|"a"|"b"|"c"|"d"|"e"|"f"
|"A"|"B"|"C"|"D"|"E"|"F"
Note:
Actually, to IOT with JumpStart, we fix the first 10 bytes of UUID string!!!!
*/
INT WscGenerateUUID(
RTMP_ADAPTER *pAd,
UCHAR *uuidHexStr,
UCHAR *uuidAscStr,
int apIdx,
BOOLEAN bUseCurrentTime)
{
WSC_UUID_T uuid_t;
unsigned long long uuid_time;
int i;
UINT16 clkSeq;
char uuidTmpStr[UUID_LEN_STR+2];
/* Get the current time. */
if (bUseCurrentTime)
{
NdisGetSystemUpTime((ULONG *)&uuid_time);
}
else
uuid_time = 2860; /*xtime.tv_sec; // Well, we fix this to make JumpStart happy! */
uuid_time *= 10000000;
uuid_time += 0x01b21dd213814000LL;
uuid_t.timeLow = (UINT32)uuid_time & 0xFFFFFFFF;
uuid_t.timeMid = (UINT16)((uuid_time >>32) & 0xFFFF);
uuid_t.timeHi_Version = (UINT16)((uuid_time >> 48) & 0x0FFF);
uuid_t.timeHi_Version |= (1 << 12);
/* Get the clock sequence. */
clkSeq = (UINT16)(0x0601/*jiffies*/ & 0xFFFF); /* Again, we fix this to make JumpStart happy! */
uuid_t.clockSeqLow = clkSeq & 0xFF;
uuid_t.clockSeqHi_Var = (clkSeq & 0x3F00) >> 8;
uuid_t.clockSeqHi_Var |= 0x80;
#ifdef CONFIG_AP_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_AP(pAd)
{
/* copy the Mac address as the value of node */
NdisMoveMemory(&uuid_t.node[0], &pAd->ApCfg.MBSSID[apIdx].Bssid[0], sizeof(uuid_t.node));
}
#endif /* CONFIG_AP_SUPPORT */
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
{
#ifdef P2P_SUPPORT
/* copy the Mac address as the value of node */
if (apIdx >= MIN_NET_DEVICE_FOR_P2P_GO)
NdisMoveMemory(&uuid_t.node[0], &pAd->ApCfg.MBSSID[MAIN_MBSSID].Bssid[0], sizeof(uuid_t.node));
else
#endif /* P2P_SUPPORT */
NdisMoveMemory(&uuid_t.node[0], &pAd->CurrentAddress[0], sizeof(uuid_t.node));
}
#endif /* CONFIG_STA_SUPPORT */
/* Create the UUID ASCII string. */
memset(uuidTmpStr, 0, sizeof(uuidTmpStr));
snprintf(uuidTmpStr, sizeof(uuidTmpStr), "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
(unsigned int)uuid_t.timeLow, uuid_t.timeMid, uuid_t.timeHi_Version, uuid_t.clockSeqHi_Var, uuid_t.clockSeqLow,
uuid_t.node[0], uuid_t.node[1], uuid_t.node[2], uuid_t.node[3], uuid_t.node[4], uuid_t.node[5]);
if (strlen(uuidT
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
MT7601(小度wifi,360wifi,miwif) sta,ap linux驱动源代码 树莓派2 (693个子文件)
Makefile.4 21KB
Makefile.4 6KB
Makefile.libwapi.4 451B
Makefile.6 22KB
Makefile.6 12KB
Makefile.libautoprovision.6 189B
Makefile.libwapi.6 177B
Makefile.libautoprovision.6 42B
image.bin 66KB
MT7650.bin 58KB
MT7650.bin 58KB
MT7601_formal_1.7_Debug.bin 51KB
MT7601_formal_1.7_Debug.bin 51KB
MT7601_formal_1.7.bin 46KB
MT7601_formal_1.7.bin 46KB
MT7601.bin 44KB
MT7601.bin 44KB
RT85592.bin 34KB
RT85592.bin 34KB
rt2870_wow.bin 12KB
rt2870_wow.bin 12KB
rt2870_wow.bin 12KB
rt2870.bin 8KB
rt2870.bin 8KB
rt2860.bin 512B
rt2860.bin 512B
bin2h 16KB
bin2h 16KB
wsc.c 347KB
p2p_cfg.c 343KB
sta_cfg.c 341KB
sta_cfg.c 279KB
ap_cfg.c 262KB
p2p_packet.c 219KB
mlme.c 193KB
p2p.c 188KB
cmm_info.c 181KB
cmm_profile.c 176KB
ap_data.c 171KB
mlme.c 161KB
cmm_info.c 159KB
rt_ate.c 157KB
rt_ate.c 154KB
rtmp_data.c 150KB
cmm_wpa.c 143KB
wsc_tlv.c 135KB
rtmp_data.c 134KB
connect.c 120KB
rt_linux.c 120KB
rtmp_init.c 118KB
rt_linux.c 118KB
cmm_wpa.c 116KB
cmm_data.c 114KB
sync.c 110KB
tdls_link_mng.c 109KB
connect.c 107KB
rtmp_init.c 103KB
cmm_profile.c 99KB
sync.c 98KB
tdls.c 98KB
cmm_asic.c 94KB
mt7601.c 91KB
cmm_asic.c 90KB
mt7601.c 89KB
cmm_dfs.c 87KB
sta_ioctl.c 82KB
rt3290.c 80KB
sta_ioctl.c 77KB
cmm_sanity.c 75KB
ap.c 74KB
cmm_data.c 73KB
ra_ctrl.c 72KB
crypt_aes.c 68KB
crypt_aes.c 68KB
ra_ctrl.c 67KB
cmm_sanity.c 66KB
assoc.c 66KB
alg_ags.c 66KB
dls.c 66KB
dls.c 65KB
p2pcli.c 65KB
rt_channel.c 65KB
rt6590.c 65KB
rt_channel.c 64KB
alg_grp.c 64KB
ba_action.c 62KB
assoc.c 61KB
spectrum.c 60KB
spectrum.c 60KB
rt_qa.c 59KB
rt_qa.c 59KB
cmm_mac_usb.c 58KB
ba_action.c 56KB
cmm_mac_usb.c 55KB
sta_iwsc.c 55KB
ap_assoc.c 53KB
uapsd.c 53KB
p2p_table.c 53KB
cfg80211drv.c 52KB
rtusb_io.c 52KB
共 693 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
随风飘_Dcl
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页