Add PPP auth types

This commit is contained in:
2023-09-12 11:29:36 +02:00
parent 7c5004c19e
commit 0bed1ebabe
2 changed files with 24 additions and 0 deletions

View File

@ -200,6 +200,24 @@ const char * toString(wifi_err_reason_t reason)
return "UNKNOWN";
}
#ifdef CONFIG_PPP_SUPPORT
std::string toString(esp_netif_auth_type_t authType)
{
switch (authType)
{
case NETIF_PPP_AUTHTYPE_NONE: return "NONE";
case NETIF_PPP_AUTHTYPE_PAP: return "PAP";
case NETIF_PPP_AUTHTYPE_CHAP: return "CHAP";
case NETIF_PPP_AUTHTYPE_MSCHAP: return "MSCHAP";
case NETIF_PPP_AUTHTYPE_MSCHAP_V2: return "MSCHAP_V2";
case NETIF_PPP_AUTHTYPE_EAP: return "EAP";
}
ESP_LOGW(TAG, "Unknown esp_netif_auth_type_t(%i)", std::to_underlying(authType));
return fmt::format("Unknown esp_netif_auth_type_t({})", std::to_underlying(authType));
}
#endif
template<> std::expected<mac_t, std::string> fromString<mac_t>(std::string_view str)
{
mac_t result{};

View File

@ -13,6 +13,9 @@
#include <esp_netif_ip_addr.h>
#include <esp_netif_types.h>
#include <lwip/ip_addr.h>
#ifdef CONFIG_PPP_SUPPORT
#include <esp_netif_ppp.h>
#endif
namespace wifi_stack {
bool wifi_ap_config_equal(const wifi_ap_config_t& lhs, const wifi_ap_config_t& rhs);
@ -24,6 +27,9 @@ std::string toString(wifi_bandwidth_t bandwidth);
std::string toString(esp_interface_t interface);
std::string toString(esp_netif_dhcp_status_t status);
const char * toString(wifi_err_reason_t reason);
#ifdef CONFIG_PPP_SUPPORT
std::string toString(esp_netif_auth_type_t);
#endif
template<typename T> std::expected<T, std::string> fromString(std::string_view str) = delete;