Skip to content

Commit

Permalink
examples/telnet_server: add support for LWIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Apr 3, 2022
1 parent ac4ac64 commit f729bc2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
24 changes: 17 additions & 7 deletions examples/telnet_server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,23 @@ RIOTBASE ?= $(CURDIR)/../..
# Include packages that pull up and auto-init the link layer.
# NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present
USEMODULE += netdev_default
USEMODULE += auto_init_gnrc_netif
# Activate ICMPv6 error messages
USEMODULE += gnrc_icmpv6_error
# Specify the mandatory networking modules for IPv6
USEMODULE += gnrc_ipv6_default
# Additional networking modules that can be dropped if not needed
USEMODULE += gnrc_icmpv6_echo

# use GNRC by default
LWIP ?= 0

ifeq (0,$(LWIP))
USEMODULE += auto_init_gnrc_netif
# Activate ICMPv6 error messages
USEMODULE += gnrc_icmpv6_error
# Specify the mandatory networking modules for IPv6
USEMODULE += gnrc_ipv6_default
# Additional networking modules that can be dropped if not needed
USEMODULE += gnrc_icmpv6_echo
else
USEMODULE += lwip_ipv6
USEMODULE += lwip_netdev
endif

USEMODULE += netutils
# Add also the shell, some shell commands
USEMODULE += shell
Expand Down
11 changes: 9 additions & 2 deletions examples/telnet_server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
#include <stdio.h>

#include "net/ipv6/addr.h"
#include "net/gnrc.h"
#include "net/gnrc/netif.h"
#include "net/telnet.h"
#include "shell.h"
#include "msg.h"

#define MAIN_QUEUE_SIZE (8)
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];

#if IS_USED(MODULE_GNRC)
#include "net/gnrc.h"
#include "net/gnrc/netif.h"
static void _print_addr(void)
{
gnrc_netif_t *netif = NULL;
Expand All @@ -49,6 +50,12 @@ static void _print_addr(void)
}
}
}
#else
static void _print_addr(void)
{
/* TODO */
}
#endif

static void _print_motd(void)
{
Expand Down

0 comments on commit f729bc2

Please sign in to comment.