Design Article
Guide to Embedded Systems Architecture - Part 1: Defining middleware
Tammy Noergaard
4/19/2010 2:29 PM EDT
Network Access/Data-link Layer Middleware Example: PPP (Point-to-Point Protocol)
PPP (point-to-point protocol) is a common OSI data-link (or network access layer under the TCP/IP model) protocol that can encapsulate and transmit data to higher layer protocols, such as IP, over a physical serial transmission medium (see Figure 10-5). PPP provides support for both asynchronous (irregular interval) and synchronous (regular interval) serial communication.

Figure 10-5: Data-link middleware
PPP is responsible for processing data passing through it as frames. When receiving data from a lower layer protocol, for example, PPP reads the bit fields of these frames to ensure that entire frames are received, that these frames are error free, that the frame is meant for this device (using the physical address retrieved from the networking hardware on the device), and to determine where this frame came from. If the data is meant for the device, then PPP strips all data-link layer headers from the frame, and the remaining data field, called a datagram, is passed up to a higher layer. These same header fields are appended to data coming down from upper layers by PPP for transmission outside the device.
In general, PPP software is defined via a combination of four submechanisms:
• The PPP encapsulation mechanism (in RFC 1661) such as the high-level data-link control (HDLC) framing in RFC1662 or the link control protocol (LCP) framing defined in RFC 1661 to process (i.e., demultiplex, create, verify checksum, etc).
• Data-link protocol handshaking, such as the link control protocol (LCP) handshaking defined in RFC 1661, responsible for establishing, configuring, and testing the data-link connection.
• Authentication protocols, such as PAP (PPP authentication protocol) in RFC 1334, used to manage security after the PPP link is established.
• Network control protocols (NCP), such as IPCP (Internet protocol control protocol) in RFC 1332, that establish and configure upper-layer protocol (i.e., OP, IPX, etc.) settings.
These submechanisms work together in the following manner: a PPP communication link, connecting both devices, can be in one of five possible phases at any given time, as shown in Table 10-1. The current phase of the communication link determines which mechanism - encapsulation, handshaking, authentication, and so on - is executed.
| Phase | Description |
| Link Dead | The link necessarily begins and ends with this phase. When an external event (such as carrier detection or network administrator configuration) indicates that the physical layer is ready to be used, PPP proceeds to the Link Establishment phase. During this phase, the LCP automaton (described later in this chapter) will be in the Initial or Starting states. The transition to the Link Establishment phase signals an Up event (discussed later in this chapter) to the LCP automaton. |
| Establish Link | The link control protocol (LCP) is used to establish the connection through an exchange of configuration packets. An establish link phase is entered once a Configure-Ack packet (described later in this chapter) has been both sent and received. |
| Authentication | Authentication is an optional PPP mechanism. If it does take place, it typically does so soon after the establish link phase. |
| Network Layer Protocol | Once PPP has completed the establish or authentication phases, each network-layer protocol (such as IP, IPX, or AppleTalk) MUST be separately configured by the appropriate network control protocol (NCP). |
| Link Termination | PPP can terminate the link at any time. after which PPP should proceed to the Link Dead phase. |

