2021-03-06 13:43:14 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) Google LLC
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup sys_auto_init_lwip_netif
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Helpers for simplified network setup
|
|
|
|
*
|
|
|
|
* @author Erik Ekman <eekman@google.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LWIP_INIT_DEVS_H
|
|
|
|
#define LWIP_INIT_DEVS_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "lwip/netif.h"
|
|
|
|
#include "net/netdev.h"
|
2021-08-20 14:48:41 +02:00
|
|
|
#include "xfa.h"
|
2021-03-06 13:43:14 +01:00
|
|
|
|
|
|
|
void lwip_netif_init_devs(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Adds an Ethernet netif using the supplied netdev.
|
|
|
|
*
|
|
|
|
* @param netif pointer to the interface to be added
|
|
|
|
* @param state pointer to the netdev for the interface
|
|
|
|
*
|
|
|
|
* The netif will be set up using the `lwip_netdev_init` helper.
|
2021-03-06 14:19:34 +01:00
|
|
|
* The first netif added will be marked as the default route.
|
2021-03-06 13:43:14 +01:00
|
|
|
*/
|
|
|
|
struct netif *lwip_add_ethernet(struct netif *netif, netdev_t *state);
|
|
|
|
|
2021-08-20 17:33:47 +02:00
|
|
|
#if IS_USED(MODULE_LWIP_SIXLOWPAN)
|
2021-08-14 18:46:17 +02:00
|
|
|
/**
|
|
|
|
* @brief Adds a 6LoWPAN netif using the supplied netdev.
|
|
|
|
*
|
|
|
|
* @param netif pointer to the interface to be added
|
|
|
|
* @param state pointer to the netdev for the interface
|
|
|
|
*
|
|
|
|
* The netif will be set up using the `lwip_netdev_init` helper.
|
|
|
|
*/
|
|
|
|
struct netif *lwip_add_6lowpan(struct netif *netif, netdev_t *state);
|
2021-08-20 17:33:47 +02:00
|
|
|
#endif /* MODULE_LWIP_SIXLOWPAN */
|
2021-08-14 18:46:17 +02:00
|
|
|
|
2021-08-20 14:48:41 +02:00
|
|
|
typedef void (*lwip_netif_setup_func_t)(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Registers initialization function for an Ethernet interface
|
|
|
|
*/
|
|
|
|
#define LWIP_INIT_ETH_NETIF(func) \
|
|
|
|
XFA_USE_CONST(lwip_netif_setup_func_t, lwip_netif_eth_xfa); \
|
|
|
|
XFA_ADD_PTR(lwip_netif_eth_xfa, func, func, &func)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Registers initialization function for a 6LoWPAN interface
|
|
|
|
*/
|
|
|
|
#define LWIP_INIT_6LOWPAN_NETIF(func) \
|
|
|
|
XFA_USE_CONST(lwip_netif_setup_func_t, lwip_netif_6lowpan_xfa); \
|
|
|
|
XFA_ADD_PTR(lwip_netif_6lowpan_xfa, func, func, &func)
|
|
|
|
|
2021-03-06 13:43:14 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* LWIP_INIT_DEVS_H */
|
|
|
|
/** @} */
|