1 /*
2  * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "esp_netif.h"
8 #include "esp_netif_lwip_internal.h"
9 #include "lwip/esp_netif_net_stack.h"
10 #if defined(CONFIG_PPP_SUPPORT)
11 #include "esp_netif_lwip_ppp.h"
12 #endif
13 #if defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
14 
15 #if CONFIG_ESP_NETIF_BRIDGE_EN
16 #include "netif/bridgeif.h"
17 
18 static const struct esp_netif_netstack_config s_br_netif_config = {
19         .lwip = {
20             .init_fn = bridgeif_init,
21             .input_fn = NULL
22         }
23 };
24 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_br       = &s_br_netif_config;
25 #endif // CONFIG_ESP_NETIF_BRIDGE_EN
26 
27 //
28 // Purpose of this object is to define default network stack configuration
29 //  of basic types of interfaces using lwip network stack
30 //
31 
32 static const struct esp_netif_netstack_config s_eth_netif_config = {
33         .lwip = {
34             .init_fn = ethernetif_init,
35             .input_fn = ethernetif_input
36         }
37 };
38 static const struct esp_netif_netstack_config s_wifi_netif_config_ap = {
39         .lwip = {
40             .init_fn = wlanif_init_ap,
41             .input_fn = wlanif_input
42         }
43 
44 };
45 static const struct esp_netif_netstack_config s_wifi_netif_config_sta = {
46         .lwip = {
47                 .init_fn = wlanif_init_sta,
48                 .input_fn = wlanif_input
49         }
50 };
51 static const struct esp_netif_netstack_config s_wifi_netif_config_nan = {
52         .lwip = {
53                 .init_fn = wlanif_init_nan,
54                 .input_fn = wlanif_input
55         }
56 };
57 
58 #if defined(CONFIG_PPP_SUPPORT)
59 static const struct esp_netif_netstack_config s_netif_config_ppp = {
60         .lwip_ppp = {
61                 .input_fn = esp_netif_lwip_ppp_input,
62                 .ppp_events = {
63                         .ppp_error_event_enabled = true,
64                         .ppp_phase_event_enabled = false
65                 }
66         }
67 };
68 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_ppp      = &s_netif_config_ppp;
69 #endif // CONFIG_PPP_SUPPORT
70 
71 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_eth      = &s_eth_netif_config;
72 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_sta = &s_wifi_netif_config_sta;
73 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_nan = &s_wifi_netif_config_nan;
74 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_ap  = &s_wifi_netif_config_ap;
75 
76 #endif /*CONFIG_ESP_NETIF_TCPIP_LWIP*/
77