software/drivers/sd8887/src/wlan/mapp/mlanconfig/mlanconfig.c
/**
 *  @brief Send an ADDTS command to the associated AP
 *
 *  Process a given conf file for a specific TSPEC data block.  Send the
 *    TSPEC along with any other IEs to the driver/firmware for transmission
 *    in an ADDTS request to the associated AP.
 *
 *  Return the execution status of the command as well as the ADDTS response
 *    from the AP if any.
 *
 *  mlanconfig mlanX addts <filename.conf> <section# of tspec> <timeout in ms>
 *
 *  @param argc     number of arguments
 *  @param argv     A pointer to arguments array
 *
 *  @return         MLAN_STATUS_SUCCESS--success, otherwise--fail
 */
@brief Send an ADDTS command to the associated AP
Process a given conf file for a specific TSPEC data block.  Send the
TSPEC along with any other IEs to the driver/firmware for transmission
in an ADDTS request to the associated AP.

Return the execution status of the command as well as the ADDTS response
from the AP if any.

mlanconfig mlanX addts   

@param argc     number of arguments
@param argv     A pointer to arguments array


@brief Send an ADDTS command to the associated AP Process a given conf file for a specific TSPEC data block . Send the TSPEC along with any other IEs to the driver / firmware for transmission in an ADDTS request to the associated AP . Return the execution status of the command as well as the ADDTS response from the AP if any . mlanconfig mlanX addts @param argc number of arguments @param argv A pointer to arguments array
static int
process_addts(int argc, char *argv[])
{
	int ioctl_val, subioctl_val;
	struct iwreq iwr;
	wlan_ioctl_wmm_addts_req_t addtsReq;
	FILE *fp = NULL;
	char filename[48];
	char config_id[20];
	memset(&addtsReq, 0x00, sizeof(addtsReq));
	memset(filename, 0x00, sizeof(filename));
	if (get_priv_ioctl("addts",
			   &ioctl_val, &subioctl_val) == MLAN_STATUS_FAILURE) {
		return -EOPNOTSUPP;
	}
	if (argc != 6) {
		fprintf(stderr, "Invalid number of parameters!\n");
		return -EINVAL;
	}
	strncpy(filename, argv[3], sizeof(filename) - 1);
	if ((fp = fopen(filename, "r")) == NULL) {
		perror("fopen");
		fprintf(stderr, "Cannot open file %s\n", argv[3]);
		return -EFAULT;;
	}
	snprintf(config_id, sizeof(config_id), "tspec%d", atoi(argv[4]));
	addtsReq.ieDataLen = fparse_for_cmd_and_hex(fp,
						    addtsReq.ieData,
						    (t_u8 *)config_id);
	if (addtsReq.ieDataLen > 0) {
		printf("Found %d bytes in the %s section of conf file %s\n",
		       (int)addtsReq.ieDataLen, config_id, filename);
	} else {
		fprintf(stderr, "section %s not found in %s\n",
			config_id, filename);
		if (fp)
			fclose(fp);
		return -EFAULT;
	}
	addtsReq.timeout_ms = atoi(argv[5]);
	printf("Cmd Input:\n");
	hexdump(config_id, addtsReq.ieData, addtsReq.ieDataLen, ' ');
	strncpy(iwr.ifr_name, dev_name, IFNAMSIZ - 1);
	iwr.u.data.flags = subioctl_val;
	iwr.u.data.pointer = (caddr_t) & addtsReq;
	iwr.u.data.length = (sizeof(addtsReq)
			     - sizeof(addtsReq.ieData)
			     + addtsReq.ieDataLen);
	if (ioctl(sockfd, ioctl_val, &iwr) < 0) {
		perror("mlanconfig: addts ioctl");
		if (fp)
			fclose(fp);
		return -EFAULT;
	}
	printf("Cmd Output:\n");
	printf("ADDTS Command Result = %d\n", addtsReq.commandResult);
	printf("ADDTS IEEE Status    = %d\n", addtsReq.ieeeStatusCode);
	hexdump(config_id, addtsReq.ieData, addtsReq.ieDataLen, ' ');
	if (fp)
		fclose(fp);
	return MLAN_STATUS_SUCCESS;
}
static int process_addts ( int argc , char * argv [ ] ) { int ioctl_val , subioctl_val ; struct iwreq iwr ; wlan_ioctl_wmm_addts_req_t addtsReq ; FILE * fp = NULL ; char filename [ 48 ] ; char config_id [ 20 ] ; memset ( & addtsReq , 0x00 , sizeof ( addtsReq ) ) ; memset ( filename , 0x00 , sizeof ( filename ) ) ; if ( get_priv_ioctl ( " " , & ioctl_val , & subioctl_val ) == MLAN_STATUS_FAILURE ) { return - EOPNOTSUPP ; } if ( argc != 6 ) { fprintf ( stderr , " \n " ) ; return - EINVAL ; } strncpy ( filename , argv [ 3 ] , sizeof ( filename ) - 1 ) ; if ( ( fp = fopen ( filename , " " ) ) == NULL ) { perror ( " " ) ; fprintf ( stderr , " \n " , argv [ 3 ] ) ; return - EFAULT ; ; } snprintf ( config_id , sizeof ( config_id ) , " " , atoi ( argv [ 4 ] ) ) ; addtsReq . ieDataLen = fparse_for_cmd_and_hex ( fp , addtsReq . ieData , ( t_u8 * ) config_id ) ; if ( addtsReq . ieDataLen > 0 ) { printf ( " \n " , ( int ) addtsReq . ieDataLen , config_id , filename ) ; } else { fprintf ( stderr , " \n " , config_id , filename ) ; if ( fp ) fclose ( fp ) ; return - EFAULT ; } addtsReq . timeout_ms = atoi ( argv [ 5 ] ) ; printf ( " \n " ) ; hexdump ( config_id , addtsReq . ieData , addtsReq . ieDataLen , ' ' ) ; strncpy ( iwr . ifr_name , dev_name , IFNAMSIZ - 1 ) ; iwr . u . data . flags = subioctl_val ; iwr . u . data . pointer = ( caddr_t ) & addtsReq ; iwr . u . data . length = ( sizeof ( addtsReq ) - sizeof ( addtsReq . ieData ) + addtsReq . ieDataLen ) ; if ( ioctl ( sockfd , ioctl_val , & iwr ) < 0 ) { perror ( " " ) ; if ( fp ) fclose ( fp ) ; return - EFAULT ; } printf ( " \n " ) ; printf ( " \n " , addtsReq . commandResult ) ; printf ( " \n " , addtsReq . ieeeStatusCode ) ; hexdump ( config_id , addtsReq . ieData , addtsReq . ieDataLen , ' ' ) ; if ( fp ) fclose ( fp ) ; return MLAN_STATUS_SUCCESS ; }
@brief Send an ADDTS command to the associated AP
  Process a given conf file for a specific TSPEC data block.
@brief Send an ADDTS command to the associated AP Process a given conf file for a specific TSPEC data block .