esp_netif: Extend PPP netif API to control connection failure

This commit is contained in:
David Cermak
2020-11-25 16:37:36 +01:00
parent ef75b5a188
commit 2f6c60573e
4 changed files with 35 additions and 6 deletions

View File

@@ -38,6 +38,11 @@ typedef struct esp_netif_ppp_config {
*/
#define NETIF_PP_PHASE_OFFSET (0x100)
/** @brief event id offset for internal errors
*
*/
#define NETIF_PPP_INTERNAL_ERR_OFFSET (0x200)
/** @brief event ids for different PPP related events
*
*/
@@ -68,6 +73,7 @@ typedef enum {
NETIF_PPP_PHASE_RUNNING = NETIF_PP_PHASE_OFFSET + 10,
NETIF_PPP_PHASE_TERMINATE = NETIF_PP_PHASE_OFFSET + 11,
NETIF_PPP_PHASE_DISCONNECT = NETIF_PP_PHASE_OFFSET + 12,
NETIF_PPP_CONNECT_FAILED = NETIF_PPP_INTERNAL_ERR_OFFSET + 0,
} esp_netif_ppp_status_event_t;
/** @brief definitions of different authorisation types
@@ -89,7 +95,8 @@ typedef enum {
* @param[in] user User name
* @param[in] passwd Password
*
* @return ESP_OK on success, ESP_ERR_ESP_NETIF_INVALID_PARAMS if netif null or not PPP
* @return ESP_OK on success,
* ESP_ERR_ESP_NETIF_INVALID_PARAMS if the supplied netif is not of PPP type, or netif is null
*/
esp_err_t esp_netif_ppp_set_auth(esp_netif_t *netif, esp_netif_auth_type_t authtype, const char *user, const char *passwd);
@@ -98,10 +105,20 @@ esp_err_t esp_netif_ppp_set_auth(esp_netif_t *netif, esp_netif_auth_type_t autht
* @param[in] esp_netif Handle to esp-netif instance
* @param[in] config Pointer to PPP netif configuration structure
*
* @return ESP_OK on success, ESP_ERR_ESP_NETIF_INVALID_PARAMS if netif null or not PPP
* @return ESP_OK on success,
* ESP_ERR_ESP_NETIF_INVALID_PARAMS if the supplied netif is not of PPP type, or netif is null
*/
esp_err_t esp_netif_ppp_set_params(esp_netif_t *netif, const esp_netif_ppp_config_t *config);
/** @brief Gets parameters configured in the supplied esp-netif.
*
* @param[in] esp_netif Handle to esp-netif instance
* @param[out] config Pointer to PPP netif configuration structure
*
* @return ESP_OK on success,
* ESP_ERR_ESP_NETIF_INVALID_PARAMS if the supplied netif is not of PPP type, or netif is null
*/
esp_err_t esp_netif_ppp_get_params(esp_netif_t *netif, esp_netif_ppp_config_t *config);
#ifdef __cplusplus
}