2022-01-19 11:15:40 -05:00
|
|
|
/*
|
2024-01-08 03:47:49 -05:00
|
|
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
2022-01-19 11:15:40 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
|
|
|
|
#ifndef _ESP_NETIF_NET_STACK_H_
|
|
|
|
#define _ESP_NETIF_NET_STACK_H_
|
|
|
|
|
2019-11-22 03:40:54 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-06-28 10:47:34 -04:00
|
|
|
//
|
|
|
|
// Network stack API: This ESP-NETIF API are supposed to be called only from internals of TCP/IP stack
|
|
|
|
//
|
|
|
|
|
2019-09-12 03:24:56 -04:00
|
|
|
/** @addtogroup ESP_NETIF_CONVERT
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2019-06-28 10:47:34 -04:00
|
|
|
/**
|
|
|
|
* @brief Returns esp-netif handle
|
|
|
|
*
|
|
|
|
* @param[in] dev opaque ptr to network interface of specific TCP/IP stack
|
|
|
|
*
|
|
|
|
* @return handle to related esp-netif instance
|
|
|
|
*/
|
|
|
|
esp_netif_t* esp_netif_get_handle_from_netif_impl(void *dev);
|
|
|
|
|
|
|
|
/**
|
2024-01-08 03:47:49 -05:00
|
|
|
* @brief Returns network stack specific implementation handle
|
2019-06-28 10:47:34 -04:00
|
|
|
*
|
|
|
|
* @param[in] esp_netif Handle to esp-netif instance
|
|
|
|
*
|
|
|
|
* @return handle to related network stack netif handle
|
|
|
|
*/
|
|
|
|
void* esp_netif_get_netif_impl(esp_netif_t *esp_netif);
|
|
|
|
|
2022-05-11 10:01:48 -04:00
|
|
|
/**
|
|
|
|
* @brief Set link-speed for the specified network interface
|
|
|
|
* @param[in] esp_netif Handle to esp-netif instance
|
|
|
|
* @param[in] speed Link speed in bit/s
|
|
|
|
* @return ESP_OK on success
|
|
|
|
*/
|
|
|
|
esp_err_t esp_netif_set_link_speed(esp_netif_t *esp_netif, uint32_t speed);
|
|
|
|
|
2019-09-12 03:24:56 -04:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @addtogroup ESP_NETIF_DATA_IO_API
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Outputs packets from the TCP/IP stack to the media to be transmitted
|
|
|
|
*
|
|
|
|
* This function gets called from network stack to output packets to IO driver.
|
|
|
|
*
|
|
|
|
* @param[in] esp_netif Handle to esp-netif instance
|
2019-11-25 10:40:56 -05:00
|
|
|
* @param[in] data Data to be transmitted
|
2019-09-12 03:24:56 -04:00
|
|
|
* @param[in] len Length of the data frame
|
2019-11-25 10:40:56 -05:00
|
|
|
*
|
|
|
|
* @return ESP_OK on success, an error passed from the I/O driver otherwise
|
2019-09-12 03:24:56 -04:00
|
|
|
*/
|
|
|
|
esp_err_t esp_netif_transmit(esp_netif_t *esp_netif, void* data, size_t len);
|
|
|
|
|
2020-02-13 01:26:48 -05:00
|
|
|
/**
|
|
|
|
* @brief Outputs packets from the TCP/IP stack to the media to be transmitted
|
|
|
|
*
|
|
|
|
* This function gets called from network stack to output packets to IO driver.
|
|
|
|
*
|
|
|
|
* @param[in] esp_netif Handle to esp-netif instance
|
|
|
|
* @param[in] data Data to be transmitted
|
|
|
|
* @param[in] len Length of the data frame
|
|
|
|
* @param[in] netstack_buf net stack buffer
|
|
|
|
*
|
|
|
|
* @return ESP_OK on success, an error passed from the I/O driver otherwise
|
|
|
|
*/
|
|
|
|
esp_err_t esp_netif_transmit_wrap(esp_netif_t *esp_netif, void *data, size_t len, void *netstack_buf);
|
|
|
|
|
2019-09-12 03:24:56 -04:00
|
|
|
/**
|
|
|
|
* @brief Free the rx buffer allocated by the media driver
|
|
|
|
*
|
|
|
|
* This function gets called from network stack when the rx buffer to be freed in IO driver context,
|
|
|
|
* i.e. to deallocate a buffer owned by io driver (when data packets were passed to higher levels
|
|
|
|
* to avoid copying)
|
|
|
|
*
|
|
|
|
* @param[in] esp_netif Handle to esp-netif instance
|
2019-11-25 10:40:56 -05:00
|
|
|
* @param[in] buffer Rx buffer pointer
|
2019-09-12 03:24:56 -04:00
|
|
|
*/
|
|
|
|
void esp_netif_free_rx_buffer(void *esp_netif, void* buffer);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2019-11-22 03:40:54 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-06-28 10:47:34 -04:00
|
|
|
#endif //_ESP_NETIF_NET_STACK_H_
|