Revert "Serial over USB or serial support"
diff --git a/Makefile.inc b/Makefile.inc
index caedcd2..94f7930 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -20,43 +20,24 @@
UCC=ucc
MAKE=make
-#=============== Config ===============================
-# Set the config flag below as required
-# to enable WMM PS
-$WMM-PS = 0
-# to enable WMM-AC set the below flag along with WMM-PS
-$WMM-AC = 0
-#=============== compilation flag ======================
-INCFLAG = -I../inc
-CFLAGS = -g -O2 -D_REENTRANT -Wall
-# This is for WMM-PS
-#for Ext TG
-#CFLAGS = -DWFA_WMM_PS_EXT
-ifeq ($WMM-PS, 1)
-CFLAGS += -DWFA_WMM_PS_EXT
-ifeq ($WMM-AC, 1)
-CFLAGS += -DWFA_WMM_AC
-echo test
-endif
-endif
# This is for WMM-PS
#for Ext TG
-#CFLAGS = -DWFA_WMM_PS_EXT -Wall -I../inc
+#CFLAGS = -g -O2 -D_REENTRANT -DWFA_WMM_PS_EXT -Wall -I../inc
## for WMM-AC, WMM-PS, Voice, PMF, TDLS Test-Bed
-#CFLAGS = -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -DWFA_STA_TB -Wall -I../inc
+#CFLAGS = -g -O2 -D_REENTRANT -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -DWFA_STA_TB -Wall -I../inc
## for WMM-AC, WMM-PS Test-Bed
-#CFLAGS = -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_STA_TB -Wall -I../inc
+#CFLAGS = -g -O2 -D_REENTRANT -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_STA_TB -Wall -I../inc
## for non-Test-Bed WMM-AC, WMM-PS and Voice
-#CFLAGS = -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -Wall -I../inc
+#CFLAGS = -g -O2 -D_REENTRANT -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -Wall -I../inc
## for PC-ENDPOINT
-#CFLAGS = -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -DWFA_PC_CONSOLE -Wall -I../inc
+#CFLAGS = -g -O2 -D_REENTRANT -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -DWFA_PC_CONSOLE -Wall -I../inc
## for PC-ENDPOINT No Voice
-#CFLAGS = -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_PC_CONSOLE -DWFA_STA_TB -Wall -I../inc
+#CFLAGS = -g -O2 -D_REENTRANT -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_PC_CONSOLE -DWFA_STA_TB -Wall -I../inc
# This is for WPA2 as default
CFLAGS = -g -O2 -D_REENTRANT -Wall -I../inc
@@ -69,10 +50,10 @@
LIBWFA_NAME_CA = libwfa_ca.a
LIBWFA_NAME = libwfa.a
-LIB_OBJS = wfa_sock.o wfa_serial.o wfa_nw_al.o wfa_tg.o wfa_cs.o wfa_ca_resp.o wfa_tlv.o wfa_typestr.o wfa_cmdtbl.o wfa_cmdproc.o wfa_miscs.o wfa_thr.o wfa_wmmps.o
+LIB_OBJS = wfa_sock.o wfa_tg.o wfa_cs.o wfa_ca_resp.o wfa_tlv.o wfa_typestr.o wfa_cmdtbl.o wfa_cmdproc.o wfa_miscs.o wfa_thr.o wfa_wmmps.o
-LIB_OBJS_DUT = wfa_sock.o wfa_serial.o wfa_nw_al.o wfa_tlv.o wfa_cs.o wfa_cmdtbl.o wfa_tg.o wfa_miscs.o wfa_thr.o wfa_wmmps.o
+LIB_OBJS_DUT = wfa_sock.o wfa_tlv.o wfa_cs.o wfa_cmdtbl.o wfa_tg.o wfa_miscs.o wfa_thr.o wfa_wmmps.o
-LIB_OBJS_CA = wfa_sock.o wfa_serial.o wfa_nw_al.o wfa_tlv.o wfa_ca_resp.o wfa_cmdproc.o wfa_miscs.o wfa_typestr.o
+LIB_OBJS_CA = wfa_sock.o wfa_tlv.o wfa_ca_resp.o wfa_cmdproc.o wfa_miscs.o wfa_typestr.o
CLEANFILES = core core.* *.core.* *.o *.a
diff --git a/ca/wfa_ca.c b/ca/wfa_ca.c
index 44c4dd8..d490604 100644
--- a/ca/wfa_ca.c
+++ b/ca/wfa_ca.c
@@ -29,8 +29,6 @@
#include <string.h> /* for memset() */
#include <unistd.h> /* for close() */
#include <sys/select.h>
-#include <getopt.h> /* for get_option */
-
#include "wfa_debug.h"
#include "wfa_main.h"
@@ -40,7 +38,6 @@
#include "wfa_cmds.h"
#include "wfa_miscs.h"
#include "wfa_sock.h"
-#include "wfa_nw_al.h"
#include "wfa_ca.h"
#include "wfa_agtctrl.h"
@@ -51,21 +48,9 @@
extern typeNameStr_t nameStr[];
extern char gRespStr[];
-int gSock = -1;
-int tmsockfd = -1;
-int gCaSockfd = -1;
-int xcSockfd = -1;
-int btSockfd;
-
-
+int gSock = -1, tmsockfd, gCaSockfd = -1, xcSockfd, btSockfd;
int gtgSend, gtgRecv, gtgTransac;
-
-
char gnetIf[32] = "any";
-char gCaNetIf[32] = "any";
-
-char logPath[100] = "";
-
tgStream_t *theStreams;
long itimeout = 0;
@@ -76,436 +61,308 @@
* the output format can be redefined for file output.
*/
-void help_usage(char *str)
-{
- printf( "Usage: %s -i <eth iface> -I <interface> -P <local port> -T <type> [Options: ] \n", str);
- printf( " Options: \n"
- " -i --iface ethernet interface for control agent \n"
- " -I --dutif interface either ethernet or serial device name \n"
- " -T --type type interface like serial(1) TCP(2) UDP(3) \n"
- " -P --port local sever port address to start server \n"
- " -d --dutip dut ip address in case of TCP/UDP \n"
- " -r --dutport dut port address in case of TCP \n"
- " -b --baud baud rate in case of serial \n"
- " -g --log log file path for debug \n"
- " -h --help display usage \n");
-}
-
-
-static const struct option longIPOptions[] = {
- { "iface", required_argument, NULL, 'i' },
- { "dutif", required_argument, NULL, 'I' },
- { "type", required_argument, NULL, 'T' },
- { "dutip", required_argument, NULL, 'd' },
- { "port", required_argument, NULL, 'P' },
- { "dutport", required_argument, NULL, 'r' },
- { "baud", required_argument, NULL, 'b' },
- { "log", required_argument, NULL, 'g' },
- { "help", no_argument, NULL, 'h' },
- { NULL, no_argument, NULL, 0 }
-};
-static const char *optionString = "i:I:T:d:P:r:b:g:h";
-
-
int main(int argc, char *argv[])
{
- t_ifaceHandle ctrlRecvHandle;
- t_ifaceHandle dutHandle;
- int typeOfConn=0;
- int opt;
- int optionIndex = 0;
-#if 0
- // these variable used for or TG
- int nfds;
- struct sockaddr_in servAddr;
- char *servIP=NULL;
+ int nfds;
+ struct sockaddr_in servAddr;
+ unsigned short servPort, myport;
+ char *servIP=NULL, *tstr=NULL;
+ int bytesRcvd;
fd_set sockSet;
- int slen;
-#endif
- /* remote port for sending command over tcp */
- unsigned short remoteServPort = 0;
- unsigned short locPortNo = 0;
- int baudrate = 0;
- int retStatus = 0;
-
- /*char *tstr=NULL;*/
- char dutSrvIP[WFA_IP_ADDR_STR_LEN];
-#if DEBUG
- int bytesRcvd;
-#endif
-
char cmdName[WFA_BUFF_32];
- int i, isFound = 0, nbytes, ret_status;
+ int i, isFound = 0, nbytes, ret_status, slen;
WORD tag;
int tmsockfd, cmdLen = WFA_BUFF_1K;
- /* int maxfdn1; */
+ int maxfdn1;
BYTE xcCmdBuf[WFA_BUFF_4K];
BYTE caCmdBuf[WFA_BUFF_4K];
BYTE pcmdBuf[WFA_BUFF_1K];
char *pcmdStr = NULL;
char respStr[WFA_BUFF_512];
- /* temporarily disable
//start of CLI handling variables
char wfaCliBuff[128];
FILE *wfaCliFd;
- char * cliCmd;
- */
- char *tempCmdBuff;
-
- while ((opt = getopt_long(argc, argv, optionString, longIPOptions, &optionIndex)) != -1)
- {
- switch (opt) {
- case 'i':
- printf ("option -i with value %s\n", optarg);
- strncpy(gCaNetIf, optarg, 31);
- break;
- case 'I':
- printf ("option -I with value %s\n", optarg);
- strncpy(gnetIf, optarg, 31);
- break;
- case 'T':
- /* interface type */
- /* none: 0, serial: 1, tcp: 2, udp: 3 */
- typeOfConn = atoi(optarg);
- break;
- case 'P':
- /* local server port*/
- locPortNo = atoi(optarg);
- break;
- case 'b':
- /* baudrate for serial operation*/
- baudrate = atoi(optarg);
- break;
- case 'd':
- if(isIpV4Addr(optarg)== WFA_ERROR) {
- printf("invalid ip address %s\n",optarg);
- help_usage(argv[0]);
- exit(1);
- }
- strncpy(dutSrvIP, optarg, WFA_IP_ADDR_STR_LEN);
- break;
- case 'r':
- /* dut server port use in case dut use TCP/UDP*/
- remoteServPort = atoi(optarg);
- break;
- case 'g':
- /* log path for debug */
- printf ("option -I with value %s\n", optarg);
- strncpy(logPath, optarg, sizeof(logPath)-1);
- break;
- case 'h':
- help_usage(argv[0]);
- exit(1);
- break;
- case ':':
- printf ("option --%s must have value \n", longIPOptions[optionIndex].name);
- break;
- case '?':
- /* getopt_long() set a variable, just keep going */
- break;
- }
- }
-
-
- if (locPortNo == 0) {
- printf ("wrong local port for server to start %d\n",locPortNo);
- help_usage(argv[0]);
- exit(1);
- }
-
- if ((CONN_TYPE_SERIAL == typeOfConn)) {
- if ( baudrate == 0) {
- printf ("wrong baud rate \n");
- exit(1);
- }
- }
- else if (CONN_TYPE_TCP == typeOfConn || CONN_TYPE_UDP == typeOfConn) {
- if ( remoteServPort == 0) {
- printf ("wrong remote port for IP connection\n");
- exit(1);
- }
- }
- else {
- printf ("type (-T) should be with correct value %d\n", typeOfConn);
- help_usage(argv[0]);
- exit(1);
- }
-
- /* check need in case logpath allocated as require*/
- if(logPath != NULL && strlen(logPath)) {
- FILE *logfile;
- int fd;
- logfile = fopen(logPath,"a");
- if(logfile != NULL) {
- fd = fileno(logfile);
- DPRINT_INFO(WFA_OUT,"redirecting the output to %s\n", logPath);
- dup2(fd,1);
- dup2(fd,2);
- }
- else {
- DPRINT_ERR(WFA_ERR, "Cant open the log file continuing without redirecting\n");
- }
- }
-
- ctrlRecvHandle.if_attr.ipConn.port = locPortNo;
- retStatus = wfaOpenInterFace(&ctrlRecvHandle, gCaNetIf, CONN_TYPE_TCP, CONNECTION_SERVER);
- if(retStatus) {
- printf("CA server faild to start \n");
- exit(1);
- }
- /* must be removed*/
- dutHandle.if_attr.ipConn.sockfd = -1;
-
-// maxfdn1 = tmsockfd + 1;
-// FD_ZERO(&sockSet);
-#if 0
- if(gSock == -1)
- {
- if ((gSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
+ char * cliCmd,*tempCmdBuff;
+ if(argc < 3)
{
- DPRINT_ERR(WFA_ERR, "socket() failed: %i", errno);
+ DPRINT_ERR(WFA_ERR, "Usage: %s <control interface> <local control agent port>\n", argv[0]);
exit(1);
}
- memset(&servAddr, 0, sizeof(servAddr));
- servAddr.sin_family = AF_INET;
- servAddr.sin_addr.s_addr = inet_addr(servIP);
- servAddr.sin_port = htons(servPort);
+ myport = atoi(argv[2]);
- if (connect(gSock, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0)
+ if(argc > 3)
{
- DPRINT_ERR(WFA_ERR, "connect() failed: %i", errno);
- exit(1);
- }
- }
-#endif
-
-
- /*infinite loop */
- for(;;)
- {
-#if 0
- FD_ZERO(&sockSet);
- FD_SET(tmsockfd, &sockSet);
- maxfdn1 = tmsockfd + 1;
-
- if(gCaSockfd != -1)
- {
- FD_SET(gCaSockfd, &sockSet);
- if(maxfdn1 < gCaSockfd)
- maxfdn1 = gCaSockfd +1;
- }
-
- if(gSock != -1)
- {
- FD_SET(gSock, &sockSet);
- if(maxfdn1 < gSock)
- maxfdn1 = gSock +1;
- }
-
- if((nfds = select(maxfdn1, &sockSet, NULL, NULL, NULL)) < 0)
- {
- if(errno == EINTR)
- continue;
- else
- DPRINT_WARNING(WFA_WNG, "select error %i", errno);
- }
- #endif
- DPRINT_INFO(WFA_OUT, "new event \n");
-
- wfaInterFacePeerConn( &ctrlRecvHandle);
- printf("client got connected\n");
-/*
- if(FD_ISSET(tmsockfd, &sockSet))
- {
- gCaSockfd = wfaAcceptTCPConn(tmsockfd);
- DPRINT_INFO(WFA_OUT, "accept new connection\n");
- continue;
- }
-*/
-
- memset(xcCmdBuf, 0, WFA_BUFF_4K);
- memset(gRespStr, 0, WFA_BUFF_512);
-#if 0
-
- nbytes = wfaCtrlRecv(gCaSockfd, xcCmdBuf);
- if(nbytes <=0)
- {
- shutdown(gCaSockfd, SHUT_WR);
- close(gCaSockfd);
- gCaSockfd = -1;
- continue;
- }
-#endif
-
- retStatus = wfaInterFaceDataRecv(&ctrlRecvHandle, xcCmdBuf, WFA_BUFF_1K, &nbytes);
- printf("retStatus %d nbytes %d {%s}",retStatus, nbytes, xcCmdBuf);
- if(nbytes <=0)
- {
- printf("Ctrl data receive error nbytes = %d \n",nbytes);
- /* may not be correct idea unless recev wait till it gets some data*/
- wfaInterFacePeerConnClose(&ctrlRecvHandle);
- continue;
- }
-
- /*
- * send back to command line or TM.
- */
- //sleep(1); /* having this is for slowing down unexpected output result on CLI command sometimes */
- memset(respStr, 0, WFA_BUFF_128);
- sprintf(respStr, "status,RUNNING\r\n");
- retStatus = wfaInterFaceDataSend(&ctrlRecvHandle ,respStr, strlen(respStr));
- if(retStatus == -1)
- continue;
-
-#if 0
-/* wfaCtrlSend(gCaSockfd, (BYTE *)respStr, strlen(respStr)); */
- DPRINT_INFO(WFA_OUT, "%s\n", respStr);
- DPRINT_INFO(WFA_OUT, "message %s %i\n", xcCmdBuf, nbytes);
- slen = (int )strlen((char *)xcCmdBuf);
-
- DPRINT_INFO(WFA_OUT, "last %x last-1 %x last-2 %x last-3 %x\n",
- cmdName[slen], cmdName[slen-1], cmdName[slen-2], cmdName[slen-3]);
- xcCmdBuf[slen-3] = '\0';
-#endif
-
- if(CONN_TYPE_TCP ==typeOfConn )
- {
- wfaOpenInterFace(&dutHandle, gnetIf, CONN_TYPE_TCP, CONNECTION_CLIENT);
- wfaInterFacePeerInfoSet( &dutHandle, dutSrvIP, remoteServPort, 0, typeOfConn);
- retStatus = wfaInterFacePeerConn(&dutHandle);
- if( WFA_ERROR == retStatus ) {
- printf("Dut Connection failed\n");
- retStatus = wfaInterFaceDataSend(&ctrlRecvHandle ,"status,ERROR\r\n",
- strlen("status,ERROR\r\n"));
- wfaInterFaceClose(&dutHandle);
- continue;
- }
- }
- else if(CONN_TYPE_SERIAL==typeOfConn )
- {
- dutHandle.if_attr.serial.baudrate = baudrate;
- wfaOpenInterFace(&dutHandle, gnetIf, CONN_TYPE_SERIAL, CONNECTION_CLIENT);
- wfaInterFacePeerInfoSet( &dutHandle, dutSrvIP, remoteServPort, 115200, typeOfConn);
- }
- isFound = 0;
- tempCmdBuff = (char* )malloc(sizeof(xcCmdBuf));
- memcpy(tempCmdBuff, xcCmdBuf, sizeof(xcCmdBuf));
-
- memcpy(cmdName, strtok_r((char *)tempCmdBuff, ",", (char **)&pcmdStr), 32);
- printf("\nInside the CLI huck block \n");
-#if 0
- wfaCliFd=fopen("/etc/WfaEndpoint/wfa_cli.txt","r");
- printf("\nAfter File open \n");
- if(wfaCliFd!= NULL)
- {
- //printf("\nInside File open \n");
- while(fgets(wfaCliBuff, 128, wfaCliFd) != NULL)
- {
- //printf("Line read from CLI file : %s",wfaCliBuff);
- if(ferror(wfaCliFd))
- break;
- cliCmd=strtok(wfaCliBuff,"-");
- if(strcmp(cliCmd,cmdName) == 0)
+ if(argc < 5)
{
- strcpy(cmdName,"wfa_cli_cmd");
- pcmdStr = (char *)&xcCmdBuf[0];
- break;
+ DPRINT_ERR(WFA_ERR, "Usage: %s <control interface> <local control agent port> <DUT IP ADDRESS> <DUT PORT>\n", argv[0]);
+ exit(1);
}
- }
- fclose(wfaCliFd);
+ servIP = argv[3];
+ if(isIpV4Addr(argv[3])== WFA_FAILURE)
+ return WFA_FAILURE;
+ if(isNumber(argv[4])== WFA_FAILURE)
+ return WFA_FAILURE;
+ servPort = atoi(argv[4]);
+ if(argc > 5)
+ {
+ FILE *logfile;
+ int fd;
+ logfile = fopen(argv[5],"a");
+ if(logfile != NULL)
+ {
+ fd = fileno(logfile);
+ DPRINT_INFO(WFA_OUT,"redirecting the output to %s\n",argv[5]);
+ dup2(fd,1);
+ dup2(fd,2);
+ }
+ else
+ {
+ DPRINT_ERR(WFA_ERR, "Cant open the log file continuing without redirecting\n");
+ }
+ }
}
+ else
+ {
+ if((tstr = getenv("WFA_ENV_AGENT_IPADDR")) == NULL)
+ {
+ DPRINT_ERR(WFA_ERR, "Environment variable WFA_ENV_AGENT_IPADDR not set or specify DUT IP/PORT\n");
+ exit(1);
+ }
+ if(isIpV4Addr(tstr)== WFA_FAILURE)
+ return WFA_FAILURE;
+ servIP= tstr;
+ if((tstr = getenv("WFA_ENV_AGENT_PORT")) == NULL)
+ {
+ DPRINT_ERR(WFA_ERR, "Environment variable WFA_ENV_AGENT_PORT not set or specify DUT IP/PORT\n");
+ exit(1);
+ }
+ if(isNumber(tstr)== WFA_FAILURE)
+ return WFA_FAILURE;
+ servPort = atoi(tstr);
+ }
+
+ tmsockfd = wfaCreateTCPServSock(myport);
+
+ maxfdn1 = tmsockfd + 1;
+
+ FD_ZERO(&sockSet);
+ if(gSock == -1)
+ {
+ if ((gSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
+ {
+ DPRINT_ERR(WFA_ERR, "socket() failed: %i", errno);
+ exit(1);
+ }
+
+ memset(&servAddr, 0, sizeof(servAddr));
+ servAddr.sin_family = AF_INET;
+ servAddr.sin_addr.s_addr = inet_addr(servIP);
+ servAddr.sin_port = htons(servPort);
+
+ if (connect(gSock, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0)
+ {
+ DPRINT_ERR(WFA_ERR, "connect() failed: %i", errno);
+ exit(1);
+ }
+
+ }
+
+ for(;;)
+ {
+ FD_ZERO(&sockSet);
+ FD_SET(tmsockfd, &sockSet);
+ maxfdn1 = tmsockfd + 1;
+
+ if(gCaSockfd != -1)
+ {
+ FD_SET(gCaSockfd, &sockSet);
+ if(maxfdn1 < gCaSockfd)
+ maxfdn1 = gCaSockfd +1;
+ }
+
+ if(gSock != -1)
+ {
+ FD_SET(gSock, &sockSet);
+ if(maxfdn1 < gSock)
+ maxfdn1 = gSock +1;
+ }
+
+ if((nfds = select(maxfdn1, &sockSet, NULL, NULL, NULL)) < 0)
+ {
+ if(errno == EINTR)
+ continue;
+ else
+ DPRINT_WARNING(WFA_WNG, "select error %i", errno);
+ }
+
+ DPRINT_INFO(WFA_OUT, "new event \n");
+ if(FD_ISSET(tmsockfd, &sockSet))
+ {
+ gCaSockfd = wfaAcceptTCPConn(tmsockfd);
+ DPRINT_INFO(WFA_OUT, "accept new connection\n");
+ continue;
+ }
+
+ if(gCaSockfd > 0 && FD_ISSET(gCaSockfd, &sockSet))
+ {
+ memset(xcCmdBuf, 0, WFA_BUFF_4K);
+ memset(gRespStr, 0, WFA_BUFF_512);
+
+ nbytes = wfaCtrlRecv(gCaSockfd, xcCmdBuf);
+ if(nbytes <=0)
+ {
+ shutdown(gCaSockfd, SHUT_WR);
+ close(gCaSockfd);
+ gCaSockfd = -1;
+ continue;
+ }
+
+ /*
+ * send back to command line or TM.
+ */
+ memset(respStr, 0, WFA_BUFF_128);
+ sprintf(respStr, "status,RUNNING\r\n");
+ wfaCtrlSend(gCaSockfd, (BYTE *)respStr, strlen(respStr));
+
+ DPRINT_INFO(WFA_OUT, "%s\n", respStr);
+ DPRINT_INFO(WFA_OUT, "message %s %i\n", xcCmdBuf, nbytes);
+ slen = (int )strlen((char *)xcCmdBuf);
+
+ DPRINT_INFO(WFA_OUT, "last %x last-1 %x last-2 %x last-3 %x\n", cmdName[slen], cmdName[slen-1], cmdName[slen-2], cmdName[slen-3]);
+
+ xcCmdBuf[slen-3] = '\0';
+
+ if(gSock == -1)
+ {
+ if ((gSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
+ {
+ DPRINT_ERR(WFA_ERR, "socket() failed: %i", errno);
+ exit(1);
+ }
+
+ memset(&servAddr, 0, sizeof(servAddr));
+ servAddr.sin_family = AF_INET;
+ servAddr.sin_addr.s_addr = inet_addr(servIP);
+ servAddr.sin_port = htons(servPort);
+
+ if (connect(gSock, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0)
+ {
+ DPRINT_ERR(WFA_ERR, "connect() failed: %i", errno);
+ exit(1);
+ }
+ }
+
+ isFound = 0;
+
+ tempCmdBuff=(char* )malloc(sizeof(xcCmdBuf));
+ memcpy(tempCmdBuff,xcCmdBuf,sizeof(xcCmdBuf));
+
+ memcpy(cmdName, strtok_r((char *)tempCmdBuff, ",", (char **)&pcmdStr), 32);
+ printf("\nInside the CLI huck block \n");
+
+ wfaCliFd=fopen("/etc/WfaEndpoint/wfa_cli.txt","r");
+ printf("\nAfter File open \n");
+ if(wfaCliFd!= NULL)
+ {
+ while(fgets(wfaCliBuff, 128, wfaCliFd) != NULL)
+ {
+ if(ferror(wfaCliFd))
+ break;
+ cliCmd=strtok(wfaCliBuff,"-");
+ if(strcmp(cliCmd,cmdName) == 0)
+ {
+ strcpy(cmdName,"wfa_cli_cmd");
+ pcmdStr = (char *)&xcCmdBuf[0];
+ break;
+ }
+ }
+ fclose(wfaCliFd);
+
+ }
+ printf("\nOutside the new block \n");
+ free(tempCmdBuff);
+ if(strcmp(cmdName,"wfa_cli_cmd") != 0)
+ memcpy(cmdName, strtok_r((char *)xcCmdBuf, ",", (char **)&pcmdStr), 32);
+
+
+ i = 0;
+ while(nameStr[i].type != -1)
+ {
+ if(strcmp(nameStr[i].name, cmdName) == 0)
+ {
+ isFound = 1;
+ break;
+ }
+ i++;
+ }
+
+ DPRINT_INFO(WFA_OUT, "%s\n", cmdName);
+
+ if(isFound == 0)
+ {
+ sleep(1);
+ sprintf(respStr, "status,INVALID\r\n");
+ wfaCtrlSend(gCaSockfd, (BYTE *)respStr, strlen(respStr));
+ DPRINT_WARNING(WFA_WNG, "Command not valid, check the name\n");
+ continue;
+ }
+
+ memset(pcmdBuf, 0, WFA_BUFF_1K);
+ if(nameStr[i].cmdProcFunc(pcmdStr, pcmdBuf, &cmdLen)==WFA_FAILURE)
+ {
+ sleep(1);
+ sprintf(respStr, "status,INVALID\r\n");
+ wfaCtrlSend(gCaSockfd, (BYTE *)respStr, strlen(respStr));
+ DPRINT_WARNING(WFA_WNG, "Incorrect command syntax\n");
+ continue;
+ }
+
+ /*
+ * send to DUT.
+ */
+ if(send(gSock, pcmdBuf, cmdLen, 0) != cmdLen)
+ {
+ DPRINT_WARNING(WFA_WNG, "Incorrect sending ...\n");
+ continue;
+ }
+
+ DPRINT_INFO(WFA_OUT, "sent to DUT\n");
+ } /* done with gCaSockfd */
+
+ if(gSock > 0 && FD_ISSET(gSock, &sockSet))
+ {
+ DPRINT_INFO(WFA_OUT, "received from DUT\n");
+ sleep(1);
+ memset(respStr, 0, WFA_BUFF_128);
+ memset(caCmdBuf, 0, WFA_BUFF_4K);
+ if ((bytesRcvd = recv(gSock, caCmdBuf, WFA_BUFF_4K, 0)) <= 0)
+ {
+ DPRINT_WARNING(WFA_WNG, "recv() failed or connection closed prematurely");
+ continue;
+ }
+
+#if DEBUG
+ for(i = 0; i< bytesRcvd; i++)
+ printf("%x ", caCmdBuf[i]);
+ printf("\n");
#endif
- printf("\nOutside the new block \n");
- free(tempCmdBuff);
- if(strcmp(cmdName,"wfa_cli_cmd") != 0)
- memcpy(cmdName, strtok_r((char *)xcCmdBuf, ",", (char **)&pcmdStr), 32);
-
- i = 0;
- while(nameStr[i].type != -1)
- {
- if(strcmp(nameStr[i].name, cmdName) == 0)
- {
- isFound = 1;
- break;
- }
- i++;
- }
+ tag = ((wfaTLV *)caCmdBuf)->tag;
- DPRINT_INFO(WFA_OUT, "%s\n", cmdName);
+ memcpy(&ret_status, caCmdBuf+4, 4);
- if(isFound == 0)
- {
- sleep(1);
- sprintf(respStr, "status,INVALID\r\n");
- retStatus = wfaInterFaceDataSend(&ctrlRecvHandle ,(char *)respStr, strlen(respStr));
- DPRINT_WARNING(WFA_WNG, "Command not valid, check the name\n");
- continue;
- }
+ DPRINT_INFO(WFA_OUT, "tag %i \n", tag);
+ if(tag != 0 && wfaCmdRespProcFuncTbl[tag] != NULL)
+ {
+ wfaCmdRespProcFuncTbl[tag](caCmdBuf);
+ }
+ else
+ DPRINT_WARNING(WFA_WNG, "function not defined\n");
+ } /* if(gCaSock */
- memset(pcmdBuf, 0, WFA_BUFF_1K);
- if(nameStr[i].cmdProcFunc(pcmdStr, pcmdBuf, &cmdLen)==WFA_FAILURE)
- {
- sleep(1);
- sprintf(respStr, "status,INVALID\r\n");
- retStatus = wfaInterFaceDataSend(&ctrlRecvHandle ,(char *)respStr, strlen(respStr));
- DPRINT_WARNING(WFA_WNG, "Incorrect command syntax\n");
- continue;
- }
- /*
- * send to DUT.
- */
- DPRINT_INFO(WFA_OUT, "sent to DUT\n");
- retStatus = wfaInterFaceDataSend(&dutHandle, (char *)pcmdBuf, cmdLen);
- if(retStatus == -1)
- {
- DPRINT_WARNING(WFA_WNG, "Incorrect sending ...\n");
- wfaInterFaceClose(&dutHandle);
- continue;
- }
- //sleep(1);
+ } /* for */
- DPRINT_INFO(WFA_OUT, "received from DUT\n");
- memset(respStr, 0, WFA_BUFF_128);
- memset(caCmdBuf, 0, WFA_BUFF_4K);
- retStatus = wfaInterFaceDataRecv(&dutHandle,(char *) caCmdBuf, WFA_BUFF_4K, &nbytes);
- if (retStatus < 0)
- {
- DPRINT_WARNING(WFA_WNG, "recv() failed or connection closed prematurely");
- wfaInterFaceClose(&dutHandle);
- continue;
- }
-/* if ((bytesRcvd = recv(gSock, caCmdBuf, WFA_BUFF_4K, 0)) <= 0)
- {
- DPRINT_WARNING(WFA_WNG, "recv() failed or connection closed prematurely");
- continue;
- }
-*/
-#if DEBUG
- for(i = 0; i< bytesRcvd; i++)
- printf("%x ", caCmdBuf[i]);
- printf("\n");
-#endif
- tag = ((wfaTLV *)caCmdBuf)->tag;
- memcpy(&ret_status, caCmdBuf+4, 4);
-
- DPRINT_INFO(WFA_OUT, "tag %i \n", tag);
- if(tag != 0 && wfaCmdRespProcFuncTbl[tag] != NULL)
- {
- wfaCmdRespProcFuncTbl[tag](caCmdBuf);
- /*send back to ctrl agent*/
- retStatus = wfaInterFaceDataSend(&ctrlRecvHandle ,
- (char *)gRespStr, strlen(gRespStr));
- }
- else
- {
- DPRINT_WARNING(WFA_WNG, "function not defined\n");
- }
- /* close the dut connection */
- wfaInterFaceClose(&dutHandle);
- wfaInterFacePeerConnClose(&ctrlRecvHandle);
- } /* for */
- wfaInterFaceClose(&ctrlRecvHandle);
- return 0;
+ close(gSock);
+ exit(0);
}
diff --git a/dut/wfa_dut.c b/dut/wfa_dut.c
index 79ed158..6afa4e5 100644
--- a/dut/wfa_dut.c
+++ b/dut/wfa_dut.c
@@ -29,8 +29,6 @@
#include <pthread.h>
#include <signal.h>
#include <time.h>
-#include <getopt.h>
-
#include "wfa_portall.h"
#include "wfa_debug.h"
@@ -45,7 +43,6 @@
#include "wfa_rsp.h"
#include "wfa_wmmps.h"
-#include "wfa_nw_al.h"
/* Global flags for synchronizing the TG functions */
int gtimeOut = 0; /* timeout value for select call in usec */
@@ -54,6 +51,7 @@
extern unsigned long psTxMsg[512];
extern unsigned long psRxMsg[512];
extern wfaWmmPS_t wmmps_info;
+extern tgWMM_t wmmps_mutex_info;
extern int psSockfd;
extern struct apts_msg *apts_msgs;
@@ -69,11 +67,10 @@
extern BYTE *trafficBuf, *respBuf;
/* stream table */
-extern tgStream_t gStreams[]; /* streams' buffers */
-#if 0
+extern tgStream_t gStreams[]; /* streams' buffers */
+
/* the agent local Socket, Agent Control socket and baseline test socket*/
int gagtSockfd = -1;
-#endif
extern int btSockfd;
@@ -108,114 +105,30 @@
extern int wfa_estimate_timer_latency();
extern void wfa_dut_init(BYTE **tBuf, BYTE **rBuf, BYTE **paBuf, BYTE **cBuf, struct timeval **timerp);
-
-
-void help_usage(char *str)
-{
- printf("Usage: %s <command interface> <type> <Local Control Port><baud rate> \n", str);
- printf( " Options: \n"
- " -I --iface interface either Ethernet or serial device name \n"
- " -T --type type interface like serial(1) TCP(2) UDP(3) \n"
- " -P --port port address in case of TCP \n"
- " -b --baud baud rate in case of serial \n"
- " -h --help display usage \n");
-}
-
-
-static const struct option longIPOptions[] = {
- { "iface", required_argument, NULL, 'I' },
- { "type", required_argument, NULL, 'T' },
- { "port", required_argument, NULL, 'P' },
- { "baud", required_argument, NULL, 'b' },
- { "help", no_argument, NULL, 'h' },
- { NULL, no_argument, NULL, 0 }
-};
-static const char *optionString = "I:T:P:b:h?";
-
-
int
main(int argc, char **argv)
{
- t_ifaceHandle dutHandle;
- int typeOfConn=0;
- int baudrate = 0;
- int retStatus;
- int opt;
- int optionIndex = 0;
- int nfds;
- int maxfdn1 = -1;
- int nbytes = 0;
- int cmdLen = 0;
- int isExit = 1;
- int respLen;
- WORD locPortNo = 0; /* local control port number */
- fd_set sockSet; /* Set of socket descriptors for select() */
- BYTE *xcCmdBuf = NULL;
- BYTE *parmsVal = NULL;
+ int nfds, maxfdn1 = -1, nbytes = 0, cmdLen = 0, isExit = 1;
+ int respLen, ret;
+ WORD locPortNo = 0; /* local control port number */
+ fd_set sockSet; /* Set of socket descriptors for select() */
+ BYTE *xcCmdBuf=NULL, *parmsVal=NULL;
struct timeval *toutvalp=NULL, *tovalp; /* Timeout for select() */
WORD xcCmdTag;
-/* struct sockfds fds; */
- int i = 0;
-
-#if 0
+ struct sockfds fds;
tgThrData_t tdata[WFA_THREADS_NUM];
+ int i = 0;
pthread_attr_t ptAttr;
int ptPolicy;
- struct sched_param ptSchedParam;
-#endif
- while((opt = getopt_long(argc, argv, optionString, longIPOptions, &optionIndex)) != -1)
- {
- switch (opt) {
- case 'I':
- printf ("option -I with value %s \n", optarg);
- strncpy(gnetIf, optarg, 31);
- break;
- case 'T':
- /*none: 0, serial: 1, tcp: 2, udp: 3*/
- typeOfConn = atoi(optarg);
- break;
- case 'P':
- /* local server port*/
- locPortNo = atoi(optarg);
- break;
- case 'b':
- baudrate = atoi(optarg);
- break;
- case 'h':
- help_usage(argv[0]);
- exit(1);
- break;
- case ':':
- printf ("option --%s must have value \n", longIPOptions[optionIndex].name);
- exit(1);
- break;
- case '?':
- /* getopt_long() set a variable, just keep going */
- break;
- }
- }
- if (CONN_TYPE_SERIAL == typeOfConn) {
- if ( baudrate == 0) {
- printf ("wrong baud rate \n");
- exit(1);
- }
- }
- else if ((CONN_TYPE_TCP == typeOfConn) || CONN_TYPE_UDP == typeOfConn) {
- if ( locPortNo == 0) {
- printf ("wrong local port for IP connection\n");
- exit(1);
- }
- }
- else{
- printf ("type (-T) should be with correct value %d\n", typeOfConn);
- help_usage(argv[0]);
+ struct sched_param ptSchedParam;
+
+ if (argc < 3) /* Test for correct number of arguments */
+ {
+ DPRINT_ERR(WFA_ERR, "Usage: %s <command interface> <Local Control Port> \n", argv[0]);
exit(1);
}
-
-
-#if 0
#ifdef WFA_PC_CONSOLE
else if(argc > 3)
{
@@ -236,9 +149,23 @@
printf("Output starts\n");
}
#endif
-#endif
-#if 0
+ if(isString(argv[1]) == WFA_FAILURE)
+ {
+ DPRINT_ERR(WFA_ERR, "incorrect network interface\n");
+ exit(1);
+ }
+
+ strncpy(gnetIf, argv[1], 31);
+
+ if(isNumber(argv[2]) == WFA_FAILURE)
+ {
+ DPRINT_ERR(WFA_ERR, "incorrect port number\n");
+ exit(1);
+ }
+
+ locPortNo = atoi(argv[2]);
+
adj_latency = wfa_estimate_timer_latency() + 4000; /* four more mini */
if(adj_latency > 500000)
@@ -250,35 +177,20 @@
/* Just set it to 500 mini seconds */
adj_latency = 500000;
}
-#endif
+
/* allocate the traffic stream table */
wfa_dut_init(&trafficBuf, &respBuf, &parmsVal, &xcCmdBuf, &toutvalp);
- if(CONN_TYPE_TCP ==typeOfConn )
- {
- dutHandle.if_attr.ipConn.port = locPortNo;
- retStatus = wfaOpenInterFace(&dutHandle, gnetIf, CONN_TYPE_TCP, CONNECTION_SERVER);
- if(retStatus == WFA_ERROR) {
- exit(1);
- }
- }
- else if(CONN_TYPE_SERIAL==typeOfConn )
- {
- dutHandle.if_attr.serial.baudrate = baudrate;
- wfaOpenInterFace(&dutHandle, gnetIf, CONN_TYPE_SERIAL, CONNECTION_CLIENT);
- }
-
-#if 0
/* 4create listening TCP socket */
- gagtSockfd = wfaCreateTCPServSock(gnetIf,locPortNo);
+ gagtSockfd = wfaCreateTCPServSock(locPortNo);
if(gagtSockfd == -1)
{
- DPRINT_ERR(WFA_ERR, "Failed to open socket\n");
- exit(1);
+ DPRINT_ERR(WFA_ERR, "Failed to open socket\n");
+ exit(1);
}
-#endif
-#if 0
+
pthread_attr_init(&ptAttr);
+
ptSchedParam.sched_priority = 10;
pthread_attr_setschedparam(&ptAttr, &ptSchedParam);
pthread_attr_getschedpolicy(&ptAttr, &ptPolicy);
@@ -293,90 +205,153 @@
tdata[i].tid = i;
pthread_mutex_init(&wmm_thr[i].thr_flag_mutex, NULL);
pthread_cond_init(&wmm_thr[i].thr_flag_cond, NULL);
- wmm_thr[i].thr_id = pthread_create(&wmm_thr[i].thr,
- &ptAttr, wfa_wmm_thread, &tdata[i]);
+ wmm_thr[i].thr_id = pthread_create(&wmm_thr[i].thr,
+ &ptAttr, wfa_wmm_thread, &tdata[i]);
}
-#endif
+
for(i = 0; i < WFA_MAX_TRAFFIC_STREAMS; i++)
- tgSockfds[i] = -1;
-// maxfdn1 = gagtSockfd + 1;
+ tgSockfds[i] = -1;
-
- while (isExit)
+#ifdef WFA_WMM_PS_EXT
+ /* WMMPS thread */
+ ret = pthread_mutex_init(&wmmps_mutex_info.thr_flag_mutex,NULL);
+ if ( ret !=0)
{
- /*
+ DPRINT_INFO(WFA_OUT, "WMMPS pthread_mutex_init faile\n");
+ }
+ ret = pthread_cond_init(&wmmps_mutex_info.thr_flag_cond,NULL);
+ if (ret != 0)
+ {
+ DPRINT_INFO(WFA_OUT, "WMMPS pthread_cond_init faile\n");
+ }
+ wmmps_mutex_info.thr_id=pthread_create(&wmmps_mutex_info.thr,NULL /*&ptAttr*/,wfa_wmmps_thread,(void*)&wmmps_mutex_info.thr_id);// calls up the wmmps-thread
+#endif
+
+ maxfdn1 = gagtSockfd + 1;
+ while (isExit)
+ {
+ fds.agtfd = &gagtSockfd;
+ fds.cafd = &gxcSockfd;
+ fds.tgfd = &btSockfd;
+ fds.wmmfds = tgSockfds;
+#ifdef WFA_WMM_PS_EXT
+ fds.psfd = &psSockfd;
+#endif
+
+ wfaSetSockFiDesc(&sockSet, &maxfdn1, &fds);
+
+ /*
* The timer will be set for transaction traffic if no echo is back
* The timeout from the select call force to send a new packet
*/
tovalp = NULL;
if(gtimeOut != 0)
{
- /* timeout is set to usec */
- tovalp = wfaSetTimer(0, gtimeOut*1000, toutvalp);
+ /* timeout is set to usec */
+ tovalp = wfaSetTimer(0, gtimeOut*1000, toutvalp);
}
- /* need to check for tcp connection from client*/
- wfaInterFacePeerConn(&dutHandle);
-
- /* we just need to check client connecion*/
- memset(xcCmdBuf, 0, WFA_BUFF_1K); /* reset the buffer */
-
- retStatus = wfaInterFaceDataRecv(&dutHandle, xcCmdBuf, WFA_BUFF_1K, &nbytes);
-
- if(nbytes <=0)
+ nfds = 0;
+ if ( (nfds = select(maxfdn1, &sockSet, NULL, NULL, tovalp)) < 0)
{
- DPRINT_ERR(WFA_ERR,"data receive error\n");
- /* may not be correct idea unless recev wait till it gets some data*/
-// wfaInterFacePeerConnClose(&dutHandle);
-// continue;
+ if (errno == EINTR)
+ continue; /* back to for() */
+ else
+ DPRINT_WARNING(WFA_WNG, "Warning: select()-%i", errno);
}
- else
+
+ if(nfds == 0)
{
- /* command received */
- DPRINT_INFO(WFA_OUT,"recv cmd nbyte %d\n",nbytes);
- wfaDecodeTLV(xcCmdBuf, nbytes, &xcCmdTag, &cmdLen, parmsVal);
+#if 0 //def WFA_WMM_PS_EXT
+ /*
+ * For WMM-Power Save
+ * periodically send HELLO to Console for initial setup.
+ */
+ if(gtgWmmPS != 0 && psSockfd != -1)
+ {
+ wfaSetDUTPwrMgmt(0);
+ wfaTGSetPrio(psSockfd, 0);
+ BUILD_APTS_MSG(APTS_HELLO, psTxMsg);
+ wfaTrafficSendTo(psSockfd, (char *)psTxMsg, sizeof(psTxMsg), (struct sockaddr *) &wmmps_info.psToAddr);
- memset(respBuf, 0, WFA_RESP_BUF_SZ);
- respLen = 0;
-
- /* reset two commond storages used by control functions */
- memset(gCmdStr, 0, WFA_CMD_STR_SZ);
- memset(&gGenericResp, 0, sizeof(dutCmdResponse_t));
-
- /* command process function defined in wfa_ca.c and wfa_tg.c */
- if(xcCmdTag != 0 && gWfaCmdFuncTbl[xcCmdTag] != NULL) {
- /* since the new commands are expanded to new block */
- gWfaCmdFuncTbl[xcCmdTag](cmdLen, parmsVal, &respLen, (BYTE *)respBuf);
+ wmmps_info.sta_state = 0;
+ wmmps_info.wait_state = WFA_WAIT_STAUT_00;
+ continue;
}
- else {
- /* no command defined */
- gWfaCmdFuncTbl[0](cmdLen, parmsVal, &respLen, (BYTE *)respBuf);
- }
+#endif /* WFA_WMM_PS_EXT */
+ }
- /* gWfaCmdFuncTbl[xcCmdTag](cmdLen, parmsVal, &respLen, (BYTE *)respBuf); */
-
- retStatus = wfaInterFaceDataSend(&dutHandle,respBuf, respLen);
- if(retStatus == -1) {
- DPRINT_WARNING(WFA_WNG, "wfa-wfaCtrlSend Error\n");
+ if (FD_ISSET(gagtSockfd, &sockSet))
+ {
+ /* Incoming connection request */
+ gxcSockfd = wfaAcceptTCPConn(gagtSockfd);
+ if(gxcSockfd == -1)
+ {
+ DPRINT_ERR(WFA_ERR, "Failed to open control link socket\n");
+ exit(1);
}
}
- /* close the client connection after serving one command*/
- wfaInterFacePeerConnClose(&dutHandle);
-#if 0
-#ifdef WFA_WMM_PS_EXT
+
+ /* Control Link port event*/
+ if(gxcSockfd >= 0 && FD_ISSET(gxcSockfd, &sockSet))
+ {
+ memset(xcCmdBuf, 0, WFA_BUFF_1K); /* reset the buffer */
+ nbytes = wfaCtrlRecv(gxcSockfd, xcCmdBuf);
+
+ if(nbytes <=0)
+ {
+ /* errors at the port, close it */
+ shutdown(gxcSockfd, SHUT_WR);
+ close(gxcSockfd);
+ gxcSockfd = -1;
+ }
+ else
+ {
+ /* command received */
+ wfaDecodeTLV(xcCmdBuf, nbytes, &xcCmdTag, &cmdLen, parmsVal);
+ memset(respBuf, 0, WFA_RESP_BUF_SZ);
+ respLen = 0;
+
+ /* reset two commond storages used by control functions */
+ memset(gCmdStr, 0, WFA_CMD_STR_SZ);
+ memset(&gGenericResp, 0, sizeof(dutCmdResponse_t));
+
+ /* command process function defined in wfa_ca.c and wfa_tg.c */
+ if(xcCmdTag != 0 && gWfaCmdFuncTbl[xcCmdTag] != NULL)
+ {
+ /* since the new commands are expanded to new block */
+ gWfaCmdFuncTbl[xcCmdTag](cmdLen, parmsVal, &respLen, (BYTE *)respBuf);
+ }
+ else
+ {
+ // no command defined
+ gWfaCmdFuncTbl[0](cmdLen, parmsVal, &respLen, (BYTE *)respBuf);
+ }
+
+ // gWfaCmdFuncTbl[xcCmdTag](cmdLen, parmsVal, &respLen, (BYTE *)respBuf);
+ if(gxcSockfd != -1)
+ {
+ if((ret = wfaCtrlSend(gxcSockfd, (BYTE *)respBuf, respLen)) != respLen)
+ {
+ DPRINT_WARNING(WFA_WNG, "wfa-dut main:wfaCtrlSend returned value %d != respLen %d\n", ret, respLen);
+ }
+ }
+ }
+
+ }
+
+#if 0 // def WFA_WMM_PS_EXT
/*
* Check if there is from Console
*/
if(psSockfd != -1 && FD_ISSET(psSockfd, &sockSet))
{
- printf("power save \n");
wfaWmmPowerSaveProcess(psSockfd);
continue;
}
#endif /* WFA_WMM_PS_EXT */
-#endif
- }/* end while isExit*/
+ }
/*
* necessarily free all mallocs for flat memory real-time systems
@@ -387,10 +362,8 @@
wFREE(xcCmdBuf);
wFREE(parmsVal);
- /* Close sockets */
-#if 0
+ /* Close sockets */
wCLOSE(gagtSockfd);
-#endif
wCLOSE(gxcSockfd);
wCLOSE(btSockfd);
@@ -398,10 +371,10 @@
{
if(tgSockfds[i] != -1)
{
- wCLOSE(tgSockfds[i]);
+ wCLOSE(tgSockfds[i]);
tgSockfds[i] = -1;
}
}
- DPRINT_INFO(WFA_OUT,"exit from application\n");
+
return 0;
}
diff --git a/dut/wfa_dut_init.c b/dut/wfa_dut_init.c
index f8c76c7..d24bf49 100644
--- a/dut/wfa_dut_init.c
+++ b/dut/wfa_dut_init.c
@@ -54,11 +54,6 @@
void wfa_dut_init(BYTE **tBuf, BYTE **rBuf, BYTE **paBuf, BYTE **cBuf, struct timeval **timerp)
{
/* allocate the traffic stream table */
- printf(" %s \n",__func__);
-
- if(tBuf == NULL || rBuf == NULL || paBuf == NULL || cBuf == NULL || timerp == NULL )
- printf("one of the buffer is null \n");
-
gStreams = (tgStream_t *) malloc(WFA_MAX_TRAFFIC_STREAMS*sizeof(tgStream_t));
if(gStreams == NULL)
{
diff --git a/inc/wfa_nw_al.h b/inc/wfa_nw_al.h
deleted file mode 100644
index 7eb137a..0000000
--- a/inc/wfa_nw_al.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-*
-* Copyright (c) 2014 Wi-Fi Alliance
-*
-* Permission to use, copy, modify, and/or distribute this software for any
-* purpose with or without fee is hereby granted, provided that the above
-* copyright notice and this permission notice appear in all copies.
-*
-* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
-* USE OR PERFORMANCE OF THIS SOFTWARE.
-*
-*****************************************************************************/
-
-
-#ifndef _WFA_NW_AL_H
-#define _WFA_NW_AL_H
-
-#include <stdio.h> /* for printf() and fprintf() */
-#include <stdlib.h> /* for atoi() and exit() */
-#include <string.h> /* for memset() */
-#include <termios.h> /* for terminal */
-#include <time.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "wfa_portall.h"
-#include "wfa_types.h"
-#include "wfa_sock.h"
-
-
-#define CONN_TYPE_NONE 0
-#define CONN_TYPE_SERIAL 1
-#define CONN_TYPE_TCP 2
-#define CONN_TYPE_UDP 3
-
-#define CONNECTION_SERVER 1
-#define CONNECTION_CLIENT 0
-
-#define IPV4_ADDR_STR_LEN 16
-
-
-typedef struct tcpUdp{
- char device[32];
- int sockfd;
- int clientSockfd;
- int srvFlag; /* true (1): its server false(0): client*/
- int port;
- char srcIpaddr[IPV4_ADDR_STR_LEN];
- struct sockaddr_in to;
- struct sockaddr_in from;
- }t_tcpUdp;
-
-typedef struct serial{
- char device[32];
- int fd;
- int baudrate;
-
- struct termios oldtio;
- struct termios newtio;
- }t_serial;
-
-typedef struct ifaceHandle{
- int ifaceType; /** numeric id*/
- char ifName[16]; /** name of the interface*/
- fd_set fds;
- struct timeval timeout; /* timeout for the blocking read */
- union if_attr{
- t_serial serial;
- t_tcpUdp ipConn;
- }if_attr;
-}t_ifaceHandle;
-
-
-
-
-
-extern int wfaOpenInterFace(t_ifaceHandle *handle, char * ifaceName, int typeOfConn, int servFlag );
-extern int wfaInterFacePeerInfoSet(t_ifaceHandle *handle, char *destIpAddr, int dstPort, int dstBuad, int typeOfConn );
-extern int wfaInterFacePeerConn(t_ifaceHandle *handle );
-extern int wfaInterFacePeerConnClose(t_ifaceHandle *handle );
-
-extern int wfaInterFaceClose(t_ifaceHandle *handle );
-extern int wfaInterFaceDataSend(t_ifaceHandle *handle, char *buffer, int bufferLen );
-extern int wfaInterFaceDataRecv(t_ifaceHandle *handle, char *buffer, int bufferLen, int *recvLen );
-
-#endif /* _WFA_NW_AL_H */
diff --git a/inc/wfa_portall.h b/inc/wfa_portall.h
index d50a21d..ca19143 100644
--- a/inc/wfa_portall.h
+++ b/inc/wfa_portall.h
@@ -16,10 +16,6 @@
*
*****************************************************************************/
-
-#ifndef _WFA_PORTALL_H
-#define _WFA_PORTALL_H
-
/* The fixed definition for the device interface name */
/* For different OSes or your platforms, you may not */
/* need to use fixed definition */
@@ -181,4 +177,4 @@
void *mem;
} wfaMemBlk_t;
-#endif /*_WFA_PORTALL_H*/
+
diff --git a/inc/wfa_serial.h b/inc/wfa_serial.h
deleted file mode 100644
index 31ca61a..0000000
--- a/inc/wfa_serial.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-*
-* Copyright (c) 2014 Wi-Fi Alliance
-*
-* Permission to use, copy, modify, and/or distribute this software for any
-* purpose with or without fee is hereby granted, provided that the above
-* copyright notice and this permission notice appear in all copies.
-*
-* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
-* USE OR PERFORMANCE OF THIS SOFTWARE.
-*
-*****************************************************************************/
-
-
-#ifndef _WFA_SERIAL_H
-#define _WFA_SERIAL_H
-
-#include <stdio.h> /* for printf() and fprintf() */
-
-#include <string.h> /* for memset() */
-#include <unistd.h> /* for close() */
-
-#include <stdlib.h> /* for atoi() and exit() */
-#include <string.h> /* for memset()*/
-#include <fcntl.h> /* for fcntl() */
-#include <errno.h>
-
-#include "wfa_nw_al.h"
-
-extern int wfaOpenSerial(t_ifaceHandle *handle, char *device, int baudRate);
-extern int wfaCloseSerial(t_ifaceHandle *handle);
-extern int wfaSerialSend(t_ifaceHandle *handle, char *buffer, int bufferLen);
-extern int wfaSerialRecv(t_ifaceHandle *handle, char *buffer, int bufferLen, int *recevLen);
-
-#endif /* _WFA_SERIAL_H */
-
diff --git a/inc/wfa_sock.h b/inc/wfa_sock.h
index 32a7b36..27aafce 100644
--- a/inc/wfa_sock.h
+++ b/inc/wfa_sock.h
@@ -49,14 +49,10 @@
int *psfd; /* wmm-ps socket id */
};
-extern int wfaCreateTCPServSock(char *devIface, unsigned short port);
-
+extern int wfaCreateTCPServSock(unsigned short sport);
extern int wfaCreateUDPSock(char *sipaddr, unsigned short sport);
extern int wfaAcceptTCPConn(int servSock);
-
extern int wfaConnectUDPPeer(int sock, char *dipaddr, int dport);
-extern int wfaConnectTCPPeer(int mysock, char *daddr, int dport);
-
extern void wfaSetSockFiDesc(fd_set *sockset, int *, struct sockfds *);
#ifdef _WINDOWS
extern int wfaCtrlSend(SOCKET sock, unsigned char *buf, int bufLen);