TinyPPP
PPP networking over any Arduino Stream
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Enumerations | Functions | Variables
PPPEngine.h File Reference
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <Arduino.h>
#include "HDLC.h"

Go to the source code of this file.

Classes

class  PPPEngine
 Portable PPP engine: LCP, PAP client and IPCP over an Arduino Stream. More...
 
struct  PPPStats
 Frame and packet counters of a PPPEngine. More...
 

Namespaces

namespace  tinyppp
 TinyPPP internals: PPP engine, HDLC framing and the IP stack.
 

Macros

#define TINYPPP_MRU   1500
 
#define TINYPPP_RESTART_MS   2000
 

Enumerations

enum  CPCode : uint8_t {
  CONF_REQ = 1 , CONF_ACK = 2 , CONF_NAK = 3 , CONF_REJ = 4 ,
  TERM_REQ = 5 , TERM_ACK = 6 , CODE_REJ = 7 , PROT_REJ = 8 ,
  ECHO_REQ = 9 , ECHO_REP = 10 , DISCARD_REQ = 11
}
 Control protocol (LCP, IPCP) packet codes. More...
 
enum class  CPState : uint8_t {
  Initial , Stopped , Closing , ReqSent ,
  AckRcvd , AckSent , Opened
}
 Simplified RFC 1661 automaton states. More...
 
enum  IPCPOption : uint8_t { IPCP_COMPRESSION = 2 , IPCP_ADDRESS = 3 , IPCP_DNS1 = 129 , IPCP_DNS2 = 131 }
 IPCP configuration options. More...
 
enum  LCPOption : uint8_t {
  LCP_MRU = 1 , LCP_ACCM = 2 , LCP_AUTH = 3 , LCP_MAGIC = 5 ,
  LCP_PFC = 7 , LCP_ACFC = 8
}
 LCP configuration options. More...
 
enum class  PPPPhase : uint8_t {
  Dead , Establish , Authenticate , Network ,
  Running , Terminate
}
 Overall link phase. More...
 

Functions

ip4_t fromIPAddress (const IPAddress &ip)
 Converts an Arduino IPAddress to an engine address (0 if not set)
 
ip4_t toIp4 (uint8_t a, uint8_t b, uint8_t c, uint8_t d)
 Builds an address from its 4 bytes (a.b.c.d)
 
IPAddress toIPAddress (ip4_t ip)
 Converts an engine address to an Arduino IPAddress.
 
const char * toStr (PPPPhase p)
 Name of a phase (for logging)
 

Variables

static constexpr uint16_t PPP_IP = 0x0021
 PPP protocol numbers.
 
static constexpr uint16_t PPP_IPCP = 0x8021
 
static constexpr uint16_t PPP_IPV6 = 0x0057
 
static constexpr uint16_t PPP_LCP = 0xC021
 
static constexpr uint16_t PPP_PAP = 0xC023
 

Macro Definition Documentation

◆ TINYPPP_MRU

#define TINYPPP_MRU   1500

A small, portable PPP implementation (RFC 1661 LCP, RFC 1332 IPCP, RFC 1334 PAP client, RFC 1877 DNS options) that runs over any Arduino Stream. It does not contain an IP stack: received IPv4 packets are handed to onIPv4Packet() and outgoing packets are passed to sendIPv4() or beginIPv4()/writeIPv4()/endIPv4().

The engine is not thread safe: the caller must serialize process() and the send methods (e.g. by holding the lwIP lock).

◆ TINYPPP_RESTART_MS

#define TINYPPP_RESTART_MS   2000