/******************************************************************************************************************** *function: construct ADDBAREQ frame * input: u8* dst //ADDBARsp frame's destination * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA_RSP. * u16 StatusCode //status code. * output: none * return: sk_buff* skb //return constructed skb to xmit ********************************************************************************************************************/ static struct sk_buff* ieee80211_ADDBA_Rsp( IN struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA, u16 StatusCode) { OCTET_STRING osADDBAFrame, tmp; FillOctetString(osADDBAFrame, Buffer, 0); *pLength = 0; ConstructMaFrameHdr( Adapter, Addr, ACT_CAT_BA, ACT_ADDBARSP, &osADDBAFrame ); // Dialog Token FillOctetString(tmp, &pBA->DialogToken, 1); PacketAppendData(&osADDBAFrame, tmp); // Status Code FillOctetString(tmp, &StatusCode, 2); PacketAppendData(&osADDBAFrame, tmp); // BA Parameter Set FillOctetString(tmp, &pBA->BaParamSet, 2); PacketAppendData(&osADDBAFrame, tmp); // BA Timeout Value FillOctetString(tmp, &pBA->BaTimeoutValue, 2); PacketAppendData(&osADDBAFrame, tmp); *pLength = osADDBAFrame.Length; }
VOID WPS_ConstructBeaconFrame( IN PADAPTER Adapter ) { // // Simple config IE. by CCW - copy from 818x // PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); PSIMPLE_CONFIG_T pSimpleConfig ; OCTET_STRING SimpleConfigInfo; PMGNT_INFO pDefaultMgntInfo; if(ACTING_AS_IBSS(Adapter)) return; if(!ACTING_AS_AP(Adapter)) return; pDefaultMgntInfo = &(GetDefaultAdapter(Adapter)->MgntInfo); pSimpleConfig = GET_SIMPLE_CONFIG(pDefaultMgntInfo); if( ((pSimpleConfig->WpsIeVersion < SUPPORT_WPS_INFO_VERSION) || (wps_IsWPSIEReady(Adapter) == FALSE)) && pSimpleConfig->IELen > 0) { // Original method carrying WPS IE RT_TRACE(COMP_WPS, DBG_TRACE, ("AP Construct Beacon \n")); FillOctetString(SimpleConfigInfo, pSimpleConfig->IEBuf, pSimpleConfig->IELen); PacketMakeElement( &pMgntInfo->beaconframe, EID_Vendor, SimpleConfigInfo); } else if(pSimpleConfig->WpsIeVersion == SUPPORT_WPS_INFO_VERSION) { FillOctetString(SimpleConfigInfo, pSimpleConfig->ieBeaconBuf, pSimpleConfig->ieBeaconLen); if(pSimpleConfig->ieBeaconLen > 0) PacketAppendData(&pMgntInfo->beaconframe, SimpleConfigInfo); } }
VOID WPS_AppendElement( IN PADAPTER Adapter, IN POCTET_STRING posFrame, IN BOOLEAN bCheckFrag, IN WPS_INFO_OPCODE frameType ) { PSIMPLE_CONFIG_T pSimpleConfig = GET_SIMPLE_CONFIG(&(GetDefaultAdapter(Adapter)->MgntInfo)); OCTET_STRING SimpleConfigInfo; FunctionIn(COMP_WPS); #if 0 if(bCheckFrag) { // WPS 2.0 Support IE Fragment for Testbed function if(pSimpleConfig->bFragmentIE && pSimpleConfig->IELen <= MAX_SIMPLE_CONFIG_IE_LEN) { u1Byte tempBuf[MAX_SIMPLE_CONFIG_IE_LEN]; pu1Byte currPtr; pu1Byte currPtrAftOui; RT_TRACE(COMP_WPS,DBG_LOUD,("ConstructProbeRequest: in Fragment IE\n")); PlatformZeroMemory(tempBuf, MAX_SIMPLE_CONFIG_IE_LEN); //Copy the OUI currPtr = pSimpleConfig->IEBuf; //Tesplan to copy the first octet in the first fragment PlatformMoveMemory(tempBuf, currPtr, SIZE_OUI + SIZE_OUI_TYPE); currPtr += (SIZE_OUI + SIZE_OUI_TYPE); currPtrAftOui = &tempBuf[SIZE_OUI + SIZE_OUI_TYPE]; // the first octet PlatformMoveMemory(currPtrAftOui, currPtr, 1); currPtr += 1; FillOctetString(SimpleConfigInfo,tempBuf,(SIZE_OUI + SIZE_OUI_TYPE +1)); PacketMakeElement( posFrame, EID_Vendor, SimpleConfigInfo); // the rest octet PlatformZeroMemory(currPtrAftOui, 1); PlatformMoveMemory(currPtrAftOui, currPtr, (pSimpleConfig->IELen-(SIZE_OUI + SIZE_OUI_TYPE)-1) ); FillOctetString(SimpleConfigInfo,tempBuf,(pSimpleConfig->IELen-1)); PacketMakeElement( posFrame, EID_Vendor, SimpleConfigInfo); } else if(pSimpleConfig->IELen > MAX_SIMPLE_CONFIG_IE_LEN) { u1Byte tempBuf[MAX_SIMPLE_CONFIG_IE_LEN]; pu1Byte currPtr; pu1Byte currPtrAftOui; PlatformZeroMemory(tempBuf, MAX_SIMPLE_CONFIG_IE_LEN); //Copy the OUI currPtr = pSimpleConfig->IEBuf; //Tesplan to copy the first octet in the first fragment PlatformMoveMemory(tempBuf, currPtr, SIZE_OUI + SIZE_OUI_TYPE); currPtr += (SIZE_OUI + SIZE_OUI_TYPE); currPtrAftOui = &tempBuf[SIZE_OUI + SIZE_OUI_TYPE]; // the first fragment PlatformMoveMemory(currPtrAftOui, currPtr, (MAX_SIMPLE_CONFIG_IE_LEN - (SIZE_OUI + SIZE_OUI_TYPE))); currPtr += (MAX_SIMPLE_CONFIG_IE_LEN - (SIZE_OUI + SIZE_OUI_TYPE)); FillOctetString(SimpleConfigInfo,tempBuf,(MAX_SIMPLE_CONFIG_IE_LEN - (SIZE_OUI + SIZE_OUI_TYPE))); PacketMakeElement( posFrame, EID_Vendor, SimpleConfigInfo); // the rest octet PlatformZeroMemory(currPtrAftOui, (MAX_SIMPLE_CONFIG_IE_LEN - (SIZE_OUI + SIZE_OUI_TYPE))); PlatformMoveMemory(currPtrAftOui, currPtr, (pSimpleConfig->IELen-MAX_SIMPLE_CONFIG_IE_LEN) ); FillOctetString(SimpleConfigInfo,tempBuf,(pSimpleConfig->IELen-MAX_SIMPLE_CONFIG_IE_LEN)); PacketMakeElement( posFrame, EID_Vendor, SimpleConfigInfo); } else { FillOctetString(SimpleConfigInfo, pSimpleConfig->IEBuf, pSimpleConfig->IELen); PacketMakeElement( posFrame, EID_Vendor, SimpleConfigInfo); } } else #endif { if(((pSimpleConfig->WpsIeVersion < SUPPORT_WPS_INFO_VERSION) || (wps_IsWPSIEReady(Adapter) == FALSE)) && pSimpleConfig->IELen > 0) { FillOctetString(SimpleConfigInfo, pSimpleConfig->IEBuf, pSimpleConfig->IELen); PacketMakeElement( posFrame, EID_Vendor, SimpleConfigInfo); } else if(pSimpleConfig->WpsIeVersion == SUPPORT_WPS_INFO_VERSION) { switch(frameType) { case WPS_INFO_ASOCREQ_IE: { FillOctetString(SimpleConfigInfo, pSimpleConfig->ieAsocReqBuf, pSimpleConfig->ieAsocReqLen); if(pSimpleConfig->ieAsocReqLen > 0) PacketAppendData(posFrame, SimpleConfigInfo); } break; case WPS_INFO_ASOCRSP_IE: { FillOctetString(SimpleConfigInfo, pSimpleConfig->ieAsocRspBuf, pSimpleConfig->ieAsocRspLen); if(pSimpleConfig->ieAsocRspLen > 0) PacketAppendData(posFrame, SimpleConfigInfo); } break; case WPS_INFO_PROBEREQ_IE: { FillOctetString(SimpleConfigInfo, pSimpleConfig->ieProbeReqBuf, pSimpleConfig->ieProbeReqLen); if(pSimpleConfig->ieProbeReqLen > 0) PacketAppendData(posFrame, SimpleConfigInfo); } break; case WPS_INFO_PROBERSP_IE: { FillOctetString(SimpleConfigInfo, pSimpleConfig->ieProbeRspBuf, pSimpleConfig->ieProbeRspLen); if(pSimpleConfig->ieProbeRspLen > 0) PacketAppendData(posFrame, SimpleConfigInfo); } break; default: //for MacOS warning. break; } } } }