net: shell: TCP stack agnostic shell

Now that TCP2 is the default stack, make the shell compatible
with both stacks.

Note: net_tcp_foreach is not implemented in TCP2, so related
code depends on TCP1.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
This commit is contained in:
Loic Poulain 2020-08-19 15:10:57 +02:00 committed by Jukka Rissanen
parent 4c8d1496ea
commit 9eb46d95a7

View File

@ -3735,7 +3735,7 @@ static int cmd_net_stats(const struct shell *shell, size_t argc, char *argv[])
return 0;
}
#if defined(CONFIG_NET_TCP1) && defined(CONFIG_NET_NATIVE_TCP)
#if defined(CONFIG_NET_TCP) && defined(CONFIG_NET_NATIVE_TCP)
static struct net_context *tcp_ctx;
static const struct shell *tcp_shell;
@ -3966,7 +3966,7 @@ static void tcp_recv_cb(struct net_context *context, struct net_pkt *pkt,
static int cmd_net_tcp_connect(const struct shell *shell, size_t argc,
char *argv[])
{
#if defined(CONFIG_NET_TCP1) && defined(CONFIG_NET_NATIVE_TCP)
#if defined(CONFIG_NET_TCP) && defined(CONFIG_NET_NATIVE_TCP)
int arg = 0;
/* tcp connect <ip> port */
@ -4010,7 +4010,7 @@ static int cmd_net_tcp_connect(const struct shell *shell, size_t argc,
static int cmd_net_tcp_send(const struct shell *shell, size_t argc,
char *argv[])
{
#if defined(CONFIG_NET_TCP1) && defined(CONFIG_NET_NATIVE_TCP)
#if defined(CONFIG_NET_TCP) && defined(CONFIG_NET_NATIVE_TCP)
int arg = 0;
int ret;
struct net_shell_user_data user_data;
@ -4047,7 +4047,7 @@ static int cmd_net_tcp_send(const struct shell *shell, size_t argc,
static int cmd_net_tcp_recv(const struct shell *shell, size_t argc,
char *argv[])
{
#if defined(CONFIG_NET_TCP1) && defined(CONFIG_NET_NATIVE_TCP)
#if defined(CONFIG_NET_TCP) && defined(CONFIG_NET_NATIVE_TCP)
int ret;
struct net_shell_user_data user_data;
@ -4076,7 +4076,7 @@ static int cmd_net_tcp_recv(const struct shell *shell, size_t argc,
static int cmd_net_tcp_close(const struct shell *shell, size_t argc,
char *argv[])
{
#if defined(CONFIG_NET_TCP1) && defined(CONFIG_NET_NATIVE_TCP)
#if defined(CONFIG_NET_TCP) && defined(CONFIG_NET_NATIVE_TCP)
int ret;
/* tcp close */