esp_netif_net_stack.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include "esp_netif.h"
  8. #include "lwip/netif.h"
  9. #include "esp_netif_ppp.h"
  10. #if defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
  11. typedef err_t (*init_fn_t_esp_idf)(struct netif*);
  12. typedef void (*input_fn_t)(void *netif, void *buffer, size_t len, void *eb);
  13. struct esp_netif_netstack_lwip_vanilla_config {
  14. init_fn_t_esp_idf init_fn;
  15. input_fn_t input_fn;
  16. };
  17. struct esp_netif_netstack_lwip_ppp_config {
  18. input_fn_t input_fn;
  19. esp_netif_ppp_config_t ppp_events;
  20. };
  21. // LWIP netif specific network stack configuration
  22. struct esp_netif_netstack_config {
  23. union {
  24. struct esp_netif_netstack_lwip_vanilla_config lwip;
  25. struct esp_netif_netstack_lwip_ppp_config lwip_ppp;
  26. };
  27. };
  28. /**
  29. * @brief LWIP's network stack init function for Ethernet
  30. * @param netif LWIP's network interface handle
  31. * @return ERR_OK on success
  32. */
  33. err_t ethernetif_init(struct netif *netif);
  34. /**
  35. * @brief LWIP's network stack input packet function for Ethernet
  36. * @param h LWIP's network interface handle
  37. * @param buffer Input buffer pointer
  38. * @param len Input buffer size
  39. * @param l2_buff External buffer pointer (to be passed to custom input-buffer free)
  40. */
  41. void ethernetif_input(void *h, void *buffer, size_t len, void *l2_buff);
  42. /**
  43. * @brief LWIP's network stack init function for WiFi (AP)
  44. * @param netif LWIP's network interface handle
  45. * @return ERR_OK on success
  46. */
  47. err_t wlanif_init_ap(struct netif *netif);
  48. /**
  49. * @brief LWIP's network stack init function for WiFi (Station)
  50. * @param netif LWIP's network interface handle
  51. * @return ERR_OK on success
  52. */
  53. err_t wlanif_init_sta(struct netif *netif);
  54. /**
  55. * @brief LWIP's network stack input packet function for WiFi (both STA/AP)
  56. * @param h LWIP's network interface handle
  57. * @param buffer Input buffer pointer
  58. * @param len Input buffer size
  59. * @param l2_buff External buffer pointer (to be passed to custom input-buffer free)
  60. */
  61. void wlanif_input(void *h, void *buffer, size_t len, void* l2_buff);
  62. #endif // CONFIG_ESP_NETIF_TCPIP_LWIP