software/drivers/sd8887/src/wlan/mapp/mlanutl/mlanoffload.c
/**
 *  @brief Retrieve the association response from the driver
 *
 *  Retrieve the buffered (re)association management frame from the driver.
 *    The response is identical to the one received from the AP and conforms
 *    to the IEEE specification.
 *
 *  @return MLAN_STATUS_SUCCESS or ioctl error code
 */
@brief Retrieve the association response from the driver
Retrieve the buffered (re)association management frame from the driver.
The response is identical to the one received from the AP and conforms
to the IEEE specification.

@return MLAN_STATUS_SUCCESS or ioctl error code
@brief Retrieve the association response from the driver Retrieve the buffered ( re ) association management frame from the driver . The response is identical to the one received from the AP and conforms to the IEEE specification . @return MLAN_STATUS_SUCCESS or ioctl error code
int
process_get_assocrsp(int argc, char *argv[])
{
	int ret = 0;
	t_u8 *buffer = NULL;
	struct eth_priv_cmd *cmd = NULL;
	struct ifreq ifr;
	IEEEtypes_AssocRsp_t *pAssocRsp = NULL;
	buffer = (t_u8 *)malloc(BUFFER_LENGTH);
	if (!buffer) {
		printf("ERR:Cannot allocate buffer for command!\n");
		return MLAN_STATUS_FAILURE;
	}
	pAssocRsp = (IEEEtypes_AssocRsp_t *)buffer;
	strncpy((char *)buffer, CMD_NXP, strlen(CMD_NXP));
	strncpy((char *)buffer + strlen(CMD_NXP), argv[2], strlen(argv[2]));
	cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd));
	if (!cmd) {
		printf("ERR:Cannot allocate buffer for command!\n");
		free(buffer);
		return MLAN_STATUS_FAILURE;
	}
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
	memset(cmd, 0, sizeof(struct eth_priv_cmd));
	memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
	cmd->buf = buffer;
#endif
	cmd->used_len = 0;
	cmd->total_len = BUFFER_LENGTH;
	memset(&ifr, 0, sizeof(struct ifreq));
	strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
	ifr.ifr_ifru.ifru_data = (void *)cmd;
	if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
		perror("mlanutl");
		fprintf(stderr, "mlanutl: version fail\n");
		ret = MLAN_STATUS_FAILURE;
		goto done;
	}
	if (cmd->used_len) {
		printf("getassocrsp: Status[%d], Cap[0x%04x]:\n",
		       pAssocRsp->StatusCode,
		       le16_to_cpu(*(t_u16 *)&pAssocRsp->Capability));
		hexdump(NULL, buffer, cmd->used_len, ' ');
	} else {
		printf("getassocrsp: <empty>\n");
	}
done:
	if (buffer)
		free(buffer);
	if (cmd)
		free(cmd);
	return ret;
}
int process_get_assocrsp ( int argc , char * argv [ ] ) { int ret = 0 ; t_u8 * buffer = NULL ; struct eth_priv_cmd * cmd = NULL ; struct ifreq ifr ; IEEEtypes_AssocRsp_t * pAssocRsp = NULL ; buffer = ( t_u8 * ) malloc ( BUFFER_LENGTH ) ; if ( ! buffer ) { printf ( " \n " ) ; return MLAN_STATUS_FAILURE ; } pAssocRsp = ( IEEEtypes_AssocRsp_t * ) buffer ; strncpy ( ( char * ) buffer , CMD_NXP , strlen ( CMD_NXP ) ) ; strncpy ( ( char * ) buffer + strlen ( CMD_NXP ) , argv [ 2 ] , strlen ( argv [ 2 ] ) ) ; cmd = ( struct eth_priv_cmd * ) malloc ( sizeof ( struct eth_priv_cmd ) ) ; if ( ! cmd ) { printf ( " \n " ) ; free ( buffer ) ; return MLAN_STATUS_FAILURE ; } #ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT memset ( cmd , 0 , sizeof ( struct eth_priv_cmd ) ) ; memcpy ( & cmd -> buf , & buffer , sizeof ( buffer ) ) ; #else cmd -> buf = buffer ; #endif cmd -> used_len = 0 ; cmd -> total_len = BUFFER_LENGTH ; memset ( & ifr , 0 , sizeof ( struct ifreq ) ) ; strncpy ( ifr . ifr_ifrn . ifrn_name , dev_name , strlen ( dev_name ) ) ; ifr . ifr_ifru . ifru_data = ( void * ) cmd ; if ( ioctl ( sockfd , MLAN_ETH_PRIV , & ifr ) ) { perror ( " " ) ; fprintf ( stderr , " \n " ) ; ret = MLAN_STATUS_FAILURE ; goto done ; } if ( cmd -> used_len ) { printf ( " \n " , pAssocRsp -> StatusCode , le16_to_cpu ( * ( t_u16 * ) & pAssocRsp -> Capability ) ) ; hexdump ( NULL , buffer , cmd -> used_len , ' ' ) ; } else { printf ( " \n " ) ; } done : if ( buffer ) free ( buffer ) ; if ( cmd ) free ( cmd ) ; return ret ; }
@brief Retrieve the association response from the driver
  Retrieve the buffered (re)association management frame from the driver.
@brief Retrieve the association response from the driver Retrieve the buffered ( re ) association management frame from the driver .
/* Initialize buffer */ /* buffer = MRVL_CMD<cmd> */ /* Fill up buffer */ /* Perform IOCTL */