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

📄 p80211frm.c

📁 Linux的无线局域网方案是一个Linux设备驱动程序和子系统 一揽子方案的用意是提供全系列的IEEE 802.11标准的Mac 管理功能
💻 C
📖 第 1 页 / 共 3 页
字号:
        f->reason	= (UINT16*)(WLAN_HDR_A3_DATAP(&(f->hdr->a3))                              + WLAN_DISASSOC_OFF_REASON);        /*-- Information elements */        return;}/*--------------------------------------------------------------* wlan_mgmt_encode_assocreq** 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.--------------------------------------------------------------*/void wlan_mgmt_encode_assocreq( wlan_fr_assocreq_t  *f ){        f->type = WLAN_FSTYPE_ASSOCREQ;        f->hdr = (p80211_hdr_t*)f->buf;        WLAN_ASSERT( f->len >= WLAN_ASSOCREQ_FR_MAXLEN );        /*-- Fixed Fields ----*/        f->cap_info		= (UINT16*)(WLAN_HDR_A3_DATAP(&(f->hdr->a3))                                 + WLAN_ASSOCREQ_OFF_CAP_INFO);        f->listen_int	= (UINT16*)(WLAN_HDR_A3_DATAP(&(f->hdr->a3))                                  + WLAN_ASSOCREQ_OFF_LISTEN_INT);        f->len = WLAN_HDR_A3_LEN +                 WLAN_ASSOCREQ_OFF_LISTEN_INT +                 sizeof(*(f->listen_int));        return;}/*--------------------------------------------------------------* wlan_mgmt_decode_assocreq** 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.--------------------------------------------------------------*/void wlan_mgmt_decode_assocreq( wlan_fr_assocreq_t  *f ){        wlan_ie_t	*ie_ptr;        f->type = WLAN_FSTYPE_ASSOCREQ;        f->hdr = (p80211_hdr_t*)f->buf;        WLAN_ASSERT(WLAN_FTYPE_MGMT ==                    WLAN_GET_FC_FTYPE(ieee2host16(f->hdr->a3.fc)));        WLAN_ASSERT(WLAN_FSTYPE_ASSOCREQ ==                    WLAN_GET_FC_FSTYPE(ieee2host16(f->hdr->a3.fc)));        /*-- Fixed Fields ----*/        f->cap_info		= (UINT16*)(WLAN_HDR_A3_DATAP(&(f->hdr->a3))                                 + WLAN_ASSOCREQ_OFF_CAP_INFO);        f->listen_int	= (UINT16*)(WLAN_HDR_A3_DATAP(&(f->hdr->a3))                                  + WLAN_ASSOCREQ_OFF_LISTEN_INT);        /*-- Information elements */        ie_ptr = (wlan_ie_t*)(WLAN_HDR_A3_DATAP(&(f->hdr->a3))                              + WLAN_ASSOCREQ_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 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;}/*--------------------------------------------------------------* wlan_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.--------------------------------------------------------------*/void wlan_mgmt_encode_assocresp( wlan_fr_assocresp_t  *f ){        f->type = WLAN_FSTYPE_ASSOCRESP;        f->hdr = (p80211_hdr_t*)f->buf;        WLAN_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;}/*--------------------------------------------------------------* wlan_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.--------------------------------------------------------------*/void wlan_mgmt_decode_assocresp( wlan_fr_assocresp_t  *f ){        f->type = WLAN_FSTYPE_ASSOCRESP;        f->hdr = (p80211_hdr_t*)f->buf;        WLAN_ASSERT(WLAN_FTYPE_MGMT ==                    WLAN_GET_FC_FTYPE(ieee2host16(f->hdr->a3.fc)));        WLAN_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;}/*--------------------------------------------------------------* wlan_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.--------------------------------------------------------------*/void wlan_mgmt_encode_reassocreq( wlan_fr_reassocreq_t  *f ){        f->type = WLAN_FSTYPE_REASSOCREQ;        f->hdr = (p80211_hdr_t*)f->buf;        WLAN_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;}/*--------------------------------------------------------------* wlan_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.--------------------------------------------------------------*/void wlan_mgmt_decode_reassocreq( wlan_fr_reassocreq_t  *f ){        wlan_ie_t	*ie_ptr;        f->type = WLAN_FSTYPE_REASSOCREQ;        f->hdr = (p80211_hdr_t*)f->buf;        WLAN_ASSERT(WLAN_FTYPE_MGMT ==                    WLAN_GET_FC_FTYPE(ieee2host16(f->hdr->a3.fc)));        WLAN_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;}/*--------------------------------------------------------------* wlan_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.--------------------------------------------------------------*/void wlan_mgmt_encode_reassocresp( wlan_fr_reassocresp_t  *f ){        f->type = WLAN_FSTYPE_REASSOCRESP;        f->hdr = (p80211_hdr_t*)f->buf;        WLAN_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;}/*--------------------------------------------------------------* wlan_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.--------------------------------------------------------------*/void wlan_mgmt_decode_reassocresp( wlan_fr_reassocresp_t  *f ){        f->type = WLAN_FSTYPE_REASSOCRESP;        f->hdr = (p80211_hdr_t*)f->buf;        WLAN_ASSERT(WLAN_FTYPE_MGMT ==                    WLAN_GET_FC_FTYPE(ieee2host16(f->hdr->a3.fc)));        WLAN_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*)

⌨️ 快捷键说明

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