esp_netif_objects_mock.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright 2020 Espressif Systems (Shanghai) CO 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. #include "esp_netif.h"
  14. #include "sys/queue.h"
  15. #include "esp_log.h"
  16. #include "freertos/FreeRTOS.h"
  17. #include "freertos/semphr.h"
  18. #include "esp_netif_private.h"
  19. #include <string.h>
  20. //
  21. // Purpose of this module is to provide list of esp-netif structures
  22. // - this module has no dependency on a specific network stack (lwip)
  23. //
  24. struct slist_netifs_s {
  25. esp_netif_t *netif;
  26. SLIST_ENTRY(slist_netifs_s) next;
  27. };
  28. SLIST_HEAD(slisthead, slist_netifs_s) s_head = { .slh_first = NULL, };
  29. static size_t s_esp_netif_counter = 0;
  30. ESP_EVENT_DEFINE_BASE(IP_EVENT);
  31. //
  32. // List manipulation functions
  33. //
  34. esp_err_t esp_netif_add_to_list(esp_netif_t *netif)
  35. {
  36. return ESP_OK;
  37. }
  38. esp_err_t esp_netif_remove_from_list(esp_netif_t *netif)
  39. {
  40. return ESP_ERR_NOT_FOUND;
  41. }
  42. size_t esp_netif_get_nr_of_ifs(void)
  43. {
  44. return s_esp_netif_counter;
  45. }
  46. esp_netif_t* esp_netif_next(esp_netif_t* netif)
  47. {
  48. return NULL;
  49. }
  50. esp_netif_t* esp_netif_next_unsafe(esp_netif_t* netif)
  51. {
  52. return NULL;
  53. }
  54. esp_netif_t *esp_netif_get_handle_from_ifkey(const char *if_key)
  55. {
  56. return NULL;
  57. }