|
TinyPPP
PPP networking over any Arduino Stream
|
Portable PPP engine: LCP, PAP client and IPCP over an Arduino Stream. More...
#include <PPPEngine.h>
Public Member Functions | |
| virtual | ~PPPEngine ()=default |
| bool | beginIPv4 () |
| Streaming API for chained buffers (e.g. lwIP pbuf) | |
| ip4_t | dns1 () const |
| First DNS server received from the peer. | |
| ip4_t | dns2 () const |
| Second DNS server received from the peer. | |
| bool | endIPv4 () |
| Sends the packet started with beginIPv4() | |
| uint32_t | fcsErrors () const |
| Number of received frames with a wrong FCS. | |
| void | input (const uint8_t *data, size_t len) |
| bool | isStarted () const |
| true after start() until stop() | |
| bool | isUp () const |
| true when IPCP is open and IPv4 packets can be exchanged | |
| ip4_t | localIP () const |
| Our IP address (0 if not negotiated yet) | |
| uint16_t | mtu () const |
| MTU we may use for sending (peer MRU) | |
| ip4_t | peerIP () const |
| IP address of the peer. | |
| PPPPhase | phase () const |
| Current link phase. | |
| void | process () |
| Reads available input and runs the timers: call frequently. | |
| void | processTimers (uint32_t now) |
| Runs the retransmission and keep-alive timers. | |
| bool | sendIPv4 (const uint8_t *data, size_t len) |
| Sends a complete IPv4 packet. | |
| void | setCredentials (const char *user, const char *password) |
| PAP credentials (used only if the peer requires authentication) | |
| void | setEchoInterval (uint32_t ms, uint8_t maxFailures=3) |
| LCP echo keep-alive: 0 disables it. | |
| void | setLocalIP (ip4_t ip) |
| Optional static address configuration. 0 = negotiate with the peer. | |
| void | setLogger (Print *log) |
| Debug output (nullptr to disable) | |
| void | setOfferedDNS (ip4_t dns1, ip4_t dns2=0) |
| DNS servers to offer the peer if it asks for them (server role) | |
| void | setPassive (bool passive) |
| Passive: do not send LCP requests before the peer starts negotiating. | |
| void | setPeerIP (ip4_t ip) |
| Address to assign to the peer if it requests one (server role) | |
| void | setRequestDNS (bool flag) |
| Request DNS servers from the peer (default true) | |
| void | start (Stream &io) |
| Starts the PPP negotiation on the indicated stream. | |
| const PPPStats & | stats () const |
| Frame and packet counters. | |
| void | stop () |
| Closes the link gracefully (sends LCP Terminate-Request) | |
| void | writeIPv4 (const uint8_t *data, size_t len) |
| Adds data to the packet started with beginIPv4() | |
Protected Member Functions | |
| void | logf (const char *fmt,...) |
| virtual void | onIPv4Packet (const uint8_t *data, size_t len) |
| Called for each received IPv4 packet. | |
| virtual void | onLinkDown () |
| Called when the IP link goes down. | |
| virtual void | onLinkUp () |
| Called when IPCP is opened: addresses are available. | |
| virtual void | onPhase (PPPPhase phase) |
| Called on phase changes. | |
Static Protected Member Functions | |
| static const char * | ipStr (ip4_t ip, char *buf) |
Portable PPP engine: LCP, PAP client and IPCP over an Arduino Stream.
The engine has no IP stack: subclasses receive IPv4 packets in onIPv4Packet() and are notified about the link state with onLinkUp() and onLinkDown(). Call process() regularly to handle input and timers.
|
inline |
Streaming API for chained buffers (e.g. lwIP pbuf)
|
inline |
First DNS server received from the peer.
|
inline |
Second DNS server received from the peer.
|
inline |
Sends the packet started with beginIPv4()
|
inline |
Number of received frames with a wrong FCS.
Feeds raw bytes (alternative to process() when you read the stream yourself)
|
inline |
true when IPCP is open and IPv4 packets can be exchanged
|
inline |
Our IP address (0 if not negotiated yet)
|
inline |
MTU we may use for sending (peer MRU)
Called for each received IPv4 packet.
Reimplemented in TinyPPP_Generic, and TinyPPP_RP2040.
Called when the IP link goes down.
Reimplemented in TinyPPP_Generic, and TinyPPP_RP2040.
Called when IPCP is opened: addresses are available.
Reimplemented in TinyPPP_Generic, and TinyPPP_RP2040.
|
inline |
IP address of the peer.
|
inline |
Current link phase.
|
inline |
Reads available input and runs the timers: call frequently.
PAP credentials (used only if the peer requires authentication)
LCP echo keep-alive: 0 disables it.
Optional static address configuration. 0 = negotiate with the peer.
DNS servers to offer the peer if it asks for them (server role)
Passive: do not send LCP requests before the peer starts negotiating.
|
inline |
Closes the link gracefully (sends LCP Terminate-Request)
Adds data to the packet started with beginIPv4()