software/drivers/sd8887/src/wlan/mapp/mlanevent/mlanevent.c
/**
 *  @brief Parse and print TDLS generic event data
 *
 *  @param buffer   Pointer to received buffer
 *  @param size     Length of the received event data
 *  @return         N/A
 */
@brief Parse and print TDLS generic event data
@param buffer   Pointer to received buffer
@param size     Length of the received event data
@return         N/A
@brief Parse and print TDLS generic event data @param buffer Pointer to received buffer @param size Length of the received event data @return N / A
void
print_event_tdls_generic(t_u8 *buffer, t_u16 size)
{
	eventbuf_tdls_generic *tdls_event;
	eventbuf_tdls_debug *tdls_debug;
	eventbuf_tdls_packet *tdls_pkt;
	printf("EVENT: TDLS\n");
	tdls_event = (eventbuf_tdls_generic *)(buffer);
	printf("Event Type = ");
	switch (uap_le16_to_cpu(tdls_event->event_type)) {
	case TDLS_EVENT_TYPE_SETUP_FAILURE:
		printf("TDLS setup failure\n");
		break;
	case TDLS_EVENT_TYPE_SETUP_REQ_RCVD:
		printf("TDLS setup request received from peer\n");
		break;
	case TDLS_EVENT_TYPE_LINK_TORN_DOWN:
		printf("TDLS link torn down\n");
		break;
	case TDLS_EVENT_TYPE_LINK_ESTABLISHED:
		printf("TDLS link established\n");
		break;
	case TDLS_EVENT_TYPE_DEBUG:
		tdls_debug = (eventbuf_tdls_debug *)(buffer);
		printf("TDLS debug event, ");
		printf("TSF  = %lld\n", uap_le64_to_cpu(tdls_debug->tsf));
		printf("String = ");
		printf((char *)(tdls_debug->string),
		       uap_le32_to_cpu(tdls_debug->first_arg),
		       uap_le32_to_cpu(tdls_debug->second_arg),
		       uap_le32_to_cpu(tdls_debug->third_arg));
		printf("\n");
		return;
	case TDLS_EVENT_TYPE_PACKET:
		tdls_pkt = (eventbuf_tdls_packet *)(buffer);
		printf("TDLS packet len=%d\n", tdls_pkt->length);
		hexdump((t_u8 *)tdls_pkt->data, tdls_pkt->length, ' ');
		return;
	case TDLS_EVENT_TYPE_CHAN_SWITCH_RESULT:
		if (tdls_event->u.switch_result.status) {
			printf("TDLS Channel Switch Failed! current channel=%d Reasoncode %d\n", tdls_event->u.switch_result.current_channel, tdls_event->u.switch_result.reason);
		} else {
			printf("TDLS Channel Switch Successful. current channel=%d\n", tdls_event->u.switch_result.current_channel);
		}
		break;
	case TDLS_EVENT_TYPE_START_CHAN_SWITCH:
		printf("TDLS Start channel switch...\n");
		break;
	case TDLS_EVENT_TYPE_CHAN_SWITCH_STOPPED:
		printf("TDLS Channel Switch stopped! reason=%d\n",
		       tdls_event->u.cs_stop_reason);
		break;
	default:
		printf("Unknown\n");
		break;
	}
	printf("Peer Mac Address - ");
	print_mac(tdls_event->peer_mac_addr);
	printf("\n");
	if (uap_le16_to_cpu(tdls_event->event_type) ==
	    TDLS_EVENT_TYPE_SETUP_FAILURE) {
		switch (uap_le16_to_cpu(tdls_event->u.reason_code)) {
		case 1:
			printf("Reason Code = Internal error\n");
			break;
		case 7:
			printf("Reason Code = Timeout waiting for response\n");
			break;
		case 8:
			printf("Reason Code = Non-zero setup response status\n");
			break;
		default:
			printf("Reason Code = %d\n",
			       uap_le16_to_cpu(tdls_event->u.reason_code));
			break;
		}
	} else if (uap_le16_to_cpu(tdls_event->event_type) ==
		   TDLS_EVENT_TYPE_LINK_TORN_DOWN) {
		switch (uap_le16_to_cpu(tdls_event->u.reason_code)) {
		case 3:
			printf("Reason Code = Peer station is leaving BSS\n");
			break;
		case 25:
			printf("Reason Code = Peer station is unreachable on direct link\n");
			break;
		case 26:
			printf("Reason Code = Unspecified\n");
			break;
		case 211:
			printf("Reason Code = Setup received from TDLS peer\n");
			break;
		case 212:
			printf("Reason Code = Clearing TDLS connections due to deauth/disassoc\n");
			break;
		default:
			printf("Reason Code = %d\n",
			       uap_le16_to_cpu(tdls_event->u.reason_code));
			break;
		}
	} else if (uap_le16_to_cpu(tdls_event->event_type) ==
		   TDLS_EVENT_TYPE_LINK_ESTABLISHED) {
		int ie_len = uap_le16_to_cpu(tdls_event->u.ie_length);
		if (ie_len) {
			printf("Peer IE len=%d\n", ie_len);
			hexdump((t_u8 *)tdls_event->ie_ptr, ie_len, ' ');
		}
	}
}
void print_event_tdls_generic ( t_u8 * buffer , t_u16 size ) { eventbuf_tdls_generic * tdls_event ; eventbuf_tdls_debug * tdls_debug ; eventbuf_tdls_packet * tdls_pkt ; printf ( " \n " ) ; tdls_event = ( eventbuf_tdls_generic * ) ( buffer ) ; printf ( " " ) ; switch ( uap_le16_to_cpu ( tdls_event -> event_type ) ) { case TDLS_EVENT_TYPE_SETUP_FAILURE : printf ( " \n " ) ; break ; case TDLS_EVENT_TYPE_SETUP_REQ_RCVD : printf ( " \n " ) ; break ; case TDLS_EVENT_TYPE_LINK_TORN_DOWN : printf ( " \n " ) ; break ; case TDLS_EVENT_TYPE_LINK_ESTABLISHED : printf ( " \n " ) ; break ; case TDLS_EVENT_TYPE_DEBUG : tdls_debug = ( eventbuf_tdls_debug * ) ( buffer ) ; printf ( " " ) ; printf ( " \n " , uap_le64_to_cpu ( tdls_debug -> tsf ) ) ; printf ( " " ) ; printf ( ( char * ) ( tdls_debug -> string ) , uap_le32_to_cpu ( tdls_debug -> first_arg ) , uap_le32_to_cpu ( tdls_debug -> second_arg ) , uap_le32_to_cpu ( tdls_debug -> third_arg ) ) ; printf ( " \n " ) ; return ; case TDLS_EVENT_TYPE_PACKET : tdls_pkt = ( eventbuf_tdls_packet * ) ( buffer ) ; printf ( " \n " , tdls_pkt -> length ) ; hexdump ( ( t_u8 * ) tdls_pkt -> data , tdls_pkt -> length , ' ' ) ; return ; case TDLS_EVENT_TYPE_CHAN_SWITCH_RESULT : if ( tdls_event -> u . switch_result . status ) { printf ( " \n " , tdls_event -> u . switch_result . current_channel , tdls_event -> u . switch_result . reason ) ; } else { printf ( " \n " , tdls_event -> u . switch_result . current_channel ) ; } break ; case TDLS_EVENT_TYPE_START_CHAN_SWITCH : printf ( " \n " ) ; break ; case TDLS_EVENT_TYPE_CHAN_SWITCH_STOPPED : printf ( " \n " , tdls_event -> u . cs_stop_reason ) ; break ; default : printf ( " \n " ) ; break ; } printf ( " " ) ; print_mac ( tdls_event -> peer_mac_addr ) ; printf ( " \n " ) ; if ( uap_le16_to_cpu ( tdls_event -> event_type ) == TDLS_EVENT_TYPE_SETUP_FAILURE ) { switch ( uap_le16_to_cpu ( tdls_event -> u . reason_code ) ) { case 1 : printf ( " \n " ) ; break ; case 7 : printf ( " \n " ) ; break ; case 8 : printf ( " \n " ) ; break ; default : printf ( " \n " , uap_le16_to_cpu ( tdls_event -> u . reason_code ) ) ; break ; } } else if ( uap_le16_to_cpu ( tdls_event -> event_type ) == TDLS_EVENT_TYPE_LINK_TORN_DOWN ) { switch ( uap_le16_to_cpu ( tdls_event -> u . reason_code ) ) { case 3 : printf ( " \n " ) ; break ; case 25 : printf ( " \n " ) ; break ; case 26 : printf ( " \n " ) ; break ; case 211 : printf ( " \n " ) ; break ; case 212 : printf ( " \n " ) ; break ; default : printf ( " \n " , uap_le16_to_cpu ( tdls_event -> u . reason_code ) ) ; break ; } } else if ( uap_le16_to_cpu ( tdls_event -> event_type ) == TDLS_EVENT_TYPE_LINK_ESTABLISHED ) { int ie_len = uap_le16_to_cpu ( tdls_event -> u . ie_length ) ; if ( ie_len ) { printf ( " \n " , ie_len ) ; hexdump ( ( t_u8 * ) tdls_event -> ie_ptr , ie_len , ' ' ) ; } } }
@brief Parse and print TDLS generic event data
  @param buffer   Pointer to received buffer
  @param size     Length of the received event data
  @return         N/A
@brief Parse and print TDLS generic event data @param buffer Pointer to received buffer @param size Length of the received event data @return N / A