esp_eth_netif_glue.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #pragma once
  15. #include "esp_eth.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /**
  20. * @brief Create a netif glue for Ethernet driver
  21. * @note netif glue is used to attach io driver to TCP/IP netif
  22. *
  23. * @param eth_hdl Ethernet driver handle
  24. * @return glue object, which inherits esp_netif_driver_base_t
  25. */
  26. void *esp_eth_new_netif_glue(esp_eth_handle_t eth_hdl);
  27. /**
  28. * @brief Delete netif glue of Ethernet driver
  29. *
  30. * @param glue netif glue
  31. * @return -ESP_OK: delete netif glue successfully
  32. */
  33. esp_err_t esp_eth_del_netif_glue(void *glue);
  34. /**
  35. * @brief Register default IP layer handlers for Ethernet
  36. *
  37. * @note: Ethernet handle might not yet properly initialized when setting up these default handlers
  38. *
  39. * @param[in] esp_netif esp network interface handle created for Ethernet driver
  40. * @return
  41. * - ESP_ERR_INVALID_ARG: invalid parameter (esp_netif is NULL)
  42. * - ESP_OK: set default IP layer handlers successfully
  43. * - others: other failure occurred during register esp_event handler
  44. */
  45. esp_err_t esp_eth_set_default_handlers(void *esp_netif);
  46. /**
  47. * @brief Unregister default IP layer handlers for Ethernet
  48. *
  49. * @param[in] esp_netif esp network interface handle created for Ethernet driver
  50. * @return
  51. * - ESP_ERR_INVALID_ARG: invalid parameter (esp_netif is NULL)
  52. * - ESP_OK: clear default IP layer handlers successfully
  53. * - others: other failure occurred during unregister esp_event handler
  54. */
  55. esp_err_t esp_eth_clear_default_handlers(void *esp_netif);
  56. #ifdef __cplusplus
  57. }
  58. #endif