1 // Copyright 2019 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include "esp_netif.h" 16 #include "esp_netif_lwip_internal.h" 17 #include "esp_netif_lwip_ppp.h" 18 19 #ifdef CONFIG_ESP_NETIF_TCPIP_LWIP 20 21 #include "netif/wlanif.h" 22 #include "netif/ethernetif.h" 23 #if CONFIG_OPENTHREAD_ENABLED 24 #include "netif/openthreadif.h" 25 #endif 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 52 static const struct esp_netif_netstack_config s_netif_config_ppp = { 53 .lwip_ppp = { 54 .input_fn = esp_netif_lwip_ppp_input, 55 .ppp_events = { 56 .ppp_error_event_enabled = true, 57 .ppp_phase_event_enabled = false 58 } 59 } 60 }; 61 62 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_eth = &s_eth_netif_config; 63 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_sta = &s_wifi_netif_config_sta; 64 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_ap = &s_wifi_netif_config_ap; 65 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_ppp = &s_netif_config_ppp; 66 67 #if CONFIG_OPENTHREAD_ENABLED 68 static const struct esp_netif_netstack_config s_netif_config_openthread = { 69 .lwip = { 70 .init_fn = openthread_netif_init, 71 .input_fn = openthread_netif_input, 72 } 73 }; 74 const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_openthread = &s_netif_config_openthread; 75 #endif // CONFIG_OPENTHREAD_ENABLED 76 77 #endif /*CONFIG_ESP_NETIF_TCPIP_LWIP*/ 78