14#include <LwipEthernet.h>
19#include <lwip/netif.h>
26extern std::function<void(
struct netif *)>
_addNetifCB;
170 volatile bool _up =
false;
190 netif->name[0] =
'p';
191 netif->name[1] =
'p';
206 for (
struct pbuf *
q =
p;
q !=
nullptr;
q =
q->next) {
208 if (
q->len ==
q->tot_len)
break;
221 if (
p ==
nullptr)
return;
std::function< void(struct netif *)> _removeNetifCB
std::function< void(struct netif *)> _addNetifCB
Portable PPP engine: LCP, PAP client and IPCP over an Arduino Stream.
Definition PPPEngine.h:134
void writeIPv4(const uint8_t *data, size_t len)
Adds data to the packet started with beginIPv4()
Definition PPPEngine.h:266
void start(Stream &io)
Starts the PPP negotiation on the indicated stream.
Definition PPPEngine.h:165
void process()
Reads available input and runs the timers: call frequently.
Definition PPPEngine.h:196
void setOfferedDNS(ip4_t dns1, ip4_t dns2=0)
DNS servers to offer the peer if it asks for them (server role)
Definition PPPEngine.h:143
void setLocalIP(ip4_t ip)
Optional static address configuration. 0 = negotiate with the peer.
Definition PPPEngine.h:139
uint32_t fcsErrors() const
Number of received frames with a wrong FCS.
Definition PPPEngine.h:298
ip4_t localIP() const
Our IP address (0 if not negotiated yet)
Definition PPPEngine.h:286
void setLogger(Print *log)
Debug output (nullptr to disable)
Definition PPPEngine.h:162
void setEchoInterval(uint32_t ms, uint8_t maxFailures=3)
LCP echo keep-alive: 0 disables it.
Definition PPPEngine.h:157
ip4_t dns2() const
Second DNS server received from the peer.
Definition PPPEngine.h:292
PPPPhase phase() const
Current link phase.
Definition PPPEngine.h:284
ip4_t dns1() const
First DNS server received from the peer.
Definition PPPEngine.h:290
void setPeerIP(ip4_t ip)
Address to assign to the peer if it requests one (server role)
Definition PPPEngine.h:141
void stop()
Closes the link gracefully (sends LCP Terminate-Request)
Definition PPPEngine.h:180
void setCredentials(const char *user, const char *password)
PAP credentials (used only if the peer requires authentication)
Definition PPPEngine.h:150
ip4_t peerIP() const
IP address of the peer.
Definition PPPEngine.h:288
bool beginIPv4()
Streaming API for chained buffers (e.g. lwIP pbuf)
Definition PPPEngine.h:260
void setRequestDNS(bool flag)
Request DNS servers from the peer (default true)
Definition PPPEngine.h:148
bool endIPv4()
Sends the packet started with beginIPv4()
Definition PPPEngine.h:268
void setPassive(bool passive)
Passive: do not send LCP requests before the peer starts negotiating.
Definition PPPEngine.h:155
uint16_t mtu() const
MTU we may use for sending (peer MRU)
Definition PPPEngine.h:294
const PPPStats & stats() const
Frame and packet counters.
Definition PPPEngine.h:296
Byte ring buffer with a fixed capacity of N bytes.
Definition IPStack.h:76
PPP network interface for RP2040 / RP2350 (arduino-pico): the TinyPPP engine registered as a point-to...
Definition TinyPPP_RP2040.h:40
struct netif * getNetIf()
The lwIP netif of the interface.
Definition TinyPPP_RP2040.h:161
bool begin(Stream &io)
Definition TinyPPP_RP2040.h:52
~TinyPPP_RP2040()
Definition TinyPPP_RP2040.h:45
IPAddress subnetMask() const
Always 255.255.255.255 (point-to-point link)
Definition TinyPPP_RP2040.h:144
void * _stateRef
Definition TinyPPP_RP2040.h:174
TinyPPP_RP2040(const TinyPPP_RP2040 &)=delete
bool _default
Definition TinyPPP_RP2040.h:172
void onLinkUp() override
Called when IPCP is opened: addresses are available.
Definition TinyPPP_RP2040.h:226
void setDefault(bool flag=true)
Make this interface the default route when the link is up (default true)
Definition TinyPPP_RP2040.h:113
volatile bool _up
Definition TinyPPP_RP2040.h:170
volatile Cmd _cmd
Definition TinyPPP_RP2040.h:169
bool waitConnected(uint32_t timeoutMs=30000)
Waits until the link is up.
Definition TinyPPP_RP2040.h:123
IPAddress localIP() const
Our IP address.
Definition TinyPPP_RP2040.h:140
wl_status_t status() const
WL_CONNECTED when the link is up, WL_NO_SHIELD before begin()
Definition TinyPPP_RP2040.h:135
Cmd
Definition TinyPPP_RP2040.h:164
bool _netifAdded
Definition TinyPPP_RP2040.h:171
static err_t output4(struct netif *netif, struct pbuf *p, const ip4_addr_t *addr)
Definition TinyPPP_RP2040.h:201
StateCallback _stateCallback
Definition TinyPPP_RP2040.h:173
void poll()
Definition TinyPPP_RP2040.h:177
bool connected() const
true when the link is up and has an IP address
Definition TinyPPP_RP2040.h:133
Stream * _io
Definition TinyPPP_RP2040.h:167
int _phID
Definition TinyPPP_RP2040.h:168
void end()
Terminates the link and removes the interface.
Definition TinyPPP_RP2040.h:72
bool config(IPAddress local, IPAddress peer=IPAddress(0, 0, 0, 0), IPAddress dns1=IPAddress(0, 0, 0, 0), IPAddress dns2=IPAddress(0, 0, 0, 0))
Definition TinyPPP_RP2040.h:92
void onIPv4Packet(const uint8_t *data, size_t len) override
Called for each received IPv4 packet.
Definition TinyPPP_RP2040.h:219
void setLogger(Print &out)
Debug output e.g. setLogger(Serial1)
Definition TinyPPP_RP2040.h:110
void onStateChange(StateCallback cb, void *ref=nullptr)
Definition TinyPPP_RP2040.h:155
IPAddress dnsIP(int n=0) const
The DNS server n (0 or 1) received from the peer.
Definition TinyPPP_RP2040.h:146
TinyPPP_RP2040 & operator=(const TinyPPP_RP2040 &)=delete
void onLinkDown() override
Called when the IP link goes down.
Definition TinyPPP_RP2040.h:250
void setPollingPeriod(int ms)
Definition TinyPPP_RP2040.h:120
IPAddress gatewayIP() const
The IP address of the peer.
Definition TinyPPP_RP2040.h:142
struct netif _netif
Definition TinyPPP_RP2040.h:166
static err_t netifInit(struct netif *netif)
Definition TinyPPP_RP2040.h:189
TinyPPP internals: PPP engine, HDLC framing and the IP stack.
Definition HDLC.h:11
IPAddress toIPAddress(ip4_t ip)
Converts an engine address to an Arduino IPAddress.
Definition PPPEngine.h:1146
NetworkClient PPPClient
Portable aliases for the network classes that work over PPP.
Definition TinyPPP_ESP32.h:31
NetworkUDP PPPUDP
Definition TinyPPP_ESP32.h:33
ip4_t fromIPAddress(const IPAddress &ip)
Converts an Arduino IPAddress to an engine address (0 if not set)
Definition PPPEngine.h:1152
TinyPPP_ESP32 TinyPPP
The PPP network interface of this platform.
Definition TinyPPP_ESP32.h:304
NetworkServer PPPServer
Definition TinyPPP_ESP32.h:32