diff --git a/examples/tcpblaster/tcpblaster_client.c b/examples/tcpblaster/tcpblaster_client.c index a5a7a6ad8..4d89853d0 100644 --- a/examples/tcpblaster/tcpblaster_client.c +++ b/examples/tcpblaster/tcpblaster_client.c @@ -67,7 +67,7 @@ void tcpblaster_client(void) #endif struct timespec start; socklen_t addrlen; - char *outbuf; + FAR char *outbuf; unsigned long sendtotal; unsigned long totallost; int sendcount; @@ -79,7 +79,7 @@ void tcpblaster_client(void) /* Allocate buffers */ - outbuf = (char*)malloc(SENDSIZE); + outbuf = (FAR char *)malloc(SENDSIZE); if (!outbuf) { printf("client: failed to allocate buffers\n"); @@ -104,20 +104,23 @@ void tcpblaster_client(void) addrlen = sizeof(struct sockaddr_in6); printf("Connecting to IPv6 Address: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - g_tcpblasterserver_ipv6[0], g_tcpblasterserver_ipv6[1], g_tcpblasterserver_ipv6[2], g_tcpblasterserver_ipv6[3], - g_tcpblasterserver_ipv6[4], g_tcpblasterserver_ipv6[5], g_tcpblasterserver_ipv6[6], g_tcpblasterserver_ipv6[7]); + g_tcpblasterserver_ipv6[0], g_tcpblasterserver_ipv6[1], + g_tcpblasterserver_ipv6[2], g_tcpblasterserver_ipv6[3], + g_tcpblasterserver_ipv6[4], g_tcpblasterserver_ipv6[5], + g_tcpblasterserver_ipv6[6], g_tcpblasterserver_ipv6[7]); #else server.sin_family = AF_INET; server.sin_port = HTONS(CONFIG_EXAMPLES_TCPBLASTER_SERVER_PORTNO); server.sin_addr.s_addr = (in_addr_t)g_tcpblasterserver_ipv4; addrlen = sizeof(struct sockaddr_in); - printf("Connecting to IPv4 Address: %08lx\n", (unsigned long)g_tcpblasterserver_ipv4); + printf("Connecting to IPv4 Address: %08lx\n", + (unsigned long)g_tcpblasterserver_ipv4); #endif /* Connect the socket to the server */ - if (connect( sockfd, (struct sockaddr*)&server, addrlen) < 0) + if (connect(sockfd, (FAR struct sockaddr *)&server, addrlen) < 0) { printf("client: connect failure: %d\n", errno); goto errout_with_socket; @@ -220,8 +223,10 @@ void tcpblaster_client(void) fkbrecvd = (float)sendtotal / 1024.0; felapsed = (float)elapsed.tv_sec + (float)elapsed.tv_nsec / 1000000000.0; - printf("Sent %d buffers: %7.1f Kb (avg %5.1f Kb) in %6.2f Sec (%7.1f Kb/Sec)\n", - sendcount, fkbrecvd, fkbrecvd/sendcount, felapsed, fkbrecvd/felapsed); + printf("Sent %d buffers: %7.1f Kb (avg %5.1f Kb) in " + "%6.2f Sec (%7.1f Kb/Sec)\n", + sendcount, fkbrecvd, fkbrecvd / sendcount, felapsed, + fkbrecvd / felapsed); if (partials > 0) { @@ -238,7 +243,7 @@ void tcpblaster_client(void) totallost = 0; clock_gettime(CLOCK_REALTIME, &start); - } + } } free(outbuf); diff --git a/examples/tcpblaster/tcpblaster_cmdline.c b/examples/tcpblaster/tcpblaster_cmdline.c index 04450e196..418f037c5 100644 --- a/examples/tcpblaster/tcpblaster_cmdline.c +++ b/examples/tcpblaster/tcpblaster_cmdline.c @@ -53,15 +53,15 @@ uint16_t g_tcpblasterserver_ipv6[8] = { -#if defined(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK) && defined(NET_LOOPBACK) - 0 /* Use the loopback address */ - 0 - 0 - 0 - 0 - 0 - 0 - HTONS(1); +#if defined(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK) && defined(CONFIG_NET_LOOPBACK) + 0, /* Use the loopback address */ + 0, + 0, + 0, + 0, + 0, + 0, + HTONS(1) #else HTONS(CONFIG_EXAMPLES_TCPBLASTER_SERVERIPv6ADDR_1), HTONS(CONFIG_EXAMPLES_TCPBLASTER_SERVERIPv6ADDR_2), @@ -76,7 +76,7 @@ uint16_t g_tcpblasterserver_ipv6[8] = #else -#if defined(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK) && defined(NET_LOOPBACK) +#if defined(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK) && defined(CONFIG_NET_LOOPBACK) uint32_t g_tcpblasterserver_ipv4 = HTONL(0x7f000001); #else uint32_t g_tcpblasterserver_ipv4 = HTONL(CONFIG_EXAMPLES_TCPBLASTER_SERVERIP); diff --git a/examples/tcpblaster/tcpblaster_server.c b/examples/tcpblaster/tcpblaster_server.c index f678ff1c8..39b8dd15a 100644 --- a/examples/tcpblaster/tcpblaster_server.c +++ b/examples/tcpblaster/tcpblaster_server.c @@ -72,7 +72,7 @@ void tcpblaster_server(void) struct timespec start; unsigned long recvtotal; socklen_t addrlen; - char *buffer; + FAR char *buffer; int recvcount; int listensd; int acceptsd; @@ -81,7 +81,7 @@ void tcpblaster_server(void) /* Allocate a BIG buffer */ - buffer = (char*)malloc(SENDSIZE); + buffer = (FAR char *)malloc(SENDSIZE); if (!buffer) { printf("server: failed to allocate buffer\n"); @@ -100,7 +100,8 @@ void tcpblaster_server(void) /* Set socket to reuse address */ optval = 1; - if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0) + if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (FAR void *)&optval, + sizeof(int)) < 0) { printf("server: setsockopt SO_REUSEADDR failure: %d\n", errno); goto errout_with_listensd; @@ -112,7 +113,7 @@ void tcpblaster_server(void) myaddr.sin6_family = AF_INET6; myaddr.sin6_port = HTONS(CONFIG_EXAMPLES_TCPBLASTER_SERVER_PORTNO); -#if defined(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK) && !defined(NET_LOOPBACK) +#if defined(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK) && !defined(CONFIG_NET_LOOPBACK) memcpy(myaddr.sin6_addr.s6_addr16, g_tcpblasterserver_ipv6, 8 * sizeof(uint16_t)); #else memset(myaddr.sin6_addr.s6_addr16, 0, 8 * sizeof(uint16_t)); @@ -128,7 +129,7 @@ void tcpblaster_server(void) myaddr.sin_family = AF_INET; myaddr.sin_port = HTONS(CONFIG_EXAMPLES_TCPBLASTER_SERVER_PORTNO); -#if defined(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK) && !defined(NET_LOOPBACK) +#if defined(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK) && !defined(CONFIG_NET_LOOPBACK) myaddr.sin_addr.s_addr = (in_addr_t)g_tcpblasterserver_ipv4; #else myaddr.sin_addr.s_addr = INADDR_ANY; @@ -139,7 +140,7 @@ void tcpblaster_server(void) (unsigned long)myaddr.sin_addr.s_addr); #endif - if (bind(listensd, (struct sockaddr*)&myaddr, addrlen) < 0) + if (bind(listensd, (FAR struct sockaddr *)&myaddr, addrlen) < 0) { printf("server: bind failure: %d\n", errno); goto errout_with_listensd; @@ -157,7 +158,7 @@ void tcpblaster_server(void) printf("server: Accepting connections on port %d\n", CONFIG_EXAMPLES_TCPBLASTER_SERVER_PORTNO); - acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen); + acceptsd = accept(listensd, (FAR struct sockaddr *)&myaddr, &addrlen); if (acceptsd < 0) { printf("server: accept failure: %d\n", errno); @@ -249,14 +250,16 @@ void tcpblaster_server(void) fkbsent = (float)recvtotal / 1024.0; felapsed = (float)elapsed.tv_sec + (float)elapsed.tv_nsec / 1000000000.0; - printf("Received %d buffers: %7.1f Kb (avg %5.1f Kb) in %6.2f Sec (%7.1f Kb/Sec)\n", - recvcount, fkbsent, fkbsent/recvcount, felapsed, fkbsent/felapsed); + printf("Received %d buffers: %7.1f Kb (avg %5.1f Kb) in " + "%6.2f Sec (%7.1f Kb/Sec)\n", + recvcount, fkbsent, fkbsent / recvcount, felapsed, + fkbsent / felapsed); recvcount = 0; recvtotal = 0; clock_gettime(CLOCK_REALTIME, &start); - } + } } errout_with_acceptsd: