esp_openthread_border_router.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2021 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. #pragma once
  14. #include "esp_netif.h"
  15. #include "esp_netif_types.h"
  16. #include "esp_openthread.h"
  17. #include "openthread/instance.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /**
  22. * @brief Initializes the border router features of OpenThread.
  23. *
  24. * @note Calling this function will make the device behave as an OpenThread
  25. * border router. Kconfig option CONFIG_OPENTHREAD_BORDER_ROUTER is required.
  26. *
  27. * @param[in] backbone_netif The backbone network interface (WiFi or ethernet)
  28. *
  29. * @return
  30. * - ESP_OK on success
  31. * - ESP_ERR_NOT_SUPPORTED if feature not supported
  32. * - ESP_ERR_INVALID_STATE if already initialized
  33. * - ESP_FIAL on other failures
  34. *
  35. */
  36. esp_err_t esp_openthread_border_router_init(esp_netif_t *backbone_netif);
  37. /**
  38. * @brief Deinitializes the border router features of OpenThread.
  39. *
  40. * @return
  41. * - ESP_OK on success
  42. * - ESP_ERR_INVALID_STATE if not initialized
  43. * - ESP_FIAL on other failures
  44. *
  45. */
  46. esp_err_t esp_openthread_border_router_deinit(void);
  47. /**
  48. * @brief Gets the backbone interface of OpenThread border router.
  49. *
  50. * @return
  51. * The backbone interface or NULL if border router not initialized.
  52. *
  53. */
  54. esp_netif_t *esp_openthread_get_backbone_netif(void);
  55. #ifdef __cplusplus
  56. }
  57. #endif