📄 readme.txt
字号:
-*- mode: indented-text; -*-This code and the accompanying documentation may be used for anypurpose as long as my copyright is cited in any source codedistributed. This code is also available electronically from my website. http://people.ne.mediaone.net/carlson/ppp http://www.workingcode.com/pppThis is version 2.0. It was released with the second edition of "PPPDesign and Debugging." Newer versions may be available from the website.Copyright 2000 by James Carlson and Working Code.General Description The assumed model of operation uses upcalls to pass data between the character I/O subsystem, AHDLC, and a queuing layer, and uses a simple flat buffer structure to hold the data. This architecture allows various components to be plugged together to suit different needs. One issue with upcalls is that the low-level must either poll for transmit data or be told when data might be available. With this code, a general enable_transmit() call is used to inform the serial driver that it should call up through AHDLC to get more data to transmit. This call may be made at any time, whether or not transmit is already in progress. It is the responsibility of enable_transmit() to avoid disturbing the transmitter if an operation is in progress. Typically, this function will just enable transmit interrupts on the serial hardware or will add a bit to select for output, depending on system implementation.AHDLC Module The AHDLC module assumes that a receive-FIFO-full interrupt routine will unload the FIFO into a local buffer in the serial driver and then call ahdlc_receive() with a pointer to that buffer. Similarly, the ahdlc_transmit() routine should be called on a transmit-FIFO-empty interrupt to fill a local buffer that is then transmitted. If the ahdlc_transmit() routine returns zero data, then the transmit interrupt should be masked off. When new packets are ready for transmit, the upper layers should call enable_transmit() to restart transmission. These routines touch the buffer locations exactly once, and do so in strictly increasing order. It is therefore fairly easy to modify these routines to work directly with the serial hardware itself rather than a local buffer. To do this, the buffer pointer passed to ahdlc_receive() and ahdlc_transmit() must be a pointer to a memory-mapped I/O address for the serial FIFO. Two #defines are included in ahdlc.c to accomodate this usage. The receive routine in this module calls up through a user- supplied function to deliver received packets. The transmit routine calls up through a similar function to fetch new packets to transmit. These routines can point to either a general queue insert and fetch routine or to the LAP-B module. To avoid data copies with protocols that retransmit packets on error, such as LAP-B, the transmit routine does not free the buffer when it is done. The caller must do this. When AHDLC calls up for a new packet, it is implied that the previous packet may now be freed.LAP-B Module By default, this module provides a simple queuing service between PPP and AHDLC with no retransmission or reliability. When LAP-B protocol operation is started, it also provides reliable packet transport. Unlike AHDLC and the queue module, this module requires the use of two timers when LAP-B is running, one for retransmission and one to detect an idle channel. The code implements this requirement using a single external timer and a set of internal state variables. LAP-B supports flow control. If the user does not wish to receive more data, he can call the lapb_ready_state() function to stop data from the peer as soon as possible. This function is also used to subsequently reenable data reception. (This function is generally not used, but is provided for completeness.) Two queues are kept; one for receive and one for transmit. The entries in these queues are numbered (for I frame numbering purposes) using modular arthmetic based on the "k+1" value (window size). Note that the window size may be less than the sequence modulus, and thus a queue offset is kept relative to vs and vr.MP Module The RFC 1990 MP code offered here is mostly for demonstration of the fragmentation and reassembly algorithms. It's not particularly efficient or well-written, and it doesn't have the actual PPP state machines that are needed for a real implementation. It's possibly useful as a starting point or as a test or reference version.Minimal PPP This module is somewhat unrelated to the other code in this directory. It's a standalone implementation of PPP that uses UDP tunnels as its physical layer. It implements just LCP and IPCP, and only one option (IP-Address), but is otherwise complete. It follows RFC 1661 quite closely. This code was originally written to demonstrate a few of the ideas behind PPP (showing how the RFC can be translated into working code) and to allow for experimentation with the protocol. It does work and has been tested, but it probably shouldn't be used to build a full-fledged version. Paul Mackerras' ppp-2.3 is more appropriate for use in real systems since it's a far more complete implementation, though it is certainly much larger and harder to understand.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -