lwIP has support for the Point-to-Point Protocol which is used to encapsulate Internet Protocol traffic between two machines. PPP becomes useful in cases when you're wanting to connect your embedded hardware project using lwIP and your computer together while you're lacking an ethernet interface on said hardware project, but does have an available UART for lwIP to use. In that case you would specifically use PPPoS (Point-to-Point over Serial) which is still PPP, but has over serial support.
An alternative to using PPPoS that's supported in lwIP is SLIP which is the predecessor to PPP.
At the time of this writing PPP is supported under:
- Multi-threading operation (NO_SYS==0)
- Single-threading (polling) operation (NO_SYS==1) CVS HEAD Only
Work In ProgressEdit
This page is still a work in progress and should not be used as reference material until it is complete. Namtron 00:12, June 29, 2010 (UTC)
PPP from an application perspectiveEdit
In this example we'll assume the following conditions:
- Project has an available UART port to use for PPPoS
- Project lacks an OS, therefore requires single-thread (polling) operation
In order to use PPP in polling or NO_SYS=1 operation you must use lwIP source code that has been checked out from CVS on or after 2010-06-21, or use any 1.4.x release (once it becomes available).
lwipopts.h should have the following similar setup in terms of PPP configuration:
#define NO_SYS 1 // No Operating System used #define LWIP_SOCKET (NO_SYS==0) #define LWIP_NETCONN (NO_SYS==0) #define LWIP_ARP 0 #define ARP_QUEUEING 0 #define IP_OPTIONS_ALLOWED 1 // IP options are allowed (but not parsed) #define IP_REASSEMBLY 1 // Reassemble incoming fragmented IP packets #define IP_FRAG 1 // Fragment outgoing IP packets if their size exceeds MTU #define LWIP_ICMP 1 // Enable ICMP module inside the IP stack. #define LWIP_RAW 1 // Enable application layer to hook into the IP layer itself (needed since netconn and BSD sockets not usable in NO_SYS==1) #define LWIP_UDP 1 // Enable User Datagram Protocol support #define LWIP_TCP 1 // enable Transmission Control Protocol support #define PPP_SUPPORT 1 // enable Point-to-Point Protocol support #if PPP_SUPPORT #define PPPOE_SUPPORT 0 // disable PPP Over Ethernet support #define PPPOS_SUPPORT 1 // enable PPP Over Serial support [our main connection] #define NUM_PPP 1 // maximum PPP connections possible #define PAP_SUPPORT 1 // PPP: Password Authentication Protocol #define CHAP_SUPPORT 1 // PPP: Challenge Handshake Authentication Protocol #define VJ_SUPPORT 1 // VJ header compression #define MD5_SUPPORT 1 // MD5 hash, must enable it when CHAP_SUPPORT==1 #else #define PPPOS_SUPPORT 0 #define NUM_PPP 0 #define PAP_SUPPORT 0 #define CHAP_SUPPORT 0 #define VJ_SUPPORT 0 #define MD5_SUPPORT 0 #endif // PPP_SUPPORT #define LWIP_NETIF_API 0 // don't support netif api (in netifapi.c, requires NO_SYS==0) #define LWIP_NETIF_STATUS_CALLBACK 0 // [Disabled] Support a callback function whenever an interface changes its up/down status (i.e., due to DHCP IP acquistion) #define LWIP_NETIF_LINK_CALLBACK 0 // [Disabled] Support a callback function from an interface whenever the link changes (i.e., link down) #define LWIP_POSIX_SOCKETS_IO_NAMES 0 // Don't use POSIX sockets
PPP support history in lwIPEdit
- RFC 1661 The Point-to-Point Protocol (PPP)