From 3c97bfeae6815f56f1694f94f435c07af9e5a0af Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 23 Jun 2017 19:14:39 -0600 Subject: [PATCH] examples/nettest: Fixes for building with loopback device again after the last changes. --- examples/README.txt | 13 +++++++++++++ examples/nettest/Kconfig | 5 ++++- examples/nettest/nettest_client.c | 2 +- examples/nettest/nettest_server.c | 2 +- examples/nettest/nettest_target1.c | 12 ++++++++++++ examples/nettest/target_netinit.c | 11 ----------- 6 files changed, 31 insertions(+), 14 deletions(-) diff --git a/examples/README.txt b/examples/README.txt index b777737c9..a0de89082 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -960,6 +960,13 @@ examples/nettest CONFIG_EXAMPLES_NETTEST=y - Enables the nettest example CONFIG_EXAMPLES_NETLIB=y - The networking library in needed. + Configurations: + + - Server on target hardware; client on host + - Client on target hardware; Server on host + - Server and Client on different targets. + - Loopback configuration with both client and server on the same target. + See also examples/tcpecho examples/nrf24l01_term @@ -2106,6 +2113,12 @@ examples/udp CONFIG_NETUTILS_NETLIB=y + Possible configurations: + + - Server on target hardware; client on host + - Client on target hardware; Server on host + - Server and Client on different targets. + examples/udpblaster ^^^^^^^^^^^^^^^^^^^ diff --git a/examples/nettest/Kconfig b/examples/nettest/Kconfig index 67aef0954..eb6de63a8 100644 --- a/examples/nettest/Kconfig +++ b/examples/nettest/Kconfig @@ -78,14 +78,17 @@ config EXAMPLES_NETTEST_STACKSIZE2 default 2048 endif # EXAMPLES_NETTEST_TARGET2 +endif # !EXAMPLES_NETTEST_LOOPBACK +if EXAMPLES_NETTEST_LOOPBACK config EXAMPLES_NETTEST_DAEMON_STACKSIZE int "Server daemon stack size" default 2048 -config EXAMPLES_NETTEST_DEAMON_PRIORITY +config EXAMPLES_NETTEST_DAEMON_PRIORITY int "Server daemon priority" default 100 +#endif endif # EXAMPLES_NETTEST_LOOPBACK diff --git a/examples/nettest/nettest_client.c b/examples/nettest/nettest_client.c index 4883504df..8792fa527 100644 --- a/examples/nettest/nettest_client.c +++ b/examples/nettest/nettest_client.c @@ -1,5 +1,5 @@ /**************************************************************************** - * examples/nettest/nettest-client.c + * examples/nettest/nettest_client.c * * Copyright (C) 2007, 2011-2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/examples/nettest/nettest_server.c b/examples/nettest/nettest_server.c index 755fdf096..1f74ed2c9 100644 --- a/examples/nettest/nettest_server.c +++ b/examples/nettest/nettest_server.c @@ -120,7 +120,7 @@ void recv_server(void) #endif addrlen = sizeof(struct sockaddr_in6); - printf("Binding to IPv6 Address: %04x:04x:04x:04x:04x:04x:04x:04x\n", + printf("Binding to IPv6 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], diff --git a/examples/nettest/nettest_target1.c b/examples/nettest/nettest_target1.c index 0a5d968dc..a5ae33a13 100644 --- a/examples/nettest/nettest_target1.c +++ b/examples/nettest/nettest_target1.c @@ -49,6 +49,18 @@ #include "nettest.h" +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NETTEST_LOOPBACK +static int server_child(int argc, char *argv[]) +{ + recv_server(); + return EXIT_SUCCESS; +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/examples/nettest/target_netinit.c b/examples/nettest/target_netinit.c index 78193737b..ecf82d673 100644 --- a/examples/nettest/target_netinit.c +++ b/examples/nettest/target_netinit.c @@ -117,7 +117,6 @@ static const uint16_t g_ipv6_netmask[8] = * Public Functions ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_NETTEST_INIT void nettest_initialize(void) { #ifndef CONFIG_EXAMPLES_NETTEST_IPv6 @@ -188,16 +187,6 @@ void nettest_initialize(void) #endif /* CONFIG_EXAMPLES_NETTEST_IPv6 */ } -#endif /*CONFIG_EXAMPLES_NETTEST_INIT */ - -#ifdef CONFIG_EXAMPLES_NETTEST_LOOPBACK -static int server_child(int argc, char *argv[]) -{ - recv_server(); - return EXIT_SUCCESS; -} -#endif - #endif /* CONFIG_EXAMPLES_NETTEST_INIT */