7 * Copyright (c) 2017, ETH Zurich.
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
16 #ifndef LIB_NET_INCLUDE_NET_NETIF_H_
17 #define LIB_NET_INCLUDE_NET_NETIF_H_
19 // forward declarations
25 * ===============================================================================
26 * Network Interface Management
27 * ===============================================================================
32 * @brief initializes a netif structure for LWIP with a device queue
34 * @param netif the netif to be initialized
35 * @param devq the device queue to be used
37 * @return SYS_ERR_OK on success, errva on failure
39 errval_t net_if_init_devq(struct netif *netif, struct devq *devq);
43 * @brief adds the netif to the LWIP
45 * @param netif the netif ot be added
46 * @param state state to be passed
50 errval_t net_if_add(struct netif *netif, void *state);
54 * @brief removes a network interface
56 * @param netif the LWIP netif
58 * @return SYS_ERR_OK on success, errval on failure
60 errval_t net_if_remove(struct netif *netif);
63 * ===============================================================================
65 * ===============================================================================
70 * @brief adds a new receive buffer to the interface
72 * @param netif the LWIP netif
73 * @param pbuf packet buffer to be added
75 * @return SYS_ERR_OK on success, errval on failure
77 errval_t net_if_add_rx_buf(struct netif *netif, struct pbuf *pbuf);
80 * @brief adds a new transmit buffer to the interface
82 * @param netif the LWIP netif
83 * @param pbuf packt boffer to be transmitted
85 * @return SYS_ERR_OK on success, errval on failure
87 errval_t net_if_add_tx_buf(struct netif *netif, struct pbuf *pbuf);
91 * ===============================================================================
92 * Polling the interfaces
93 * ===============================================================================
98 * @brief polls then network interface for new incoming packets
100 * @param netif the LWIP netif to be polled
102 * @return SYS_ERR_OK on success, errval on failure
104 errval_t net_if_poll(struct netif *netif);
107 * @brief polls all added network interfaces
109 * @return SYS_ERR_OK on success, errval on failure
111 errval_t net_if_poll_all(void);
113 #endif /* LIB_NET_INCLUDE_NET_NETIF_H_ */