1/*
2 * Copyright (c) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
3 *
4 * UniProton is licensed under Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *          http://license.coscl.org.cn/MulanPSL2
8 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11 * See the Mulan PSL v2 for more details.
12 * Create: 2022-09-21
13 * Description: 网络
14 */
15
16#ifndef LWIP_PORTING_NETIF_H
17#define LWIP_PORTING_NETIF_H
18
19#include "lwip/arch.h"
20#include <net/if.h>
21#include <netinet/ip.h>
22
23#define netif_find OsNetifapiNetifFindByName
24
25#if LWIP_DHCPS
26#define LWIP_NETIF_CLIENT_DATA_INDEX_DHCP   LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, \
27                                            LWIP_NETIF_CLIENT_DATA_INDEX_DHCPS
28#endif
29
30#define linkoutput      linkoutput; \
31                        void (*drv_send)(struct netif *netif, struct pbuf *p); \
32                        u8_t (*drv_set_hwaddr)(struct netif *netif, u8_t *addr, u8_t len); \
33                        void (*drv_config)(struct netif *netif, u32_t config_flags, u8_t setBit); \
34                        char full_name[IFNAMSIZ]; \
35                        u16_t link_layer_type
36#include_next <lwip/netif.h>
37#undef linkoutput
38#if LWIP_DHCPS
39#undef LWIP_NETIF_CLIENT_DATA_INDEX_DHCP
40#endif
41
42#include <lwip/etharp.h>
43
44// redefine NETIF_NAMESIZE which was defined in netif.h
45#undef NETIF_NAMESIZE
46#define NETIF_NAMESIZE IFNAMSIZ
47
48#define LOOPBACK_IF         0
49#define ETHERNET_DRIVER_IF  1
50#define WIFI_DRIVER_IF      801
51#define BT_PROXY_IF         802
52
53err_t driverif_init(struct netif *netif);
54void driverif_input(struct netif *netif, struct pbuf *p);
55
56#define netif_get_name(netif) ((netif)->full_name)
57
58#endif /* LWIP_PORTING_NETIF_H */
59