esp_netif_net_stack.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Copyright 2015-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. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef _ESP_NETIF_NET_STACK_H_
  14. #define _ESP_NETIF_NET_STACK_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //
  19. // Network stack API: This ESP-NETIF API are supposed to be called only from internals of TCP/IP stack
  20. //
  21. /** @addtogroup ESP_NETIF_CONVERT
  22. * @{
  23. */
  24. /**
  25. * @brief Returns esp-netif handle
  26. *
  27. * @param[in] dev opaque ptr to network interface of specific TCP/IP stack
  28. *
  29. * @return handle to related esp-netif instance
  30. */
  31. esp_netif_t* esp_netif_get_handle_from_netif_impl(void *dev);
  32. /**
  33. * @brief Returns network stack specific implementation handle (if supported)
  34. *
  35. * Note that it is not supported to acquire PPP netif impl pointer and
  36. * this function will return NULL for esp_netif instances configured to PPP mode
  37. *
  38. * @param[in] esp_netif Handle to esp-netif instance
  39. *
  40. * @return handle to related network stack netif handle
  41. */
  42. void* esp_netif_get_netif_impl(esp_netif_t *esp_netif);
  43. /**
  44. * @}
  45. */
  46. /** @addtogroup ESP_NETIF_DATA_IO_API
  47. * @{
  48. */
  49. /**
  50. * @brief Outputs packets from the TCP/IP stack to the media to be transmitted
  51. *
  52. * This function gets called from network stack to output packets to IO driver.
  53. *
  54. * @param[in] esp_netif Handle to esp-netif instance
  55. * @param[in] data Data to be transmitted
  56. * @param[in] len Length of the data frame
  57. *
  58. * @return ESP_OK on success, an error passed from the I/O driver otherwise
  59. */
  60. esp_err_t esp_netif_transmit(esp_netif_t *esp_netif, void* data, size_t len);
  61. /**
  62. * @brief Free the rx buffer allocated by the media driver
  63. *
  64. * This function gets called from network stack when the rx buffer to be freed in IO driver context,
  65. * i.e. to deallocate a buffer owned by io driver (when data packets were passed to higher levels
  66. * to avoid copying)
  67. *
  68. * @param[in] esp_netif Handle to esp-netif instance
  69. * @param[in] buffer Rx buffer pointer
  70. */
  71. void esp_netif_free_rx_buffer(void *esp_netif, void* buffer);
  72. /**
  73. * @}
  74. */
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif //_ESP_NETIF_NET_STACK_H_