📄 wt_frm.c
字号:
/* wt_log(L_DEBUG, "Unrecognized EID=%dd in assocreq decode.\n", ie_ptr->eid); WLAN_HEX_DUMP(3, "frm w/ bad eid:", f->buf, f->len ); */ break; } ie_ptr = (wlan_ie_t *) (((UINT8 *) ie_ptr) + 2 + ie_ptr->len); } return;}/*--------------------------------------------------------------* wt_mgmt_encode_assocresp** Receives an fr_mgmt struct with its len and buf set. Fills* in the rest of the members as far as possible. On entry len* is the length of the buffer, on return len is the actual length* of the frame with all the currently encoded fields. For * frames where the caller adds variable/optional IEs, the caller* will have to update the len field.* On entry Assumptions:* 1) f->len and f->buf are already set* 2) f->len is the length of the MAC header + data, the CRC* is NOT included* 3) all members except len, buf, and priv are zero** Arguments:* f frame structure ** Returns:* nothing** Side effects:* frame structure members are pointing at their* respective portions of the frame buffer.* * STATUS: UNVERIFIED. NONV3.* --------------------------------------------------------------*/void wt_mgmt_encode_assocresp(wlan_fr_assocresp_t * f){// printk(LEVEL " %s: UNVERIFIED. NONV3.\n", __FUNCTION__); f->type = WLAN_FSTYPE_ASSOCRESP; f->hdr = (p80211_hdr_t *) f->buf; ASSERT(f->len >= WLAN_ASSOCRESP_FR_MAXLEN); /*-- Fixed Fields ----*/ f->cap_info = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_ASSOCRESP_OFF_CAP_INFO); f->status = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_ASSOCRESP_OFF_STATUS); f->aid = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_ASSOCRESP_OFF_AID); f->len = WLAN_HDR_A3_LEN + WLAN_ASSOCRESP_OFF_AID + sizeof(*(f->aid)); return;}/*--------------------------------------------------------------* wt_mgmt_decode_assocresp** Given a complete frame in f->buf, sets the pointers in f to * the areas that correspond to the parts of the frame.** Assumptions:* 1) f->len and f->buf are already set* 2) f->len is the length of the MAC header + data, the CRC* is NOT included* 3) all members except len and buf are zero** Arguments:* f frame structure ** Returns:* nothing** Side effects:* frame structure members are pointing at their* respective portions of the frame buffer.* * STATUS: UNVERIFIED. NONV3.* --------------------------------------------------------------*/void wt_mgmt_decode_assocresp(wlan_fr_assocresp_t * f){ f->type = WLAN_FSTYPE_ASSOCRESP; f->hdr = (p80211_hdr_t *) f->buf;// printk(LEVEL " %s: UNVERIFIED. NONV3.\n", __FUNCTION__); ASSERT(WLAN_FTYPE_MGMT == WLAN_GET_FC_FTYPE(ieee2host16(f->hdr->a3.fc))); ASSERT(WLAN_FSTYPE_ASSOCRESP == WLAN_GET_FC_FSTYPE(ieee2host16(f->hdr->a3.fc))); /*-- Fixed Fields ----*/ f->cap_info = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_ASSOCRESP_OFF_CAP_INFO); f->status = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_ASSOCRESP_OFF_STATUS); f->aid = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_ASSOCRESP_OFF_AID); /*-- Information elements */ f->supp_rates = (wlan_ie_supp_rates_t *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_ASSOCRESP_OFF_SUPP_RATES); return;}/*--------------------------------------------------------------* wt_mgmt_encode_reassocreq** Receives an fr_mgmt struct with its len and buf set. Fills* in the rest of the members as far as possible. On entry len* is the length of the buffer, on return len is the actual length* of the frame with all the currently encoded fields. For * frames where the caller adds variable/optional IEs, the caller* will have to update the len field.* On entry Assumptions:* 1) f->len and f->buf are already set* 2) f->len is the length of the MAC header + data, the CRC* is NOT included* 3) all members except len, buf, and priv are zero** Arguments:* f frame structure ** Returns:* nothing** Side effects:* frame structure members are pointing at their* respective portions of the frame buffer.* * STATUS: UNVERIFIED. NONV3.* --------------------------------------------------------------*/void wt_mgmt_encode_reassocreq(wlan_fr_reassocreq_t * f){// printk(LEVEL " %s: UNVERIFIED. NONV3.\n", __FUNCTION__); f->type = WLAN_FSTYPE_REASSOCREQ; f->hdr = (p80211_hdr_t *) f->buf; ASSERT(f->len >= WLAN_REASSOCREQ_FR_MAXLEN); /*-- Fixed Fields ----*/ f->cap_info = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCREQ_OFF_CAP_INFO); f->listen_int = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCREQ_OFF_LISTEN_INT); f->curr_ap = (UINT8 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCREQ_OFF_CURR_AP); f->len = WLAN_HDR_A3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP + sizeof(*(f->curr_ap)); return;}/*--------------------------------------------------------------* wt_mgmt_decode_reassocreq** Given a complete frame in f->buf, sets the pointers in f to * the areas that correspond to the parts of the frame.** Assumptions:* 1) f->len and f->buf are already set* 2) f->len is the length of the MAC header + data, the CRC* is NOT included* 3) all members except len and buf are zero** Arguments:* f frame structure ** Returns:* nothing** Side effects:* frame structure members are pointing at their* respective portions of the frame buffer.* * STATUS: UNVERIFIED. NONV3.* --------------------------------------------------------------*/void wt_mgmt_decode_reassocreq(wlan_fr_reassocreq_t * f){ wlan_ie_t *ie_ptr;// printk(LEVEL " %s: UNVERIFIED. NONV3.\n", __FUNCTION__); f->type = WLAN_FSTYPE_REASSOCREQ; f->hdr = (p80211_hdr_t *) f->buf; ASSERT(WLAN_FTYPE_MGMT == WLAN_GET_FC_FTYPE(ieee2host16(f->hdr->a3.fc))); ASSERT(WLAN_FSTYPE_REASSOCREQ == WLAN_GET_FC_FSTYPE(ieee2host16(f->hdr->a3.fc))); /*-- Fixed Fields ----*/ f->cap_info = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCREQ_OFF_CAP_INFO); f->listen_int = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCREQ_OFF_LISTEN_INT); f->curr_ap = (UINT8 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCREQ_OFF_CURR_AP); /*-- Information elements */ ie_ptr = (wlan_ie_t *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCREQ_OFF_SSID); while (((UINT8 *) ie_ptr) < (f->buf + f->len)) { switch (ie_ptr->eid) { case WLAN_EID_SSID: f->ssid = (wlan_ie_ssid_t *) ie_ptr; break; case WLAN_EID_SUPP_RATES: f->supp_rates = (wlan_ie_supp_rates_t *) ie_ptr; break; default: /* WLAN_LOG_WARNING1( "Unrecognized EID=%dd in reassocreq decode.\n", ie_ptr->eid); WLAN_HEX_DUMP(3, "frm w/ bad eid:", f->buf, f->len ); */ break; } ie_ptr = (wlan_ie_t *) (((UINT8 *) ie_ptr) + 2 + ie_ptr->len); } return;}/*--------------------------------------------------------------* wt_mgmt_encode_reassocresp** Receives an fr_mgmt struct with its len and buf set. Fills* in the rest of the members as far as possible. On entry len* is the length of the buffer, on return len is the actual length* of the frame with all the currently encoded fields. For * frames where the caller adds variable/optional IEs, the caller* will have to update the len field.* On entry Assumptions:* 1) f->len and f->buf are already set* 2) f->len is the length of the MAC header + data, the CRC* is NOT included* 3) all members except len, buf, and priv are zero** Arguments:* f frame structure ** Returns:* nothing** Side effects:* frame structure members are pointing at their* respective portions of the frame buffer.* * STATUS: UNVERIFIED. NONV3.* --------------------------------------------------------------*/void wt_mgmt_encode_reassocresp(wlan_fr_reassocresp_t * f){ //printk(LEVEL " %s: UNVERIFIED. NONV3.\n", __FUNCTION__); f->type = WLAN_FSTYPE_REASSOCRESP; f->hdr = (p80211_hdr_t *) f->buf; ASSERT(f->len >= WLAN_REASSOCRESP_FR_MAXLEN); /*-- Fixed Fields ----*/ f->cap_info = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCRESP_OFF_CAP_INFO); f->status = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCRESP_OFF_STATUS); f->aid = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCRESP_OFF_AID); f->len = WLAN_HDR_A3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(f->aid)); return;}/*--------------------------------------------------------------* wt_mgmt_decode_reassocresp** Given a complete frame in f->buf, sets the pointers in f to * the areas that correspond to the parts of the frame.** Assumptions:* 1) f->len and f->buf are already set* 2) f->len is the length of the MAC header + data, the CRC* is NOT included* 3) all members except len and buf are zero** Arguments:* f frame structure ** Returns:* nothing** Side effects:* frame structure members are pointing at their* respective portions of the frame buffer.* * STATUS: UNVERIFIED. NONV3.* --------------------------------------------------------------*/void wt_mgmt_decode_reassocresp(wlan_fr_reassocresp_t * f){ f->type = WLAN_FSTYPE_REASSOCRESP; f->hdr = (p80211_hdr_t *) f->buf;// printk(LEVEL " %s: UNVERIFIED. NONV3.\n", __FUNCTION__); ASSERT(WLAN_FTYPE_MGMT == WLAN_GET_FC_FTYPE(ieee2host16(f->hdr->a3.fc))); ASSERT(WLAN_FSTYPE_REASSOCRESP == WLAN_GET_FC_FSTYPE(ieee2host16(f->hdr->a3.fc))); /*-- Fixed Fields ----*/ f->cap_info = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCRESP_OFF_CAP_INFO); f->status = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCRESP_OFF_STATUS); f->aid = (UINT16 *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCRESP_OFF_AID); /*-- Information elements */ f->supp_rates = (wlan_ie_supp_rates_t *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_REASSOCRESP_OFF_SUPP_RATES); return;}/*--------------------------------------------------------------* wt_mgmt_encode_probereq** Receives an fr_mgmt struct with its len and buf set. Fills* in the rest of the members as far as possible. On entry len* is the length of the buffer, on return len is the actual length* of the frame with all the currently encoded fields. For * frames where the caller adds variable/optional IEs, the caller* will have to update the len field.* On entry Assumptions:* 1) f->len and f->buf are already set* 2) f->len is the length of the MAC header + data, the CRC* is NOT included* 3) all members except len, buf, and priv are zero** Arguments:* f frame structure ** Returns:* nothing** Side effects:* frame structure members are pointing at their* respective portions of the frame buffer.* * STATUS: UNVERIFIED. NONV3.* --------------------------------------------------------------*/void wt_mgmt_encode_probereq(wlan_fr_probereq_t * f){// printk(LEVEL " %s: UNVERIFIED. NONV3.\n", __FUNCTION__); f->type = WLAN_FSTYPE_PROBEREQ; f->hdr = (p80211_hdr_t *) f->buf; ASSERT(f->len >= WLAN_PROBEREQ_FR_MAXLEN); f->len = WLAN_HDR_A3_LEN; return;}/*--------------------------------------------------------------* wt_mgmt_decode_probereq** Given a complete frame in f->buf, sets the pointers in f to * the areas that correspond to the parts of the frame.** Assumptions:* 1) f->len and f->buf are already set* 2) f->len is the length of the MAC header + data, the CRC* is NOT included* 3) all members except len and buf are zero** Arguments:* f frame structure ** Returns:* nothing** Side effects:* frame structure members are pointing at their* respective portions of the frame buffer.* * STATUS: UNVERIFIED. NONV3.* --------------------------------------------------------------*/void wt_mgmt_decode_probereq(wlan_fr_probereq_t * f){ wlan_ie_t *ie_ptr;// printk(LEVEL " %s: UNVERIFIED. NONV3.\n", __FUNCTION__); f->type = WLAN_FSTYPE_PROBEREQ; f->hdr = (p80211_hdr_t *) f->buf; ASSERT(WLAN_FTYPE_MGMT == WLAN_GET_FC_FTYPE(ieee2host16(f->hdr->a3.fc))); ASSERT(WLAN_FSTYPE_PROBEREQ == WLAN_GET_FC_FSTYPE(ieee2host16(f->hdr->a3.fc))); /*-- Fixed Fields ----*/ /*-- Information elements */ ie_ptr = (wlan_ie_t *) (WLAN_HDR_A3_DATAP(&(f->hdr->a3)) + WLAN_PROBEREQ_OFF_SSID); while (((UINT8 *) ie_ptr) < (f->buf + f->len)) { switch (ie_ptr->eid) { case WLAN_EID_SSID: f->ssid = (wlan_ie_ssid_t *) ie_ptr; break; case WLAN_EID_SUPP_RATES: f->supp_rates = (wlan_ie_supp_rates_t *) ie_ptr; break; default:/* WLAN_LOG_WARNING1( "Unrecognized EID=%dd in probereq decode.\n", ie_ptr->eid); WLAN_HEX_DUMP(3, "frm w/ bad eid:", f->buf, f->len );*/ break; } ie_ptr = (wlan_ie_t *) (((UINT8 *) ie_ptr) + 2 + ie_ptr->len); } return;}/*--------------------------------------------------------------* wt_mgmt_encode_proberesp** Receives an fr_mgmt struct with its len and buf set. Fills* in the rest of the members as far as possible. On entry len* is the length of the buffer, on return len is the actual length* of the frame with all the currently encoded fields. For * frames where the caller adds variable/optional IEs, the caller* will have to update the len field.* On entry Assumptions:* 1) f->len and f->buf are already set* 2) f->len is the length of the MAC header + data, the CRC* is NOT included* 3) all members except len, buf, and priv are zero** Arguments:* f frame structure ** Returns:* nothing** Side effects:* frame structure members are pointing at their* respective portions of the frame buffer.* * STATUS: UNVERIFIED. NONV3.* --------------------------------------------------------------*/#if 0void TBeacnIBSS(IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3){ char Str[10], FrameBody[256]; USHORT BodyLen = 0; PWT_ADAPTER Adapter = (PWT_ADAPTER)FunctionContext; PWTWLAN_TXBUF PTxBuffer; if((Adapter->MacParameter.CurrentState == IBSS_IDLE) || (Adapter->MacParameter.CurrentState == IBSS_ACTIVE) ) { //NdisSetTimer(&Adapter->MacParameter.MacTimer.TBeacon, (ULONG)kUsec((now() + Adapter->MacParameter.mBcnPeriod))); NdisSetTimer(&Adapter->MacParameter.MacTimer.TBeacon, 100); AllocTxMgmt( Adapter, &PTxBuffer); if( PTxBuffer == NULL ) return; NdisZeroMemory( &PTxBuffer->TXHwBuf.pHwTxBuf->TxAUXBuf, sizeof(WTWLAN_TAUXB)); NdisZeroMemory( &PTxBuffer->TXHwBuf.pHwTxBuf->dot11Head, Adapter->MacHwCfg.HeadLen); //TimeStamp为8锟节碉拷悖
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -