Protocols Lab

Champlain College Online

Instructor: Rick Eary

Lecture 5: Data Link Protocols - HDLC

There are many layer 2 (data link layer) protocols. In this lecture we will look at HDLC or high level data link control, which is widely used. Then we'll take a look at PPP or point to point protocol that is used extensively with TCP/IP. Following that we'll take a look at Ethernet data link level.

HDLC can be fairly complex, so let's start by looking at a simple implementation of HDLC called LAPB. We say that "LAPB is a subset of HDLC."

The primary purpose of any data link protocol is to provide error-free transmission over the physical layer channel. As you will recall from the OSI lecture, the physical layer is not required to provide error free transmission of bits. That is why we have a data link layer. Data link layer protocols may also provide additional functions such as station addressing.

LAPB which stands for link access procedure balanced is the layer 2 protocol used to carry X.25 packets between an end user and an X.25 public packet data network (PPDN). We will not delve into X.25 here, just the LAPB protocol.

What is a Frame?

Data Link protocols package bits into a frame format. Basically the frame wraps additional information around the user data. Another name for user data is payload.

The additional information permits the receiving station to determine whether there were any errors in the transmission. If there were, the receiver requests that the sender retransmit the information. The additional fields also support other capabilities such as addressing, line initialization, etc.

What does a LAPB frame look like?

This is the LAPB frame format:

Flag

Address Field

Control Field

Payload

FCS

Flag

 

The flag is a unique bit pattern that is only allowed to appear at the beginning and end of a frame. This allows the receiver to delimit frames. Delimiting simply means determining where one frame ends and the next one begins.

What is Bit Stuffing

The flag characters are needed to delimit the frame. The bit pattern in the 8 bit flag character must be unique to support frame delimiting. The flag character bit pattern is 01111110. A zero, six ones, and another 0.

This presents a problem for HDLC. HDLC is what we call a bit oriented protocol. This means that HDLC does not impose any restrictions on the bit patterns in the payload (data) field. The payload must be in multiples of 8 bits, in other words the quantity of bits, divided by 8, would not have a remainder. However, the payload is not restricted as to the pattern of bits. Another way to say this is that each group of 8 bits does not need to conform to any pre-established code such as ASCII or EBCDIC.

What happens if some of the bits in the payload look like a flag character? How does HDLC distinguish between valid flags and 01111110 patterns in the data? The answer is that all HDLC senders and receivers use bit stuffing.

The rule for bit stuffing is simple. If any bit stream other than flags has 5 consecutive 1 bits then a 0 bit is inserted immediately after the five 1 bits.

This insertion is done by the HDLC sending device. The receiving device, once it has received a valid beginning flag character, screens for stuffed bits. Anytime the receiver sees five 1 bits followed by a 0 it removes the 0. If it sees a string of six 1 bits that have a leading and trailing 0 then it knows it has received the end flag.

Pretty slick when you think about it. J

What is the Address Field used for?

LAPB, as mentioned, is actually a subset of HDLC. HDLC uses the address field because it can support multiple stations on a channel.

LAPB however only works with 2 end points or stations so the address field us simply used to indicate whether the frame is a command or a response.

The control field serves to identify the type of the frame such as information frame, frame reject, etc. This field also includes sequence numbers, control features and error tracking according to the frame type.

What goes in the Payload?

The payload, as mentioned previously, is the user data. You should note that I am using the term user in a very general sense. For example, a process running on a server or workstation in this context could be a user. The IP protocol would be a user to HDLC. In that instance the HDLC payload would be an entire IP packet.

Web Break

OK, before we go on I want you to visit this web site: www.protocols.com. When you get there I want you go to the Protocol Directory. Once you are there follow the hyperlinks to LAPB and HDLC. You should find them on the same page.

Read through the LAPB information. See if it makes sense to you based on the lecture material you have just read. After you read through LAPB skim through the information on HDLC.

After you have done that come back to this lecture and finish reading about HDLC.

More on HDLC

As you can see from the web site, HDLC is a fairly complex protocol. We will hit some highlights here. As a convenience I have listed some of the HDLC information from the site following this lecture.

I think the easiest way to explain Response Mode is to give you a real life example of Normal Response Mode NRM.

Automatic Teller Machines are "everywhere". A common networking technique is to use multi-drop DDS channels as illustrated below:

The host is the primary station, also called a master.

The primary sends poll frames to the secondary stations (slaves). Slaves can only respond to polls from the host, and they can only send data to the host.

The bridge is simply an electronic means of connecting the primary and secondary channels together.

ATM networks can be quite large. ATM's send very little traffic with each transaction, so they do not saturate the data channel.

From a traffic standpoint you can easily accommodate 50 to 100 ATM's on a 56 Kbps line. Of course if you start shipping lots of fancy images down to the ATM then this situation will change, but most ATM's that I have seen are basically moving text data.

Addressing allows us to have more than two stations on the channel. Using an 8 bit address we can have 127 stations on a channel. One of the bits is used to indicate extended addressing and one of the remaining 128 bit combinations is reserved for a broadcast address when the primary wants to send information to all stations.

As the web site explains, extended addressing can be used to allow more bytes in the address field, which significantly opens up the number of addresses that can be defined.

How does HDLC work?

If you were working on an HDLC implementation, or trouble shooting and HDLC link you might want to get a copy of the ISO (International Standards Organization) specification # 3309. You can obtain one from http://www.iso.ch/cate/d8561.html.

An official copy of the spec cost about $60 with shipping, so you might first check with your favorite vendor sites, and of course search engines, to obtain free copies of HDLC documentation.

I'll walk you through the basic operation of Normal Response Mode (NRM).

Initializing the line

The master station sends a Set Normal Response Mode frame to each slave station on the channel. This causes the station to prepare for NRM operation. The slave acknowledges this to the master by responding with an Unnumbered Acknowledgement UA frame.

Polling the Line

Addresses are 8 bits, but if you view them on a protocol analyzer they are usually displayed as hexadecimal characters. Let's assume that the ATM network shown above has assigned the four stations hex addresses of C1, C2, C3, and C4.

The master sends a poll frame to a specific station, such as station address C4. All other stations (C1-C3) ignore the frame since their address was not in the address field.

There are several possible responses from C3:

  1. If C3 has data to send it will now send the data in I-Frames (information frames).
  2. If C3 does not have data to send it will respond with an RR-Frame (Receiver Ready). This is an indication to the master that it can move on to polling the next station.
  3. If C3 is busy for some reason, then it will send an RNR-Frame (Receiver Not Ready).

In this manner the host (master station) can step around the line and request information from each station. In fact, if some stations produce more traffic than other stations, the host can be configured to poll those stations more frequently.

Similarly the host can select a station and then forward information to that station. In the case of ATM's, perhaps the balance in your checking account, or maybe an authorization for the ATM to dispense $20.

That is the basic operation of a multi-point HDLC line. The actually operation is more complex, but this should give you a general feel for it.

 

The following information is from www.protocols.com.

Modes of operation
HDLC has 3 modes of operation according to the strength of the master/slave relationship. This is determined by a unique frame type specifier:

Window size
HDLC supports an extended window size (modulo 128) where the number of possible outstanding frames for acknowledgement is raised from 8 to 128. This extension is generally used for satellite transmissions where the acknowledgement delay is significantly greater than the frame transmission times. The type of the link initialization frame determines the modulo of the session and an "E" is added to the basic frame type name (e.g., SABM becomes SABME).

Extended address
HDLC provides another type of extension to the basic format. The address field may be extended to more than one byte by agreement between the involved parties. When an address extension is used, the presence of a 1 bit in the first bit of an address byte indicates that the following byte is also an address byte. The last byte of the string of address bytes is signalled by a 0 bit in the first position of the byte.

Frame types

There are three different frame types supported by HDLC: Supervisory, Unnumbered, and Information.

The following are the Supervisory Frame Types in HDLC:

RR

Information frame acknowledgement and indication to receive more.

REJ

Request for retransmission of all frames after a given sequence number.

RNR

Indicates a state of temporary occupation of station (e.g., window full).

SREJ

Request for retransmission of one given frame sequence number.

The following are the Unnumbered Frame Types in HDLC:

DISC

Request disconnection.

UA

Acknowledgement frame.

DM

Response to DISC indicating disconnected mode.

FRMR

Frame reject.

SABM

Initiator for asynchronous balanced mode. No master/slave relationship.

SABME

SABM in extended mode.

SARM

Initiator for asynchronous response mode. Semi master/slave relationship.

SARME

SAMR in extended mode.

REST

Reset sequence numbers.

CMDR

Command reject.

SNRM

Initiator for normal response mode. Full master/slave relationship.

SNRME

SNRM in extended mode.

RD

Request disconnect.

RIM

Secondary station request for initialization after disconnection.

SIM

Set initialization mode.

UP

Unnumbered poll.

UI

Unnumbered information. Sends state information/data.

XID

Identification exchange command.

There is one Information Frame Type in HDLC:

Info

Information frame.