1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_netif2: rename to gnrc_netif

This commit is contained in:
Martine Lenders 2017-11-16 18:06:46 +01:00
parent 6980d82cc1
commit 31b1ceb440
No known key found for this signature in database
GPG Key ID: 8E97A9FE55F25D62
117 changed files with 1424 additions and 1423 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 */
/** @} */

View File

@ -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);
}

View File

@ -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 */
/** @} */

View File

@ -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;

View File

@ -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

View File

@ -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));

View File

@ -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];

View File

@ -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);
}

View File

@ -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
}
}

View File

@ -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]);
}
}
}

View File

@ -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]);
}
}

View File

@ -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

View File

@ -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]);
}
}

View File

@ -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

View File

@ -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(&ethos, &p);
/* initialize netdev<->gnrc adapter state */
gnrc_netif2_ethernet_create(_netdev_eth_stack, ETHOS_MAC_STACKSIZE,
ETHOS_MAC_PRIO, "ethos", (netdev_t *)&ethos);
gnrc_netif_ethernet_create(_netdev_eth_stack, ETHOS_MAC_STACKSIZE,
ETHOS_MAC_PRIO, "ethos", (netdev_t *)&ethos);
}
#else

View File

@ -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

View File

@ -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

View File

@ -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);
}
}

View File

@ -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

View File

@ -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]);
}
}

View File

@ -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]);
}
}

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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)

View File

@ -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);

View File

@ -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 */
/** @} */

View File

@ -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 */
/** @} */

View File

@ -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 */
/** @} */

View File

@ -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 */
/** @} */

View File

@ -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 */
/** @} */

View File

@ -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 */
/** @} */

View File

@ -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 */
/** @} */

View File

@ -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 */
/** @} */

View File

@ -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 */
/** @} */

View File

@ -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 */
/** @} */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -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)) {

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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 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_netif2_ops_t lwmac_ops = {
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;

View File

@ -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;

View File

@ -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)) {}

View File

@ -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);

View File

@ -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)) {}

View File

@ -1,3 +1,3 @@
MODULE := gnrc_netif2
MODULE := gnrc_netif
include $(RIOTBASE)/Makefile.base

View File

@ -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);
}
}
}

View File

@ -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,
&ethernet_ops);
return gnrc_netif_create(stack, stacksize, priority, name, dev,
&ethernet_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);

View File

@ -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 {

View File

@ -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;

View File

@ -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)");

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -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)

View File

@ -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) &&

View File

@ -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) */

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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 */

View File

@ -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");
}

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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));

View File

@ -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;

View File

@ -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 */

View File

@ -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

View File

@ -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);

View File

@ -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]));
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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());
}

View File

@ -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);

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More