2022-05-11 10:01:48 -04:00
|
|
|
/*
|
2023-02-13 23:36:40 -05:00
|
|
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
2022-05-11 10:01:48 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "esp_netif.h"
|
|
|
|
#include "lwip/netif.h"
|
|
|
|
#include "esp_netif_ppp.h"
|
|
|
|
|
2022-09-23 02:59:37 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2022-05-11 10:01:48 -04:00
|
|
|
|
2022-07-14 04:34:06 -04:00
|
|
|
typedef err_t (*init_fn_t)(struct netif*);
|
2023-03-27 04:37:51 -04:00
|
|
|
typedef esp_err_t (*input_fn_t)(void *netif, void *buffer, size_t len, void *eb);
|
2022-07-14 04:34:06 -04:00
|
|
|
|
2022-05-11 10:01:48 -04:00
|
|
|
struct esp_netif_netstack_lwip_vanilla_config {
|
2022-07-14 04:34:06 -04:00
|
|
|
init_fn_t init_fn;
|
|
|
|
input_fn_t input_fn;
|
2022-05-11 10:01:48 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct esp_netif_netstack_lwip_ppp_config {
|
2022-07-14 04:34:06 -04:00
|
|
|
input_fn_t input_fn;
|
2022-05-11 10:01:48 -04:00
|
|
|
esp_netif_ppp_config_t ppp_events;
|
|
|
|
};
|
|
|
|
|
|
|
|
// LWIP netif specific network stack configuration
|
|
|
|
struct esp_netif_netstack_config {
|
|
|
|
union {
|
|
|
|
struct esp_netif_netstack_lwip_vanilla_config lwip;
|
|
|
|
struct esp_netif_netstack_lwip_ppp_config lwip_ppp;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief LWIP's network stack init function for Ethernet
|
|
|
|
* @param netif LWIP's network interface handle
|
|
|
|
* @return ERR_OK on success
|
|
|
|
*/
|
|
|
|
err_t ethernetif_init(struct netif *netif);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief LWIP's network stack input packet function for Ethernet
|
|
|
|
* @param h LWIP's network interface handle
|
|
|
|
* @param buffer Input buffer pointer
|
|
|
|
* @param len Input buffer size
|
|
|
|
* @param l2_buff External buffer pointer (to be passed to custom input-buffer free)
|
|
|
|
*/
|
2023-03-27 04:37:51 -04:00
|
|
|
esp_err_t ethernetif_input(void *h, void *buffer, size_t len, void *l2_buff);
|
2022-05-11 10:01:48 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief LWIP's network stack init function for WiFi (AP)
|
|
|
|
* @param netif LWIP's network interface handle
|
|
|
|
* @return ERR_OK on success
|
|
|
|
*/
|
|
|
|
err_t wlanif_init_ap(struct netif *netif);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief LWIP's network stack init function for WiFi (Station)
|
|
|
|
* @param netif LWIP's network interface handle
|
|
|
|
* @return ERR_OK on success
|
|
|
|
*/
|
|
|
|
err_t wlanif_init_sta(struct netif *netif);
|
|
|
|
|
2023-02-13 23:36:40 -05:00
|
|
|
/**
|
|
|
|
* @brief LWIP's network stack init function for WiFi Aware interface (NAN)
|
|
|
|
* @param netif LWIP's network interface handle
|
|
|
|
* @return ERR_OK on success
|
|
|
|
*/
|
|
|
|
err_t wlanif_init_nan(struct netif *netif);
|
|
|
|
|
2022-05-11 10:01:48 -04:00
|
|
|
/**
|
|
|
|
* @brief LWIP's network stack input packet function for WiFi (both STA/AP)
|
|
|
|
* @param h LWIP's network interface handle
|
|
|
|
* @param buffer Input buffer pointer
|
|
|
|
* @param len Input buffer size
|
|
|
|
* @param l2_buff External buffer pointer (to be passed to custom input-buffer free)
|
|
|
|
*/
|
2023-03-27 04:37:51 -04:00
|
|
|
esp_err_t wlanif_input(void *h, void *buffer, size_t len, void* l2_buff);
|
2022-05-11 10:01:48 -04:00
|
|
|
|
2022-09-23 02:59:37 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|