20#include "esp_netif_ppp.h"
21#include "freertos/FreeRTOS.h"
22#include "freertos/task.h"
24#ifndef TINYPPP_RX_BUFFER
25#define TINYPPP_RX_BUFFER 512
61 log_e(
"register NETIF_PPP_STATUS failed");
68 log_e(
"esp_netif_new failed");
78 log_e(
"esp_netif_attach failed");
83 if (
_user.length() > 0) {
93 log_e(
"task creation failed");
114 if (
_task !=
nullptr) {
178 return out.print(
",TinyPPP");
198 pppConfig.ppp_phase_event_enabled =
true;
199 pppConfig.ppp_error_event_enabled =
true;
224 size_t n = self->
_io->readBytes(
235 self->
log(
"restarting");
239 self->
_task =
nullptr;
244 log_d(
"TinyPPP: %s (%d)",
msg, (
int)
id);
245 if (
_log ==
nullptr)
return;
246 _log->print(
"PPP: ");
263 if (
netif != self->_esp_netif)
return;
277 log(
"link down, error",
id);
291 log(
"phase running");
293 log(
"phase establish");
295 log(
"phase network");
297 log(
"connect failed");
#define TINYPPP_RX_BUFFER
Definition TinyPPP_ESP32.h:25
TCP client over PPP: used like WiFiClient or EthernetClient.
Definition PPPSockets.h:25
TCP server over PPP: used like WiFiServer or EthernetServer.
Definition PPPSockets.h:144
UDP socket over PPP: used like WiFiUDP or EthernetUDP.
Definition PPPSockets.h:206
Byte ring buffer with a fixed capacity of N bytes.
Definition IPStack.h:76
size_t available() const
Number of stored bytes.
Definition IPStack.h:79
size_t write(const uint8_t *data, size_t len)
Appends data: returns the number of bytes stored.
Definition IPStack.h:88
PPP network interface for ESP32 (arduino-esp32 3.x): ESP-IDF lwIP PPP via esp_netif,...
Definition TinyPPP_ESP32.h:39
static void rxTask(void *arg)
Definition TinyPPP_ESP32.h:218
volatile bool _stopping
Definition TinyPPP_ESP32.h:167
static void postEvent(arduino_event_id_t id)
Definition TinyPPP_ESP32.h:181
volatile uint32_t _restartAt
Definition TinyPPP_ESP32.h:168
String _user
Definition TinyPPP_ESP32.h:169
EventGroupHandle_t _events()
Definition TinyPPP_ESP32.h:172
esp_event_handler_instance_t _pppEventInstance
Definition TinyPPP_ESP32.h:164
static esp_err_t transmit(void *handle, void *buffer, size_t len)
Definition TinyPPP_ESP32.h:204
bool waitConnected(uint32_t timeoutMs=30000)
Waits until we have got an IP address.
Definition TinyPPP_ESP32.h:143
static void pppEventCb(void *arg, esp_event_base_t base, int32_t id, void *data)
Definition TinyPPP_ESP32.h:256
Driver _driver
Definition TinyPPP_ESP32.h:160
void log(const char *msg, int32_t id=-1)
Definition TinyPPP_ESP32.h:243
volatile bool _running
Definition TinyPPP_ESP32.h:166
void onPppEvent(int32_t id)
Definition TinyPPP_ESP32.h:268
void setCredentials(const char *user, const char *password)
PAP credentials, if the peer requires authentication (before begin())
Definition TinyPPP_ESP32.h:134
bool connected() const
true when the link is up and we have an IP address
Definition TinyPPP_ESP32.h:150
static constexpr EventBits_t DEAD_BIT
Definition TinyPPP_ESP32.h:153
Stream * _io
Definition TinyPPP_ESP32.h:161
TinyPPP_ESP32(const TinyPPP_ESP32 &)=delete
bool begin(Stream &io, UBaseType_t taskPriority=5, BaseType_t core=tskNO_AFFINITY)
Definition TinyPPP_ESP32.h:51
void end()
Terminates the link and removes the interface.
Definition TinyPPP_ESP32.h:105
size_t printDriverInfo(Print &out) const override
Definition TinyPPP_ESP32.h:177
void setLogger(Print &out)
Debug output of the PPP state changes, e.g. setLogger(Serial1)
Definition TinyPPP_ESP32.h:140
TinyPPP_ESP32 & operator=(const TinyPPP_ESP32 &)=delete
String _password
Definition TinyPPP_ESP32.h:170
EventGroupHandle_t _eventGroup
Definition TinyPPP_ESP32.h:165
~TinyPPP_ESP32()
Definition TinyPPP_ESP32.h:44
TaskHandle_t _task
Definition TinyPPP_ESP32.h:163
Print * _log
Definition TinyPPP_ESP32.h:162
static esp_err_t postAttach(esp_netif_t *netif, void *handle)
Definition TinyPPP_ESP32.h:188
TinyPPP internals: PPP engine, HDLC framing and the IP stack.
Definition HDLC.h:11
Definition TinyPPP_ESP32.h:155
TinyPPP_ESP32 * self
Definition TinyPPP_ESP32.h:157
esp_netif_driver_base_t base
Definition TinyPPP_ESP32.h:156