software/drivers/sd8887/src/wlan/mapp/uaputl/uaputl.c
/**
 *  @brief Creates addbareject request and send to driver
 *
 *
 *  @param argc     Number of arguments
 *  @param argv     Pointer to the arguments
 *  @return         UAP_SUCCESS/UAP_FAILURE
 */
@brief Creates addbareject request and send to driver
@param argc     Number of arguments
@param argv     Pointer to the arguments
@return         UAP_SUCCESS/UAP_FAILURE
@brief Creates addbareject request and send to driver @param argc Number of arguments @param argv Pointer to the arguments @return UAP_SUCCESS / UAP_FAILURE
int
apcmd_addbareject(int argc, char *argv[])
{
	int opt;
	addba_reject_para param;
	struct ifreq ifr;
	t_s32 sockfd;
	int i;
	while ((opt = getopt_long(argc, argv, "+", cmd_options, NULL)) != -1) {
		switch (opt) {
		default:
			print_addba_reject_usage();
			return UAP_SUCCESS;
		}
	}
	argc -= optind;
	argv += optind;
	memset(&param, 0, sizeof(param));
	if ((argc != 0) && (argc != 8)) {
		printf("ERR:wrong arguments. Only support 0 or 8 arguments\n");
		print_addba_reject_usage();
		return UAP_FAILURE;
	}
	param.subcmd = UAP_ADDBA_REJECT;
	if (argc) {
		for (i = 0; i < argc; i++) {
			if ((ISDIGIT(argv[i]) == UAP_FAILURE) ||
			    (atoi(argv[i]) < 0) || (atoi(argv[i]) > 1)) {
				printf("ERR: Only allow 0 or 1\n");
				print_addba_reject_usage();
				return UAP_FAILURE;
			}
		}
		param.action = 1;
		for (i = 0; i < MAX_NUM_TID; i++) {
			param.addba_reject[i] = (t_u8)atoi(argv[i]);
		}
	} else {
		param.action = 0;
	}
	if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
		printf("ERR:Cannot open socket\n");
		return UAP_FAILURE;
	}
	memset(&ifr, 0, sizeof(ifr));
	strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, IFNAMSIZ - 1);
	ifr.ifr_ifru.ifru_data = (void *)&param;
	errno = 0;
	if (ioctl(sockfd, UAP_IOCTL_CMD, &ifr)) {
		perror("");
		printf("ERR: addba reject table failed\n");
		close(sockfd);
		return UAP_FAILURE;
	}
	if (!argc) {
		printf("addba reject table: ");
		for (i = 0; i < MAX_NUM_TID; i++) {
			printf("%d ", param.addba_reject[i]);
		}
		printf("\n");
	}
	close(sockfd);
	return UAP_SUCCESS;
}
int apcmd_addbareject ( int argc , char * argv [ ] ) { int opt ; addba_reject_para param ; struct ifreq ifr ; t_s32 sockfd ; int i ; while ( ( opt = getopt_long ( argc , argv , " " , cmd_options , NULL ) ) != -1 ) { switch ( opt ) { default : print_addba_reject_usage ( ) ; return UAP_SUCCESS ; } } argc -= optind ; argv += optind ; memset ( & param , 0 , sizeof ( param ) ) ; if ( ( argc != 0 ) && ( argc != 8 ) ) { printf ( " \n " ) ; print_addba_reject_usage ( ) ; return UAP_FAILURE ; } param . subcmd = UAP_ADDBA_REJECT ; if ( argc ) { for ( i = 0 ; i < argc ; i ++ ) { if ( ( ISDIGIT ( argv [ i ] ) == UAP_FAILURE ) || ( atoi ( argv [ i ] ) < 0 ) || ( atoi ( argv [ i ] ) > 1 ) ) { printf ( " \n " ) ; print_addba_reject_usage ( ) ; return UAP_FAILURE ; } } param . action = 1 ; for ( i = 0 ; i < MAX_NUM_TID ; i ++ ) { param . addba_reject [ i ] = ( t_u8 ) atoi ( argv [ i ] ) ; } } else { param . action = 0 ; } if ( ( sockfd = socket ( AF_INET , SOCK_STREAM , 0 ) ) < 0 ) { printf ( " \n " ) ; return UAP_FAILURE ; } memset ( & ifr , 0 , sizeof ( ifr ) ) ; strncpy ( ifr . ifr_ifrn . ifrn_name , dev_name , IFNAMSIZ - 1 ) ; ifr . ifr_ifru . ifru_data = ( void * ) & param ; errno = 0 ; if ( ioctl ( sockfd , UAP_IOCTL_CMD , & ifr ) ) { perror ( " " ) ; printf ( " \n " ) ; close ( sockfd ) ; return UAP_FAILURE ; } if ( ! argc ) { printf ( " " ) ; for ( i = 0 ; i < MAX_NUM_TID ; i ++ ) { printf ( " " , param . addba_reject [ i ] ) ; } printf ( " \n " ) ; } close ( sockfd ) ; return UAP_SUCCESS ; }
@brief Creates addbareject request and send to driver
  @param argc     Number of arguments
  @param argv     Pointer to the arguments
  @return         UAP_SUCCESS/UAP_FAILURE
@brief Creates addbareject request and send to driver @param argc Number of arguments @param argv Pointer to the arguments @return UAP_SUCCESS / UAP_FAILURE
/* Check arguments */ /* Open socket */ /* Initialize the ifr structure */ /* Perform ioctl */ /* Close socket */