From ea7437c2a82937019c50eb1de6d4524bcfe17dec Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 22 May 2020 04:17:48 +0800 Subject: [PATCH] Fix nxstyle issue Signed-off-by: Xiang Xiao --- examples/flowc/flowc_receiver.c | 6 +- examples/flowc/flowc_sender.c | 3 +- examples/nettest/nettest_client.c | 45 +++++---- examples/nettest/nettest_netinit.c | 5 +- examples/nettest/nettest_server.c | 44 +++++---- examples/nettest/nettest_target1.c | 12 ++- examples/nettest/nettest_target2.c | 7 +- examples/tcpblaster/tcpblaster_target1.c | 9 +- examples/tcpblaster/tcpblaster_target2.c | 4 + examples/udp/udp_client.c | 21 ++-- examples/udpblaster/udpblaster_target.c | 50 ++++++---- examples/udpblaster/udpblaster_text.c | 118 ++++++++++++----------- 12 files changed, 191 insertions(+), 133 deletions(-) diff --git a/examples/flowc/flowc_receiver.c b/examples/flowc/flowc_receiver.c index 210ad2b8f..57e4722a2 100644 --- a/examples/flowc/flowc_receiver.c +++ b/examples/flowc/flowc_receiver.c @@ -59,7 +59,8 @@ * Public Data ****************************************************************************/ -static char g_tty_devname[MAX_DEVNAME] = CONFIG_EXAMPLES_FLOWC_RECEVER_DEVNAME; +static char g_tty_devname[MAX_DEVNAME] = + CONFIG_EXAMPLES_FLOWC_RECEVER_DEVNAME; static char g_expected = 0x20; static unsigned int g_nerrors; static unsigned long g_count; @@ -83,7 +84,8 @@ static inline void check_buffer(FAR uint8_t *buf, size_t buflen) { if (*ptr != ch) { - printf("receiver: ERROR: Expected %c (%02x), found %c (%02x) at count=%lu\n", + printf("receiver: ERROR: " + "Expected %c (%02x), found %c (%02x) at count=%lu\n", isprint(ch) ? ch : '.', ch, isprint(*ptr) ? *ptr : '.', *ptr, count); diff --git a/examples/flowc/flowc_sender.c b/examples/flowc/flowc_sender.c index 5b24b979b..a0d546725 100644 --- a/examples/flowc/flowc_sender.c +++ b/examples/flowc/flowc_sender.c @@ -54,7 +54,8 @@ * Public Data ****************************************************************************/ -static char g_tty_devname[MAX_DEVNAME] = CONFIG_EXAMPLES_FLOWC_SENDER_DEVNAME; +static char g_tty_devname[MAX_DEVNAME] = + CONFIG_EXAMPLES_FLOWC_SENDER_DEVNAME; /**************************************************************************** * Private Functions diff --git a/examples/nettest/nettest_client.c b/examples/nettest/nettest_client.c index c9059d36b..909e40cb9 100644 --- a/examples/nettest/nettest_client.c +++ b/examples/nettest/nettest_client.c @@ -79,9 +79,9 @@ void nettest_client(void) /* Allocate buffers */ - outbuf = (char*)malloc(SENDSIZE); + outbuf = malloc(SENDSIZE); #ifndef CONFIG_EXAMPLES_NETTEST_PERFORMANCE - inbuf = (char*)malloc(SENDSIZE); + inbuf = malloc(SENDSIZE); if (!outbuf || !inbuf) #else if (!outbuf) @@ -103,26 +103,30 @@ void nettest_client(void) /* Set up the server address */ #ifdef CONFIG_EXAMPLES_NETTEST_IPv6 - server.sin6_family = AF_INET6; - server.sin6_port = HTONS(CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO); - memcpy(server.sin6_addr.s6_addr16, g_nettestserver_ipv6, 8 * sizeof(uint16_t)); - addrlen = sizeof(struct sockaddr_in6); + server.sin6_family = AF_INET6; + server.sin6_port = HTONS(CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO); + memcpy(server.sin6_addr.s6_addr16, + g_nettestserver_ipv6, 8 * sizeof(uint16_t)); + addrlen = sizeof(struct sockaddr_in6); - printf("Connecting to IPv6 Address: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - g_nettestserver_ipv6[0], g_nettestserver_ipv6[1], g_nettestserver_ipv6[2], g_nettestserver_ipv6[3], - g_nettestserver_ipv6[4], g_nettestserver_ipv6[5], g_nettestserver_ipv6[6], g_nettestserver_ipv6[7]); + printf("Connecting to Address: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + g_nettestserver_ipv6[0], g_nettestserver_ipv6[1], + g_nettestserver_ipv6[2], g_nettestserver_ipv6[3], + g_nettestserver_ipv6[4], g_nettestserver_ipv6[5], + g_nettestserver_ipv6[6], g_nettestserver_ipv6[7]); #else - server.sin_family = AF_INET; - server.sin_port = HTONS(CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO); - server.sin_addr.s_addr = (in_addr_t)g_nettestserver_ipv4; - addrlen = sizeof(struct sockaddr_in); + server.sin_family = AF_INET; + server.sin_port = HTONS(CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO); + server.sin_addr.s_addr = (in_addr_t)g_nettestserver_ipv4; + addrlen = sizeof(struct sockaddr_in); - printf("Connecting to IPv4 Address: %08lx\n", (unsigned long)g_nettestserver_ipv4); + printf("Connecting to Address: %08lx\n", + (unsigned long)g_nettestserver_ipv4); #endif /* Connect the socket to the server */ - if (connect( sockfd, (struct sockaddr*)&server, addrlen) < 0) + if (connect(sockfd, (struct sockaddr *)&server, addrlen) < 0) { printf("client: connect failure: %d\n", errno); goto errout_with_socket; @@ -145,7 +149,7 @@ void nettest_client(void) #ifdef CONFIG_EXAMPLES_NETTEST_PERFORMANCE /* Then send messages forever */ - for (;;) + for (; ; ) { nbytessent = send(sockfd, outbuf, SENDSIZE, 0); if (nbytessent < 0) @@ -176,7 +180,8 @@ void nettest_client(void) } else if (nbytessent != SENDSIZE) { - printf("client: Bad send length: %d Expected: %d\n", nbytessent, SENDSIZE); + printf("client: Bad send length: %d Expected: %d\n", + nbytessent, SENDSIZE); goto errout_with_socket; } @@ -184,7 +189,8 @@ void nettest_client(void) do { printf("client: Receiving...\n"); - nbytesrecvd = recv(sockfd, &inbuf[totalbytesrecvd], SENDSIZE - totalbytesrecvd, 0); + nbytesrecvd = recv(sockfd, &inbuf[totalbytesrecvd], + SENDSIZE - totalbytesrecvd, 0); if (nbytesrecvd < 0) { @@ -204,7 +210,8 @@ void nettest_client(void) if (totalbytesrecvd != SENDSIZE) { - printf("client: Bad recv length: %d Expected: %d\n", totalbytesrecvd, SENDSIZE); + printf("client: Bad recv length: %d Expected: %d\n", + totalbytesrecvd, SENDSIZE); goto errout_with_socket; } else if (memcmp(inbuf, outbuf, SENDSIZE) != 0) diff --git a/examples/nettest/nettest_netinit.c b/examples/nettest/nettest_netinit.c index bec7ceb89..961b53c08 100644 --- a/examples/nettest/nettest_netinit.c +++ b/examples/nettest/nettest_netinit.c @@ -1,7 +1,8 @@ /**************************************************************************** * examples/nettest/nettest_netinit.c * - * Copyright (C) 2007, 2009-2011, 2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009-2011, 2015, 2017 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -126,7 +127,7 @@ void nettest_initialize(void) uint8_t mac[IFHWADDRLEN]; #endif -/* Many embedded network interfaces must have a software assigned MAC */ + /* Many embedded network interfaces must have a software assigned MAC */ #ifdef CONFIG_EXAMPLES_NETTEST_NOMAC mac[0] = 0x00; diff --git a/examples/nettest/nettest_server.c b/examples/nettest/nettest_server.c index 0d690edae..80aee4f0e 100644 --- a/examples/nettest/nettest_server.c +++ b/examples/nettest/nettest_server.c @@ -82,7 +82,7 @@ void nettest_server(void) /* Allocate a BIG buffer */ - buffer = (char*)malloc(2*SENDSIZE); + buffer = malloc(2*SENDSIZE); if (!buffer) { printf("server: failed to allocate buffer\n"); @@ -101,7 +101,8 @@ void nettest_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, + (void *)&optval, sizeof(int)) < 0) { printf("server: setsockopt SO_REUSEADDR failure: %d\n", errno); goto errout_with_listensd; @@ -111,28 +112,29 @@ void nettest_server(void) #ifdef CONFIG_EXAMPLES_NETTEST_IPv6 - myaddr.sin6_family = AF_INET6; - myaddr.sin6_port = HTONS(CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO); + myaddr.sin6_family = AF_INET6; + myaddr.sin6_port = HTONS(CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO); #if defined(CONFIG_EXAMPLES_NETTEST_LOOPBACK) && !defined(NET_LOOPBACK) - memcpy(myaddr.sin6_addr.s6_addr16, g_nettestserver_ipv6, 8 * sizeof(uint16_t)); + memcpy(myaddr.sin6_addr.s6_addr16, + g_nettestserver_ipv6, 8 * sizeof(uint16_t)); #else memset(myaddr.sin6_addr.s6_addr16, 0, 8 * sizeof(uint16_t)); #endif addrlen = sizeof(struct sockaddr_in6); - printf("Binding to IPv6 Address: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + printf("Binding to Address: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", myaddr.sin6_addr.s6_addr16[0], myaddr.sin6_addr.s6_addr16[1], myaddr.sin6_addr.s6_addr16[2], myaddr.sin6_addr.s6_addr16[3], myaddr.sin6_addr.s6_addr16[4], myaddr.sin6_addr.s6_addr16[5], myaddr.sin6_addr.s6_addr16[6], myaddr.sin6_addr.s6_addr16[7]); #else - myaddr.sin_family = AF_INET; - myaddr.sin_port = HTONS(CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO); + myaddr.sin_family = AF_INET; + myaddr.sin_port = HTONS(CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO); #if defined(CONFIG_EXAMPLES_NETTEST_LOOPBACK) && !defined(NET_LOOPBACK) - myaddr.sin_addr.s_addr = (in_addr_t)g_nettestserver_ipv4; + myaddr.sin_addr.s_addr = (in_addr_t)g_nettestserver_ipv4; #else - myaddr.sin_addr.s_addr = INADDR_ANY; + myaddr.sin_addr.s_addr = INADDR_ANY; #endif addrlen = sizeof(struct sockaddr_in); @@ -140,7 +142,7 @@ void nettest_server(void) (unsigned long)myaddr.sin_addr.s_addr); #endif - if (bind(listensd, (struct sockaddr*)&myaddr, addrlen) < 0) + if (bind(listensd, (struct sockaddr *)&myaddr, addrlen) < 0) { printf("server: bind failure: %d\n", errno); goto errout_with_listensd; @@ -158,7 +160,7 @@ void nettest_server(void) printf("server: Accepting connections on port %d\n", CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO); - acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen); + acceptsd = accept(listensd, (struct sockaddr *)&myaddr, &addrlen); if (acceptsd < 0) { printf("server: accept failure: %d\n", errno); @@ -173,7 +175,8 @@ void nettest_server(void) ling.l_onoff = 1; ling.l_linger = 30; /* timeout is seconds */ - if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)) < 0) + if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, + &ling, sizeof(struct linger)) < 0) { printf("server: setsockopt SO_LINGER failure: %d\n", errno); goto errout_with_acceptsd; @@ -183,7 +186,7 @@ void nettest_server(void) #ifdef CONFIG_EXAMPLES_NETTEST_PERFORMANCE /* Then receive data forever */ - for (;;) + for (; ; ) { nbytesread = recv(acceptsd, buffer, 2*SENDSIZE, 0); if (nbytesread < 0) @@ -207,7 +210,8 @@ void nettest_server(void) while (totalbytesread < SENDSIZE) { printf("server: Reading...\n"); - nbytesread = recv(acceptsd, &buffer[totalbytesread], 2*SENDSIZE - totalbytesread, 0); + nbytesread = recv(acceptsd, &buffer[totalbytesread], + 2 * SENDSIZE - totalbytesread, 0); if (nbytesread < 0) { printf("server: recv failed: %d\n", errno); @@ -227,7 +231,8 @@ void nettest_server(void) if (totalbytesread != SENDSIZE) { - printf("server: Received %d / Expected %d bytes\n", totalbytesread, SENDSIZE); + printf("server: Received %d / Expected %d bytes\n", + totalbytesread, SENDSIZE); goto errout_with_acceptsd; } @@ -236,7 +241,8 @@ void nettest_server(void) { if (buffer[i] != ch) { - printf("server: Byte %d is %02x / Expected %02x\n", i, buffer[i], ch); + printf("server: Byte %d is %02x / Expected %02x\n", + i, buffer[i], ch); goto errout_with_acceptsd; } @@ -258,8 +264,8 @@ void nettest_server(void) printf("server: Sent %d bytes\n", nbytessent); - /* If this platform only does abortive disconnects, then wait a bit to get the - * client side a change to receive the data. + /* If this platform only does abortive disconnects, then wait a bit to get + * the client side a change to receive the data. */ #if 1 /* Do it for all platforms */ diff --git a/examples/nettest/nettest_target1.c b/examples/nettest/nettest_target1.c index 19d410c51..e97aeee2f 100644 --- a/examples/nettest/nettest_target1.c +++ b/examples/nettest/nettest_target1.c @@ -1,7 +1,8 @@ /**************************************************************************** * examples/nettest/nettest_target1.c * - * Copyright (C) 2007, 2009-2011, 2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009-2011, 2015, 2017 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -91,16 +92,17 @@ int main(int argc, FAR char *argv[]) #if defined(CONFIG_EXAMPLES_NETTEST_LOOPBACK) /* Then perform the server side of the test on a child task */ - child = task_create("Nettest Child", CONFIG_EXAMPLES_NETTEST_DAEMON_PRIORITY, - CONFIG_EXAMPLES_NETTEST_DAEMON_STACKSIZE, server_child, - NULL); + child = task_create("Nettest Child", + CONFIG_EXAMPLES_NETTEST_DAEMON_PRIORITY, + CONFIG_EXAMPLES_NETTEST_DAEMON_STACKSIZE, + server_child, NULL); if (child < 0) { fprintf(stderr, "ERROR: Failed to server daemon\n"); return EXIT_FAILURE; } - usleep(500*1000); + usleep(500 * 1000); #elif defined(CONFIG_EXAMPLES_NETTEST_SERVER) /* Then perform the server side of the test on this thread */ diff --git a/examples/nettest/nettest_target2.c b/examples/nettest/nettest_target2.c index 40468b787..9bff57307 100644 --- a/examples/nettest/nettest_target2.c +++ b/examples/nettest/nettest_target2.c @@ -1,7 +1,8 @@ /**************************************************************************** * examples/nettest/nettest_target2.c * - * Copyright (C) 2007, 2009-2011, 2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009-2011, 2015, 2017 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +42,10 @@ #include #include "nettest.h" +/**************************************************************************** + * Public Functions + ****************************************************************************/ + /**************************************************************************** * nettest_main ****************************************************************************/ diff --git a/examples/tcpblaster/tcpblaster_target1.c b/examples/tcpblaster/tcpblaster_target1.c index c05d5aa6b..7be5d7c05 100644 --- a/examples/tcpblaster/tcpblaster_target1.c +++ b/examples/tcpblaster/tcpblaster_target1.c @@ -91,16 +91,17 @@ int main(int argc, FAR char *argv[]) #if defined(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK) /* Then perform the server side of the test on a child task */ - child = task_create("TcpBlaster Child", CONFIG_EXAMPLES_TCPBLASTER_DAEMON_PRIORITY, - CONFIG_EXAMPLES_TCPBLASTER_DAEMON_STACKSIZE, server_child, - NULL); + child = task_create("TcpBlaster Child", + CONFIG_EXAMPLES_TCPBLASTER_DAEMON_PRIORITY, + CONFIG_EXAMPLES_TCPBLASTER_DAEMON_STACKSIZE, + server_child, NULL); if (child < 0) { fprintf(stderr, "ERROR: Failed to server daemon\n"); return EXIT_FAILURE; } - usleep(500*1000); + usleep(500 * 1000); #elif defined(CONFIG_EXAMPLES_TCPBLASTER_SERVER) /* Then perform the server side of the test on this thread */ diff --git a/examples/tcpblaster/tcpblaster_target2.c b/examples/tcpblaster/tcpblaster_target2.c index d9ace1fc6..413642638 100644 --- a/examples/tcpblaster/tcpblaster_target2.c +++ b/examples/tcpblaster/tcpblaster_target2.c @@ -41,6 +41,10 @@ #include #include "tcpblaster.h" +/**************************************************************************** + * Public Functions + ****************************************************************************/ + /**************************************************************************** * tcpblaster_main ****************************************************************************/ diff --git a/examples/udp/udp_client.c b/examples/udp/udp_client.c index 3aabcbd2e..d184e8749 100644 --- a/examples/udp/udp_client.c +++ b/examples/udp/udp_client.c @@ -122,6 +122,7 @@ static inline void fill_buffer(unsigned char *buf, int offset) { j = 1; } + buf[j] = ch; } } @@ -177,22 +178,23 @@ void udp_client(void) /* Set up the server address */ #ifdef CONFIG_EXAMPLES_UDP_IPv6 - server.sin6_family = AF_INET6; - server.sin6_port = HTONS(CONFIG_EXAMPLES_UDP_SERVER_PORTNO); - memcpy(server.sin6_addr.s6_addr16, g_udpserver_ipv6, 8 * sizeof(uint16_t)); - addrlen = sizeof(struct sockaddr_in6); + server.sin6_family = AF_INET6; + server.sin6_port = HTONS(CONFIG_EXAMPLES_UDP_SERVER_PORTNO); + memcpy(server.sin6_addr.s6_addr16, + g_udpserver_ipv6, 8 * sizeof(uint16_t)); + addrlen = sizeof(struct sockaddr_in6); #else - server.sin_family = AF_INET; - server.sin_port = HTONS(CONFIG_EXAMPLES_UDP_SERVER_PORTNO); - server.sin_addr.s_addr = (in_addr_t)g_udpserver_ipv4; - addrlen = sizeof(struct sockaddr_in); + server.sin_family = AF_INET; + server.sin_port = HTONS(CONFIG_EXAMPLES_UDP_SERVER_PORTNO); + server.sin_addr.s_addr = (in_addr_t)g_udpserver_ipv4; + addrlen = sizeof(struct sockaddr_in); #endif /* Send the message */ printf("client: %d. Sending %d bytes\n", offset, SENDSIZE); nbytes = sendto(sockfd, outbuf, SENDSIZE, 0, - (struct sockaddr*)&server, addrlen); + (struct sockaddr *)&server, addrlen); printf("client: %d. Sent %d bytes\n", offset, nbytes); if (nbytes < 0) @@ -215,5 +217,6 @@ void udp_client(void) sleep(2); } + close(sockfd); } diff --git a/examples/udpblaster/udpblaster_target.c b/examples/udpblaster/udpblaster_target.c index 01aed5045..928883373 100644 --- a/examples/udpblaster/udpblaster_target.c +++ b/examples/udpblaster/udpblaster_target.c @@ -183,7 +183,7 @@ static void netest_initialize(void) netlib_ifup("eth0"); } -#endif /*CONFIG_EXAMPLES_UDPBLASTER_INIT */ +#endif /* CONFIG_EXAMPLES_UDPBLASTER_INIT */ /**************************************************************************** * Public Functions @@ -242,14 +242,22 @@ int main(int argc, FAR char *argv[]) #else host.sin6_family = AF_INET6; host.sin6_port = HTONS(UDPBLASTER_HOST_PORTNO); - host.sin6_addr.s6_addr16[0] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_1); - host.sin6_addr.s6_addr16[1] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_2); - host.sin6_addr.s6_addr16[2] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_3); - host.sin6_addr.s6_addr16[3] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_4); - host.sin6_addr.s6_addr16[4] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_5); - host.sin6_addr.s6_addr16[5] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_6); - host.sin6_addr.s6_addr16[6] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_7); - host.sin6_addr.s6_addr16[7] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_8); + host.sin6_addr.s6_addr16[0] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_1); + host.sin6_addr.s6_addr16[1] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_2); + host.sin6_addr.s6_addr16[2] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_3); + host.sin6_addr.s6_addr16[3] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_4); + host.sin6_addr.s6_addr16[4] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_5); + host.sin6_addr.s6_addr16[5] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_6); + host.sin6_addr.s6_addr16[6] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_7); + host.sin6_addr.s6_addr16[7] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_8); sockfd = socket(PF_INET6, SOCK_DGRAM, 0); if (sockfd < 0) @@ -261,14 +269,22 @@ int main(int argc, FAR char *argv[]) target.sin6_family = AF_INET6; target.sin6_port = HTONS(UDPBLASTER_TARGET_PORTNO); - target.sin6_addr.s6_addr16[0] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_1); - target.sin6_addr.s6_addr16[1] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_2); - target.sin6_addr.s6_addr16[2] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_3); - target.sin6_addr.s6_addr16[3] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_4); - target.sin6_addr.s6_addr16[4] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_5); - target.sin6_addr.s6_addr16[5] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_6); - target.sin6_addr.s6_addr16[6] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_7); - target.sin6_addr.s6_addr16[7] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_8); + target.sin6_addr.s6_addr16[0] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_1); + target.sin6_addr.s6_addr16[1] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_2); + target.sin6_addr.s6_addr16[2] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_3); + target.sin6_addr.s6_addr16[3] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_4); + target.sin6_addr.s6_addr16[4] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_5); + target.sin6_addr.s6_addr16[5] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_6); + target.sin6_addr.s6_addr16[6] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_7); + target.sin6_addr.s6_addr16[7] = + HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_8); addrlen = sizeof(struct sockaddr_in6); if (bind(sockfd, (struct sockaddr *)&target, addrlen) < 0) diff --git a/examples/udpblaster/udpblaster_text.c b/examples/udpblaster/udpblaster_text.c index ad057da4b..6c0c2d11b 100644 --- a/examples/udpblaster/udpblaster_text.c +++ b/examples/udpblaster/udpblaster_text.c @@ -57,65 +57,75 @@ const char g_udpblaster_text[] = "They went along, and they went along, and they went along, till they " "met Ducky-daddles. 'Where are you going to, Hennypenny and Cocky-locky?' " - "says Ducky-daddles. 'Oh! we're going to tell the king the sky's a-falling,' " - "said Henny-penny and Cocky-locky. 'May I come with you?' said Ducky-daddles. " - "'Certainly,' said Henny-penny and Cocky-locky. So Hennypenny, Cocky-locky, " - "and Ducky-daddles went to tell the king the sky was a-falling.\n\n" + "says Ducky-daddles. 'Oh! we're going to tell the king the sky's a-" + "falling,' said Henny-penny and Cocky-locky. 'May I come with you?' said " + "Ducky-daddles. 'Certainly,' said Henny-penny and Cocky-locky. So " + "Hennypenny, Cocky-locky, and Ducky-daddles went to tell the king the sky " + "was a-falling.\n\n" - "So they went along and they went along, and they went along, till they met " - "Goosey-poosey. 'Where are you going to, Henny-penny, Cocky-locky, and " - "Ducky-daddles?' said Gooseypoosey. 'Oh! we're going to tell the king the " - "sky's a-falling,' said Henny-penny and Cocky-locky and Ducky-daddles. 'May " - "I come with you?' said Goosey-poosey. 'Certainly,' said Hennypenny, " - "Cocky-locky, and Ducky-daddles. So Henny-penny, Cocky-locky, Ducky-daddles, " - "and Goosey-poosey went to tell the king the sky was a-falling.\n\n" - - "So they went along, and they went along, and they went along, till they met " - "Turkey-lurkey. 'Where are you going, Henny-penny, Cocky-locky, Ducky-daddles, " - "and Gooseypoosey?' says Turkey-turkey. 'Oh! we're going to tell the king the " - "sky's a-falling,' said Henny-penny, Cocky-locky, Duckydaddies, and Goosey-poosey. " - "'May I come with you, Hennypenny, Cocky-locky, Ducky-daddles, and Goosey-poosey?' " - "said Turkey-lurkey. 'Oh, certainly, Turkey-turkey,' said Henny-penny, Cocky-locky, " - "Ducky-daddles, and Gooseypoosey. So Henny-penny, Cocky-locky, Ducky-daddles, " - "Goosey-poosey, and Turkey-lurkey all went to tell the king the sky was a-" + "So they went along and they went along, and they went along, till they " + "met Goosey-poosey. 'Where are you going to, Henny-penny, Cocky-locky," + "and Ducky-daddles?' said Gooseypoosey. 'Oh! we're going to tell the king " + "the sky's a-falling,' said Henny-penny and Cocky-locky and Ducky-" + "daddles. 'May I come with you?' said Goosey-poosey. 'Certainly,' said " + "Hennypenny, Cocky-locky, and Ducky-daddles. So Henny-penny, Cocky-locky, " + "Ducky-daddles, and Goosey-poosey went to tell the king the sky was a-" "falling.\n\n" - "So they went along, and they went along, and they went along, till they met " - "Foxy-woxy, and Foxy-woxy said to Hennypenny, Cocky-locky, Ducky-daddles, " - "Goosey-poosey, and Turkey-lurkey: 'Where are you going, Henny-penny, " - "Cockylocky, Ducky-daddles, Goosey-poosey, and Turkey-lurkey?' And Henny-penny, " - "Cocky-locky, Ducky-daddles, Goosey poosey, and Turkey-lurkey said to " - "Foxy-woxy: 'We' re going to tell the king the sky's a-falling.' 'Oh! but " - "this is not the way to the king, Henny-penny, Cocky-locky, Ducky-daddles, " - "Goosey-poosey, and Turkey-lurkey,' says Foxy-woxy; 'I know the proper way; " - "shall I show it you?' 'Oh, certainly, Foxywoxy,' said Henny-penny, Cocky-locky, " - "Ducky-daddles, Goosey-poosey, and Turkey-lurkey. So Henny-penny, Cockylocky, " - "Ducky-daddles, Goosey-poosey, Turkey-lurkey, and Foxy-woxy all went to tell " - "the king the sky was a-falling. So they went along, and they went along, and " - "they went along, till they came to a narrow and dark hole. Now this was the " - "door of Foxy-woxy's cave. But Foxy-woxy said to Henny-penny, Cocky-locky, " - "Ducky-daddles, Goosey-poosey, and Turkeyturkey: 'This is the short way to the " - "king's palace: you'll soon get there if you follow me. I will go first and you " - "come after, Henny-penny, Cocky-locky, Ducky-daddles, Goosey-poosey, and " - "Turkey-turkey.' 'Why, of course, certainly, without doubt, why not?' said " - "Henny-penny, Cocky-locky, Ducky-daddles, Goosey-poosey, and Turkey-lurkey.\n\n" + "So they went along, and they went along, and they went along, till they " + "met Turkey-lurkey. 'Where are you going, Henny-penny, Cocky-locky, Ducky-" + "daddles, and Gooseypoosey?' says Turkey-turkey. 'Oh! we're going to tell " + "the king the sky's a-falling,' said Henny-penny, Cocky-locky, " + "Duckydaddies, and Goosey-poosey. 'May I come with you, Hennypenny, " + "Cocky-locky, Ducky-daddles, and Goosey-poosey?' said Turkey-lurkey. 'Oh, " + " certainly, Turkey-turkey,' said Henny-penny, Cocky-locky, " + "Ducky-daddles, and Gooseypoosey. So Henny-penny, Cocky-locky, Ducky-" + "daddles,Goosey-poosey, and Turkey-lurkey all went to tell the king " + "the sky was a-falling.\n\n" - "So Foxy-woxy went into his cave, and he didn't go very far, but turned round " - "to wait for Henny-penny, Cocky-locky, Ducky-daddles, Goosey-poosey, and " - "Turkey-lurkey. So at last at first Turkey-lurkey went through the dark hole " - "into the cave. He hadn't got far when 'Hrumph', Foxy-woxy snapped off Turkey-" - "lurkey's head and threw his body over his left shoulder. Then Goosey-poosey " - "went in, and 'Hrumph', off went her head and Goosey-poosey was thrown beside " - "Turkey-lurkey. Then Ducky-daddles waddled down, and 'Hrumph', snapped " - "Foxy-woxy, and Ducky-daddles's head was off and Duckydaddies was thrown " - "alongside Turkey-turkey and Gooseypoosey. Then Cocky-locky strutted down " - "into the cave, and he hadn't gone far when 'Snap, Hrumph!' went Foxy-woxy, " - "and Cocky-locky was thrown alongside of Turkey-lurkey, Gooseypoosey, and " - "Ducky-daddles.\n\n" + "So they went along, and they went along, and they went along, till they " + "met Foxy-woxy, and Foxy-woxy said to Hennypenny, Cocky-locky, Ducky-" + "daddles, Goosey-poosey, and Turkey-lurkey: 'Where are you going, Henny-" + "penny, Cockylocky, Ducky-daddles, Goosey-poosey, and Turkey-lurkey?' And " + "Henny-penny, Cocky-locky, Ducky-daddles, Goosey poosey, and Turkey- " + "lurkey said to Foxy-woxy: 'We' re going to tell the king the sky's a " + "-falling.' 'Oh! butthis is not the way to the king, Henny-penny, Cocky- " + "locky, Ducky-daddles, Goosey-poosey, and Turkey-lurkey,' says Foxy-woxy; " + "'I know the proper way; shall I show it you?' 'Oh, certainly, Foxywoxy,'" + "said Henny-penny, Cocky-locky, Ducky-daddles, Goosey-poosey, and " + "Turkey-lurkey. So Henny-penny, Cockylocky, Ducky-daddles, Goosey-poosey, " + "Turkey-lurkey, and Foxy-woxy all went to tell the king the sky was a-" + "falling. So they went along, and they went along, and they went along, " + "till they came to a narrow and dark hole. Now this was the door of Foxy-" + "woxy's cave. But Foxy-woxy said to Henny-penny, Cocky-locky, " + "Ducky-daddles, Goosey-poosey, and Turkeyturkey: 'This is the short way " + "to the king's palace: you'll soon get there if you follow me. I will go " + "first and you come after, Henny-penny, Cocky-locky, Ducky-daddles, " + "Goosey-poosey, and Turkey-turkey.' 'Why, of course, certainly, without " + "doubt, why not?' said Henny-penny, Cocky-locky, Ducky-daddles, Goosey-" + "poosey, and Turkey-lurkey.\n\n" + + "So Foxy-woxy went into his cave, and he didn't go very far, but turned " + "round to wait for Henny-penny, Cocky-locky, Ducky-daddles, Goosey-" + "poosey, and Turkey-lurkey. So at last at first Turkey-lurkey went " + "through the dark hole into the cave. He hadn't got far when 'Hrumph', " + "Foxy-woxy snapped off Turkey-lurkey's head and threw his body over his " + "left shoulder. Then Goosey-poosey went in, and 'Hrumph', off went her " + "head and Goosey-poosey was thrown beside Turkey-lurkey. Then Ducky-" + "daddles waddled down, and 'Hrumph', snapped Foxy-woxy, and Ducky-" + "daddles's head was off and Duckydaddies was thrown alongside Turkey-" + "turkey and Gooseypoosey. Then Cocky-locky strutted down into the cave, " + "and he hadn't gone far when 'Snap, Hrumph!' went Foxy-woxy, and Cocky-" + "locky was thrown alongside of Turkey-lurkey, Gooseypoosey, and Ducky-" + "daddles.\n\n" "But Foxy-woxy had made two bites at Cocky-locky, and when the first snap " - "only hurt Cocky-locky, but didn't kill him, he called out to Henny-penny. " - "But she turned tail and off she ran home, so she never told the king the " - "sky was a-falling.\n\n"; + "only hurt Cocky-locky, but didn't kill him, he called out to Henny- " + "penny. But she turned tail and off she ran home, so she never told the " + "king the sky was a-falling.\n\n"; const int g_udpblaster_strlen = sizeof(g_udpblaster_text) - 1; + +/**************************************************************************** + * Public Functions + ****************************************************************************/