software/drivers/sd8887/src/wlan/mlan/mlan_uap_cmdevent.c
/**
 *  @brief This function send sta_assoc_event to moal
 *          payload with sta mac address and assoc ie.
 *
 *  @param priv    A pointer to mlan_private
 *  @param pevent  A pointer to mlan_event buffer
 *  @param pbuf    A pointer to mlan_buffer which has event content.
 *
 *  @return	       MFALSE
 */
@brief This function send sta_assoc_event to moal
payload with sta mac address and assoc ie.

@param priv    A pointer to mlan_private
@param pevent  A pointer to mlan_event buffer
@param pbuf    A pointer to mlan_buffer which has event content.

@return            MFALSE
@brief This function send sta_assoc_event to moal payload with sta mac address and assoc ie . @param priv A pointer to mlan_private @param pevent A pointer to mlan_event buffer @param pbuf A pointer to mlan_buffer which has event content . @return MFALSE
static t_u32
wlan_process_sta_assoc_event(pmlan_private priv, mlan_event *pevent,
			     pmlan_buffer pmbuf)
{
	t_u32 ret = MFALSE;
	t_u16 tlv_type, tlv_len;
	t_u16 frame_control, frame_sub_type = 0;
	t_u8 *assoc_req_ie = MNULL;
	t_u8 ie_len = 0, assoc_ie_len = 0;
	int tlv_buf_left = pmbuf->data_len - ASSOC_EVENT_FIX_SIZE;
	MrvlIEtypesHeader_t *tlv = (MrvlIEtypesHeader_t *)
		(pmbuf->pbuf + pmbuf->data_offset + ASSOC_EVENT_FIX_SIZE);
	MrvlIETypes_MgmtFrameSet_t *mgmt_tlv = MNULL;
	ENTER();
	pevent->event_id = MLAN_EVENT_ID_UAP_FW_STA_CONNECT;
	pevent->bss_index = priv->bss_index;
	pevent->event_len = MLAN_MAC_ADDR_LENGTH;
	memcpy(priv->adapter, pevent->event_buf,
	       pmbuf->pbuf + pmbuf->data_offset + 6, pevent->event_len);
	while (tlv_buf_left >= (int)sizeof(MrvlIEtypesHeader_t)) {
		tlv_type = wlan_le16_to_cpu(tlv->type);
		tlv_len = wlan_le16_to_cpu(tlv->len);
		if ((sizeof(MrvlIEtypesHeader_t) + tlv_len) >
		    (unsigned int)tlv_buf_left) {
			PRINTM(MERROR, "wrong tlv: tlvLen=%d, tlvBufLeft=%d\n",
			       tlv_len, tlv_buf_left);
			break;
		}
		if (tlv_type == TLV_TYPE_MGMT_FRAME) {
			mgmt_tlv = (MrvlIETypes_MgmtFrameSet_t *)tlv;
			memcpy(priv->adapter, &frame_control,
			       (t_u8 *)&(mgmt_tlv->frame_control),
			       sizeof(frame_control));
			frame_sub_type =
				IEEE80211_GET_FC_MGMT_FRAME_SUBTYPE
				(frame_control);
			if ((mgmt_tlv->frame_control.type == 0) &&
			    ((frame_sub_type == SUBTYPE_ASSOC_REQUEST) ||
			     (frame_sub_type == SUBTYPE_REASSOC_REQUEST))) {
				if (frame_sub_type == SUBTYPE_ASSOC_REQUEST)
					assoc_ie_len =
						sizeof(IEEEtypes_AssocRqst_t);
				else if (frame_sub_type ==
					 SUBTYPE_REASSOC_REQUEST)
					assoc_ie_len =
						sizeof(IEEEtypes_ReAssocRqst_t);
				ie_len = tlv_len -
					sizeof(IEEEtypes_FrameCtl_t) -
					assoc_ie_len;
				assoc_req_ie =
					(t_u8 *)tlv +
					sizeof(MrvlIETypes_MgmtFrameSet_t) +
					assoc_ie_len;
				memcpy(priv->adapter,
				       pevent->event_buf + pevent->event_len,
				       assoc_req_ie, ie_len);
				pevent->event_len += ie_len;
				break;
			}
		}
		tlv_buf_left -= (sizeof(MrvlIEtypesHeader_t) + tlv_len);
		tlv = (MrvlIEtypesHeader_t *)((t_u8 *)tlv + tlv_len +
					      sizeof(MrvlIEtypesHeader_t));
	}
	PRINTM(MEVENT, "STA assoc event len=%d\n", pevent->event_len);
	DBG_HEXDUMP(MCMD_D, "STA assoc event", pevent->event_buf,
		    pevent->event_len);
	wlan_recv_event(priv, pevent->event_id, pevent);
	LEAVE();
	return ret;
}
static t_u32 wlan_process_sta_assoc_event ( pmlan_private priv , mlan_event * pevent , pmlan_buffer pmbuf ) { t_u32 ret = MFALSE ; t_u16 tlv_type , tlv_len ; t_u16 frame_control , frame_sub_type = 0 ; t_u8 * assoc_req_ie = MNULL ; t_u8 ie_len = 0 , assoc_ie_len = 0 ; int tlv_buf_left = pmbuf -> data_len - ASSOC_EVENT_FIX_SIZE ; MrvlIEtypesHeader_t * tlv = ( MrvlIEtypesHeader_t * ) ( pmbuf -> pbuf + pmbuf -> data_offset + ASSOC_EVENT_FIX_SIZE ) ; MrvlIETypes_MgmtFrameSet_t * mgmt_tlv = MNULL ; ENTER ( ) ; pevent -> event_id = MLAN_EVENT_ID_UAP_FW_STA_CONNECT ; pevent -> bss_index = priv -> bss_index ; pevent -> event_len = MLAN_MAC_ADDR_LENGTH ; memcpy ( priv -> adapter , pevent -> event_buf , pmbuf -> pbuf + pmbuf -> data_offset + 6 , pevent -> event_len ) ; while ( tlv_buf_left >= ( int ) sizeof ( MrvlIEtypesHeader_t ) ) { tlv_type = wlan_le16_to_cpu ( tlv -> type ) ; tlv_len = wlan_le16_to_cpu ( tlv -> len ) ; if ( ( sizeof ( MrvlIEtypesHeader_t ) + tlv_len ) > ( unsigned int ) tlv_buf_left ) { PRINTM ( MERROR , " \n " , tlv_len , tlv_buf_left ) ; break ; } if ( tlv_type == TLV_TYPE_MGMT_FRAME ) { mgmt_tlv = ( MrvlIETypes_MgmtFrameSet_t * ) tlv ; memcpy ( priv -> adapter , & frame_control , ( t_u8 * ) & ( mgmt_tlv -> frame_control ) , sizeof ( frame_control ) ) ; frame_sub_type = IEEE80211_GET_FC_MGMT_FRAME_SUBTYPE ( frame_control ) ; if ( ( mgmt_tlv -> frame_control . type == 0 ) && ( ( frame_sub_type == SUBTYPE_ASSOC_REQUEST ) || ( frame_sub_type == SUBTYPE_REASSOC_REQUEST ) ) ) { if ( frame_sub_type == SUBTYPE_ASSOC_REQUEST ) assoc_ie_len = sizeof ( IEEEtypes_AssocRqst_t ) ; else if ( frame_sub_type == SUBTYPE_REASSOC_REQUEST ) assoc_ie_len = sizeof ( IEEEtypes_ReAssocRqst_t ) ; ie_len = tlv_len - sizeof ( IEEEtypes_FrameCtl_t ) - assoc_ie_len ; assoc_req_ie = ( t_u8 * ) tlv + sizeof ( MrvlIETypes_MgmtFrameSet_t ) + assoc_ie_len ; memcpy ( priv -> adapter , pevent -> event_buf + pevent -> event_len , assoc_req_ie , ie_len ) ; pevent -> event_len += ie_len ; break ; } } tlv_buf_left -= ( sizeof ( MrvlIEtypesHeader_t ) + tlv_len ) ; tlv = ( MrvlIEtypesHeader_t * ) ( ( t_u8 * ) tlv + tlv_len + sizeof ( MrvlIEtypesHeader_t ) ) ; } PRINTM ( MEVENT , " \n " , pevent -> event_len ) ; DBG_HEXDUMP ( MCMD_D , " " , pevent -> event_buf , pevent -> event_len ) ; wlan_recv_event ( priv , pevent -> event_id , pevent ) ; LEAVE ( ) ; return ret ; }
@brief This function send sta_assoc_event to moal
          payload with sta mac address and assoc ie.
@brief This function send sta_assoc_event to moal payload with sta mac address and assoc ie .