software/drivers/sd8887/src/wlan/mlan/mlan_sta_event.c
/**
 *  @brief This function will handle the generic NAN event for further wlan action
 *   based on the Event subtypes
 *
 *  @param pmpriv     A pointer to mlan_private
 *  @param evt_buf    A pointer to mlan_event
 *  @param pmbuf    A pointer to mlan buffer
 *
 *  @return         N/A
 */
@brief This function will handle the generic NAN event for further wlan action
based on the Event subtypes

@param pmpriv     A pointer to mlan_private
@param evt_buf    A pointer to mlan_event
@param pmbuf    A pointer to mlan buffer

@return         N/A
@brief This function will handle the generic NAN event for further wlan action based on the Event subtypes @param pmpriv A pointer to mlan_private @param evt_buf A pointer to mlan_event @param pmbuf A pointer to mlan buffer @return N / A
static void
wlan_process_nan_event(pmlan_private pmpriv, pmlan_buffer pmbuf)
{
	t_u8 *evt_buf = MNULL;
	mlan_event *pevent;
	mlan_status ret = MLAN_STATUS_SUCCESS;
	event_nan_generic *nan_event = (event_nan_generic *)
		(pmbuf->pbuf + pmbuf->data_offset + sizeof(mlan_event_id));
	pmlan_adapter pmadapter = pmpriv->adapter;
	pmlan_callbacks pcb = &pmadapter->callbacks;
	ENTER();
	ret = pcb->moal_malloc(pmadapter->pmoal_handle, MAX_EVENT_SIZE,
			       MLAN_MEM_DEF, &evt_buf);
	if (ret != MLAN_STATUS_SUCCESS || !evt_buf) {
		LEAVE();
		return;
	}
	pevent = (pmlan_event)evt_buf;
	pevent->bss_index = pmpriv->bss_index;
	if (wlan_le16_to_cpu(nan_event->event_sub_type) ==
	    NAN_EVT_SUBTYPE_SD_EVENT ||
	    wlan_le16_to_cpu(nan_event->event_sub_type) ==
	    NAN_EVT_SUBTYPE_SDF_TX_DONE) {
		pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU;
		pevent->event_len = pmbuf->data_len;
		memcpy(pmadapter, (t_u8 *)pevent->event_buf,
		       pmbuf->pbuf + pmbuf->data_offset, pevent->event_len);
		wlan_recv_event(pmpriv, pevent->event_id, pevent);
		pcb->moal_mfree(pmadapter->pmoal_handle, evt_buf);
	} else {
		t_u8 test_mac[MLAN_MAC_ADDR_LENGTH]
		= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
		pevent->event_id = MLAN_EVENT_ID_DRV_CONNECTED;
		pevent->event_len = MLAN_MAC_ADDR_LENGTH;
		memcpy(pmpriv->adapter, (t_u8 *)pevent->event_buf,
		       test_mac, MLAN_MAC_ADDR_LENGTH);
		wlan_ralist_add(pmpriv, test_mac);
		memcpy(pmpriv->adapter,
		       pmpriv->curr_bss_params.bss_descriptor.mac_address,
		       test_mac, MLAN_MAC_ADDR_LENGTH);
		wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_CONNECTED, pevent);
		if (pmpriv->port_ctrl_mode == MTRUE)
			pmpriv->port_open = MTRUE;
		pmpriv->media_connected = MTRUE;
		PRINTM_NETINTF(MEVENT, pmpriv);
		PRINTM(MEVENT, "nan interface - opened\n");
		pcb->moal_mfree(pmadapter->pmoal_handle, evt_buf);
	}
	LEAVE();
	return;
}
static void wlan_process_nan_event ( pmlan_private pmpriv , pmlan_buffer pmbuf ) { t_u8 * evt_buf = MNULL ; mlan_event * pevent ; mlan_status ret = MLAN_STATUS_SUCCESS ; event_nan_generic * nan_event = ( event_nan_generic * ) ( pmbuf -> pbuf + pmbuf -> data_offset + sizeof ( mlan_event_id ) ) ; pmlan_adapter pmadapter = pmpriv -> adapter ; pmlan_callbacks pcb = & pmadapter -> callbacks ; ENTER ( ) ; ret = pcb -> moal_malloc ( pmadapter -> pmoal_handle , MAX_EVENT_SIZE , MLAN_MEM_DEF , & evt_buf ) ; if ( ret != MLAN_STATUS_SUCCESS || ! evt_buf ) { LEAVE ( ) ; return ; } pevent = ( pmlan_event ) evt_buf ; pevent -> bss_index = pmpriv -> bss_index ; if ( wlan_le16_to_cpu ( nan_event -> event_sub_type ) == NAN_EVT_SUBTYPE_SD_EVENT || wlan_le16_to_cpu ( nan_event -> event_sub_type ) == NAN_EVT_SUBTYPE_SDF_TX_DONE ) { pevent -> event_id = MLAN_EVENT_ID_DRV_PASSTHRU ; pevent -> event_len = pmbuf -> data_len ; memcpy ( pmadapter , ( t_u8 * ) pevent -> event_buf , pmbuf -> pbuf + pmbuf -> data_offset , pevent -> event_len ) ; wlan_recv_event ( pmpriv , pevent -> event_id , pevent ) ; pcb -> moal_mfree ( pmadapter -> pmoal_handle , evt_buf ) ; } else { t_u8 test_mac [ MLAN_MAC_ADDR_LENGTH ] = { 0x00 , 0x11 , 0x22 , 0x33 , 0x44 , 0x55 } ; pevent -> event_id = MLAN_EVENT_ID_DRV_CONNECTED ; pevent -> event_len = MLAN_MAC_ADDR_LENGTH ; memcpy ( pmpriv -> adapter , ( t_u8 * ) pevent -> event_buf , test_mac , MLAN_MAC_ADDR_LENGTH ) ; wlan_ralist_add ( pmpriv , test_mac ) ; memcpy ( pmpriv -> adapter , pmpriv -> curr_bss_params . bss_descriptor . mac_address , test_mac , MLAN_MAC_ADDR_LENGTH ) ; wlan_recv_event ( pmpriv , MLAN_EVENT_ID_DRV_CONNECTED , pevent ) ; if ( pmpriv -> port_ctrl_mode == MTRUE ) pmpriv -> port_open = MTRUE ; pmpriv -> media_connected = MTRUE ; PRINTM_NETINTF ( MEVENT , pmpriv ) ; PRINTM ( MEVENT , " \n " ) ; pcb -> moal_mfree ( pmadapter -> pmoal_handle , evt_buf ) ; } LEAVE ( ) ; return ; }
@brief This function will handle the generic NAN event for further wlan action
   based on the Event subtypes
@brief This function will handle the generic NAN event for further wlan action based on the Event subtypes