diff --git a/Makefile.dep b/Makefile.dep index 4d7f2b4d0107059c5159f5627e2de53d41d1d49f..1cfc9da138c40c77f5bb7fc59c49f431b9277d99 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -37,7 +37,7 @@ endif ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) USEMODULE += netdev_default - USEMODULE += gnrc_netif2 + USEMODULE += gnrc_netif endif ifneq (,$(filter netdev_ieee802154,$(USEMODULE))) @@ -195,7 +195,7 @@ endif ifneq (,$(filter gnrc_ndp2,$(USEMODULE))) USEMODULE += gnrc_icmpv6 - USEMODULE += gnrc_netif2 + USEMODULE += gnrc_netif endif ifneq (,$(filter gnrc_icmpv6_echo,$(USEMODULE))) @@ -242,7 +242,7 @@ ifneq (,$(filter gnrc_ipv6,$(USEMODULE))) USEMODULE += ipv6_addr USEMODULE += gnrc_ipv6_hdr USEMODULE += gnrc_ipv6_nib - USEMODULE += gnrc_netif2 + USEMODULE += gnrc_netif endif ifneq (,$(filter gnrc_ipv6_hdr,$(USEMODULE))) @@ -300,7 +300,7 @@ endif ifneq (,$(filter gnrc_nettest,$(USEMODULE))) USEMODULE += gnrc_netapi USEMODULE += gnrc_netreg - USEMODULE += gnrc_netif2 + USEMODULE += gnrc_netif USEMODULE += gnrc_pktbuf USEMODULE += xtimer endif @@ -461,7 +461,7 @@ endif ifneq (,$(filter gnrc,$(USEMODULE))) USEMODULE += gnrc_netapi USEMODULE += gnrc_netreg - USEMODULE += gnrc_netif2 + USEMODULE += gnrc_netif USEMODULE += gnrc_netif_hdr USEMODULE += gnrc_pktbuf endif @@ -486,7 +486,7 @@ ifneq (,$(filter netstats_%, $(USEMODULE))) endif ifneq (,$(filter gnrc_lwmac,$(USEMODULE))) - USEMODULE += gnrc_netif2 + USEMODULE += gnrc_netif USEMODULE += gnrc_mac FEATURES_REQUIRED += periph_rtt endif diff --git a/cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c b/cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c index 05716fbbe95c2d2be14a2e8ee536adedce80d00b..7bbe1424c212d8b4331b216874dba801db79b16d 100644 --- a/cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c +++ b/cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c @@ -20,7 +20,7 @@ #include "net/gnrc.h" #include "thread.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "nrfmin_gnrc.h" @@ -32,7 +32,7 @@ * @{ */ #ifndef NRFMIN_GNRC_THREAD_PRIO -#define NRFMIN_GNRC_THREAD_PRIO GNRC_NETIF2_PRIO +#define NRFMIN_GNRC_THREAD_PRIO GNRC_NETIF_PRIO #endif #ifndef NRFMIN_GNRC_STACKSIZE @@ -76,7 +76,7 @@ static int hdr_netif_to_nrfmin(nrfmin_hdr_t *nrfmin, gnrc_pktsnip_t *pkt) return 0; } -static int gnrc_nrfmin_send(gnrc_netif2_t *dev, gnrc_pktsnip_t *pkt) +static int gnrc_nrfmin_send(gnrc_netif_t *dev, gnrc_pktsnip_t *pkt) { int res; struct iovec *vec; @@ -119,7 +119,7 @@ static int gnrc_nrfmin_send(gnrc_netif2_t *dev, gnrc_pktsnip_t *pkt) return res; } -static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netif2_t *dev) +static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netif_t *dev) { int pktsize; nrfmin_hdr_t *nrfmin; @@ -180,17 +180,17 @@ static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netif2_t *dev) return pkt_snip; } -static const gnrc_netif2_ops_t gnrc_nrfmin_ops = { +static const gnrc_netif_ops_t gnrc_nrfmin_ops = { .send = gnrc_nrfmin_send, .recv = gnrc_nrfmin_recv, - .get = gnrc_netif2_get_from_netdev, - .set = gnrc_netif2_set_from_netdev, + .get = gnrc_netif_get_from_netdev, + .set = gnrc_netif_set_from_netdev, }; void gnrc_nrfmin_init(void) { /* setup the NRFMIN driver */ nrfmin_setup(); - gnrc_netif2_create(stack, sizeof(stack), NRFMIN_GNRC_THREAD_PRIO, "nrfmin", - (netdev_t *)&nrfmin_dev, &gnrc_nrfmin_ops); + gnrc_netif_create(stack, sizeof(stack), NRFMIN_GNRC_THREAD_PRIO, "nrfmin", + (netdev_t *)&nrfmin_dev, &gnrc_nrfmin_ops); } diff --git a/drivers/cc110x/gnrc_cc110x/gnrc_cc110x.c b/drivers/cc110x/gnrc_cc110x/gnrc_cc110x.c index 1e11d7351c7a41a21c8eef13792684bed288252f..ec67c095c4ee68fffa9fa04cbe6e1f49af04776c 100644 --- a/drivers/cc110x/gnrc_cc110x/gnrc_cc110x.c +++ b/drivers/cc110x/gnrc_cc110x/gnrc_cc110x.c @@ -14,13 +14,13 @@ #include "net/gnrc.h" #include "cc110x.h" #include "cc110x-netdev.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "od.h" #define ENABLE_DEBUG (0) #include "debug.h" -static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { cc110x_pkt_t cc110x_pkt; netdev_t *dev = netif->dev; @@ -107,7 +107,7 @@ static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) return dev->driver->send(dev, &vector, 1); } -static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) +static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif) { netdev_t *dev = netif->dev; cc110x_t *cc110x = &((netdev_cc110x_t*) dev)->cc110x; @@ -182,16 +182,16 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) return pkt; } -static const gnrc_netif2_ops_t _cc110x_ops = { +static const gnrc_netif_ops_t _cc110x_ops = { .send = _send, .recv = _recv, - .get = gnrc_netif2_get_from_netdev, - .set = gnrc_netif2_set_from_netdev, + .get = gnrc_netif_get_from_netdev, + .set = gnrc_netif_set_from_netdev, }; -gnrc_netif2_t *gnrc_netif2_cc110x_create(char *stack, int stacksize, char priority, - char *name, netdev_t *dev) +gnrc_netif_t *gnrc_netif_cc110x_create(char *stack, int stacksize, char priority, + char *name, netdev_t *dev) { - return gnrc_netif2_create(stack, stacksize, priority, name, dev, - &_cc110x_ops); + return gnrc_netif_create(stack, stacksize, priority, name, dev, + &_cc110x_ops); } diff --git a/drivers/cc110x/include/gnrc_netif2_cc110x.h b/drivers/cc110x/include/gnrc_netif_cc110x.h similarity index 52% rename from drivers/cc110x/include/gnrc_netif2_cc110x.h rename to drivers/cc110x/include/gnrc_netif_cc110x.h index a7be168c69a0696612944033ee91f4da26f5be45..dc1d43c2110c66489ead93a6d341e658b49db983 100644 --- a/drivers/cc110x/include/gnrc_netif2_cc110x.h +++ b/drivers/cc110x/include/gnrc_netif_cc110x.h @@ -7,29 +7,29 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file - * @brief CC110x adaption for @ref net_gnrc_netif2 + * @brief CC110x adaption for @ref net_gnrc_netif * * @author Martine Lenders <m.lenders@fu-berlin.de> */ -#ifndef GNRC_NETIF2_CC110X_H -#define GNRC_NETIF2_CC110X_H +#ifndef GNRC_NETIF_CC110X_H +#define GNRC_NETIF_CC110X_H -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { #endif -gnrc_netif2_t *gnrc_netif2_cc110x_create(char *stack, int stacksize, char priority, - char *name, netdev_t *dev); +gnrc_netif_t *gnrc_netif_cc110x_create(char *stack, int stacksize, char priority, + char *name, netdev_t *dev); #ifdef __cplusplus } #endif -#endif /* GNRC_NETIF2_CC110X_H */ +#endif /* GNRC_NETIF_CC110X_H */ /** @} */ diff --git a/drivers/xbee/gnrc_xbee.c b/drivers/xbee/gnrc_xbee.c index a20da1e2f1352f070568f2411a3fef14efcc9753..be78de2aee81acf9abf4847cc0d91c74fd356e3b 100644 --- a/drivers/xbee/gnrc_xbee.c +++ b/drivers/xbee/gnrc_xbee.c @@ -7,7 +7,7 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file @@ -21,14 +21,14 @@ #include "assert.h" #include "xbee.h" #include "net/gnrc.h" -#include "gnrc_netif2_xbee.h" +#include "gnrc_netif_xbee.h" #define ENABLE_DEBUG (0) #include "debug.h" #define BCAST (GNRC_NETIF_HDR_FLAGS_BROADCAST | GNRC_NETIF_HDR_FLAGS_MULTICAST) -static gnrc_pktsnip_t *xbee_adpt_recv(gnrc_netif2_t *netif) +static gnrc_pktsnip_t *xbee_adpt_recv(gnrc_netif_t *netif) { netdev_t *dev = netif->dev; int pktlen; @@ -100,7 +100,7 @@ static gnrc_pktsnip_t *xbee_adpt_recv(gnrc_netif2_t *netif) return payload; } -static int xbee_adpt_send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static int xbee_adpt_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { int res; size_t size; @@ -173,17 +173,17 @@ static int xbee_adpt_send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) return res; } -static const gnrc_netif2_ops_t _xbee_ops = { +static const gnrc_netif_ops_t _xbee_ops = { .send = xbee_adpt_send, .recv = xbee_adpt_recv, - .get = gnrc_netif2_get_from_netdev, - .set = gnrc_netif2_set_from_netdev, + .get = gnrc_netif_get_from_netdev, + .set = gnrc_netif_set_from_netdev, }; -gnrc_netif2_t *gnrc_netif2_xbee_create(char *stack, int stacksize, - char priority, char *name, - netdev_t *dev) +gnrc_netif_t *gnrc_netif_xbee_create(char *stack, int stacksize, + char priority, char *name, + netdev_t *dev) { - return gnrc_netif2_create(stack, stacksize, priority, name, - dev, &_xbee_ops); + return gnrc_netif_create(stack, stacksize, priority, name, + dev, &_xbee_ops); } diff --git a/drivers/xbee/include/gnrc_netif2_xbee.h b/drivers/xbee/include/gnrc_netif_xbee.h similarity index 50% rename from drivers/xbee/include/gnrc_netif2_xbee.h rename to drivers/xbee/include/gnrc_netif_xbee.h index ef28ab7848a5e6eace4f4e8074d5c1884d51e156..f34baeef48761af16cf818d8550fe510d75c9621 100644 --- a/drivers/xbee/include/gnrc_netif2_xbee.h +++ b/drivers/xbee/include/gnrc_netif_xbee.h @@ -7,30 +7,30 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file - * @brief XBee adaption for @ref net_gnrc_netif2 + * @brief XBee adaption for @ref net_gnrc_netif * * @author Martine Lenders <m.lenders@fu-berlin.de> */ -#ifndef GNRC_NETIF2_XBEE_H -#define GNRC_NETIF2_XBEE_H +#ifndef GNRC_NETIF_XBEE_H +#define GNRC_NETIF_XBEE_H -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { #endif -gnrc_netif2_t *gnrc_netif2_xbee_create(char *stack, int stacksize, - char priority, char *name, - netdev_t *dev); +gnrc_netif_t *gnrc_netif_xbee_create(char *stack, int stacksize, + char priority, char *name, + netdev_t *dev); #ifdef __cplusplus } #endif -#endif /* GNRC_NETIF2_XBEE_H */ +#endif /* GNRC_NETIF_XBEE_H */ /** @} */ diff --git a/examples/ccn-lite-relay/main.c b/examples/ccn-lite-relay/main.c index a119882281b9e7fb989be24416500a24e0488bd4..298b32b0141188249aa6413aa0ec70e129ac9bde 100644 --- a/examples/ccn-lite-relay/main.c +++ b/examples/ccn-lite-relay/main.c @@ -24,7 +24,7 @@ #include "msg.h" #include "shell.h" #include "ccn-lite-riot.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" /* main thread's message queue */ #define MAIN_QUEUE_SIZE (8) @@ -46,10 +46,10 @@ int main(void) ccnl_start(); /* get the default interface */ - gnrc_netif2_t *netif; + gnrc_netif_t *netif; /* set the relay's PID, configure the interface to use CCN nettype */ - if (((netif = gnrc_netif2_iter(NULL)) == NULL) || + if (((netif = gnrc_netif_iter(NULL)) == NULL) || (ccnl_open_netif(netif->pid, GNRC_NETTYPE_CCN) < 0)) { puts("Error registering at network interface!"); return -1; diff --git a/examples/gnrc_minimal/Makefile b/examples/gnrc_minimal/Makefile index 09200a6ec65094f0080a8b17c05f11e2eb76e2fc..21e15be191744cb20d9a5297f4be7fa3662325b0 100644 --- a/examples/gnrc_minimal/Makefile +++ b/examples/gnrc_minimal/Makefile @@ -25,8 +25,8 @@ USEMODULE += gnrc_icmpv6_echo # Use minimal standard PRNG USEMODULE += prng_minstd -CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DGNRC_NETIF2_IPV6_ADDRS_NUMOF=2 \ - -DGNRC_NETIF2_IPV6_GROUPS_NUMOF=2 -DGNRC_IPV6_NC_SIZE=1 +CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DGNRC_NETIF_IPV6_ADDRS_NUMOF=2 \ + -DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DGNRC_IPV6_NC_SIZE=1 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 diff --git a/examples/gnrc_minimal/main.c b/examples/gnrc_minimal/main.c index e61178a054473d12f8cefeb8ed2687f41c08ec65..4dbcae539e03052da1b02521b35dc06d0752cbc1 100644 --- a/examples/gnrc_minimal/main.c +++ b/examples/gnrc_minimal/main.c @@ -23,7 +23,7 @@ #include "msg.h" #include "net/ipv6/addr.h" #include "net/gnrc.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" int main(void) { @@ -31,9 +31,9 @@ int main(void) puts("RIOT network stack example application"); /* get interfaces and print their addresses */ - gnrc_netif2_t *netif = NULL; - while ((netif = gnrc_netif2_iter(netif))) { - ipv6_addr_t ipv6_addrs[GNRC_NETIF2_IPV6_ADDRS_NUMOF]; + gnrc_netif_t *netif = NULL; + while ((netif = gnrc_netif_iter(netif))) { + ipv6_addr_t ipv6_addrs[GNRC_NETIF_IPV6_ADDRS_NUMOF]; int res = gnrc_netapi_get(netif->pid, NETOPT_IPV6_ADDR, 0, ipv6_addrs, sizeof(ipv6_addrs)); diff --git a/examples/nanocoap_server/main.c b/examples/nanocoap_server/main.c index ca28aac45590f176ea79cc36b77989b989644a6d..c600d20fd6403619c582f91d6618fd341289c67d 100644 --- a/examples/nanocoap_server/main.c +++ b/examples/nanocoap_server/main.c @@ -30,7 +30,7 @@ static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; /* import "ifconfig" shell command, used for printing addresses */ -extern int _gnrc_netif2_config(int argc, char **argv); +extern int _gnrc_netif_config(int argc, char **argv); int main(void) { @@ -44,7 +44,7 @@ int main(void) /* print network addresses */ puts("Configured network interfaces:"); - _gnrc_netif2_config(0, NULL); + _gnrc_netif_config(0, NULL); /* initialize nanocoap server instance */ uint8_t buf[COAP_INBUF_SIZE]; diff --git a/pkg/ccn-lite/patches/0001-ccn-line-riot-port-to-gnrc_netif.patch b/pkg/ccn-lite/patches/0001-ccn-line-riot-port-to-gnrc_netif.patch new file mode 100644 index 0000000000000000000000000000000000000000..0db11bad206a162d6a99726574e681beb83b0865 Binary files /dev/null and b/pkg/ccn-lite/patches/0001-ccn-line-riot-port-to-gnrc_netif.patch differ diff --git a/pkg/ccn-lite/patches/0001-ccn-line-riot-port-to-gnrc_netif2.patch b/pkg/ccn-lite/patches/0001-ccn-line-riot-port-to-gnrc_netif2.patch deleted file mode 100644 index 0c6c1541639d7e9e7fb219e5993512ed7ef25dad..0000000000000000000000000000000000000000 Binary files a/pkg/ccn-lite/patches/0001-ccn-line-riot-port-to-gnrc_netif2.patch and /dev/null differ diff --git a/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c b/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c index 2e49db4d0628dac167bdb72a4363c48ea47749a0..394da9457576461923c73361f2860742550822d0 100644 --- a/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c +++ b/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c @@ -46,7 +46,7 @@ #include "thread.h" #include "net/gnrc.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/nettype.h" #include "ble-core.h" @@ -61,11 +61,11 @@ #include "od.h" #endif -#define BLE_PRIO (GNRC_NETIF2_PRIO) +#define BLE_PRIO (GNRC_NETIF_PRIO) static char _stack[(THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)]; -static gnrc_netif2_t *_ble_netif = NULL; +static gnrc_netif_t *_ble_netif = NULL; static uint8_t _sendbuf[BLE_SIXLOWPAN_MTU]; @@ -221,7 +221,7 @@ static int _handle_get(gnrc_netapi_opt_t *_opt) return res; } -static void _netif_init(gnrc_netif2_t *netif) +static void _netif_init(gnrc_netif_t *netif) { ble_stack_init(); ble_mac_init(_ble_mac_callback); @@ -231,28 +231,28 @@ static void _netif_init(gnrc_netif2_t *netif) ble_advertising_start(); } -static int _netif_send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static int _netif_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { (void)netif; assert(netif != _ble_netif); return _send(pkt); } -static gnrc_pktsnip_t *_netif_recv(gnrc_netif2_t *netif) +static gnrc_pktsnip_t *_netif_recv(gnrc_netif_t *netif) { (void)netif; /* not supported */ return NULL; } -static int _netif_get(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) +static int _netif_get(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) { (void)netif; assert(netif != _ble_netif); return _handle_get(opt); } -static int _netif_set(gnrc_netif2_t *netif, const gnrc_netapi_opt_t *opt) +static int _netif_set(gnrc_netif_t *netif, const gnrc_netapi_opt_t *opt) { (void)netif; (void)opt; @@ -260,7 +260,7 @@ static int _netif_set(gnrc_netif2_t *netif, const gnrc_netapi_opt_t *opt) return -ENOTSUP; } -static void _netif_msg_handler(gnrc_netif2_t *netif, msg_t *msg) +static void _netif_msg_handler(gnrc_netif_t *netif, msg_t *msg) { switch (msg->type) { case BLE_EVENT_RX_DONE: @@ -273,7 +273,7 @@ static void _netif_msg_handler(gnrc_netif2_t *netif, msg_t *msg) } } -static const gnrc_netif2_ops_t _ble_ops = { +static const gnrc_netif_ops_t _ble_ops = { .init = _netif_init, .send = _netif_send, .recv = _netif_recv, @@ -284,6 +284,6 @@ static const gnrc_netif2_ops_t _ble_ops = { void gnrc_nordic_ble_6lowpan_init(void) { - _ble_netif = gnrc_netif2_create(_stack, sizeof(_stack), BLE_PRIO, - "ble", NULL, &_ble_ops); + _ble_netif = gnrc_netif_create(_stack, sizeof(_stack), BLE_PRIO, + "ble", NULL, &_ble_ops); } diff --git a/sys/auto_init/netif/auto_init_at86rf2xx.c b/sys/auto_init/netif/auto_init_at86rf2xx.c index fdf950c7edc2fe859fb1cf148dcdfcae9b9faec1..c56d539ecc369edab6c7eb2757c6667d83d6f1b0 100644 --- a/sys/auto_init/netif/auto_init_at86rf2xx.c +++ b/sys/auto_init/netif/auto_init_at86rf2xx.c @@ -21,7 +21,7 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netif2/ieee802154.h" +#include "net/gnrc/netif/ieee802154.h" #include "net/gnrc/lwmac/lwmac.h" #include "net/gnrc.h" @@ -34,7 +34,7 @@ */ #define AT86RF2XX_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef AT86RF2XX_MAC_PRIO -#define AT86RF2XX_MAC_PRIO (GNRC_NETIF2_PRIO) +#define AT86RF2XX_MAC_PRIO (GNRC_NETIF_PRIO) #endif #define AT86RF2XX_NUM (sizeof(at86rf2xx_params) / sizeof(at86rf2xx_params[0])) @@ -49,15 +49,15 @@ void auto_init_at86rf2xx(void) at86rf2xx_setup(&at86rf2xx_devs[i], &at86rf2xx_params[i]); #ifdef MODULE_GNRC_LWMAC - gnrc_netif2_lwmac_create(_at86rf2xx_stacks[i], - AT86RF2XX_MAC_STACKSIZE, - AT86RF2XX_MAC_PRIO, "at86rf2xx-lwmac", - (netdev_t *)&at86rf2xx_devs[i]); + gnrc_netif_lwmac_create(_at86rf2xx_stacks[i], + AT86RF2XX_MAC_STACKSIZE, + AT86RF2XX_MAC_PRIO, "at86rf2xx-lwmac", + (netdev_t *)&at86rf2xx_devs[i]); #else - gnrc_netif2_ieee802154_create(_at86rf2xx_stacks[i], - AT86RF2XX_MAC_STACKSIZE, - AT86RF2XX_MAC_PRIO, "at86rf2xx", - (netdev_t *)&at86rf2xx_devs[i]); + gnrc_netif_ieee802154_create(_at86rf2xx_stacks[i], + AT86RF2XX_MAC_STACKSIZE, + AT86RF2XX_MAC_PRIO, "at86rf2xx", + (netdev_t *)&at86rf2xx_devs[i]); #endif } } diff --git a/sys/auto_init/netif/auto_init_cc110x.c b/sys/auto_init/netif/auto_init_cc110x.c index e8b66c517ec3283bcd4646ba48fc3a91ff7262ee..471f6a91c591c0ccf12729827d9a2012018890cb 100644 --- a/sys/auto_init/netif/auto_init_cc110x.c +++ b/sys/auto_init/netif/auto_init_cc110x.c @@ -22,7 +22,7 @@ #include "log.h" #include "debug.h" #include "board.h" -#include "gnrc_netif2_cc110x.h" +#include "gnrc_netif_cc110x.h" #include "cc110x-netdev.h" #include "net/gnrc.h" @@ -35,7 +35,7 @@ */ #define CC110X_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #ifndef CC110X_MAC_PRIO -#define CC110X_MAC_PRIO (GNRC_NETIF2_PRIO) +#define CC110X_MAC_PRIO (GNRC_NETIF_PRIO) #endif #define CC110X_NUM (sizeof(cc110x_params)/sizeof(cc110x_params[0])) @@ -55,9 +55,9 @@ void auto_init_cc110x(void) LOG_ERROR("[auto_init_netif] error initializing cc110x #%u\n", i); } else { - gnrc_netif2_cc110x_create(_stacks[i], CC110X_MAC_STACKSIZE, - CC110X_MAC_PRIO, "cc110x", - (netdev_t *)&cc110x_devs[i]); + gnrc_netif_cc110x_create(_stacks[i], CC110X_MAC_STACKSIZE, + CC110X_MAC_PRIO, "cc110x", + (netdev_t *)&cc110x_devs[i]); } } } diff --git a/sys/auto_init/netif/auto_init_cc2420.c b/sys/auto_init/netif/auto_init_cc2420.c index 5370f269f16fd388c9fb6ba29d87cb1df3d1d9ca..d06c66e1787162cfa67c4d1c9a0226b13428e14c 100644 --- a/sys/auto_init/netif/auto_init_cc2420.c +++ b/sys/auto_init/netif/auto_init_cc2420.c @@ -23,7 +23,7 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netif2/ieee802154.h" +#include "net/gnrc/netif/ieee802154.h" #include "net/gnrc.h" #include "cc2420.h" @@ -35,7 +35,7 @@ */ #define CC2420_MAC_STACKSIZE (THREAD_STACKSIZE_MAIN) #ifndef CC2420_MAC_PRIO -#define CC2420_MAC_PRIO (GNRC_NETIF2_PRIO) +#define CC2420_MAC_PRIO (GNRC_NETIF_PRIO) #endif /** @} */ @@ -58,9 +58,9 @@ void auto_init_cc2420(void) LOG_DEBUG("[auto_init_netif] initializing cc2420 #%u\n", i); cc2420_setup(&cc2420_devs[i], &cc2420_params[i]); - gnrc_netif2_ieee802154_create(_cc2420_stacks[i], CC2420_MAC_STACKSIZE, - CC2420_MAC_PRIO, "cc2420", - (netdev_t *)&cc2420_devs[i]); + gnrc_netif_ieee802154_create(_cc2420_stacks[i], CC2420_MAC_STACKSIZE, + CC2420_MAC_PRIO, "cc2420", + (netdev_t *)&cc2420_devs[i]); } } diff --git a/sys/auto_init/netif/auto_init_cc2538_rf.c b/sys/auto_init/netif/auto_init_cc2538_rf.c index e3b29c3ac42a3b8fd3f5149d6c04baa317609df0..9371b5fbac588e14166851c3f011ef683ce366ce 100644 --- a/sys/auto_init/netif/auto_init_cc2538_rf.c +++ b/sys/auto_init/netif/auto_init_cc2538_rf.c @@ -20,7 +20,7 @@ #ifdef MODULE_CC2538_RF #include "log.h" -#include "net/gnrc/netif2/ieee802154.h" +#include "net/gnrc/netif/ieee802154.h" #include "cc2538_rf.h" @@ -30,7 +30,7 @@ */ #define CC2538_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef CC2538_MAC_PRIO -#define CC2538_MAC_PRIO (GNRC_NETIF2_PRIO) +#define CC2538_MAC_PRIO (GNRC_NETIF_PRIO) #endif static cc2538_rf_t cc2538_rf_dev; @@ -41,10 +41,10 @@ void auto_init_cc2538_rf(void) LOG_DEBUG("[auto_init_netif] initializing cc2538 radio\n"); cc2538_setup(&cc2538_rf_dev); - gnrc_netif2_ieee802154_create(_cc2538_rf_stack, - CC2538_MAC_STACKSIZE, - CC2538_MAC_PRIO, "cc2538_rf", - (netdev_t *)&cc2538_rf_dev); + gnrc_netif_ieee802154_create(_cc2538_rf_stack, + CC2538_MAC_STACKSIZE, + CC2538_MAC_PRIO, "cc2538_rf", + (netdev_t *)&cc2538_rf_dev); } #else diff --git a/sys/auto_init/netif/auto_init_enc28j60.c b/sys/auto_init/netif/auto_init_enc28j60.c index 433ecd684df215d9d584313c28565b7574d5892f..3d4b9c0beeecbd3bec5129316c337d79480e1c68 100644 --- a/sys/auto_init/netif/auto_init_enc28j60.c +++ b/sys/auto_init/netif/auto_init_enc28j60.c @@ -24,7 +24,7 @@ #include "log.h" #include "enc28j60.h" #include "enc28j60_params.h" -#include "net/gnrc/netif2/ethernet.h" +#include "net/gnrc/netif/ethernet.h" /** * @brief Define stack parameters for the MAC layer thread @@ -32,7 +32,7 @@ */ #define ENC28J60_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef ENC28J60_MAC_PRIO -#define ENC28J60_MAC_PRIO (GNRC_NETIF2_PRIO) +#define ENC28J60_MAC_PRIO (GNRC_NETIF_PRIO) #endif /*** @} */ @@ -61,9 +61,9 @@ void auto_init_enc28j60(void) /* setup netdev device */ enc28j60_setup(&dev[i], &enc28j60_params[i]); - gnrc_netif2_ethernet_create(stack[i], ENC28J60_MAC_STACKSIZE, - ENC28J60_MAC_PRIO, "enc28j60", - (netdev_t *)&dev[i]); + gnrc_netif_ethernet_create(stack[i], ENC28J60_MAC_STACKSIZE, + ENC28J60_MAC_PRIO, "enc28j60", + (netdev_t *)&dev[i]); } } diff --git a/sys/auto_init/netif/auto_init_encx24j600.c b/sys/auto_init/netif/auto_init_encx24j600.c index 239912ca0e5cf2a9ee01e55eee9ba1c96c668e1d..83796e800b9b670565414a09056b9a69d90add83 100644 --- a/sys/auto_init/netif/auto_init_encx24j600.c +++ b/sys/auto_init/netif/auto_init_encx24j600.c @@ -22,7 +22,7 @@ #include "log.h" #include "debug.h" #include "encx24j600.h" -#include "net/gnrc/netif2/ethernet.h" +#include "net/gnrc/netif/ethernet.h" static encx24j600_t encx24j600; @@ -32,7 +32,7 @@ static encx24j600_t encx24j600; */ #define ENCX24J600_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #ifndef ENCX24J600_MAC_PRIO -#define ENCX24J600_MAC_PRIO (GNRC_NETIF2_PRIO) +#define ENCX24J600_MAC_PRIO (GNRC_NETIF_PRIO) #endif /** @@ -52,9 +52,9 @@ void auto_init_encx24j600(void) encx24j600_setup(&encx24j600, &p); /* initialize netdev<->gnrc adapter state */ - gnrc_netif2_ethernet_create(_netdev_eth_stack, ENCX24J600_MAC_STACKSIZE, - ENCX24J600_MAC_PRIO, "encx24j600", - (netdev_t *)&encx24j600); + gnrc_netif_ethernet_create(_netdev_eth_stack, ENCX24J600_MAC_STACKSIZE, + ENCX24J600_MAC_PRIO, "encx24j600", + (netdev_t *)&encx24j600); } #else diff --git a/sys/auto_init/netif/auto_init_ethos.c b/sys/auto_init/netif/auto_init_ethos.c index b654f199aa14a717ab80dcddd2f77fe29f5abde4..f1d9a317cc581f6711f0141c2c1460ce96a6c70b 100644 --- a/sys/auto_init/netif/auto_init_ethos.c +++ b/sys/auto_init/netif/auto_init_ethos.c @@ -23,7 +23,7 @@ #include "debug.h" #include "ethos.h" #include "periph/uart.h" -#include "net/gnrc/netif2/ethernet.h" +#include "net/gnrc/netif/ethernet.h" /** * @brief global ethos object, used by uart_stdio @@ -36,7 +36,7 @@ ethos_t ethos; */ #define ETHOS_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #ifndef ETHOS_MAC_PRIO -#define ETHOS_MAC_PRIO (GNRC_NETIF2_PRIO) +#define ETHOS_MAC_PRIO (GNRC_NETIF_PRIO) #endif /** @@ -59,8 +59,8 @@ void auto_init_ethos(void) ethos_setup(ðos, &p); /* initialize netdev<->gnrc adapter state */ - gnrc_netif2_ethernet_create(_netdev_eth_stack, ETHOS_MAC_STACKSIZE, - ETHOS_MAC_PRIO, "ethos", (netdev_t *)ðos); + gnrc_netif_ethernet_create(_netdev_eth_stack, ETHOS_MAC_STACKSIZE, + ETHOS_MAC_PRIO, "ethos", (netdev_t *)ðos); } #else diff --git a/sys/auto_init/netif/auto_init_kw2xrf.c b/sys/auto_init/netif/auto_init_kw2xrf.c index 69039ad59478cae14b1d35ecb08c92a9f1028b4d..0c687db3e01a54d82989fcfc95ecfe81607d9fca 100644 --- a/sys/auto_init/netif/auto_init_kw2xrf.c +++ b/sys/auto_init/netif/auto_init_kw2xrf.c @@ -24,7 +24,7 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netif2/ieee802154.h" +#include "net/gnrc/netif/ieee802154.h" #include "net/gnrc.h" #include "kw2xrf.h" @@ -36,7 +36,7 @@ */ #define KW2XRF_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef KW2XRF_MAC_PRIO -#define KW2XRF_MAC_PRIO (GNRC_NETIF2_PRIO) +#define KW2XRF_MAC_PRIO (GNRC_NETIF_PRIO) #endif #define KW2XRF_NUM (sizeof(kw2xrf_params)/sizeof(kw2xrf_params[0])) @@ -51,9 +51,9 @@ void auto_init_kw2xrf(void) LOG_DEBUG("[auto_init_netif] initializing kw2xrf #%u\n", i); kw2xrf_setup(&kw2xrf_devs[i], (kw2xrf_params_t*) p); - gnrc_netif2_ieee802154_create(_kw2xrf_stacks[i], KW2XRF_MAC_STACKSIZE, - KW2XRF_MAC_PRIO, "kw2xrf", - (netdev_t *)&kw2xrf_devs[i]); + gnrc_netif_ieee802154_create(_kw2xrf_stacks[i], KW2XRF_MAC_STACKSIZE, + KW2XRF_MAC_PRIO, "kw2xrf", + (netdev_t *)&kw2xrf_devs[i]); } } #else diff --git a/sys/auto_init/netif/auto_init_mrf24j40.c b/sys/auto_init/netif/auto_init_mrf24j40.c index fab6eeaeac597adc2d4175ea19b1587b1bc5bb16..9b514e4b0a8f7ab4f936a9888ef80dd98a1e244c 100644 --- a/sys/auto_init/netif/auto_init_mrf24j40.c +++ b/sys/auto_init/netif/auto_init_mrf24j40.c @@ -21,7 +21,7 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netif2/ieee802154.h" +#include "net/gnrc/netif/ieee802154.h" #include "net/gnrc.h" #include "mrf24j40.h" @@ -33,7 +33,7 @@ */ #define MRF24J40_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef MRF24J40_MAC_PRIO -#define MRF24J40_MAC_PRIO (GNRC_NETIF2_PRIO) +#define MRF24J40_MAC_PRIO (GNRC_NETIF_PRIO) #endif #define MRF24J40_NUM (sizeof(mrf24j40_params) / sizeof(mrf24j40_params[0])) @@ -47,10 +47,10 @@ void auto_init_mrf24j40(void) LOG_DEBUG("[auto_init_netif] initializing mrf24j40 #%u\n", i); mrf24j40_setup(&mrf24j40_devs[i], &mrf24j40_params[i]); - gnrc_netif2_ieee802154_create(_mrf24j40_stacks[i], - MRF24J40_MAC_STACKSIZE, MRF24J40_MAC_PRIO, - "mrf24j40", - (netdev_t *)&mrf24j40_devs[i]); + gnrc_netif_ieee802154_create(_mrf24j40_stacks[i], + MRF24J40_MAC_STACKSIZE, MRF24J40_MAC_PRIO, + "mrf24j40", + (netdev_t *)&mrf24j40_devs[i]); } } #else diff --git a/sys/auto_init/netif/auto_init_netdev_tap.c b/sys/auto_init/netif/auto_init_netdev_tap.c index 8d11fc2d391141381e175396de68ab5b87eece5f..1854dc666adbe6cdac098a109eab0fe315f405da 100644 --- a/sys/auto_init/netif/auto_init_netdev_tap.c +++ b/sys/auto_init/netif/auto_init_netdev_tap.c @@ -22,10 +22,10 @@ #include "log.h" #include "debug.h" #include "netdev_tap_params.h" -#include "net/gnrc/netif2/ethernet.h" +#include "net/gnrc/netif/ethernet.h" #define TAP_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) -#define TAP_MAC_PRIO (GNRC_NETIF2_PRIO) +#define TAP_MAC_PRIO (GNRC_NETIF_PRIO) static netdev_tap_t netdev_tap[NETDEV_TAP_MAX]; static char _netdev_eth_stack[NETDEV_TAP_MAX][TAP_MAC_STACKSIZE + DEBUG_EXTRA_STACKSIZE]; @@ -39,9 +39,9 @@ void auto_init_netdev_tap(void) i, *(p->tap_name)); netdev_tap_setup(&netdev_tap[i], p); - gnrc_netif2_ethernet_create(_netdev_eth_stack[i], TAP_MAC_STACKSIZE, - TAP_MAC_PRIO, "gnrc_netdev_tap", - &netdev_tap[i].netdev); + gnrc_netif_ethernet_create(_netdev_eth_stack[i], TAP_MAC_STACKSIZE, + TAP_MAC_PRIO, "gnrc_netdev_tap", + &netdev_tap[i].netdev); } } diff --git a/sys/auto_init/netif/auto_init_slipdev.c b/sys/auto_init/netif/auto_init_slipdev.c index d83069bd203163d829b7cb4c88c66f3aa8bcebfe..9f6c1b0fc955b6bc80dc1970f534bb87c3de3fef 100644 --- a/sys/auto_init/netif/auto_init_slipdev.c +++ b/sys/auto_init/netif/auto_init_slipdev.c @@ -21,7 +21,7 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netif2/raw.h" +#include "net/gnrc/netif/raw.h" #include "net/gnrc.h" #include "slipdev.h" @@ -35,7 +35,7 @@ */ #define SLIPDEV_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef SLIPDEV_PRIO -#define SLIPDEV_PRIO (GNRC_NETIF2_PRIO) +#define SLIPDEV_PRIO (GNRC_NETIF_PRIO) #endif static slipdev_t slipdevs[SLIPDEV_NUM]; @@ -49,9 +49,9 @@ void auto_init_slipdev(void) LOG_DEBUG("[auto_init_netif] initializing slip #%u\n", i); slipdev_setup(&slipdevs[i], p); - gnrc_netif2_raw_create(_slipdev_stacks[i], SLIPDEV_STACKSIZE, - SLIPDEV_PRIO, "slipdev", - (netdev_t *)&slipdevs[i]); + gnrc_netif_raw_create(_slipdev_stacks[i], SLIPDEV_STACKSIZE, + SLIPDEV_PRIO, "slipdev", + (netdev_t *)&slipdevs[i]); } } #else diff --git a/sys/auto_init/netif/auto_init_w5100.c b/sys/auto_init/netif/auto_init_w5100.c index ec9ed5b2d5aab821263357cae0249146eee7db44..f0ab09f651dacc55626dbb62dc7f0d77123e29ba 100644 --- a/sys/auto_init/netif/auto_init_w5100.c +++ b/sys/auto_init/netif/auto_init_w5100.c @@ -22,14 +22,14 @@ #include "log.h" #include "w5100.h" #include "w5100_params.h" -#include "net/gnrc/netif2/ethernet.h" +#include "net/gnrc/netif/ethernet.h" /** * @brief Define stack parameters for the MAC layer thread * @{ */ #define MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) -#define MAC_PRIO (GNRC_NETIF2_PRIO) +#define MAC_PRIO (GNRC_NETIF_PRIO) /*** @} */ /** @@ -58,8 +58,8 @@ void auto_init_w5100(void) /* setup netdev device */ w5100_setup(&dev[i], &w5100_params[i]); /* initialize netdev <-> gnrc adapter state */ - gnrc_netif2_ethernet_create(stack[i], MAC_STACKSIZE, MAC_PRIO, "w5100", - (netdev_t *)&dev[i]); + gnrc_netif_ethernet_create(stack[i], MAC_STACKSIZE, MAC_PRIO, "w5100", + (netdev_t *)&dev[i]); } } diff --git a/sys/auto_init/netif/auto_init_xbee.c b/sys/auto_init/netif/auto_init_xbee.c index 60794093a412a58818aaef5a0e0888aa88934583..cac098929b8bf1c745851df3778ec078e49c39e4 100644 --- a/sys/auto_init/netif/auto_init_xbee.c +++ b/sys/auto_init/netif/auto_init_xbee.c @@ -23,7 +23,7 @@ #include "log.h" #include "board.h" -#include "gnrc_netif2_xbee.h" +#include "gnrc_netif_xbee.h" #include "xbee.h" #include "xbee_params.h" @@ -37,7 +37,7 @@ */ #define XBEE_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef XBEE_MAC_PRIO -#define XBEE_MAC_PRIO (GNRC_NETIF2_PRIO) +#define XBEE_MAC_PRIO (GNRC_NETIF_PRIO) #endif /** @@ -52,8 +52,8 @@ void auto_init_xbee(void) LOG_DEBUG("[auto_init_netif] initializing xbee #%u\n", i); xbee_setup(&xbee_devs[i], &xbee_params[i]); - gnrc_netif2_xbee_create(stacks[i], XBEE_MAC_STACKSIZE, XBEE_MAC_PRIO, - "xbee", (netdev_t *)&xbee_devs[i]); + gnrc_netif_xbee_create(stacks[i], XBEE_MAC_STACKSIZE, XBEE_MAC_PRIO, + "xbee", (netdev_t *)&xbee_devs[i]); } } diff --git a/sys/include/net/gnrc.h b/sys/include/net/gnrc.h index 75bb0e67ba2cc952ff988f3efd7b48b6ce1238a1..c4a5d12159601d5813edde5ba5868e124c880f7c 100644 --- a/sys/include/net/gnrc.h +++ b/sys/include/net/gnrc.h @@ -286,7 +286,7 @@ #include "net/gnrc/netapi.h" #include "net/gnrc/netreg.h" #include "net/gnrc/nettype.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/netif/hdr.h" #include "net/gnrc/pktbuf.h" #include "net/gnrc/pkt.h" diff --git a/sys/include/net/gnrc/ipv6/nib.h b/sys/include/net/gnrc/ipv6/nib.h index 22f1ff989a6cacb31bd836083d5557ec473a7431..bf64916d4c51e716e051585e79ee59c6ede16fbd 100644 --- a/sys/include/net/gnrc/ipv6/nib.h +++ b/sys/include/net/gnrc/ipv6/nib.h @@ -34,7 +34,7 @@ #include "net/ipv6/addr.h" #include "net/ipv6/hdr.h" #include "net/gnrc/ipv6/nib/nc.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/pkt.h" #ifdef __cplusplus @@ -176,7 +176,7 @@ extern "C" { * * This message type is for the event of recalculating the reachability timeout * time. The expected message context is a valid - * [interface](@ref net_gnrc_netif2). + * [interface](@ref net_gnrc_netif). * * @note Only handled with @ref GNRC_IPV6_NIB_CONF_ARSM != 0 */ @@ -195,7 +195,7 @@ extern "C" { /** @} */ /** - * @brief Types for gnrc_netif2_ipv6_t::route_info_cb + * @brief Types for gnrc_netif_ipv6_t::route_info_cb * @anchor net_gnrc_ipv6_nib_route_info_type */ enum { @@ -259,7 +259,7 @@ void gnrc_ipv6_nib_init(void); * * @param[in,out] netif The interface to be managed by the NIB */ -void gnrc_ipv6_nib_init_iface(gnrc_netif2_t *netif); +void gnrc_ipv6_nib_init_iface(gnrc_netif_t *netif); /** * @brief Gets link-layer address of next hop to a destination address @@ -283,7 +283,7 @@ void gnrc_ipv6_nib_init_iface(gnrc_netif2_t *netif); * solicitation sent). */ int gnrc_ipv6_nib_get_next_hop_l2addr(const ipv6_addr_t *dst, - gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt, + gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_ipv6_nib_nc_t *nce); /** @@ -326,7 +326,7 @@ int gnrc_ipv6_nib_get_next_hop_l2addr(const ipv6_addr_t *dst, * packet. * @param[in] icmpv6_len The number of bytes at @p icmpv6. */ -void gnrc_ipv6_nib_handle_pkt(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +void gnrc_ipv6_nib_handle_pkt(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, size_t icmpv6_len); /** @@ -348,7 +348,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type); * `false`, to disable advertising the interface as a * router. */ -void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif2_t *netif, bool enable); +void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif_t *netif, bool enable); #else /** * @brief Optimization to NOP for non-routers diff --git a/sys/include/net/gnrc/lwmac/lwmac.h b/sys/include/net/gnrc/lwmac/lwmac.h index 081a6deb877d350a9b974aed90df162cdadf8adf..c10c7a6265cd2eaf1e72793803e8c542447b0fda 100644 --- a/sys/include/net/gnrc/lwmac/lwmac.h +++ b/sys/include/net/gnrc/lwmac/lwmac.h @@ -74,7 +74,7 @@ #define NET_GNRC_LWMAC_LWMAC_H #include "kernel_types.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -306,14 +306,14 @@ extern "C" { * @param[in] name Name for the LWMAC network interface. May be NULL. * @param[in] dev Device for the interface * - * @see @ref gnrc_netif2_create() + * @see @ref gnrc_netif_create() * * @return The network interface on success. * @return NULL, on error. */ -gnrc_netif2_t *gnrc_netif2_lwmac_create(char *stack, int stacksize, - char priority, char *name, - netdev_t *dev); +gnrc_netif_t *gnrc_netif_lwmac_create(char *stack, int stacksize, + char priority, char *name, + netdev_t *dev); #ifdef __cplusplus } #endif diff --git a/sys/include/net/gnrc/lwmac/timeout.h b/sys/include/net/gnrc/lwmac/timeout.h index b3118e31bf7d677d3ada29a28e78cde060047058..9d9945b40179986783e431b10966d9285428e057 100644 --- a/sys/include/net/gnrc/lwmac/timeout.h +++ b/sys/include/net/gnrc/lwmac/timeout.h @@ -25,7 +25,7 @@ #include <stdint.h> #include <stdbool.h> -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/lwmac/types.h" #ifdef __cplusplus @@ -44,7 +44,7 @@ extern "C" { * @param[in] type LWMAC timeout type * @param[in] offset timeout offset */ -void gnrc_lwmac_set_timeout(gnrc_netif2_t *netif, +void gnrc_lwmac_set_timeout(gnrc_netif_t *netif, gnrc_lwmac_timeout_type_t type, uint32_t offset); @@ -54,7 +54,7 @@ void gnrc_lwmac_set_timeout(gnrc_netif2_t *netif, * @param[in,out] netif the network interface * @param[in] type LWMAC timeout type */ -void gnrc_lwmac_clear_timeout(gnrc_netif2_t *netif, gnrc_lwmac_timeout_type_t type); +void gnrc_lwmac_clear_timeout(gnrc_netif_t *netif, gnrc_lwmac_timeout_type_t type); /** * @brief Check whether LWMAC timeout of type @p type is running. @@ -65,7 +65,7 @@ void gnrc_lwmac_clear_timeout(gnrc_netif2_t *netif, gnrc_lwmac_timeout_type_t ty * @return true, if timeout of type @p type is running. * @return false, if timeout of type @p type is not running. */ -bool gnrc_lwmac_timeout_is_running(gnrc_netif2_t *netif, +bool gnrc_lwmac_timeout_is_running(gnrc_netif_t *netif, gnrc_lwmac_timeout_type_t type); /** @@ -78,14 +78,14 @@ bool gnrc_lwmac_timeout_is_running(gnrc_netif2_t *netif, * @return true, if timeout of type @p type is expired. * @return false, if timeout of type @p type is not expired, or not exist. */ -bool gnrc_lwmac_timeout_is_expired(gnrc_netif2_t *netif, gnrc_lwmac_timeout_type_t type); +bool gnrc_lwmac_timeout_is_expired(gnrc_netif_t *netif, gnrc_lwmac_timeout_type_t type); /** * @brief Reset all LWMAC timeouts. * * @param[in,out] netif the network interface */ -void gnrc_lwmac_reset_timeouts(gnrc_netif2_t *netif); +void gnrc_lwmac_reset_timeouts(gnrc_netif_t *netif); /** * @brief Make a specific LWMAC timeout expired. diff --git a/sys/include/net/gnrc/mac/internal.h b/sys/include/net/gnrc/mac/internal.h index 8d2ae6cb82487268b9f2d5b16348ba96851155ef..3527b99c167fb06b6a2d7975caec9a764142dbeb 100644 --- a/sys/include/net/gnrc/mac/internal.h +++ b/sys/include/net/gnrc/mac/internal.h @@ -24,7 +24,7 @@ #include <stdint.h> #include "net/ieee802154.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -39,9 +39,9 @@ extern "C" { * * @return the rx_started state */ -static inline bool gnrc_netif2_get_rx_started(gnrc_netif2_t *netif) +static inline bool gnrc_netif_get_rx_started(gnrc_netif_t *netif) { - return (netif->mac.mac_info & GNRC_NETIF2_MAC_INFO_RX_STARTED); + return (netif->mac.mac_info & GNRC_NETIF_MAC_INFO_RX_STARTED); } /** @@ -52,13 +52,13 @@ static inline bool gnrc_netif2_get_rx_started(gnrc_netif2_t *netif) * @param[in] netif the network interface * @param[in] rx_started the rx_started state */ -static inline void gnrc_netif2_set_rx_started(gnrc_netif2_t *netif, bool rx_started) +static inline void gnrc_netif_set_rx_started(gnrc_netif_t *netif, bool rx_started) { if (rx_started) { - netif->mac.mac_info |= GNRC_NETIF2_MAC_INFO_RX_STARTED; + netif->mac.mac_info |= GNRC_NETIF_MAC_INFO_RX_STARTED; } else { - netif->mac.mac_info &= ~GNRC_NETIF2_MAC_INFO_RX_STARTED; + netif->mac.mac_info &= ~GNRC_NETIF_MAC_INFO_RX_STARTED; } } @@ -69,10 +69,10 @@ static inline void gnrc_netif2_set_rx_started(gnrc_netif2_t *netif, bool rx_star * * @return the transmission feedback */ -static inline gnrc_mac_tx_feedback_t gnrc_netif2_get_tx_feedback(gnrc_netif2_t *netif) +static inline gnrc_mac_tx_feedback_t gnrc_netif_get_tx_feedback(gnrc_netif_t *netif) { return (gnrc_mac_tx_feedback_t)(netif->mac.mac_info & - GNRC_NETIF2_MAC_INFO_TX_FEEDBACK_MASK); + GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK); } /** @@ -83,15 +83,15 @@ static inline gnrc_mac_tx_feedback_t gnrc_netif2_get_tx_feedback(gnrc_netif2_t * * @param[in] netif the network interface * @param[in] txf the transmission feedback */ -static inline void gnrc_netif2_set_tx_feedback(gnrc_netif2_t *netif, - gnrc_mac_tx_feedback_t txf) +static inline void gnrc_netif_set_tx_feedback(gnrc_netif_t *netif, + gnrc_mac_tx_feedback_t txf) { /* check if gnrc_mac_tx_feedback does not collide with - * GNRC_NETIF2_MAC_INFO_RX_STARTED */ - assert(!(txf & GNRC_NETIF2_MAC_INFO_RX_STARTED)); + * GNRC_NETIF_MAC_INFO_RX_STARTED */ + assert(!(txf & GNRC_NETIF_MAC_INFO_RX_STARTED)); /* unset previous value */ - netif->mac.mac_info &= ~GNRC_NETIF2_MAC_INFO_TX_FEEDBACK_MASK; - netif->mac.mac_info |= (uint16_t)(txf & GNRC_NETIF2_MAC_INFO_TX_FEEDBACK_MASK); + netif->mac.mac_info &= ~GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK; + netif->mac.mac_info |= (uint16_t)(txf & GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK); } #if (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN) diff --git a/sys/include/net/gnrc/ndp2.h b/sys/include/net/gnrc/ndp2.h index ab7d4bd84ac8746b3836244a1ebcc63fc014e32e..65a0b211bf0159fd2dd33369c84744611bc5b162 100644 --- a/sys/include/net/gnrc/ndp2.h +++ b/sys/include/net/gnrc/ndp2.h @@ -24,7 +24,7 @@ #include "kernel_types.h" #include "net/gnrc/pkt.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/ipv6/addr.h" #include "net/ipv6/hdr.h" @@ -270,7 +270,7 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_mtu_build(uint32_t mtu, gnrc_pktsnip_t *next); * for a neighbor solicitation so be sure to check that. * **Will be released** in an error case. */ -void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, +void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst, gnrc_pktsnip_t *ext_opts); @@ -316,7 +316,7 @@ void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, * check that. * **Will be released** in an error case. */ -void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, +void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *dst, bool supply_tl2a, gnrc_pktsnip_t *ext_opts); @@ -329,7 +329,7 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, * @param[in] netif Interface to send over. May not be NULL. * @param[in] dst Destination for the router solicitation. ff02::2 if NULL. */ -void gnrc_ndp2_rtr_sol_send(gnrc_netif2_t *netif, const ipv6_addr_t *dst); +void gnrc_ndp2_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst); /** * @brief Send pre-compiled router advertisement depending on a given network @@ -356,7 +356,7 @@ void gnrc_ndp2_rtr_sol_send(gnrc_netif2_t *netif, const ipv6_addr_t *dst); * for a neighbor advertisement so be sure to check that. * **Will be released** in an error case. */ -void gnrc_ndp2_rtr_adv_send(gnrc_netif2_t *netif, const ipv6_addr_t *src, +void gnrc_ndp2_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst, bool fin, gnrc_pktsnip_t *ext_opts); diff --git a/sys/include/net/gnrc/netif2.h b/sys/include/net/gnrc/netif.h similarity index 74% rename from sys/include/net/gnrc/netif2.h rename to sys/include/net/gnrc/netif.h index 05683a37992cd2459adecab0d3ab1a9bcb4089ec..5a6505a1dbd86924dd07e5edc2d00df8dac57a0b 100644 --- a/sys/include/net/gnrc/netif2.h +++ b/sys/include/net/gnrc/netif.h @@ -7,7 +7,7 @@ */ /** - * @defgroup net_gnrc_netif2 New network interface API + * @defgroup net_gnrc_netif Network interface API * @ingroup net_gnrc * @brief Abstraction layer for GNRC's network interfaces * @@ -21,8 +21,8 @@ * * @author Martine Lenders <mlenders@inf.fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_H -#define NET_GNRC_NETIF2_H +#ifndef NET_GNRC_NETIF_H +#define NET_GNRC_NETIF_H #include <stddef.h> #include <stdint.h> @@ -32,16 +32,16 @@ #include "msg.h" #include "net/gnrc/netapi.h" #include "net/gnrc/pkt.h" -#include "net/gnrc/netif2/conf.h" +#include "net/gnrc/netif/conf.h" #ifdef MODULE_GNRC_SIXLOWPAN -#include "net/gnrc/netif2/6lo.h" +#include "net/gnrc/netif/6lo.h" #endif -#include "net/gnrc/netif2/flags.h" +#include "net/gnrc/netif/flags.h" #ifdef MODULE_GNRC_IPV6 -#include "net/gnrc/netif2/ipv6.h" +#include "net/gnrc/netif/ipv6.h" #endif #ifdef MODULE_GNRC_MAC -#include "net/gnrc/netif2/mac.h" +#include "net/gnrc/netif/mac.h" #endif #include "net/netdev.h" #include "rmutex.h" @@ -53,55 +53,55 @@ extern "C" { /** * @brief Operations to an interface */ -typedef struct gnrc_netif2_ops gnrc_netif2_ops_t; +typedef struct gnrc_netif_ops gnrc_netif_ops_t; /** * @brief Representation of a network interface */ typedef struct { - const gnrc_netif2_ops_t *ops; /**< Operations of the network interface */ + const gnrc_netif_ops_t *ops; /**< Operations of the network interface */ netdev_t *dev; /**< Network device of the network interface */ rmutex_t mutex; /**< Mutex of the interface */ #if defined(MODULE_GNRC_IPV6) || DOXYGEN - gnrc_netif2_ipv6_t ipv6; /**< IPv6 component */ + gnrc_netif_ipv6_t ipv6; /**< IPv6 component */ #endif #if defined(MODULE_GNRC_MAC) || DOXYGEN - gnrc_netif2_mac_t mac; /**< @ref net_gnrc_mac component */ + gnrc_netif_mac_t mac; /**< @ref net_gnrc_mac component */ #endif /* MODULE_GNRC_MAC */ /** * @brief Flags for the interface * - * @see net_gnrc_netif2_flags + * @see net_gnrc_netif_flags */ uint32_t flags; -#if (GNRC_NETIF2_L2ADDR_MAXLEN > 0) +#if (GNRC_NETIF_L2ADDR_MAXLEN > 0) /** * @brief The link-layer address currently used as the source address * on this interface. * - * @note Only available if @ref GNRC_NETIF2_L2ADDR_MAXLEN > 0 + * @note Only available if @ref GNRC_NETIF_L2ADDR_MAXLEN > 0 */ - uint8_t l2addr[GNRC_NETIF2_L2ADDR_MAXLEN]; + uint8_t l2addr[GNRC_NETIF_L2ADDR_MAXLEN]; /** - * @brief Length in bytes of gnrc_netif2_t::l2addr + * @brief Length in bytes of gnrc_netif_t::l2addr * - * @note Only available if @ref GNRC_NETIF2_L2ADDR_MAXLEN > 0 + * @note Only available if @ref GNRC_NETIF_L2ADDR_MAXLEN > 0 */ uint8_t l2addr_len; #endif #if defined(MODULE_GNRC_SIXLOWPAN) || DOXYGEN - gnrc_netif2_6lo_t sixlo; /**< 6Lo component */ + gnrc_netif_6lo_t sixlo; /**< 6Lo component */ #endif uint8_t cur_hl; /**< Current hop-limit for out-going packets */ uint8_t device_type; /**< Device type */ kernel_pid_t pid; /**< PID of the network interface's thread */ -} gnrc_netif2_t; +} gnrc_netif_t; /** - * @see gnrc_netif2_ops_t + * @see gnrc_netif_ops_t */ -struct gnrc_netif2_ops { +struct gnrc_netif_ops { /** * @brief Initializes network interface beyond the default settings * @@ -114,7 +114,7 @@ struct gnrc_netif2_ops { * the interface's mutex gnrc_netif_t::mutex, since the thread will already * lock it. Leave NULL if you do not need any special initialization. */ - void (*init)(gnrc_netif2_t *netif); + void (*init)(gnrc_netif_t *netif); /** * @brief Send a @ref net_gnrc_pkt "packet" over the network interface @@ -134,9 +134,9 @@ struct gnrc_netif2_ops { * or is in an unexpected format. * @return -ENOTSUP, if sending @p pkt in the given format isn't supported * (e.g. empty payload with Ethernet). - * @return Any negative error code reported by gnrc_netif2_t::dev. + * @return Any negative error code reported by gnrc_netif_t::dev. */ - int (*send)(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt); + int (*send)(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt); /** * @brief Receives a @ref net_gnrc_pkt "packet" from the network interface @@ -154,13 +154,13 @@ struct gnrc_netif2_ops { * accordingly) and a @ref net_gnrc_netif_hdr in receive order. * @return NULL, if @ref net_gnrc_pktbuf was full. */ - gnrc_pktsnip_t *(*recv)(gnrc_netif2_t *netif); + gnrc_pktsnip_t *(*recv)(gnrc_netif_t *netif); /** * @brief Gets an option from the network interface * - * Use gnrc_netif2_get_from_netdev() to just get options from - * gnrc_netif2_t::dev. + * Use gnrc_netif_get_from_netdev() to just get options from + * gnrc_netif_t::dev. * * @param[in] netif The network interface. * @param[in] opt The option parameters. @@ -168,26 +168,26 @@ struct gnrc_netif2_ops { * @return Number of bytes in @p data. * @return -EOVERFLOW, if @p max_len is lesser than the required space. * @return -ENOTSUP, if @p opt is not supported to be set. - * @return Any negative error code reported by gnrc_netif2_t::dev. + * @return Any negative error code reported by gnrc_netif_t::dev. */ - int (*get)(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt); + int (*get)(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt); /** * @brief Sets an option from the network interface * - * Use gnrc_netif2_set_from_netdev() to just set options from - * gnrc_netif2_t::dev. + * Use gnrc_netif_set_from_netdev() to just set options from + * gnrc_netif_t::dev. * * @param[in] netif The network interface. * @param[in] opt The option parameters. * - * @return Number of bytes written to gnrc_netif2_t::dev. + * @return Number of bytes written to gnrc_netif_t::dev. * @return -EOVERFLOW, if @p data_len is greater than the allotted space in - * gnrc_netif2_t::dev or gnrc_netif_t. + * gnrc_netif_t::dev or gnrc_netif_t. * @return -ENOTSUP, if @p opt is not supported to be set. - * @return Any negative error code reported by gnrc_netif2_t::dev. + * @return Any negative error code reported by gnrc_netif_t::dev. */ - int (*set)(gnrc_netif2_t *netif, const gnrc_netapi_opt_t *opt); + int (*set)(gnrc_netif_t *netif, const gnrc_netapi_opt_t *opt); /** * @brief Message handler for network interface @@ -199,7 +199,7 @@ struct gnrc_netif2_ops { * @param[in] netif The network interface. * @param[in] msg Message to be handled. */ - void (*msg_handler)(gnrc_netif2_t *netif, msg_t *msg); + void (*msg_handler)(gnrc_netif_t *netif, msg_t *msg); }; /** @@ -221,16 +221,16 @@ struct gnrc_netif2_ops { * * @return The network interface on success. */ -gnrc_netif2_t *gnrc_netif2_create(char *stack, int stacksize, char priority, - const char *name, netdev_t *dev, - const gnrc_netif2_ops_t *ops); +gnrc_netif_t *gnrc_netif_create(char *stack, int stacksize, char priority, + const char *name, netdev_t *dev, + const gnrc_netif_ops_t *ops); /** * @brief Get number of network interfaces actually allocated * * @return Number of network interfaces actually allocated */ -unsigned gnrc_netif2_numof(void); +unsigned gnrc_netif_numof(void); /** * @brief Iterate over all network interfaces. @@ -240,7 +240,7 @@ unsigned gnrc_netif2_numof(void); * @return The next network interface after @p prev. * @return NULL, if @p prev was the last network interface. */ -gnrc_netif2_t *gnrc_netif2_iter(const gnrc_netif2_t *prev); +gnrc_netif_t *gnrc_netif_iter(const gnrc_netif_t *prev); /** * @brief Get network interface by PID @@ -250,34 +250,34 @@ gnrc_netif2_t *gnrc_netif2_iter(const gnrc_netif2_t *prev); * @return The network interface on success. * @return NULL, if no network interface with PID exists. */ -gnrc_netif2_t *gnrc_netif2_get_by_pid(kernel_pid_t pid); +gnrc_netif_t *gnrc_netif_get_by_pid(kernel_pid_t pid); /** - * @brief Default operation for gnrc_netif2_ops_t::get() + * @brief Default operation for gnrc_netif_ops_t::get() * * @note Can also be used to be called *after* a custom operation. * * @param[in] netif The network interface. * @param[out] opt The option parameters. * - * @return Return value of netdev_driver_t::get() of gnrc_netif2_t::dev of + * @return Return value of netdev_driver_t::get() of gnrc_netif_t::dev of * @p netif. */ -int gnrc_netif2_get_from_netdev(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt); +int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt); /** - * @brief Default operation for gnrc_netif2_ops_t::set() + * @brief Default operation for gnrc_netif_ops_t::set() * * @note Can also be used to be called *after* a custom operation. * * @param[in] netif The network interface. * @param[in] opt The option parameters. * - * @return Return value of netdev_driver_t::set() of gnrc_netif2_t::dev of + * @return Return value of netdev_driver_t::set() of gnrc_netif_t::dev of * @p netif. */ -int gnrc_netif2_set_from_netdev(gnrc_netif2_t *netif, - const gnrc_netapi_opt_t *opt); +int gnrc_netif_set_from_netdev(gnrc_netif_t *netif, + const gnrc_netapi_opt_t *opt); /** * @brief Converts a hardware address to a human readable string. @@ -295,7 +295,7 @@ int gnrc_netif2_set_from_netdev(gnrc_netif2_t *netif, * * @return @p out. */ -char *gnrc_netif2_addr_to_str(const uint8_t *addr, size_t addr_len, char *out); +char *gnrc_netif_addr_to_str(const uint8_t *addr, size_t addr_len, char *out); /** * @brief Parses a string of colon-separated hexadecimals to a hardware @@ -306,20 +306,20 @@ char *gnrc_netif2_addr_to_str(const uint8_t *addr, size_t addr_len, char *out); * * @pre `(out != NULL)` * @pre @p out **MUST** have allocated at least - * @ref GNRC_NETIF2_L2ADDR_MAXLEN bytes. + * @ref GNRC_NETIF_L2ADDR_MAXLEN bytes. * * @param[in] str A string of colon-separated hexadecimals. * @param[out] out The resulting hardware address. Must at least have - * @ref GNRC_NETIF2_L2ADDR_MAXLEN bytes allocated. + * @ref GNRC_NETIF_L2ADDR_MAXLEN bytes allocated. * * @return Actual length of @p out on success. * @return 0, on failure. */ -size_t gnrc_netif2_addr_from_str(const char *str, uint8_t *out); +size_t gnrc_netif_addr_from_str(const char *str, uint8_t *out); #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_H */ +#endif /* NET_GNRC_NETIF_H */ /** @} */ diff --git a/sys/include/net/gnrc/netif2/6lo.h b/sys/include/net/gnrc/netif/6lo.h similarity index 72% rename from sys/include/net/gnrc/netif2/6lo.h rename to sys/include/net/gnrc/netif/6lo.h index 7a9415e017cabe3f6fb6f7b17f86aa3fab88b0ae..af1602f30f265d51e2264d5e267fddb4d5a83201 100644 --- a/sys/include/net/gnrc/netif2/6lo.h +++ b/sys/include/net/gnrc/netif/6lo.h @@ -7,16 +7,16 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file - * @brief 6LoWPAN definitions for @ref net_gnrc_netif2 + * @brief 6LoWPAN definitions for @ref net_gnrc_netif * * @author Martine Lenders <m.lenders@fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_6LO_H -#define NET_GNRC_NETIF2_6LO_H +#ifndef NET_GNRC_NETIF_6LO_H +#define NET_GNRC_NETIF_6LO_H #include <stdint.h> @@ -25,7 +25,7 @@ extern "C" { #endif /** - * @brief 6Lo component of @ref gnrc_netif2_t + * @brief 6Lo component of @ref gnrc_netif_t */ typedef struct { /** @@ -35,11 +35,11 @@ typedef struct { * @ref net_gnrc_sixlowpan_frag "gnrc_sixlowpan_frag". */ uint8_t max_frag_size; -} gnrc_netif2_6lo_t; +} gnrc_netif_6lo_t; #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_6LO_H */ +#endif /* NET_GNRC_NETIF_6LO_H */ /** @} */ diff --git a/sys/include/net/gnrc/netif2/conf.h b/sys/include/net/gnrc/netif/conf.h similarity index 62% rename from sys/include/net/gnrc/netif2/conf.h rename to sys/include/net/gnrc/netif/conf.h index 085f622a2552007812bb45632a3af561cc32c62a..8808476f2f67f32d43638b2d7ac4df242e794b8b 100644 --- a/sys/include/net/gnrc/netif2/conf.h +++ b/sys/include/net/gnrc/netif/conf.h @@ -7,16 +7,16 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file - * @brief Configuration macros for @ref net_gnrc_netif2 + * @brief Configuration macros for @ref net_gnrc_netif * * @author Martine Lenders <mlenders@inf.fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_CONF_H -#define NET_GNRC_NETIF2_CONF_H +#ifndef NET_GNRC_NETIF_CONF_H +#define NET_GNRC_NETIF_CONF_H #include "net/ieee802154.h" #include "net/ethernet/hdr.h" @@ -30,7 +30,7 @@ extern "C" { /** * @brief Maximum number of network interfaces * - * @note Intentionally not calling it `GNRC_NETIF2_NUMOF` to not require + * @note Intentionally not calling it `GNRC_NETIF_NUMOF` to not require * rewrites throughout the stack. */ #ifndef GNRC_NETIF_NUMOF @@ -40,31 +40,31 @@ extern "C" { /** * @brief Default priority for network interface threads */ -#ifndef GNRC_NETIF2_PRIO -#define GNRC_NETIF2_PRIO (THREAD_PRIORITY_MAIN - 5) +#ifndef GNRC_NETIF_PRIO +#define GNRC_NETIF_PRIO (THREAD_PRIORITY_MAIN - 5) #endif /** * @brief Number of multicast addresses needed for @ref net_gnrc_rpl "RPL". * - * @note Used for calculation of @ref GNRC_NETIF2_IPV6_GROUPS_NUMOF + * @note Used for calculation of @ref GNRC_NETIF_IPV6_GROUPS_NUMOF */ #ifdef MODULE_GNRC_RPL -#define GNRC_NETIF2_RPL_ADDR (1) +#define GNRC_NETIF_RPL_ADDR (1) #else -#define GNRC_NETIF2_RPL_ADDR (0) +#define GNRC_NETIF_RPL_ADDR (0) #endif /** * @brief Number of multicast addresses needed for a @ref net_gnrc_ipv6 "IPv6" * router * - * @note Used for calculation of @ref GNRC_NETIF2_IPV6_GROUPS_NUMOF + * @note Used for calculation of @ref GNRC_NETIF_IPV6_GROUPS_NUMOF */ #if GNRC_IPV6_NIB_CONF_ROUTER -#define GNRC_NETIF2_IPV6_RTR_ADDR (1) +#define GNRC_NETIF_IPV6_RTR_ADDR (1) #else -#define GNRC_NETIF2_IPV6_RTR_ADDR (0) +#define GNRC_NETIF_IPV6_RTR_ADDR (0) #endif /** @@ -72,18 +72,18 @@ extern "C" { * * Default: 2 (link-local + corresponding global address) */ -#ifndef GNRC_NETIF2_IPV6_ADDRS_NUMOF -#define GNRC_NETIF2_IPV6_ADDRS_NUMOF (2) +#ifndef GNRC_NETIF_IPV6_ADDRS_NUMOF +#define GNRC_NETIF_IPV6_ADDRS_NUMOF (2) #endif /** * @brief Maximum number of multicast groups per interface * * Default: 2 (all-nodes + solicited-nodes of link-local and global unicast - * address) + @ref GNRC_NETIF2_RPL_ADDR + @ref GNRC_NETIF2_IPV6_RTR_ADDR + * address) + @ref GNRC_NETIF_RPL_ADDR + @ref GNRC_NETIF_IPV6_RTR_ADDR */ -#ifndef GNRC_NETIF2_IPV6_GROUPS_NUMOF -#define GNRC_NETIF2_IPV6_GROUPS_NUMOF (2 + GNRC_NETIF2_RPL_ADDR + GNRC_NETIF2_IPV6_RTR_ADDR) +#ifndef GNRC_NETIF_IPV6_GROUPS_NUMOF +#define GNRC_NETIF_IPV6_GROUPS_NUMOF (2 + GNRC_NETIF_RPL_ADDR + GNRC_NETIF_IPV6_RTR_ADDR) #endif /** @@ -102,25 +102,25 @@ extern "C" { * @note Implementers note: From longest to shortest extend, if new link-layer * address types are included */ -#ifndef GNRC_NETIF2_L2ADDR_MAXLEN +#ifndef GNRC_NETIF_L2ADDR_MAXLEN #if defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_XBEE) -#define GNRC_NETIF2_L2ADDR_MAXLEN (IEEE802154_LONG_ADDRESS_LEN) +#define GNRC_NETIF_L2ADDR_MAXLEN (IEEE802154_LONG_ADDRESS_LEN) #elif MODULE_NETDEV_ETH -#define GNRC_NETIF2_L2ADDR_MAXLEN (ETHERNET_ADDR_LEN) +#define GNRC_NETIF_L2ADDR_MAXLEN (ETHERNET_ADDR_LEN) #elif MODULE_CC110X -#define GNRC_NETIF2_L2ADDR_MAXLEN (1U) +#define GNRC_NETIF_L2ADDR_MAXLEN (1U) #else -#define GNRC_NETIF2_L2ADDR_MAXLEN (GNRC_IPV6_NIB_L2ADDR_MAX_LEN) +#define GNRC_NETIF_L2ADDR_MAXLEN (GNRC_IPV6_NIB_L2ADDR_MAX_LEN) #endif #endif -#ifndef GNRC_NETIF2_DEFAULT_HL -#define GNRC_NETIF2_DEFAULT_HL (64U) /**< default hop limit */ +#ifndef GNRC_NETIF_DEFAULT_HL +#define GNRC_NETIF_DEFAULT_HL (64U) /**< default hop limit */ #endif #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_CONF_H */ +#endif /* NET_GNRC_NETIF_CONF_H */ /** @} */ diff --git a/sys/include/net/gnrc/netif2/ethernet.h b/sys/include/net/gnrc/netif/ethernet.h similarity index 71% rename from sys/include/net/gnrc/netif2/ethernet.h rename to sys/include/net/gnrc/netif/ethernet.h index e54821c89a6fb7da0bb3a8f77008b267aef9923a..3f2dd5ac141ed38d33c31e46ea54f15f90b47674 100644 --- a/sys/include/net/gnrc/netif2/ethernet.h +++ b/sys/include/net/gnrc/netif/ethernet.h @@ -7,18 +7,18 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file - * @brief Ethernet adaption for @ref net_gnrc_netif2 + * @brief Ethernet adaption for @ref net_gnrc_netif * * @author Martine Lenders <mlenders@inf.fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_ETHERNET_H -#define NET_GNRC_NETIF2_ETHERNET_H +#ifndef NET_GNRC_NETIF_ETHERNET_H +#define NET_GNRC_NETIF_ETHERNET_H -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -33,7 +33,7 @@ extern "C" { * @param[in] name Name for the network interface. May be NULL. * @param[in] dev Device for the interface. * - * @see @ref gnrc_netif2_create() + * @see @ref gnrc_netif_create() * * @attention Fails and crashes (assertion error with @ref DEVELHELP or * segmentation fault without) if `GNRC_NETIF_NUMOF` is lower than @@ -41,12 +41,12 @@ extern "C" { * * @return The network interface on success. */ -gnrc_netif2_t *gnrc_netif2_ethernet_create(char *stack, int stacksize, char priority, - char *name, netdev_t *dev); +gnrc_netif_t *gnrc_netif_ethernet_create(char *stack, int stacksize, char priority, + char *name, netdev_t *dev); #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_ETHERNET_H */ +#endif /* NET_GNRC_NETIF_ETHERNET_H */ /** @} */ diff --git a/sys/include/net/gnrc/netif2/flags.h b/sys/include/net/gnrc/netif/flags.h similarity index 53% rename from sys/include/net/gnrc/netif2/flags.h rename to sys/include/net/gnrc/netif/flags.h index dbbbd40b700ef1e063647be70f753069df9004f8..f8a9660278a682be31f9f37dea400f854aa87436 100644 --- a/sys/include/net/gnrc/netif2/flags.h +++ b/sys/include/net/gnrc/netif/flags.h @@ -7,16 +7,16 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file - * @brief Flag definitions for @ref net_gnrc_netif2 + * @brief Flag definitions for @ref net_gnrc_netif * * @author Martine Lenders <m.lenders@fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_FLAGS_H -#define NET_GNRC_NETIF2_FLAGS_H +#ifndef NET_GNRC_NETIF_FLAGS_H +#define NET_GNRC_NETIF_FLAGS_H #ifdef __cplusplus extern "C" { @@ -24,18 +24,18 @@ extern "C" { /** * @brief Auto-address configuration modes - * @anchor net_gnrc_netif2_aac + * @anchor net_gnrc_netif_aac */ enum { - GNRC_NETIF2_AAC_NONE = 0, /**< no configuration */ - GNRC_NETIF2_AAC_AUTO, /**< Use some automatic bootstrapping (e.g. SLAAC with IPv6) */ - GNRC_NETIF2_AAC_DHCP, /**< Use DHCP(v6) */ + GNRC_NETIF_AAC_NONE = 0, /**< no configuration */ + GNRC_NETIF_AAC_AUTO, /**< Use some automatic bootstrapping (e.g. SLAAC with IPv6) */ + GNRC_NETIF_AAC_DHCP, /**< Use DHCP(v6) */ /* extend if needed */ }; /** * @name Network interface flags - * @anchor net_gnrc_netif2_flags + * @anchor net_gnrc_netif_flags * @{ */ /** @@ -44,69 +44,69 @@ enum { * There are link-layers (e.g. SLIP) that do not have (nor require) link-layer * addresses. This flag signifies this fact to upper layers by leaving it unset. */ -#define GNRC_NETIF2_FLAGS_HAS_L2ADDR (0x00000001U) +#define GNRC_NETIF_FLAGS_HAS_L2ADDR (0x00000001U) /** * @brief Network interface is enabled for IPv6 forwarding */ -#define GNRC_NETIF2_FLAGS_IPV6_FORWARDING (0x00000002U) +#define GNRC_NETIF_FLAGS_IPV6_FORWARDING (0x00000002U) /** * @brief Network interface advertises itself as an IPv6 router - * (implies @ref GNRC_NETIF2_FLAGS_IPV6_FORWARDING to be set) + * (implies @ref GNRC_NETIF_FLAGS_IPV6_FORWARDING to be set) */ -#define GNRC_NETIF2_FLAGS_IPV6_RTR_ADV (0x00000004U) +#define GNRC_NETIF_FLAGS_IPV6_RTR_ADV (0x00000004U) /** - * @brief This interface advertises its gnrc_netif2_t::mtu to other nodes - * (implies @ref GNRC_NETIF2_FLAGS_IPV6_RTR_ADV to be set) + * @brief This interface advertises its gnrc_netif_t::mtu to other nodes + * (implies @ref GNRC_NETIF_FLAGS_IPV6_RTR_ADV to be set) */ -#define GNRC_NETIF2_FLAGS_IPV6_ADV_MTU (0x00000008U) +#define GNRC_NETIF_FLAGS_IPV6_ADV_MTU (0x00000008U) /** - * @brief This interface advertises its gnrc_netif2_t::cur_hl to other nodes - * (implies @ref GNRC_NETIF2_FLAGS_IPV6_RTR_ADV to be set) + * @brief This interface advertises its gnrc_netif_t::cur_hl to other nodes + * (implies @ref GNRC_NETIF_FLAGS_IPV6_RTR_ADV to be set) */ -#define GNRC_NETIF2_FLAGS_IPV6_ADV_CUR_HL (0x00000010U) +#define GNRC_NETIF_FLAGS_IPV6_ADV_CUR_HL (0x00000010U) /** * @brief This interface advertises its reachable time to other nodes - * (implies @ref GNRC_NETIF2_FLAGS_IPV6_RTR_ADV to be set) + * (implies @ref GNRC_NETIF_FLAGS_IPV6_RTR_ADV to be set) */ -#define GNRC_NETIF2_FLAGS_IPV6_ADV_REACH_TIME (0x00000020U) +#define GNRC_NETIF_FLAGS_IPV6_ADV_REACH_TIME (0x00000020U) /** * @brief This interface advertises its retransmission timer to other nodes - * (implies @ref GNRC_NETIF2_FLAGS_IPV6_RTR_ADV to be set) + * (implies @ref GNRC_NETIF_FLAGS_IPV6_RTR_ADV to be set) */ -#define GNRC_NETIF2_FLAGS_IPV6_ADV_RETRANS_TIMER (0x00000040U) +#define GNRC_NETIF_FLAGS_IPV6_ADV_RETRANS_TIMER (0x00000040U) /** - * @brief If gnrc_netif2_t::ipv6::aac_mode == GNRC_NETIF2_AAC_DHCP then this + * @brief If gnrc_netif_t::ipv6::aac_mode == GNRC_NETIF_AAC_DHCP then this * flag indicates that other configuration information is available via * DHCPv6 (e.g. DNS-related information) * * @see [RFC 4861, section 4.2](https://tools.ietf.org/html/rfc4861#section-4.2) */ -#define GNRC_NETIF2_FLAGS_IPV6_ADV_O_FLAG (0x00000080U) +#define GNRC_NETIF_FLAGS_IPV6_ADV_O_FLAG (0x00000080U) /** * @brief This interface uses 6Lo header compression * * @see [RFC 6282](https://tools.ietf.org/html/rfc6282) */ -#define GNRC_NETIF2_FLAGS_6LO_HC (0x00000100U) +#define GNRC_NETIF_FLAGS_6LO_HC (0x00000100U) /** * @brief This interface acts as a 6Lo border router to the LLN */ -#define GNRC_NETIF2_FLAGS_6LO_ABR (0x00000200U) +#define GNRC_NETIF_FLAGS_6LO_ABR (0x00000200U) /** * @brief This interface acts as a mesh-under node (route-over topology when * unset) */ -#define GNRC_NETIF2_FLAGS_6LO_MESH (0x00000400U) +#define GNRC_NETIF_FLAGS_6LO_MESH (0x00000400U) /** * @brief Interface supports 6LoWPAN general header compression @@ -116,29 +116,29 @@ enum { * @see [draft-ietf-6lo-rfc6775-update-09, section 6.3] * (https://tools.ietf.org/html/draft-ietf-6lo-rfc6775-update-09#section-6.3) */ -#define GNRC_NETIF2_FLAGS_6LO_BACKBONE (0x00000800U) +#define GNRC_NETIF_FLAGS_6LO_BACKBONE (0x00000800U) /** * @brief Marks if the addresses of the interface were already registered * to an interface or not */ -#define GNRC_NETIF2_FLAGS_6LO_ADDRS_REG (0x00001000U) +#define GNRC_NETIF_FLAGS_6LO_ADDRS_REG (0x00001000U) /** * @brief Mask for @ref gnrc_mac_tx_feedback_t */ -#define GNRC_NETIF2_FLAGS_MAC_TX_FEEDBACK_MASK (0x00006000U) +#define GNRC_NETIF_FLAGS_MAC_TX_FEEDBACK_MASK (0x00006000U) /** * @brief Flag to track if a transmission might have corrupted a received * packet */ -#define GNRC_NETIF2_FLAGS_MAC_RX_STARTED (0x00008000U) +#define GNRC_NETIF_FLAGS_MAC_RX_STARTED (0x00008000U) /** @} */ #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_FLAGS_H */ +#endif /* NET_GNRC_NETIF_FLAGS_H */ /** @} */ diff --git a/sys/include/net/gnrc/netif2/ieee802154.h b/sys/include/net/gnrc/netif/ieee802154.h similarity index 63% rename from sys/include/net/gnrc/netif2/ieee802154.h rename to sys/include/net/gnrc/netif/ieee802154.h index 80b73ae3a1d01c51f7beff5615d07eb4da5f1c45..96000e5769e70f757b72303bc3a225ed13976def 100644 --- a/sys/include/net/gnrc/netif2/ieee802154.h +++ b/sys/include/net/gnrc/netif/ieee802154.h @@ -7,18 +7,18 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file - * @brief IEEE 802.15.4 adaption for @ref net_gnrc_netif2 + * @brief IEEE 802.15.4 adaption for @ref net_gnrc_netif * * @author Martine Lenders <m.lenders@fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_IEEE802154_H -#define NET_GNRC_NETIF2_IEEE802154_H +#ifndef NET_GNRC_NETIF_IEEE802154_H +#define NET_GNRC_NETIF_IEEE802154_H -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -33,18 +33,18 @@ extern "C" { * @param[in] name Name for the network interface. May be NULL. * @param[in] dev Device for the interface * - * @see @ref gnrc_netif2_create() + * @see @ref gnrc_netif_create() * * @return The network interface on success. * @return NULL, on error. */ -gnrc_netif2_t *gnrc_netif2_ieee802154_create(char *stack, int stacksize, - char priority, char *name, - netdev_t *dev); +gnrc_netif_t *gnrc_netif_ieee802154_create(char *stack, int stacksize, + char priority, char *name, + netdev_t *dev); #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_IEEE802154_H */ +#endif /* NET_GNRC_NETIF_IEEE802154_H */ /** @} */ diff --git a/sys/include/net/gnrc/netif2/internal.h b/sys/include/net/gnrc/netif/internal.h similarity index 75% rename from sys/include/net/gnrc/netif2/internal.h rename to sys/include/net/gnrc/netif/internal.h index 495a67c67f67ce7b15ef6a44464df99bd12e9bf3..0a78df887fe9cfb92e534fd879d9b64bf92d1bd2 100644 --- a/sys/include/net/gnrc/netif2/internal.h +++ b/sys/include/net/gnrc/netif/internal.h @@ -18,10 +18,10 @@ * * @author Martine Lenders <m.lenders@fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_INTERNAL_H -#define NET_GNRC_NETIF2_INTERNAL_H +#ifndef NET_GNRC_NETIF_INTERNAL_H +#define NET_GNRC_NETIF_INTERNAL_H -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -39,7 +39,7 @@ extern "C" { * * @internal */ -void gnrc_netif2_acquire(gnrc_netif2_t *netif); +void gnrc_netif_acquire(gnrc_netif_t *netif); /** * @brief Releases exclusive access to the interface @@ -48,7 +48,7 @@ void gnrc_netif2_acquire(gnrc_netif2_t *netif); * * @internal */ -void gnrc_netif2_release(gnrc_netif2_t *netif); +void gnrc_netif_release(gnrc_netif_t *netif); #if defined(MODULE_GNRC_IPV6) || DOXYGEN /** @@ -67,12 +67,12 @@ void gnrc_netif2_release(gnrc_netif2_t *netif); * @param[in] pfx_len length in bits of the prefix of @p addr * @param[in] flags initial flags for the address. * - Setting the address' state to - * @ref GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE + * @ref GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE * means that this address is assumed to be added due to * stateless auto-address configuration and actions * related to that may be performed in the background. * - Setting the address' state to - * @ref GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID means + * @ref GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID means * that the address is assumed to be manually configured * and its prefix will be added to the node's prefix * list (valid and preferred lifetime will be set to @@ -85,8 +85,8 @@ void gnrc_netif2_release(gnrc_netif2_t *netif); * @return >= 0, on success * @return -ENOMEM, when no space for new addresses is left on the interface */ -int gnrc_netif2_ipv6_addr_add(gnrc_netif2_t *netif, const ipv6_addr_t *addr, - unsigned pfx_len, uint8_t flags); +int gnrc_netif_ipv6_addr_add(gnrc_netif_t *netif, const ipv6_addr_t *addr, + unsigned pfx_len, uint8_t flags); /** * @brief Removes an IPv6 address from the interface @@ -98,12 +98,12 @@ int gnrc_netif2_ipv6_addr_add(gnrc_netif2_t *netif, const ipv6_addr_t *addr, * * @note Only available with @ref net_gnrc_ipv6 "gnrc_ipv6". */ -void gnrc_netif2_ipv6_addr_remove(gnrc_netif2_t *netif, - const ipv6_addr_t *addr); +void gnrc_netif_ipv6_addr_remove(gnrc_netif_t *netif, + const ipv6_addr_t *addr); /** - * @brief Returns the index of @p addr in gnrc_netif2_t::ipv6_addrs of @p + * @brief Returns the index of @p addr in gnrc_netif_t::ipv6_addrs of @p * netif * * @pre `(netif != NULL) && (addr != NULL)` @@ -115,11 +115,11 @@ void gnrc_netif2_ipv6_addr_remove(gnrc_netif2_t *netif, * * @note Only available with @ref net_gnrc_ipv6 "gnrc_ipv6". * - * @return index of @p addr in gnrc_netif2_t::ipv6_addrs of @p netif + * @return index of @p addr in gnrc_netif_t::ipv6_addrs of @p netif * @return -1, if @p addr isn't assigned to @p netif */ -int gnrc_netif2_ipv6_addr_idx(gnrc_netif2_t *netif, - const ipv6_addr_t *addr); +int gnrc_netif_ipv6_addr_idx(gnrc_netif_t *netif, + const ipv6_addr_t *addr); /** * @brief Gets state from address flags @@ -129,10 +129,10 @@ int gnrc_netif2_ipv6_addr_idx(gnrc_netif2_t *netif, * * @return the state of the address at @p idx */ -static inline uint8_t gnrc_netif2_ipv6_addr_get_state(const gnrc_netif2_t *netif, - int idx) +static inline uint8_t gnrc_netif_ipv6_addr_get_state(const gnrc_netif_t *netif, + int idx) { - return netif->ipv6.addrs_flags[idx] & GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK; + return netif->ipv6.addrs_flags[idx] & GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK; } /** @@ -145,14 +145,14 @@ static inline uint8_t gnrc_netif2_ipv6_addr_get_state(const gnrc_netif2_t *netif * @return the number of duplicate address detection transmissions already * performed */ -static inline uint8_t gnrc_netif2_ipv6_addr_dad_trans(const gnrc_netif2_t *netif, - int idx) +static inline uint8_t gnrc_netif_ipv6_addr_dad_trans(const gnrc_netif_t *netif, + int idx) { - return netif->ipv6.addrs_flags[idx] & GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE; + return netif->ipv6.addrs_flags[idx] & GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE; } /** - * @brief Returns the index of an address in gnrc_netif2_t::ipv6_addrs of @p + * @brief Returns the index of an address in gnrc_netif_t::ipv6_addrs of @p * netif that matches @p addr best * * @pre `(netif != NULL) && (addr != NULL)` @@ -165,12 +165,12 @@ static inline uint8_t gnrc_netif2_ipv6_addr_dad_trans(const gnrc_netif2_t *netif * * @note Only available with @ref net_gnrc_ipv6 "gnrc_ipv6". * - * @return index of an address in gnrc_netif2_t::ipv6_addrs of @p netif that + * @return index of an address in gnrc_netif_t::ipv6_addrs of @p netif that * best matches @p addr. * @return -1, if no address on @p netif matches @p addr */ -int gnrc_netif2_ipv6_addr_match(gnrc_netif2_t *netif, - const ipv6_addr_t *addr); +int gnrc_netif_ipv6_addr_match(gnrc_netif_t *netif, + const ipv6_addr_t *addr); /** * @brief Searches for the best address on an interface usable as a source @@ -198,9 +198,9 @@ int gnrc_netif2_ipv6_addr_match(gnrc_netif2_t *netif, * @return The best source address for a packet addressed to @p dst * @return NULL, if no matching address can be found on the interface. */ -ipv6_addr_t *gnrc_netif2_ipv6_addr_best_src(gnrc_netif2_t *netif, - const ipv6_addr_t *dst, - bool ll_only); +ipv6_addr_t *gnrc_netif_ipv6_addr_best_src(gnrc_netif_t *netif, + const ipv6_addr_t *dst, + bool ll_only); /** * @brief Gets an interface by an address (incl. multicast groups) assigned @@ -213,7 +213,7 @@ ipv6_addr_t *gnrc_netif2_ipv6_addr_best_src(gnrc_netif2_t *netif, * @return The network interface that has @p addr assigned * @return NULL, if no interface has @p addr assigned */ -gnrc_netif2_t *gnrc_netif2_get_by_ipv6_addr(const ipv6_addr_t *addr); +gnrc_netif_t *gnrc_netif_get_by_ipv6_addr(const ipv6_addr_t *addr); /** * @brief Gets an interface by an address matching a given prefix best @@ -224,7 +224,7 @@ gnrc_netif2_t *gnrc_netif2_get_by_ipv6_addr(const ipv6_addr_t *addr); * @p prefix best * @return NULL, if there is no address on any interface that matches @prefix */ -gnrc_netif2_t *gnrc_netif2_get_by_prefix(const ipv6_addr_t *prefix); +gnrc_netif_t *gnrc_netif_get_by_prefix(const ipv6_addr_t *prefix); /** * @brief Joins interface to an IPv6 multicast group @@ -240,8 +240,8 @@ gnrc_netif2_t *gnrc_netif2_get_by_prefix(const ipv6_addr_t *prefix); * @return 0, on success * @return -ENOMEM, when no space for new addresses is left on the interface */ -int gnrc_netif2_ipv6_group_join(gnrc_netif2_t *netif, - const ipv6_addr_t *addr); +int gnrc_netif_ipv6_group_join(gnrc_netif_t *netif, + const ipv6_addr_t *addr); /** * @brief Let interface leave from an IPv6 multicast group @@ -253,11 +253,11 @@ int gnrc_netif2_ipv6_group_join(gnrc_netif2_t *netif, * * @note Only available with @ref net_gnrc_ipv6 "gnrc_ipv6". */ -void gnrc_netif2_ipv6_group_leave(gnrc_netif2_t *netif, - const ipv6_addr_t *addr); +void gnrc_netif_ipv6_group_leave(gnrc_netif_t *netif, + const ipv6_addr_t *addr); /** - * @brief Returns the index of @p addr in gnrc_netif2_t::ipv6_groups of @p + * @brief Returns the index of @p addr in gnrc_netif_t::ipv6_groups of @p * netif * * @pre `(netif != NULL) && (addr != NULL)` @@ -269,11 +269,11 @@ void gnrc_netif2_ipv6_group_leave(gnrc_netif2_t *netif, * * @note Only available with @ref net_gnrc_ipv6 "gnrc_ipv6". * - * @return index of @p addr in gnrc_netif2_t::ipv6_groups of @p netif + * @return index of @p addr in gnrc_netif_t::ipv6_groups of @p netif * @return -1, if @p netif is not in group @p addr */ -int gnrc_netif2_ipv6_group_idx(gnrc_netif2_t *netif, - const ipv6_addr_t *addr); +int gnrc_netif_ipv6_group_idx(gnrc_netif_t *netif, + const ipv6_addr_t *addr); /** * @brief Gets interface identifier (IID) of an interface's link-layer address @@ -283,9 +283,9 @@ int gnrc_netif2_ipv6_group_idx(gnrc_netif2_t *netif, * * @return 0, on success * @return -ENOTSUP, if interface has no link-layer address or if - * gnrc_netif2_t::device_type is not supported. + * gnrc_netif_t::device_type is not supported. */ -int gnrc_netif2_ipv6_get_iid(gnrc_netif2_t *netif, eui64_t *eui64); +int gnrc_netif_ipv6_get_iid(gnrc_netif_t *netif, eui64_t *eui64); #endif /* MODULE_GNRC_IPV6 */ /** @@ -300,9 +300,9 @@ int gnrc_netif2_ipv6_get_iid(gnrc_netif2_t *netif, eui64_t *eui64); * @return true, if the interface represents a router * @return false, if the interface does not represent a router */ -static inline bool gnrc_netif2_is_rtr(const gnrc_netif2_t *netif) +static inline bool gnrc_netif_is_rtr(const gnrc_netif_t *netif) { - return (netif->flags & GNRC_NETIF2_FLAGS_IPV6_FORWARDING); + return (netif->flags & GNRC_NETIF_FLAGS_IPV6_FORWARDING); } /** @@ -316,9 +316,9 @@ static inline bool gnrc_netif2_is_rtr(const gnrc_netif2_t *netif) * @return false, if the interface is not allowed to send out router * advertisements */ -static inline bool gnrc_netif2_is_rtr_adv(const gnrc_netif2_t *netif) +static inline bool gnrc_netif_is_rtr_adv(const gnrc_netif_t *netif) { - return (netif->flags & GNRC_NETIF2_FLAGS_IPV6_RTR_ADV); + return (netif->flags & GNRC_NETIF_FLAGS_IPV6_RTR_ADV); } /** @@ -334,7 +334,7 @@ static inline bool gnrc_netif2_is_rtr_adv(const gnrc_netif2_t *netif) * @return true, if the interface represents a 6LN * @return false, if the interface does not represent a 6LN */ -bool gnrc_netif2_is_6ln(const gnrc_netif2_t *netif); +bool gnrc_netif_is_6ln(const gnrc_netif_t *netif); /** * @brief Checks if the interface represents a 6Lo router (6LR) according to @@ -349,9 +349,9 @@ bool gnrc_netif2_is_6ln(const gnrc_netif2_t *netif); * @return true, if the interface represents a 6LR * @return false, if the interface does not represent a 6LR */ -static inline bool gnrc_netif2_is_6lr(const gnrc_netif2_t *netif) +static inline bool gnrc_netif_is_6lr(const gnrc_netif_t *netif) { - return gnrc_netif2_is_rtr(netif) && gnrc_netif2_is_6ln(netif); + return gnrc_netif_is_rtr(netif) && gnrc_netif_is_6ln(netif); } /** @@ -367,15 +367,15 @@ static inline bool gnrc_netif2_is_6lr(const gnrc_netif2_t *netif) * @return true, if the interface represents a 6LBR * @return false, if the interface does not represent a 6LBR */ -static inline bool gnrc_netif2_is_6lbr(const gnrc_netif2_t *netif) +static inline bool gnrc_netif_is_6lbr(const gnrc_netif_t *netif) { - return (netif->flags & GNRC_NETIF2_FLAGS_6LO_ABR) && - gnrc_netif2_is_6lr(netif); + return (netif->flags & GNRC_NETIF_FLAGS_6LO_ABR) && + gnrc_netif_is_6lr(netif); } #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_INTERNAL_H */ +#endif /* NET_GNRC_NETIF_INTERNAL_H */ /** @} */ diff --git a/sys/include/net/gnrc/netif2/ipv6.h b/sys/include/net/gnrc/netif/ipv6.h similarity index 85% rename from sys/include/net/gnrc/netif2/ipv6.h rename to sys/include/net/gnrc/netif/ipv6.h index 56e5dfe26ecf900b1000141f662a5694c4d5754f..87307846a4a768116bb7adb702c52c1c28f4b341 100644 --- a/sys/include/net/gnrc/netif2/ipv6.h +++ b/sys/include/net/gnrc/netif/ipv6.h @@ -7,23 +7,23 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file - * @brief IPv6 defintions for @ref net_gnrc_netif2 + * @brief IPv6 defintions for @ref net_gnrc_netif * * @author Martine Lenders <mlenders@inf.fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_IPV6_H -#define NET_GNRC_NETIF2_IPV6_H +#ifndef NET_GNRC_NETIF_IPV6_H +#define NET_GNRC_NETIF_IPV6_H #include "evtimer_msg.h" #include "net/ipv6/addr.h" #ifdef MODULE_GNRC_IPV6_NIB #include "net/gnrc/ipv6/nib/conf.h" #endif -#include "net/gnrc/netif2/conf.h" +#include "net/gnrc/netif/conf.h" #ifdef MODULE_NETSTATS_IPV6 #include "net/netstats.h" #endif @@ -34,67 +34,67 @@ extern "C" { /** * @name IPv6 unicast and anycast address flags - * @anchor net_gnrc_netif2_ipv6_addrs_flags + * @anchor net_gnrc_netif_ipv6_addrs_flags * @{ */ /** * @brief Mask for the address' state */ -#define GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK (0x1fU) +#define GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK (0x1fU) /** * @brief Tentative states (with encoded DAD retransmissions) * * The retransmissions of DAD transmits can be decoded from this state by - * applying it as a mask to the [flags](gnrc_netif2_ipv6_t::addrs_flags) of the + * applying it as a mask to the [flags](gnrc_netif_ipv6_t::addrs_flags) of the * address. */ -#define GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE (0x07U) +#define GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE (0x07U) /** * @brief Deprecated address state (still valid, but not preferred) */ -#define GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_DEPRECATED (0x08U) +#define GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_DEPRECATED (0x08U) /** * @brief Valid address state */ -#define GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID (0x10U) +#define GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID (0x10U) /** * @brief Address is an anycast address */ -#define GNRC_NETIF2_IPV6_ADDRS_FLAGS_ANYCAST (0x20U) +#define GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST (0x20U) /** @} */ /** - * @brief IPv6 component for @ref gnrc_netif2_t + * @brief IPv6 component for @ref gnrc_netif_t * * @note only available with @ref net_gnrc_ipv6. */ typedef struct { /** - * @brief Flags for gnrc_netif2_t::ipv6_addrs + * @brief Flags for gnrc_netif_t::ipv6_addrs * - * @see net_gnrc_netif2_ipv6_addrs_flags + * @see net_gnrc_netif_ipv6_addrs_flags * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". */ - uint8_t addrs_flags[GNRC_NETIF2_IPV6_ADDRS_NUMOF]; + uint8_t addrs_flags[GNRC_NETIF_IPV6_ADDRS_NUMOF]; /** * @brief IPv6 unicast and anycast addresses of the interface * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". */ - ipv6_addr_t addrs[GNRC_NETIF2_IPV6_ADDRS_NUMOF]; + ipv6_addr_t addrs[GNRC_NETIF_IPV6_ADDRS_NUMOF]; /** * @brief IPv6 multicast groups of the interface * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". */ - ipv6_addr_t groups[GNRC_NETIF2_IPV6_GROUPS_NUMOF]; + ipv6_addr_t groups[GNRC_NETIF_IPV6_GROUPS_NUMOF]; #ifdef MODULE_NETSTATS_IPV6 /** * @brief IPv6 packet statistics @@ -158,7 +158,7 @@ typedef struct { * @note Might also be usable in the later default SLAAC implementation * for NS retransmission timers. */ - evtimer_msg_event_t addrs_timers[GNRC_NETIF2_IPV6_ADDRS_NUMOF]; + evtimer_msg_event_t addrs_timers[GNRC_NETIF_IPV6_ADDRS_NUMOF]; #endif #if GNRC_IPV6_NIB_CONF_ROUTER || DOXYGEN @@ -175,7 +175,7 @@ typedef struct { #if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) /** * @brief Base for random reachable time calculation and advertised - * reachable time in ms (if @ref GNRC_NETIF2_FLAGS_IPV6_RTR_ADV is + * reachable time in ms (if @ref GNRC_NETIF_FLAGS_IPV6_RTR_ADV is * set) * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". @@ -251,11 +251,11 @@ typedef struct { * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". */ uint16_t mtu; -} gnrc_netif2_ipv6_t; +} gnrc_netif_ipv6_t; #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_IPV6_H */ +#endif /* NET_GNRC_NETIF_IPV6_H */ /** @} */ diff --git a/sys/include/net/gnrc/netif2/mac.h b/sys/include/net/gnrc/netif/mac.h similarity index 85% rename from sys/include/net/gnrc/netif2/mac.h rename to sys/include/net/gnrc/netif/mac.h index 08dc95425361bb5b2176a0580b12edbb18c12fd1..daf0de8c98c06c407cc0f7f7b285931e63250184 100644 --- a/sys/include/net/gnrc/netif2/mac.h +++ b/sys/include/net/gnrc/netif/mac.h @@ -7,16 +7,16 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file - * @brief @ref net_gnrc_mac definitions for @ref net_gnrc_netif2 + * @brief @ref net_gnrc_mac definitions for @ref net_gnrc_netif * * @author Martine Lenders <mlenders@inf.fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_MAC_H -#define NET_GNRC_NETIF2_MAC_H +#ifndef NET_GNRC_NETIF_MAC_H +#define NET_GNRC_NETIF_MAC_H #include "net/gnrc/mac/types.h" #include "net/csma_sender.h" @@ -28,13 +28,13 @@ extern "C" { /** * @brief Mask for @ref gnrc_mac_tx_feedback_t */ -#define GNRC_NETIF2_MAC_INFO_TX_FEEDBACK_MASK (0x0003U) +#define GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK (0x0003U) /** * @brief Flag to track if a transmission might have corrupted a received * packet */ -#define GNRC_NETIF2_MAC_INFO_RX_STARTED (0x0004U) +#define GNRC_NETIF_MAC_INFO_RX_STARTED (0x0004U) /** * @brief Flag to track if a device has enabled CSMA for transmissions @@ -43,10 +43,10 @@ extern "C" { * requiring CSMA transmission, then, the device will run software CSMA * using `csma_sender` APIs. */ -#define GNRC_NETIF2_MAC_INFO_CSMA_ENABLED (0x0100U) +#define GNRC_NETIF_MAC_INFO_CSMA_ENABLED (0x0100U) /** - * @brief @ref net_gnrc_mac component of @ref gnrc_netif2_mac_t + * @brief @ref net_gnrc_mac component of @ref gnrc_netif_mac_t */ typedef struct { /** @@ -86,11 +86,11 @@ typedef struct { */ gnrc_lwmac_t lwmac; #endif -} gnrc_netif2_mac_t; +} gnrc_netif_mac_t; #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_MAC_H */ +#endif /* NET_GNRC_NETIF_MAC_H */ /** @} */ diff --git a/sys/include/net/gnrc/netif2/raw.h b/sys/include/net/gnrc/netif/raw.h similarity index 71% rename from sys/include/net/gnrc/netif2/raw.h rename to sys/include/net/gnrc/netif/raw.h index bb494ad1dacd5f8d5e50d81df1d8d6e40d56b78f..808798fe74870576fd885dd39c4de8d435d0cad7 100644 --- a/sys/include/net/gnrc/netif2/raw.h +++ b/sys/include/net/gnrc/netif/raw.h @@ -7,19 +7,19 @@ */ /** - * @ingroup net_gnrc_netif2 + * @ingroup net_gnrc_netif * @{ * * @file * @brief Raw (i.e. raw IP packets without link-layer information) adaptation - * for @ref net_gnrc_netif2 + * for @ref net_gnrc_netif * * @author Martine Lenders <m.lenders@fu-berlin.de> */ -#ifndef NET_GNRC_NETIF2_RAW_H -#define NET_GNRC_NETIF2_RAW_H +#ifndef NET_GNRC_NETIF_RAW_H +#define NET_GNRC_NETIF_RAW_H -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -34,17 +34,17 @@ extern "C" { * @param[in] name Name for the network interface. May be NULL. * @param[in] dev Device for the interface. * - * @see @ref gnrc_netif2_create() + * @see @ref gnrc_netif_create() * * @return The network interface on success. * @return NULL, on error. */ -gnrc_netif2_t *gnrc_netif2_raw_create(char *stack, int stacksize, char priority, - char *name, netdev_t *dev); +gnrc_netif_t *gnrc_netif_raw_create(char *stack, int stacksize, char priority, + char *name, netdev_t *dev); #ifdef __cplusplus } #endif -#endif /* NET_GNRC_NETIF2_RAW_H */ +#endif /* NET_GNRC_NETIF_RAW_H */ /** @} */ diff --git a/sys/include/net/gnrc/sixlowpan.h b/sys/include/net/gnrc/sixlowpan.h index 219bfc422c0fdc6a1b2ef68cfe0025eb6bea17bd..ee21f8e36d19a8ec452661cd6c5caa23abc6a8e4 100644 --- a/sys/include/net/gnrc/sixlowpan.h +++ b/sys/include/net/gnrc/sixlowpan.h @@ -75,7 +75,7 @@ * The false case also applies if @ref net_gnrc_sixlowpan_iphc is not included. * * If the packet without @ref GNRC_NETTYPE_NETIF header is shorter than - * gnrc_netif2_t::sixlo::max_frag_size of `netif` the packet will be send to the `netif`'s + * gnrc_netif_t::sixlo::max_frag_size of `netif` the packet will be send to the `netif`'s * thread. Otherwise if @ref net_gnrc_sixlowpan_frag is included the packet will be fragmented * according to <a href="https://tools.ietf.org/html/rfc4944">RFC 4944</a> if the packet is without * @ref GNRC_NETTYPE_NETIF header shorter than @ref SIXLOWPAN_FRAG_MAX_LEN. If none of these cases diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index 7d688c08c462b20aa60624689242fad0138ba4a3..da5c657196e5da6ec7f0d9b363f6d75b82706f02 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -86,7 +86,7 @@ typedef enum { * When adding an IPv6 address to a GNRC interface using * @ref GNRC_NETAPI_MSG_TYPE_SET, the gnrc_netapi_opt_t::context field can * be used to pass the prefix length (8 MSB) and some flags (8 LSB) - * according to @ref net_gnrc_netif2_ipv6_addrs_flags. The address is however always + * according to @ref net_gnrc_netif_ipv6_addrs_flags. The address is however always * considered to be manually added. * When getting the option you can pass an array of @ref ipv6_addr_t of any * length greater than 0 to the getter. The array will be filled up to to @@ -103,7 +103,7 @@ typedef enum { * * The information contained in the array is very specific to the * interface's API. For GNRC e.g. the values are according to - * @ref net_gnrc_netif2_ipv6_addrs_flags. + * @ref net_gnrc_netif_ipv6_addrs_flags. */ NETOPT_IPV6_ADDR_FLAGS, /** @@ -114,7 +114,7 @@ typedef enum { * When adding an IPv6 address to a GNRC interface using * @ref GNRC_NETAPI_MSG_TYPE_SET, the gnrc_netapi_opt_t::context field can * be used to pass the prefix length (8 MSB) and some flags (8 LSB) - * according to @ref net_gnrc_netif2_ipv6_addrs_flags. The address is however always + * according to @ref net_gnrc_netif_ipv6_addrs_flags. The address is however always * considered to be manually added. * When getting the option you can pass an array of @ref ipv6_addr_t of any * length greater than 0 to the getter. The array will be filled up to to diff --git a/sys/net/gnrc/Makefile b/sys/net/gnrc/Makefile index 61d132a635fdeb6239bc74d797b5e1ce338e748e..407753b37be62948839bd6dab639e1299b36ba12 100644 --- a/sys/net/gnrc/Makefile +++ b/sys/net/gnrc/Makefile @@ -31,8 +31,8 @@ endif ifneq (,$(filter gnrc_netapi,$(USEMODULE))) DIRS += netapi endif -ifneq (,$(filter gnrc_netif2,$(USEMODULE))) - DIRS += netif2 +ifneq (,$(filter gnrc_netif,$(USEMODULE))) + DIRS += netif endif ifneq (,$(filter gnrc_netif_hdr,$(USEMODULE))) DIRS += netif/hdr diff --git a/sys/net/gnrc/application_layer/tftp/gnrc_tftp.c b/sys/net/gnrc/application_layer/tftp/gnrc_tftp.c index b3fa543bbf6ac722490b9c0558b60bd81593cc93..5059dbe6078072851f5abdb00ccffeaba0716b98 100644 --- a/sys/net/gnrc/application_layer/tftp/gnrc_tftp.c +++ b/sys/net/gnrc/application_layer/tftp/gnrc_tftp.c @@ -22,7 +22,7 @@ #include "net/gnrc/tftp.h" #include "net/gnrc/netapi.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/netreg.h" #include "net/gnrc/udp.h" #include "net/gnrc/ipv6.h" @@ -254,7 +254,7 @@ static int _tftp_server(tftp_context_t *ctxt); static uint16_t _tftp_get_maximum_block_size(void) { uint16_t tmp; - gnrc_netif2_t *netif = gnrc_netif2_iter(NULL); + gnrc_netif_t *netif = gnrc_netif_iter(NULL); if ((netif != NULL) && gnrc_netapi_get(netif->pid, NETOPT_MAX_PACKET_SIZE, 0, &tmp, sizeof(uint16_t)) >= 0) { diff --git a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c index cdcc01eea0145f50ebb7e497c4a9fd257c59386e..45a617ec3f082091a5668ed44f1aa216f1086eee 100644 --- a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c +++ b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c @@ -9,7 +9,7 @@ #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ipv6.h" #include "net/gnrc/netapi.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/ipv6/addr.h" #include "net/netdev.h" #include "net/netopt.h" @@ -23,9 +23,9 @@ static kernel_pid_t gnrc_wireless_interface; static void set_interface_roles(void) { - gnrc_netif2_t *netif = NULL; + gnrc_netif_t *netif = NULL; - while ((netif = gnrc_netif2_iter(netif))) { + while ((netif = gnrc_netif_iter(netif))) { kernel_pid_t dev = netif->pid; int is_wired = gnrc_netapi_get(dev, NETOPT_IS_WIRED, 0, NULL, 0); if ((!gnrc_border_interface) && (is_wired == 1)) { diff --git a/sys/net/gnrc/link_layer/lwmac/include/lwmac_internal.h b/sys/net/gnrc/link_layer/lwmac/include/lwmac_internal.h index 7103c635a5771256f575efefb5b28eaa5165ffee..9d244f7ca0813b6e0d18a93c780310cdecf0025e 100644 --- a/sys/net/gnrc/link_layer/lwmac/include/lwmac_internal.h +++ b/sys/net/gnrc/link_layer/lwmac/include/lwmac_internal.h @@ -24,7 +24,7 @@ #include <stdint.h> #include "periph/rtt.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/mac/types.h" #include "net/gnrc/lwmac/types.h" @@ -104,7 +104,7 @@ typedef struct { * @param[in] tx_continue value for LWMAC tx-continue flag * */ -static inline void gnrc_lwmac_set_tx_continue(gnrc_netif2_t *netif, bool tx_continue) +static inline void gnrc_lwmac_set_tx_continue(gnrc_netif_t *netif, bool tx_continue) { if (tx_continue) { netif->mac.mac_info |= GNRC_LWMAC_TX_CONTINUE; @@ -122,7 +122,7 @@ static inline void gnrc_lwmac_set_tx_continue(gnrc_netif2_t *netif, bool tx_cont * @return true if tx continue * @return false if tx will not continue */ -static inline bool gnrc_lwmac_get_tx_continue(gnrc_netif2_t *netif) +static inline bool gnrc_lwmac_get_tx_continue(gnrc_netif_t *netif) { return (netif->mac.mac_info & GNRC_LWMAC_TX_CONTINUE); } @@ -134,7 +134,7 @@ static inline bool gnrc_lwmac_get_tx_continue(gnrc_netif2_t *netif) * @param[in] quit_tx value for @ref GNRC_LWMAC_QUIT_TX flag * */ -static inline void gnrc_lwmac_set_quit_tx(gnrc_netif2_t *netif, bool quit_tx) +static inline void gnrc_lwmac_set_quit_tx(gnrc_netif_t *netif, bool quit_tx) { if (quit_tx) { netif->mac.mac_info |= GNRC_LWMAC_QUIT_TX; @@ -152,7 +152,7 @@ static inline void gnrc_lwmac_set_quit_tx(gnrc_netif2_t *netif, bool quit_tx) * @return true if quit tx * @return false if will not quit tx */ -static inline bool gnrc_lwmac_get_quit_tx(gnrc_netif2_t *netif) +static inline bool gnrc_lwmac_get_quit_tx(gnrc_netif_t *netif) { return (netif->mac.mac_info & GNRC_LWMAC_QUIT_TX); } @@ -164,7 +164,7 @@ static inline bool gnrc_lwmac_get_quit_tx(gnrc_netif2_t *netif) * @param[in] backoff value for LWMAC @ref GNRC_LWMAC_PHASE_BACKOFF flag * */ -static inline void gnrc_lwmac_set_phase_backoff(gnrc_netif2_t *netif, bool backoff) +static inline void gnrc_lwmac_set_phase_backoff(gnrc_netif_t *netif, bool backoff) { if (backoff) { netif->mac.mac_info |= GNRC_LWMAC_PHASE_BACKOFF; @@ -182,7 +182,7 @@ static inline void gnrc_lwmac_set_phase_backoff(gnrc_netif2_t *netif, bool backo * @return true if will run phase-backoff * @return false if will not run phase-backoff */ -static inline bool gnrc_lwmac_get_phase_backoff(gnrc_netif2_t *netif) +static inline bool gnrc_lwmac_get_phase_backoff(gnrc_netif_t *netif) { return (netif->mac.mac_info & GNRC_LWMAC_PHASE_BACKOFF); } @@ -194,7 +194,7 @@ static inline bool gnrc_lwmac_get_phase_backoff(gnrc_netif2_t *netif) * @param[in] quit_rx value for LWMAC @ref GNRC_LWMAC_QUIT_RX flag * */ -static inline void gnrc_lwmac_set_quit_rx(gnrc_netif2_t *netif, bool quit_rx) +static inline void gnrc_lwmac_set_quit_rx(gnrc_netif_t *netif, bool quit_rx) { if (quit_rx) { netif->mac.mac_info |= GNRC_LWMAC_QUIT_RX; @@ -212,7 +212,7 @@ static inline void gnrc_lwmac_set_quit_rx(gnrc_netif2_t *netif, bool quit_rx) * @return true if will quit rx * @return false if will not quit rx */ -static inline bool gnrc_lwmac_get_quit_rx(gnrc_netif2_t *netif) +static inline bool gnrc_lwmac_get_quit_rx(gnrc_netif_t *netif) { return (netif->mac.mac_info & GNRC_LWMAC_QUIT_RX); } @@ -224,7 +224,7 @@ static inline bool gnrc_lwmac_get_quit_rx(gnrc_netif2_t *netif) * @param[in] active value for LWMAC @ref GNRC_LWMAC_DUTYCYCLE_ACTIVE flag * */ -static inline void gnrc_lwmac_set_dutycycle_active(gnrc_netif2_t *netif, bool active) +static inline void gnrc_lwmac_set_dutycycle_active(gnrc_netif_t *netif, bool active) { if (active) { netif->mac.lwmac.lwmac_info |= GNRC_LWMAC_DUTYCYCLE_ACTIVE; @@ -242,7 +242,7 @@ static inline void gnrc_lwmac_set_dutycycle_active(gnrc_netif2_t *netif, bool ac * @return true if active * @return false if not active */ -static inline bool gnrc_lwmac_get_dutycycle_active(gnrc_netif2_t *netif) +static inline bool gnrc_lwmac_get_dutycycle_active(gnrc_netif_t *netif) { return (netif->mac.lwmac.lwmac_info & GNRC_LWMAC_DUTYCYCLE_ACTIVE); } @@ -254,7 +254,7 @@ static inline bool gnrc_lwmac_get_dutycycle_active(gnrc_netif2_t *netif) * @param[in] reschedule value for @ref GNRC_LWMAC_NEEDS_RESCHEDULE flag * */ -static inline void gnrc_lwmac_set_reschedule(gnrc_netif2_t *netif, bool reschedule) +static inline void gnrc_lwmac_set_reschedule(gnrc_netif_t *netif, bool reschedule) { if (reschedule) { netif->mac.lwmac.lwmac_info |= GNRC_LWMAC_NEEDS_RESCHEDULE; @@ -272,7 +272,7 @@ static inline void gnrc_lwmac_set_reschedule(gnrc_netif2_t *netif, bool reschedu * @return true if needs rescheduling * @return false if no need for rescheduling */ -static inline bool gnrc_lwmac_get_reschedule(gnrc_netif2_t *netif) +static inline bool gnrc_lwmac_get_reschedule(gnrc_netif_t *netif) { return (netif->mac.lwmac.lwmac_info & GNRC_LWMAC_NEEDS_RESCHEDULE); } @@ -297,9 +297,9 @@ static inline bool gnrc_lwmac_get_reschedule(gnrc_netif2_t *netif) * or is in an unexpected format. * @return -ENOTSUP, if sending @p pkt in the given format isn't supported * (e.g. empty payload with Ethernet). - * @return Any negative error code reported by gnrc_netif2_t::dev. + * @return Any negative error code reported by gnrc_netif_t::dev. */ -int _gnrc_lwmac_transmit(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt); +int _gnrc_lwmac_transmit(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt); /** * @brief Parse an incoming packet and extract important information. @@ -321,7 +321,7 @@ int _gnrc_lwmac_parse_packet(gnrc_pktsnip_t *pkt, gnrc_lwmac_packet_info_t *info * * @return state of netdev */ -netopt_state_t _gnrc_lwmac_get_netdev_state(gnrc_netif2_t *netif); +netopt_state_t _gnrc_lwmac_get_netdev_state(gnrc_netif_t *netif); /** * @brief Shortcut to set the state of netdev @@ -329,7 +329,7 @@ netopt_state_t _gnrc_lwmac_get_netdev_state(gnrc_netif2_t *netif); * @param[in] netif ptr to the network interface * @param[in] devstate new state for netdev */ -void _gnrc_lwmac_set_netdev_state(gnrc_netif2_t *netif, netopt_state_t devstate); +void _gnrc_lwmac_set_netdev_state(gnrc_netif_t *netif, netopt_state_t devstate); /** * @brief Convert RTT ticks to device phase diff --git a/sys/net/gnrc/link_layer/lwmac/include/rx_state_machine.h b/sys/net/gnrc/link_layer/lwmac/include/rx_state_machine.h index f045e191332c7a72083a2acb3667cb6d09315823..85498d382cc45877c8cabda12d6a75a3c5933d90 100644 --- a/sys/net/gnrc/link_layer/lwmac/include/rx_state_machine.h +++ b/sys/net/gnrc/link_layer/lwmac/include/rx_state_machine.h @@ -23,7 +23,7 @@ #define RX_STATE_MACHINE_H #include "net/gnrc/pkt.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -35,7 +35,7 @@ extern "C" { * @param[in,out] netif ptr to the network interface * */ -void gnrc_lwmac_rx_start(gnrc_netif2_t *netif); +void gnrc_lwmac_rx_start(gnrc_netif_t *netif); /** * @brief Stop LWMAC RX procedure @@ -43,7 +43,7 @@ void gnrc_lwmac_rx_start(gnrc_netif2_t *netif); * @param[in,out] netif ptr to the network interface * */ -void gnrc_lwmac_rx_stop(gnrc_netif2_t *netif); +void gnrc_lwmac_rx_stop(gnrc_netif_t *netif); /** * @brief Update LWMAC RX procedure for packet reception @@ -51,7 +51,7 @@ void gnrc_lwmac_rx_stop(gnrc_netif2_t *netif); * @param[in,out] netif ptr to the network interface * */ -void gnrc_lwmac_rx_update(gnrc_netif2_t *netif); +void gnrc_lwmac_rx_update(gnrc_netif_t *netif); #ifdef __cplusplus } diff --git a/sys/net/gnrc/link_layer/lwmac/include/tx_state_machine.h b/sys/net/gnrc/link_layer/lwmac/include/tx_state_machine.h index f8da8bdc9843d2af5ef425bbffbeadc20172b484..838295ce806386c7e590e624d869f44e02e72f7e 100644 --- a/sys/net/gnrc/link_layer/lwmac/include/tx_state_machine.h +++ b/sys/net/gnrc/link_layer/lwmac/include/tx_state_machine.h @@ -23,7 +23,7 @@ #define TX_STATE_MACHINE_H #include "net/gnrc/pkt.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/mac/types.h" #ifdef __cplusplus @@ -38,7 +38,7 @@ extern "C" { * @param[in] neighbor Tx neighbor * */ -void gnrc_lwmac_tx_start(gnrc_netif2_t *netif, +void gnrc_lwmac_tx_start(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_mac_tx_neighbor_t *neighbor); @@ -48,7 +48,7 @@ void gnrc_lwmac_tx_start(gnrc_netif2_t *netif, * @param[in,out] netif ptr to the network interface * */ -void gnrc_lwmac_tx_stop(gnrc_netif2_t *netif); +void gnrc_lwmac_tx_stop(gnrc_netif_t *netif); /** * @brief Update LWMAC TX procedure for transmission @@ -56,7 +56,7 @@ void gnrc_lwmac_tx_stop(gnrc_netif2_t *netif); * @param[in,out] netif ptr to the network interface * */ -void gnrc_lwmac_tx_update(gnrc_netif2_t *netif); +void gnrc_lwmac_tx_update(gnrc_netif_t *netif); #ifdef __cplusplus } diff --git a/sys/net/gnrc/link_layer/lwmac/lwmac.c b/sys/net/gnrc/link_layer/lwmac/lwmac.c index ef21508d5a37533030a15ccac3db0018c6a6ddaf..5e821c976cd6f2467bae214d5475e89de0cf7fc6 100644 --- a/sys/net/gnrc/link_layer/lwmac/lwmac.c +++ b/sys/net/gnrc/link_layer/lwmac/lwmac.c @@ -28,9 +28,9 @@ #include "timex.h" #include "random.h" #include "periph/rtt.h" -#include "net/gnrc/netif2.h" -#include "net/gnrc/netif2/internal.h" -#include "net/gnrc/netif2/ieee802154.h" +#include "net/gnrc/netif.h" +#include "net/gnrc/netif/internal.h" +#include "net/gnrc/netif/ieee802154.h" #include "net/netdev/ieee802154.h" #include "net/gnrc/lwmac/types.h" #include "net/gnrc/lwmac/lwmac.h" @@ -58,29 +58,29 @@ kernel_pid_t lwmac_pid; static void rtt_cb(void *arg); -static void lwmac_set_state(gnrc_netif2_t *netif, gnrc_lwmac_state_t newstate); -static void lwmac_schedule_update(gnrc_netif2_t *netif); -static void rtt_handler(uint32_t event, gnrc_netif2_t *netif); -static void _lwmac_init(gnrc_netif2_t *netif); -static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt); -static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif); -static void _lwmac_msg_handler(gnrc_netif2_t *netif, msg_t *msg); - -static const gnrc_netif2_ops_t lwmac_ops = { +static void lwmac_set_state(gnrc_netif_t *netif, gnrc_lwmac_state_t newstate); +static void lwmac_schedule_update(gnrc_netif_t *netif); +static void rtt_handler(uint32_t event, gnrc_netif_t *netif); +static void _lwmac_init(gnrc_netif_t *netif); +static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt); +static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif); +static void _lwmac_msg_handler(gnrc_netif_t *netif, msg_t *msg); + +static const gnrc_netif_ops_t lwmac_ops = { .init = _lwmac_init, .send = _send, .recv = _recv, - .get = gnrc_netif2_get_from_netdev, - .set = gnrc_netif2_set_from_netdev, + .get = gnrc_netif_get_from_netdev, + .set = gnrc_netif_set_from_netdev, .msg_handler = _lwmac_msg_handler, }; -gnrc_netif2_t *gnrc_netif2_lwmac_create(char *stack, int stacksize, - char priority, char *name, - netdev_t *dev) +gnrc_netif_t *gnrc_netif_lwmac_create(char *stack, int stacksize, + char priority, char *name, + netdev_t *dev) { - return gnrc_netif2_create(stack, stacksize, priority, name, dev, - &lwmac_ops); + return gnrc_netif_create(stack, stacksize, priority, name, dev, + &lwmac_ops); } static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr) @@ -110,7 +110,7 @@ static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr) return snip; } -static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) +static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif) { netdev_t *dev = netif->dev; netdev_ieee802154_rx_info_t rx_info; @@ -196,7 +196,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) return pkt; } -static gnrc_mac_tx_neighbor_t *_next_tx_neighbor(gnrc_netif2_t *netif) +static gnrc_mac_tx_neighbor_t *_next_tx_neighbor(gnrc_netif_t *netif) { int next = -1; @@ -239,12 +239,12 @@ static uint32_t _next_inphase_event(uint32_t last, uint32_t interval) return last; } -inline void lwmac_schedule_update(gnrc_netif2_t *netif) +inline void lwmac_schedule_update(gnrc_netif_t *netif) { gnrc_lwmac_set_reschedule(netif, true); } -void lwmac_set_state(gnrc_netif2_t *netif, gnrc_lwmac_state_t newstate) +void lwmac_set_state(gnrc_netif_t *netif, gnrc_lwmac_state_t newstate) { gnrc_lwmac_state_t oldstate = netif->mac.lwmac.state; @@ -358,7 +358,7 @@ void lwmac_set_state(gnrc_netif2_t *netif, gnrc_lwmac_state_t newstate) lwmac_schedule_update(netif); } -static void _sleep_management(gnrc_netif2_t *netif) +static void _sleep_management(gnrc_netif_t *netif) { /* If a packet is scheduled, no other (possible earlier) packet can be * sent before the first one is handled, even no broadcast @@ -428,7 +428,7 @@ static void _sleep_management(gnrc_netif2_t *netif) } } -static void _rx_management_failed(gnrc_netif2_t *netif) +static void _rx_management_failed(gnrc_netif_t *netif) { /* This may happen frequently because we'll receive WA from * every node in range. */ @@ -463,7 +463,7 @@ static void _rx_management_failed(gnrc_netif2_t *netif) } } -static void _rx_management_success(gnrc_netif2_t *netif) +static void _rx_management_success(gnrc_netif_t *netif) { LOG_DEBUG("[LWMAC] Reception was successful\n"); gnrc_lwmac_rx_stop(netif); @@ -494,7 +494,7 @@ static void _rx_management_success(gnrc_netif2_t *netif) } } -static void _rx_management(gnrc_netif2_t *netif) +static void _rx_management(gnrc_netif_t *netif) { gnrc_lwmac_rx_state_t state_rx = netif->mac.rx.state; @@ -522,7 +522,7 @@ static void _rx_management(gnrc_netif2_t *netif) } } -static void _tx_management_stopped(gnrc_netif2_t *netif) +static void _tx_management_stopped(gnrc_netif_t *netif) { /* If there is packet remaining for retransmission, * retransmit it (i.e., the retransmission scheme of LWMAC). */ @@ -549,7 +549,7 @@ static void _tx_management_stopped(gnrc_netif2_t *netif) } } -static void _tx_management_success(gnrc_netif2_t *netif) +static void _tx_management_success(gnrc_netif_t *netif) { if (netif->mac.tx.current_neighbor == &(netif->mac.tx.neighbors[0])) { LOG_INFO("[LWMAC] Broadcast transmission done\n"); @@ -568,7 +568,7 @@ static void _tx_management_success(gnrc_netif2_t *netif) } } -static void _tx_management(gnrc_netif2_t *netif) +static void _tx_management(gnrc_netif_t *netif) { gnrc_lwmac_tx_state_t state_tx = netif->mac.tx.state; @@ -601,7 +601,7 @@ static void _tx_management(gnrc_netif2_t *netif) } } -static void _lwmac_update_listening(gnrc_netif2_t *netif) +static void _lwmac_update_listening(gnrc_netif_t *netif) { /* In case has pending packet to send, clear rtt alarm thus to goto * transmission initialization (in SLEEPING management) right after the @@ -645,7 +645,7 @@ static void _lwmac_update_listening(gnrc_netif2_t *netif) } /* Main state machine. Call whenever something happens */ -static bool lwmac_update(gnrc_netif2_t *netif) +static bool lwmac_update(gnrc_netif_t *netif) { gnrc_lwmac_set_reschedule(netif, false); @@ -693,7 +693,7 @@ static void rtt_cb(void *arg) } } -void rtt_handler(uint32_t event, gnrc_netif2_t *netif) +void rtt_handler(uint32_t event, gnrc_netif_t *netif) { uint32_t alarm; @@ -757,7 +757,7 @@ void rtt_handler(uint32_t event, gnrc_netif2_t *netif) */ static void _lwmac_event_cb(netdev_t *dev, netdev_event_t event) { - gnrc_netif2_t *netif = (gnrc_netif2_t *) dev->context; + gnrc_netif_t *netif = (gnrc_netif_t *) dev->context; if (event == NETDEV_EVENT_ISR) { msg_t msg; @@ -774,7 +774,7 @@ static void _lwmac_event_cb(netdev_t *dev, netdev_event_t event) switch (event) { case NETDEV_EVENT_RX_STARTED: { LOG_DEBUG("[LWMAC] NETDEV_EVENT_RX_STARTED\n"); - gnrc_netif2_set_rx_started(netif, true); + gnrc_netif_set_rx_started(netif, true); break; } case NETDEV_EVENT_RX_COMPLETE: { @@ -793,11 +793,11 @@ static void _lwmac_event_cb(netdev_t *dev, netdev_event_t event) * TODO: transceivers might have 2 frame buffers, so make this optional */ if (pkt == NULL) { - gnrc_netif2_set_rx_started(netif, false); + gnrc_netif_set_rx_started(netif, false); break; } - gnrc_netif2_set_rx_started(netif, false); + gnrc_netif_set_rx_started(netif, false); if (!gnrc_mac_queue_rx_packet(&netif->mac.rx, 0, pkt)) { LOG_ERROR("ERROR: [LWMAC] Can't push RX packet @ %p, memory full?\n", pkt); @@ -808,25 +808,25 @@ static void _lwmac_event_cb(netdev_t *dev, netdev_event_t event) break; } case NETDEV_EVENT_TX_STARTED: { - gnrc_netif2_set_tx_feedback(netif, TX_FEEDBACK_UNDEF); - gnrc_netif2_set_rx_started(netif, false); + gnrc_netif_set_tx_feedback(netif, TX_FEEDBACK_UNDEF); + gnrc_netif_set_rx_started(netif, false); break; } case NETDEV_EVENT_TX_COMPLETE: { - gnrc_netif2_set_tx_feedback(netif, TX_FEEDBACK_SUCCESS); - gnrc_netif2_set_rx_started(netif, false); + gnrc_netif_set_tx_feedback(netif, TX_FEEDBACK_SUCCESS); + gnrc_netif_set_rx_started(netif, false); lwmac_schedule_update(netif); break; } case NETDEV_EVENT_TX_NOACK: { - gnrc_netif2_set_tx_feedback(netif, TX_FEEDBACK_NOACK); - gnrc_netif2_set_rx_started(netif, false); + gnrc_netif_set_tx_feedback(netif, TX_FEEDBACK_NOACK); + gnrc_netif_set_rx_started(netif, false); lwmac_schedule_update(netif); break; } case NETDEV_EVENT_TX_MEDIUM_BUSY: { - gnrc_netif2_set_tx_feedback(netif, TX_FEEDBACK_BUSY); - gnrc_netif2_set_rx_started(netif, false); + gnrc_netif_set_tx_feedback(netif, TX_FEEDBACK_BUSY); + gnrc_netif_set_rx_started(netif, false); lwmac_schedule_update(netif); break; } @@ -841,7 +841,7 @@ static void _lwmac_event_cb(netdev_t *dev, netdev_event_t event) } } -static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { if (!gnrc_mac_queue_tx_packet(&netif->mac.tx, 0, pkt)) { gnrc_pktbuf_release(pkt); @@ -859,7 +859,7 @@ static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) return 0; } -static void _lwmac_msg_handler(gnrc_netif2_t *netif, msg_t *msg) +static void _lwmac_msg_handler(gnrc_netif_t *netif, msg_t *msg) { switch (msg->type) { /* RTT raised an interrupt */ @@ -896,7 +896,7 @@ static void _lwmac_msg_handler(gnrc_netif2_t *netif, msg_t *msg) } } -static void _lwmac_init(gnrc_netif2_t *netif) +static void _lwmac_init(gnrc_netif_t *netif) { netdev_t *dev; diff --git a/sys/net/gnrc/link_layer/lwmac/lwmac_internal.c b/sys/net/gnrc/link_layer/lwmac/lwmac_internal.c index de8bc9a74003966d9fb39b6ff3cf343348e00439..34a5e16b74007e0923eb13aefa4df1ad8b696463 100644 --- a/sys/net/gnrc/link_layer/lwmac/lwmac_internal.c +++ b/sys/net/gnrc/link_layer/lwmac/lwmac_internal.c @@ -26,13 +26,13 @@ #include "net/gnrc/mac/mac.h" #include "net/gnrc/lwmac/lwmac.h" #include "include/lwmac_internal.h" -#include "net/gnrc/netif2/ieee802154.h" +#include "net/gnrc/netif/ieee802154.h" #include "net/netdev/ieee802154.h" #define ENABLE_DEBUG (0) #include "debug.h" -int _gnrc_lwmac_transmit(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +int _gnrc_lwmac_transmit(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { netdev_t *dev = netif->dev; netdev_ieee802154_t *state = (netdev_ieee802154_t *)netif->dev; @@ -99,7 +99,7 @@ int _gnrc_lwmac_transmit(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) } #endif #ifdef MODULE_GNRC_MAC - if (netif->mac.mac_info & GNRC_NETIF2_MAC_INFO_CSMA_ENABLED) { + if (netif->mac.mac_info & GNRC_NETIF_MAC_INFO_CSMA_ENABLED) { res = csma_sender_csma_ca_send(dev, vector, n, &netif->mac.csma_conf); } else { @@ -189,7 +189,7 @@ int _gnrc_lwmac_parse_packet(gnrc_pktsnip_t *pkt, gnrc_lwmac_packet_info_t *info return 0; } -void _gnrc_lwmac_set_netdev_state(gnrc_netif2_t *netif, netopt_state_t devstate) +void _gnrc_lwmac_set_netdev_state(gnrc_netif_t *netif, netopt_state_t devstate) { netif->dev->driver->set(netif->dev, NETOPT_STATE, @@ -217,7 +217,7 @@ void _gnrc_lwmac_set_netdev_state(gnrc_netif2_t *netif, netopt_state_t devstate) #endif } -netopt_state_t _gnrc_lwmac_get_netdev_state(gnrc_netif2_t *netif) +netopt_state_t _gnrc_lwmac_get_netdev_state(gnrc_netif_t *netif) { netopt_state_t state; diff --git a/sys/net/gnrc/link_layer/lwmac/rx_state_machine.c b/sys/net/gnrc/link_layer/lwmac/rx_state_machine.c index 7707453207a983e05b374238476f089ffd7526de..fa7854175e8ee2d6b6f6b08612c48f967cba6855 100644 --- a/sys/net/gnrc/link_layer/lwmac/rx_state_machine.c +++ b/sys/net/gnrc/link_layer/lwmac/rx_state_machine.c @@ -52,7 +52,7 @@ */ #define GNRC_LWMAC_RX_FOUND_DATA (0x04U) -static uint8_t _packet_process_in_wait_for_wr(gnrc_netif2_t *netif) +static uint8_t _packet_process_in_wait_for_wr(gnrc_netif_t *netif) { uint8_t rx_info = 0; gnrc_pktsnip_t *pkt; @@ -112,7 +112,7 @@ static uint8_t _packet_process_in_wait_for_wr(gnrc_netif2_t *netif) } /* return false if send wa failed, otherwise return true */ -static bool _send_wa(gnrc_netif2_t *netif) +static bool _send_wa(gnrc_netif_t *netif) { gnrc_pktsnip_t *pkt; gnrc_pktsnip_t *pkt_lwmac; @@ -198,7 +198,7 @@ static bool _send_wa(gnrc_netif2_t *netif) return true; } -static uint8_t _packet_process_in_wait_for_data(gnrc_netif2_t *netif) +static uint8_t _packet_process_in_wait_for_data(gnrc_netif_t *netif) { uint8_t rx_info = 0; gnrc_pktsnip_t *pkt; @@ -277,7 +277,7 @@ static uint8_t _packet_process_in_wait_for_data(gnrc_netif2_t *netif) return rx_info; } -void gnrc_lwmac_rx_start(gnrc_netif2_t *netif) +void gnrc_lwmac_rx_start(gnrc_netif_t *netif) { if (netif == NULL) { return; @@ -287,7 +287,7 @@ void gnrc_lwmac_rx_start(gnrc_netif2_t *netif) assert(netif->mac.rx.l2_addr.len == 0); /* Don't attempt to send a WA if channel is busy to get timings right */ - netif->mac.mac_info &= ~GNRC_NETIF2_MAC_INFO_CSMA_ENABLED; + netif->mac.mac_info &= ~GNRC_NETIF_MAC_INFO_CSMA_ENABLED; netopt_enable_t csma_disable = NETOPT_DISABLE; netif->dev->driver->set(netif->dev, NETOPT_CSMA, &csma_disable, sizeof(csma_disable)); @@ -295,7 +295,7 @@ void gnrc_lwmac_rx_start(gnrc_netif2_t *netif) netif->mac.rx.state = GNRC_LWMAC_RX_STATE_INIT; } -void gnrc_lwmac_rx_stop(gnrc_netif2_t *netif) +void gnrc_lwmac_rx_stop(gnrc_netif_t *netif) { if (!netif) { return; @@ -307,7 +307,7 @@ void gnrc_lwmac_rx_stop(gnrc_netif2_t *netif) } /* Returns whether rescheduling is needed or not */ -static bool _lwmac_rx_update(gnrc_netif2_t *netif) +static bool _lwmac_rx_update(gnrc_netif_t *netif) { bool reschedule = false; @@ -364,7 +364,7 @@ static bool _lwmac_rx_update(gnrc_netif2_t *netif) case GNRC_LWMAC_RX_STATE_WAIT_WA_SENT: { LOG_DEBUG("[LWMAC-rx] GNRC_LWMAC_RX_STATE_WAIT_WA_SENT\n"); - if (gnrc_netif2_get_tx_feedback(netif) == TX_FEEDBACK_UNDEF) { + if (gnrc_netif_get_tx_feedback(netif) == TX_FEEDBACK_UNDEF) { LOG_DEBUG("[LWMAC-rx] WA not yet completely sent\n"); break; } @@ -397,7 +397,7 @@ static bool _lwmac_rx_update(gnrc_netif2_t *netif) * machine (see above). */ if (gnrc_lwmac_timeout_is_expired(netif, GNRC_LWMAC_TIMEOUT_DATA)) { - if (!gnrc_netif2_get_rx_started(netif)) { + if (!gnrc_netif_get_rx_started(netif)) { LOG_INFO("[LWMAC-rx] DATA timed out\n"); netif->mac.rx.rx_bad_exten_count++; netif->mac.rx.state = GNRC_LWMAC_RX_STATE_FAILED; @@ -430,7 +430,7 @@ static bool _lwmac_rx_update(gnrc_netif2_t *netif) return reschedule; } -void gnrc_lwmac_rx_update(gnrc_netif2_t *netif) +void gnrc_lwmac_rx_update(gnrc_netif_t *netif) { /* Update until no rescheduling needed */ while (_lwmac_rx_update(netif)) {} diff --git a/sys/net/gnrc/link_layer/lwmac/timeout.c b/sys/net/gnrc/link_layer/lwmac/timeout.c index 39fa8b7732344b8a5e9468271bf453f991ce1c53..6b3f8d42d38762aace9b6aa66278b87fd7f82369 100644 --- a/sys/net/gnrc/link_layer/lwmac/timeout.c +++ b/sys/net/gnrc/link_layer/lwmac/timeout.c @@ -58,14 +58,14 @@ static int _lwmac_find_timeout(gnrc_lwmac_t *lwmac, gnrc_lwmac_timeout_type_t ty return -ENOENT; } -inline bool gnrc_lwmac_timeout_is_running(gnrc_netif2_t *netif, +inline bool gnrc_lwmac_timeout_is_running(gnrc_netif_t *netif, gnrc_lwmac_timeout_type_t type) { assert(netif); return (_lwmac_find_timeout(&netif->mac.lwmac, type) >= 0); } -bool gnrc_lwmac_timeout_is_expired(gnrc_netif2_t *netif, gnrc_lwmac_timeout_type_t type) +bool gnrc_lwmac_timeout_is_expired(gnrc_netif_t *netif, gnrc_lwmac_timeout_type_t type) { assert(netif); @@ -79,7 +79,7 @@ bool gnrc_lwmac_timeout_is_expired(gnrc_netif2_t *netif, gnrc_lwmac_timeout_type return false; } -gnrc_lwmac_timeout_t *_lwmac_acquire_timeout(gnrc_netif2_t *netif, +gnrc_lwmac_timeout_t *_lwmac_acquire_timeout(gnrc_netif_t *netif, gnrc_lwmac_timeout_type_t type) { assert(netif); @@ -104,7 +104,7 @@ void gnrc_lwmac_timeout_make_expire(gnrc_lwmac_timeout_t *timeout) timeout->expired = true; } -void gnrc_lwmac_clear_timeout(gnrc_netif2_t *netif, gnrc_lwmac_timeout_type_t type) +void gnrc_lwmac_clear_timeout(gnrc_netif_t *netif, gnrc_lwmac_timeout_type_t type) { assert(netif); @@ -114,7 +114,7 @@ void gnrc_lwmac_clear_timeout(gnrc_netif2_t *netif, gnrc_lwmac_timeout_type_t ty } } -void gnrc_lwmac_set_timeout(gnrc_netif2_t *netif, +void gnrc_lwmac_set_timeout(gnrc_netif_t *netif, gnrc_lwmac_timeout_type_t type, uint32_t offset) { @@ -136,7 +136,7 @@ void gnrc_lwmac_set_timeout(gnrc_netif2_t *netif, } } -void gnrc_lwmac_reset_timeouts(gnrc_netif2_t *netif) +void gnrc_lwmac_reset_timeouts(gnrc_netif_t *netif) { assert(netif); diff --git a/sys/net/gnrc/link_layer/lwmac/tx_state_machine.c b/sys/net/gnrc/link_layer/lwmac/tx_state_machine.c index ae68acb68d801ce4192e13e0743665c6f6894724..4c65ae6e2085db8eaf6c335dd84ef73c656bd05b 100644 --- a/sys/net/gnrc/link_layer/lwmac/tx_state_machine.c +++ b/sys/net/gnrc/link_layer/lwmac/tx_state_machine.c @@ -49,7 +49,7 @@ */ #define GNRC_LWMAC_TX_FAIL (0x02U) -static uint8_t _send_bcast(gnrc_netif2_t *netif) +static uint8_t _send_bcast(gnrc_netif_t *netif) { assert(netif != NULL); @@ -142,7 +142,7 @@ static uint8_t _send_bcast(gnrc_netif2_t *netif) return tx_info; } -static uint8_t _send_wr(gnrc_netif2_t *netif) +static uint8_t _send_wr(gnrc_netif_t *netif) { assert(netif != NULL); @@ -228,7 +228,7 @@ static uint8_t _send_wr(gnrc_netif2_t *netif) return tx_info; } -static uint8_t _packet_process_in_wait_for_wa(gnrc_netif2_t *netif) +static uint8_t _packet_process_in_wait_for_wa(gnrc_netif_t *netif) { assert(netif != NULL); @@ -371,7 +371,7 @@ static uint8_t _packet_process_in_wait_for_wa(gnrc_netif2_t *netif) } /* return false if send data failed, otherwise return true */ -static bool _send_data(gnrc_netif2_t *netif) +static bool _send_data(gnrc_netif_t *netif) { assert(netif != NULL); @@ -390,7 +390,7 @@ static bool _send_data(gnrc_netif2_t *netif) netif->dev->driver->set(netif->dev, NETOPT_CSMA_RETRIES, &csma_retries, sizeof(csma_retries)); - netif->mac.mac_info |= GNRC_NETIF2_MAC_INFO_CSMA_ENABLED; + netif->mac.mac_info |= GNRC_NETIF_MAC_INFO_CSMA_ENABLED; netopt_enable_t csma_enable = NETOPT_ENABLE; netif->dev->driver->set(netif->dev, NETOPT_CSMA, &csma_enable, sizeof(csma_enable)); @@ -473,7 +473,7 @@ static bool _send_data(gnrc_netif2_t *netif) return true; } -void gnrc_lwmac_tx_start(gnrc_netif2_t *netif, +void gnrc_lwmac_tx_start(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_mac_tx_neighbor_t *neighbor) { @@ -496,7 +496,7 @@ void gnrc_lwmac_tx_start(gnrc_netif2_t *netif, #endif } -void gnrc_lwmac_tx_stop(gnrc_netif2_t *netif) +void gnrc_lwmac_tx_stop(gnrc_netif_t *netif) { assert(netif != NULL); @@ -526,7 +526,7 @@ void gnrc_lwmac_tx_stop(gnrc_netif2_t *netif) } /* Returns whether rescheduling is needed or not */ -static bool _lwmac_tx_update(gnrc_netif2_t *netif) +static bool _lwmac_tx_update(gnrc_netif_t *netif) { assert(netif != NULL); @@ -560,7 +560,7 @@ static bool _lwmac_tx_update(gnrc_netif2_t *netif) uint8_t csma_retries = GNRC_LWMAC_BROADCAST_CSMA_RETRIES; netif->dev->driver->set(netif->dev, NETOPT_CSMA_RETRIES, &csma_retries, sizeof(csma_retries)); - netif->mac.mac_info |= GNRC_NETIF2_MAC_INFO_CSMA_ENABLED; + netif->mac.mac_info |= GNRC_NETIF_MAC_INFO_CSMA_ENABLED; netopt_enable_t csma_enable = NETOPT_ENABLE; netif->dev->driver->set(netif->dev, NETOPT_CSMA, &csma_enable, sizeof(csma_enable)); @@ -571,7 +571,7 @@ static bool _lwmac_tx_update(gnrc_netif2_t *netif) } else { /* Use CSMA for the first WR */ - netif->mac.mac_info |= GNRC_NETIF2_MAC_INFO_CSMA_ENABLED; + netif->mac.mac_info |= GNRC_NETIF_MAC_INFO_CSMA_ENABLED; netopt_enable_t csma_disable = NETOPT_ENABLE; netif->dev->driver->set(netif->dev, NETOPT_CSMA, &csma_disable, sizeof(csma_disable)); @@ -633,14 +633,14 @@ static bool _lwmac_tx_update(gnrc_netif2_t *netif) break; } - if (gnrc_netif2_get_tx_feedback(netif) == TX_FEEDBACK_UNDEF) { + if (gnrc_netif_get_tx_feedback(netif) == TX_FEEDBACK_UNDEF) { LOG_DEBUG("[LWMAC-tx] WR not yet completely sent\n"); break; } /* If found ongoing transmission, goto TX failure, i.e., postpone transmission to * next cycle. This is mainly for collision avoidance. */ - if (gnrc_netif2_get_tx_feedback(netif) == TX_FEEDBACK_BUSY) { + if (gnrc_netif_get_tx_feedback(netif) == TX_FEEDBACK_BUSY) { if (!gnrc_mac_queue_tx_packet(&netif->mac.tx, 0, netif->mac.tx.packet)) { gnrc_pktbuf_release(netif->mac.tx.packet); LOG_WARNING("WARNING: [LWMAC-tx] TX queue full, drop packet\n"); @@ -654,7 +654,7 @@ static bool _lwmac_tx_update(gnrc_netif2_t *netif) if (netif->mac.tx.wr_sent == 0) { /* Only the first WR use CSMA */ - netif->mac.mac_info &= ~GNRC_NETIF2_MAC_INFO_CSMA_ENABLED; + netif->mac.mac_info &= ~GNRC_NETIF_MAC_INFO_CSMA_ENABLED; netopt_enable_t csma_disable = NETOPT_DISABLE; netif->dev->driver->set(netif->dev, NETOPT_CSMA, &csma_disable, sizeof(csma_disable)); @@ -763,21 +763,21 @@ static bool _lwmac_tx_update(gnrc_netif2_t *netif) } LOG_DEBUG("[LWMAC-tx] GNRC_LWMAC_TX_STATE_WAIT_FEEDBACK\n"); - if (gnrc_netif2_get_tx_feedback(netif) == TX_FEEDBACK_UNDEF) { + if (gnrc_netif_get_tx_feedback(netif) == TX_FEEDBACK_UNDEF) { break; } - else if (gnrc_netif2_get_tx_feedback(netif) == TX_FEEDBACK_SUCCESS) { + else if (gnrc_netif_get_tx_feedback(netif) == TX_FEEDBACK_SUCCESS) { netif->mac.tx.state = GNRC_LWMAC_TX_STATE_SUCCESSFUL; reschedule = true; break; } - else if (gnrc_netif2_get_tx_feedback(netif) == TX_FEEDBACK_NOACK) { + else if (gnrc_netif_get_tx_feedback(netif) == TX_FEEDBACK_NOACK) { LOG_ERROR("ERROR: [LWMAC-tx] Not ACKED\n"); netif->mac.tx.state = GNRC_LWMAC_TX_STATE_FAILED; reschedule = true; break; } - else if (gnrc_netif2_get_tx_feedback(netif) == TX_FEEDBACK_BUSY) { + else if (gnrc_netif_get_tx_feedback(netif) == TX_FEEDBACK_BUSY) { LOG_ERROR("ERROR: [LWMAC-tx] Channel busy \n"); netif->mac.tx.state = GNRC_LWMAC_TX_STATE_FAILED; reschedule = true; @@ -785,7 +785,7 @@ static bool _lwmac_tx_update(gnrc_netif2_t *netif) } LOG_ERROR("ERROR: [LWMAC-tx] Tx feedback unhandled: %i\n", - gnrc_netif2_get_tx_feedback(netif)); + gnrc_netif_get_tx_feedback(netif)); netif->mac.tx.state = GNRC_LWMAC_TX_STATE_FAILED; reschedule = true; break; @@ -802,7 +802,7 @@ static bool _lwmac_tx_update(gnrc_netif2_t *netif) return reschedule; } -void gnrc_lwmac_tx_update(gnrc_netif2_t *netif) +void gnrc_lwmac_tx_update(gnrc_netif_t *netif) { /* Update until no rescheduling needed */ while (_lwmac_tx_update(netif)) {} diff --git a/sys/net/gnrc/netif2/Makefile b/sys/net/gnrc/netif/Makefile similarity index 61% rename from sys/net/gnrc/netif2/Makefile rename to sys/net/gnrc/netif/Makefile index 590336f5daecaf7c1bb550bf2eb7518418512882..02c030bd3503ea3b2cedbcaf2a391d822cb2ef6e 100644 --- a/sys/net/gnrc/netif2/Makefile +++ b/sys/net/gnrc/netif/Makefile @@ -1,3 +1,3 @@ -MODULE := gnrc_netif2 +MODULE := gnrc_netif include $(RIOTBASE)/Makefile.base diff --git a/sys/net/gnrc/netif2/gnrc_netif2.c b/sys/net/gnrc/netif/gnrc_netif.c similarity index 79% rename from sys/net/gnrc/netif2/gnrc_netif2.c rename to sys/net/gnrc/netif/gnrc_netif.c index 804d7aa69356abd9b67f6c55490d5a664eaf30dd..baf4e0a441be146c467f320c65caa41e4195e896 100644 --- a/sys/net/gnrc/netif2/gnrc_netif2.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -28,8 +28,8 @@ #include "log.h" #include "sched.h" -#include "net/gnrc/netif2.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif.h" +#include "net/gnrc/netif/internal.h" #define ENABLE_DEBUG (0) #include "debug.h" @@ -40,17 +40,17 @@ static char addr_str[IPV6_ADDR_MAX_STR_LEN]; #define _NETIF_NETAPI_MSG_QUEUE_SIZE (8) -static gnrc_netif2_t _netifs[GNRC_NETIF_NUMOF]; +static gnrc_netif_t _netifs[GNRC_NETIF_NUMOF]; -static void _update_l2addr_from_dev(gnrc_netif2_t *netif); -static void *_gnrc_netif2_thread(void *args); +static void _update_l2addr_from_dev(gnrc_netif_t *netif); +static void *_gnrc_netif_thread(void *args); static void _event_cb(netdev_t *dev, netdev_event_t event); -gnrc_netif2_t *gnrc_netif2_create(char *stack, int stacksize, char priority, - const char *name, netdev_t *netdev, - const gnrc_netif2_ops_t *ops) +gnrc_netif_t *gnrc_netif_create(char *stack, int stacksize, char priority, + const char *name, netdev_t *netdev, + const gnrc_netif_ops_t *ops) { - gnrc_netif2_t *netif = NULL; + gnrc_netif_t *netif = NULL; int res; for (int i = 0; i < GNRC_NETIF_NUMOF; i++) { @@ -67,18 +67,18 @@ gnrc_netif2_t *gnrc_netif2_create(char *stack, int stacksize, char priority, assert(netif->dev == NULL); netif->dev = netdev; res = thread_create(stack, stacksize, priority, THREAD_CREATE_STACKTEST, - _gnrc_netif2_thread, (void *)netif, name); + _gnrc_netif_thread, (void *)netif, name); (void)res; assert(res > 0); return netif; } -unsigned gnrc_netif2_numof(void) +unsigned gnrc_netif_numof(void) { - gnrc_netif2_t *netif = NULL; + gnrc_netif_t *netif = NULL; unsigned res = 0; - while ((netif = gnrc_netif2_iter(netif))) { + while ((netif = gnrc_netif_iter(netif))) { if (netif->ops != NULL) { res++; } @@ -86,24 +86,24 @@ unsigned gnrc_netif2_numof(void) return res; } -gnrc_netif2_t *gnrc_netif2_iter(const gnrc_netif2_t *prev) +gnrc_netif_t *gnrc_netif_iter(const gnrc_netif_t *prev) { assert((prev == NULL) || (prev >= _netifs)); - for (const gnrc_netif2_t *netif = (prev == NULL) ? _netifs : (prev + 1); + for (const gnrc_netif_t *netif = (prev == NULL) ? _netifs : (prev + 1); netif < (_netifs + GNRC_NETIF_NUMOF); netif++) { if (netif->ops != NULL) { /* we don't care about external modification */ - return (gnrc_netif2_t *)netif; + return (gnrc_netif_t *)netif; } } return NULL; } -int gnrc_netif2_get_from_netdev(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) +int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) { int res = -ENOTSUP; - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); switch (opt->opt) { case NETOPT_HOP_LIMIT: assert(opt->data_len == sizeof(uint8_t)); @@ -132,7 +132,7 @@ int gnrc_netif2_get_from_netdev(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) res = 0; for (unsigned i = 0; - (res < opt->data_len) && (i < GNRC_NETIF2_IPV6_ADDRS_NUMOF); + (res < opt->data_len) && (i < GNRC_NETIF_IPV6_ADDRS_NUMOF); i++, tgt++) { if (netif->ipv6.addrs_flags[i] != 0) { memcpy(tgt, &netif->ipv6.addrs[i], sizeof(ipv6_addr_t)); @@ -147,7 +147,7 @@ int gnrc_netif2_get_from_netdev(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) res = 0; for (unsigned i = 0; - (res < opt->data_len) && (i < GNRC_NETIF2_IPV6_ADDRS_NUMOF); + (res < opt->data_len) && (i < GNRC_NETIF_IPV6_ADDRS_NUMOF); i++, tgt++) { if (netif->ipv6.addrs_flags[i] != 0) { *tgt = netif->ipv6.addrs_flags[i]; @@ -162,7 +162,7 @@ int gnrc_netif2_get_from_netdev(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) res = 0; for (unsigned i = 0; - (res < opt->data_len) && (i < GNRC_NETIF2_IPV6_GROUPS_NUMOF); + (res < opt->data_len) && (i < GNRC_NETIF_IPV6_GROUPS_NUMOF); i++, tgt++) { if (!ipv6_addr_is_unspecified(&netif->ipv6.groups[i])) { memcpy(tgt, &netif->ipv6.groups[i], sizeof(ipv6_addr_t)); @@ -173,7 +173,7 @@ int gnrc_netif2_get_from_netdev(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) break; case NETOPT_IPV6_IID: assert(opt->data_len >= sizeof(eui64_t)); - if (gnrc_netif2_ipv6_get_iid(netif, opt->data) == 0) { + if (gnrc_netif_ipv6_get_iid(netif, opt->data) == 0) { res = sizeof(eui64_t); } break; @@ -188,13 +188,13 @@ int gnrc_netif2_get_from_netdev(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) #if GNRC_IPV6_NIB_CONF_ROUTER case NETOPT_IPV6_FORWARDING: assert(opt->data_len == sizeof(netopt_enable_t)); - *((netopt_enable_t *)opt->data) = (gnrc_netif2_is_rtr(netif)) ? + *((netopt_enable_t *)opt->data) = (gnrc_netif_is_rtr(netif)) ? NETOPT_ENABLE : NETOPT_DISABLE; res = sizeof(netopt_enable_t); break; case NETOPT_IPV6_SND_RTR_ADV: assert(opt->data_len == sizeof(netopt_enable_t)); - *((netopt_enable_t *)opt->data) = (gnrc_netif2_is_rtr_adv(netif)) ? + *((netopt_enable_t *)opt->data) = (gnrc_netif_is_rtr_adv(netif)) ? NETOPT_ENABLE : NETOPT_DISABLE; res = sizeof(netopt_enable_t); break; @@ -203,7 +203,7 @@ int gnrc_netif2_get_from_netdev(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) #ifdef MODULE_GNRC_SIXLOWPAN_IPHC case NETOPT_6LO_IPHC: assert(opt->data_len == sizeof(netopt_enable_t)); - *((netopt_enable_t *)opt->data) = (netif->flags & GNRC_NETIF2_FLAGS_6LO_HC) ? + *((netopt_enable_t *)opt->data) = (netif->flags & GNRC_NETIF_FLAGS_6LO_HC) ? NETOPT_ENABLE : NETOPT_DISABLE; res = sizeof(netopt_enable_t); break; @@ -214,16 +214,16 @@ int gnrc_netif2_get_from_netdev(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) if (res == -ENOTSUP) { res = netif->dev->driver->get(netif->dev, opt->opt, opt->data, opt->data_len); } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return res; } -int gnrc_netif2_set_from_netdev(gnrc_netif2_t *netif, - const gnrc_netapi_opt_t *opt) +int gnrc_netif_set_from_netdev(gnrc_netif_t *netif, + const gnrc_netapi_opt_t *opt) { int res = -ENOTSUP; - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); switch (opt->opt) { case NETOPT_HOP_LIMIT: assert(opt->data_len == sizeof(uint8_t)); @@ -235,12 +235,12 @@ int gnrc_netif2_set_from_netdev(gnrc_netif2_t *netif, assert(opt->data_len == sizeof(ipv6_addr_t)); /* always assume manually added */ uint8_t flags = ((((uint8_t)opt->context & 0xff) & - ~GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK) | - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID); + ~GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK) | + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID); uint8_t pfx_len = (uint8_t)(opt->context >> 8U); /* acquire locks a recursive mutex so we are safe calling this * public function */ - gnrc_netif2_ipv6_addr_add(netif, opt->data, pfx_len, flags); + gnrc_netif_ipv6_addr_add(netif, opt->data, pfx_len, flags); res = sizeof(ipv6_addr_t); } break; @@ -248,21 +248,21 @@ int gnrc_netif2_set_from_netdev(gnrc_netif2_t *netif, assert(opt->data_len == sizeof(ipv6_addr_t)); /* acquire locks a recursive mutex so we are safe calling this * public function */ - gnrc_netif2_ipv6_addr_remove(netif, opt->data); + gnrc_netif_ipv6_addr_remove(netif, opt->data); res = sizeof(ipv6_addr_t); break; case NETOPT_IPV6_GROUP: assert(opt->data_len == sizeof(ipv6_addr_t)); /* acquire locks a recursive mutex so we are safe calling this * public function */ - gnrc_netif2_ipv6_group_join(netif, opt->data); + gnrc_netif_ipv6_group_join(netif, opt->data); res = sizeof(ipv6_addr_t); break; case NETOPT_IPV6_GROUP_LEAVE: assert(opt->data_len == sizeof(ipv6_addr_t)); /* acquire locks a recursive mutex so we are safe calling this * public function */ - gnrc_netif2_ipv6_group_leave(netif, opt->data); + gnrc_netif_ipv6_group_leave(netif, opt->data); res = sizeof(ipv6_addr_t); break; case NETOPT_MAX_PACKET_SIZE: @@ -277,13 +277,13 @@ int gnrc_netif2_set_from_netdev(gnrc_netif2_t *netif, case NETOPT_IPV6_FORWARDING: assert(opt->data_len == sizeof(netopt_enable_t)); if (*(((netopt_enable_t *)opt->data)) == NETOPT_ENABLE) { - netif->flags |= GNRC_NETIF2_FLAGS_IPV6_FORWARDING; + netif->flags |= GNRC_NETIF_FLAGS_IPV6_FORWARDING; } else { - if (gnrc_netif2_is_rtr_adv(netif)) { + if (gnrc_netif_is_rtr_adv(netif)) { gnrc_ipv6_nib_change_rtr_adv_iface(netif, false); } - netif->flags &= ~GNRC_NETIF2_FLAGS_IPV6_FORWARDING; + netif->flags &= ~GNRC_NETIF_FLAGS_IPV6_FORWARDING; } res = sizeof(netopt_enable_t); break; @@ -299,10 +299,10 @@ int gnrc_netif2_set_from_netdev(gnrc_netif2_t *netif, case NETOPT_6LO_IPHC: assert(opt->data_len == sizeof(netopt_enable_t)); if (*(((netopt_enable_t *)opt->data)) == NETOPT_ENABLE) { - netif->flags |= GNRC_NETIF2_FLAGS_6LO_HC; + netif->flags |= GNRC_NETIF_FLAGS_6LO_HC; } else { - netif->flags &= ~GNRC_NETIF2_FLAGS_6LO_HC; + netif->flags &= ~GNRC_NETIF_FLAGS_6LO_HC; } res = sizeof(netopt_enable_t); break; @@ -326,15 +326,15 @@ int gnrc_netif2_set_from_netdev(gnrc_netif2_t *netif, } } } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return res; } -gnrc_netif2_t *gnrc_netif2_get_by_pid(kernel_pid_t pid) +gnrc_netif_t *gnrc_netif_get_by_pid(kernel_pid_t pid) { - gnrc_netif2_t *netif = NULL; + gnrc_netif_t *netif = NULL; - while ((netif = gnrc_netif2_iter(netif))) { + while ((netif = gnrc_netif_iter(netif))) { if (netif->pid == pid) { return netif; } @@ -347,7 +347,7 @@ static inline char _half_byte_to_char(uint8_t half_byte) return (half_byte < 10) ? ('0' + half_byte) : ('a' + (half_byte - 10)); } -char *gnrc_netif2_addr_to_str(const uint8_t *addr, size_t addr_len, char *out) +char *gnrc_netif_addr_to_str(const uint8_t *addr, size_t addr_len, char *out) { char *res = out; @@ -377,7 +377,7 @@ static inline int _dehex(char c, int default_) } } -size_t gnrc_netif2_addr_from_str(const char *str, uint8_t *out) +size_t gnrc_netif_addr_from_str(const char *str, uint8_t *out) { /* Walk over str from the end. */ /* Take two chars a time as one hex value (%hhx). */ @@ -428,14 +428,14 @@ size_t gnrc_netif2_addr_from_str(const char *str, uint8_t *out) return count; } -void gnrc_netif2_acquire(gnrc_netif2_t *netif) +void gnrc_netif_acquire(gnrc_netif_t *netif) { if (netif && (netif->ops)) { rmutex_lock(&netif->mutex); } } -void gnrc_netif2_release(gnrc_netif2_t *netif) +void gnrc_netif_release(gnrc_netif_t *netif) { if (netif && (netif->ops)) { rmutex_unlock(&netif->mutex); @@ -443,8 +443,8 @@ void gnrc_netif2_release(gnrc_netif2_t *netif) } #ifdef MODULE_GNRC_IPV6 -static inline bool _addr_anycast(const gnrc_netif2_t *netif, unsigned idx); -static int _addr_idx(const gnrc_netif2_t *netif, const ipv6_addr_t *addr); +static inline bool _addr_anycast(const gnrc_netif_t *netif, unsigned idx); +static int _addr_idx(const gnrc_netif_t *netif, const ipv6_addr_t *addr); /** * @brief Matches an address by prefix to an address on the interface @@ -459,7 +459,7 @@ static int _addr_idx(const gnrc_netif2_t *netif, const ipv6_addr_t *addr); * @return bits up to which the best match matches @p addr * @return 0, if no match was found */ -static unsigned _match(const gnrc_netif2_t *netif, const ipv6_addr_t *addr, +static unsigned _match(const gnrc_netif_t *netif, const ipv6_addr_t *addr, const uint8_t *filter, int *idx); /** @@ -473,7 +473,7 @@ static unsigned _match(const gnrc_netif2_t *netif, const ipv6_addr_t *addr, * see http://tools.ietf.org/html/rfc6724#section-4 */ static uint8_t _get_scope(const ipv6_addr_t *addr); -static inline unsigned _get_state(const gnrc_netif2_t *netif, unsigned idx); +static inline unsigned _get_state(const gnrc_netif_t *netif, unsigned idx); /** * @brief selects potential source address candidates @@ -493,7 +493,7 @@ static inline unsigned _get_state(const gnrc_netif2_t *netif, unsigned idx); * @pre the interface entry and its set of addresses must not be changed during * runtime of this function */ -static int _create_candidate_set(const gnrc_netif2_t *netif, +static int _create_candidate_set(const gnrc_netif_t *netif, const ipv6_addr_t *dst, bool ll_only, uint8_t *candidate_set); @@ -514,13 +514,13 @@ static int _create_candidate_set(const gnrc_netif2_t *netif, * @return The best matching candidate found on @p netif, may be NULL if none * is found. */ -static ipv6_addr_t *_src_addr_selection(gnrc_netif2_t *netif, +static ipv6_addr_t *_src_addr_selection(gnrc_netif_t *netif, const ipv6_addr_t *dst, uint8_t *candidate_set); -static int _group_idx(const gnrc_netif2_t *netif, const ipv6_addr_t *addr); +static int _group_idx(const gnrc_netif_t *netif, const ipv6_addr_t *addr); -int gnrc_netif2_ipv6_addr_add(gnrc_netif2_t *netif, const ipv6_addr_t *addr, - unsigned pfx_len, uint8_t flags) +int gnrc_netif_ipv6_addr_add(gnrc_netif_t *netif, const ipv6_addr_t *addr, + unsigned pfx_len, uint8_t flags) { unsigned idx = UINT_MAX; @@ -528,16 +528,16 @@ int gnrc_netif2_ipv6_addr_add(gnrc_netif2_t *netif, const ipv6_addr_t *addr, assert(!(ipv6_addr_is_multicast(addr) || ipv6_addr_is_unspecified(addr) || ipv6_addr_is_loopback(addr))); assert((pfx_len > 0) && (pfx_len <= 128)); - gnrc_netif2_acquire(netif); - if ((flags & GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK) == - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE) { + gnrc_netif_acquire(netif); + if ((flags & GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK) == + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE) { /* set to first retransmission */ - flags &= ~GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE; + flags &= ~GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE; flags |= 0x1; } - for (unsigned i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { if (ipv6_addr_equal(&netif->ipv6.addrs[i], addr)) { - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return i; } if ((idx == UINT_MAX) && (netif->ipv6.addrs_flags[i] == 0)) { @@ -545,13 +545,13 @@ int gnrc_netif2_ipv6_addr_add(gnrc_netif2_t *netif, const ipv6_addr_t *addr, } } if (idx == UINT_MAX) { - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return -ENOMEM; } netif->ipv6.addrs_flags[idx] = flags; memcpy(&netif->ipv6.addrs[idx], addr, sizeof(netif->ipv6.addrs[idx])); #ifdef MODULE_GNRC_IPV6_NIB - if (_get_state(netif, idx) == GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID) { + if (_get_state(netif, idx) == GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID) { void *state = NULL; gnrc_ipv6_nib_pl_t ple; bool in_pl = false; @@ -574,62 +574,63 @@ int gnrc_netif2_ipv6_addr_add(gnrc_netif2_t *netif, const ipv6_addr_t *addr, #else (void)pfx_len; #endif - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return idx; } -void gnrc_netif2_ipv6_addr_remove(gnrc_netif2_t *netif, - const ipv6_addr_t *addr) +void gnrc_netif_ipv6_addr_remove(gnrc_netif_t *netif, + const ipv6_addr_t *addr) { int idx; assert((netif != NULL) && (addr != NULL)); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); idx = _addr_idx(netif, addr); if (idx >= 0) { netif->ipv6.addrs_flags[idx] = 0; ipv6_addr_set_unspecified(&netif->ipv6.addrs[idx]); } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } -int gnrc_netif2_ipv6_addr_idx(gnrc_netif2_t *netif, - const ipv6_addr_t *addr) +int gnrc_netif_ipv6_addr_idx(gnrc_netif_t *netif, + const ipv6_addr_t *addr) { int idx; assert((netif != NULL) && (addr != NULL)); - DEBUG("gnrc_netif2: get index of %s from inteface %i\n", + DEBUG("gnrc_netif: get index of %s from inteface %i\n", ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)), netif->pid); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); idx = _addr_idx(netif, addr); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return idx; } -int gnrc_netif2_ipv6_addr_match(gnrc_netif2_t *netif, - const ipv6_addr_t *addr) +int gnrc_netif_ipv6_addr_match(gnrc_netif_t *netif, + const ipv6_addr_t *addr) { int idx; assert((netif != NULL) && (addr != NULL)); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); _match(netif, addr, NULL, &idx); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return idx; } -ipv6_addr_t *gnrc_netif2_ipv6_addr_best_src(gnrc_netif2_t *netif, - const ipv6_addr_t *dst, - bool ll_only) +ipv6_addr_t *gnrc_netif_ipv6_addr_best_src(gnrc_netif_t *netif, + const ipv6_addr_t *dst, + bool ll_only) { ipv6_addr_t *best_src = NULL; - BITFIELD(candidate_set, GNRC_NETIF2_IPV6_ADDRS_NUMOF); + + BITFIELD(candidate_set, GNRC_NETIF_IPV6_ADDRS_NUMOF); assert((netif != NULL) && (dst != NULL)); memset(candidate_set, 0, sizeof(candidate_set)); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); int first_candidate = _create_candidate_set(netif, dst, ll_only, candidate_set); if (first_candidate >= 0) { @@ -638,17 +639,17 @@ ipv6_addr_t *gnrc_netif2_ipv6_addr_best_src(gnrc_netif2_t *netif, best_src = &(netif->ipv6.addrs[first_candidate]); } } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return best_src; } -gnrc_netif2_t *gnrc_netif2_get_by_ipv6_addr(const ipv6_addr_t *addr) +gnrc_netif_t *gnrc_netif_get_by_ipv6_addr(const ipv6_addr_t *addr) { - gnrc_netif2_t *netif = NULL; + gnrc_netif_t *netif = NULL; - DEBUG("gnrc_netif2: get interface by IPv6 address %s\n", + DEBUG("gnrc_netif: get interface by IPv6 address %s\n", ipv6_addr_to_str(addr_str, addr, sizeof(addr_str))); - while ((netif = gnrc_netif2_iter(netif))) { + while ((netif = gnrc_netif_iter(netif))) { if (_addr_idx(netif, addr) >= 0) { break; } @@ -659,12 +660,12 @@ gnrc_netif2_t *gnrc_netif2_get_by_ipv6_addr(const ipv6_addr_t *addr) return netif; } -gnrc_netif2_t *gnrc_netif2_get_by_prefix(const ipv6_addr_t *prefix) +gnrc_netif_t *gnrc_netif_get_by_prefix(const ipv6_addr_t *prefix) { - gnrc_netif2_t *netif = NULL, *best_netif = NULL; + gnrc_netif_t *netif = NULL, *best_netif = NULL; unsigned best_match = 0; - while ((netif = gnrc_netif2_iter(netif))) { + while ((netif = gnrc_netif_iter(netif))) { unsigned match; int idx; @@ -677,15 +678,15 @@ gnrc_netif2_t *gnrc_netif2_get_by_prefix(const ipv6_addr_t *prefix) return best_netif; } -int gnrc_netif2_ipv6_group_join(gnrc_netif2_t *netif, - const ipv6_addr_t *addr) +int gnrc_netif_ipv6_group_join(gnrc_netif_t *netif, + const ipv6_addr_t *addr) { unsigned idx = UINT_MAX; - gnrc_netif2_acquire(netif); - for (unsigned i = 0; i < GNRC_NETIF2_IPV6_GROUPS_NUMOF; i++) { + gnrc_netif_acquire(netif); + for (unsigned i = 0; i < GNRC_NETIF_IPV6_GROUPS_NUMOF; i++) { if (ipv6_addr_equal(&netif->ipv6.groups[i], addr)) { - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return i; } if ((idx == UINT_MAX) && (ipv6_addr_is_unspecified(&netif->ipv6.groups[i]))) { @@ -693,48 +694,48 @@ int gnrc_netif2_ipv6_group_join(gnrc_netif2_t *netif, } } if (idx == UINT_MAX) { - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return -ENOMEM; } memcpy(&netif->ipv6.groups[idx], addr, sizeof(netif->ipv6.groups[idx])); /* TODO: * - MLD action */ - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return idx; } -void gnrc_netif2_ipv6_group_leave(gnrc_netif2_t *netif, - const ipv6_addr_t *addr) +void gnrc_netif_ipv6_group_leave(gnrc_netif_t *netif, + const ipv6_addr_t *addr) { int idx; assert((netif != NULL) && (addr != NULL)); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); idx = _group_idx(netif, addr); if (idx >= 0) { ipv6_addr_set_unspecified(&netif->ipv6.groups[idx]); /* TODO: * - MLD action */ } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } -int gnrc_netif2_ipv6_group_idx(gnrc_netif2_t *netif, const ipv6_addr_t *addr) +int gnrc_netif_ipv6_group_idx(gnrc_netif_t *netif, const ipv6_addr_t *addr) { int idx; assert((netif != NULL) && (addr != NULL)); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); idx = _group_idx(netif, addr); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return idx; } -int gnrc_netif2_ipv6_get_iid(gnrc_netif2_t *netif, eui64_t *eui64) +int gnrc_netif_ipv6_get_iid(gnrc_netif_t *netif, eui64_t *eui64) { -#if GNRC_NETIF2_L2ADDR_MAXLEN > 0 - if (netif->flags & GNRC_NETIF2_FLAGS_HAS_L2ADDR) { +#if GNRC_NETIF_L2ADDR_MAXLEN > 0 + if (netif->flags & GNRC_NETIF_FLAGS_HAS_L2ADDR) { switch (netif->device_type) { #ifdef MODULE_NETDEV_ETH case NETDEV_TYPE_ETHERNET: @@ -795,14 +796,14 @@ int gnrc_netif2_ipv6_get_iid(gnrc_netif2_t *netif, eui64_t *eui64) return -ENOTSUP; } -static inline bool _addr_anycast(const gnrc_netif2_t *netif, unsigned idx) +static inline bool _addr_anycast(const gnrc_netif_t *netif, unsigned idx) { - return (netif->ipv6.addrs_flags[idx] & GNRC_NETIF2_IPV6_ADDRS_FLAGS_ANYCAST); + return (netif->ipv6.addrs_flags[idx] & GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST); } -static int _addr_idx(const gnrc_netif2_t *netif, const ipv6_addr_t *addr) +static int _addr_idx(const gnrc_netif_t *netif, const ipv6_addr_t *addr) { - for (unsigned i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { if (ipv6_addr_equal(&netif->ipv6.addrs[i], addr)) { return i; } @@ -810,14 +811,14 @@ static int _addr_idx(const gnrc_netif2_t *netif, const ipv6_addr_t *addr) return -1; } -static unsigned _match(const gnrc_netif2_t *netif, const ipv6_addr_t *addr, +static unsigned _match(const gnrc_netif_t *netif, const ipv6_addr_t *addr, const uint8_t *filter, int *idx) { unsigned best_match = 0; assert(idx != NULL); *idx = -1; - for (int i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { unsigned match; if ((netif->ipv6.addrs_flags[i] == 0) || @@ -837,7 +838,7 @@ static unsigned _match(const gnrc_netif2_t *netif, const ipv6_addr_t *addr, } #if ENABLE_DEBUG if (*idx >= 0) { - DEBUG("gnrc_netif2: Found %s on interface %" PRIkernel_pid " matching ", + DEBUG("gnrc_netif: Found %s on interface %" PRIkernel_pid " matching ", ipv6_addr_to_str(addr_str, &netif->ipv6.addrs[*idx], sizeof(addr_str)), netif->pid); @@ -847,7 +848,7 @@ static unsigned _match(const gnrc_netif2_t *netif, const ipv6_addr_t *addr, (filter != NULL) ? "true" : "false"); } else { - DEBUG("gnrc_netif2: Did not found any address on interface %" PRIkernel_pid + DEBUG("gnrc_netif: Did not found any address on interface %" PRIkernel_pid " matching %s (used as source address = %s)\n", netif->pid, ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)), @@ -870,10 +871,10 @@ static uint8_t _get_scope(const ipv6_addr_t *addr) } } -static inline unsigned _get_state(const gnrc_netif2_t *netif, unsigned idx) +static inline unsigned _get_state(const gnrc_netif_t *netif, unsigned idx) { return (netif->ipv6.addrs_flags[idx] & - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK); + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK); } /** @@ -894,7 +895,7 @@ static inline unsigned _get_state(const gnrc_netif2_t *netif, unsigned idx) * @pre the interface entry and its set of addresses must not be changed during * runtime of this function */ -static int _create_candidate_set(const gnrc_netif2_t *netif, +static int _create_candidate_set(const gnrc_netif_t *netif, const ipv6_addr_t *dst, bool ll_only, uint8_t *candidate_set) { @@ -905,7 +906,7 @@ static int _create_candidate_set(const gnrc_netif2_t *netif, * candidates assigned to this interface. Thus we assume all addresses to be * on interface @p netif */ (void) dst; - for (int i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { const ipv6_addr_t *tmp = &(netif->ipv6.addrs[i]); DEBUG("Checking address: %s\n", @@ -914,8 +915,8 @@ static int _create_candidate_set(const gnrc_netif2_t *netif, * be included in a candidate set." */ if ((netif->ipv6.addrs_flags[i] == 0) || - (gnrc_netif2_ipv6_addr_get_state(netif, i) == - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE)) { + (gnrc_netif_ipv6_addr_get_state(netif, i) == + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE)) { continue; } /* Check if we only want link local addresses */ @@ -951,23 +952,23 @@ static int _create_candidate_set(const gnrc_netif2_t *netif, /* number of "points" assigned to an source address candidate in preferred state */ #define RULE_3_PTS (1) -static ipv6_addr_t *_src_addr_selection(gnrc_netif2_t *netif, +static ipv6_addr_t *_src_addr_selection(gnrc_netif_t *netif, const ipv6_addr_t *dst, uint8_t *candidate_set) { /* create temporary set for assigning "points" to candidates winning in the * corresponding rules. */ - uint8_t winner_set[GNRC_NETIF2_IPV6_ADDRS_NUMOF]; + uint8_t winner_set[GNRC_NETIF_IPV6_ADDRS_NUMOF]; - memset(winner_set, 0, GNRC_NETIF2_IPV6_ADDRS_NUMOF); + memset(winner_set, 0, GNRC_NETIF_IPV6_ADDRS_NUMOF); uint8_t max_pts = 0; /* _create_candidate_set() assures that `dst` is not unspecified and if * `dst` is loopback rule 1 will fire anyway. */ uint8_t dst_scope = _get_scope(dst); DEBUG("finding the best match within the source address candidates\n"); - for (unsigned i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { ipv6_addr_t *ptr = &(netif->ipv6.addrs[i]); DEBUG("Checking address: %s\n", @@ -1001,7 +1002,7 @@ static ipv6_addr_t *_src_addr_selection(gnrc_netif2_t *netif, } } /* Rule 3: Avoid deprecated addresses. */ - if (_get_state(netif, i) == GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_DEPRECATED) { + if (_get_state(netif, i) == GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_DEPRECATED) { DEBUG("winner for rule 3 found\n"); winner_set[i] += RULE_3_PTS; if (winner_set[i] > max_pts) { @@ -1037,10 +1038,10 @@ static ipv6_addr_t *_src_addr_selection(gnrc_netif2_t *netif, */ } /* reset candidate set to mark winners */ - memset(candidate_set, 0, (GNRC_NETIF2_IPV6_ADDRS_NUMOF + 7) / 8); + memset(candidate_set, 0, (GNRC_NETIF_IPV6_ADDRS_NUMOF + 7) / 8); /* check if we have a clear winner */ /* collect candidates with maximum points */ - for (int i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { if (winner_set[i] == max_pts) { bf_set(candidate_set, i); } @@ -1051,9 +1052,9 @@ static ipv6_addr_t *_src_addr_selection(gnrc_netif2_t *netif, return (res < 0) ? NULL : &netif->ipv6.addrs[res]; } -static int _group_idx(const gnrc_netif2_t *netif, const ipv6_addr_t *addr) +static int _group_idx(const gnrc_netif_t *netif, const ipv6_addr_t *addr) { - for (unsigned i = 0; i < GNRC_NETIF2_IPV6_GROUPS_NUMOF; i++) { + for (unsigned i = 0; i < GNRC_NETIF_IPV6_GROUPS_NUMOF; i++) { if (ipv6_addr_equal(&netif->ipv6.groups[i], addr)) { return i; } @@ -1062,7 +1063,7 @@ static int _group_idx(const gnrc_netif2_t *netif, const ipv6_addr_t *addr) } #endif /* MODULE_GNRC_IPV6 */ -bool gnrc_netif2_is_6ln(const gnrc_netif2_t *netif) +bool gnrc_netif_is_6ln(const gnrc_netif_t *netif) { switch (netif->device_type) { case NETDEV_TYPE_IEEE802154: @@ -1074,7 +1075,7 @@ bool gnrc_netif2_is_6ln(const gnrc_netif2_t *netif) } } -static void _update_l2addr_from_dev(gnrc_netif2_t *netif) +static void _update_l2addr_from_dev(gnrc_netif_t *netif) { netdev_t *dev = netif->dev; int res; @@ -1100,14 +1101,14 @@ static void _update_l2addr_from_dev(gnrc_netif2_t *netif) res = dev->driver->get(dev, opt, netif->l2addr, sizeof(netif->l2addr)); if (res != -ENOTSUP) { - netif->flags |= GNRC_NETIF2_FLAGS_HAS_L2ADDR; + netif->flags |= GNRC_NETIF_FLAGS_HAS_L2ADDR; } if (res > 0) { netif->l2addr_len = res; } } -static void _init_from_device(gnrc_netif2_t *netif) +static void _init_from_device(gnrc_netif_t *netif) { int res; netdev_t *dev = netif->dev; @@ -1121,7 +1122,7 @@ static void _init_from_device(gnrc_netif2_t *netif) #ifdef MODULE_NETDEV_IEEE802154 case NETDEV_TYPE_IEEE802154: #ifdef MODULE_GNRC_SIXLOWPAN_IPHC - netif->flags |= GNRC_NETIF2_FLAGS_6LO_HC; + netif->flags |= GNRC_NETIF_FLAGS_6LO_HC; #endif #ifdef MODULE_GNRC_IPV6 res = dev->driver->get(dev, NETOPT_MAX_PACKET_SIZE, &tmp, sizeof(tmp)); @@ -1158,18 +1159,18 @@ static void _init_from_device(gnrc_netif2_t *netif) _update_l2addr_from_dev(netif); } -static void *_gnrc_netif2_thread(void *args) +static void *_gnrc_netif_thread(void *args) { gnrc_netapi_opt_t *opt; - gnrc_netif2_t *netif; + gnrc_netif_t *netif; netdev_t *dev; int res; msg_t reply = { .type = GNRC_NETAPI_MSG_TYPE_ACK }; msg_t msg, msg_queue[_NETIF_NETAPI_MSG_QUEUE_SIZE]; - DEBUG("gnrc_netif2: starting thread %i\n", sched_active_pid); + DEBUG("gnrc_netif: starting thread %i\n", sched_active_pid); netif = args; - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); dev = netif->dev; netif->pid = sched_active_pid; /* setup the link-layer's message queue */ @@ -1180,7 +1181,7 @@ static void *_gnrc_netif2_thread(void *args) /* initialize low-level driver */ dev->driver->init(dev); _init_from_device(netif); - netif->cur_hl = GNRC_NETIF2_DEFAULT_HL; + netif->cur_hl = GNRC_NETIF_DEFAULT_HL; #ifdef MODULE_GNRC_IPV6_NIB gnrc_ipv6_nib_init_iface(netif); #endif @@ -1188,23 +1189,23 @@ static void *_gnrc_netif2_thread(void *args) netif->ops->init(netif); } /* now let rest of GNRC use the interface */ - gnrc_netif2_release(netif); + gnrc_netif_release(netif); while (1) { - DEBUG("gnrc_netif2: waiting for incoming messages\n"); + DEBUG("gnrc_netif: waiting for incoming messages\n"); msg_receive(&msg); /* dispatch netdev, MAC and gnrc_netapi messages */ switch (msg.type) { case NETDEV_MSG_TYPE_EVENT: - DEBUG("gnrc_netif2: GNRC_NETDEV_MSG_TYPE_EVENT received\n"); + DEBUG("gnrc_netif: GNRC_NETDEV_MSG_TYPE_EVENT received\n"); dev->driver->isr(dev); break; case GNRC_NETAPI_MSG_TYPE_SND: - DEBUG("gnrc_netif2: GNRC_NETDEV_MSG_TYPE_SND received\n"); + DEBUG("gnrc_netif: GNRC_NETDEV_MSG_TYPE_SND received\n"); res = netif->ops->send(netif, msg.content.ptr); #if ENABLE_DEBUG if (res < 0) { - DEBUG("gnrc_netif2: error sending packet %p (code: %u)\n", + DEBUG("gnrc_netif: error sending packet %p (code: %u)\n", msg.content.ptr, res); } #endif @@ -1212,42 +1213,42 @@ static void *_gnrc_netif2_thread(void *args) case GNRC_NETAPI_MSG_TYPE_SET: opt = msg.content.ptr; #ifdef MODULE_NETOPT - DEBUG("gnrc_netif2: GNRC_NETAPI_MSG_TYPE_SET received. opt=%s\n", + DEBUG("gnrc_netif: GNRC_NETAPI_MSG_TYPE_SET received. opt=%s\n", netopt2str(opt->opt)); #else - DEBUG("gnrc_netif2: GNRC_NETAPI_MSG_TYPE_SET received. opt=%s\n", + DEBUG("gnrc_netif: GNRC_NETAPI_MSG_TYPE_SET received. opt=%s\n", opt->opt); #endif /* set option for device driver */ res = netif->ops->set(netif, opt); - DEBUG("gnrc_netif2: response of netif->ops->set(): %i\n", res); + DEBUG("gnrc_netif: response of netif->ops->set(): %i\n", res); reply.content.value = (uint32_t)res; msg_reply(&msg, &reply); break; case GNRC_NETAPI_MSG_TYPE_GET: opt = msg.content.ptr; #ifdef MODULE_NETOPT - DEBUG("gnrc_netif2: GNRC_NETAPI_MSG_TYPE_GET received. opt=%s\n", + DEBUG("gnrc_netif: GNRC_NETAPI_MSG_TYPE_GET received. opt=%s\n", netopt2str(opt->opt)); #else - DEBUG("gnrc_netif2: GNRC_NETAPI_MSG_TYPE_GET received. opt=%s\n", + DEBUG("gnrc_netif: GNRC_NETAPI_MSG_TYPE_GET received. opt=%s\n", opt->opt); #endif /* get option from device driver */ res = netif->ops->get(netif, opt); - DEBUG("gnrc_netif2: response of netif->ops->get(): %i\n", res); + DEBUG("gnrc_netif: response of netif->ops->get(): %i\n", res); reply.content.value = (uint32_t)res; msg_reply(&msg, &reply); break; default: if (netif->ops->msg_handler) { - DEBUG("gnrc_netif2: delegate message of type 0x%04x to " + DEBUG("gnrc_netif: delegate message of type 0x%04x to " "netif->ops->msg_handler()\n", msg.type); netif->ops->msg_handler(netif, &msg); } #if ENABLE_DEBUG else { - DEBUG("gnrc_netif2: unknown message type 0x%04x" + DEBUG("gnrc_netif: unknown message type 0x%04x" "(no message handler defined)\n", msg.type); } #endif @@ -1262,7 +1263,7 @@ static void _pass_on_packet(gnrc_pktsnip_t *pkt) { /* throw away packet if no one is interested */ if (!gnrc_netapi_dispatch_receive(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL, pkt)) { - DEBUG("gnrc_netif2: unable to forward packet of type %i\n", pkt->type); + DEBUG("gnrc_netif: unable to forward packet of type %i\n", pkt->type); gnrc_pktbuf_release(pkt); return; } @@ -1270,18 +1271,18 @@ static void _pass_on_packet(gnrc_pktsnip_t *pkt) static void _event_cb(netdev_t *dev, netdev_event_t event) { - gnrc_netif2_t *netif = (gnrc_netif2_t *) dev->context; + gnrc_netif_t *netif = (gnrc_netif_t *) dev->context; if (event == NETDEV_EVENT_ISR) { msg_t msg = { .type = NETDEV_MSG_TYPE_EVENT, .content = { .ptr = netif } }; if (msg_send(&msg, netif->pid) <= 0) { - puts("gnrc_netif2: possibly lost interrupt."); + puts("gnrc_netif: possibly lost interrupt."); } } else { - DEBUG("gnrc_netif2: event triggered -> %i\n", event); + DEBUG("gnrc_netif: event triggered -> %i\n", event); switch (event) { case NETDEV_EVENT_RX_COMPLETE: { gnrc_pktsnip_t *pkt = netif->ops->recv(netif); @@ -1304,7 +1305,7 @@ static void _event_cb(netdev_t *dev, netdev_event_t event) break; #endif default: - DEBUG("gnrc_netif2: warning: unhandled event %u.\n", event); + DEBUG("gnrc_netif: warning: unhandled event %u.\n", event); } } } diff --git a/sys/net/gnrc/netif2/gnrc_netif2_ethernet.c b/sys/net/gnrc/netif/gnrc_netif_ethernet.c similarity index 79% rename from sys/net/gnrc/netif2/gnrc_netif2_ethernet.c rename to sys/net/gnrc/netif/gnrc_netif_ethernet.c index 70152ea23aa52e5deb87a7a6d8fbea14377e74ce..c05346827a5188fb36fcca905ac29880d22abf08 100644 --- a/sys/net/gnrc/netif2/gnrc_netif2_ethernet.c +++ b/sys/net/gnrc/netif/gnrc_netif_ethernet.c @@ -18,7 +18,7 @@ #ifdef MODULE_NETDEV_ETH #include "net/ethernet/hdr.h" #include "net/gnrc.h" -#include "net/gnrc/netif2/ethernet.h" +#include "net/gnrc/netif/ethernet.h" #ifdef MODULE_GNRC_IPV6 #include "net/ipv6/hdr.h" #endif @@ -26,22 +26,22 @@ #define ENABLE_DEBUG (0) #include "debug.h" -static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt); -static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif); +static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt); +static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif); -static const gnrc_netif2_ops_t ethernet_ops = { +static const gnrc_netif_ops_t ethernet_ops = { .send = _send, .recv = _recv, - .get = gnrc_netif2_get_from_netdev, - .set = gnrc_netif2_set_from_netdev, + .get = gnrc_netif_get_from_netdev, + .set = gnrc_netif_set_from_netdev, }; -gnrc_netif2_t *gnrc_netif2_ethernet_create(char *stack, int stacksize, - char priority, char *name, - netdev_t *dev) +gnrc_netif_t *gnrc_netif_ethernet_create(char *stack, int stacksize, + char priority, char *name, + netdev_t *dev) { - return gnrc_netif2_create(stack, stacksize, priority, name, dev, - ðernet_ops); + return gnrc_netif_create(stack, stacksize, priority, name, dev, + ðernet_ops); } static inline void _addr_set_broadcast(uint8_t *dst) @@ -67,7 +67,7 @@ static inline void _addr_set_multicast(uint8_t *dst, gnrc_pktsnip_t *payload) } } -static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { ethernet_hdr_t hdr; gnrc_netif_hdr_t *netif_hdr; @@ -77,14 +77,14 @@ static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) netdev_t *dev = netif->dev; if (pkt == NULL) { - DEBUG("gnrc_netif2_ethernet: pkt was NULL\n"); + DEBUG("gnrc_netif_ethernet: pkt was NULL\n"); return -EINVAL; } payload = pkt->next; if (pkt->type != GNRC_NETTYPE_NETIF) { - DEBUG("gnrc_netif2_ethernet: First header was not generic netif header\n"); + DEBUG("gnrc_netif_ethernet: First header was not generic netif header\n"); return -EBADMSG; } @@ -111,7 +111,7 @@ static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) } else if (netif_hdr->flags & GNRC_NETIF_HDR_FLAGS_MULTICAST) { if (payload == NULL) { - DEBUG("gnrc_netif2_ethernet: empty multicast packets over Ethernet " + DEBUG("gnrc_netif_ethernet: empty multicast packets over Ethernet " "are not yet supported\n"); return -ENOTSUP; } @@ -122,12 +122,12 @@ static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) ETHERNET_ADDR_LEN); } else { - DEBUG("gnrc_netif2_ethernet: destination address had unexpected " + DEBUG("gnrc_netif_ethernet: destination address had unexpected " "format\n"); return -EBADMSG; } - DEBUG("gnrc_netif2_ethernet: send to %02x:%02x:%02x:%02x:%02x:%02x\n", + DEBUG("gnrc_netif_ethernet: send to %02x:%02x:%02x:%02x:%02x:%02x\n", hdr.dst[0], hdr.dst[1], hdr.dst[2], hdr.dst[3], hdr.dst[4], hdr.dst[5]); @@ -157,7 +157,7 @@ static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) return res; } -static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) +static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif) { netdev_t *dev = netif->dev; int bytes_expected = dev->driver->recv(dev, NULL, 0, NULL); @@ -169,7 +169,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) GNRC_NETTYPE_UNDEF); if (!pkt) { - DEBUG("gnrc_netif2_ethernet: cannot allocate pktsnip.\n"); + DEBUG("gnrc_netif_ethernet: cannot allocate pktsnip.\n"); /* drop the packet */ dev->driver->recv(dev, NULL, bytes_expected, NULL); @@ -179,7 +179,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) int nread = dev->driver->recv(dev, pkt->data, bytes_expected, NULL); if (nread <= 0) { - DEBUG("gnrc_netif2_ethernet: read error.\n"); + DEBUG("gnrc_netif_ethernet: read error.\n"); goto safe_out; } @@ -187,14 +187,14 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) /* we've got less than the expected packet size, * so free the unused space.*/ - DEBUG("gnrc_netif2_ethernet: reallocating.\n"); + DEBUG("gnrc_netif_ethernet: reallocating.\n"); gnrc_pktbuf_realloc_data(pkt, nread); } /* mark ethernet header */ gnrc_pktsnip_t *eth_hdr = gnrc_pktbuf_mark(pkt, sizeof(ethernet_hdr_t), GNRC_NETTYPE_UNDEF); if (!eth_hdr) { - DEBUG("gnrc_netif2_ethernet: no space left in packet buffer\n"); + DEBUG("gnrc_netif_ethernet: no space left in packet buffer\n"); goto safe_out; } @@ -202,7 +202,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) #ifdef MODULE_L2FILTER if (!l2filter_pass(dev->filter, hdr->src, ETHERNET_ADDR_LEN)) { - DEBUG("gnrc_netif2_ethernet: incoming packet filtered by l2filter\n"); + DEBUG("gnrc_netif_ethernet: incoming packet filtered by l2filter\n"); goto safe_out; } #endif @@ -217,7 +217,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) GNRC_NETTYPE_NETIF); if (netif_hdr == NULL) { - DEBUG("gnrc_netif2_ethernet: no space left in packet buffer\n"); + DEBUG("gnrc_netif_ethernet: no space left in packet buffer\n"); pkt = eth_hdr; goto safe_out; } @@ -227,7 +227,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) gnrc_netif_hdr_set_dst_addr(netif_hdr->data, hdr->dst, ETHERNET_ADDR_LEN); ((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = thread_getpid(); - DEBUG("gnrc_netif2_ethernet: received packet from %02x:%02x:%02x:%02x:%02x:%02x " + DEBUG("gnrc_netif_ethernet: received packet from %02x:%02x:%02x:%02x:%02x:%02x " "of length %d\n", hdr->src[0], hdr->src[1], hdr->src[2], hdr->src[3], hdr->src[4], hdr->src[5], nread); diff --git a/sys/net/gnrc/netif2/gnrc_netif2_ieee802154.c b/sys/net/gnrc/netif/gnrc_netif_ieee802154.c similarity index 89% rename from sys/net/gnrc/netif2/gnrc_netif2_ieee802154.c rename to sys/net/gnrc/netif/gnrc_netif_ieee802154.c index 6ffeb71658f519701195f71827529da08faa37df..86adc6d50142b747b117d4080974dd8c37d0d812 100644 --- a/sys/net/gnrc/netif2/gnrc_netif2_ieee802154.c +++ b/sys/net/gnrc/netif/gnrc_netif_ieee802154.c @@ -14,7 +14,7 @@ */ #include "net/gnrc.h" -#include "net/gnrc/netif2/ieee802154.h" +#include "net/gnrc/netif/ieee802154.h" #include "net/netdev/ieee802154.h" #ifdef MODULE_GNRC_IPV6 @@ -25,22 +25,22 @@ #include "debug.h" #ifdef MODULE_NETDEV_IEEE802154 -static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt); -static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif); +static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt); +static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif); -static const gnrc_netif2_ops_t ieee802154_ops = { +static const gnrc_netif_ops_t ieee802154_ops = { .send = _send, .recv = _recv, - .get = gnrc_netif2_get_from_netdev, - .set = gnrc_netif2_set_from_netdev, + .get = gnrc_netif_get_from_netdev, + .set = gnrc_netif_set_from_netdev, }; -gnrc_netif2_t *gnrc_netif2_ieee802154_create(char *stack, int stacksize, - char priority, char *name, - netdev_t *dev) +gnrc_netif_t *gnrc_netif_ieee802154_create(char *stack, int stacksize, + char priority, char *name, + netdev_t *dev) { - return gnrc_netif2_create(stack, stacksize, priority, name, dev, - &ieee802154_ops); + return gnrc_netif_create(stack, stacksize, priority, name, dev, + &ieee802154_ops); } static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr) @@ -70,7 +70,7 @@ static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr) return snip; } -static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) +static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif) { netdev_t *dev = netif->dev; netdev_ieee802154_rx_info_t rx_info; @@ -156,7 +156,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) return pkt; } -static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { netdev_t *dev = netif->dev; netdev_ieee802154_t *state = (netdev_ieee802154_t *)netif->dev; @@ -214,8 +214,8 @@ static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) vector[0].iov_base = mhr; vector[0].iov_len = (size_t)res; #ifdef MODULE_NETSTATS_L2 - if (netif_hdr->flags & - (GNRC_NETIF_HDR_FLAGS_BROADCAST | GNRC_NETIF_HDR_FLAGS_MULTICAST)) { + if (netif_hdr->flags & + (GNRC_NETIF_HDR_FLAGS_BROADCAST | GNRC_NETIF_HDR_FLAGS_MULTICAST)) { netif->dev->stats.tx_mcast_count++; } else { @@ -223,7 +223,7 @@ static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) } #endif #ifdef MODULE_GNRC_MAC - if (netif->mac.mac_info & GNRC_NETIF2_MAC_INFO_CSMA_ENABLED) { + if (netif->mac.mac_info & GNRC_NETIF_MAC_INFO_CSMA_ENABLED) { res = csma_sender_csma_ca_send(dev, vector, n, &netif->mac.csma_conf); } else { diff --git a/sys/net/gnrc/netif2/gnrc_netif2_raw.c b/sys/net/gnrc/netif/gnrc_netif_raw.c similarity index 78% rename from sys/net/gnrc/netif2/gnrc_netif2_raw.c rename to sys/net/gnrc/netif/gnrc_netif_raw.c index e7e9f2080f1ad46e3fc90debdb2ccdfe7620cfbb..30d3f4a984bdeaa3128cf7bb788d74b0284dffa9 100644 --- a/sys/net/gnrc/netif2/gnrc_netif2_raw.c +++ b/sys/net/gnrc/netif/gnrc_netif_raw.c @@ -14,7 +14,7 @@ */ #include "net/gnrc/pktbuf.h" -#include "net/gnrc/netif2/raw.h" +#include "net/gnrc/netif/raw.h" #define ENABLE_DEBUG (0) #include "debug.h" @@ -24,22 +24,22 @@ #define IP_VERSION6 (0x60U) -static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt); -static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif); +static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt); +static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif); -static const gnrc_netif2_ops_t raw_ops = { +static const gnrc_netif_ops_t raw_ops = { .send = _send, .recv = _recv, - .get = gnrc_netif2_get_from_netdev, - .set = gnrc_netif2_set_from_netdev, + .get = gnrc_netif_get_from_netdev, + .set = gnrc_netif_set_from_netdev, }; -gnrc_netif2_t *gnrc_netif2_raw_create(char *stack, int stacksize, - char priority, char *name, - netdev_t *dev) +gnrc_netif_t *gnrc_netif_raw_create(char *stack, int stacksize, + char priority, char *name, + netdev_t *dev) { - return gnrc_netif2_create(stack, stacksize, priority, name, dev, - &raw_ops); + return gnrc_netif_create(stack, stacksize, priority, name, dev, + &raw_ops); } static inline uint8_t _get_version(uint8_t *data) @@ -47,7 +47,7 @@ static inline uint8_t _get_version(uint8_t *data) return (data[0] & IP_VERSION_MASK); } -static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) +static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif) { netdev_t *dev = netif->dev; int bytes_expected = dev->driver->recv(dev, NULL, 0, NULL); @@ -90,7 +90,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif2_t *netif) return pkt; } -static int _send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { gnrc_pktsnip_t *vector; int res = -ENOBUFS; diff --git a/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c b/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c index fc3bc81316b9dbca940ee8b5d936dbead0e5c6bc..06fd418ce89e757dff110a4b3eb23cc90870309d 100644 --- a/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c +++ b/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c @@ -15,7 +15,7 @@ #include <stdio.h> #include <inttypes.h> -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/netif/hdr.h" void gnrc_netif_hdr_print(gnrc_netif_hdr_t *hdr) @@ -44,8 +44,8 @@ void gnrc_netif_hdr_print(gnrc_netif_hdr_t *hdr) if (hdr->src_l2addr_len > 0) { printf("src_l2addr: %s\n", - gnrc_netif2_addr_to_str(gnrc_netif_hdr_get_src_addr(hdr), - hdr->src_l2addr_len, addr_str)); + gnrc_netif_addr_to_str(gnrc_netif_hdr_get_src_addr(hdr), + hdr->src_l2addr_len, addr_str)); } else { puts("src_l2addr: (nil)"); @@ -53,8 +53,8 @@ void gnrc_netif_hdr_print(gnrc_netif_hdr_t *hdr) if (hdr->dst_l2addr_len > 0) { printf("dst_l2addr: %s\n", - gnrc_netif2_addr_to_str(gnrc_netif_hdr_get_dst_addr(hdr), - hdr->dst_l2addr_len, addr_str)); + gnrc_netif_addr_to_str(gnrc_netif_hdr_get_dst_addr(hdr), + hdr->dst_l2addr_len, addr_str)); } else { puts("dst_l2addr: (nil)"); diff --git a/sys/net/gnrc/network_layer/icmpv6/gnrc_icmpv6.c b/sys/net/gnrc/network_layer/icmpv6/gnrc_icmpv6.c index b7ab3a3ae5477eba974f8f0c25469d1f86b72a5e..9679956b857cabeeda5be36a0590c363b774bc81 100644 --- a/sys/net/gnrc/network_layer/icmpv6/gnrc_icmpv6.c +++ b/sys/net/gnrc/network_layer/icmpv6/gnrc_icmpv6.c @@ -101,7 +101,7 @@ void gnrc_icmpv6_demux(kernel_pid_t iface, gnrc_pktsnip_t *pkt) case ICMPV6_DAR: case ICMPV6_DAC: DEBUG("icmpv6: NDP message received. Handle with gnrc_ipv6_nib\n"); - gnrc_ipv6_nib_handle_pkt(gnrc_netif2_get_by_pid(iface), + gnrc_ipv6_nib_handle_pkt(gnrc_netif_get_by_pid(iface), ipv6->data, hdr, icmpv6->size); break; diff --git a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c index c612768753c7eec59e7821d8bf85dede2ba10742..25350012d98a6c9e65f2cf0ce4e1f76b19fb2f2f 100644 --- a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c +++ b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c @@ -28,7 +28,7 @@ #include "utlist.h" #include "net/gnrc/ipv6/nib.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc/ipv6/whitelist.h" #include "net/gnrc/ipv6/blacklist.h" @@ -309,7 +309,7 @@ static void *_event_loop(void *args) return NULL; } -static void _send_to_iface(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static void _send_to_iface(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { assert(netif != NULL); ((gnrc_netif_hdr_t *)pkt->data)->if_pid = netif->pid; @@ -324,7 +324,7 @@ static void _send_to_iface(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) #endif #ifdef MODULE_GNRC_SIXLOWPAN - if (gnrc_netif2_is_6ln(netif)) { + if (gnrc_netif_is_6ln(netif)) { DEBUG("ipv6: send to 6LoWPAN instead\n"); if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_SIXLOWPAN, GNRC_NETREG_DEMUX_CTX_ALL, pkt)) { DEBUG("ipv6: no 6LoWPAN thread found\n"); @@ -373,7 +373,7 @@ static gnrc_pktsnip_t *_create_netif_hdr(uint8_t *dst_l2addr, } /* functions for sending */ -static void _send_unicast(gnrc_netif2_t *netif, uint8_t *dst_l2addr, +static void _send_unicast(gnrc_netif_t *netif, uint8_t *dst_l2addr, uint16_t dst_l2addr_len, gnrc_pktsnip_t *pkt) { DEBUG("ipv6: add interface header to packet\n"); @@ -388,7 +388,7 @@ static void _send_unicast(gnrc_netif2_t *netif, uint8_t *dst_l2addr, _send_to_iface(netif, pkt); } -static int _fill_ipv6_hdr(gnrc_netif2_t *netif, gnrc_pktsnip_t *ipv6, +static int _fill_ipv6_hdr(gnrc_netif_t *netif, gnrc_pktsnip_t *ipv6, gnrc_pktsnip_t *payload) { int res; @@ -412,7 +412,7 @@ static int _fill_ipv6_hdr(gnrc_netif2_t *netif, gnrc_pktsnip_t *ipv6, if (hdr->hl == 0) { if (netif == NULL) { - hdr->hl = GNRC_NETIF2_DEFAULT_HL; + hdr->hl = GNRC_NETIF_DEFAULT_HL; } else { hdr->hl = netif->cur_hl; @@ -424,8 +424,8 @@ static int _fill_ipv6_hdr(gnrc_netif2_t *netif, gnrc_pktsnip_t *ipv6, ipv6_addr_set_loopback(&hdr->src); } else { - ipv6_addr_t *src = gnrc_netif2_ipv6_addr_best_src(netif, &hdr->dst, - false); + ipv6_addr_t *src = gnrc_netif_ipv6_addr_best_src(netif, &hdr->dst, + false); if (src != NULL) { DEBUG("ipv6: set packet source to %s\n", @@ -448,7 +448,7 @@ static int _fill_ipv6_hdr(gnrc_netif2_t *netif, gnrc_pktsnip_t *ipv6, return 0; } -static inline void _send_multicast_over_iface(gnrc_netif2_t *netif, +static inline void _send_multicast_over_iface(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { DEBUG("ipv6: send multicast over interface %" PRIkernel_pid "\n", netif->pid); @@ -461,14 +461,14 @@ static inline void _send_multicast_over_iface(gnrc_netif2_t *netif, _send_to_iface(netif, pkt); } -static void _send_multicast(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt, +static void _send_multicast(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_pktsnip_t *ipv6, gnrc_pktsnip_t *payload, bool prep_hdr) { size_t ifnum = 0; if (netif == NULL) { - ifnum = gnrc_netif2_numof(); + ifnum = gnrc_netif_numof(); /* throw away packet if no one is interested */ if (ifnum == 0) { DEBUG("ipv6: no interfaces registered, dropping packet\n"); @@ -484,7 +484,7 @@ static void _send_multicast(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt, /* send packet to link layer */ gnrc_pktbuf_hold(pkt, ifnum - 1); - while ((netif = gnrc_netif2_iter(netif))) { + while ((netif = gnrc_netif_iter(netif))) { if (prep_hdr) { /* need to get second write access (duplication) to fill IPv6 * header interface-local */ @@ -541,7 +541,7 @@ static void _send_multicast(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt, #else /* GNRC_NETIF_NUMOF */ (void)ifnum; /* not used in this build branch */ if (netif == NULL) { - netif = gnrc_netif2_iter(NULL); + netif = gnrc_netif_iter(NULL); /* allocate interface header */ if ((pkt = _create_netif_hdr(NULL, 0, pkt)) == NULL) { @@ -604,17 +604,17 @@ static void _send(gnrc_pktsnip_t *pkt, bool prep_hdr) hdr = ipv6->data; payload = ipv6->next; - gnrc_netif2_t *netif = (iface == KERNEL_PID_UNDEF) ? + gnrc_netif_t *netif = (iface == KERNEL_PID_UNDEF) ? NULL : - gnrc_netif2_get_by_pid(iface); + gnrc_netif_get_by_pid(iface); if (ipv6_addr_is_multicast(&hdr->dst)) { _send_multicast(netif, pkt, ipv6, payload, prep_hdr); } else if ((ipv6_addr_is_loopback(&hdr->dst)) || /* dst is loopback address */ ((iface == KERNEL_PID_UNDEF) && /* or dst registered to any local interface */ - ((netif = gnrc_netif2_get_by_ipv6_addr(&hdr->dst)) != NULL) + ((netif = gnrc_netif_get_by_ipv6_addr(&hdr->dst)) != NULL) ) || ((iface != KERNEL_PID_UNDEF) && /* or dst registered to given interface */ - (gnrc_netif2_ipv6_addr_idx(netif, &hdr->dst) > 0) + (gnrc_netif_ipv6_addr_idx(netif, &hdr->dst) > 0) )) { uint8_t *rcv_data; gnrc_pktsnip_t *ptr = ipv6, *rcv_pkt; @@ -655,7 +655,7 @@ static void _send(gnrc_pktsnip_t *pkt, bool prep_hdr) } else { gnrc_ipv6_nib_nc_t nce; - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(iface); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(iface); if (gnrc_ipv6_nib_get_next_hop_l2addr(&hdr->dst, netif, pkt, &nce) < 0) { @@ -663,7 +663,7 @@ static void _send(gnrc_pktsnip_t *pkt, bool prep_hdr) return; } iface = gnrc_ipv6_nib_nc_get_iface(&nce); - netif = gnrc_netif2_get_by_pid(iface); + netif = gnrc_netif_get_by_pid(iface); assert(netif != NULL); if (prep_hdr) { if (_fill_ipv6_hdr(netif, ipv6, payload) < 0) { @@ -686,7 +686,7 @@ static inline bool _pkt_not_for_me(kernel_pid_t *iface, ipv6_hdr_t *hdr) } else if ((!ipv6_addr_is_link_local(&hdr->dst)) || (*iface == KERNEL_PID_UNDEF)) { - gnrc_netif2_t *netif = gnrc_netif2_get_by_ipv6_addr(&hdr->dst); + gnrc_netif_t *netif = gnrc_netif_get_by_ipv6_addr(&hdr->dst); if (*iface == KERNEL_PID_UNDEF) { /* Use original interface for reply if existent */ *iface = (netif != NULL) ? netif->pid : KERNEL_PID_UNDEF; @@ -694,7 +694,7 @@ static inline bool _pkt_not_for_me(kernel_pid_t *iface, ipv6_hdr_t *hdr) return (netif == NULL); } else { - return (gnrc_netif2_get_by_ipv6_addr(&hdr->dst) == NULL); + return (gnrc_netif_get_by_ipv6_addr(&hdr->dst) == NULL); } } @@ -713,7 +713,7 @@ static void _receive(gnrc_pktsnip_t *pkt) #ifdef MODULE_NETSTATS_IPV6 assert(iface); - netstats_t *stats = &(gnrc_netif2_get_by_pid(iface)->ipv6.stats); + netstats_t *stats = &(gnrc_netif_get_by_pid(iface)->ipv6.stats); stats->rx_count++; stats->rx_bytes += (gnrc_pkt_len(pkt) - netif->size); #endif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c index 982635b9b86ad88ca88c6afe274edd96d7171d37..cd5b6e6af0f97f1c965597f2b367c26a404cf0e2 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c @@ -13,7 +13,7 @@ * @author Martine Lenders <m.lenders@fu-berlin.de> */ -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ndp2.h" @@ -28,9 +28,9 @@ static char addr_str[IPV6_ADDR_MAX_STR_LEN]; #endif -extern void _handle_search_rtr(gnrc_netif2_t *netif); +extern void _handle_search_rtr(gnrc_netif_t *netif); -static inline bool _is_iface_eui64(gnrc_netif2_t *netif, const eui64_t *eui64) +static inline bool _is_iface_eui64(gnrc_netif_t *netif, const eui64_t *eui64) { /* TODO: adapt for short addresses */ return (netif->l2addr_len == sizeof(eui64_t)) && @@ -38,7 +38,7 @@ static inline bool _is_iface_eui64(gnrc_netif2_t *netif, const eui64_t *eui64) } static inline uint8_t _reverse_iid(const ipv6_addr_t *dst, - const gnrc_netif2_t *netif, uint8_t *l2addr) + const gnrc_netif_t *netif, uint8_t *l2addr) { switch (netif->device_type) { #ifdef MODULE_NETDEV_ETH @@ -71,10 +71,10 @@ static inline uint8_t _reverse_iid(const ipv6_addr_t *dst, } } -bool _resolve_addr_from_ipv6(const ipv6_addr_t *dst, gnrc_netif2_t *netif, +bool _resolve_addr_from_ipv6(const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_ipv6_nib_nc_t *nce) { - bool res = (netif != NULL) && gnrc_netif2_is_6ln(netif) && + bool res = (netif != NULL) && gnrc_netif_is_6ln(netif) && ipv6_addr_is_link_local(dst); if (res) { @@ -86,8 +86,8 @@ bool _resolve_addr_from_ipv6(const ipv6_addr_t *dst, gnrc_netif2_t *netif, (unsigned)netif->pid); nce->l2addr_len = l2addr_len; DEBUG("%s\n", - gnrc_netif2_addr_to_str(nce->l2addr, nce->l2addr_len, - addr_str)); + gnrc_netif_addr_to_str(nce->l2addr, nce->l2addr_len, + addr_str)); memcpy(&nce->ipv6, dst, sizeof(nce->ipv6)); nce->info = 0; nce->info |= (netif->pid << GNRC_IPV6_NIB_NC_INFO_IFACE_POS) & @@ -102,13 +102,13 @@ bool _resolve_addr_from_ipv6(const ipv6_addr_t *dst, gnrc_netif2_t *netif, return res; } -uint8_t _handle_aro(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +uint8_t _handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_ar_t *aro, const ndp_opt_t *sl2ao, _nib_onl_entry_t *nce) { assert(netif != NULL); - if (gnrc_netif2_is_6ln(netif) && (aro->len == SIXLOWPAN_ND_OPT_AR_LEN)) { + if (gnrc_netif_is_6ln(netif) && (aro->len == SIXLOWPAN_ND_OPT_AR_LEN)) { DEBUG("nib: valid ARO received\n"); DEBUG(" - length: %u\n", aro->len); DEBUG(" - status: %u\n", aro->status); @@ -126,7 +126,7 @@ uint8_t _handle_aro(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, case SIXLOWPAN_ND_STATUS_SUCCESS: { uint16_t ltime = byteorder_ntohs(aro->ltime); uint32_t rereg_time; - int idx = gnrc_netif2_ipv6_addr_idx(netif, &ipv6->dst); + int idx = gnrc_netif_ipv6_addr_idx(netif, &ipv6->dst); /* if ltime 1min, reschedule NS in 30sec, otherwise 1min * before timeout */ rereg_time = (ltime == 1U) ? (30 * MS_PER_SEC) : @@ -135,8 +135,8 @@ uint8_t _handle_aro(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, "Scheduling re-registration in %" PRIu32 "ms\n", ipv6_addr_to_str(addr_str, &ipv6->dst, sizeof(addr_str)), rereg_time); - netif->ipv6.addrs_flags[idx] &= ~GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK; - netif->ipv6.addrs_flags[idx] |= GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID; + netif->ipv6.addrs_flags[idx] &= ~GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK; + netif->ipv6.addrs_flags[idx] |= GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID; _evtimer_add(&netif->ipv6.addrs[idx], GNRC_IPV6_NIB_REREG_ADDRESS, &netif->ipv6.addrs_timers[idx], @@ -149,7 +149,7 @@ uint8_t _handle_aro(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, ipv6_addr_to_str(addr_str, &ipv6->dst, sizeof(addr_str)), netif->pid); - gnrc_netif2_ipv6_addr_remove(netif, &ipv6->dst); + gnrc_netif_ipv6_addr_remove(netif, &ipv6->dst); /* TODO: generate new address */ break; case SIXLOWPAN_ND_STATUS_NC_FULL: { @@ -173,7 +173,7 @@ uint8_t _handle_aro(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, return aro->status; } #if GNRC_IPV6_NIB_CONF_6LR - else if (gnrc_netif2_is_6lr(netif) && + else if (gnrc_netif_is_6lr(netif) && (icmpv6->type == ICMPV6_NBR_SOL)) { assert(nce != NULL); return _reg_addr_upstream(netif, ipv6, icmpv6, aro, sl2ao, nce); @@ -191,21 +191,21 @@ uint8_t _handle_aro(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, return _ADDR_REG_STATUS_IGNORE; } -static inline bool _is_tentative(const gnrc_netif2_t *netif, int idx) +static inline bool _is_tentative(const gnrc_netif_t *netif, int idx) { - return (gnrc_netif2_ipv6_addr_get_state(netif, idx) & - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE); + return (gnrc_netif_ipv6_addr_get_state(netif, idx) & + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE); } -static inline bool _is_valid(const gnrc_netif2_t *netif, int idx) +static inline bool _is_valid(const gnrc_netif_t *netif, int idx) { - return (gnrc_netif2_ipv6_addr_get_state(netif, idx) == - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID); + return (gnrc_netif_ipv6_addr_get_state(netif, idx) == + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID); } void _handle_rereg_address(const ipv6_addr_t *addr) { - gnrc_netif2_t *netif = gnrc_netif2_get_by_ipv6_addr(addr); + gnrc_netif_t *netif = gnrc_netif_get_by_ipv6_addr(addr); _nib_dr_entry_t *router = _nib_drl_get_dr(); if ((netif != NULL) && (router != NULL)) { @@ -223,10 +223,10 @@ void _handle_rereg_address(const ipv6_addr_t *addr) ipv6_addr_to_str(addr_str, addr, sizeof(addr_str))); } if (netif != NULL) { - int idx = gnrc_netif2_ipv6_addr_idx(netif, addr); + int idx = gnrc_netif_ipv6_addr_idx(netif, addr); if (_is_valid(netif, idx) || (_is_tentative(netif, idx) && - (gnrc_netif2_ipv6_addr_dad_trans(netif, idx) < + (gnrc_netif_ipv6_addr_dad_trans(netif, idx) < SIXLOWPAN_ND_REG_TRANSMIT_NUMOF))) { uint32_t retrans_time; diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h index d371aebc9372b2eb2acb9a3003c9034a2a1a980a..34d18b0d33ccd43ebb9996c3fd318aeaa6ce5403 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h @@ -62,7 +62,7 @@ static inline uint32_t _now_min(void) * * @return true when @p nce was set, false when not. */ -bool _resolve_addr_from_ipv6(const ipv6_addr_t *dst, gnrc_netif2_t *netif, +bool _resolve_addr_from_ipv6(const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_ipv6_nib_nc_t *nce); /** @@ -74,9 +74,9 @@ bool _resolve_addr_from_ipv6(const ipv6_addr_t *dst, gnrc_netif2_t *netif, * * @return The interval in ms to the next RS */ -static inline uint32_t _get_next_rs_interval(const gnrc_netif2_t *netif) +static inline uint32_t _get_next_rs_interval(const gnrc_netif_t *netif) { - if (gnrc_netif2_is_6ln(netif)) { + if (gnrc_netif_is_6ln(netif)) { if (netif->ipv6.rs_sent < SIXLOWPAN_ND_MAX_RS_NUMOF) { return SIXLOWPAN_ND_RS_MSEC_INTERVAL; } @@ -109,7 +109,7 @@ static inline uint32_t _get_next_rs_interval(const gnrc_netif2_t *netif) * @return registration status of the address (including * @ref _ADDR_REG_STATUS_TENTATIVE and @ref _ADDR_REG_STATUS_IGNORE). */ -uint8_t _handle_aro(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +uint8_t _handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_ar_t *aro, const ndp_opt_t *sl2ao, _nib_onl_entry_t *nce); diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c index 4342b0b354e39339baba13afa3f48732cb7b3738..69ea79d2c3216382919456f366a7826d3b5f5aa5 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c @@ -14,7 +14,7 @@ */ #include "net/gnrc/ipv6/nib.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc/sixlowpan/nd.h" #include "_nib-6lr.h" @@ -48,7 +48,7 @@ static uint8_t _update_nce_ar_state(const sixlowpan_nd_opt_ar_t *aro, } } -uint8_t _reg_addr_upstream(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +uint8_t _reg_addr_upstream(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_ar_t *aro, const ndp_opt_t *sl2ao, _nib_onl_entry_t *nce) @@ -90,7 +90,7 @@ uint8_t _reg_addr_upstream(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, return _ADDR_REG_STATUS_IGNORE; } -gnrc_pktsnip_t *_copy_and_handle_aro(gnrc_netif2_t *netif, +gnrc_pktsnip_t *_copy_and_handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_nbr_sol_t *nbr_sol, const sixlowpan_nd_opt_ar_t *aro, diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.h index e7b7661a55317c58567e711c9c816ad9e8974dd0..b99ba5599529517b510c220b3669454ed90dd9ca 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.h @@ -66,10 +66,10 @@ static inline void _set_ar_state(_nib_onl_entry_t *entry, uint16_t state) * @param[in] netif A network interface. * @param[in] icmpv6 An ICMPv6 message. */ -static inline bool _rtr_sol_on_6lr(const gnrc_netif2_t *netif, +static inline bool _rtr_sol_on_6lr(const gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6) { - return gnrc_netif2_is_6lr(netif) && (icmpv6->type == ICMPV6_RTR_SOL); + return gnrc_netif_is_6lr(netif) && (icmpv6->type == ICMPV6_RTR_SOL); } /** @@ -90,7 +90,7 @@ static inline bool _rtr_sol_on_6lr(const gnrc_netif2_t *netif, * @return registration status of the address (including * @ref _ADDR_REG_STATUS_TENTATIVE and @ref _ADDR_REG_STATUS_IGNORE). */ -uint8_t _reg_addr_upstream(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +uint8_t _reg_addr_upstream(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_ar_t *aro, const ndp_opt_t *sl2ao, _nib_onl_entry_t *nce); @@ -111,17 +111,17 @@ uint8_t _reg_addr_upstream(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, * @return registration status of the address (including * @ref _ADDR_REG_STATUS_TENTATIVE and @ref _ADDR_REG_STATUS_IGNORE). */ -gnrc_pktsnip_t *_copy_and_handle_aro(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +gnrc_pktsnip_t *_copy_and_handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_nbr_sol_t *nbr_sol, const sixlowpan_nd_opt_ar_t *aro, const ndp_opt_t *sl2ao); /** - * @brief Sets the @ref GNRC_NETIF2_FLAGS_IPV6_RTR_ADV flags of an interface + * @brief Sets the @ref GNRC_NETIF_FLAGS_IPV6_RTR_ADV flags of an interface * * @param[in] netif The interface. */ -void _set_rtr_adv(gnrc_netif2_t *netif); +void _set_rtr_adv(gnrc_netif_t *netif); #else /* GNRC_IPV6_NIB_CONF_6LR || defined(DOXYGEN) */ #define _rtr_sol_on_6lr(netif, icmpv6) (false) #define _get_ar_state(nbr) (_ADDR_REG_STATUS_IGNORE) diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index a1d814e10e1af7baa9784ec7bfb62d921ac5ca05..93b388d35ce552bee002522af6a61578cddca49a 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -16,7 +16,7 @@ #include "xtimer.h" #include "net/gnrc/ndp2.h" #include "net/gnrc/ipv6/nib.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #ifdef MODULE_GNRC_SIXLOWPAN_ND #include "net/gnrc/sixlowpan/nd.h" #endif /* MODULE_GNRC_SIXLOWPAN_ND */ @@ -41,10 +41,10 @@ static char addr_str[IPV6_ADDR_MAX_STR_LEN]; * * @return The length of the L2 address carried in @p opt. */ -static inline unsigned _get_l2addr_len(gnrc_netif2_t *netif, +static inline unsigned _get_l2addr_len(gnrc_netif_t *netif, const ndp_opt_t *opt); -void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, +void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst) { gnrc_pktsnip_t *ext_opt = NULL; @@ -54,11 +54,11 @@ void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, assert(netif != NULL); /* add ARO based on interface */ - if ((src != NULL) && gnrc_netif2_is_6ln(netif) && + if ((src != NULL) && gnrc_netif_is_6ln(netif) && (_nib_onl_get_if(dr->next_hop) == (unsigned)netif->pid) && ipv6_addr_equal(&dr->next_hop->ipv6, dst)) { netdev_t *dev = netif->dev; - uint8_t l2src[GNRC_NETIF2_L2ADDR_MAXLEN]; + uint8_t l2src[GNRC_NETIF_L2ADDR_MAXLEN]; size_t l2src_len = (uint16_t)dev->driver->get(dev, NETOPT_ADDRESS_LONG, l2src, sizeof(l2src)); if (l2src_len != sizeof(eui64_t)) { @@ -78,10 +78,10 @@ void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, void _snd_uc_ns(_nib_onl_entry_t *nbr, bool reset) { - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(_nib_onl_get_if(nbr)); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(nbr)); assert(netif != NULL); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); DEBUG("nib: unicast to %s (retrans. timer = %ums)\n", ipv6_addr_to_str(addr_str, &nbr->ipv6, sizeof(addr_str)), (unsigned)netif->ipv6.retrans_time); @@ -95,13 +95,13 @@ void _snd_uc_ns(_nib_onl_entry_t *nbr, bool reset) _snd_ns(&nbr->ipv6, netif, NULL, &nbr->ipv6); _evtimer_add(nbr, GNRC_IPV6_NIB_SND_UC_NS, &nbr->nud_timeout, netif->ipv6.retrans_time); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); #if GNRC_IPV6_NIB_CONF_ARSM nbr->ns_sent++; #endif /* GNRC_IPV6_NIB_CONF_ARSM */ } -void _handle_sl2ao(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, const ndp_opt_t *sl2ao) { assert(netif != NULL); @@ -176,7 +176,7 @@ void _handle_sl2ao(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, } } -static inline unsigned _get_l2addr_len(gnrc_netif2_t *netif, +static inline unsigned _get_l2addr_len(gnrc_netif_t *netif, const ndp_opt_t *opt) { switch (netif->device_type) { @@ -258,7 +258,7 @@ static inline bool _rflag_set(const ndp_nbr_adv_t *nbr_adv); */ static inline bool _tl2ao_changes_nce(_nib_onl_entry_t *nce, const ndp_opt_t *tl2ao, - gnrc_netif2_t *netif, + gnrc_netif_t *netif, unsigned tl2ao_addr_len); void _handle_snd_ns(_nib_onl_entry_t *nbr) @@ -276,7 +276,7 @@ void _handle_snd_ns(_nib_onl_entry_t *nbr) break; case GNRC_IPV6_NIB_NC_INFO_NUD_STATE_PROBE: if (nbr->ns_sent >= NDP_MAX_UC_SOL_NUMOF) { - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(_nib_onl_get_if(nbr)); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(nbr)); _set_nud_state(netif, nbr, GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNREACHABLE); @@ -300,7 +300,7 @@ void _handle_state_timeout(_nib_onl_entry_t *nbr) new_state = GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE; /* falls through intentionally */ case GNRC_IPV6_NIB_NC_INFO_NUD_STATE_DELAY: { - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(_nib_onl_get_if(nbr)); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(nbr)); _set_nud_state(netif, nbr, new_state); if (new_state == GNRC_IPV6_NIB_NC_INFO_NUD_STATE_PROBE) { @@ -324,12 +324,12 @@ void _probe_nbr(_nib_onl_entry_t *nbr, bool reset) break; case GNRC_IPV6_NIB_NC_INFO_NUD_STATE_INCOMPLETE: case GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNREACHABLE: { - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(_nib_onl_get_if(nbr)); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(nbr)); uint32_t next_ns = _evtimer_lookup(nbr, GNRC_IPV6_NIB_SND_MC_NS); assert(netif != NULL); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); if (next_ns > netif->ipv6.retrans_time) { ipv6_addr_t sol_nodes; uint32_t retrans_time = netif->ipv6.retrans_time; @@ -366,7 +366,7 @@ void _probe_nbr(_nib_onl_entry_t *nbr, bool reset) (unsigned)netif->ipv6.retrans_time); } #endif /* ENABLE_DEBUG */ - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } break; case GNRC_IPV6_NIB_NC_INFO_NUD_STATE_PROBE: @@ -376,7 +376,7 @@ void _probe_nbr(_nib_onl_entry_t *nbr, bool reset) } } -void _handle_adv_l2(gnrc_netif2_t *netif, _nib_onl_entry_t *nce, +void _handle_adv_l2(gnrc_netif_t *netif, _nib_onl_entry_t *nce, const icmpv6_hdr_t *icmpv6, const ndp_opt_t *tl2ao) { unsigned l2addr_len = 0; @@ -456,7 +456,7 @@ void _handle_adv_l2(gnrc_netif2_t *netif, _nib_onl_entry_t *nce, } } -void _recalc_reach_time(gnrc_netif2_ipv6_t *netif) +void _recalc_reach_time(gnrc_netif_ipv6_t *netif) { const uint32_t half = (netif->reach_time_base >> 1); @@ -467,7 +467,7 @@ void _recalc_reach_time(gnrc_netif2_ipv6_t *netif) GNRC_IPV6_NIB_CONF_REACH_TIME_RESET); } -void _set_reachable(gnrc_netif2_t *netif, _nib_onl_entry_t *nce) +void _set_reachable(gnrc_netif_t *netif, _nib_onl_entry_t *nce) { DEBUG("nib: Set %s%%%u to REACHABLE for %ums\n", ipv6_addr_to_str(addr_str, &nce->ipv6, sizeof(addr_str)), @@ -477,19 +477,19 @@ void _set_reachable(gnrc_netif2_t *netif, _nib_onl_entry_t *nce) netif->ipv6.reach_time); } -void _set_nud_state(gnrc_netif2_t *netif, _nib_onl_entry_t *nce, +void _set_nud_state(gnrc_netif_t *netif, _nib_onl_entry_t *nce, uint16_t state) { nce->info &= ~GNRC_IPV6_NIB_NC_INFO_NUD_STATE_MASK; nce->info |= state; #if GNRC_IPV6_NIB_CONF_ROUTER - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); if (netif != NULL) { _call_route_info_cb(netif, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_NSC, &nce->ipv6, (void *)((intptr_t)state)); } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); #else /* GNRC_IPV6_NIB_CONF_ROUTER */ (void)netif; #endif /* GNRC_IPV6_NIB_CONF_ROUTER */ @@ -521,7 +521,7 @@ static inline bool _redirect_with_tl2ao(icmpv6_hdr_t *icmpv6, ndp_opt_t *tl2ao) static inline bool _tl2ao_changes_nce(_nib_onl_entry_t *nce, const ndp_opt_t *tl2ao, - gnrc_netif2_t *netif, + gnrc_netif_t *netif, unsigned tl2ao_addr_len) { return ((tl2ao != NULL) && diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h index b0c356f3c46a1a4907e309a75fc9859f4ad6784b..f2558ff8525f86377d45e2a0dd5320edf8b6680e 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h @@ -24,7 +24,7 @@ #include <stdint.h> #include "net/gnrc/ipv6/nib/conf.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/ndp.h" #include "net/icmpv6.h" @@ -48,7 +48,7 @@ extern "C" { * @param[in] dst Destination address for neighbor solicitation. May not * be NULL. */ -void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, +void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst); /** @@ -78,7 +78,7 @@ void _snd_uc_ns(_nib_onl_entry_t *nbr, bool reset); * @param[in] icmpv6 ICMPv6 header of the message carrying the SL2AO. * @param[in] sl2ao The SL2AO */ -void _handle_sl2ao(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, const ndp_opt_t *sl2ao); #if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) @@ -121,7 +121,7 @@ void _probe_nbr(_nib_onl_entry_t *nbr, bool reset); * @param[in] tl2ao The TL2AO carrying the link-layer information. May be * NULL for link-layers without addresses. */ -void _handle_adv_l2(gnrc_netif2_t *netif, _nib_onl_entry_t *nce, +void _handle_adv_l2(gnrc_netif_t *netif, _nib_onl_entry_t *nce, const icmpv6_hdr_t *icmpv6, const ndp_opt_t *tl2ao); @@ -133,7 +133,7 @@ void _handle_adv_l2(gnrc_netif2_t *netif, _nib_onl_entry_t *nce, * * @param[in] netif Interface to set reachable time for. */ -void _recalc_reach_time(gnrc_netif2_ipv6_t *netif); +void _recalc_reach_time(gnrc_netif_ipv6_t *netif); /** * @brief Sets a neighbor cache entry reachable and starts the required @@ -142,14 +142,14 @@ void _recalc_reach_time(gnrc_netif2_ipv6_t *netif); * @param[in] netif Interface to the NCE * @param[in] nce The neighbor cache entry to set reachable */ -void _set_reachable(gnrc_netif2_t *netif, _nib_onl_entry_t *nce); +void _set_reachable(gnrc_netif_t *netif, _nib_onl_entry_t *nce); /** * @brief Initializes interface for address registration state machine * * @param[in] netif An interface */ -static inline void _init_iface_arsm(gnrc_netif2_t *netif) +static inline void _init_iface_arsm(gnrc_netif_t *netif) { netif->ipv6.reach_time_base = NDP_REACH_MS; _recalc_reach_time(&netif->ipv6); @@ -175,7 +175,7 @@ static inline uint16_t _get_nud_state(_nib_onl_entry_t *nbr) * @param[in] nbr Neighbor cache entry representing the neighbor. * @param[in] state Neighbor unreachability state for the neighbor. */ -void _set_nud_state(gnrc_netif2_t *netif, _nib_onl_entry_t *nbr, +void _set_nud_state(gnrc_netif_t *netif, _nib_onl_entry_t *nbr, uint16_t state); #else /* GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 98d528d839b6751f20a673d913628430cbc6c7d7..7f5ac8f2a84d3bac4b9c040d367c0260880c1aba 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -21,7 +21,7 @@ #include "net/gnrc/ipv6/nib/conf.h" #include "net/gnrc/ipv6/nib/nc.h" #include "net/gnrc/ipv6/nib.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "random.h" #include "_nib-internal.h" @@ -225,7 +225,7 @@ _nib_onl_entry_t *_nib_onl_get(const ipv6_addr_t *addr, unsigned iface) void _nib_nc_set_reachable(_nib_onl_entry_t *node) { #if GNRC_IPV6_NIB_CONF_ARSM - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(_nib_onl_get_if(node)); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(node)); node->info &= ~GNRC_IPV6_NIB_NC_INFO_NUD_STATE_MASK; node->info |= GNRC_IPV6_NIB_NC_INFO_NUD_STATE_REACHABLE; @@ -289,9 +289,9 @@ void _nib_nc_get(const _nib_onl_entry_t *node, gnrc_ipv6_nib_nc_t *nce) #if GNRC_IPV6_NIB_CONF_ARSM #if GNRC_IPV6_NIB_CONF_6LN if (ipv6_addr_is_link_local(&nce->ipv6)) { - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(_nib_onl_get_if(node)); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(node)); assert(netif != NULL); - if (gnrc_netif2_is_6ln(netif) && !gnrc_netif2_is_rtr(netif)) { + if (gnrc_netif_is_6ln(netif) && !gnrc_netif_is_rtr(netif)) { _get_l2addr_from_ipv6(nce->l2addr, &node->ipv6); nce->l2addr_len = sizeof(uint64_t); return; @@ -598,9 +598,9 @@ int _nib_get_route(const ipv6_addr_t *dst, gnrc_pktsnip_t *pkt, if ((router == NULL) && (offl == NULL)) { #if GNRC_IPV6_NIB_CONF_ROUTER - gnrc_netif2_t *ptr = NULL; + gnrc_netif_t *ptr = NULL; - while ((ptr = gnrc_netif2_iter(ptr))) { + while ((ptr = gnrc_netif_iter(ptr))) { _call_route_info_cb(ptr, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_RRQ, dst, pkt); diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c index 90d95baad168efe547d01896c3b4e91cc50ab6c9..fa0a96db6b23a215828b20a1802a530f294c5df9 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c @@ -15,7 +15,7 @@ #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ndp2.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc/sixlowpan/nd.h" #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C @@ -31,33 +31,33 @@ static char addr_str[IPV6_ADDR_MAX_STR_LEN]; #endif -static void _snd_ra(gnrc_netif2_t *netif, const ipv6_addr_t *dst, +static void _snd_ra(gnrc_netif_t *netif, const ipv6_addr_t *dst, bool final, _nib_abr_entry_t *abr); void _handle_reply_rs(_nib_onl_entry_t *host) { - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(_nib_onl_get_if(host)); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(host)); assert(netif != NULL); - gnrc_netif2_acquire(netif); - if (gnrc_netif2_is_rtr_adv(netif)) { + gnrc_netif_acquire(netif); + if (gnrc_netif_is_rtr_adv(netif)) { _snd_rtr_advs(netif, &host->ipv6, false); } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } -void _handle_snd_mc_ra(gnrc_netif2_t *netif) +void _handle_snd_mc_ra(gnrc_netif_t *netif) { - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); assert(netif != NULL); - if (!gnrc_netif2_is_6ln(netif)) { + if (!gnrc_netif_is_6ln(netif)) { bool final_ra = (netif->ipv6.ra_sent > (UINT8_MAX - NDP_MAX_FIN_RA_NUMOF)); uint32_t next_ra_time = random_uint32_range(NDP_MIN_RA_INTERVAL_MS, NDP_MAX_RA_INTERVAL_MS); /* router has router advertising interface or the RA is one of the * (now deactivated) routers final one */ - if (final_ra || gnrc_netif2_is_rtr_adv(netif)) { + if (final_ra || gnrc_netif_is_rtr_adv(netif)) { _snd_rtr_advs(netif, NULL, final_ra); netif->ipv6.last_ra = (xtimer_now_usec64() / US_PER_MS) & UINT32_MAX; if ((netif->ipv6.ra_sent < NDP_MAX_INIT_RA_NUMOF) || final_ra) { @@ -74,10 +74,10 @@ void _handle_snd_mc_ra(gnrc_netif2_t *netif) } } } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } -void _snd_rtr_advs(gnrc_netif2_t *netif, const ipv6_addr_t *dst, bool final) +void _snd_rtr_advs(gnrc_netif_t *netif, const ipv6_addr_t *dst, bool final) { #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C _nib_abr_entry_t *abr = NULL; @@ -123,7 +123,7 @@ static gnrc_pktsnip_t *_offl_to_pio(_nib_offl_entry_t *offl, return pio; } -static gnrc_pktsnip_t *_build_ext_opts(gnrc_netif2_t *netif, +static gnrc_pktsnip_t *_build_ext_opts(gnrc_netif_t *netif, _nib_abr_entry_t *abr) { gnrc_pktsnip_t *ext_opts = NULL; @@ -157,7 +157,7 @@ static gnrc_pktsnip_t *_build_ext_opts(gnrc_netif2_t *netif, } } } - ltime = (gnrc_netif2_is_6lbr(netif)) ? + ltime = (gnrc_netif_is_6lbr(netif)) ? (SIXLOWPAN_ND_OPT_ABR_LTIME_DEFAULT) : (abr->valid_until - _now_min()); (void)ltime; /* gnrc_sixlowpan_nd_opt_abr_build might evaluate to NOP */ @@ -181,15 +181,15 @@ static gnrc_pktsnip_t *_build_ext_opts(gnrc_netif2_t *netif, return ext_opts; } -void _set_rtr_adv(gnrc_netif2_t *netif) +void _set_rtr_adv(gnrc_netif_t *netif) { DEBUG("nib: set RTR_ADV flag for interface %i\n", netif->pid); netif->ipv6.ra_sent = 0; - netif->flags |= GNRC_NETIF2_FLAGS_IPV6_RTR_ADV; + netif->flags |= GNRC_NETIF_FLAGS_IPV6_RTR_ADV; _handle_snd_mc_ra(netif); } -static void _snd_ra(gnrc_netif2_t *netif, const ipv6_addr_t *dst, +static void _snd_ra(gnrc_netif_t *netif, const ipv6_addr_t *dst, bool final, _nib_abr_entry_t *abr) { gnrc_pktsnip_t *ext_opts = _build_ext_opts(netif, abr); diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h index 1205dc555f2a0f7ff73de8a100bec87e832ee58d..5c0235ad3e31c95081f4ec42aed3011b1c1d2079 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h @@ -20,8 +20,8 @@ #define PRIV_NIB_ROUTER_H #include "net/gnrc/ipv6/nib/conf.h" -#include "net/gnrc/netif2/internal.h" -#include "net/gnrc/netif2/ipv6.h" +#include "net/gnrc/netif/internal.h" +#include "net/gnrc/netif/ipv6.h" #include "net/ipv6/addr.h" #include "net/ndp.h" @@ -37,24 +37,24 @@ extern "C" { * * @param[in] netif An interface. */ -static inline void _init_iface_router(gnrc_netif2_t *netif) +static inline void _init_iface_router(gnrc_netif_t *netif) { netif->ipv6.rtr_ltime = NDP_RTR_LTIME_SEC; netif->ipv6.last_ra = UINT32_MAX; netif->ipv6.ra_sent = 0; - netif->flags |= GNRC_NETIF2_FLAGS_IPV6_FORWARDING; + netif->flags |= GNRC_NETIF_FLAGS_IPV6_FORWARDING; #if !GNRC_IPV6_NIB_CONF_6LR || GNRC_IPV6_NIB_CONF_6LBR - netif->flags |= GNRC_NETIF2_FLAGS_IPV6_RTR_ADV; + netif->flags |= GNRC_NETIF_FLAGS_IPV6_RTR_ADV; #endif /* !GNRC_IPV6_NIB_CONF_6LR || GNRC_IPV6_NIB_CONF_6LBR */ #if GNRC_IPV6_NIB_CONF_6LBR - netif->flags |= GNRC_NETIF2_FLAGS_6LO_ABR; + netif->flags |= GNRC_NETIF_FLAGS_6LO_ABR; #endif /* GNRC_IPV6_NIB_CONF_6LBR */ - gnrc_netif2_ipv6_group_join(netif, &ipv6_addr_all_routers_link_local); + gnrc_netif_ipv6_group_join(netif, &ipv6_addr_all_routers_link_local); } /** * @brief Helper function to safely call the - * [route info callback](@ref gnrc_netif2_ipv6_t::route_info_cb) of an + * [route info callback](@ref gnrc_netif_ipv6_t::route_info_cb) of an * interface * * @param[in] netif An interface. @@ -63,7 +63,7 @@ static inline void _init_iface_router(gnrc_netif2_t *netif) * @param[in] ctx_addr Context address of the route info. * @param[in] ctx Further context of the route info. */ -static inline void _call_route_info_cb(gnrc_netif2_t *netif, unsigned type, +static inline void _call_route_info_cb(gnrc_netif_t *netif, unsigned type, const ipv6_addr_t *ctx_addr, const void *ctx) { @@ -85,16 +85,16 @@ void _handle_reply_rs(_nib_onl_entry_t *host); * @param[in] netif Network interface to send multicast router advertisement * over. */ -void _handle_snd_mc_ra(gnrc_netif2_t *netif); +void _handle_snd_mc_ra(gnrc_netif_t *netif); /** - * @brief Set the @ref GNRC_NETIF2_FLAGS_IPV6_RTR_ADV flag for an interface + * @brief Set the @ref GNRC_NETIF_FLAGS_IPV6_RTR_ADV flag for an interface * and starts advertising that interface as a router * - * @param[in] netif Interface to set the @ref GNRC_NETIF2_FLAGS_IPV6_RTR_ADV + * @param[in] netif Interface to set the @ref GNRC_NETIF_FLAGS_IPV6_RTR_ADV * for. */ -void _set_rtr_adv(gnrc_netif2_t *netif); +void _set_rtr_adv(gnrc_netif_t *netif); /** * @brief Send router advertisements @@ -108,7 +108,7 @@ void _set_rtr_adv(gnrc_netif2_t *netif); * @param[in] final The router advertisement are the final ones of the @p netif * (because it was set to be a non-forwarding interface e.g.). */ -void _snd_rtr_advs(gnrc_netif2_t *netif, const ipv6_addr_t *dst, +void _snd_rtr_advs(gnrc_netif_t *netif, const ipv6_addr_t *dst, bool final); #else /* GNRC_IPV6_NIB_CONF_ROUTER */ #define _init_iface_router(netif) (void)netif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 9ff8d152757ce4d67b79a0ece2e5a30f52eea874..ca762d83d7c8f82a3419987aba2b1ff900c38acc 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -19,7 +19,7 @@ #include "log.h" #include "net/ipv6/addr.h" #include "net/gnrc/nettype.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ndp2.h" #include "net/gnrc/pktqueue.h" @@ -52,17 +52,17 @@ static gnrc_pktqueue_t _queue_pool[GNRC_IPV6_NIB_NUMOF]; * @{ */ #if GNRC_IPV6_NIB_CONF_ROUTER -static void _handle_rtr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +static void _handle_rtr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_rtr_sol_t *rtr_sol, size_t icmpv6_len); #endif /* GNRC_IPV6_NIB_CONF_ROUTER */ -static void _handle_rtr_adv(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_rtr_adv_t *rtr_adv, size_t icmpv6_len); -static void _handle_nbr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_nbr_sol_t *nbr_sol, size_t icmpv6_len); -static void _handle_nbr_adv(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_nbr_adv_t *nbr_adv, size_t icmpv6_len); -static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif2_t *netif, +static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_ipv6_nib_nc_t *nce, _nib_onl_entry_t *entry); @@ -70,7 +70,7 @@ static void _handle_pfx_timeout(_nib_offl_entry_t *pfx); static void _handle_rtr_timeout(_nib_dr_entry_t *router); static void _handle_snd_na(gnrc_pktsnip_t *pkt); #if GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC -static void _auto_configure_addr(gnrc_netif2_t *netif, const ipv6_addr_t *pfx, +static void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, uint8_t pfx_len); #else /* GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ #define _auto_configure_addr(netif, pfx, pfx_len) (void)netif; \ @@ -78,7 +78,7 @@ static void _auto_configure_addr(gnrc_netif2_t *netif, const ipv6_addr_t *pfx, (void)pfx_len #endif /* GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ /* needs to be exported for 6LN's ARO handling */ -void _handle_search_rtr(gnrc_netif2_t *netif); +void _handle_search_rtr(gnrc_netif_t *netif); /** @} */ void gnrc_ipv6_nib_init(void) @@ -95,18 +95,18 @@ void gnrc_ipv6_nib_init(void) mutex_unlock(&_nib_mutex); } -void gnrc_ipv6_nib_init_iface(gnrc_netif2_t *netif) +void gnrc_ipv6_nib_init_iface(gnrc_netif_t *netif) { assert(netif != NULL); DEBUG("nib: Initialize interface %u\n", netif->pid); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); _init_iface_arsm(netif); netif->ipv6.retrans_time = NDP_RETRANS_TIMER_MS; #if GNRC_IPV6_NIB_CONF_SLAAC || GNRC_IPV6_NIB_CONF_6LN /* TODO: set differently dependent on GNRC_IPV6_NIB_CONF_SLAAC if * alternatives exist */ - netif->ipv6.aac_mode = GNRC_NETIF2_AAC_AUTO; + netif->ipv6.aac_mode = GNRC_NETIF_AAC_AUTO; #endif /* GNRC_IPV6_NIB_CONF_SLAAC || GNRC_IPV6_NIB_CONF_6LN */ _init_iface_router(netif); #if GNRC_IPV6_NIB_CONF_6LN @@ -124,16 +124,16 @@ void gnrc_ipv6_nib_init_iface(gnrc_netif2_t *netif) } #endif /* GNRC_IPV6_NIB_CONF_6LN */ netif->ipv6.na_sent = 0; - if (gnrc_netif2_ipv6_group_join(netif, - &ipv6_addr_all_nodes_link_local) < 0) { + if (gnrc_netif_ipv6_group_join(netif, + &ipv6_addr_all_nodes_link_local) < 0) { DEBUG("nib: Can't join link-local all-nodes on interface %u\n", netif->pid); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return; } _auto_configure_addr(netif, &ipv6_addr_link_local_prefix, 64U); - if (!(gnrc_netif2_is_rtr_adv(netif)) || - (gnrc_netif2_is_6ln(netif) && !gnrc_netif2_is_6lbr(netif))) { + if (!(gnrc_netif_is_rtr_adv(netif)) || + (gnrc_netif_is_6ln(netif) && !gnrc_netif_is_6lbr(netif))) { uint32_t next_rs_time = random_uint32_range(0, NDP_MAX_RS_MS_DELAY); _evtimer_add(netif, GNRC_IPV6_NIB_SEARCH_RTR, &netif->ipv6.search_rtr, @@ -144,7 +144,7 @@ void gnrc_ipv6_nib_init_iface(gnrc_netif2_t *netif) _handle_snd_mc_ra(netif); } #endif /* GNRC_IPV6_NIB_CONF_ROUTER */ - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } static bool _on_link(const ipv6_addr_t *dst, unsigned *iface) @@ -153,7 +153,7 @@ static bool _on_link(const ipv6_addr_t *dst, unsigned *iface) #if GNRC_IPV6_NIB_CONF_6LN if (*iface != 0) { - if (gnrc_netif2_is_6ln(gnrc_netif2_get_by_pid(*iface))) { + if (gnrc_netif_is_6ln(gnrc_netif_get_by_pid(*iface))) { return ipv6_addr_is_link_local(dst); } } @@ -169,7 +169,7 @@ static bool _on_link(const ipv6_addr_t *dst, unsigned *iface) } int gnrc_ipv6_nib_get_next_hop_l2addr(const ipv6_addr_t *dst, - gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt, + gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_ipv6_nib_nc_t *nce) { int res = 0; @@ -177,7 +177,7 @@ int gnrc_ipv6_nib_get_next_hop_l2addr(const ipv6_addr_t *dst, DEBUG("nib: get next hop link-layer address of %s%%%u\n", ipv6_addr_to_str(addr_str, dst, sizeof(addr_str)), (netif != NULL) ? (unsigned)netif->pid : 0U); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); mutex_lock(&_nib_mutex); do { /* XXX: hidden goto ;-) */ _nib_onl_entry_t *node = _nib_onl_get(dst, @@ -191,9 +191,9 @@ int gnrc_ipv6_nib_get_next_hop_l2addr(const ipv6_addr_t *dst, /* on-link prefixes return their interface */ if (!ipv6_addr_is_link_local(dst) && (iface != 0)) { /* release preassumed interface */ - gnrc_netif2_release(netif); - netif = gnrc_netif2_get_by_pid(iface); - gnrc_netif2_acquire(netif); + gnrc_netif_release(netif); + netif = gnrc_netif_get_by_pid(iface); + gnrc_netif_acquire(netif); } if ((netif == NULL) || !_resolve_addr(dst, netif, pkt, nce, node)) { @@ -224,12 +224,12 @@ int gnrc_ipv6_nib_get_next_hop_l2addr(const ipv6_addr_t *dst, } if ((netif != NULL) && (netif->pid != route.iface)) { /* drop pre-assumed netif */ - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } if ((netif == NULL) || (netif->pid != route.iface)) { /* get actual netif */ - netif = gnrc_netif2_get_by_pid(route.iface); - gnrc_netif2_acquire(netif); + netif = gnrc_netif_get_by_pid(route.iface); + gnrc_netif_acquire(netif); } node = _nib_onl_get(&route.next_hop, (netif == NULL) ? netif->pid : 0); @@ -248,16 +248,16 @@ int gnrc_ipv6_nib_get_next_hop_l2addr(const ipv6_addr_t *dst, } } while (0); mutex_unlock(&_nib_mutex); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return res; } -void gnrc_ipv6_nib_handle_pkt(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +void gnrc_ipv6_nib_handle_pkt(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, size_t icmpv6_len) { DEBUG("nib: Handle packet (icmpv6->type = %u)\n", icmpv6->type); assert(netif != NULL); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); mutex_lock(&_nib_mutex); switch (icmpv6->type) { #if GNRC_IPV6_NIB_CONF_ROUTER @@ -289,7 +289,7 @@ void gnrc_ipv6_nib_handle_pkt(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, #endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_DAD */ } mutex_unlock(&_nib_mutex); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) @@ -353,9 +353,9 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) } #if GNRC_IPV6_NIB_CONF_ROUTER -void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif2_t *netif, bool enable) +void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif_t *netif, bool enable) { - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); if (enable) { _set_rtr_adv(netif); } @@ -363,13 +363,13 @@ void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif2_t *netif, bool enable) uint32_t next_rs_time = random_uint32_range(0, NDP_MAX_RS_MS_DELAY); netif->ipv6.ra_sent = (UINT8_MAX - NDP_MAX_FIN_RA_NUMOF) + 1; - netif->flags &= ~GNRC_NETIF2_FLAGS_IPV6_RTR_ADV; + netif->flags &= ~GNRC_NETIF_FLAGS_IPV6_RTR_ADV; /* send final router advertisements */ _handle_snd_mc_ra(netif); _evtimer_add(netif, GNRC_IPV6_NIB_SEARCH_RTR, &netif->ipv6.search_rtr, next_rs_time); } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } #endif /* GNRC_IPV6_NIB_CONF_ROUTER */ @@ -377,14 +377,14 @@ void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif2_t *netif, bool enable) * @internal * @{ */ -static void _handle_mtuo(gnrc_netif2_t *netif, const icmpv6_hdr_t *icmpv6, +static void _handle_mtuo(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_mtu_t *mtuo); #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C -static uint32_t _handle_pio(gnrc_netif2_t *netif, const icmpv6_hdr_t *icmpv6, +static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_pi_t *pio, _nib_abr_entry_t *abr); #else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ -static uint32_t _handle_pio(gnrc_netif2_t *netif, const icmpv6_hdr_t *icmpv6, +static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_pi_t *pio); #endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ /** @} */ @@ -397,7 +397,7 @@ static uint32_t _handle_pio(gnrc_netif2_t *netif, const icmpv6_hdr_t *icmpv6, opt = (ndp_opt_t *)(((uint8_t *)opt) + (opt->len << 3))) #if GNRC_IPV6_NIB_CONF_ROUTER -static void _handle_rtr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +static void _handle_rtr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_rtr_sol_t *rtr_sol, size_t icmpv6_len) { size_t tmp_len = icmpv6_len - sizeof(ndp_rtr_sol_t); @@ -408,7 +408,7 @@ static void _handle_rtr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, assert(netif != NULL); /* check validity, see: https://tools.ietf.org/html/rfc4861#section-6.1.1 */ /* checksum is checked by GNRC's ICMPv6 module */ - if (!(gnrc_netif2_is_rtr(netif)) || (ipv6->hl != 255U) || + if (!(gnrc_netif_is_rtr(netif)) || (ipv6->hl != 255U) || (rtr_sol->code != 0U) || (icmpv6_len < sizeof(ndp_rtr_sol_t))) { DEBUG("nib: Received router solicitation is invalid (or interface %i " "is not a forwarding interface). Discarding silently\n", @@ -448,7 +448,7 @@ static void _handle_rtr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, FOREACH_OPT(rtr_sol, opt, tmp_len) { switch (opt->type) { case NDP_OPT_SL2A: - if (!gnrc_netif2_is_6ln(netif)) { + if (!gnrc_netif_is_6ln(netif)) { _handle_sl2ao(netif, ipv6, (const icmpv6_hdr_t *)rtr_sol, opt); } @@ -460,7 +460,7 @@ static void _handle_rtr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, } nce = _nib_onl_get(&ipv6->src, netif->pid); } - if (!gnrc_netif2_is_6ln(netif)) { + if (!gnrc_netif_is_6ln(netif)) { uint32_t next_ra_scheduled = _evtimer_lookup(netif, GNRC_IPV6_NIB_SND_MC_RA); if (next_ra_scheduled < next_ra_delay) { @@ -488,7 +488,7 @@ static void _handle_rtr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, } } #if GNRC_IPV6_NIB_CONF_6LR - else if (gnrc_netif2_is_rtr(netif) && gnrc_netif2_is_rtr_adv(netif)) { + else if (gnrc_netif_is_rtr(netif) && gnrc_netif_is_rtr_adv(netif)) { _snd_rtr_advs(netif, &ipv6->src, false); } #endif /* GNRC_IPV6_NIB_CONF_6LR */ @@ -500,7 +500,7 @@ static inline uint32_t _min(uint32_t a, uint32_t b) return (a < b) ? a : b; } -static void _handle_rtr_adv(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_rtr_adv_t *rtr_adv, size_t icmpv6_len) { size_t tmp_len = icmpv6_len - sizeof(ndp_rtr_adv_t); @@ -519,7 +519,7 @@ static void _handle_rtr_adv(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, if (!(ipv6_addr_is_link_local(&ipv6->src)) || (ipv6->hl != 255U) || (rtr_adv->code != 0U) || (icmpv6_len < sizeof(ndp_rtr_adv_t)) || - (!gnrc_netif2_is_6ln(netif) && + (!gnrc_netif_is_6ln(netif) && (byteorder_ntohs(rtr_adv->ltime) > NDP_RTR_ADV_LTIME_SEC_MAX))) { DEBUG("nib: Received router advertisement is invalid. " "Discarding silently\n"); @@ -633,16 +633,16 @@ static void _handle_rtr_adv(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, netif->ipv6.retrans_time = byteorder_ntohl(rtr_adv->retrans_timer); } #if GNRC_IPV6_NIB_CONF_6LN - if ((dr != NULL) && gnrc_netif2_is_6ln(netif) && - !gnrc_netif2_is_6lbr(netif) && - !(netif->flags & GNRC_NETIF2_FLAGS_6LO_ADDRS_REG)) { + if ((dr != NULL) && gnrc_netif_is_6ln(netif) && + !gnrc_netif_is_6lbr(netif) && + !(netif->flags & GNRC_NETIF_FLAGS_6LO_ADDRS_REG)) { /* (register addresses already assigned)*/ - for (int i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { if ((netif->ipv6.addrs_flags[i] != 0)) { _handle_rereg_address(&netif->ipv6.addrs[i]); } } - netif->flags |= GNRC_NETIF2_FLAGS_6LO_ADDRS_REG; + netif->flags |= GNRC_NETIF_FLAGS_6LO_ADDRS_REG; } #endif /* GNRC_IPV6_NIB_CONF_6LN */ tmp_len = icmpv6_len - sizeof(ndp_rtr_adv_t); @@ -693,7 +693,7 @@ static void _handle_rtr_adv(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, * see https://tools.ietf.org/html/rfc4861#section-6.3.7 */ evtimer_del(&_nib_evtimer, &netif->ipv6.search_rtr.event); #if GNRC_IPV6_NIB_CONF_6LN - if (gnrc_netif2_is_6ln(netif) && !gnrc_netif2_is_6lbr(netif)) { + if (gnrc_netif_is_6ln(netif) && !gnrc_netif_is_6lbr(netif)) { _set_rtr_adv(netif); /* but re-fetch information from router in time */ _evtimer_add(netif, GNRC_IPV6_NIB_SEARCH_RTR, @@ -703,19 +703,19 @@ static void _handle_rtr_adv(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, #endif /* GNRC_IPV6_NIB_CONF_6LN */ } -static inline size_t _get_l2src(const gnrc_netif2_t *netif, uint8_t *l2src) +static inline size_t _get_l2src(const gnrc_netif_t *netif, uint8_t *l2src) { -#if GNRC_NETIF2_L2ADDR_MAXLEN > 0 +#if GNRC_NETIF_L2ADDR_MAXLEN > 0 memcpy(l2src, netif->l2addr, netif->l2addr_len); return netif->l2addr_len; -#else /* GNRC_NETIF2_L2ADDR_MAXLEN > 0 */ +#else /* GNRC_NETIF_L2ADDR_MAXLEN > 0 */ (void)netif; (void)l2src; return 0; -#endif /* GNRC_NETIF2_L2ADDR_MAXLEN > 0 */ +#endif /* GNRC_NETIF_L2ADDR_MAXLEN > 0 */ } -static void _send_delayed_nbr_adv(const gnrc_netif2_t *netif, +static void _send_delayed_nbr_adv(const gnrc_netif_t *netif, const ipv6_addr_t *tgt, const ipv6_addr_t *dst, gnrc_pktsnip_t *reply_aro) @@ -725,13 +725,13 @@ static void _send_delayed_nbr_adv(const gnrc_netif2_t *netif, uint8_t reply_flags = NDP_NBR_ADV_FLAGS_S; #if GNRC_IPV6_NIB_CONF_ROUTER - if (gnrc_netif2_is_rtr(netif)) { + if (gnrc_netif_is_rtr(netif)) { reply_flags |= NDP_NBR_ADV_FLAGS_R; } #endif /* GNRC_IPV6_NIB_CONF_ROUTER */ -#if GNRC_NETIF2_L2ADDR_MAXLEN > 0 +#if GNRC_NETIF_L2ADDR_MAXLEN > 0 if (ipv6_addr_is_multicast(dst)) { - uint8_t l2addr[GNRC_NETIF2_L2ADDR_MAXLEN]; + uint8_t l2addr[GNRC_NETIF_L2ADDR_MAXLEN]; size_t l2addr_len = _get_l2src(netif, l2addr); if (l2addr_len > 0) { @@ -750,9 +750,9 @@ static void _send_delayed_nbr_adv(const gnrc_netif2_t *netif, else { reply_flags |= NDP_NBR_ADV_FLAGS_O; } -#else /* GNRC_NETIF2_L2ADDR_MAXLEN > 0 */ +#else /* GNRC_NETIF_L2ADDR_MAXLEN > 0 */ reply_flags |= NDP_NBR_ADV_FLAGS_O; -#endif /* GNRC_NETIF2_L2ADDR_MAXLEN > 0 */ +#endif /* GNRC_NETIF_L2ADDR_MAXLEN > 0 */ /* discard const qualifier */ nbr_adv = gnrc_ndp2_nbr_adv_build(tgt, reply_flags, extra_opts); if (nbr_adv == NULL) { @@ -770,7 +770,7 @@ static void _send_delayed_nbr_adv(const gnrc_netif2_t *netif, } } -static void _handle_nbr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_nbr_sol_t *nbr_sol, size_t icmpv6_len) { size_t tmp_len = icmpv6_len - sizeof(ndp_nbr_sol_t); @@ -799,7 +799,7 @@ static void _handle_nbr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, return; } /* check if target is assigned only now in case the length was wrong */ - tgt_idx = gnrc_netif2_ipv6_addr_idx(netif, &nbr_sol->tgt); + tgt_idx = gnrc_netif_ipv6_addr_idx(netif, &nbr_sol->tgt); if (tgt_idx < 0) { DEBUG("nib: Target address %s is not assigned to the local interface\n", ipv6_addr_to_str(addr_str, &nbr_sol->tgt, sizeof(addr_str))); @@ -839,7 +839,7 @@ static void _handle_nbr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, #endif /* GNRC_IPV6_NIB_CONF_6LR */ tmp_len = icmpv6_len - sizeof(ndp_nbr_sol_t); - if (!(netif->flags & GNRC_NETIF2_FLAGS_HAS_L2ADDR)) { + if (!(netif->flags & GNRC_NETIF_FLAGS_HAS_L2ADDR)) { /* Set STALE NCE if link-layer has no addresses */ _nib_nc_add(&ipv6->src, netif->pid, GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE); @@ -848,7 +848,7 @@ static void _handle_nbr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, switch (opt->type) { case NDP_OPT_SL2A: #if GNRC_IPV6_NIB_CONF_6LR - if (gnrc_netif2_is_6lr(netif)) { + if (gnrc_netif_is_6lr(netif)) { DEBUG("nib: Storing SL2AO for later handling\n"); sl2ao = opt; break; @@ -871,7 +871,7 @@ static void _handle_nbr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, } reply_aro = _copy_and_handle_aro(netif, ipv6, nbr_sol, aro, sl2ao); /* check if target address is anycast */ - if (netif->ipv6.addrs_flags[tgt_idx] & GNRC_NETIF2_IPV6_ADDRS_FLAGS_ANYCAST) { + if (netif->ipv6.addrs_flags[tgt_idx] & GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST) { _send_delayed_nbr_adv(netif, &nbr_sol->tgt, &ipv6->dst, reply_aro); } else { @@ -882,7 +882,7 @@ static void _handle_nbr_sol(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, } } -static void _handle_nbr_adv(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, +static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_nbr_adv_t *nbr_adv, size_t icmpv6_len) { size_t tmp_len = icmpv6_len - sizeof(ndp_nbr_adv_t); @@ -970,7 +970,7 @@ static void _handle_nbr_adv(gnrc_netif2_t *netif, const ipv6_hdr_t *ipv6, /* reachability confirmed without TL2AO */ _set_reachable(netif, nce); } - if (!(netif->flags & GNRC_NETIF2_FLAGS_HAS_L2ADDR)) { + if (!(netif->flags & GNRC_NETIF_FLAGS_HAS_L2ADDR)) { _handle_adv_l2(netif, nce, (icmpv6_hdr_t *)nbr_adv, NULL); } #endif /* GNRC_IPV6_NIB_CONF_ARSM */ @@ -1004,7 +1004,7 @@ static gnrc_pktqueue_t *_alloc_queue_entry(gnrc_pktsnip_t *pkt) } #endif /* GNRC_IPV6_NIB_CONF_QUEUE_PKT */ -static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif2_t *netif, +static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_ipv6_nib_nc_t *nce, _nib_onl_entry_t *entry) { @@ -1106,33 +1106,33 @@ static void _handle_snd_na(gnrc_pktsnip_t *pkt) static void _handle_pfx_timeout(_nib_offl_entry_t *pfx) { - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(_nib_onl_get_if(pfx->next_hop)); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(pfx->next_hop)); uint32_t now = (xtimer_now_usec64() / US_PER_MS) & UINT32_MAX; - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); if (now >= pfx->valid_until) { evtimer_del(&_nib_evtimer, &pfx->pfx_timeout.event); - for (int i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { if (ipv6_addr_match_prefix(&netif->ipv6.addrs[i], &pfx->pfx) >= pfx->pfx_len) { - gnrc_netif2_ipv6_addr_remove(netif, &netif->ipv6.addrs[i]); + gnrc_netif_ipv6_addr_remove(netif, &netif->ipv6.addrs[i]); } } pfx->mode &= ~_PL; _nib_offl_clear(pfx); } else if (now >= pfx->pref_until) { - for (int i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { if (ipv6_addr_match_prefix(&netif->ipv6.addrs[i], &pfx->pfx) >= pfx->pfx_len) { - netif->ipv6.addrs_flags[i] &= ~GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK; - netif->ipv6.addrs_flags[i] |= GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_DEPRECATED; + netif->ipv6.addrs_flags[i] &= ~GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK; + netif->ipv6.addrs_flags[i] |= GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_DEPRECATED; } } _evtimer_add(pfx, GNRC_IPV6_NIB_PFX_TIMEOUT, &pfx->pfx_timeout, pfx->valid_until - now); } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } static void _handle_rtr_timeout(_nib_dr_entry_t *router) @@ -1160,10 +1160,10 @@ static void _handle_rtr_timeout(_nib_dr_entry_t *router) } } -void _handle_search_rtr(gnrc_netif2_t *netif) +void _handle_search_rtr(gnrc_netif_t *netif) { - gnrc_netif2_acquire(netif); - if (!(gnrc_netif2_is_rtr_adv(netif)) || gnrc_netif2_is_6ln(netif)) { + gnrc_netif_acquire(netif); + if (!(gnrc_netif_is_rtr_adv(netif)) || gnrc_netif_is_6ln(netif)) { uint32_t next_rs = _evtimer_lookup(netif, GNRC_IPV6_NIB_SEARCH_RTR); uint32_t interval = _get_next_rs_interval(netif); @@ -1176,17 +1176,17 @@ void _handle_search_rtr(gnrc_netif2_t *netif) netif->ipv6.rs_sent++; } if ((netif->ipv6.rs_sent < NDP_MAX_RS_NUMOF) || - gnrc_netif2_is_6ln(netif)) { + gnrc_netif_is_6ln(netif)) { /* 6LN will solicitate indefinitely */ _evtimer_add(netif, GNRC_IPV6_NIB_SEARCH_RTR, &netif->ipv6.search_rtr, interval); } } } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } -static void _handle_mtuo(gnrc_netif2_t *netif, const icmpv6_hdr_t *icmpv6, +static void _handle_mtuo(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_mtu_t *mtuo) { if ((mtuo->len != NDP_OPT_MTU_LEN) || (icmpv6->type != ICMPV6_RTR_ADV)) { @@ -1212,10 +1212,10 @@ static void _remove_prefix(const ipv6_addr_t *pfx, unsigned pfx_len) } #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C -static uint32_t _handle_pio(gnrc_netif2_t *netif, const icmpv6_hdr_t *icmpv6, +static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_pi_t *pio, _nib_abr_entry_t *abr) #else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ -static uint32_t _handle_pio(gnrc_netif2_t *netif, const icmpv6_hdr_t *icmpv6, +static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_pi_t *pio) #endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ { @@ -1246,7 +1246,7 @@ static uint32_t _handle_pio(gnrc_netif2_t *netif, const icmpv6_hdr_t *icmpv6, _auto_configure_addr(netif, &pio->prefix, pio->prefix_len); } #endif /* GNRC_IPV6_NIB_CONF_SLAAC || GNRC_IPV6_NIB_CONF_6LN */ - if ((pio->flags & NDP_OPT_PI_FLAGS_L) || gnrc_netif2_is_6lr(netif)) { + if ((pio->flags & NDP_OPT_PI_FLAGS_L) || gnrc_netif_is_6lr(netif)) { _nib_offl_entry_t *pfx; if (pio->valid_ltime.u32 == 0) { @@ -1289,12 +1289,12 @@ static uint32_t _handle_pio(gnrc_netif2_t *netif, const icmpv6_hdr_t *icmpv6, } #if GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC -static void _auto_configure_addr(gnrc_netif2_t *netif, const ipv6_addr_t *pfx, +static void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, uint8_t pfx_len) { ipv6_addr_t addr = IPV6_ADDR_UNSPECIFIED; int idx; - uint8_t flags = GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE; + uint8_t flags = GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE; DEBUG("nib: add address based on %s/%u automatically to interface %u\n", ipv6_addr_to_str(addr_str, pfx, sizeof(addr_str)), @@ -1302,10 +1302,10 @@ static void _auto_configure_addr(gnrc_netif2_t *netif, const ipv6_addr_t *pfx, #if GNRC_IPV6_NIB_CONF_6LN bool new_address = false; #endif /* GNRC_IPV6_NIB_CONF_6LN */ - gnrc_netif2_ipv6_get_iid(netif, (eui64_t *)&addr.u64[1]); + gnrc_netif_ipv6_get_iid(netif, (eui64_t *)&addr.u64[1]); ipv6_addr_init_prefix(&addr, pfx, pfx_len); - if ((idx = gnrc_netif2_ipv6_addr_idx(netif, &addr)) < 0) { - if ((idx = gnrc_netif2_ipv6_addr_add(netif, &addr, pfx_len, flags)) < 0) { + if ((idx = gnrc_netif_ipv6_addr_idx(netif, &addr)) < 0) { + if ((idx = gnrc_netif_ipv6_addr_add(netif, &addr, pfx_len, flags)) < 0) { DEBUG("nib: Can't add link-local address on interface %u\n", netif->pid); return; @@ -1316,13 +1316,13 @@ static void _auto_configure_addr(gnrc_netif2_t *netif, const ipv6_addr_t *pfx, } #if GNRC_IPV6_NIB_CONF_6LN - if (gnrc_netif2_is_6ln(netif)) { + if (gnrc_netif_is_6ln(netif)) { /* don't do this beforehand or risk a deadlock: - * * gnrc_netif2_ipv6_addr_add() adds VALID (i.e. manually configured + * * gnrc_netif_ipv6_addr_add() adds VALID (i.e. manually configured * addresses to the prefix list locking the NIB's mutex which is already * locked here) */ - netif->ipv6.addrs_flags[idx] &= ~GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK; - netif->ipv6.addrs_flags[idx] |= GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID; + netif->ipv6.addrs_flags[idx] &= ~GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK; + netif->ipv6.addrs_flags[idx] |= GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID; } #endif /* GNRC_IPV6_NIB_CONF_6LN */ (void)idx; @@ -1332,15 +1332,15 @@ static void _auto_configure_addr(gnrc_netif2_t *netif, const ipv6_addr_t *pfx, /* TODO: SHOULD delay join between 0 and MAX_RTR_SOLICITATION_DELAY * for SLAAC */ ipv6_addr_set_solicited_nodes(&addr, &addr); - if (gnrc_netif2_ipv6_group_join(netif, &addr) < 0) { + if (gnrc_netif_ipv6_group_join(netif, &addr) < 0) { DEBUG("nib: Can't join solicited-nodes of link-local address on " "interface %u\n", netif->pid); return; } #endif /* GNRC_IPV6_NIB_CONF_ARSM */ #if GNRC_IPV6_NIB_CONF_6LN - if (new_address && gnrc_netif2_is_6ln(netif) && - !gnrc_netif2_is_6lbr(netif)) { + if (new_address && gnrc_netif_is_6ln(netif) && + !gnrc_netif_is_6lbr(netif)) { _handle_rereg_address(&netif->ipv6.addrs[idx]); } #endif /* GNRC_IPV6_NIB_CONF_6LN */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c b/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c index 09b7245f910babb649284f01d971d37fb7eb5966..daf850ac49c996d7196bbf0813a64b39453e864e 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c @@ -18,7 +18,7 @@ #include <stdio.h> #include "net/gnrc/ipv6.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/ipv6/nib/nc.h" @@ -134,9 +134,9 @@ void gnrc_ipv6_nib_nc_print(gnrc_ipv6_nib_nc_t *entry) if (gnrc_ipv6_nib_nc_get_iface(entry) != KERNEL_PID_UNDEF) { printf("dev #%u ", gnrc_ipv6_nib_nc_get_iface(entry)); } - printf("lladdr %s ", gnrc_netif2_addr_to_str(entry->l2addr, - entry->l2addr_len, - addr_str)); + printf("lladdr %s ", gnrc_netif_addr_to_str(entry->l2addr, + entry->l2addr_len, + addr_str)); if (gnrc_ipv6_nib_nc_is_router(entry)) { printf("router"); } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c b/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c index 49abce66a5d633dcc872ac7e565e64ebf509b806..8645cc2bd883116d7851cad0c92bd940c7ff2bae 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c @@ -18,7 +18,7 @@ #include <stdio.h> #include "net/gnrc/ipv6/nib/pl.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "timex.h" #include "xtimer.h" @@ -49,25 +49,25 @@ int gnrc_ipv6_nib_pl_set(unsigned iface, if (dst == NULL) { res = -ENOMEM; } -#ifdef MODULE_GNRC_NETIF2 - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(iface); +#ifdef MODULE_GNRC_NETIF + gnrc_netif_t *netif = gnrc_netif_get_by_pid(iface); int idx; if (netif == NULL) { mutex_unlock(&_nib_mutex); return res; } - gnrc_netif2_acquire(netif); - if (!gnrc_netif2_is_6ln(netif) && - ((idx = gnrc_netif2_ipv6_addr_match(netif, pfx)) >= 0) && + gnrc_netif_acquire(netif); + if (!gnrc_netif_is_6ln(netif) && + ((idx = gnrc_netif_ipv6_addr_match(netif, pfx)) >= 0) && (ipv6_addr_match_prefix(&netif->ipv6.addrs[idx], pfx) >= pfx_len)) { dst->flags |= _PFX_ON_LINK; } - if (netif->ipv6.aac_mode == GNRC_NETIF2_AAC_AUTO) { + if (netif->ipv6.aac_mode == GNRC_NETIF_AAC_AUTO) { dst->flags |= _PFX_SLAAC; } #if GNRC_IPV6_NIB_CONF_6LBR && GNRC_IPV6_NIB_CONF_MULTIHOP_P6C - if (gnrc_netif2_is_6lbr(netif)) { + if (gnrc_netif_is_6lbr(netif)) { _nib_abr_entry_t *abr = NULL; while ((abr = _nib_abr_iter(abr))) { @@ -76,10 +76,10 @@ int gnrc_ipv6_nib_pl_set(unsigned iface, } } #endif - gnrc_netif2_release(netif); -#endif /* MODULE_GNRC_NETIF2 */ + gnrc_netif_release(netif); +#endif /* MODULE_GNRC_NETIF */ mutex_unlock(&_nib_mutex); -#if defined(MODULE_GNRC_NETIF2) && GNRC_IPV6_NIB_CONF_ROUTER +#if defined(MODULE_GNRC_NETIF) && GNRC_IPV6_NIB_CONF_ROUTER /* update prefixes down-stream */ _handle_snd_mc_ra(netif); #endif @@ -101,7 +101,7 @@ void gnrc_ipv6_nib_pl_del(unsigned iface, _nib_pl_remove(dst); mutex_unlock(&_nib_mutex); #if GNRC_IPV6_NIB_CONF_ROUTER - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(iface); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(iface); if (netif) { /* update prefixes down-stream */ diff --git a/sys/net/gnrc/network_layer/ndp2/gnrc_ndp2.c b/sys/net/gnrc/network_layer/ndp2/gnrc_ndp2.c index 4a2a1321ba7b2717040d838dab50fa7d3bda7ff4..7882833106e6b58ba377b34ad46d5125934ccb06 100644 --- a/sys/net/gnrc/network_layer/ndp2/gnrc_ndp2.c +++ b/sys/net/gnrc/network_layer/ndp2/gnrc_ndp2.c @@ -15,7 +15,7 @@ #include "net/gnrc/icmpv6.h" #include "net/gnrc/ipv6.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #ifdef MODULE_GNRC_SIXLOWPAN_ND #include "net/gnrc/sixlowpan/nd.h" #endif @@ -167,7 +167,7 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_sl2a_build(const uint8_t *l2addr, { assert((l2addr != NULL) && (l2addr_len != 0)); DEBUG("ndp2: building source link-layer address option (l2addr: %s)\n", - gnrc_netif2_addr_to_str(l2addr, l2addr_len, addr_str)); + gnrc_netif_addr_to_str(l2addr, l2addr_len, addr_str)); return _opt_l2a_build(l2addr, l2addr_len, next, NDP_OPT_SL2A); } @@ -177,7 +177,7 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_tl2a_build(const uint8_t *l2addr, { assert((l2addr != NULL) && (l2addr_len != 0)); DEBUG("ndp2: building target link-layer address option (l2addr: %s)\n", - gnrc_netif2_addr_to_str(l2addr, l2addr_len, addr_str)); + gnrc_netif_addr_to_str(l2addr, l2addr_len, addr_str)); return _opt_l2a_build(l2addr, l2addr_len, next, NDP_OPT_TL2A); } @@ -221,13 +221,13 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_mtu_build(uint32_t mtu, gnrc_pktsnip_t *next) return pkt; } -static gnrc_pktsnip_t *_build_headers(gnrc_netif2_t *netif, +static gnrc_pktsnip_t *_build_headers(gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst, gnrc_pktsnip_t *payload); -static inline size_t _get_l2src(const gnrc_netif2_t *netif, uint8_t *l2src); +static inline size_t _get_l2src(const gnrc_netif_t *netif, uint8_t *l2src); -void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, +void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst, gnrc_pktsnip_t *ext_opts) { @@ -247,11 +247,11 @@ void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, sizeof(addr_str))); DEBUG("tgt: %s, ", ipv6_addr_to_str(addr_str, tgt, sizeof(addr_str))); DEBUG("dst: %s)\n", ipv6_addr_to_str(addr_str, dst, sizeof(addr_str))); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); do { /* XXX hidden goto */ /* check if there is a fitting source address to target */ if (src == NULL) { - src = gnrc_netif2_ipv6_addr_best_src(netif, tgt, false); + src = gnrc_netif_ipv6_addr_best_src(netif, tgt, false); } /* add SL2AO based on interface and source address */ @@ -291,14 +291,14 @@ void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, break; } } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return; } while (0); gnrc_pktbuf_release(pkt); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } -void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, +void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *dst, bool supply_tl2a, gnrc_pktsnip_t *ext_opts) { @@ -313,15 +313,15 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, ipv6_addr_to_str(addr_str, tgt, sizeof(addr_str))); DEBUG("dst: %s, supply_tl2a: %d)\n", ipv6_addr_to_str(addr_str, dst, sizeof(addr_str)), supply_tl2a); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); do { /* XXX: hidden goto */ int tgt_idx; - if ((tgt_idx = gnrc_netif2_ipv6_addr_idx(netif, tgt)) < 0) { + if ((tgt_idx = gnrc_netif_ipv6_addr_idx(netif, tgt)) < 0) { DEBUG("ndp2: tgt not assigned to interface. Abort sending\n"); break; } - if (gnrc_netif2_is_rtr(netif) && gnrc_netif2_is_rtr_adv(netif)) { + if (gnrc_netif_is_rtr(netif) && gnrc_netif_is_rtr_adv(netif)) { adv_flags |= NDP_NBR_ADV_FLAGS_R; } if (ipv6_addr_is_unspecified(dst)) { @@ -354,7 +354,7 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, /* TODO: also check if the node provides proxy servies for tgt */ if ((pkt != NULL) && (netif->ipv6.addrs_flags[tgt_idx] & - GNRC_NETIF2_IPV6_ADDRS_FLAGS_ANYCAST)) { + GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST)) { /* TL2A is not supplied and tgt is not anycast */ adv_flags |= NDP_NBR_ADV_FLAGS_O; } @@ -380,14 +380,14 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif2_t *netif, break; } } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return; } while (0); gnrc_pktbuf_release(pkt); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } -void gnrc_ndp2_rtr_sol_send(gnrc_netif2_t *netif, const ipv6_addr_t *dst) +void gnrc_ndp2_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst) { gnrc_pktsnip_t *hdr, *pkt = NULL; @@ -398,12 +398,12 @@ void gnrc_ndp2_rtr_sol_send(gnrc_netif2_t *netif, const ipv6_addr_t *dst) DEBUG("ndp2: send router solicitation (iface: %" PRIkernel_pid ", dst: %s)\n", netif->pid, ipv6_addr_to_str(addr_str, dst, sizeof(addr_str))); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); do { /* XXX: hidden goto */ ipv6_addr_t *src = NULL; /* add SL2AO => check if there is a fitting source address to target */ - if ((src = gnrc_netif2_ipv6_addr_best_src(netif, dst, false)) != NULL) { + if ((src = gnrc_netif_ipv6_addr_best_src(netif, dst, false)) != NULL) { uint8_t l2src[8]; size_t l2src_len = _get_l2src(netif, l2src); if (l2src_len > 0) { @@ -437,14 +437,14 @@ void gnrc_ndp2_rtr_sol_send(gnrc_netif2_t *netif, const ipv6_addr_t *dst) break; } } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return; } while (0); gnrc_pktbuf_release(pkt); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); } -void gnrc_ndp2_rtr_adv_send(gnrc_netif2_t *netif, const ipv6_addr_t *src, +void gnrc_ndp2_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst, bool fin, gnrc_pktsnip_t *ext_opts) { @@ -461,9 +461,9 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif2_t *netif, const ipv6_addr_t *src, DEBUG("ndp2: send router advertisement (iface: %" PRIkernel_pid ", dst: %s%s\n", netif->pid, ipv6_addr_to_str(addr_str, dst, sizeof(addr_str)), fin ? ", final" : ""); - gnrc_netif2_acquire(netif); + gnrc_netif_acquire(netif); do { /* XXX: hidden goto */ - if (netif->flags & GNRC_NETIF2_FLAGS_IPV6_ADV_MTU) { + if (netif->flags & GNRC_NETIF_FLAGS_IPV6_ADV_MTU) { if ((hdr = gnrc_ndp2_opt_mtu_build(netif->ipv6.mtu, pkt)) == NULL) { DEBUG("ndp rtr: no space left in packet buffer\n"); break; @@ -473,7 +473,7 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif2_t *netif, const ipv6_addr_t *src, if (src == NULL) { /* get address from source selection algorithm. * Only link local addresses may be used (RFC 4861 section 4.1) */ - src = gnrc_netif2_ipv6_addr_best_src(netif, dst, true); + src = gnrc_netif_ipv6_addr_best_src(netif, dst, true); } /* add SL2A for source address */ if (src != NULL) { @@ -496,10 +496,10 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif2_t *netif, const ipv6_addr_t *src, pkt = hdr; } } - if (netif->flags & GNRC_NETIF2_FLAGS_IPV6_ADV_CUR_HL) { + if (netif->flags & GNRC_NETIF_FLAGS_IPV6_ADV_CUR_HL) { cur_hl = netif->cur_hl; } - if (netif->flags & GNRC_NETIF2_FLAGS_IPV6_ADV_REACH_TIME) { + if (netif->flags & GNRC_NETIF_FLAGS_IPV6_ADV_REACH_TIME) { if (netif->ipv6.reach_time_base > (3600 * MS_PER_SEC)) { /* reach_time > 1 hour */ reach_time = (3600 * MS_PER_SEC); @@ -508,15 +508,15 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif2_t *netif, const ipv6_addr_t *src, reach_time = netif->ipv6.reach_time_base; } } - if (netif->flags & GNRC_NETIF2_FLAGS_IPV6_ADV_RETRANS_TIMER) { + if (netif->flags & GNRC_NETIF_FLAGS_IPV6_ADV_RETRANS_TIMER) { retrans_timer = netif->ipv6.retrans_time; } if (!fin) { adv_ltime = netif->ipv6.rtr_ltime; } - if (netif->ipv6.aac_mode == GNRC_NETIF2_AAC_DHCP) { + if (netif->ipv6.aac_mode == GNRC_NETIF_AAC_DHCP) { flags |= NDP_RTR_ADV_FLAGS_M; - if (netif->flags & GNRC_NETIF2_FLAGS_IPV6_ADV_O_FLAG) { + if (netif->flags & GNRC_NETIF_FLAGS_IPV6_ADV_O_FLAG) { flags |= NDP_RTR_ADV_FLAGS_O; } } @@ -541,11 +541,11 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif2_t *netif, const ipv6_addr_t *src, break; } } - gnrc_netif2_release(netif); + gnrc_netif_release(netif); return; } while (0); gnrc_pktbuf_release(pkt); - gnrc_netif2_release(netif); + gnrc_netif_release(netif); #else (void)netif; (void)src; @@ -556,7 +556,7 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif2_t *netif, const ipv6_addr_t *src, #endif /* GNRC_IPV6_NIB_CONF_ROUTER */ } -static gnrc_pktsnip_t *_build_headers(gnrc_netif2_t *netif, +static gnrc_pktsnip_t *_build_headers(gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst, gnrc_pktsnip_t *payload) @@ -581,9 +581,9 @@ static gnrc_pktsnip_t *_build_headers(gnrc_netif2_t *netif, return l2hdr; } -static inline size_t _get_l2src(const gnrc_netif2_t *netif, uint8_t *l2src) +static inline size_t _get_l2src(const gnrc_netif_t *netif, uint8_t *l2src) { -#if GNRC_NETIF2_L2ADDR_MAXLEN > 0 +#if GNRC_NETIF_L2ADDR_MAXLEN > 0 memcpy(l2src, netif->l2addr, netif->l2addr_len); return netif->l2addr_len; #else diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c b/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c index 01946ce77a635bd12f7c8724f04b1d4f64bfed3f..0f47980c56efc477f50d60da169646a8a9322cca 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c @@ -21,7 +21,7 @@ #include "net/gnrc/netapi.h" #include "net/gnrc/netif/hdr.h" #include "net/gnrc/sixlowpan/frag.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/sixlowpan.h" #include "utlist.h" @@ -81,7 +81,7 @@ static gnrc_pktsnip_t *_build_frag_pkt(gnrc_pktsnip_t *pkt, size_t payload_len, return frag; } -static uint16_t _send_1st_fragment(gnrc_netif2_t *iface, gnrc_pktsnip_t *pkt, +static uint16_t _send_1st_fragment(gnrc_netif_t *iface, gnrc_pktsnip_t *pkt, size_t payload_len, size_t datagram_size) { gnrc_pktsnip_t *frag; @@ -138,7 +138,7 @@ static uint16_t _send_1st_fragment(gnrc_netif2_t *iface, gnrc_pktsnip_t *pkt, return local_offset; } -static uint16_t _send_nth_fragment(gnrc_netif2_t *iface, gnrc_pktsnip_t *pkt, +static uint16_t _send_nth_fragment(gnrc_netif_t *iface, gnrc_pktsnip_t *pkt, size_t payload_len, size_t datagram_size, uint16_t offset) { @@ -218,7 +218,7 @@ static uint16_t _send_nth_fragment(gnrc_netif2_t *iface, gnrc_pktsnip_t *pkt, void gnrc_sixlowpan_frag_send(gnrc_sixlowpan_msg_frag_t *fragment_msg) { - gnrc_netif2_t *iface = gnrc_netif2_get_by_pid(fragment_msg->pid); + gnrc_netif_t *iface = gnrc_netif_get_by_pid(fragment_msg->pid); uint16_t res; /* payload_len: actual size of the packet vs * datagram_size: size of the uncompressed IPv6 packet */ diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c b/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c index cb99b6a3d2b18f3248e8c9051ad74c225a4cefdd..271d4887aa1742809534a5737fa4caea3f636c4f 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c @@ -237,11 +237,11 @@ static bool _rbuf_update_ints(rbuf_t *entry, uint16_t offset, size_t frag_size) new->end = end; DEBUG("6lo rfrag: add interval (%" PRIu16 ", %" PRIu16 ") to entry (%s, ", - new->start, new->end, gnrc_netif2_addr_to_str(entry->src, - entry->src_len, - l2addr_str)); - DEBUG("%s, %u, %u)\n", gnrc_netif2_addr_to_str(entry->dst, entry->dst_len, - l2addr_str), + new->start, new->end, gnrc_netif_addr_to_str(entry->src, + entry->src_len, + l2addr_str)); + DEBUG("%s, %u, %u)\n", gnrc_netif_addr_to_str(entry->dst, entry->dst_len, + l2addr_str), (unsigned)entry->pkt->size, entry->tag); LL_PREPEND(entry->ints, new); @@ -259,11 +259,11 @@ static void _rbuf_gc(void) if ((rbuf[i].pkt != NULL) && ((now_usec - rbuf[i].arrival) > RBUF_TIMEOUT)) { DEBUG("6lo rfrag: entry (%s, ", - gnrc_netif2_addr_to_str(rbuf[i].src, rbuf[i].src_len, - l2addr_str)); + gnrc_netif_addr_to_str(rbuf[i].src, rbuf[i].src_len, + l2addr_str)); DEBUG("%s, %u, %u) timed out\n", - gnrc_netif2_addr_to_str(rbuf[i].dst, rbuf[i].dst_len, - l2addr_str), + gnrc_netif_addr_to_str(rbuf[i].dst, rbuf[i].dst_len, + l2addr_str), (unsigned)rbuf[i].pkt->size, rbuf[i].tag); gnrc_pktbuf_release(rbuf[i].pkt); @@ -287,11 +287,11 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len, (memcmp(rbuf[i].src, src, src_len) == 0) && (memcmp(rbuf[i].dst, dst, dst_len) == 0)) { DEBUG("6lo rfrag: entry %p (%s, ", (void *)(&rbuf[i]), - gnrc_netif2_addr_to_str(rbuf[i].src, rbuf[i].src_len, - l2addr_str)); + gnrc_netif_addr_to_str(rbuf[i].src, rbuf[i].src_len, + l2addr_str)); DEBUG("%s, %u, %u) found\n", - gnrc_netif2_addr_to_str(rbuf[i].dst, rbuf[i].dst_len, - l2addr_str), + gnrc_netif_addr_to_str(rbuf[i].dst, rbuf[i].dst_len, + l2addr_str), (unsigned)rbuf[i].pkt->size, rbuf[i].tag); rbuf[i].arrival = now_usec; return &(rbuf[i]); @@ -338,9 +338,9 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len, res->cur_size = 0; DEBUG("6lo rfrag: entry %p (%s, ", (void *)res, - gnrc_netif2_addr_to_str(res->src, res->src_len, l2addr_str)); + gnrc_netif_addr_to_str(res->src, res->src_len, l2addr_str)); DEBUG("%s, %u, %u) created\n", - gnrc_netif2_addr_to_str(res->dst, res->dst_len, l2addr_str), (unsigned)res->pkt->size, + gnrc_netif_addr_to_str(res->dst, res->dst_len, l2addr_str), (unsigned)res->pkt->size, res->tag); return res; diff --git a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c index 51c49621afc536e60e9fae85888213ae3e2c711a..eda15b6f946cf051c4b558ece73e675f236101bf 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c +++ b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c @@ -21,7 +21,7 @@ #include "net/gnrc/sixlowpan.h" #include "net/gnrc/sixlowpan/frag.h" #include "net/gnrc/sixlowpan/iphc.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/sixlowpan.h" #define ENABLE_DEBUG (0) @@ -192,7 +192,7 @@ static void _send(gnrc_pktsnip_t *pkt) { gnrc_netif_hdr_t *hdr; gnrc_pktsnip_t *pkt2; - gnrc_netif2_t *iface; + gnrc_netif_t *iface; /* datagram_size: pure IPv6 packet without 6LoWPAN dispatches or compression */ size_t datagram_size; @@ -217,7 +217,7 @@ static void _send(gnrc_pktsnip_t *pkt) } hdr = pkt2->data; - iface = gnrc_netif2_get_by_pid(hdr->if_pid); + iface = gnrc_netif_get_by_pid(hdr->if_pid); datagram_size = gnrc_pkt_len(pkt2->next); if (iface == NULL) { @@ -227,7 +227,7 @@ static void _send(gnrc_pktsnip_t *pkt) } #ifdef MODULE_GNRC_SIXLOWPAN_IPHC - if (iface->flags & GNRC_NETIF2_FLAGS_6LO_HC) { + if (iface->flags & GNRC_NETIF_FLAGS_6LO_HC) { if (!gnrc_sixlowpan_iphc_encode(pkt2)) { DEBUG("6lo: error on IPHC encoding\n"); gnrc_pktbuf_release(pkt2); diff --git a/sys/net/gnrc/pktdump/gnrc_pktdump.c b/sys/net/gnrc/pktdump/gnrc_pktdump.c index e7c22f97d405322fe9eec22a8e57dfe76beeef49..811aee30774793327e42e3fac15f3cdb76f4fcbf 100644 --- a/sys/net/gnrc/pktdump/gnrc_pktdump.c +++ b/sys/net/gnrc/pktdump/gnrc_pktdump.c @@ -52,7 +52,7 @@ static void _dump_snip(gnrc_pktsnip_t *pkt) printf("NETTYPE_UNDEF (%i)\n", pkt->type); od_hex_dump(pkt->data, pkt->size, OD_WIDTH_DEFAULT); break; -#ifdef MODULE_GNRC_NETIF2 +#ifdef MODULE_GNRC_NETIF case GNRC_NETTYPE_NETIF: printf("NETTYPE_NETIF (%i)\n", pkt->type); gnrc_netif_hdr_print(pkt->data); diff --git a/sys/net/gnrc/routing/rpl/gnrc_rpl.c b/sys/net/gnrc/routing/rpl/gnrc_rpl.c index 4b792cc43f3d2797b6a8562e30d0179fee8bab0d..f87a80da789acf671d0f38cdf49f6e260d608d68 100644 --- a/sys/net/gnrc/routing/rpl/gnrc_rpl.c +++ b/sys/net/gnrc/routing/rpl/gnrc_rpl.c @@ -16,7 +16,7 @@ #include "net/icmpv6.h" #include "net/ipv6.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc.h" #include "mutex.h" @@ -81,8 +81,8 @@ kernel_pid_t gnrc_rpl_init(kernel_pid_t if_pid) } /* register all_RPL_nodes multicast address */ - gnrc_netif2_ipv6_group_join(gnrc_netif2_get_by_pid(if_pid), - &ipv6_addr_all_rpl_nodes); + gnrc_netif_ipv6_group_join(gnrc_netif_get_by_pid(if_pid), + &ipv6_addr_all_rpl_nodes); gnrc_rpl_send_DIS(NULL, (ipv6_addr_t *) &ipv6_addr_all_rpl_nodes); return gnrc_rpl_pid; diff --git a/sys/net/gnrc/routing/rpl/gnrc_rpl_auto_init.c b/sys/net/gnrc/routing/rpl/gnrc_rpl_auto_init.c index d58f5ff5fc531112d7d49c2467c1589eacdc0dda..84de487cd9e6a615b2c10a41c311d0ca543c4963 100644 --- a/sys/net/gnrc/routing/rpl/gnrc_rpl_auto_init.c +++ b/sys/net/gnrc/routing/rpl/gnrc_rpl_auto_init.c @@ -28,14 +28,14 @@ void auto_init_gnrc_rpl(void) { #if (GNRC_NETIF_NUMOF == 1) - gnrc_netif2_t *netif = gnrc_netif2_iter(NULL); + gnrc_netif_t *netif = gnrc_netif_iter(NULL); assert(netif != NULL); DEBUG("auto_init_gnrc_rpl: initializing RPL on interface %" PRIkernel_pid "\n", netif->pid); gnrc_rpl_init(netif->pid); return; #elif defined(GNRC_RPL_DEFAULT_NETIF) - if (gnrc_netif2_get_by_pid(GNRC_RPL_DEFAULT_NETIF) != NULL) { + if (gnrc_netif_get_by_pid(GNRC_RPL_DEFAULT_NETIF) != NULL) { DEBUG("auto_init_gnrc_rpl: initializing RPL on interface %" PRIkernel_pid "\n", GNRC_RPL_DEFAULT_NETIF); gnrc_rpl_init(GNRC_RPL_DEFAULT_NETIF); diff --git a/sys/net/gnrc/routing/rpl/gnrc_rpl_control_messages.c b/sys/net/gnrc/routing/rpl/gnrc_rpl_control_messages.c index 080c84244917c172bef8da50f01ddb27e2f7a431..b18b3789863c1704ba1254d2b2c85d913fbb3bdf 100644 --- a/sys/net/gnrc/routing/rpl/gnrc_rpl_control_messages.c +++ b/sys/net/gnrc/routing/rpl/gnrc_rpl_control_messages.c @@ -20,7 +20,7 @@ #include "net/ipv6/hdr.h" #include "net/gnrc/icmpv6.h" #include "net/gnrc/ipv6.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc.h" #include "net/eui64.h" @@ -54,12 +54,12 @@ static char addr_str[IPV6_ADDR_MAX_STR_LEN]; #define GNRC_RPL_PRF_MASK (0x7) #define GNRC_RPL_PREFIX_AUTO_ADDRESS_BIT (1 << 6) -static gnrc_netif2_t *_find_interface_with_rpl_mcast(void) +static gnrc_netif_t *_find_interface_with_rpl_mcast(void) { - gnrc_netif2_t *netif = NULL; + gnrc_netif_t *netif = NULL; - while ((netif = gnrc_netif2_iter(netif))) { - for (unsigned i = 0; i < GNRC_NETIF2_IPV6_GROUPS_NUMOF; i++) { + while ((netif = gnrc_netif_iter(netif))) { + for (unsigned i = 0; i < GNRC_NETIF_IPV6_GROUPS_NUMOF; i++) { if (ipv6_addr_equal(&netif->ipv6.groups[i], &ipv6_addr_all_rpl_nodes)) { return netif; } @@ -71,7 +71,7 @@ static gnrc_netif2_t *_find_interface_with_rpl_mcast(void) void gnrc_rpl_send(gnrc_pktsnip_t *pkt, kernel_pid_t iface, ipv6_addr_t *src, ipv6_addr_t *dst, ipv6_addr_t *dodag_id) { - gnrc_netif2_t *netif; + gnrc_netif_t *netif; (void)dodag_id; gnrc_pktsnip_t *hdr; @@ -86,11 +86,11 @@ void gnrc_rpl_send(gnrc_pktsnip_t *pkt, kernel_pid_t iface, ipv6_addr_t *src, ip iface = netif->pid; } else { - netif = gnrc_netif2_get_by_pid(iface); + netif = gnrc_netif_get_by_pid(iface); } if (src == NULL) { - int src_idx = gnrc_netif2_ipv6_addr_match(netif, &ipv6_addr_link_local_prefix); + int src_idx = gnrc_netif_ipv6_addr_match(netif, &ipv6_addr_link_local_prefix); src = &netif->ipv6.addrs[src_idx]; @@ -397,16 +397,16 @@ bool _parse_options(int msg_type, gnrc_rpl_instance_t *inst, gnrc_rpl_opt_t *opt #endif gnrc_rpl_opt_prefix_info_t *pi = (gnrc_rpl_opt_prefix_info_t *) opt; /* check for the auto address-configuration flag */ - gnrc_netif2_t *netif = gnrc_netif2_get_by_pid(dodag->iface); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(dodag->iface); assert(netif != NULL); - if ((gnrc_netif2_ipv6_get_iid(netif, &iid) < 0) - && !(pi->LAR_flags & GNRC_RPL_PREFIX_AUTO_ADDRESS_BIT)) { + if ((gnrc_netif_ipv6_get_iid(netif, &iid) < 0) + && !(pi->LAR_flags & GNRC_RPL_PREFIX_AUTO_ADDRESS_BIT)) { break; } ipv6_addr_set_aiid(&pi->prefix, iid.uint8); - gnrc_netif2_ipv6_addr_add(netif, &pi->prefix, pi->prefix_len, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID); + gnrc_netif_ipv6_addr_add(netif, &pi->prefix, pi->prefix_len, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID); /* TODO: add to prefix list */ break; @@ -513,7 +513,7 @@ void gnrc_rpl_recv_DIO(gnrc_rpl_dio_t *dio, kernel_pid_t iface, ipv6_addr_t *src inst->of = gnrc_rpl_get_of_for_ocp(GNRC_RPL_DEFAULT_OCP); if (iface == KERNEL_PID_UNDEF) { - gnrc_netif2_t *netif = _find_interface_with_rpl_mcast(); + gnrc_netif_t *netif = _find_interface_with_rpl_mcast(); iface = netif->pid; assert(iface != KERNEL_PID_UNDEF); @@ -744,14 +744,14 @@ void gnrc_rpl_send_DAO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination, uint /* find my address */ ipv6_addr_t *me = NULL; - gnrc_netif2_t *netif = gnrc_netif2_get_by_ipv6_addr(&dodag->dodag_id); + gnrc_netif_t *netif = gnrc_netif_get_by_ipv6_addr(&dodag->dodag_id); int idx; if (netif == NULL) { DEBUG("RPL: no address configured\n"); return; } - idx = gnrc_netif2_ipv6_addr_idx(netif, &dodag->dodag_id); + idx = gnrc_netif_ipv6_addr_idx(netif, &dodag->dodag_id); me = &netif->ipv6.addrs[idx]; mutex_lock(&(gnrc_ipv6_fib_table.mtx_access)); diff --git a/sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c b/sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c index 633377afc858a99f8bff6ce0f9b8d8807c921d9a..7f8a7f0916c0022b2f471fadb85aca814feb37d1 100644 --- a/sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c +++ b/sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c @@ -18,7 +18,7 @@ #include <stdbool.h> #include "net/af.h" #include "net/gnrc/ipv6.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc/rpl/dodag.h" #include "net/gnrc/rpl/structs.h" #include "utlist.h" @@ -363,7 +363,7 @@ gnrc_rpl_instance_t *gnrc_rpl_root_instance_init(uint8_t instance_id, ipv6_addr_ return NULL; } - gnrc_netif2_t *netif; + gnrc_netif_t *netif; gnrc_rpl_instance_t *inst = NULL; gnrc_rpl_dodag_t *dodag = NULL; kernel_pid_t iface; @@ -374,7 +374,7 @@ gnrc_rpl_instance_t *gnrc_rpl_root_instance_init(uint8_t instance_id, ipv6_addr_ return NULL; } - if ((netif = gnrc_netif2_get_by_ipv6_addr(dodag_id)) == NULL) { + if ((netif = gnrc_netif_get_by_ipv6_addr(dodag_id)) == NULL) { DEBUG("RPL: no IPv6 address configured to match the given dodag id: %s\n", ipv6_addr_to_str(addr_str, dodag_id, sizeof(addr_str))); return NULL; diff --git a/sys/net/gnrc/routing/rpl/srh/gnrc_rpl_srh.c b/sys/net/gnrc/routing/rpl/srh/gnrc_rpl_srh.c index e8a109d379aa985895a7589521edead3a3ca45b9..3b1561f7b3f0102ee88ea75d8917c68162b3dbb8 100644 --- a/sys/net/gnrc/routing/rpl/srh/gnrc_rpl_srh.c +++ b/sys/net/gnrc/routing/rpl/srh/gnrc_rpl_srh.c @@ -13,7 +13,7 @@ */ #include <string.h> -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/ipv6/ext/rh.h" #include "net/gnrc/rpl/srh.h" @@ -73,7 +73,7 @@ int gnrc_rpl_srh_process(ipv6_hdr_t *ipv6, gnrc_rpl_srh_t *rh) tmp_addr_len = sizeof(ipv6_addr_t) - tmp_pref_elided; } memcpy(&tmp.u8[tmp_pref_elided], &addr_vec[k * compri_addr_len], tmp_addr_len); - if (gnrc_netif2_get_by_ipv6_addr(&tmp) != NULL) { + if (gnrc_netif_get_by_ipv6_addr(&tmp) != NULL) { if (found && ((k - found_pos) > 1)) { DEBUG("RPL SRH: found multiple addresses that belong to me - discard\n"); /* TODO send an ICMP Parameter Problem (Code 0) and discard the packet */ diff --git a/sys/shell/commands/Makefile b/sys/shell/commands/Makefile index 2c8da3187382eee948975c16f07b1df6aa3194d9..d20fb4ecaabbc46aebcbebbfaf3b3593d178e16c 100644 --- a/sys/shell/commands/Makefile +++ b/sys/shell/commands/Makefile @@ -23,8 +23,8 @@ endif ifneq (,$(filter at30tse75x,$(USEMODULE))) SRC += sc_at30tse75x.c endif -ifneq (,$(filter gnrc_netif2,$(USEMODULE))) - SRC += sc_gnrc_netif2.c +ifneq (,$(filter gnrc_netif,$(USEMODULE))) + SRC += sc_gnrc_netif.c endif ifneq (,$(filter fib,$(USEMODULE))) SRC += sc_fib.c diff --git a/sys/shell/commands/sc_ccnl.c b/sys/shell/commands/sc_ccnl.c index cad1ec3d06f0eeac1bee818765bf87afd7d41494..a4502bd8cec2f4a14aa1590592890bab23ad3510 100644 --- a/sys/shell/commands/sc_ccnl.c +++ b/sys/shell/commands/sc_ccnl.c @@ -20,13 +20,13 @@ #include "random.h" #include "sched.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "ccn-lite-riot.h" #include "ccnl-pkt-ndntlv.h" #define BUF_SIZE (64) -#define MAX_ADDR_LEN (GNRC_NETIF2_L2ADDR_MAXLEN) +#define MAX_ADDR_LEN (GNRC_NETIF_L2ADDR_MAXLEN) static unsigned char _int_buf[BUF_SIZE]; static unsigned char _cont_buf[BUF_SIZE]; @@ -56,7 +56,7 @@ int _ccnl_open(int argc, char **argv) /* check if given number is a valid netif PID */ int pid = atoi(argv[1]); - if (gnrc_netif2_get_by_pid(pid) == NULL) { + if (gnrc_netif_get_by_pid(pid) == NULL) { printf("%i is not a valid interface!\n", pid); return -1; } @@ -142,7 +142,7 @@ static struct ccnl_face_s *_intern_face_get(char *addr_str) /* initialize address with 0xFF for broadcast */ uint8_t relay_addr[MAX_ADDR_LEN]; memset(relay_addr, UINT8_MAX, MAX_ADDR_LEN); - size_t addr_len = gnrc_netif2_addr_from_str(addr_str, relay_addr); + size_t addr_len = gnrc_netif_addr_from_str(addr_str, relay_addr); if (addr_len == 0) { printf("Error: %s is not a valid link layer address\n", addr_str); diff --git a/sys/shell/commands/sc_fib.c b/sys/shell/commands/sc_fib.c index bb7303a771807c23ad62c7a5ff1e0210e07f93dd..511a76a396cc0eff75445b118bb9ba3c31d64b38 100644 --- a/sys/shell/commands/sc_fib.c +++ b/sys/shell/commands/sc_fib.c @@ -25,7 +25,7 @@ #include <stdlib.h> #include "thread.h" #include "net/af.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/fib.h" #include "net/gnrc/ipv6.h" @@ -165,7 +165,7 @@ int _fib_route_handler(int argc, char **argv) if (argc == 3) { if ((strcmp("flush", argv[1]) == 0)) { kernel_pid_t iface = atoi(argv[2]); - if (gnrc_netif2_get_by_pid(iface) != NULL) { + if (gnrc_netif_get_by_pid(iface) != NULL) { fib_flush(&gnrc_ipv6_fib_table, iface); printf("successfully flushed all entries for interface %" PRIu16"\n", iface); } @@ -189,9 +189,9 @@ int _fib_route_handler(int argc, char **argv) /* e.g. fibroute add <destination> via <next hop> */ if ((argc == 5) && (strcmp("add", argv[1]) == 0) && (strcmp("via", argv[3]) == 0)) { - size_t ifnum = gnrc_netif2_numof(); + size_t ifnum = gnrc_netif_numof(); if (ifnum == 1) { - gnrc_netif2_t *netif = gnrc_netif2_iter(NULL); + gnrc_netif_t *netif = gnrc_netif_iter(NULL); _fib_add(argv[2], argv[4], netif->pid, (uint32_t)FIB_LIFETIME_NO_EXPIRE); } @@ -206,9 +206,9 @@ int _fib_route_handler(int argc, char **argv) /* e.g. fibroute add <destination> via <next hop> lifetime <lifetime> */ if ((argc == 7) && (strcmp("add", argv[1]) == 0) && (strcmp("via", argv[3]) == 0) && (strcmp("lifetime", argv[5]) == 0)) { - size_t ifnum = gnrc_netif2_numof(); + size_t ifnum = gnrc_netif_numof(); if (ifnum == 1) { - gnrc_netif2_t *netif = gnrc_netif2_iter(NULL); + gnrc_netif_t *netif = gnrc_netif_iter(NULL); _fib_add(argv[2], argv[4], netif->pid, (uint32_t)atoi(argv[6])); } diff --git a/sys/shell/commands/sc_gnrc_ipv6_nib.c b/sys/shell/commands/sc_gnrc_ipv6_nib.c index 544f360e3256b62ca407e881b521e11079e0938d..aaab26da94f81516e0aff71a0009663639bafd6f 100644 --- a/sys/shell/commands/sc_gnrc_ipv6_nib.c +++ b/sys/shell/commands/sc_gnrc_ipv6_nib.c @@ -16,7 +16,7 @@ #include <stdio.h> #include "net/gnrc/ipv6/nib.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/ipv6/addr.h" static void _usage(char **argv); @@ -106,7 +106,7 @@ static int _nib_neigh(int argc, char **argv) return 1; } if ((argc > 5) && /* TODO also check if interface supports link-layers or not */ - (l2addr_len = gnrc_netif2_addr_from_str(argv[5], l2addr)) == 0) { + (l2addr_len = gnrc_netif_addr_from_str(argv[5], l2addr)) == 0) { _usage_nib_neigh(argv); return 1; } diff --git a/sys/shell/commands/sc_gnrc_netif2.c b/sys/shell/commands/sc_gnrc_netif.c similarity index 95% rename from sys/shell/commands/sc_gnrc_netif2.c rename to sys/shell/commands/sc_gnrc_netif.c index 731e9966c7bdb2ab04a9d60da3eff705aec677f2..c900db9bce874a5d95da0dc66e1f5320c4ab2a76 100644 --- a/sys/shell/commands/sc_gnrc_netif2.c +++ b/sys/shell/commands/sc_gnrc_netif.c @@ -22,7 +22,7 @@ #include "net/ipv6/addr.h" #include "net/gnrc.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/netif/hdr.h" #ifdef MODULE_NETSTATS @@ -84,7 +84,7 @@ static bool _is_number(char *str) static inline bool _is_iface(kernel_pid_t iface) { - return (gnrc_netif2_get_by_pid(iface) != NULL); + return (gnrc_netif_get_by_pid(iface) != NULL); } #ifdef MODULE_NETSTATS @@ -309,17 +309,17 @@ static void _netif_list_ipv6(ipv6_addr_t *addr, uint8_t flags) else { printf("global"); } - if (flags & GNRC_NETIF2_IPV6_ADDRS_FLAGS_ANYCAST) { + if (flags & GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST) { printf(" [anycast]"); } - switch (flags & GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK) { - case GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE: + switch (flags & GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK) { + case GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE: printf(" TNT"); break; - case GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_DEPRECATED: + case GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_DEPRECATED: printf(" DPR"); break; - case GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID: + case GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID: printf(" VAL"); break; } @@ -330,9 +330,9 @@ static void _netif_list_ipv6(ipv6_addr_t *addr, uint8_t flags) static void _netif_list(kernel_pid_t iface) { #ifdef MODULE_GNRC_IPV6 - ipv6_addr_t ipv6_addrs[GNRC_NETIF2_IPV6_ADDRS_NUMOF]; + ipv6_addr_t ipv6_addrs[GNRC_NETIF_IPV6_ADDRS_NUMOF]; #endif - uint8_t hwaddr[GNRC_NETIF2_L2ADDR_MAXLEN]; + uint8_t hwaddr[GNRC_NETIF_L2ADDR_MAXLEN]; uint16_t u16; int16_t i16; uint8_t u8; @@ -345,7 +345,7 @@ static void _netif_list(kernel_pid_t iface) if (res >= 0) { char hwaddr_str[res * 3]; printf(" HWaddr: %s ", - gnrc_netif2_addr_to_str(hwaddr, res, hwaddr_str)); + gnrc_netif_addr_to_str(hwaddr, res, hwaddr_str)); } res = gnrc_netapi_get(iface, NETOPT_CHANNEL, 0, &u16, sizeof(u16)); if (res >= 0) { @@ -364,7 +364,7 @@ static void _netif_list(kernel_pid_t iface) if (res >= 0) { char hwaddr_str[res * 3]; printf("Long HWaddr: "); - printf("%s ", gnrc_netif2_addr_to_str(hwaddr, res, hwaddr_str)); + printf("%s ", gnrc_netif_addr_to_str(hwaddr, res, hwaddr_str)); line_thresh++; } line_thresh = _newline(0U, line_thresh); @@ -447,7 +447,7 @@ static void _netif_list(kernel_pid_t iface) res = gnrc_netapi_get(iface, NETOPT_IPV6_ADDR, 0, ipv6_addrs, sizeof(ipv6_addrs)); if (res >= 0) { - uint8_t ipv6_addrs_flags[GNRC_NETIF2_IPV6_ADDRS_NUMOF]; + uint8_t ipv6_addrs_flags[GNRC_NETIF_IPV6_ADDRS_NUMOF]; memset(ipv6_addrs_flags, 0, sizeof(ipv6_addrs_flags)); /* assume it to succeed (otherwise array will stay 0) */ @@ -473,8 +473,8 @@ static void _netif_list(kernel_pid_t iface) for (unsigned i = 0; i < L2FILTER_LISTSIZE; i++) { if (filter[i].addr_len > 0) { char hwaddr_str[filter[i].addr_len * 3]; - gnrc_netif2_addr_to_str(filter[i].addr, filter[i].addr_len, - hwaddr_str); + gnrc_netif_addr_to_str(filter[i].addr, filter[i].addr_len, + hwaddr_str); printf(" %2i: %s\n", count++, hwaddr_str); } } @@ -596,8 +596,8 @@ static int _netif_set_flag(kernel_pid_t iface, netopt_t opt, static int _netif_set_addr(kernel_pid_t iface, netopt_t opt, char *addr_str) { - uint8_t addr[GNRC_NETIF2_L2ADDR_MAXLEN]; - size_t addr_len = gnrc_netif2_addr_from_str(addr_str, addr); + uint8_t addr[GNRC_NETIF_L2ADDR_MAXLEN]; + size_t addr_len = gnrc_netif_addr_from_str(addr_str, addr); if (addr_len == 0) { puts("error: unable to parse address.\n" @@ -728,8 +728,8 @@ static int _netif_set_encrypt_key(kernel_pid_t iface, netopt_t opt, char *key_st #ifdef MODULE_L2FILTER static int _netif_addrm_l2filter(kernel_pid_t iface, char *val, bool add) { - uint8_t addr[GNRC_NETIF2_L2ADDR_MAXLEN]; - size_t addr_len = gnrc_netif2_addr_from_str(val, addr); + uint8_t addr[GNRC_NETIF_L2ADDR_MAXLEN]; + size_t addr_len = gnrc_netif_addr_from_str(val, addr); if ((addr_len == 0) || (addr_len > L2FILTER_ADDR_MAXLEN)) { puts("error: given address is invalid"); @@ -866,7 +866,7 @@ static int _netif_add(char *cmd_name, kernel_pid_t iface, int argc, char **argv) } type = _UNICAST; char *addr_str = argv[0]; ipv6_addr_t addr; - uint16_t flags = GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID; + uint16_t flags = GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID; uint8_t prefix_len; if (argc > 1) { @@ -900,7 +900,7 @@ static int _netif_add(char *cmd_name, kernel_pid_t iface, int argc, char **argv) } else { if (type == _ANYCAST) { - flags |= GNRC_NETIF2_IPV6_ADDRS_FLAGS_ANYCAST; + flags |= GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST; } flags |= (prefix_len << 8U); if (gnrc_netapi_set(iface, NETOPT_IPV6_ADDR, flags, &addr, @@ -964,10 +964,10 @@ static int _netif_del(kernel_pid_t iface, char *addr_str) /* shell commands */ #ifdef MODULE_GNRC_TXTSND -int _gnrc_netif2_send(int argc, char **argv) +int _gnrc_netif_send(int argc, char **argv) { kernel_pid_t iface; - uint8_t addr[GNRC_NETIF2_L2ADDR_MAXLEN]; + uint8_t addr[GNRC_NETIF_L2ADDR_MAXLEN]; size_t addr_len; gnrc_pktsnip_t *pkt, *hdr; gnrc_netif_hdr_t *nethdr; @@ -987,7 +987,7 @@ int _gnrc_netif2_send(int argc, char **argv) } /* parse address */ - addr_len = gnrc_netif2_addr_from_str(argv[2], addr); + addr_len = gnrc_netif_addr_from_str(argv[2], addr); if (addr_len == 0) { if (strcmp(argv[2], "bcast") == 0) { @@ -1025,12 +1025,12 @@ int _gnrc_netif2_send(int argc, char **argv) } #endif -int _gnrc_netif2_config(int argc, char **argv) +int _gnrc_netif_config(int argc, char **argv) { if (argc < 2) { - gnrc_netif2_t *netif = NULL; + gnrc_netif_t *netif = NULL; - while ((netif = gnrc_netif2_iter(netif))) { + while ((netif = gnrc_netif_iter(netif))) { _netif_list(netif->pid); } diff --git a/sys/shell/commands/sc_gnrc_rpl.c b/sys/shell/commands/sc_gnrc_rpl.c index fc2dda8ef4e6f8f54208848c91569ac1ecbe95c4..7167b877d834a39d76b8d784683225d7dcc8d603 100644 --- a/sys/shell/commands/sc_gnrc_rpl.c +++ b/sys/shell/commands/sc_gnrc_rpl.c @@ -17,7 +17,7 @@ #include <string.h> #include <stdio.h> -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/rpl.h" #include "net/gnrc/rpl/structs.h" #include "net/gnrc/rpl/dodag.h" @@ -32,7 +32,7 @@ int _gnrc_rpl_init(char *arg) { kernel_pid_t iface_pid = atoi(arg); - if (gnrc_netif2_get_by_pid(iface_pid) == NULL) { + if (gnrc_netif_get_by_pid(iface_pid) == NULL) { puts("unknown interface specified"); return 1; } diff --git a/sys/shell/commands/sc_icmpv6_echo.c b/sys/shell/commands/sc_icmpv6_echo.c index 5ac65923b4abcdef3cad064de45bf46e58f82b35..f7b7a674c3ace3584cf2d2e14b0ec2c8e39a0e90 100644 --- a/sys/shell/commands/sc_icmpv6_echo.c +++ b/sys/shell/commands/sc_icmpv6_echo.c @@ -28,7 +28,7 @@ #include "net/gnrc/ipv6/nib/nc.h" #endif #include "net/gnrc/ipv6/hdr.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc.h" #include "thread.h" #include "utlist.h" @@ -203,11 +203,11 @@ int _icmpv6_ping(int argc, char **argv) } if (ipv6_addr_is_link_local(&addr) || (src_iface != KERNEL_PID_UNDEF)) { - size_t ifnum = gnrc_netif2_numof(); + size_t ifnum = gnrc_netif_numof(); if (src_iface == KERNEL_PID_UNDEF) { if (ifnum == 1) { - src_iface = gnrc_netif2_iter(NULL)->pid; + src_iface = gnrc_netif_iter(NULL)->pid; } else { puts("error: link local target needs interface parameter (use \"<address>%<ifnum>\")\n"); @@ -215,7 +215,7 @@ int _icmpv6_ping(int argc, char **argv) } } else { - if (gnrc_netif2_get_by_pid(src_iface) == NULL) { + if (gnrc_netif_get_by_pid(src_iface) == NULL) { printf("error: %"PRIkernel_pid" is not a valid interface.\n", src_iface); return 1; } diff --git a/sys/shell/commands/shell_commands.c b/sys/shell/commands/shell_commands.c index e61b9e2552dd814299fa4bb7b8482d4fa39a17d5..75e796d61b0f23270fe63189cd12b8c5ae228abb 100644 --- a/sys/shell/commands/shell_commands.c +++ b/sys/shell/commands/shell_commands.c @@ -88,10 +88,10 @@ extern int _random_get(int argc, char **argv); extern int _gnrc_ipv6_nib(int argc, char **argv); #endif -#ifdef MODULE_GNRC_NETIF2 -extern int _gnrc_netif2_config(int argc, char **argv); +#ifdef MODULE_GNRC_NETIF +extern int _gnrc_netif_config(int argc, char **argv); #ifdef MODULE_GNRC_TXTSND -extern int _gnrc_netif2_send(int argc, char **argv); +extern int _gnrc_netif_send(int argc, char **argv); #endif #endif @@ -191,10 +191,10 @@ const shell_command_t _shell_command_list[] = { #ifdef MODULE_GNRC_IPV6_NIB {"nib", "Configure neighbor information base", _gnrc_ipv6_nib}, #endif -#ifdef MODULE_GNRC_NETIF2 - {"ifconfig", "Configure network interfaces", _gnrc_netif2_config}, +#ifdef MODULE_GNRC_NETIF + {"ifconfig", "Configure network interfaces", _gnrc_netif_config}, #ifdef MODULE_GNRC_TXTSND - {"txtsnd", "Sends a custom string as is over the link layer", _gnrc_netif2_send }, + {"txtsnd", "Sends a custom string as is over the link layer", _gnrc_netif_send }, #endif #endif #ifdef MODULE_FIB diff --git a/tests/driver_kw2xrf/main.c b/tests/driver_kw2xrf/main.c index aba18b1b86d3a486a453b3b5f1ecb1f259316c9f..99ee100d1f951793a48e71ed40d9abcc76d36b30 100644 --- a/tests/driver_kw2xrf/main.c +++ b/tests/driver_kw2xrf/main.c @@ -49,7 +49,7 @@ static void _set_test_mode(int argc, char **argv, uint8_t mode) if (_is_number(argv[1])) { kernel_pid_t dev = atoi(argv[1]); - if (gnrc_netif2_get_by_pid(dev)) { + if (gnrc_netif_get_by_pid(dev)) { gnrc_netapi_set(dev, NETOPT_RF_TESTMODE, 0, (void *)&mode, sizeof(mode)); return; } diff --git a/tests/gnrc_ipv6_ext/main.c b/tests/gnrc_ipv6_ext/main.c index 861147451aebf55a912e19e04067e89526000666..81ff16a7a3911382bd48021bf803a0b6e31b523f 100644 --- a/tests/gnrc_ipv6_ext/main.c +++ b/tests/gnrc_ipv6_ext/main.c @@ -28,15 +28,15 @@ #include "net/gnrc/pktbuf.h" #include "net/gnrc/netreg.h" #include "net/gnrc/netapi.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/netif/hdr.h" static void _init_interface(void) { - gnrc_netif2_t *iface; + gnrc_netif_t *iface; ipv6_addr_t addr = IPV6_ADDR_UNSPECIFIED; - iface = gnrc_netif2_iter(NULL); + iface = gnrc_netif_iter(NULL); addr.u8[0] = 0xfd; addr.u8[1] = 0x01; @@ -54,7 +54,7 @@ static void _init_interface(void) static void _send_packet_raw(void) { - gnrc_netif2_t *iface = gnrc_netif2_iter(NULL); + gnrc_netif_t *iface = gnrc_netif_iter(NULL); gnrc_netif_hdr_t netif_hdr; @@ -128,7 +128,7 @@ static void _send_packet_raw(void) static void _send_packet_parsed(void) { - gnrc_netif2_t *iface = gnrc_netif2_iter(NULL); + gnrc_netif_t *iface = gnrc_netif_iter(NULL); gnrc_netif_hdr_t netif_hdr; diff --git a/tests/gnrc_ipv6_nib/Makefile b/tests/gnrc_ipv6_nib/Makefile index 908369ad8d138f7ed8fc8fe8ef29dd777eb342af..c1666cabaaa1ee762b0395687585004d84b0837b 100644 --- a/tests/gnrc_ipv6_nib/Makefile +++ b/tests/gnrc_ipv6_nib/Makefile @@ -7,7 +7,7 @@ BOARD_INSUFFICIENT_MEMORY := chronos nucleo32-f031 nucleo32-f042 nucleo32-l031 \ USEMODULE += gnrc_ipv6 USEMODULE += gnrc_ipv6_nib -USEMODULE += gnrc_netif2 +USEMODULE += gnrc_netif USEMODULE += embunit USEMODULE += netdev_eth USEMODULE += netdev_test diff --git a/tests/gnrc_ipv6_nib/common.h b/tests/gnrc_ipv6_nib/common.h index f7c9de5388e27a0dd81a629b43ee9cd913d557a3..265801c9f1ce292d079048423ff9073893eacae9 100644 --- a/tests/gnrc_ipv6_nib/common.h +++ b/tests/gnrc_ipv6_nib/common.h @@ -22,7 +22,7 @@ #include <stdio.h> #include "net/gnrc.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -35,7 +35,7 @@ extern "C" { #define _LL4 (0xf7) #define _LL5 (0x26) -extern gnrc_netif2_t *_mock_netif; +extern gnrc_netif_t *_mock_netif; void _tests_init(void); int _mock_netif_get(gnrc_netapi_opt_t *opt); diff --git a/tests/gnrc_ipv6_nib/main.c b/tests/gnrc_ipv6_nib/main.c index a1ee3c8fc553b3cf827759b3aef24c76d686c155..7365218ce2d868a485c4ec2400513d1214f323ec 100644 --- a/tests/gnrc_ipv6_nib/main.c +++ b/tests/gnrc_ipv6_nib/main.c @@ -29,7 +29,7 @@ #include "net/gnrc.h" #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ipv6/nib/nc.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/ndp.h" #include "sched.h" @@ -75,12 +75,12 @@ static inline size_t ceil8(size_t size); static void _set_up(void) { _common_set_up(); - gnrc_netif2_acquire(_mock_netif); + gnrc_netif_acquire(_mock_netif); /* reset some fields not set by the nib interface initializer */ _mock_netif->ipv6.mtu = ETHERNET_DATA_LEN; - _mock_netif->cur_hl = GNRC_NETIF2_DEFAULT_HL; - gnrc_netif2_ipv6_addr_remove(_mock_netif, &_loc_gb); - gnrc_netif2_release(_mock_netif); + _mock_netif->cur_hl = GNRC_NETIF_DEFAULT_HL; + gnrc_netif_ipv6_addr_remove(_mock_netif, &_loc_gb); + gnrc_netif_release(_mock_netif); memset(_buffer, 0, sizeof(_buffer)); gnrc_pktbuf_init(); /* remove messages */ @@ -91,7 +91,7 @@ static void _set_up(void) } static void test_get_next_hop_l2addr__EHOSTUNREACH(const ipv6_addr_t *dst, - gnrc_netif2_t *netif, + gnrc_netif_t *netif, bool on_link) { ipv6_addr_t addr; @@ -107,9 +107,9 @@ static void test_get_next_hop_l2addr__EHOSTUNREACH(const ipv6_addr_t *dst, } else if (on_link) { /* add _rem_gb prefix as on-link prefix */ - TEST_ASSERT(gnrc_netif2_ipv6_addr_add(_mock_netif, &addr, + TEST_ASSERT(gnrc_netif_ipv6_addr_add(_mock_netif, &addr, _REM_GB_PFX_LEN, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID) >= 0); + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID) >= 0); } else { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_ft_add(NULL, 0, &_rem_ll, @@ -158,7 +158,7 @@ static void test_get_next_hop_l2addr__EHOSTUNREACH(const ipv6_addr_t *dst, gnrc_pktbuf_release(pkt); TEST_ASSERT(gnrc_pktbuf_is_empty()); } - gnrc_netif2_ipv6_addr_remove(_mock_netif, &addr); + gnrc_netif_ipv6_addr_remove(_mock_netif, &addr); } static void test_get_next_hop_l2addr__link_local_EHOSTUNREACH_no_iface(void) @@ -863,11 +863,11 @@ typedef struct { uint8_t cur_hl; } _netif_exp_t; -static uint8_t _netif_addr_count(const gnrc_netif2_t *netif) +static uint8_t _netif_addr_count(const gnrc_netif_t *netif) { unsigned count = 0U; - for (int i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { if (netif->ipv6.addrs_flags[i] != 0) { count++; } @@ -875,7 +875,7 @@ static uint8_t _netif_addr_count(const gnrc_netif2_t *netif) return count; } -static inline void _get_netif_exp(const gnrc_netif2_t *netif, +static inline void _get_netif_exp(const gnrc_netif_t *netif, _netif_exp_t *exp) { exp->reach_time_base = netif->ipv6.reach_time_base; @@ -1033,7 +1033,7 @@ static void test_handle_pkt__rtr_adv__success(uint8_t rtr_adv_flags, _netif_exp_t exp_netif; _get_netif_exp(_mock_netif, &exp_netif); - TEST_ASSERT(gnrc_netif2_ipv6_addr_idx(_mock_netif, &_loc_gb) < 0); + TEST_ASSERT(gnrc_netif_ipv6_addr_idx(_mock_netif, &_loc_gb) < 0); gnrc_ipv6_nib_handle_pkt(_mock_netif, ipv6, icmpv6, icmpv6_len); if (set_rtr_adv_fields) { while (gnrc_ipv6_nib_ft_iter(NULL, 0, &state, &route)) { @@ -1096,13 +1096,13 @@ static void test_handle_pkt__rtr_adv__success(uint8_t rtr_adv_flags, state = NULL; if (pio) { if (pio_flags & NDP_OPT_PI_FLAGS_A) { - TEST_ASSERT_MESSAGE(gnrc_netif2_ipv6_addr_idx(_mock_netif, - &_loc_gb) >= 0, + TEST_ASSERT_MESSAGE(gnrc_netif_ipv6_addr_idx(_mock_netif, + &_loc_gb) >= 0, "Address was not configured by PIO"); } else { - TEST_ASSERT_MESSAGE(gnrc_netif2_ipv6_addr_idx(_mock_netif, - &_loc_gb) < 0, + TEST_ASSERT_MESSAGE(gnrc_netif_ipv6_addr_idx(_mock_netif, + &_loc_gb) < 0, "Address was configured by PIO, " "but A flag was set"); } @@ -1205,13 +1205,13 @@ static void test_handle_pkt__rtr_adv__success_sl2ao_mtuo_pio_LA(void) static void test_change_rtr_adv_iface(void) { - TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF2_FLAGS_IPV6_RTR_ADV), + TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF_FLAGS_IPV6_RTR_ADV), "RTR_ADV was unexpectedly set"); gnrc_ipv6_nib_change_rtr_adv_iface(_mock_netif, true); - TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF2_FLAGS_IPV6_RTR_ADV), + TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF_FLAGS_IPV6_RTR_ADV), "RTR_ADV was unexpectedly changed"); gnrc_ipv6_nib_change_rtr_adv_iface(_mock_netif, false); - TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF2_FLAGS_IPV6_RTR_ADV), + TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF_FLAGS_IPV6_RTR_ADV), "RTR_ADV was unexpectedly changed"); TEST_ASSERT_EQUAL_INT(0, msg_avail()); } diff --git a/tests/gnrc_ipv6_nib/mockup_netif.c b/tests/gnrc_ipv6_nib/mockup_netif.c index d36f9d6b430eb3ec38020feda6b1be2a6c6a2cc9..4c6ccb5c7f7d6221d444377440f43fd4a03324d0 100644 --- a/tests/gnrc_ipv6_nib/mockup_netif.c +++ b/tests/gnrc_ipv6_nib/mockup_netif.c @@ -18,15 +18,15 @@ #include "net/gnrc.h" #include "net/ethernet.h" #include "net/gnrc/ipv6/nib.h" -#include "net/gnrc/netif2/ethernet.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/ethernet.h" +#include "net/gnrc/netif/internal.h" #include "net/netdev_test.h" #include "sched.h" #include "thread.h" #define _MSG_QUEUE_SIZE (2) -gnrc_netif2_t *_mock_netif = NULL; +gnrc_netif_t *_mock_netif = NULL; static netdev_test_t _mock_netdev; static char _mock_netif_stack[THREAD_STACKSIZE_DEFAULT]; @@ -37,9 +37,9 @@ void _common_set_up(void) { assert(_mock_netif != NULL); gnrc_ipv6_nib_init(); - gnrc_netif2_acquire(_mock_netif); + gnrc_netif_acquire(_mock_netif); gnrc_ipv6_nib_init_iface(_mock_netif); - gnrc_netif2_release(_mock_netif); + gnrc_netif_release(_mock_netif); } int _get_device_type(netdev_t *dev, void *value, size_t max_len) @@ -78,16 +78,16 @@ void _tests_init(void) _get_max_packet_size); netdev_test_set_get_cb(&_mock_netdev, NETOPT_ADDRESS, _get_address); - _mock_netif = gnrc_netif2_ethernet_create( - _mock_netif_stack, THREAD_STACKSIZE_DEFAULT, GNRC_NETIF2_PRIO, + _mock_netif = gnrc_netif_ethernet_create( + _mock_netif_stack, THREAD_STACKSIZE_DEFAULT, GNRC_NETIF_PRIO, "mockup_eth", &_mock_netdev.netdev ); assert(_mock_netif != NULL); /* we do not want to test for SLAAC here so just assure the configured * address is valid */ assert(!ipv6_addr_is_unspecified(&_mock_netif->ipv6.addrs[0])); - _mock_netif->ipv6.addrs_flags[0] &= ~GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_MASK; - _mock_netif->ipv6.addrs_flags[0] |= GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID; + _mock_netif->ipv6.addrs_flags[0] &= ~GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK; + _mock_netif->ipv6.addrs_flags[0] |= GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID; gnrc_netreg_entry_init_pid(&dumper, GNRC_NETREG_DEMUX_CTX_ALL, sched_active_pid); gnrc_netreg_register(GNRC_NETTYPE_NDP2, &dumper); diff --git a/tests/gnrc_ipv6_nib_6ln/Makefile b/tests/gnrc_ipv6_nib_6ln/Makefile index 8642c81a9148b3066adcbe509be41d2a846120e3..fc85e184cf9a87b4d06e9e43842cbabefcc3cacc 100644 --- a/tests/gnrc_ipv6_nib_6ln/Makefile +++ b/tests/gnrc_ipv6_nib_6ln/Makefile @@ -10,7 +10,7 @@ USEMODULE += gnrc_ipv6 USEMODULE += gnrc_sixlowpan USEMODULE += gnrc_sixlowpan_ctx USEMODULE += gnrc_ipv6_nib_6ln -USEMODULE += gnrc_netif2 +USEMODULE += gnrc_netif USEMODULE += embunit USEMODULE += netdev_ieee802154 USEMODULE += netdev_test diff --git a/tests/gnrc_ipv6_nib_6ln/common.h b/tests/gnrc_ipv6_nib_6ln/common.h index 5862bad963970cfa5a1cda9f49ae6cca55f02d5a..8338c70610bcf721892f17d67be70ec225d8db83 100644 --- a/tests/gnrc_ipv6_nib_6ln/common.h +++ b/tests/gnrc_ipv6_nib_6ln/common.h @@ -22,7 +22,7 @@ #include <stdio.h> #include "net/gnrc.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -37,7 +37,7 @@ extern "C" { #define _LL6 (0xef) #define _LL7 (0xa4) -extern gnrc_netif2_t *_mock_netif; +extern gnrc_netif_t *_mock_netif; void _tests_init(void); int _mock_netif_get(gnrc_netapi_opt_t *opt); diff --git a/tests/gnrc_ipv6_nib_6ln/main.c b/tests/gnrc_ipv6_nib_6ln/main.c index a034888272eb4e95b961437ca623ed17c2aac9f8..6126eaf6cec02f604934520f8b2874748bb1db8d 100644 --- a/tests/gnrc_ipv6_nib_6ln/main.c +++ b/tests/gnrc_ipv6_nib_6ln/main.c @@ -29,7 +29,7 @@ #include "net/gnrc.h" #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ipv6/nib/nc.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc/sixlowpan/ctx.h" #include "net/gnrc/sixlowpan/nd.h" #include "net/ndp.h" @@ -84,13 +84,13 @@ static inline size_t ceil8(size_t size); static void _set_up(void) { _common_set_up(); - gnrc_netif2_acquire(_mock_netif); + gnrc_netif_acquire(_mock_netif); /* reset some fields not set by the nib interface initializer */ _mock_netif->ipv6.mtu = IPV6_MIN_MTU; - _mock_netif->cur_hl = GNRC_NETIF2_DEFAULT_HL; - gnrc_netif2_ipv6_addr_remove(_mock_netif, &_loc_gb); - _mock_netif->flags &= ~GNRC_NETIF2_FLAGS_6LO_ADDRS_REG; - gnrc_netif2_release(_mock_netif); + _mock_netif->cur_hl = GNRC_NETIF_DEFAULT_HL; + gnrc_netif_ipv6_addr_remove(_mock_netif, &_loc_gb); + _mock_netif->flags &= ~GNRC_NETIF_FLAGS_6LO_ADDRS_REG; + gnrc_netif_release(_mock_netif); memset(_buffer, 0, sizeof(_buffer)); gnrc_pktbuf_init(); /* remove messages */ @@ -630,13 +630,13 @@ static void test_handle_pkt__nbr_adv__aro_not_my_eui64(void) SIXLOWPAN_ND_STATUS_SUCCESS); int idx; - idx = gnrc_netif2_ipv6_addr_add(_mock_netif, &_loc_gb, _LOC_GB_PFX_LEN, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE); + idx = gnrc_netif_ipv6_addr_add(_mock_netif, &_loc_gb, _LOC_GB_PFX_LEN, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE); TEST_ASSERT(idx >= 0); gnrc_ipv6_nib_handle_pkt(_mock_netif, ipv6, icmpv6, icmpv6_len); TEST_ASSERT(ipv6_addr_equal(&_loc_gb, &_mock_netif->ipv6.addrs[idx])); TEST_ASSERT(_mock_netif->ipv6.addrs_flags[idx] & - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE); + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE); } static void test_handle_pkt__nbr_adv__aro_duplicate(void) @@ -648,11 +648,11 @@ static void test_handle_pkt__nbr_adv__aro_duplicate(void) TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_nc_set(&_rem_ll, _mock_netif->pid, _rem_l2, sizeof(_rem_l2))); - idx = gnrc_netif2_ipv6_addr_add(_mock_netif, &_loc_gb, _LOC_GB_PFX_LEN, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_TENTATIVE); + idx = gnrc_netif_ipv6_addr_add(_mock_netif, &_loc_gb, _LOC_GB_PFX_LEN, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE); TEST_ASSERT(idx >= 0); gnrc_ipv6_nib_handle_pkt(_mock_netif, ipv6, icmpv6, icmpv6_len); - TEST_ASSERT(gnrc_netif2_ipv6_addr_idx(_mock_netif, &_loc_gb) < 0); + TEST_ASSERT(gnrc_netif_ipv6_addr_idx(_mock_netif, &_loc_gb) < 0); } static size_t _set_rtr_sol(const ipv6_addr_t *ipv6_src, @@ -792,11 +792,11 @@ typedef struct { uint8_t cur_hl; } _netif_exp_t; -static uint8_t _netif_addr_count(const gnrc_netif2_t *netif) +static uint8_t _netif_addr_count(const gnrc_netif_t *netif) { unsigned count = 0U; - for (int i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; i++) { + for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { if (netif->ipv6.addrs_flags[i] != 0) { count++; } @@ -804,7 +804,7 @@ static uint8_t _netif_addr_count(const gnrc_netif2_t *netif) return count; } -static inline void _get_netif_exp(const gnrc_netif2_t *netif, +static inline void _get_netif_exp(const gnrc_netif_t *netif, _netif_exp_t *exp) { exp->retrans_timer = netif->ipv6.retrans_time; @@ -987,7 +987,7 @@ static void test_handle_pkt__rtr_adv__success(uint8_t rtr_adv_flags, _netif_exp_t exp_netif; _get_netif_exp(_mock_netif, &exp_netif); - TEST_ASSERT(gnrc_netif2_ipv6_addr_idx(_mock_netif, &_loc_gb) < 0); + TEST_ASSERT(gnrc_netif_ipv6_addr_idx(_mock_netif, &_loc_gb) < 0); gnrc_ipv6_nib_handle_pkt(_mock_netif, ipv6, icmpv6, icmpv6_len); if (set_rtr_adv_fields) { while (gnrc_ipv6_nib_ft_iter(NULL, 0, &state, &route)) { @@ -1054,13 +1054,13 @@ static void test_handle_pkt__rtr_adv__success(uint8_t rtr_adv_flags, state = NULL; if (pio) { if (pio_flags & NDP_OPT_PI_FLAGS_A) { - TEST_ASSERT_MESSAGE(gnrc_netif2_ipv6_addr_idx(_mock_netif, - &_loc_gb) >= 0, + TEST_ASSERT_MESSAGE(gnrc_netif_ipv6_addr_idx(_mock_netif, + &_loc_gb) >= 0, "Address was not configured by PIO"); } else { - TEST_ASSERT_MESSAGE(gnrc_netif2_ipv6_addr_idx(_mock_netif, - &_loc_gb) < 0, + TEST_ASSERT_MESSAGE(gnrc_netif_ipv6_addr_idx(_mock_netif, + &_loc_gb) < 0, "Address was configured by PIO, " "but A flag was set"); } @@ -1218,13 +1218,13 @@ static void test_handle_pkt__rtr_adv__success_6co_sl2ao_mtuo_pio_LA(void) static void test_change_rtr_adv_iface(void) { - TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF2_FLAGS_IPV6_RTR_ADV), + TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF_FLAGS_IPV6_RTR_ADV), "RTR_ADV was unexpectedly set"); gnrc_ipv6_nib_change_rtr_adv_iface(_mock_netif, true); - TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF2_FLAGS_IPV6_RTR_ADV), + TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF_FLAGS_IPV6_RTR_ADV), "RTR_ADV was unexpectedly changed"); gnrc_ipv6_nib_change_rtr_adv_iface(_mock_netif, false); - TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF2_FLAGS_IPV6_RTR_ADV), + TEST_ASSERT_MESSAGE(!(_mock_netif->flags & GNRC_NETIF_FLAGS_IPV6_RTR_ADV), "RTR_ADV was unexpectedly changed"); TEST_ASSERT_EQUAL_INT(0, msg_avail()); } diff --git a/tests/gnrc_ipv6_nib_6ln/mockup_netif.c b/tests/gnrc_ipv6_nib_6ln/mockup_netif.c index faa8435b3a67ba144098fb66bd5ee04e8e42414a..924dbc4ca758e2197838bc971f5c0d76e859e080 100644 --- a/tests/gnrc_ipv6_nib_6ln/mockup_netif.c +++ b/tests/gnrc_ipv6_nib_6ln/mockup_netif.c @@ -18,15 +18,15 @@ #include "net/gnrc.h" #include "net/ethernet.h" #include "net/gnrc/ipv6/nib.h" -#include "net/gnrc/netif2/ieee802154.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/ieee802154.h" +#include "net/gnrc/netif/internal.h" #include "net/netdev_test.h" #include "sched.h" #include "thread.h" #define _MSG_QUEUE_SIZE (2) -gnrc_netif2_t *_mock_netif = NULL; +gnrc_netif_t *_mock_netif = NULL; static netdev_test_t _mock_netdev; static char _mock_netif_stack[THREAD_STACKSIZE_DEFAULT]; @@ -37,9 +37,9 @@ void _common_set_up(void) { assert(_mock_netif != NULL); gnrc_ipv6_nib_init(); - gnrc_netif2_acquire(_mock_netif); + gnrc_netif_acquire(_mock_netif); gnrc_ipv6_nib_init_iface(_mock_netif); - gnrc_netif2_release(_mock_netif); + gnrc_netif_release(_mock_netif); } int _get_device_type(netdev_t *dev, void *value, size_t max_len) @@ -89,8 +89,8 @@ void _tests_init(void) _get_src_len); netdev_test_set_get_cb(&_mock_netdev, NETOPT_ADDRESS_LONG, _get_address_long); - _mock_netif = gnrc_netif2_ieee802154_create( - _mock_netif_stack, THREAD_STACKSIZE_DEFAULT, GNRC_NETIF2_PRIO, + _mock_netif = gnrc_netif_ieee802154_create( + _mock_netif_stack, THREAD_STACKSIZE_DEFAULT, GNRC_NETIF_PRIO, "mockup_wpan", &_mock_netdev.netdev.netdev ); assert(_mock_netif != NULL); diff --git a/tests/gnrc_ndp2/Makefile b/tests/gnrc_ndp2/Makefile index 90d2dcdfc84627e5db0ad9d524ad805abe7e861c..8aa836a8c2797c4c4790cacdb4b20301f91baa3a 100644 --- a/tests/gnrc_ndp2/Makefile +++ b/tests/gnrc_ndp2/Makefile @@ -7,7 +7,7 @@ BOARD_INSUFFICIENT_MEMORY := chronos nucleo32-f031 nucleo32-f042 nucleo32-l031 \ USEMODULE += gnrc_ipv6_nib_router USEMODULE += gnrc_ndp2 -USEMODULE += gnrc_netif2 +USEMODULE += gnrc_netif USEMODULE += embunit USEMODULE += netdev_test diff --git a/tests/gnrc_ndp2/main.c b/tests/gnrc_ndp2/main.c index fe46bab5bcf4f3792979938f204d8be98743c469..54beed3e34795baa93271b7c735e9d3fd5da1f53 100644 --- a/tests/gnrc_ndp2/main.c +++ b/tests/gnrc_ndp2/main.c @@ -28,7 +28,7 @@ #include "net/gnrc/ipv6/nib/conf.h" #include "net/gnrc/netapi.h" #include "net/gnrc/netif/hdr.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif/internal.h" #include "net/gnrc/netreg.h" #include "net/gnrc/pktbuf.h" #include "net/icmpv6.h" @@ -66,7 +66,7 @@ static const ipv6_addr_t test_pfx = { { 0x47, 0x25, 0xd9, 0x3b, 0x7f, 0xcc, 0x15 0x64, 0x3e, 0x76, 0x0d, 0x30, 0x10, 0x0d, 0xc8 } }; static const uint8_t test_src_l2[] = { 0xe7, 0x43, 0xb7, 0x74, 0xd7, 0xa9, 0x30, 0x74 }; -static gnrc_netif2_t *test_netif = NULL; +static gnrc_netif_t *test_netif = NULL; static void init_pkt_handler(void); static inline size_t ceil8(size_t size); @@ -932,20 +932,20 @@ static msg_t msg_queue_main[MSG_QUEUE_SIZE]; static gnrc_netreg_entry_t netreg_entry; static netdev_test_t dev; -static int _test_netif_send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static int _test_netif_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { (void)netif; gnrc_pktbuf_release(pkt); return 0; } -static gnrc_pktsnip_t *_test_netif_recv(gnrc_netif2_t *netif) +static gnrc_pktsnip_t *_test_netif_recv(gnrc_netif_t *netif) { (void)netif; return NULL; } -static int _test_netif_get(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) +static int _test_netif_get(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) { (void)netif; switch (opt->opt) { @@ -984,14 +984,14 @@ static int _test_netif_get(gnrc_netif2_t *netif, gnrc_netapi_opt_t *opt) } } -static int _test_netif_set(gnrc_netif2_t *netif, const gnrc_netapi_opt_t *opt) +static int _test_netif_set(gnrc_netif_t *netif, const gnrc_netapi_opt_t *opt) { (void)netif; (void)opt; return -ENOTSUP; } -static const gnrc_netif2_ops_t _test_netif_ops = { +static const gnrc_netif_ops_t _test_netif_ops = { .send = _test_netif_send, .recv = _test_netif_recv, .get = _test_netif_get, @@ -1005,14 +1005,14 @@ static void init_pkt_handler(void) sched_active_pid); gnrc_netreg_register(GNRC_NETTYPE_NDP2, &netreg_entry); netdev_test_setup(&dev, NULL); - test_netif = gnrc_netif2_create(test_netif_stack, sizeof(test_netif_stack), - GNRC_NETIF2_PRIO, "test-netif", - &dev.netdev, &_test_netif_ops); + test_netif = gnrc_netif_create(test_netif_stack, sizeof(test_netif_stack), + GNRC_NETIF_PRIO, "test-netif", + &dev.netdev, &_test_netif_ops); TEST_ASSERT_MESSAGE(test_netif != NULL, "Unable to start test interface"); memcpy(&test_netif->ipv6.addrs[0], &test_src, sizeof(test_netif->ipv6.addrs[0])); - test_netif->ipv6.addrs_flags[0] = GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID; + test_netif->ipv6.addrs_flags[0] = GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID; memcpy(test_netif->l2addr, test_src_l2, sizeof(test_netif->l2addr)); test_netif->l2addr_len = sizeof(test_src_l2); } diff --git a/tests/gnrc_netif2/Makefile b/tests/gnrc_netif/Makefile similarity index 91% rename from tests/gnrc_netif2/Makefile rename to tests/gnrc_netif/Makefile index 92e7d4ea0b6de668064ef91ac8336c29d6559832..929b403d35f06e9bf7a82099b4ac293f30c0c242 100644 --- a/tests/gnrc_netif2/Makefile +++ b/tests/gnrc_netif/Makefile @@ -13,7 +13,7 @@ BOARD_INSUFFICIENT_MEMORY := airfy-beacon b-l072z-lrwan1 calliope-mini \ wsn430-v1_4 yunjia-nrf51822 z1 \ USEMODULE += embunit -USEMODULE += gnrc_netif2 +USEMODULE += gnrc_netif USEMODULE += gnrc_pktdump USEMODULE += gnrc_sixlowpan USEMODULE += gnrc_sixlowpan_iphc @@ -25,8 +25,8 @@ USEMODULE += od CFLAGS += -DDEVELHELP CFLAGS += -DGNRC_NETIF_NUMOF=4 -CFLAGS += -DGNRC_NETIF2_ADDRS_NUMOF=16 -CFLAGS += -DGNRC_NETIF2_GROUPS_NUMOF=8 +CFLAGS += -DGNRC_NETIF_ADDRS_NUMOF=16 +CFLAGS += -DGNRC_NETIF_GROUPS_NUMOF=8 CFLAGS += -DLOG_LEVEL=LOG_NONE CFLAGS += -DTEST_SUITES diff --git a/tests/gnrc_netif2/common.c b/tests/gnrc_netif/common.c similarity index 98% rename from tests/gnrc_netif2/common.c rename to tests/gnrc_netif/common.c index a3ddb58d86b32e90f81c9dec91415264e33f291a..98620acff63e5b97691c332cff82b6906767a808 100644 --- a/tests/gnrc_netif2/common.c +++ b/tests/gnrc_netif/common.c @@ -68,7 +68,7 @@ static int _dump_send_packet(netdev_t *netdev, const struct iovec *vector, return res; } -void _test_trigger_recv(gnrc_netif2_t *netif, const uint8_t *data, +void _test_trigger_recv(gnrc_netif_t *netif, const uint8_t *data, size_t data_len) { netdev_t *dev = netif->dev; diff --git a/tests/gnrc_netif2/common.h b/tests/gnrc_netif/common.h similarity index 96% rename from tests/gnrc_netif2/common.h rename to tests/gnrc_netif/common.h index 0ff9d3d24cff1d11ddfe95478beddbc86e5942d1..2f75dd3aca902d02925a30bdacd562974e140a8f 100644 --- a/tests/gnrc_netif2/common.h +++ b/tests/gnrc_netif/common.h @@ -20,7 +20,7 @@ #define COMMON_H -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #ifdef __cplusplus extern "C" { @@ -86,7 +86,7 @@ extern netdev_t *ieee802154_dev; extern netdev_t *devs[DEFAULT_DEVS_NUMOF]; void _tests_init(void); -void _test_trigger_recv(gnrc_netif2_t *netif, const uint8_t *data, +void _test_trigger_recv(gnrc_netif_t *netif, const uint8_t *data, size_t data_len); #ifdef __cplusplus diff --git a/tests/gnrc_netif2/main.c b/tests/gnrc_netif/main.c similarity index 82% rename from tests/gnrc_netif2/main.c rename to tests/gnrc_netif/main.c index e024b137b0b90d6653c2100e7fe7d7bf8d670832..f28f5928bf80b8d58f49594ec759b01e6deab698 100644 --- a/tests/gnrc_netif2/main.c +++ b/tests/gnrc_netif/main.c @@ -29,10 +29,10 @@ #include "net/gnrc.h" #include "net/gnrc/ipv6/hdr.h" #include "net/gnrc/netif/hdr.h" -#include "net/gnrc/netif2.h" -#include "net/gnrc/netif2/ethernet.h" -#include "net/gnrc/netif2/ieee802154.h" -#include "net/gnrc/netif2/internal.h" +#include "net/gnrc/netif.h" +#include "net/gnrc/netif/ethernet.h" +#include "net/gnrc/netif/ieee802154.h" +#include "net/gnrc/netif/internal.h" #include "net/netdev_test.h" #include "utlist.h" #include "xtimer.h" @@ -40,17 +40,17 @@ #define ETHERNET_STACKSIZE (THREAD_STACKSIZE_MAIN) #define IEEE802154_STACKSIZE (THREAD_STACKSIZE_MAIN) -static gnrc_netif2_t *ethernet_netif = NULL; -static gnrc_netif2_t *ieee802154_netif = NULL; -static gnrc_netif2_t *netifs[DEFAULT_DEVS_NUMOF]; +static gnrc_netif_t *ethernet_netif = NULL; +static gnrc_netif_t *ieee802154_netif = NULL; +static gnrc_netif_t *netifs[DEFAULT_DEVS_NUMOF]; static char ethernet_netif_stack[ETHERNET_STACKSIZE]; static char ieee802154_netif_stack[ETHERNET_STACKSIZE]; static char netifs_stack[DEFAULT_DEVS_NUMOF][THREAD_STACKSIZE_DEFAULT]; static bool init_called = false; -static inline void _test_init(gnrc_netif2_t *netif); -static inline int _mock_netif_send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt); -static inline gnrc_pktsnip_t *_mock_netif_recv(gnrc_netif2_t * netif); +static inline void _test_init(gnrc_netif_t *netif); +static inline int _mock_netif_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt); +static inline gnrc_pktsnip_t *_mock_netif_recv(gnrc_netif_t * netif); static int _get_netdev_address(netdev_t *dev, void *value, size_t max_len); static int _set_netdev_address(netdev_t *dev, const void *value, size_t value_len); @@ -61,12 +61,12 @@ static int _get_netdev_src_len(netdev_t *dev, void *value, size_t max_len); static int _set_netdev_src_len(netdev_t *dev, const void *value, size_t value_len); -static const gnrc_netif2_ops_t default_ops = { +static const gnrc_netif_ops_t default_ops = { .init = _test_init, .send = _mock_netif_send, .recv = _mock_netif_recv, - .get = gnrc_netif2_get_from_netdev, - .set = gnrc_netif2_set_from_netdev, + .get = gnrc_netif_get_from_netdev, + .set = gnrc_netif_set_from_netdev, .msg_handler = NULL, }; @@ -102,7 +102,7 @@ static void _set_up(void) while (msg_try_receive(&msg) > 0) {} } -static inline void _test_init(gnrc_netif2_t *netif) +static inline void _test_init(gnrc_netif_t *netif) { (void)netif; init_called = true; @@ -110,21 +110,21 @@ static inline void _test_init(gnrc_netif2_t *netif) static void test_creation(void) { - gnrc_netif2_t *ptr = NULL; + gnrc_netif_t *ptr = NULL; - TEST_ASSERT_EQUAL_INT(0, gnrc_netif2_numof()); - TEST_ASSERT_NULL(gnrc_netif2_iter(ptr)); - TEST_ASSERT_NOT_NULL((ethernet_netif = gnrc_netif2_ethernet_create( - ethernet_netif_stack, ETHERNET_STACKSIZE, GNRC_NETIF2_PRIO, + TEST_ASSERT_EQUAL_INT(0, gnrc_netif_numof()); + TEST_ASSERT_NULL(gnrc_netif_iter(ptr)); + TEST_ASSERT_NOT_NULL((ethernet_netif = gnrc_netif_ethernet_create( + ethernet_netif_stack, ETHERNET_STACKSIZE, GNRC_NETIF_PRIO, "eth", ethernet_dev ))); - TEST_ASSERT_EQUAL_INT(1, gnrc_netif2_numof()); - TEST_ASSERT_NOT_NULL((ptr = gnrc_netif2_iter(ptr))); - TEST_ASSERT_NULL((ptr = gnrc_netif2_iter(ptr))); + TEST_ASSERT_EQUAL_INT(1, gnrc_netif_numof()); + TEST_ASSERT_NOT_NULL((ptr = gnrc_netif_iter(ptr))); + TEST_ASSERT_NULL((ptr = gnrc_netif_iter(ptr))); TEST_ASSERT_NOT_NULL(ethernet_netif->ops); TEST_ASSERT_NOT_NULL(ethernet_netif->dev); TEST_ASSERT_EQUAL_INT(ETHERNET_DATA_LEN, ethernet_netif->ipv6.mtu); - TEST_ASSERT_EQUAL_INT(GNRC_NETIF2_DEFAULT_HL, ethernet_netif->cur_hl); + TEST_ASSERT_EQUAL_INT(GNRC_NETIF_DEFAULT_HL, ethernet_netif->cur_hl); TEST_ASSERT_EQUAL_INT(NETDEV_TYPE_ETHERNET, ethernet_netif->device_type); TEST_ASSERT(ethernet_netif->pid > KERNEL_PID_UNDEF); #ifdef DEVELHELP @@ -132,20 +132,20 @@ static void test_creation(void) #endif TEST_ASSERT_NOT_NULL(sched_threads[ethernet_netif->pid]->msg_array); - TEST_ASSERT_NOT_NULL((ieee802154_netif = gnrc_netif2_ieee802154_create( - ieee802154_netif_stack, IEEE802154_STACKSIZE, GNRC_NETIF2_PRIO, + TEST_ASSERT_NOT_NULL((ieee802154_netif = gnrc_netif_ieee802154_create( + ieee802154_netif_stack, IEEE802154_STACKSIZE, GNRC_NETIF_PRIO, "wpan", ieee802154_dev ))); - TEST_ASSERT_EQUAL_INT(2, gnrc_netif2_numof()); - TEST_ASSERT_NOT_NULL((ptr = gnrc_netif2_iter(ptr))); - TEST_ASSERT_NOT_NULL((ptr = gnrc_netif2_iter(ptr))); - TEST_ASSERT_NULL((ptr = gnrc_netif2_iter(ptr))); + TEST_ASSERT_EQUAL_INT(2, gnrc_netif_numof()); + TEST_ASSERT_NOT_NULL((ptr = gnrc_netif_iter(ptr))); + TEST_ASSERT_NOT_NULL((ptr = gnrc_netif_iter(ptr))); + TEST_ASSERT_NULL((ptr = gnrc_netif_iter(ptr))); TEST_ASSERT_NOT_NULL(ieee802154_netif->ops); TEST_ASSERT_NOT_NULL(ieee802154_netif->dev); TEST_ASSERT_EQUAL_INT(IPV6_MIN_MTU, ieee802154_netif->ipv6.mtu); TEST_ASSERT_EQUAL_INT(TEST_IEEE802154_MAX_FRAG_SIZE, ieee802154_netif->sixlo.max_frag_size); - TEST_ASSERT_EQUAL_INT(GNRC_NETIF2_DEFAULT_HL, ieee802154_netif->cur_hl); + TEST_ASSERT_EQUAL_INT(GNRC_NETIF_DEFAULT_HL, ieee802154_netif->cur_hl); TEST_ASSERT_EQUAL_INT(NETDEV_TYPE_IEEE802154, ieee802154_netif->device_type); TEST_ASSERT(ieee802154_netif->pid > KERNEL_PID_UNDEF); @@ -155,31 +155,31 @@ static void test_creation(void) TEST_ASSERT_NOT_NULL(sched_threads[ieee802154_netif->pid]->msg_array); for (unsigned i = 0; i < DEFAULT_DEVS_NUMOF; i++) { - TEST_ASSERT_NOT_NULL((netifs[i] = gnrc_netif2_create( + TEST_ASSERT_NOT_NULL((netifs[i] = gnrc_netif_create( netifs_stack[i], THREAD_STACKSIZE_DEFAULT, - GNRC_NETIF2_PRIO, "netif", devs[i], &default_ops + GNRC_NETIF_PRIO, "netif", devs[i], &default_ops ))); TEST_ASSERT_NOT_NULL(netifs[i]->ops); TEST_ASSERT_NOT_NULL(netifs[i]->dev); - TEST_ASSERT_EQUAL_INT(GNRC_NETIF2_DEFAULT_HL, netifs[i]->cur_hl); + TEST_ASSERT_EQUAL_INT(GNRC_NETIF_DEFAULT_HL, netifs[i]->cur_hl); TEST_ASSERT_EQUAL_INT(NETDEV_TYPE_UNKNOWN, netifs[i]->device_type); TEST_ASSERT(netifs[i]->pid > KERNEL_PID_UNDEF); TEST_ASSERT_NOT_NULL(sched_threads[netifs[i]->pid]->msg_array); - TEST_ASSERT_EQUAL_INT(i + SPECIAL_DEVS + 1, gnrc_netif2_numof()); + TEST_ASSERT_EQUAL_INT(i + SPECIAL_DEVS + 1, gnrc_netif_numof()); for (unsigned j = 0; j < (i + SPECIAL_DEVS + 1); j++) { - TEST_ASSERT_NOT_NULL((ptr = gnrc_netif2_iter(ptr))); + TEST_ASSERT_NOT_NULL((ptr = gnrc_netif_iter(ptr))); } - TEST_ASSERT_NULL((ptr = gnrc_netif2_iter(ptr))); + TEST_ASSERT_NULL((ptr = gnrc_netif_iter(ptr))); } TEST_ASSERT(init_called); } static void test_get_by_pid(void) { - TEST_ASSERT(ethernet_netif == gnrc_netif2_get_by_pid(ethernet_netif->pid)); - TEST_ASSERT(ieee802154_netif == gnrc_netif2_get_by_pid(ieee802154_netif->pid)); + TEST_ASSERT(ethernet_netif == gnrc_netif_get_by_pid(ethernet_netif->pid)); + TEST_ASSERT(ieee802154_netif == gnrc_netif_get_by_pid(ieee802154_netif->pid)); for (kernel_pid_t i = 0; i < DEFAULT_DEVS_NUMOF; i++) { - TEST_ASSERT(netifs[i] == gnrc_netif2_get_by_pid(netifs[i]->pid)); + TEST_ASSERT(netifs[i] == gnrc_netif_get_by_pid(netifs[i]->pid)); } } @@ -191,22 +191,22 @@ static void test_addr_to_str(void) static const uint8_t netif0_l2addr[] = NETIF0_SRC; char out[sizeof(netif0_l2addr) * 3]; - TEST_ASSERT(out == gnrc_netif2_addr_to_str(NULL, 0, out)); + TEST_ASSERT(out == gnrc_netif_addr_to_str(NULL, 0, out)); TEST_ASSERT_EQUAL_STRING("", &out[0]); - TEST_ASSERT(out == gnrc_netif2_addr_to_str(ethernet_l2addr, - sizeof(ethernet_l2addr), out)); + TEST_ASSERT(out == gnrc_netif_addr_to_str(ethernet_l2addr, + sizeof(ethernet_l2addr), out)); TEST_ASSERT_EQUAL_STRING("3e:e6:b5:22:fd:0a", &out[0]); - TEST_ASSERT(out == gnrc_netif2_addr_to_str(ieee802154_l2addr_long, - sizeof(ieee802154_l2addr_long), - out)); + TEST_ASSERT(out == gnrc_netif_addr_to_str(ieee802154_l2addr_long, + sizeof(ieee802154_l2addr_long), + out)); TEST_ASSERT_EQUAL_STRING("3e:e6:b5:0f:19:22:fd:0a", &out[0]); - TEST_ASSERT(out == gnrc_netif2_addr_to_str(ieee802154_l2addr_short, - sizeof(ieee802154_l2addr_short), - out)); + TEST_ASSERT(out == gnrc_netif_addr_to_str(ieee802154_l2addr_short, + sizeof(ieee802154_l2addr_short), + out)); TEST_ASSERT_EQUAL_STRING("fd:0a", &out[0]); - TEST_ASSERT(out == gnrc_netif2_addr_to_str(netif0_l2addr, - sizeof(netif0_l2addr), - out)); + TEST_ASSERT(out == gnrc_netif_addr_to_str(netif0_l2addr, + sizeof(netif0_l2addr), + out)); TEST_ASSERT_EQUAL_STRING("3e:e7:b5:0f:19:22:fd:0a", &out[0]); } @@ -215,20 +215,20 @@ static void test_addr_from_str(void) static const uint8_t ethernet_l2addr[] = ETHERNET_SRC; static const uint8_t ieee802154_l2addr_long[] = IEEE802154_LONG_SRC; static const uint8_t ieee802154_l2addr_short[] = IEEE802154_SHORT_SRC; - uint8_t out[GNRC_NETIF2_L2ADDR_MAXLEN]; + uint8_t out[GNRC_NETIF_L2ADDR_MAXLEN]; - TEST_ASSERT_EQUAL_INT(0, gnrc_netif2_addr_from_str("", out)); + TEST_ASSERT_EQUAL_INT(0, gnrc_netif_addr_from_str("", out)); TEST_ASSERT_EQUAL_INT(sizeof(ethernet_l2addr), - gnrc_netif2_addr_from_str("3e:e6:b5:22:fd:0a", out)); + gnrc_netif_addr_from_str("3e:e6:b5:22:fd:0a", out)); TEST_ASSERT_EQUAL_INT(0, memcmp(ethernet_l2addr, out, sizeof(ethernet_l2addr))); TEST_ASSERT_EQUAL_INT(sizeof(ieee802154_l2addr_long), - gnrc_netif2_addr_from_str("3e:e6:b5:0f:19:22:fd:0a", - out)); + gnrc_netif_addr_from_str("3e:e6:b5:0f:19:22:fd:0a", + out)); TEST_ASSERT_EQUAL_INT(0, memcmp(ieee802154_l2addr_long, out, sizeof(ieee802154_l2addr_long))); TEST_ASSERT_EQUAL_INT(sizeof(ieee802154_l2addr_short), - gnrc_netif2_addr_from_str("fd:0a", out)); + gnrc_netif_addr_from_str("fd:0a", out)); TEST_ASSERT_EQUAL_INT(0, memcmp(ieee802154_l2addr_short, out, sizeof(ieee802154_l2addr_short))); } @@ -237,14 +237,14 @@ static void test_ipv6_addr_add__ENOMEM(void) { ipv6_addr_t addr = { .u8 = NETIF0_IPV6_G }; - for (unsigned i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; + for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++, addr.u16[3].u16++) { - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); } TEST_ASSERT_EQUAL_INT(-ENOMEM, - gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); + gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); } static void test_ipv6_addr_add__success(void) @@ -252,13 +252,13 @@ static void test_ipv6_addr_add__success(void) static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_LL }; int idx; - TEST_ASSERT(0 <= (idx = gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID))); + TEST_ASSERT(0 <= (idx = gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID))); /* check duplicate addition */ TEST_ASSERT_EQUAL_INT(idx, - gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); - TEST_ASSERT_EQUAL_INT(GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID, + gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); + TEST_ASSERT_EQUAL_INT(GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID, netifs[0]->ipv6.addrs_flags[idx]); TEST_ASSERT(ipv6_addr_equal(&addr, &netifs[0]->ipv6.addrs[idx])); } @@ -270,14 +270,14 @@ static void test_ipv6_addr_add__readd_with_free_entry(void) static const ipv6_addr_t addr2 = { .u8 = NETIF0_IPV6_G }; int idx; - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_add(netifs[0], &addr1, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); - TEST_ASSERT(0 <= (idx = gnrc_netif2_ipv6_addr_add(netifs[0], &addr2, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID))); - gnrc_netif2_ipv6_addr_remove(netifs[0], &addr1); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_add(netifs[0], &addr1, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); + TEST_ASSERT(0 <= (idx = gnrc_netif_ipv6_addr_add(netifs[0], &addr2, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID))); + gnrc_netif_ipv6_addr_remove(netifs[0], &addr1); TEST_ASSERT_EQUAL_INT(idx, - gnrc_netif2_ipv6_addr_add(netifs[0], &addr2, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); + gnrc_netif_ipv6_addr_add(netifs[0], &addr2, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); } static void test_ipv6_addr_remove__not_allocated(void) @@ -286,11 +286,11 @@ static void test_ipv6_addr_remove__not_allocated(void) static const ipv6_addr_t addr2 = { .u8 = NETIF0_IPV6_G }; test_ipv6_addr_add__success(); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_idx(netifs[0], &addr1)); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_add(netifs[0], &addr2, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); - gnrc_netif2_ipv6_addr_remove(netifs[0], &addr2); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_idx(netifs[0], &addr1)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_idx(netifs[0], &addr1)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_add(netifs[0], &addr2, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); + gnrc_netif_ipv6_addr_remove(netifs[0], &addr2); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_idx(netifs[0], &addr1)); } static void test_ipv6_addr_remove__success(void) @@ -298,15 +298,15 @@ static void test_ipv6_addr_remove__success(void) static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_LL }; test_ipv6_addr_add__success(); - gnrc_netif2_ipv6_addr_remove(netifs[0], &addr); - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_addr_idx(netifs[0], &addr)); + gnrc_netif_ipv6_addr_remove(netifs[0], &addr); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_addr_idx(netifs[0], &addr)); } static void test_ipv6_addr_idx__empty(void) { static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_LL }; - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_addr_idx(netifs[0], &addr)); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_addr_idx(netifs[0], &addr)); } static void test_ipv6_addr_idx__wrong_netif(void) @@ -314,7 +314,7 @@ static void test_ipv6_addr_idx__wrong_netif(void) static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_LL }; test_ipv6_addr_add__success(); - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_addr_idx(netifs[1], &addr)); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_addr_idx(netifs[1], &addr)); } static void test_ipv6_addr_idx__wrong_addr(void) @@ -322,7 +322,7 @@ static void test_ipv6_addr_idx__wrong_addr(void) static const ipv6_addr_t addr2 = { .u8 = NETIF0_IPV6_G }; test_ipv6_addr_add__success(); - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_addr_idx(netifs[0], &addr2)); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_addr_idx(netifs[0], &addr2)); } static void test_ipv6_addr_idx__success(void) @@ -330,14 +330,14 @@ static void test_ipv6_addr_idx__success(void) static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_LL }; test_ipv6_addr_add__success(); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_idx(netifs[0], &addr)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_idx(netifs[0], &addr)); } static void test_ipv6_addr_match__empty(void) { static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_G }; - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_addr_match(netifs[0], &addr)); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_addr_match(netifs[0], &addr)); } static void test_ipv6_addr_match__wrong_netif(void) @@ -345,7 +345,7 @@ static void test_ipv6_addr_match__wrong_netif(void) static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_G }; test_ipv6_addr_add__success(); - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_addr_match(netifs[1], &addr)); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_addr_match(netifs[1], &addr)); } static void test_ipv6_addr_match__wrong_addr(void) @@ -353,7 +353,7 @@ static void test_ipv6_addr_match__wrong_addr(void) static const ipv6_addr_t addr2 = { .u8 = NETIF0_IPV6_G }; test_ipv6_addr_add__success(); - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_addr_match(netifs[0], &addr2)); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_addr_match(netifs[0], &addr2)); } static void test_ipv6_addr_match__success18(void) @@ -363,9 +363,9 @@ static void test_ipv6_addr_match__success18(void) static const ipv6_addr_t pfx = { .u8 = GLOBAL_PFX18 }; int idx; - TEST_ASSERT(0 <= (idx = gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID))); - TEST_ASSERT_EQUAL_INT(idx, gnrc_netif2_ipv6_addr_match(netifs[0], &pfx)); + TEST_ASSERT(0 <= (idx = gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID))); + TEST_ASSERT_EQUAL_INT(idx, gnrc_netif_ipv6_addr_match(netifs[0], &pfx)); TEST_ASSERT_EQUAL_INT(18, ipv6_addr_match_prefix(&netifs[0]->ipv6.addrs[idx], &pfx)); } @@ -377,9 +377,9 @@ static void test_ipv6_addr_match__success23(void) static const ipv6_addr_t pfx = { .u8 = GLOBAL_PFX23 }; int idx; - TEST_ASSERT(0 <= (idx = gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID))); - TEST_ASSERT_EQUAL_INT(idx, gnrc_netif2_ipv6_addr_match(netifs[0], &pfx)); + TEST_ASSERT(0 <= (idx = gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID))); + TEST_ASSERT_EQUAL_INT(idx, gnrc_netif_ipv6_addr_match(netifs[0], &pfx)); TEST_ASSERT_EQUAL_INT(23, ipv6_addr_match_prefix(&netifs[0]->ipv6.addrs[idx], &pfx)); } @@ -391,9 +391,9 @@ static void test_ipv6_addr_match__success64(void) static const ipv6_addr_t pfx = { .u8 = GLOBAL_PFX64 }; int idx; - TEST_ASSERT(0 <= (idx = gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID))); - TEST_ASSERT_EQUAL_INT(idx, gnrc_netif2_ipv6_addr_match(netifs[0], &pfx)); + TEST_ASSERT(0 <= (idx = gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID))); + TEST_ASSERT_EQUAL_INT(idx, gnrc_netif_ipv6_addr_match(netifs[0], &pfx)); TEST_ASSERT_EQUAL_INT(64, ipv6_addr_match_prefix(&netifs[0]->ipv6.addrs[idx], &pfx)); } @@ -407,11 +407,11 @@ static void test_ipv6_addr_best_src__multicast_input(void) /* adds a link-local address */ test_ipv6_addr_add__success(); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_add(netifs[0], &addr1, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); - TEST_ASSERT_NOT_NULL((out = gnrc_netif2_ipv6_addr_best_src(netifs[0], - &addr2, - false))); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_add(netifs[0], &addr1, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); + TEST_ASSERT_NOT_NULL((out = gnrc_netif_ipv6_addr_best_src(netifs[0], + &addr2, + false))); TEST_ASSERT(!ipv6_addr_equal(&addr2, out)); TEST_ASSERT(ipv6_addr_equal(&addr1, out)); } @@ -422,9 +422,9 @@ static void test_ipv6_addr_best_src__other_subnet(void) ipv6_addr_t *out = NULL; test_ipv6_addr_add__success(); - TEST_ASSERT_NOT_NULL((out = gnrc_netif2_ipv6_addr_best_src(netifs[0], - &mc_addr, - false))); + TEST_ASSERT_NOT_NULL((out = gnrc_netif_ipv6_addr_best_src(netifs[0], + &mc_addr, + false))); TEST_ASSERT(!ipv6_addr_equal(&mc_addr, out)); TEST_ASSERT(!ipv6_addr_is_multicast(out)); TEST_ASSERT(!ipv6_addr_is_unspecified(out)); @@ -434,7 +434,7 @@ static void test_get_by_ipv6_addr__empty(void) { static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_LL }; - TEST_ASSERT_NULL(gnrc_netif2_get_by_ipv6_addr(&addr)); + TEST_ASSERT_NULL(gnrc_netif_get_by_ipv6_addr(&addr)); } static void test_get_by_ipv6_addr__success(void) @@ -443,14 +443,14 @@ static void test_get_by_ipv6_addr__success(void) test_ipv6_addr_add__success(); TEST_ASSERT_NOT_NULL(netifs[0]); - TEST_ASSERT(netifs[0] == gnrc_netif2_get_by_ipv6_addr(&addr)); + TEST_ASSERT(netifs[0] == gnrc_netif_get_by_ipv6_addr(&addr)); } static void test_get_by_prefix__empty(void) { static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_G }; - TEST_ASSERT_NULL(gnrc_netif2_get_by_prefix(&addr)); + TEST_ASSERT_NULL(gnrc_netif_get_by_prefix(&addr)); } static void test_get_by_prefix__success18(void) @@ -458,10 +458,10 @@ static void test_get_by_prefix__success18(void) static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_G }; static const ipv6_addr_t pfx = { .u8 = GLOBAL_PFX18 }; - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); TEST_ASSERT_NOT_NULL(netifs[0]); - TEST_ASSERT(netifs[0] == gnrc_netif2_get_by_prefix(&pfx)); + TEST_ASSERT(netifs[0] == gnrc_netif_get_by_prefix(&pfx)); test_ipv6_addr_match__success18(); } @@ -470,10 +470,10 @@ static void test_get_by_prefix__success23(void) static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_G }; static const ipv6_addr_t pfx = { .u8 = GLOBAL_PFX23 }; - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); TEST_ASSERT_NOT_NULL(netifs[0]); - TEST_ASSERT(netifs[0] == gnrc_netif2_get_by_prefix(&pfx)); + TEST_ASSERT(netifs[0] == gnrc_netif_get_by_prefix(&pfx)); test_ipv6_addr_match__success23(); } @@ -482,10 +482,10 @@ static void test_get_by_prefix__success64(void) static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_G }; static const ipv6_addr_t pfx = { .u8 = GLOBAL_PFX64 }; - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_add(netifs[0], &addr, 64U, - GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_add(netifs[0], &addr, 64U, + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)); TEST_ASSERT_NOT_NULL(netifs[0]); - TEST_ASSERT(netifs[0] == gnrc_netif2_get_by_prefix(&pfx)); + TEST_ASSERT(netifs[0] == gnrc_netif_get_by_prefix(&pfx)); test_ipv6_addr_match__success64(); } @@ -493,24 +493,24 @@ static void test_ipv6_group_join__ENOMEM(void) { ipv6_addr_t addr = IPV6_ADDR_ALL_NODES_LINK_LOCAL; - for (unsigned i = 0; i < GNRC_NETIF2_IPV6_ADDRS_NUMOF; + for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++, addr.u16[7].u16++) { - TEST_ASSERT(0 <= gnrc_netif2_ipv6_group_join(netifs[0], &addr)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_group_join(netifs[0], &addr)); } TEST_ASSERT_EQUAL_INT(-ENOMEM, - gnrc_netif2_ipv6_group_join(netifs[0], &addr)); + gnrc_netif_ipv6_group_join(netifs[0], &addr)); } static void test_ipv6_group_join__success(void) { int idx; - TEST_ASSERT(0 <= (idx = gnrc_netif2_ipv6_group_join(netifs[0], - &ipv6_addr_all_nodes_link_local))); + TEST_ASSERT(0 <= (idx = gnrc_netif_ipv6_group_join(netifs[0], + &ipv6_addr_all_nodes_link_local))); /* check duplicate addition */ TEST_ASSERT_EQUAL_INT(idx, - gnrc_netif2_ipv6_group_join(netifs[0], - &ipv6_addr_all_nodes_link_local)); + gnrc_netif_ipv6_group_join(netifs[0], + &ipv6_addr_all_nodes_link_local)); TEST_ASSERT(ipv6_addr_equal(&ipv6_addr_all_nodes_link_local, &netifs[0]->ipv6.groups[idx])); } @@ -520,60 +520,60 @@ static void test_ipv6_group_join__readd_with_free_entry(void) /* Tests for possible duplicates (see #2965) */ int idx; - TEST_ASSERT(0 <= gnrc_netif2_ipv6_group_join(netifs[0], - &ipv6_addr_all_nodes_link_local)); - TEST_ASSERT(0 <= (idx = gnrc_netif2_ipv6_group_join(netifs[0], - &ipv6_addr_all_routers_link_local))); - gnrc_netif2_ipv6_group_leave(netifs[0], &ipv6_addr_all_nodes_link_local); + TEST_ASSERT(0 <= gnrc_netif_ipv6_group_join(netifs[0], + &ipv6_addr_all_nodes_link_local)); + TEST_ASSERT(0 <= (idx = gnrc_netif_ipv6_group_join(netifs[0], + &ipv6_addr_all_routers_link_local))); + gnrc_netif_ipv6_group_leave(netifs[0], &ipv6_addr_all_nodes_link_local); TEST_ASSERT_EQUAL_INT(idx, - gnrc_netif2_ipv6_group_join(netifs[0], - &ipv6_addr_all_routers_link_local)); + gnrc_netif_ipv6_group_join(netifs[0], + &ipv6_addr_all_routers_link_local)); } static void test_ipv6_group_leave__not_allocated(void) { test_ipv6_group_join__success(); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_group_idx(netifs[0], - &ipv6_addr_all_nodes_link_local)); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_group_join(netifs[0], - &ipv6_addr_all_routers_link_local)); - gnrc_netif2_ipv6_group_leave(netifs[0], &ipv6_addr_all_routers_link_local); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_group_idx(netifs[0], - &ipv6_addr_all_nodes_link_local)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_group_idx(netifs[0], + &ipv6_addr_all_nodes_link_local)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_group_join(netifs[0], + &ipv6_addr_all_routers_link_local)); + gnrc_netif_ipv6_group_leave(netifs[0], &ipv6_addr_all_routers_link_local); + TEST_ASSERT(0 <= gnrc_netif_ipv6_group_idx(netifs[0], + &ipv6_addr_all_nodes_link_local)); } static void test_ipv6_group_leave__success(void) { test_ipv6_group_join__success(); - gnrc_netif2_ipv6_group_leave(netifs[0], &ipv6_addr_all_nodes_link_local); - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_group_idx(netifs[0], - &ipv6_addr_all_nodes_link_local)); + gnrc_netif_ipv6_group_leave(netifs[0], &ipv6_addr_all_nodes_link_local); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_group_idx(netifs[0], + &ipv6_addr_all_nodes_link_local)); } static void test_ipv6_group_idx__empty(void) { - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_group_idx(netifs[0], - &ipv6_addr_all_nodes_link_local)); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_group_idx(netifs[0], + &ipv6_addr_all_nodes_link_local)); } static void test_ipv6_group_idx__wrong_netif(void) { test_ipv6_group_join__success(); - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_group_idx(netifs[1], - &ipv6_addr_all_nodes_link_local)); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_group_idx(netifs[1], + &ipv6_addr_all_nodes_link_local)); } static void test_ipv6_group_idx__wrong_addr(void) { test_ipv6_group_join__success(); - TEST_ASSERT_EQUAL_INT(-1, gnrc_netif2_ipv6_group_idx(netifs[0], - &ipv6_addr_all_routers_link_local)); + TEST_ASSERT_EQUAL_INT(-1, gnrc_netif_ipv6_group_idx(netifs[0], + &ipv6_addr_all_routers_link_local)); } static void test_ipv6_group_idx__success(void) { test_ipv6_group_join__success(); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_group_idx(netifs[0], &ipv6_addr_all_nodes_link_local)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_group_idx(netifs[0], &ipv6_addr_all_nodes_link_local)); } static void test_ipv6_get_iid(void) @@ -585,10 +585,10 @@ static void test_ipv6_get_iid(void) eui64_t res; uint16_t ieee802154_l2addr_len = 2U; - TEST_ASSERT_EQUAL_INT(0, gnrc_netif2_ipv6_get_iid(ethernet_netif, &res)); + TEST_ASSERT_EQUAL_INT(0, gnrc_netif_ipv6_get_iid(ethernet_netif, &res)); TEST_ASSERT_EQUAL_INT(0, memcmp(&res, ðernet_ipv6_ll.u64[1], sizeof(res))); - TEST_ASSERT_EQUAL_INT(0, gnrc_netif2_ipv6_get_iid(ieee802154_netif, &res)); + TEST_ASSERT_EQUAL_INT(0, gnrc_netif_ipv6_get_iid(ieee802154_netif, &res)); TEST_ASSERT_EQUAL_INT(0, memcmp(&res, &ieee802154_ipv6_ll_long.u64[1], sizeof(res))); TEST_ASSERT_EQUAL_INT(sizeof(ieee802154_l2addr_len), @@ -596,7 +596,7 @@ static void test_ipv6_get_iid(void) NETOPT_SRC_LEN, 0, &ieee802154_l2addr_len, sizeof(ieee802154_l2addr_len))); - TEST_ASSERT_EQUAL_INT(0, gnrc_netif2_ipv6_get_iid(ieee802154_netif, &res)); + TEST_ASSERT_EQUAL_INT(0, gnrc_netif_ipv6_get_iid(ieee802154_netif, &res)); TEST_ASSERT_EQUAL_INT(0, memcmp(&res, &ieee802154_eui64_short, sizeof(res))); /* reset to source length 8 */ ieee802154_l2addr_len = 8U; @@ -606,7 +606,7 @@ static void test_ipv6_get_iid(void) &ieee802154_l2addr_len, sizeof(ieee802154_l2addr_len))); for (unsigned i = 0; i < DEFAULT_DEVS_NUMOF; i++) { - TEST_ASSERT_EQUAL_INT(-ENOTSUP, gnrc_netif2_ipv6_get_iid(netifs[i], &res)); + TEST_ASSERT_EQUAL_INT(-ENOTSUP, gnrc_netif_ipv6_get_iid(netifs[i], &res)); } } @@ -623,7 +623,7 @@ static void test_netapi_get__HOP_LIMIT(void) static void test_netapi_get__IPV6_ADDR(void) { static const ipv6_addr_t exp = { NETIF0_IPV6_LL }; - ipv6_addr_t value[GNRC_NETIF2_IPV6_ADDRS_NUMOF]; + ipv6_addr_t value[GNRC_NETIF_IPV6_ADDRS_NUMOF]; test_ipv6_addr_add__success(); TEST_ASSERT_EQUAL_INT(sizeof(ipv6_addr_t), gnrc_netapi_get(netifs[0]->pid, @@ -635,20 +635,20 @@ static void test_netapi_get__IPV6_ADDR(void) static void test_netapi_get__IPV6_ADDR_FLAGS(void) { - uint8_t value[GNRC_NETIF2_IPV6_ADDRS_NUMOF]; + uint8_t value[GNRC_NETIF_IPV6_ADDRS_NUMOF]; test_ipv6_addr_add__success(); TEST_ASSERT_EQUAL_INT(sizeof(uint8_t), gnrc_netapi_get(netifs[0]->pid, NETOPT_IPV6_ADDR_FLAGS, 0, &value, sizeof(value))); - TEST_ASSERT_EQUAL_INT(GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID, + TEST_ASSERT_EQUAL_INT(GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID, value[0]); } static void test_netapi_get__IPV6_GROUP(void) { - ipv6_addr_t value[GNRC_NETIF2_IPV6_GROUPS_NUMOF]; + ipv6_addr_t value[GNRC_NETIF_IPV6_GROUPS_NUMOF]; test_ipv6_group_join__success(); TEST_ASSERT_EQUAL_INT(sizeof(ipv6_addr_t), gnrc_netapi_get(netifs[0]->pid, @@ -761,7 +761,7 @@ static void test_netapi_get__ADDRESS(void) { static const uint8_t exp_ethernet[] = ETHERNET_SRC; static const uint8_t exp_ieee802154[] = IEEE802154_SHORT_SRC; - uint8_t value[GNRC_NETIF2_L2ADDR_MAXLEN]; + uint8_t value[GNRC_NETIF_L2ADDR_MAXLEN]; TEST_ASSERT_EQUAL_INT(sizeof(exp_ethernet), gnrc_netapi_get(ethernet_netif->pid, @@ -779,7 +779,7 @@ static void test_netapi_get__ADDRESS(void) static void test_netapi_get__ADDRESS_LONG(void) { static const uint8_t exp_ieee802154[] = IEEE802154_LONG_SRC; - uint8_t value[GNRC_NETIF2_L2ADDR_MAXLEN]; + uint8_t value[GNRC_NETIF_L2ADDR_MAXLEN]; TEST_ASSERT_EQUAL_INT(-ENOTSUP, gnrc_netapi_get(ethernet_netif->pid, @@ -812,14 +812,14 @@ static void test_netapi_set__IPV6_ADDR(void) { ipv6_addr_t value = { .u8 = NETIF0_IPV6_LL }; static const uint16_t context = (64U << 8) | - (GNRC_NETIF2_IPV6_ADDRS_FLAGS_STATE_VALID); + (GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID); - TEST_ASSERT(0 > gnrc_netif2_ipv6_addr_idx(netifs[0], &value)); + TEST_ASSERT(0 > gnrc_netif_ipv6_addr_idx(netifs[0], &value)); TEST_ASSERT_EQUAL_INT(sizeof(value), gnrc_netapi_set(netifs[0]->pid, NETOPT_IPV6_ADDR, context, &value, sizeof(value))); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_idx(netifs[0], &value)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_idx(netifs[0], &value)); } static void test_netapi_set__IPV6_ADDR_REMOVE(void) @@ -827,24 +827,24 @@ static void test_netapi_set__IPV6_ADDR_REMOVE(void) ipv6_addr_t value = { .u8 = NETIF0_IPV6_LL }; test_ipv6_addr_add__success(); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_addr_idx(netifs[0], &value)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_idx(netifs[0], &value)); TEST_ASSERT_EQUAL_INT(sizeof(value), gnrc_netapi_set(netifs[0]->pid, NETOPT_IPV6_ADDR_REMOVE, 0, &value, sizeof(value))); - TEST_ASSERT(0 > gnrc_netif2_ipv6_addr_idx(netifs[0], &value)); + TEST_ASSERT(0 > gnrc_netif_ipv6_addr_idx(netifs[0], &value)); } static void test_netapi_set__IPV6_GROUP(void) { ipv6_addr_t value = IPV6_ADDR_ALL_NODES_LINK_LOCAL; - TEST_ASSERT(0 > gnrc_netif2_ipv6_group_idx(netifs[0], &value)); + TEST_ASSERT(0 > gnrc_netif_ipv6_group_idx(netifs[0], &value)); TEST_ASSERT_EQUAL_INT(sizeof(value), gnrc_netapi_set(netifs[0]->pid, NETOPT_IPV6_GROUP, 0, &value, sizeof(value))); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_group_idx(netifs[0], &value)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_group_idx(netifs[0], &value)); } static void test_netapi_set__IPV6_GROUP_LEAVE(void) @@ -852,12 +852,12 @@ static void test_netapi_set__IPV6_GROUP_LEAVE(void) ipv6_addr_t value = IPV6_ADDR_ALL_NODES_LINK_LOCAL; test_ipv6_group_join__success(); - TEST_ASSERT(0 <= gnrc_netif2_ipv6_group_idx(netifs[0], &value)); + TEST_ASSERT(0 <= gnrc_netif_ipv6_group_idx(netifs[0], &value)); TEST_ASSERT_EQUAL_INT(sizeof(value), gnrc_netapi_set(netifs[0]->pid, NETOPT_IPV6_GROUP_LEAVE, 0, &value, sizeof(value))); - TEST_ASSERT(0 > gnrc_netif2_ipv6_group_idx(netifs[0], &value)); + TEST_ASSERT(0 > gnrc_netif_ipv6_group_idx(netifs[0], &value)); } static void test_netapi_set__MAX_PACKET_SIZE(void) @@ -884,7 +884,7 @@ static void test_netapi_set__6LO_IPHC(void) gnrc_netapi_set(netifs[0]->pid, NETOPT_6LO_IPHC, 0, &value, sizeof(value))); - TEST_ASSERT(netifs[0]->flags & GNRC_NETIF2_FLAGS_6LO_HC); + TEST_ASSERT(netifs[0]->flags & GNRC_NETIF_FLAGS_6LO_HC); } static void test_netapi_set__ADDRESS(void) @@ -1321,7 +1321,7 @@ static void test_netapi_recv__ipv6_ethernet_payload(void) _test_trigger_recv(ethernet_netif, data, sizeof(data)); } -static Test *embunit_tests_gnrc_netif2(void) +static Test *embunit_tests_gnrc_netif(void) { EMB_UNIT_TESTFIXTURES(fixtures) { new_TestFixture(test_creation), @@ -1407,7 +1407,7 @@ int main(void) netdev_test_set_set_cb((netdev_test_t *)ieee802154_dev, NETOPT_SRC_LEN, _set_netdev_src_len); TESTS_START(); - TESTS_RUN(embunit_tests_gnrc_netif2()); + TESTS_RUN(embunit_tests_gnrc_netif()); TESTS_END(); /* add netapi send and receive tests here */ test_netapi_send__raw_unicast_ethernet_packet(); @@ -1431,14 +1431,14 @@ int main(void) return 0; } -static inline int _mock_netif_send(gnrc_netif2_t *netif, gnrc_pktsnip_t *pkt) +static inline int _mock_netif_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) { (void)netif; (void)pkt; return -1; } -static inline gnrc_pktsnip_t *_mock_netif_recv(gnrc_netif2_t * netif) +static inline gnrc_pktsnip_t *_mock_netif_recv(gnrc_netif_t * netif) { (void)netif; return NULL; diff --git a/tests/gnrc_netif2/tests/01-run.py b/tests/gnrc_netif/tests/01-run.py similarity index 100% rename from tests/gnrc_netif2/tests/01-run.py rename to tests/gnrc_netif/tests/01-run.py diff --git a/tests/gnrc_sixlowpan/main.c b/tests/gnrc_sixlowpan/main.c index 964f66a6049dc08f32221b3c52b82caa3fc36bdf..6210652e8f859074c3e90373a43c209c00fafe29 100644 --- a/tests/gnrc_sixlowpan/main.c +++ b/tests/gnrc_sixlowpan/main.c @@ -28,13 +28,13 @@ #include "net/gnrc/pktbuf.h" #include "net/gnrc/netreg.h" #include "net/gnrc/netapi.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/netif/hdr.h" #include "net/gnrc/pktdump.h" static void _init_interface(void) { - gnrc_netif2_t *netif = gnrc_netif2_iter(NULL); + gnrc_netif_t *netif = gnrc_netif_iter(NULL); ipv6_addr_t addr = IPV6_ADDR_UNSPECIFIED; /* fd01::01 */ @@ -51,7 +51,7 @@ static void _init_interface(void) static void _send_packet(void) { - gnrc_netif2_t *netif = gnrc_netif2_iter(NULL); + gnrc_netif_t *netif = gnrc_netif_iter(NULL); struct { gnrc_netif_hdr_t netif_hdr; diff --git a/tests/gnrc_sock_dns/Makefile b/tests/gnrc_sock_dns/Makefile index 8ff2c111d103d6a69f08f159c020054755e38cd9..76ec76066a6deb33ab8611264403c925b7ca39e0 100644 --- a/tests/gnrc_sock_dns/Makefile +++ b/tests/gnrc_sock_dns/Makefile @@ -22,8 +22,8 @@ CFLAGS += -DDEVELHELP LOW_MEMORY_BOARDS := nucleo-f334 msb-430 msb-430h ifeq ($(BOARD),$(filter $(BOARD),$(LOW_MEMORY_BOARDS))) - CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DGNRC_NETIF2_IPV6_ADDRS_NUMOF=2 \ - -DGNRC_NETIF2_IPV6_GROUPS_NUMOF=2 -DGNRC_IPV6_NC_SIZE=1 + CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DGNRC_NETIF_IPV6_ADDRS_NUMOF=2 \ + -DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DGNRC_IPV6_NC_SIZE=1 endif include $(RIOTBASE)/Makefile.include diff --git a/tests/gnrc_sock_dns/main.c b/tests/gnrc_sock_dns/main.c index 2573f5c569654367620398519ad033ad11daa320..1b6cc3d22390afbdd057cfa02224a4ac117b2b43 100644 --- a/tests/gnrc_sock_dns/main.c +++ b/tests/gnrc_sock_dns/main.c @@ -40,7 +40,7 @@ sock_udp_ep_t sock_dns_server; /* import "ifconfig" shell command, used for printing addresses */ -extern int _gnrc_netif2_config(int argc, char **argv); +extern int _gnrc_netif_config(int argc, char **argv); int main(void) { @@ -53,7 +53,7 @@ int main(void) /* print network addresses */ puts("Configured network interfaces:"); - _gnrc_netif2_config(0, NULL); + _gnrc_netif_config(0, NULL); int res = sock_dns_query(TEST_NAME, addr, AF_UNSPEC); if (res > 0) { diff --git a/tests/gnrc_tcp_server/main.c b/tests/gnrc_tcp_server/main.c index b8af60ac8de1320f7e72c8f7ba48e9ec2965796d..67ca8deca5a330a70ed528ef1f082c47b340620e 100644 --- a/tests/gnrc_tcp_server/main.c +++ b/tests/gnrc_tcp_server/main.c @@ -11,7 +11,7 @@ #include "thread.h" #include "net/af.h" #include "net/gnrc/ipv6.h" -#include "net/gnrc/netif2.h" +#include "net/gnrc/netif.h" #include "net/gnrc/tcp.h" #define ENABLE_DEBUG (0) @@ -41,16 +41,16 @@ uint8_t bufs[CONNS][NBYTE]; uint8_t stacks[CONNS][THREAD_STACKSIZE_DEFAULT + THREAD_EXTRA_STACKSIZE_PRINTF]; /* "ifconfig" shell command */ -extern int _gnrc_netif2_config(int argc, char **argv); +extern int _gnrc_netif_config(int argc, char **argv); /* Server thread */ void *srv_thread(void *arg); int main(void) { - gnrc_netif2_t *netif; + gnrc_netif_t *netif; - if (!(netif = gnrc_netif2_iter(NULL))) { + if (!(netif = gnrc_netif_iter(NULL))) { printf("No valid network interface found\n"); return -1; } @@ -58,7 +58,7 @@ int main(void) /* Set pre-configured IP address */ char if_pid[] = {netif->pid + '0', '\0'}; char *cmd[] = {"ifconfig", if_pid, "add", "unicast", LOCAL_ADDR}; - _gnrc_netif2_config(5, cmd); + _gnrc_netif_config(5, cmd); /* Test configuration */ printf("\nStarting server: LOCAL_ADDR=%s, LOCAL_PORT=%d, ", LOCAL_ADDR, LOCAL_PORT); diff --git a/tests/netdev_test/Makefile b/tests/netdev_test/Makefile index ca692fed43f81cb60b41bd5a1acdd02ce1c51d6e..ee45fa3806622e9744c9fc27224b907a400ab81c 100644 --- a/tests/netdev_test/Makefile +++ b/tests/netdev_test/Makefile @@ -9,7 +9,7 @@ FEATURES_REQUIRED += periph_timer # xtimer required for this application USEMODULE += gnrc USEMODULE += gnrc_neterr -USEMODULE += gnrc_netif2 +USEMODULE += gnrc_netif USEMODULE += netdev_eth USEMODULE += netdev_test USEMODULE += od diff --git a/tests/netdev_test/main.c b/tests/netdev_test/main.c index b9ae81fa3d030b99ab833a464164d10ae3deb020..ae1bb37e3be659622cc6b094c657b50079403e96 100644 --- a/tests/netdev_test/main.c +++ b/tests/netdev_test/main.c @@ -22,7 +22,7 @@ #include "msg.h" #include "net/ethernet.h" #include "net/gnrc.h" -#include "net/gnrc/netif2/ethernet.h" +#include "net/gnrc/netif/ethernet.h" #include "net/netdev_test.h" #include "od.h" #include "thread.h" @@ -196,12 +196,12 @@ static int test_receive(void) puts("================="); puts("expected"); puts("================="); - puts(gnrc_netif2_addr_to_str(_test_src, ETHERNET_ADDR_LEN, addr_str)); + puts(gnrc_netif_addr_to_str(_test_src, ETHERNET_ADDR_LEN, addr_str)); puts("================="); puts("received source"); puts("================="); - puts(gnrc_netif2_addr_to_str(gnrc_netif_hdr_get_src_addr(hdr->data), - ETHERNET_ADDR_LEN, addr_str)); + puts(gnrc_netif_addr_to_str(gnrc_netif_hdr_get_src_addr(hdr->data), + ETHERNET_ADDR_LEN, addr_str)); return 0; } if (memcmp(gnrc_netif_hdr_get_dst_addr(hdr->data), _dev_addr, @@ -211,12 +211,12 @@ static int test_receive(void) puts("================="); puts("expected"); puts("================="); - puts(gnrc_netif2_addr_to_str(_dev_addr, ETHERNET_ADDR_LEN, addr_str)); + puts(gnrc_netif_addr_to_str(_dev_addr, ETHERNET_ADDR_LEN, addr_str)); puts("===================="); puts("received destination"); puts("===================="); - puts(gnrc_netif2_addr_to_str(gnrc_netif_hdr_get_dst_addr(hdr->data), - ETHERNET_ADDR_LEN, addr_str)); + puts(gnrc_netif_addr_to_str(gnrc_netif_hdr_get_dst_addr(hdr->data), + ETHERNET_ADDR_LEN, addr_str)); return 0; } @@ -258,8 +258,8 @@ int main(void) netdev_test_set_send_cb(&_dev, _dev_send); netdev_test_set_get_cb(&_dev, NETOPT_ADDRESS, _dev_get_addr); netdev_test_set_set_cb(&_dev, NETOPT_ADDRESS, _dev_set_addr); - _mac_pid = gnrc_netif2_ethernet_create(_mac_stack, _MAC_STACKSIZE, _MAC_PRIO, - "netdev_test", (netdev_t *)&_dev)->pid; + _mac_pid = gnrc_netif_ethernet_create(_mac_stack, _MAC_STACKSIZE, _MAC_PRIO, + "netdev_test", (netdev_t *)&_dev)->pid; /* test execution */ EXECUTE(test_get_addr); diff --git a/tests/pkg_microcoap/main.c b/tests/pkg_microcoap/main.c index ce0c4983cf9df0a06ed84d2e4e1349208f69f047..25eaccaf9416872282462baa6dacbdb7c5cc5d98 100644 --- a/tests/pkg_microcoap/main.c +++ b/tests/pkg_microcoap/main.c @@ -24,7 +24,7 @@ void microcoap_server_loop(void); /* import "ifconfig" shell command, used for printing addresses */ -extern int _gnrc_netif2_config(int argc, char **argv); +extern int _gnrc_netif_config(int argc, char **argv); int main(void) { @@ -35,7 +35,7 @@ int main(void) /* print network addresses */ puts("Configured network interfaces:"); - _gnrc_netif2_config(0, NULL); + _gnrc_netif_config(0, NULL); /* start coap server loop */ microcoap_server_loop();