HDLC and PPP Data Link Protocols Explained

HDLC Frame Control Fields

The Information (I) field is used to transport user data and network layer data. It includes information for error and flow control (where piggybacking is applicable).

It contains a 1-bit Poll/Final (P/F) bit (if it’s 0, it’s an I-frame) and the next 3 bits: N(S) (send sequence number) and the last 3 bits: N(R) (receive sequence number), which is the acknowledgment field when piggybacking is used.

The N(S) and N(R) bits are only meaningful when the P/F bit is active. The P/F bit is set by the primary station when it sends a command to a secondary station. It indicates the end when the frame sent by the secondary is a response to a primary frame.

Supervisory (S) Control Field

These frames are used for error and flow control when piggybacking is not possible or difficult. They do not contain information.

The first two bits of the Supervisory control field are ’10’. The last 3 bits, N(R), indicate the acknowledgment (ACK) or rejection (NAK) number. There are 4 types of S-frames, as described below:

  • Ready to Receive (RR): Subfield code ’00’. Confirms the receiver is ready to receive.
  • Not Ready to Receive (RNR): Subfield code ’10’. Indicates the receiver is busy and cannot receive more. Acts as a congestion control mechanism, asking the sender to reduce its speed.
  • Reject (REJ): Subfield code ’01’. This is a NAK with a ‘go-back-N’ ARQ, informing the sender, before the timer expires, that the last frame was lost or damaged.
  • Selective Reject (SREJ): Subfield code ’11’. Used in NAK frames with selective repeat ARQ.

Unnumbered (U) Control Fields

These frames are used to exchange control information and manage sessions between two connected devices. They contain an information field, used only for system management information.

They have a 2-bit prefix before the P/F bit and a 3-bit prefix after the P/F bit. There are up to 32 types of U-frames.

Point-to-Point Protocol (PPP)

PPP provides several services:

  • PPP defines the frame format exchanged between devices.
  • PPP defines how two devices can negotiate the establishment and exchange of data.
  • PPP defines how to encapsulate network layer data into a link layer frame.
  • PPP defines how two devices can authenticate each other.
  • PPP provides multiple network layer services and supports a variety of network layer protocols.
  • PPP provides connections over multiple links.
  • PPP provides network address configurations. This is useful when a home user needs a temporary network address to connect to the internet.

PPP Frame Format

  • Flag: The PPP frame begins and ends with a 1-byte flag with the pattern 01111110 (0x7E). Like HDLC, PPP is a byte-oriented protocol, unlike bit-oriented DLC.
  • Address: The address field is 1 byte and is set to the constant value 11111111 (broadcast address).
  • Control: A constant value of 00000011 (0x03), imitating unnumbered HDLC frames. It does not provide error or flow control. The control field also limits error detection. This field is not strictly necessary (it can be omitted).
  • Protocol: Defines what is transported in the data field: user data or other information.
  • Payload (Data Field): Transports user data or other information. The data field is a sequence of bytes with a default maximum field of 1500 bytes. The data byte pattern is omitted if it appears in the flag field (byte stuffing).
  • FCS (Frame Check Sequence): The FCS is simply a 2 or 4-byte standard Cyclic Redundancy Check (CRC).

PPP Communication Phases

  • Dead Phase: In this phase, the link is not used. The line is silent.
  • Establish Phase: When one of the two parties starts communication, it enters the link establishment phase. In this phase, options are negotiated between the two parties. If negotiation succeeds, it proceeds to the authentication phase (if necessary) or directly to the network phase. Packets are exchanged.
  • Authenticate Phase: This is optional; both parties can decide during the establishment phase to skip this phase. However, if they decide to proceed with authentication, several authentication packets are sent. If successful, it skips to the network phase; otherwise, it goes to the termination phase.
  • Network Phase: Network layer protocol negotiation occurs. PPP specifies that two nodes must agree to establish a network layer before exchanging higher-level network data.
  • Open Phase: The open phase is for data transfer. Data packet exchange begins. The connection remains in this phase until one of the ends wishes to terminate the connection.
  • Terminate Phase: The termination phase cuts the connection. Several packets are exchanged between the ends to notify both parties to clean up and close the remaining data link.