⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sync.c

📁 华硕无线网卡 167G linux 驱动
💻 C
📖 第 1 页 / 共 5 页
字号:
}/*     ==========================================================================    Description:        MLME START Request state machine procedure, starting an IBSS    ========================================================================== */VOID MlmeStartReqAction(    IN PRT2570ADAPTER pAd,     IN MLME_QUEUE_ELEM *Elem) {    UCHAR         Ssid[MAX_LEN_OF_SSID], SsidLen;     // New for WPA security suites    UCHAR                       VarIE[MAX_VIE_LEN];     // Total VIE length = MAX_VIE_LEN - -5    NDIS_802_11_VARIABLE_IEs    *pVIE = NULL;    LARGE_INTEGER               TimeStamp;    BOOLEAN Privacy;#ifdef  SINGLE_ADHOC_LINKUP    ULONG   Bssidx;    BOOLEAN CfExist = FALSE;    CF_PARM CfParm;#endif    // Init Variable IE structure    pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE;    pVIE->Length = 0;    TimeStamp.vv.LowPart  = 0;    TimeStamp.vv.HighPart = 0;        if (MlmeStartReqSanity(pAd, Elem->Msg, Elem->MsgLen, Ssid, &SsidLen))     {        // reset all the timers        RTMPCancelTimer(&pAd->Mlme.SyncAux.ScanTimer);        RTMPCancelTimer(&pAd->Mlme.SyncAux.BeaconTimer);        // PortCfg.PrivacyInvoked should have been set via OID_802_11_WEP_STATUS.         // pAd->PortCfg.PrivacyInvoked = FALSE;                memcpy(pAd->PortCfg.Ssid, Ssid, SsidLen);         pAd->PortCfg.SsidLen           = SsidLen;        pAd->PortCfg.BssType           = BSS_INDEP;        Privacy = (pAd->PortCfg.WepStatus == Ndis802_11Encryption1Enabled) ||                   (pAd->PortCfg.WepStatus == Ndis802_11Encryption2Enabled) ||                   (pAd->PortCfg.WepStatus == Ndis802_11Encryption3Enabled);        pAd->PortCfg.CapabilityInfo    = CAP_GENERATE(0,1,0,0,Privacy, (pAd->PortCfg.WindowsTxPreamble == Rt802_11PreambleShort));        pAd->PortCfg.BeaconPeriod      = pAd->PortCfg.IbssConfig.BeaconPeriod;        pAd->PortCfg.AtimWin           = pAd->PortCfg.IbssConfig.AtimWin;        pAd->PortCfg.Channel           = pAd->PortCfg.IbssConfig.Channel;        if ((pAd->PortCfg.PhyMode == PHY_11ABG_MIXED) && (pAd->PortCfg.Channel > 14))        {            // no 1,2,5.5,11 Mbps when in 5Ghz band            pAd->PortCfg.SupportedRatesLen = pAd->PortCfg.IbssConfig.SupportedRatesLen - 4;            memset(pAd->PortCfg.SupportedRates, 0, MAX_LEN_OF_SUPPORTED_RATES);            memcpy(pAd->PortCfg.SupportedRates, &pAd->PortCfg.IbssConfig.SupportedRates[4], MAX_LEN_OF_SUPPORTED_RATES - 4);        }        else        {            pAd->PortCfg.SupportedRatesLen = pAd->PortCfg.IbssConfig.SupportedRatesLen;            memcpy(pAd->PortCfg.SupportedRates, pAd->PortCfg.IbssConfig.SupportedRates, MAX_LEN_OF_SUPPORTED_RATES);        }//      pAd->PortCfg.Pss = PWR_ACTIVE;                // generate a radom number as BSSID        MacAddrRandomBssid(pAd, &pAd->PortCfg.Bssid);        AsicSetBssid(pAd, &pAd->PortCfg.Bssid);         AsicSwitchChannel(pAd, pAd->PortCfg.Channel);        AsicLockChannel(pAd, pAd->PortCfg.Channel);        DBGPRINT(RT_DEBUG_TRACE, "SYNC - MlmeStartReqAction(ch= %d,supported rate len= %d)\n",            pAd->PortCfg.Channel, pAd->PortCfg.SupportedRatesLen);#ifdef  SINGLE_ADHOC_LINKUP        // Add itself as the entry within BSS table        Bssidx = BssTableSearch(&pAd->PortCfg.BssTab, &pAd->PortCfg.Bssid);        if (Bssidx == BSS_NOT_FOUND)        {            Bssidx = BssTableSetEntry(pAd, &pAd->PortCfg.BssTab, &pAd->PortCfg.Bssid,                Ssid, SsidLen, pAd->PortCfg.BssType, pAd->PortCfg.BeaconPeriod,                 CfExist, &CfParm, pAd->PortCfg.AtimWin, pAd->PortCfg.CapabilityInfo,                 pAd->PortCfg.SupportedRates, pAd->PortCfg.SupportedRatesLen, TRUE,                pAd->PortCfg.Channel, Elem->Rssi, TimeStamp, pVIE);        }#endif        pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE;        MlmeCntlConfirm(pAd, MT2_START_CONF, (USHORT)MLME_SUCCESS);    }     else     {        DBGPRINT(RT_DEBUG_ERROR, "SYNC - MlmeStartReqAction() sanity check fail. BUG!!!\n");        pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE;        MlmeCntlConfirm(pAd, MT2_START_CONF, MLME_INVALID_FORMAT);    }}/*     ==========================================================================    Description:        peer sends beacon back when scanning    ========================================================================== */VOID PeerBeaconAtScanAction(    IN PRT2570ADAPTER pAd,     IN MLME_QUEUE_ELEM *Elem) {    MACADDR         Bssid, Addr2;    UCHAR           Ssid[MAX_LEN_OF_SSID], BssType, Channel, Rates[MAX_LEN_OF_SUPPORTED_RATES], RatesLen,                     SsidLen, DtimCount, DtimPeriod, BcastFlag, MessageToMe, Legacy;    CF_PARM         CfParm;    USHORT          BeaconPeriod, AtimWin, CapabilityInfo;    MACFRAME       *Fr;    LARGE_INTEGER   TimeStamp;    BOOLEAN         CfExist = FALSE;    BOOLEAN         ExtendedRateIeExist;    UCHAR           Erp;    UCHAR         SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES];    UCHAR         SupRateLen, ExtRateLen;	UCHAR			LenVIE;    // New for WPA security suites    UCHAR                       VarIE[MAX_VIE_LEN];     // Total VIE length = MAX_VIE_LEN - -5    NDIS_802_11_VARIABLE_IEs    *pVIE = NULL;    // memset(Ssid, 0, MAX_LEN_OF_SSID);    Fr = (MACFRAME *) Elem->Msg;    // Init Variable IE structure    pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE;    pVIE->Length = 0;    if (PeerBeaconAndProbeRspSanity(pAd,                                 Elem->Msg,                                 Elem->MsgLen,                                 &Addr2,                                 &Bssid, Ssid,                                 &SsidLen,                                 &BssType,                                 &BeaconPeriod,                                 &Channel,                                 &TimeStamp,                                 &CfExist,                                 &CfParm,                                 &AtimWin,                                 &CapabilityInfo,                                 Rates,                                 &RatesLen,                                &ExtendedRateIeExist,                                &Erp,                                &DtimCount,                                 &DtimPeriod,                                 &BcastFlag,                                 &MessageToMe,                                 &Legacy,                                SupRate,                                &SupRateLen,                                ExtRate,                                &ExtRateLen,								&LenVIE,                                pVIE))     {        ULONG Idx;        UCHAR Rssi = 0;        // This correct im-proper RSSI indication during SITE SURVEY issue.        // Always report bigger RSSI during SCANNING when receiving multiple BEACONs from the same AP.         // This case happens because BEACONs come from adjacent channels, so RSSI become weaker as we         // switch to more far away channels.        Idx = BssTableSearch(&pAd->PortCfg.BssTab, &Bssid);        if (pAd->Mlme.SyncAux.Channel != Channel)            {            return;            }        if (Idx != BSS_NOT_FOUND)             Rssi = pAd->PortCfg.BssTab.BssEntry[Idx].Rssi;        if (Elem->Rssi > Rssi)            Rssi = Elem->Rssi;                DBGPRINT(RT_DEBUG_INFO, "SYNC - PeerBeaconAtScanAction (Subtype=%d, SsidLen=%d, Ssid=%s)\n", Fr->Hdr.SubType, SsidLen,Ssid);        // Mask out unnecessary capability information        CapabilityInfo &= SUPPORTED_CAPABILITY_INFO;                BssTableSetEntry(pAd, &pAd->PortCfg.BssTab, &Bssid, Ssid, SsidLen, BssType,                          BeaconPeriod, CfExist, &CfParm, AtimWin, CapabilityInfo, Rates,                          RatesLen, ExtendedRateIeExist, Channel, Rssi, TimeStamp, LenVIE, pVIE);    }    // sanity check fail, ignored}/*     ==========================================================================    Description:        When waiting joining the (I)BSS, beacon received from external    ========================================================================== */VOID PeerBeaconAtJoinAction(    IN PRT2570ADAPTER pAd,     IN MLME_QUEUE_ELEM *Elem) {    MACADDR       Bssid, Addr2;    UCHAR           Ssid[MAX_LEN_OF_SSID], BssType, Channel, Rates[MAX_LEN_OF_SUPPORTED_RATES], RatesLen,                     SsidLen, DtimCount, DtimPeriod, BcastFlag, MessageToMe, Legacy;    LARGE_INTEGER TimeStamp;    USHORT        BeaconPeriod, AtimWin, CapabilityInfo;    CF_PARM       Cf;    BOOLEAN       CfExist = FALSE, ExtendedRateIeExist;    UCHAR         Erp;    UCHAR         SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES];    UCHAR         SupRateLen, ExtRateLen;	UCHAR		  LenVIE;    // New for WPA security suites    UCHAR                       VarIE[MAX_VIE_LEN];     // Total VIE length = MAX_VIE_LEN - -5    NDIS_802_11_VARIABLE_IEs    *pVIE = NULL;    // Init Variable IE structure    pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE;    pVIE->Length = 0;    if (PeerBeaconAndProbeRspSanity(pAd,                                 Elem->Msg,                                 Elem->MsgLen,                                 &Addr2,                                 &Bssid,                                 Ssid,                                 &SsidLen,                                 &BssType,                                 &BeaconPeriod,                                 &Channel,                                 &TimeStamp,                                 &CfExist,                                 &Cf,                                 &AtimWin,                                 &CapabilityInfo,                                 Rates,                                 &RatesLen,                                &ExtendedRateIeExist,                                &Erp,                                &DtimCount,                                 &DtimPeriod,                                 &BcastFlag,                                 &MessageToMe,                                 &Legacy,                                SupRate,                                &SupRateLen,                                ExtRate,                                &ExtRateLen,								&LenVIE,                                pVIE))     {        // Disqualify 11b only adhoc when we are in 11g only adhoc mode        if ((BssType == BSS_INDEP) && (pAd->PortCfg.AdhocMode == 2) && (RatesLen < 12))            return;                if (MAC_ADDR_EQUAL(&pAd->Mlme.SyncAux.Bssid, &Bssid))        {            RTMPCancelTimer( &pAd->Mlme.SyncAux.BeaconTimer);            // Update RSSI to prevent No signal display when cards first initialized            pAd->PortCfg.LastRssi = Elem->Rssi;            pAd->PortCfg.AvgRssi  = Elem->Rssi;                        if (pAd->Mlme.CntlAux.SsidLen > 0)            {                memcpy(pAd->PortCfg.Ssid, pAd->Mlme.CntlAux.Ssid, pAd->Mlme.CntlAux.SsidLen);                pAd->PortCfg.SsidLen = pAd->Mlme.CntlAux.SsidLen;            }            else            {                memcpy(pAd->PortCfg.Ssid, Ssid, SsidLen);                pAd->PortCfg.SsidLen = SsidLen;            }                    COPY_MAC_ADDR(&pAd->PortCfg.Bssid, &Bssid);            AsicSetBssid(pAd, &pAd->PortCfg.Bssid);            pAd->PortCfg.BssType = BssType;            pAd->PortCfg.BeaconPeriod = BeaconPeriod;            pAd->PortCfg.Channel = Channel;            // filter out non-supported rates            {                int i;                pAd->PortCfg.SupportedRatesLen = 0;                for (i=0;i<RatesLen;i++)                {                    UCHAR Rate = Rates[i] & 0x7f;                    if ((pAd->PortCfg.PhyMode == PHY_11B) &&                        (Rate == 2 || Rate == 4 || Rate == 11 || Rate == 22))                    {                        ///DBGPRINT(RT_DEBUG_TRACE, ("SYNC - Supported Rate[%d] = 0x%02x\n",pAd->PortCfg.SupportedRatesLen, Rates[i]));                        pAd->PortCfg.SupportedRates[pAd->PortCfg.SupportedRatesLen] = Rates[i];                        pAd->PortCfg.SupportedRatesLen ++;                    }                    else if ((Rate == 2 || Rate == 4 || Rate == 11 || Rate == 22) ||                             (Rate == 12 || Rate == 18 || Rate == 24 || Rate == 36) ||                             (Rate == 48 || Rate == 72 || Rate == 96 || Rate == 108))                    {                        // DBGPRINT(RT_DEBUG_TRACE, ("SYNC - Supported Rate[%d] = 0x%02x\n",pAd->PortCfg.SupportedRatesLen, Rates[i]));                        pAd->PortCfg.SupportedRates[pAd->PortCfg.SupportedRatesLen] = Rates[i];                        pAd->PortCfg.SupportedRatesLen ++;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -