0% found this document useful (0 votes)
784 views314 pages

Understanding Data Communications and Networks, Shay

This document discusses the history and evolution of communication technologies from the telegraph to modern networks. It describes Alexander Graham Bell's invention of the telephone in 1876, which allowed voice transmission over wires. Early telephone systems required operators to manually connect calls using switchboards. Over 70 years, telephone networks expanded and dialing systems were developed. Communication satellites launched in the 1960s enabled global television and phone transmission. The document outlines how modern networks allow electronic mail, file transfers, and internet access between computers locally and worldwide.

Uploaded by

Salvador Alcaraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
784 views314 pages

Understanding Data Communications and Networks, Shay

This document discusses the history and evolution of communication technologies from the telegraph to modern networks. It describes Alexander Graham Bell's invention of the telephone in 1876, which allowed voice transmission over wires. Early telephone systems required operators to manually connect calls using switchboards. Over 70 years, telephone networks expanded and dialing systems were developed. Communication satellites launched in the 1960s enabled global television and phone transmission. The document outlines how modern networks allow electronic mail, file transfers, and internet access between computers locally and worldwide.

Uploaded by

Salvador Alcaraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 314

2942 | Ch 01 Page 2 Thursday, July 30, 1998 2:48 PM

2 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

obvious verbal or visual medium began a sequence of events that forever changed
the way people communicate.
In 1876 Alexander Graham Bell took the telegraph one step further. Rather than
converting a message into a sequence of dots and dashes, he showed that a voice
could be converted directly to electrical energy and transmitted over a wire using
continuously varying voltages. At the wire’s other end the electrical signals were
converted back to sound. The result was that a person’s voice could be transmitted
electronically between two points as long as a physical connection existed between
them. To most people whose lives were based on only what they could see and hear,
this invention was absolutely incredible and seemed magical.
The earliest telephones required a different pair of wires for each phone to
which you wished to connect. To place a call, a person had to first connect the tele-
phone to the correct wires and then hope the person on the other end was there lis-
tening. There were no bells or signaling devices to interrupt dinner. That changed
with the invention of the switchboard (Figure 1.1), a switching device that con-
nected lines between two telephones. Callers simply picked up the phone and recited
the number of the person they wished to call. Telephones had not yet evolved to the
point where people had to perform manual activities such as dialing numbers or
pushing buttons. Establishing connections was voice activated. That is, an operator
heard the number and then used a switchboard to connect one person’s phone lines
with another person’s lines.
During the next 70 years the telephone system grew to the point where the tele-
phone became a common device in a home. Most of us do not even think about how
the telephone system works. We know we can dial a number and be connected to
just about anywhere in the world.

Early Switchboards

switchboard

connection was manually established by


a switchboard operator

Black process 45.0° 133.0 LPI


2942 | Ch 01 Page 4 Wednesday, February 16, 2000 1:26 PM

4 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

that began in 1962 with Telstar, a communications satellite designed to transfer tele-
phone and television signals between the United States and Europe. Telstar showed
that transmitting information between continents was both technologically and eco-
nomically feasible.
Many communications satellites transmit television signals today. Figure 1.2
shows a common system. A transmitter in one part of the world sends a signal to an
orbiting satellite, which relays the signal to receivers in other parts. Signals from the
receiver are sent to broadcast towers and are transmitted locally using a frequency
approved by the Federal Communications Commission (FCC). An antenna receives
the signals and relays them to the television set in your home.
Television antennas are not the only way to receive signals. Many homes sub-
scribe to a cable television service that brings signals into the home using optical
fibers and coaxial cable. In addition, many people purchase their own receiving
dishes and receive satellite signals directly.
Other communications applications are local area networks (LANs) and wide
area networks (WANs), systems that allow multiple computers to communicate
over short (LAN) or long (WAN) distances. Once connected, users can send or
receive data files, log in to remote computers, send mail (email, or electronic mail),
or connect to the World Wide Web. With email, a person can send personal or busi-
ness messages from one computer to another. The email system stores messages on
a computer disk where someone else can read them.

Figure 1.2 Television Reception

satellite

FCC-approved frequency
for local broadcast
satellite transmission

transmitter receiver

broadcast tower
2942 | Ch 01 Page 5 Wednesday, February 16, 2000 1:26 PM

1.1 WHY STUDY COMMUNICATIONS? 5

The phenomenal growth of email, which sends and receives messages electron-
ically, has caused some people to predict it will eventually replace postal service.
This is not likely to happen in the foreseeable future, but email is used extensively
by many professionals and, with the emergence of the World Wide Web, by individ-
uals for personal reasons as well.
With email, it is possible to send a message to remote locations from the privacy
of your own home; Figure 1.3 shows how. A person with a PC and modem at home
can access his or her company’s or Internet Service provider’s computer. This com-
puter is connected to a local area network that allows a message to be sent to any
person connected to it. The local area network also connects to a wide area network
that allows a message to be sent across the country or to other countries. Local area
networks at the other end can route a transmitted message to any connected PC. An
individual on that end with a PC and modem can receive the message at home.
The following additional applications are described only briefly here. We will
discuss some of these topics more fully in later chapters.
• Facsimile machines (fax). A fax machine creates an electronic equivalent of an
image on a sheet of paper and then sends the image over telephone lines. A fax
machine at the other end recreates the original paper’s image. The fax is widely
used to send letters, charts, and diagrams in minutes.
• Voice and video communications. LANs, used to connect PCs and other
devices, transfer data primarily. Communications systems can also transmit
voice and video images. Many companies often manage their own telephone
systems or private branch exchanges (PBX) (discussed further in Section 2.2).
Video communications can be used to play a tape or receive a video transmis-
sion from outside and relay the signals throughout a company or organization.
Video communication has special needs because it typically requires the

Figure 1.3 Electronic Mail Connections

modem local area PC at


network work

telephone
line
computer wide area
network PC in a remote
modem connection location

local area
network

PC at
home
2942 | Ch 01 Page 8 Wednesday, February 16, 2000 1:26 PM

8 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

CPU

memory
disk drives
terminals

tape drives

Figure 1.4 Communicating Devices in a Computer System

retrieve a program from one place, run it on any of a variety of processors, and send
the result to a third location.
A system connecting different devices such as PCs, printers, and disk drives is a
network. Typically, each device in a network serves a specific purpose for one or
more individuals. For example, a PC may sit on your desk providing access to infor-
mation or software you need. A PC may also be devoted to managing a disk drive
containing shared files. We call it a file server. Often a network covers a small geo-
graphic area and connects devices in a single building or group of buildings. Such a
network is a local area network (LAN). A network that covers a larger area such as
a municipality, state, country, or the world is called a wide area network (WAN).
To illustrate a network’s use, suppose a small business has connected several
devices as shown in Figure 1.5. A company executive is planning a presentation to
the board of directors that includes an analysis of last month’s sales. The data reside
in a file server, the statistical software to analyze sales runs on a PC, and a program
forecasting future sales runs only on the mainframe. The executive can transfer the
sales figures from the file server to a PC (Step 1 in Figure 1.5). She can then run the
statistical software, send the results to the mainframe, and run the forecasting soft-
ware (Step 2). When the results are generated, she can transfer them back to the PC
(Step 3), where she can format the data for presentation. Finally, she can print her
charts on a laser printer (Step 4).
The arrangement in Figure 1.5 is a simple scheme that works for one person.
Most networks, however, involve many people using many PCs, each of which can
access any of many printers or servers. With all these people accessing information,
their requests inevitably will conflict. Consequently, the devices must be connected
in a way that permits an orderly transfer of information for all concerned. A good
analogy is a street layout in a large city. With only one person driving it matters little
where the streets are, which ones are one-way, where the traffic signals are, or how
they are synchronized. But with thousands of cars on the streets during the morning
2942 | Ch 01 Page 9 Wednesday, February 16, 2000 1:26 PM

1.2 COMPUTER NETWORKS 9

PC
4
laser printer

file server 2 3

mainframe
computer

Step 1: Transfer data from file server to PC and run statistical software.
Step 2: Transfer results from Step 1 to mainframe and run forecasting program.
Step 3: Transfer results from Step 2 back to PC for printer formatting.
Step 4: Send results to laser printer.

Figure 1.5 Variety of Connected Computing Devices

rush hour, a bad layout will create congestion that causes major delays. The same is
true of computer networks. They must be connected in a way that allows data to
travel among many users with little or no delay. We call the connection strategy the
network topology. The best topology depends on the types of devices and user
needs. What works well for one group may perform dismally for another.

C OMMON B US T OPOLOGY
Figure 1.6 shows a common bus topology (or simply bus topology) connecting
devices such as workstations, mainframes, and file servers. They communicate
through a single bus (a collection of parallel lines). A common approach gives each
device an interface that listens to the bus and examines its data traffic. If an interface
determines that data are destined for the device it serves, it reads the data from the
bus and transfers it to the device. Similarly, if a device wants to transmit data, the
interface circuits sense when the bus is empty and then transmit data. This is not
unlike waiting on a freeway entrance ramp during rush hour. You sense an opening
and either quickly dart to it or muscle your way through, depending on whether
you’re driving a subcompact or a large truck.
Sometimes, two devices try to transmit simultaneously. Each one detects an
absence of traffic and begins transmitting before becoming aware of the other
device’s transmission. The result is a collision of signals. As the devices transmit
2942 | Ch 01 Page 10 Wednesday, February 16, 2000 1:26 PM

10 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

file server workstation


mainframe mainframe

workstation workstation file server workstation

Figure 1.6 Common Bus Topology

they continue to listen to the bus and detect the noise resulting from the collision.
When a device detects a collision it stops transmitting, waits a random period of
time, and tries again. This process, called Carrier Sense, Multiple Access with
Collision Detection (CSMA/CD) is discussed along with other ways of accessing
common media in Sections 3.4 and 6.2.
One popular common bus network is an Ethernet. Its common bus typically is
Ethernet cable, which consists of copper, optical fiber, or combinations of both
(although recent developments allow connections using microwave and infrared
technology). Its design allows terminals, PCs, disk storage systems, and office
machines to communicate. A major advantage of an Ethernet is the ability to add
new devices to the network easily.

S TAR T OPOLOGY
Another common connecting arrangement is the star topology (Figure 1.7). It uses
a central computer that communicates with other devices in the network. Control is
centralized; if a device wants to communicate, it does so only through the central
computer. The computer, in turn, routes the data to its destination. Centralization
provides a focal point for responsibility, an advantage of the star topology. The bus
topology, however, has some advantages over a star topology. The lack of central
control makes adding new devices easy because no device needs to be aware of
others. In addition, the failure or removal of a device in a bus network does not cause
the network to fail. In a star topology, the failure of the central computer brings
down the entire network.
Star topologies often involve a single mainframe computer that services many
terminals and secondary storage devices. With appropriate terminal emulation soft-
2942 | Ch 01 Page 11 Wednesday, February 16, 2000 1:26 PM

1.2 COMPUTER NETWORKS 11

printer

computer

server

Figure 1.7 Star Topology

ware, PCs can communicate with the mainframe. Data transfers between terminals
or between terminals and storage devices occur only through the main computer.

R ING T OPOLOGY
In a ring topology (Figure 1.8), devices are connected circularly. Each one can com-
municate directly with either or both of its neighbors but nobody else. If it wants to

Figure 1.8 Ring Topology


2942 | Ch 01 Page 11 Wednesday, February 16, 2000 1:26 PM

1.2 COMPUTER NETWORKS 11

printer

computer

server

Figure 1.7 Star Topology

ware, PCs can communicate with the mainframe. Data transfers between terminals
or between terminals and storage devices occur only through the main computer.

R ING T OPOLOGY
In a ring topology (Figure 1.8), devices are connected circularly. Each one can com-
municate directly with either or both of its neighbors but nobody else. If it wants to

Figure 1.8 Ring Topology


2942 | Ch 01 Page 12 Wednesday, February 16, 2000 1:26 PM

12 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

communicate with a device farther away, it sends a message that passes through
each device in between.
A ring network may be either unidirectional or bidirectional. Unidirectional
means that all transmissions travel in the same direction. Thus, each device can
communicate with only one neighbor. Bidirectional means that data trans-
missions travel in either direction, and a device can communicate with both
neighbors.
Ring topologies such as IBM’s token ring network often connect PCs in a
single office or department. Applications from one PC thus can access data stored on
others without requiring a mainframe to coordinate communications. Instead, com-
munications are coordinated by passing a token (a predefined sequence of bits)
among all the stations in the ring. A station can send something only when it
receives the token.
A disadvantage of the ring topology is that when one station sends to another,
all stations in between are involved. More time is spent relaying messages meant for
others than in, for example, a bus topology. Moreover, the failure of one station
causes a break in the ring that affects communications among all the stations. Ways
of dealing with such problems and other aspects of token rings are discussed further
in Sections 3.4 and 6.3.

F ULLY C ONNECTED T OPOLOGY


The fully connected topology (Figure 1.9) has a direct connection between every
pair of devices in the network. This is an extreme design. Communication becomes
very simple because there is no competition for common lines. If two devices want
to communicate, they do so directly without involving other devices. The cost of
Figure 1.9 Fully Connected Topology
2942 | Ch 01 Page 18 Wednesday, February 16, 2000 1:26 PM

18 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

host system and user

7. application layer

6. presentation layer

5. session layer

4. transport layer

3. network layer

2. data link layer

1. physical layer

transmission medium

Figure 1.11 ISO’s OSI Layered Protocol Model

to the data link layer. The data link layer does not care how the service is performed,
just that it is done. Thus, if changes occur in how the physical layer is implemented,
the data link layer (and all higher layers) is unaffected. This approach applies to any
two consecutive layers and is the same concept as that behind the modular program-
ming (or top-down design) style that you may have learned in your first program-
ming class.
Compare the process to a meeting among several heads of state. Each leader
needs to make his or her thoughts known, but the ideas often must be recast in
appropriate diplomatic language to avoid offending someone. Furthermore, if they
all speak a different language, one language must be chosen as the primary form of
communication. Figure 1.12 illustrates a possible three-layer protocol involving a
crisis that two of the leaders are trying to resolve. One leader adamantly states that
he is not going to tolerate the situation. The diplomat recasts the message into a less-
threatening tenor, and a translator translates the message to the chosen language. On
the other side, another translator translates back to a specific language. The diplomat
receives the message and tells the head of state what it really means.
2942 | Ch 01 Page 19 Wednesday, February 16, 2000 1:26 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 19

high-level communication,
even though they do not
speak the same language
Formulate
Formulate message
message based
based Receive message and
country’s best
on country's best interests.
interests. decide on response.
head of state head of state

“This situation “That bonehead


is intolerable, said they are not
you bonehead.” going to put up
Communicate ideas without with it.”
authority to generate or
Recast using appropriate change their meaning. Recast
Recastputting
puttingininlanguage
language
diplomatic language. pertinent
pertinenttotocountry’s
country'sinterests.
interests.
diplomat diplomat

“It is in the best interests “It is in the best interests


of the health and security of the health and security
of both countries to Communicate without of both countries to
remedy this problem.” knowing the full extent remedy this problem.”
or meaning of the
Translate to mutually communications. Translate back to
agreed-on language. national language.
translator translator

Figure 1.12 Communication Protocol between Two Heads of State

In a sense, the two leaders are communicating directly, even though the mes-
sage actually passes through other individuals. The OSI model works similarly. The
lowest level, the physical layer, deals with actual data transmission. The highest
level deals with the computer system connected to the network. Each layer in
between corresponds to a different level of abstraction in data communications and
defines certain functions and protocols.
Two otherwise incompatible sites, each running the OSI model, can communi-
cate with each other (Figure 1.13). Logically, each layer communicates directly with
its counterpart at the other site. Physically, each layer communicates with the layers
immediately above and below it. When a process wants to send information, it starts
by handing it over to the application layer. That layer performs its functions and
sends the data to the presentation layer. It, in turn, performs its functions and gives
the data to the session layer. This process continues until the physical layer receives
the data and actually transmits it.
On the receiving end, the process works in reverse. The physical layer receives
the bit stream and gives it to the data link layer. The data link layer performs certain
functions and sends the data to the network layer. This process continues until the
2942 | Ch 01 Page 20 Wednesday, February 16, 2000 1:26 PM

20 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

process sending information process receiving information


logical communication
between layers
application layer application layer

presentation layer presentation layer

Each layer session layer session layer Each layer


performs functions performs functions
and sends the data and sends the data
to the next-lower to the next-higher
layer. transport layer transport layer layer.

network layer network layer

data link layer data link layer

physical layer physical layer

physical transmission of data stream

Figure 1.13 Communication Using the OSI Seven-Layer Protocol

application eventually receives the information and gives it to the receiving process.
The two processes appear to communicate directly, with each layer appearing to
communicate directly with its counterpart at another network node. In reality, all
data are broken into a bit stream and transmitted between physical layers.
This process is a bit like sending a letter, where you communicate with the
letter’s recipient by addressing the envelope and dropping it in a mailbox. As far as
you are concerned, the activity is then complete: The communication is independent
of how the letter is eventually routed or whether it goes by truck, plane, train, boat, or
carrier pigeon. You know the letter will arrive and you can simply wait for a response.
2942 | Ch 01 Page 24 Wednesday, February 16, 2000 1:26 PM

24 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

D
B

A F

C E

Figure 1.14 Sample Computer Network

strategy of the physical layer answers the question, If node A wants to communicate
with node F, how do we connect them? Take care to distinguish this problem from
determining the route, or network path. If the lines represent physical connections,
there are four routes along which data may travel from node A to node F. (Can you
list them?) The network layer will determine which one is best, but the issue here is
how the two endpoints are actually connected via the chosen route.
There are three connection strategies: circuit switching, message switching, and
packet-switching. In circuit switching, once a connection is made between two
nodes, it is maintained until one of them terminates it. In other words, the connec-
tion is dedicated to the communication between the two parties. Circuit switching is
common in the telephone system (Figure 1.15) because the channel allocated to one
telephone connection cannot be used by another.
How does it work? A person at node A wants to talk to someone at node F. The
person at A requests a connection to F. In a telephone network, dialing a number
makes the connection. In a computer network, the user enters appropriate com-
mands to connect to a specified location. Either way, logic at node A must determine
the next node in a route that leads to F. This process involves factors such as the cost
of the connection and the availability of different paths. For example, a telephone
call from San Francisco to Los Angeles is not normally routed through Miami. How-
ever, if the lines between the two cities are congested, the connection may be indi-
rect; for example, through Sacramento.
In Figure 1.15, node A has determined that C is a better choice than B in the
route from A to F. Thus, node A connects to node C. Node C, in turn, proceeds simi-
larly. It might choose node F, or it might decide to go through node E. Again, cost
and existing connections affect the choice. In this case, node C connects to node E.
Finally, E connects to F. The connection is made, and node F may be willing to
accept it. In the telephone system, you accept a connection by picking up the
2942 | Ch 01 Page 25 Wednesday, February 16, 2000 1:26 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 25

receiver and saying “Hello.” In a computer network, appropriate commands are used
to accept connections. If node F does not respond (e.g., busy signal or no answer),
node A terminates the request.
If node F accepts the connection, information may be exchanged. The person at
node A asks, “Do you want to go to the movies?” The person at node F responds by
saying, “I’d really love to go with you, but my canary just died and I’m in mourning.
Ask me some other time when I’m out of town.”
Circuit switching requires that the route be determined and the connection made
before any information is transmitted. Also, the network maintains the connection until
a node terminates it. This type of connection is most useful when the communications
between the two nodes are continuous, that is, when node A “says” something and node
F “hears” almost immediately, with virtually no transmission delay. This approach is
not always the best way to communicate, however. First of all, if node A calls node F, F
must answer. Otherwise, A cannot send any information. Second, suppose nodes A and
F exchange information infrequently. (Did you ever experience long periods of silence
during a telephone conversation?) In that case, the connection is underused.
Message switching is an alternative to circuit switching. A network uses mes-
sage switching to establish a route when a message (a unit of information) is sent.
For example, suppose node A sends the message “Will you go to the movies with
me?” to node F. Node A attaches the location or address of F to the message and
looks for the first node in the route. As Figure 1.16, shows, node A chooses node C.
As before, the choice depends on cost and the availability of connections. Node A
sends the message (along with the address of F) to C. The message is stored there
temporarily, while logic looks for another node. It sends the message to node E,
where it is again stored temporarily. Finally, logic at E locates node F and sends the
message to its final destination. Because the message is stored in its entirety at each
node, networks that use this method are also called store-and-forward networks.

Figure 1.15 Dedicated Circuit Connecting A and F

D
B

A F

Would you I’d rather


I'd rather go
go with
with the
the
like to go to BostonStrangler,
Boston Strangler,but
but
the movies? thankyou
thank youvery
verymuch
much
anyway.
anyway.
C E
2942 | Ch 01 Page 26 Wednesday, February 16, 2000 1:26 PM

26 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

“Forget the first message; I


have to work late.” D
B

A F

Route used for first message,


“Will you go to the movies
with me?”
Route used for second message,
C
“Will you go to the E “Forget the first message;
movies with me?” I have to work late.”

Figure 1.16 Message-Switched Network

How are message switching and circuit switching different?


• In message switching, the message is stored temporarily at each node. In circuit
switching, the node simply acts as a switching device to route the data. For
example, your telephone conversations are not stored at intermediate locations
(unless someone is listening and recording your conversation!). The transmis-
sion delays resulting from message switching make this connection strategy
unsuitable for telephone networks. Delays in voice transmission would make
conversations very difficult.
• In circuit switching, a single route is dedicated to the exchange of all messages
between two nodes. In message switching, different messages may travel over
different routes. Suppose node A wanted to send a second message, “Forget the
first message; I have to work late,” to node F. Because routing is often time
dependent, A might choose B for the first node in the route. The message then
goes to nodes D and F. Different messages thus can share common connections
over time, providing a higher utilization.
• Circuit switching requires that both parties be ready when data is sent. Message
switching does not. The message may be sent and stored for later retrieval.
The third connection strategy, packet-switching, minimizes the effects of prob-
lems caused by long messages on message-switched networks. Long messages may
exceed the buffering capacity at a node, or connections between adjacent nodes may
be tied up for long periods. A failure in a connection may mean the loss of the entire
message. Consequently, message-switched networks are no longer common and
2942 | Ch 01 Page 27 Wednesday, February 16, 2000 1:26 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 27

have given way to the more efficient packet-switched networks. Let’s see how they
work.
Suppose a user at node A wants to send a message to node F. If the message is
long, it is divided into smaller units called packets. Their size is design dependent.
Each packet contains its destination address or some other designator indicating
where it should go and is routed there by network protocols. When the packets all
arrive, they are reassembled. Like message switching, a physical connection
between the two endpoints is not maintained. The smaller size of the packets facili-
tates the necessary buffering at intermediate network nodes.
The two common routing methods in packet-switched networks are the data-
gram and the virtual circuit. In the datagram approach, each packet is transmitted
independently. That is, network protocols route each one as though it were a sepa-
rate message. This allows routing strategies to consider the changing conditions
within the network. Congestion on certain routes may cause rerouting. (Chapter 7
discusses routing strategies in more detail.)
In the virtual circuit approach, network protocols establish a route (virtual cir-
cuit) before sending any packets. The delivery of the packets using the same route
ensures that the packets arrive in order and without error. The process is similar to
circuit switching, with one important difference: The route is not dedicated. That is,
different virtual circuits may share a common network connection. Logic at each
node must store received packets and schedule them for transmission.
Datagrams have a disadvantage when the message consists of many packets,
because independent routing represents a lot of overhead. In such cases, a virtual
circuit may be more efficient. Another disadvantage of datagrams is that packets
may not arrive in the order in which they were sent. Consider the network shown in
Figure 1.17. Suppose the user at node A wants to send a message consisting of three

Figure 1.17 Packet-Switched Network

D
B

P3
Send Receive packets
P1, P2, and P3 P1, P3, and P2
A P1 F

P2
Routes for packets
P1 and P2
E Routes for
C packet P3
2942 | Ch 01 Page 30 Wednesday, February 16, 2000 1:26 PM

30 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

C
B

A D

token circulates token


around the network

Node E has the


F E token. Only E
can transmit.

Figure 1.18 Token Ring Network

data link layer determines whether an error has occurred and, if so, typically
requests that the information be retransmitted. With error correction the data link
layer has the ability to set the damaged bits to their correct value.
Perhaps the simplest detection method uses a parity bit, an extra bit attached to
each sequence of data bits, or frame. For example, an even parity makes the total
number of 1 bits (including itself) even. That is, if the frame has an odd number of 1
bits, the parity bit is 1. If it has an even number, the parity bit is 0. (There is an anal-
ogous definition for odd parity.) Consider the frames in Figure 1.19. The first frame
has four 1 bits. Therefore, its even parity bit is 0. The second frame has five 1 bits, so
its even parity bit is 1. The parity bit is transmitted with the frame and the receiver
checks the parity. If it finds an odd number of 1 bits, an error has occurred.
The problem with parity bits is that errors can go undetected. For example, if two
bits change during transmission, the number of 1 bits remains even. Thus, parity bits
can detect single but not double errors. More sophisticated techniques exist that deal
with multiple-bit errors. Sections 4.2 to 4.4 discuss several of them in greater detail.

Figure 1.19 Parity Bits

frame frame
11010100 0 01101101 1

Parity bit is 0 to make the Parity bit is 1 to make the


number of 1s even. number of 1s even.
2942 | Ch 01 Page 30 Wednesday, February 16, 2000 1:26 PM

30 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

C
B

A D

token circulates token


around the network

Node E has the


F E token. Only E
can transmit.

Figure 1.18 Token Ring Network

data link layer determines whether an error has occurred and, if so, typically
requests that the information be retransmitted. With error correction the data link
layer has the ability to set the damaged bits to their correct value.
Perhaps the simplest detection method uses a parity bit, an extra bit attached to
each sequence of data bits, or frame. For example, an even parity makes the total
number of 1 bits (including itself) even. That is, if the frame has an odd number of 1
bits, the parity bit is 1. If it has an even number, the parity bit is 0. (There is an anal-
ogous definition for odd parity.) Consider the frames in Figure 1.19. The first frame
has four 1 bits. Therefore, its even parity bit is 0. The second frame has five 1 bits, so
its even parity bit is 1. The parity bit is transmitted with the frame and the receiver
checks the parity. If it finds an odd number of 1 bits, an error has occurred.
The problem with parity bits is that errors can go undetected. For example, if two
bits change during transmission, the number of 1 bits remains even. Thus, parity bits
can detect single but not double errors. More sophisticated techniques exist that deal
with multiple-bit errors. Sections 4.2 to 4.4 discuss several of them in greater detail.

Figure 1.19 Parity Bits

frame frame
11010100 0 01101101 1

Parity bit is 0 to make the Parity bit is 1 to make the


number of 1s even. number of 1s even.
2942 | Ch 01 Page 31 Wednesday, February 16, 2000 1:26 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 31

N ETWORK L AYER
The network layer provides the transport layer with the ability to establish end-to-
end communications. This ability allows the transport layer to do its tasks without
worrying about the details of sending information back and forth between the two
stations. It is a lot like making a telephone call without worrying about the details of
telephone switching equipment. This process, which often requires communication
across multiple intermediate nodes, can be quite difficult. There are several common
protocols, but they are too complex to discuss here, and we delay them to later chap-
ters. For example, Section 7.3 discusses packet-switched networks and the X.25 pro-
tocol, and Section 7.4 discusses the Internet Protocol.
The network layer contains algorithms designed to find the best route between
two points. We mentioned route determination when we described switching tech-
niques. We indicated that route determination considers factors such as connection
costs and availability of lines as it tries to find the quickest and cheapest route to a
particular node. For example, Figure 1.20 shows a network containing several routes
from A to F. Each line connecting two nodes represents the cost, indicated by the
numbers on the lines. Going from A to F through B and D results in a total cost of
16. Going through B and E instead results in a cost of only 12. In general, the net-
work layer determines which route is best. Perhaps more accurately, network-layer
protocols running at network nodes collectively determine which route is best. There
are many different ways to approach routing. Section 7.2 discusses several of them,
and Section 6.5 discusses routing as it applies to LAN interconnections. References
[Ta96] and [Sp91] also discuss many approaches.
Successful routing is often more difficult than it seems at first. Courses in dis-
crete mathematics and data structures typically cover algorithms designed to find the

Figure 1.20 Route Costs

D
B
5

8 7
4
3
A F

6 5
7

6
C E
2942 | Ch 01 Page 33 Wednesday, February 16, 2000 1:26 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 33

that can be sent through a single node. The transport layer, however, can establish
connections to multiple nodes and thus increase the overall transmission rate.
In upward multiplexing (Figure 1.23), several transport users share a single
node. This method applies when a user wants a constant connection to the network
but cannot afford it. The sharing may cause a delay, but it has little effect if network
accesses are infrequent.
The transport layer also handles buffering at network nodes. An interesting
aspect here is that buffering may occur at either the destination or the source node.
When a sending transport layer receives data from the session layer for transmis-
sion, it divides it into units called transport protocol data units (TPDUs). The
transport protocol sends them to the receiving transport layer (via the lower layers),
where they eventually are routed to the receiving session layer.
A transport protocol typically requires the acknowledgment of each received
TPDU. This acknowledgment is especially useful in packet-switching networks, in
which packets may be delayed or even lost because of a network failure. Suppose
transport user A wants to send several TPDUs to user B. In some cases, the TPDUs
are buffered at the source and queued for transmission by the lower layers. The trans-
port layer waits for an acknowledgment for each TPDU but does not remove them
from the buffer. If the protocol requires an acknowledgment for each TPDU, the

Figure 1.21 End-to-End Connection with Intermediate Nodes

process sending information process receiving information

application application

presentation presentation

session session

transport transport

network network network network

data link data link data link data link

physical physical physical physical


2942 | Ch 01 Page 34 Wednesday, February 16, 2000 1:26 PM

34 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

sending transport layer waits for it. If it does not occur within a set period of time,

Figure 1.22 Downward Multiplexing

transport
layer
network node

n transport user
e
t
w
data transfer
o
r
k

Figure 1.23 Upward Multiplexing

network node

n transport user
e
t
w
data transfer
o
r
k

transport
layer
2942 | Ch 01 Page 34 Wednesday, February 16, 2000 1:26 PM

34 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

sending transport layer waits for it. If it does not occur within a set period of time,

Figure 1.22 Downward Multiplexing

transport
layer
network node

n transport user
e
t
w
data transfer
o
r
k

Figure 1.23 Upward Multiplexing

network node

n transport user
e
t
w
data transfer
o
r
k

transport
layer
2942 | Ch 01 Page 35 Wednesday, February 16, 2000 1:26 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 35

the sender retransmits the TPDU, which is possible only if it is still in the buffer.
When a receiving transport layer receives a TPDU, it holds the TPDU until the
session layer is ready for it. Keep in mind that there is no guarantee the session layer
will accept it immediately. If the receiver knows the sender is buffering all TPDUs,
it may elect to use a single buffer to save space. The disadvantage of this choice is
that the receiver may have no room for subsequent TPDUs until the one being held
is delivered to the session layer. In this case, the receiver ignores the TPDUs and
refuses to acknowledge their reception. The sender receives no acknowledgment and
eventually retransmits the TPDUs.
If the network is reliable (that is, errors are few), the TPDUs may instead be
buffered at the destination. If the sender knows the receiver is buffering the data, the
sender need not do so. It reasons that there is little need to hold on to something
once it is sent. After all, the chances of it arriving quickly and safely are high. It’s a
bit like not keeping a copy of every letter you mail because you are afraid the post
office will lose it and you will have to remail it.
Connection management is the protocol by which the transport layer estab-
lishes and releases connections between two nodes. At first glance, making and
releasing connections may seem easy, but it is deceptively tricky. For example, sup-
pose the transport layer is trying to establish a connection between users A and B.
You might think the connection is as simple as (1) user A requesting a connection to
user B and (2) user B indicating readiness for a connection, after which (3) a connec-
tion occurs (Figure 1.24). This is a two-way handshake protocol for establishing a
connection. The problem is that it does not always work because of potential delays
in either A’s request or B’s response.
For example, consider the timing shown in Figure 1.25. Note that requests and
acknowledgments are made by transmitting special TPDUs. At time t1, user A
requests a connection. However, for some reason, perhaps network congestion or a
problem at an intermediate site, the request is delayed. User A, thinking the message
is lost, makes another connection request at time t2. User B receives the second
request at time t3 and promptly acknowledges it. User A receives the acknowledg-
ment at time t4, and the connection is made. No problem so far.
Users A and B do whatever they are supposed to do and eventually disconnect.
However, the first connection request is still floating around somewhere. Suppose it
finally arrives at user B at time t5. User B thinks it is another request and acknowl-

Figure 1.24 Two-Way Handshake Protocol to Establish a Connection

1. Are you ready to connect? 2. Yes!

A B
3. Connection established
2942 | Ch 01 Page 36 Wednesday, February 16, 2000 1:26 PM

36 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

A B

Send connection- t1
request TPDU.

Send connection- t2
request TPDU.
t3 Receive connection-request TPDU.
B establishes connection and sends an
acknowledgment TPDU.
Receive acknowledgment. t4
A establishes connection.
A and B exchange
data and eventually
disconnect.

t5 Receive connection-request TPDU.


B establishes connection and sends
an acknowledgment TPDU.

time time

Figure 1.25 Failure of a Two-Way Handshake Protocol

edges it. As far as B is concerned there is another connection, but this time it is unin-
tentional. Worse yet, consider what could happen if user A sent a data TPDU during
the first connection that was seriously delayed. Not receiving an acknowledgment,
user A would have retransmitted it. But the first request is still somewhere in the net-
work. What happens if B finally gets it after time t5? User B thinks it is another
TPDU and responds to it. How serious is this problem? Imagine if the connections
were private ones to Swiss banks, and the data packets requested deposits of $5 mil-
lion. Bank officials will not be happy paying interest on a bogus $5 million deposit.
The problem may be solved in two ways. The first is to send a sequence number
with every TPDU. It may be based on a counter or clock that increases each time.
The second is to use a three-way handshake protocol, designed by Tomlinson (Ref.
[To75]). It works as follows:
1. User A transmits a TPDU requesting a connection. Its sequence number is x.
2942 | Ch 01 Page 37 Wednesday, February 16, 2000 1:26 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 37

A B

Send TPDU x t1
(request for connect).

Send TPDU y t2
(request for connect). Send TPDU z (receive and
t3
acknowledge TPDU y).
Send data TPDU. Include
sequence numbers y and z to t4
acknowledge receipt of TPDU z.

A and B disconnected
at some time.

t5 Send TPDU w (receive and


acknowledge TPDU x).
TPDU w not acknowledged t6
and no connection is made.

time time

Figure 1.26 Three-Way Handshake Protocol

2. User B transmits a TPDU acknowledging both the request and sequence


number. Its sequence number is y.
3. User A acknowledges the acknowledgment by including sequence numbers x
and y in its first data TPDU.
Let’s see how this works in a case similar to that of Figure 1.25. Figure 1.26
shows the details. At time t1, user A sends TPDU x requesting a connection. How-
ever, as before, the TPDU is delayed. User A, receiving no acknowledgment, sends
another TPDU at time t2. This is TPDU y. User B receives TPDU y at time t3. It
acknowledges by sending TPDU z, which contains sequence number y. User A
receives TPDU z at time t4. It acknowledges sequence numbers y and z by including
them in its first data TPDU. Everything works so far.
Suppose, as before, users A and B disconnect, and TPDU x arrives at user B at
time t5. User B thinks it is another request and acknowledges it by sending TPDU w,
which contains sequence number x. When user A receives this TPDU, it realizes
2942 | Ch 01 Page 39 Wednesday, February 16, 2000 2:05 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 39

Please get Mr. Jones


on the phone. OK.

dialing Mr.
Jones’ number
(a) Requesting a session connection (b) Requesting a tr ansport connection

I have reached Mr.


Jones on line 3.
Hello.

(c) Transport connection established

Hello, Mr. Jones. Who is this?

(d) Session connection established

on a mainframe computer at a central location. Each office (airline reservation sys-


tems, major brokerage companies, banks, and so on) has its own front-end processor
that communicates with the company’s mainframe over a network. Through the pro-
cessor, regional office employees frequently access the mainframe for short periods.
These are the sessions that the session layer provides. Because of the frequent
2942 | Ch 01 Page 40 Wednesday, February 16, 2000 1:26 PM

40 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

t1 logical conn
ection or sess
ion
Establish session
and get information.

transport
t2 Local office connection Company
minicomputer over a Database
End session. network

t3 logical connection or session

Establish session
and get information.

t4

End session.
time

Figure 1.28 Multiple Sessions Using One Transport Connection

If the transport connection is disrupted because of a network failure, the ses-


sion layer can request another transport connection without disrupting the session.
This recovery is analogous to the executive in Figure 1.27 being disconnected
from her client and then waiting on the telephone while the secretary calls a
second time.
Three operations promote orderly communications and allow the session layer
to define logical units of information: dialog management, synchronization points,
and activities.
Dialog management: Most communications are full duplex; that is, data trans-
missions can go in two directions at the same time. In half-duplex communications,
data can go in either direction, but transmissions must alternate. This is the common
personal communication protocol: You normally take turns talking (unless the con-
versation is between two politicians, neither of whom ever bothers to listen).
If desired, the session layer can manage half-duplex communications. Through
the exchange of a data token, it will coordinate conversations (or data exchanges) so
that only one user can send at a time. Only the user with the token can send data.
When the session layer establishes a session, one user initially gets the token. He or
she is the sender, and the other is the receiver. As long as the sender has the token, he
or she can send data. If the receiver wants to transmit data, he or she can request the
token. The sender decides when to give it up. On acquiring the token, the receiver
becomes the sender.
2942 | Ch 01 Page 41 Wednesday, February 16, 2000 1:26 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 41

Synchronization points: In many cases, a session allows a user to transmit


large amounts of data. Some questions you might ask are, What happens if an error
occurs after much of the data have been transmitted? Is everything lost? Must I start
over from the beginning? The lower layers handle some of the problems of lost
packets, but received packets still must percolate up through the OSI layers. What
happens if an error occurs there? For example, a file might be transmitted success-
fully and then be lost because of a disk error when the receiving user is writing it.
This error has nothing to do with network communication per se, and the lower
layers cannot deal with it.
The session-layer user can prevent large losses by defining synchronization
points within the data stream. These points divide the data into distinct dialog units.
More important, they also define recovery points in case an error occurs. There are
two types of synchronization points: major and minor. Figure 1.29 shows major syn-
chronization points that define separate dialog units.
At each major synchronization point, the receiving session layer must
acknowledge that the dialog unit has been received successfully by the intended user.
This assures the sender that the dialog unit has arrived where it is finally supposed to
be. If an error occurs before acknowledgment, the sender may resynchronize or
retransmit data starting from the most recent synchronization point. Retaining copies
of the dialog unit is the sender’s responsibility. However, once a dialog unit has been
acknowledged, the sender may delete it and free the buffer space.
Minor synchronization points are similar to major ones. The sender may
refine the dialog unit by inserting them. Figure 1.30 shows the placement of minor
synchronization points. The user may resynchronize to a minor synchronization
point within the current dialog unit. Minor synchronization points are not acknowl-
edged, which reduces overhead. On the other hand, the sender cannot free the space
used to buffer the dialog units. (Can you guess why?)
Activities: The user may place another structure on the data by defining a unit
of work called an activity. Figure 1.31 shows that an activity consists of one or more

Figure 1.29 Major Synchronization Points Defining Dialog Units

dialog unit dialog unit dialog unit dialog unit





























major synchronization points

complete dialog (data) transmitted


during session
2942 | Ch 01 Page 42 Wednesday, February 16, 2000 1:26 PM

42 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

dialog units. Activities are separate, independent units much like the dialogs and, as
with dialog units, must be defined.
One way to think of an activity is as a series of requests that must be processed
on an all-or-nothing basis. For example, suppose you work in the catalog order
department of a retail store. When a customer calls in an order, the information you
enter from a PC is transmitted across a network to the company’s main computer.
Suppose you have just entered the customer’s account number. Because many data-
bases lock records during accesses, the customer’s account is now locked. Now sup-
pose the PC stops working, perhaps because someone accidentally unplugs it. When
it is running again, you try to resume by accessing the customer’s account, but you
get a message stating the account is locked. (It is like locking yourself out of the
house and leaving your keys inside.)
To avoid such an occurrence, the session-layer user can request the quarantining
of a series of commands or messages transmitted on a network. The receiving ses-
sion layer puts them all in a buffer before processing any of them. Because the mes-
sages are not processed immediately, the scenario just described does not occur.
When you enter the account number, the session layer saves it. The customer’s
account is not accessed and hence not locked.
The sending session layer marks the beginning and end of an activity with special
commands. When the receiving session layer detects the start of an activity, it buffers

Figure 1.30 Minor Synchronization Points within a Dialog Unit

dialog unit






minor synchronization
points

Figure 1.31 Session Activity

activity

dialog unit dialog unit dialog unit dialog unit




























major synchronization points


2942 | Ch 01 Page 42 Wednesday, February 16, 2000 1:26 PM

42 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

dialog units. Activities are separate, independent units much like the dialogs and, as
with dialog units, must be defined.
One way to think of an activity is as a series of requests that must be processed
on an all-or-nothing basis. For example, suppose you work in the catalog order
department of a retail store. When a customer calls in an order, the information you
enter from a PC is transmitted across a network to the company’s main computer.
Suppose you have just entered the customer’s account number. Because many data-
bases lock records during accesses, the customer’s account is now locked. Now sup-
pose the PC stops working, perhaps because someone accidentally unplugs it. When
it is running again, you try to resume by accessing the customer’s account, but you
get a message stating the account is locked. (It is like locking yourself out of the
house and leaving your keys inside.)
To avoid such an occurrence, the session-layer user can request the quarantining
of a series of commands or messages transmitted on a network. The receiving ses-
sion layer puts them all in a buffer before processing any of them. Because the mes-
sages are not processed immediately, the scenario just described does not occur.
When you enter the account number, the session layer saves it. The customer’s
account is not accessed and hence not locked.
The sending session layer marks the beginning and end of an activity with special
commands. When the receiving session layer detects the start of an activity, it buffers

Figure 1.30 Minor Synchronization Points within a Dialog Unit

dialog unit






minor synchronization
points

Figure 1.31 Session Activity

activity

dialog unit dialog unit dialog unit dialog unit




























major synchronization points


2942 | Ch 01 Page 43 Wednesday, February 16, 2000 1:26 PM

1.4 OPEN SYSTEMS AND THE OSI M O D E L 43

all incoming commands until it sees the end of the activity. Then and only then will it
pass the commands to the higher layers, where they perform the required task.

P RESENTATION L AYER
Computer networking would be much simpler if all computers spoke the same lan-
guage. We are not talking here about languages such as Pascal, C, Ada, or COBOL. We
are referring to the way in which a computer represents the entity we call information.
We must distinguish between information and data, as the difference is impor-
tant. When we speak of data, we conjure up images of hoards of numbers, hexa-
decimal dumps, or pages of letters and special symbols. In short, a computer does
not store information, it stores data. Information is a meaning we attach to the
data. At the most basic level, data are an assortment of bits and bytes and other
unmentionable things. Information is a human interpretation of it. A problem exists
because different computers have different ways of representing the same informa-
tion. Thus, it is not enough to define effective data communications. We must
define effective communication of information. The presentation layer does this.
For example, consider a network that transmits data between two computers
(Figure 1.32). One stores information using ASCII and the other uses EBCDIC,
which represent two different ways of storing data (Chapter 2 discusses ASCII and
EBCDIC further). When the ASCII-based computer says “HELLO,” the network
transmits the ASCII message. The EBCDIC-based computer receives and stores the
data. Unfortunately, anyone interpreting it will see it as “ <<!” because of the dif-
ferent interpretation placed on the bits received.
What we really want is communication of information, as shown in Figure 1.33.
The ASCII version of “HELLO” is transmitted. Because the receiver uses EBCDIC,
the data must be converted. In this case, the hexadecimal characters 48 45 4C 4C 4F
are transmitted, but C8 C5 D3 D3 D6 are received. The two computers have not
exchanged data; instead, and more important, they have exchanged information in
the form of the word “HELLO.”
The problem involves more than just code conversion. We may also have prob-
lems transmitting numbers. For example, computers may store integers using either
a two’s complement or a one’s complement format. The difference is minor, but it

Figure 1.32 Data Exchange between Two Computers

ASCII- EBCDIC-
based Network based
computer 48 45 4C 4C 4F 48 45 4C 4C 4F computer

ASCII “HELLO” EBCDIC “ <<!”


2942 | Ch 01 Page 44 Wednesday, February 16, 2000 1:26 PM

44 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

must be considered. In addition, the number of bits used to represent an integer


varies. Common formats use 16, 32, 64, or 80 bits. Bits must be added or removed to
allow for the different sizes. Sometimes a translation is impossible. For example, the
maximum integer in a 16-bit format is 32,767. What happens if a computer that uses
32-bit integers tries to transfer 50,000 to a computer limited to 16-bit integers?
Floating-point numbers also present problems. Figure 1.34 shows a common
format, although many variations exist. The number of bits used for the mantissa and
exponent vary. The number of bits may even vary within a machine, because numbers
may be either single or double precision. The exponent may also be interpreted in dif-
ferent ways. Sometimes it is a power of 2; in other cases, it is a power of 16. Some-
times the mantissa is not stored in contiguous bits. When one considers the range of
differences, it is amazing that computers can share numeric information at all.
The problem increases with more sophisticated data structures such as arrays,
records, and linked lists. The presentation layer must consider how the fields of a
record are stored. For example, does each one begin on a word boundary or a byte
boundary? Where are link fields stored? How many bytes do they occupy? Is a mul-
tidimensional array stored by row or by column?
The presentation layer must know the system it serves. It must also know the
format of data it receives from other sources. It must ensure the proper transfer of
information throughout the network.
Another function of the presentation layer is data compression,* which is a way of
reducing the number of bits while retaining their meaning. If transmission is expensive,
compression can lower costs significantly and increase the amount of information that
can be sent per unit of time. For example, suppose the data in a large file consist entirely
of strings of capital letters. For example, it might be a list of keywords or employees’ last

Figure 1.33 Information Exchange between Two Computers

ASCII- EBCDIC-
based Network based
computer 48 45 4C 4C 4F C8 C5 D3 D3 D6 computer

ASCII “HELLO” EBCDIC “HELLO”

Figure 1.34 Generic Format for Floating-Point Numbers

s yyyyy.....y xxxxx.....xxxxx

sign bit exponent mantissa


2942 | Ch 01 Page 44 Wednesday, February 16, 2000 1:26 PM

44 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

must be considered. In addition, the number of bits used to represent an integer


varies. Common formats use 16, 32, 64, or 80 bits. Bits must be added or removed to
allow for the different sizes. Sometimes a translation is impossible. For example, the
maximum integer in a 16-bit format is 32,767. What happens if a computer that uses
32-bit integers tries to transfer 50,000 to a computer limited to 16-bit integers?
Floating-point numbers also present problems. Figure 1.34 shows a common
format, although many variations exist. The number of bits used for the mantissa and
exponent vary. The number of bits may even vary within a machine, because numbers
may be either single or double precision. The exponent may also be interpreted in dif-
ferent ways. Sometimes it is a power of 2; in other cases, it is a power of 16. Some-
times the mantissa is not stored in contiguous bits. When one considers the range of
differences, it is amazing that computers can share numeric information at all.
The problem increases with more sophisticated data structures such as arrays,
records, and linked lists. The presentation layer must consider how the fields of a
record are stored. For example, does each one begin on a word boundary or a byte
boundary? Where are link fields stored? How many bytes do they occupy? Is a mul-
tidimensional array stored by row or by column?
The presentation layer must know the system it serves. It must also know the
format of data it receives from other sources. It must ensure the proper transfer of
information throughout the network.
Another function of the presentation layer is data compression,* which is a way of
reducing the number of bits while retaining their meaning. If transmission is expensive,
compression can lower costs significantly and increase the amount of information that
can be sent per unit of time. For example, suppose the data in a large file consist entirely
of strings of capital letters. For example, it might be a list of keywords or employees’ last

Figure 1.33 Information Exchange between Two Computers

ASCII- EBCDIC-
based Network based
computer 48 45 4C 4C 4F C8 C5 D3 D3 D6 computer

ASCII “HELLO” EBCDIC “HELLO”

Figure 1.34 Generic Format for Floating-Point Numbers

s yyyyy.....y xxxxx.....xxxxx

sign bit exponent mantissa


2942 | Ch 01 Page 46 Wednesday, February 16, 2000 1:26 PM

46 CHAPTER 1 INTRODUCTION TO COMMUNICATIONS, STANDARDS, AND PROTOCOLS

location to another with a simple click of a mouse button. Common jargon for this is
Web browsing or Web surfing. We’ll discuss the Web more fully in Chapter 8.
A virtual terminal protocol allows a user at a terminal to connect to a remote
computer across a computer network. Once connected, the user interacts as though
the computer were on-site. Allowing access to different computers from different ter-
minals presents problems because of the variety of equipment and software. One
problem is that software often is written with specific equipment in mind. Full-screen
text editors are examples. The editor displays text on a screen and allows the user to
move the cursor and make changes. The displayed number of rows and columns,
however, varies from one terminal to another. Commands to move the cursor and
delete or insert text require control sequences that also vary by terminal. Perhaps you
have noticed that different terminals have different keyboards. Other examples
include software that depends on screen formats for input. Often layouts provide a
simple uncluttered view of a user’s options. Spacing, tabs, and highlighting help the
user work with the software. Again, such features are terminal dependent.
Distributed systems are another growing application of computer networks. A
distributed system allows many devices to run the same software and to access
common resources. Example resources include workstations, file servers, main-
frames, and printers (Figure 1.35). In a true distributed system, a user logs on and
has no knowledge of the underlying structure. The user requests a particular
resource and gets it without knowing or caring where it came from or what kind of
workstation he or she is using to get it. The distributed system hides the details.
Distributed systems present many challenges. Suppose a user requests a file by
name. A problem is that different systems use different rules for naming files. How
can we make these rules transparent to the user and still adhere to what a particular
computer requires? Often the files exist on different computers. How does the dis-
tributed system know where to look for a requested file? Because different com-

Figure 1.35 Distributed System

distributed system

workstations file servers printers


mainframes
2942 | Ch 02 Page 57 Wednesday, February 16, 2000 2:42 PM

2.1 COMMUNICATIONS MEDIA 57

problems may still occur. We must consider the way in which data are transmitted.
For example, computers transmit data using digital signals, that is, sequences of
specified voltage levels. Graphically, they are often represented as a square wave
(Figure 2.1a). In this figure the horizontal axis represents time and the vertical axis
represents the voltage level. The alternating high and low voltage levels constitute
the sequence over a period of time.
Computers sometimes communicate over telephone lines using analog sig-
nals,* which are formed by continuously varying voltage levels. They are most often
represented by their characteristic sine wave (Figure 2.1b). Now we have another
problem: Digital and analog signals transmit data in different ways. As a result, if a
computer is going to communicate over an analog phone line, we need to find a way
to convert signals of one type to signals of another and back again.
Section 2.4 discusses analog and digital signals. It presents their limitations and
reports on two famous results that specify limits on the amount of data that can be
transmitted per unit of time. Section 2.5 describes modulation and demodulation
techniques. Finally, Section 2.6 covers modems, common devices used for modula-
tion and demodulation. It also covers intelligent modems and standards.

2.1 COMMUNICATIONS MEDIA

There are three types of transmission media, each with many variations. The first is a
conductive metal such as copper or iron. We will show how an electric current trav-
eling along a wire can be used to transmit data. The second medium is a transparent
glass or plastic strand that transmits data using light waves. The third requires no
physical connection at all and relies on electromagnetic waves such as those found
in noncable television and radio broadcasts.

Figure 2.1 Analog and Digital Signals

(a) Digital signal (b) Analog signal

*
Although much of the telephone system is digital, most telephones are devices designed to send and
receive analog signals. A computer typically uses a modem to convert its digital signals to an analog
format before transmitting. We will discuss modems later in this chapter.
2942 | Ch 02 Page 58 Wednesday, February 16, 2000 2:42 PM

58 CHAPTER 2 TRANSMISSION FUNDAMENTALS

One factor to consider in a discussion of communications media is cost. For


example, wires, cables, and strands all have different manufacturing costs. In addi-
tion, the devices to which they attach have various costs.
Another factor to consider is the number of bits each communications medium
can transmit per unit of time. Two measures are important: bit rate and bandwidth.
The bit rate is a measure of the number of bits that can be transmitted per unit of
time. The typical unit of measure is bits per second (bps). Depending on the
medium and the application, bit rates commonly range from a few hundred bps to
billions of bps.
Before defining bandwidth, let us take a closer look at what a signal is. Many
analog signals, for example, exhibit the sine wave pattern of Figure 2.2. It is an
example of a periodic signal, which means it repeats a pattern or cycle continu-
ously. The period of a signal is the time required for it to complete one cycle. The
signal in Figure 2.2 has a period of p. A signal’s frequency, f, is the number of cycles
through which the signal can oscillate in a second. The unit of measurement is
cycles per second, or hertz (Hz). For example, suppose p from Figure 2.2 was 0.5
microsecond (µsec). Because 0.5 µsec is the same as 0.5 × 10–6 second, the signal’s
frequency is 1/(.5 × 10–6), or 2,000,000 Hz. The frequency and period are related by
1
f = ---
p
A given transmission medium can accommodate signals within a given fre-
quency range. The bandwidth is equal to the difference between the highest and
lowest frequencies that may be transmitted. For example, a telephone signal can
handle frequencies between 300 Hz and 3300 Hz, giving it a bandwidth of 3000 Hz.
In terms of audible sounds, this means that very high- or low-pitched sound cannot
pass through the telephone system. Most human speech falls within this range and
consequently is easily recognizable. The loss of high- and low-frequency sounds,
however, will cause a problem for someone wanting to listen to and appreciate the
New York Philharmonic over the telephone.
Sometimes the term bandwidth is used when referring to the number of bits that
can be transmitted. Technically, bandwidth and bit rates are different, but there is an

Figure 2.2 Periodic Signal

0 p p time
---
2

1 period
2942 | Ch 02 Page 59 Wednesday, February 16, 2000 2:42 PM

2.1 COMMUNICATIONS MEDIA 59

important relationship between them. This complex relationship will be explored in


more detail in Section 2.4.
To transmit bits between two devices there must be a way for a signal to travel
between them. Typically, this requires either a physical connection or the ability to
use electromagnetic waves such as those used by radio and television. This section
discusses several ways of making physical connections: twisted-pair wire, coaxial
cable, and optical fiber. It also discusses wireless communications using microwave
and satellite transmission.

C ONDUCTIVE M ETAL
Twisted Pair One of the oldest transmission media is conducting metal, which
was used to transmit information as early as 1837, when Samuel Morse invented the
telegraph. Basically, it is a circuit consisting of a power source, a switch, and a sensor
(Figure 2.3). The switch, at location A, can be opened or closed manually, thus con-
trolling whether current flows. A sensor, at location B, detects current and creates the
clicking sound with which you are probably familiar from TV and movie Westerns.
Figure 2.3 shows a telegraph system allowing transmission in just one direction.
Other designs exist that allow transmissions in both directions (Ref. [Sh90]).
Opening and closing the switch in different patterns controls the frequency and dura-
tion of signals sent to location B. The familiar Morse code, which we present in Sec-
tion 2.3, associates data with different signal patterns.
Copper wire is probably the most common way of connecting devices. Copper
is used because of its electrical conductive properties. That is, electricity flows
through copper with less resistance than through many other materials. In addition,
copper is more resistant to corrosion than other conducting metals such as iron, a
property that makes it a good choice in places where it is exposed to moisture or
humidity.
One of the most common uses of copper is in the twisted pair in which two
insulated copper wires are twisted around each other. The insulation prevents the
conductive metal in each wire from making contact and thus short-circuiting the cir-
cuit. A common use of twisted-pair wire is the transmission of a balanced signal.

Figure 2.3 One-Way Telegraph System

switch in
open position sensor
A
B
power
source
2942 | Ch 02 Page 60 Wednesday, February 16, 2000 2:42 PM

60 CHAPTER 2 TRANSMISSION FUNDAMENTALS

This means that each wire carries current but that the signals are 180° out of phase
with each other.* The effects on each current from outside electromagnetic sources
nearly cancel each other, resulting in a signal that degrades less rapidly. The twisting
helps counteract any electrical capacitance that may build up as the current travels
the length of the wire.
Twisted pairs often are bundled together and wrapped in a protective coating
that allows the bundled cable to be buried. Such cables can be rated, in part, by the
number of twists per unit length of wire. A larger frequency of twists provides a
greater reduction in capacitance and also helps reduce crosstalk, the electromagnetic
interference between adjacent pairs. For a long time, this medium was the primary
mode of telephone communications and is still common in connecting a home tele-
phone to a nearby telephone exchange. It is also common in connecting low-speed
devices such as computer terminals to a high-speed network.
Even though copper is a good conductor, electrical resistance still occurs, and a
signal transmitted over a copper wire will eventually distort and lose strength
(attenuate). In practice, this means there is a limit on the twisted pair’s length
before the transmitted signal becomes distorted beyond recognition.
If the wire must connect two points separated by a long distance, a repeater
must be inserted between the two points (Figure 2.4). A repeater is a device that
intercepts a transmitted signal before it has distorted and attenuated too badly and
then regenerates the signal and retransmits it. A logical question to ask is, How far
apart must repeaters be spaced? The space between repeaters depends on charac-
teristics such as the type of signal and the bandwidth and current carrying
capacity of the wire. Many signals may be transmitted for miles before signal
regeneration is necessary. With repeaters, there is no limit on how far a signal can
be transmitted.
A twisted pair has a bandwidth of up to 250 kHz (1 kHz = 1000 Hz) for analog
signals. Digital signal data rates vary with distance. For example, a local area net-

Figure 2.4 Two Points Connected Using a Repeater

Repeater removes distortion, and amplifies and


resends received signal.
point A point B
repeater

transmitted attenuated and retransmitted


signal distorted signal signal

*
By contrast, an unbalanced signal uses one wire to carry the current while the other is held at ground
potential. Unbalanced signals are typically more susceptible to interference than balanced signals. We’ll
discuss this further in Section 3.2.
2942 | Ch 02 Page 61 Wednesday, February 16, 2000 2:42 PM

2.1 COMMUNICATIONS MEDIA 61

work protocol known as Fast Ethernet uses twisted pair and operates at 100 Mbps
over a segment length of 100 meters. Twisted pair can also support a 2400 bps rate
for up to 10 miles.

Coaxial Cable Another common medium is coaxial cable (Figure 2.5), which
consists of four components. First is the innermost conductor, a copper or aluminum
wire core. As with the twisted pair, the core carries the signal. An insulation layer
surrounds the core and prevents the conductor from making contact with the third
layer, typically a tightly wound wire mesh.* The wire mesh acts as a shield, pro-
tecting the core from electromagnetic interference. It also protects the core from
hungry rodents looking for a free meal. The last layer is what you see on the cables
connecting your VCR to your television set, a plastic protective cover.
The wire mesh shield provides excellent protection from extraneous electrical
signals. Consequently, coaxial cable has a bandwidth of about 500 MHz (1 MHz =
1,000,000 Hz) and can achieve data rates of up to 500 Mbps.† However, coaxial
cable is more expensive than twisted pair.
Coaxial cable typically transmits information in either a baseband mode or a
broadband mode. In baseband mode, the cable’s bandwidth is devoted to a single
stream of data. Thus, the high bandwidth capability allows high data rates over a
cable. This is typical in local area networks, where only one data stream is present at
any time. With broadband, the bandwidth is divided into ranges. Each range typi-
cally carries separate coded information, which allows the transmission of multiple
data streams over the same cable simultaneously. Special equipment is used to com-
bine the signals at the source and separate them at the end. Cable television is an
example of multiple signals (one for each channel) traveling a single section of
cable. We will further discuss combining signals in Section 3.3 under multiplexing.

Figure 2.5 Coaxial Cable

copper or wire mesh


aluminum
conductor

insulator
outer cover

*
Sometimes a solid metal conductor is used instead of a mesh on cables that do not need much flexibility.

Actual data rates may vary with distances.
2942 | Ch 02 Page 63 Wednesday, February 16, 2000 2:42 PM

2.1 COMMUNICATIONS MEDIA 63

light source reflected source

α α interface between
two media
β

refracted light

Figure 2.6 Light Refraction and Reflection

distorted if viewed from above the surface. The light reflected off the objects we see
is distorted, making them look different.
The relation between β and α is of interest. Physicists use a measure known as
the index of refraction to describe it. It is defined by
cos ( α )
-----------------
cos ( β )
Thus, an index of refraction less than 1 means light is traveling into a less optically
dense medium whereas an index of refraction of greatrer than 1 means it is traveling
in to a more optically dense medium. Remember, angles β and α are between 0° and
90°, so that cos(α) < cos(β) means α > β, and vice versa.
Another interesting phenomenon occurs when the index of refraction is less
than 1 (α > β). When α is less than a certain critical angle, there is no refracted light.
In other words, all the light is reflected. This is what makes fiber optics work.
The three main components to a fiber optic filament are the core, the cladding,
and a protective cover. The core is made from very pure glass or plastic material.
The cladding surrounds the core. It is also glass or plastic but is optically less dense
than the core. How pure is the core? As we will see, an optical fiber works by
allowing light to travel through the core. In some cases the fiber is up to 20 miles
long. Because light travels from end to end we can think of the core as 20 miles
thick. Thus, imagine a block of glass so pure that a chunk 20 miles thick is nearly
transparent.
Next question: How does light enter the fiber? A light source such as a light-
emitting diode (LED) or a laser is placed at one end of the fiber. Each is a device that
responds to an electric charge to produce a pulse of light typically near the infrared
frequency of 1014 Hz. The laser produces a very pure* and narrow beam. It also has a
higher power output, allowing the light to propagate farther than that produced by an

*
Light often consists of many wavelengths, or colors, as indicated by the fact that light passing through a
prism is divided into its component rainbow colors. A laser can produce “pure” light, or light consisting
of very few wavelengths.
2942 | Ch 02 Page 65 Wednesday, February 16, 2000 2:42 PM

2.1 COMMUNICATIONS MEDIA 65

the speed of light depends on the medium through which it travels: Specifically,
light travels faster through less optically dense media.
A graded-index multimode fiber (Figure 2.8) also has a core, cladding, and pro-
tective cover. The difference is that the boundary between core and cladding is not
sharply defined. In other words, moving out radially from the core, the material
becomes gradually less dense. Consequently, as light travels radially outward it
begins to bend back toward the center, eventually reflecting back. Because the mate-
rial also becomes less dense, the light travels faster. The net result is that although
some light travels a greater distance, it travels faster, and modal dispersion is
reduced.
Another way of dealing with modal dispersion is to eliminate it. How? you may
ask. Earlier we stated that there is a finite number of modes at which light can prop-
agate. The exact number depends on the core’s diameter and the light’s wavelength.
Specifically, reducing the core’s diameter decreases the number of angles at which
light can strike the boundary. Consequently, it also reduces the number of modes. If
we reduce the diameter enough, the fiber has only one mode. Cleverly, this is called
single-mode fiber (Figure 2.9).
How far must we reduce the diameter? Another principle of physics relates the
ability to reflect an electromagnetic wave (such as light) to the size of the reflector.
Specifically, it tells us that to reflect a light ray in the manner we have described, the
reflector must be larger than the wavelength of the reflected light. Because the
reflector here is wrapped around the core, its size depends on the core’s diameter.
The relationship between frequency and wavelength states that
speed of light
wavelength = --------------------------------
frequency
Light traveling through optical fibers has a frequency of approximately 1014
Hz, so its wavelength evaluates to approximately 2 × 10–6 meters, or 2 microns

Figure 2.8 Graded-Index Multimode Fiber

entering light cladding with


waves variable refractive
index

higher optical density


lower optical density

Figure 2.9 Single-Mode Fiber

entering light
waves
2942 | Ch 02 Page 70 Wednesday, February 16, 2000 2:42 PM

70 CHAPTER 2 TRANSMISSION FUNDAMENTALS

Another type of antenna is the horn antenna (Figure 2.13). Transmitting antennas
are often this type. (Figure 2.12 shows both horn and parabolic dish antennae.) The
horn antenna consists of a cylindrical tube called a waveguide. It acts to guide the
waves and transmit them directly into a concave reflector. The reflector’s shape is
designed to reflect the microwaves in a narrow beam. The beam travels across an
unobstructed region and is eventually received by another antenna. The next time you
take a leisurely drive in the countryside, look around and you may see both types of
antenna mounted on towers. (But don’t look too long; there are other cars on the road!)
Because there must be a direct line of sight between the transmitter and
receiver, there is a limit on how far apart they can be. The limit depends on the
tower’s height, the earth’s curvature, and the type of terrain in between. For
example, antennae on tall towers separated by flat land can cover long distances,
typically 20 to 30 miles, although higher towers or towers constructed on a hilltop
can increase the distance. In some cases, antennae are separated by short distances
within city limits. However, there will be a problem if someone constructs a building
directly in the line of sight.
If transmissions must travel a long distance, several repeater towers may be
placed in between (Figure 2.14). One antenna transmits to its neighbor, which in
turn transmits to its neighbor. Proceeding this way allows transmissions between
sites whose line of sight cuts through the earth.

Satellite Transmission Primarily, satellite transmission is microwave transmis-


sion in which one of the stations is a satellite orbiting the earth (Figure 2.15). It is

Figure 2.13 Horn Antenna

narrow beam of concave


microwave reflector
transmissions

waveguide
guides
microwaves into
concave reflector

microwave
transmitter
2942 | Ch 02 Page 71 Wednesday, February 16, 2000 2:42 PM

2.1 COMMUNICATIONS MEDIA 71

direct line of sight

Earth

direct line-of-sight transmission


between two ground stations

microwave transmission tower

Figure 2.14 Microwave Towers Used as Repeaters

k up
lin lin
wn k
do

earth

receiver receiving transmitter sending


signals signals

Figure 2.15 Satellite Communications


2942 | Ch 02 Page 73 Wednesday, February 16, 2000 2:42 PM

2.1 COMMUNICATIONS MEDIA 73

siderably higher than the Sputnik traveled. The answer has great significance.
Because the earth takes 24 hours to rotate on its axis, an orbiting satellite at that height
appears stationary to a ground observer. This is called a geosynchronous orbit. If the
observer were a transmitter or receiver, the satellite would remain in a position that is
fixed relative to the observer, and communications need not be interrupted.
Sputnik and many early satellites were in much lower orbits. Technology
simply did not provide rocket engines powerful enough to boost them into higher
orbits. Consequently, they rotated around the earth in less than 24 hours, which is
why they appear to move across the sky when observed from the surface. Today,
powerful rockets boost communications satellites much higher into geosynchronous
orbits. Three equally spaced satellites at 22,300 miles above the equator can cover
almost the entire earth’s surface (Figure 2.16), except some polar regions.
Satellite communication is straightforward. Each satellite has several transpon-
ders, devices that accept a signal within a specified frequency range and rebroadcast
it over a different frequency. A ground based transmitter sends a signal (uplink) to a
satellite, where one of the transponders relays the signal back down to earth (down-
link) to a different location (Figure 2.15). Satellite communications are now com-
monly used to transmit telephone and television signals. Many people have their
own receivers for cable television reception. In some locations it is difficult to drive
through the countryside and not see a satellite receiving dish in someone’s backyard.
Of course, this is now old technology, with increasing numbers of people using 18-
inch dishes mounted on roofs, back porches, and on top of televisions.
Satellites commonly send and receive over a wide range of frequencies, with
each transponder handling signals in a specified range. Typically, the uplink and

Figure 2.16 Satellites in Geosynchronous Orbit above the Equator

satellite
22,300
miles

Earth
area of
coverage
2942 | Ch 02 Page 75 Wednesday, February 16, 2000 2:42 PM

2.1 COMMUNICATIONS MEDIA 75

more atmospheric
interference

least
atmospheric
interference

Earth

atmosphere

Figure 2.17 Atmospheric Interference as a Function of Angle of Transmission

trucks, boats, or anything mobile are relayed through satellites. The lower frequency
allows the use of equipment that is smaller, lower in cost, and requires less power.
Such applications can be found in the trucking industry, where dispatchers can
locate trucks within a range of just a few hundred feet (on a continental scale).
Applications also exist as navigation aids: Planes, boats, and automobiles can use
the system to plot their own current locations.
Geosynchronous satellites transmit a signal that can be received anywhere on
earth as long as there is a direct line-of-sight path. This type of broadcasting is
useful for broadcast television transmission and pay-per-view movie services, in
which the receivers are widely dispersed and do not have access to cable signals.
Other applications, such as for military uses, must restrict the geographic areas that
can receive signals. Special antennae that provide beam shaping allow a signal to be
concentrated in a smaller area such as a city. The future will provide spot beam
antennae, which will allow transmissions to a single site.
Currently, there are many hundreds of satellites orbiting the planet providing
communications for different applications that send and receive signals in the C and
Ku bands, so how can a satellite discriminate signals that were not meant for it? For
example, suppose ground stations 1 and 2 send to satellites 1 and 2, respectively,
2942 | Ch 02 Page 76 Wednesday, February 16, 2000 2:42 PM

76 CHAPTER 2 TRANSMISSION FUNDAMENTALS

using the same frequency (Figure 2.18). The area the signal covers depends on the
angle of signal dispersion. If two satellites are too close or the angle of dispersion is
too large, both satellites receive both signals. Consequently, neither can tell which
signal to ignore.
If the dispersion angles are smaller and satellites are sufficiently far apart, how-
ever, no two satellites will receive signals from more than one station (Figure 2.19).
The FCC defines U.S. satellite positions. For example, it has defined positions at 2°
increments between 67° and 143° west longitude for U.S. communications using the
C band. This is closer together than the previous 4° separation allowed. Satellites
transmitting signals in the Ku band may be placed at 1° increments. Increased needs
require more satellites, which must be placed closer together. As a result, ground
stations must have smaller dispersion angles for transmitted signals.
Satellite communications have created problems. For example, how do you pre-
vent unauthorized reception of signals? For that matter, how do you define unautho-
rized reception of a signal that travels through the public airwaves? Legalities are
not often clear-cut. For example, there have been different views on whether it is
legal to receive cable television’s pay channels such as HBO using satellite dishes.
Cable companies claim they lose revenue by such access. Dish owners claim the sig-
nals travel through public airspace, and anyone should be able to receive them as
they would any television signal.
Perhaps worse, how do you prevent unauthorized transmission via satellite?
There have been instances of intruders sending harmless messages via satellite. But
what about an intrusion that disrupts communications? Considering how many
applications rely on satellite communications, this could be disastrous. In many

Figure 2.18 Satellite Receiving More Than One Signal

satellite 1 satellite 2

Anything in this
range receives
signals from both
ground stations.

angle of signal
dispersion

ground station 1 ground station 2


2942 | Ch 02 Page 77 Wednesday, February 16, 2000 2:42 PM

2.1 COMMUNICATIONS MEDIA 77

satellite 1 satellite 2

area covered by
ground station 1
area covered by
ground station 2

angle of signal
dispersion

ground station 1 ground station 2

Figure 2.19 Satellite Receiving One Signal

cases, satellite signals are scrambled or encrypted to make the signal unintelligible
to unauthorized receivers. One incident, on April 27, 1986, involved a video hacker
who called himself “Captain Midnight” interrupting an HBO showing of the movie
Falcon and the Snowman. He transmitted a signal over a satellite link that over-
powered HBO’s movie signal. He claimed it was done to protest the scrambling of
signals. Chapter 4 deals with encryption and security in more detail.
Not all satellites are for telephones, weather forecasting, and military applica-
tions. Many private industries see satellites as an alternative to the telephone system,
especially where a need exists for data transmission over a long distance. Using the
phone system and going through many switches makes data transfer less reliable, and
heavy usage may cause longer response times. The solution may be the very small
aperture terminal (VSAT) system, developed in the 1980s. A VSAT system com-
monly connects a central location with many remote ones. For example, the central
location may contain a large database to which many regional offices or users need
access. Communication between two sites is via a satellite and requires the use of
small antenna dishes that can be placed to allow easy access to the central location.
VSAT equipment may connect directly to user equipment such as workstations
or controllers. Many applications rely on VSAT systems, especially those that
require high data rates for short periods of time. Examples include the National
Weather Service, news services, credit card verifications, automatic tellers, car
rental agencies, and others (Ref. [Hu90], [Po91], and [Ro93]).

Low Earth Orbit Satellites Geosynchronous satellites are particularly useful for
broadcast-type transmissions. Dishes can be aimed at a fixed point in the sky and
2942 | Ch 02 Page 84 Wednesday, February 16, 2000 2:42 PM

84 CHAPTER 2 TRANSMISSION FUNDAMENTALS

diaphragm vibration changes carbon


granule density, thus changing electrical
conductivity contacts

blah!
blah!
blah!

sound waves cause


diaphragm to vibrate

telephone mouthpiece

Figure 2.22 Converting Sound Waves to Electric Signals

the sequence and determines the destination. If there is an available route to the des-
tination and the phone is not busy, two signals are sent. The first goes to the destina-
tion and causes the phone to ring. The second goes to the source and alerts the caller
that the phone is now ringing.
Because the signals are separate, it is interesting to note that a caller does not
actually hear the phone ringing. In fact, because of delays in the circuits you might
not hear the ring until after it occurs. Perhaps you have had the experience of having
someone answer your call before you heard a ring. Common perception is that it is
caused by gremlins in the line or the mystical ability of the phone system. Now you
know that it happens only because someone answered the phone before the second
signal got back to you.
The code for each digit depends on whether you have tone or pulse dialing.
With tone dialing, each digit sends a tone consisting of a unique pair of frequencies.
With pulse dialing, each digit generates from 1 to 10 pulses. Each pulse actually cor-
responds to opening and closing a circuit, similar to depressing the hook. In fact, if
your fingers are fast enough, you can actually dial a number by rapidly depressing
the hook the proper number of times for each digit.

Call Routing The way in which phone calls are routed is an amazing feat of engi-
neering. Remember, we are discussing a network connecting many millions of users.
The first part of this network is the local loop. It consists of phones connected by
copper wires running along the familiar telephone pole or in underground cables to a
local exchange.* The local exchange contains switching logic and determines where
to route a call. If the call is to a phone with the same exchange (first three digits of

*
Other terms used in place of local exchange include the end office, central office, or class 5 office.
2942 | Ch 02 Page 85 Wednesday, February 16, 2000 2:42 PM

2.2 COMMUNICATION SERVICES AND DEVICES 85

the number), the connection can be made directly to the destination. Otherwise the
routing strategy depends on the call’s destination.
Figure 2.23 shows the major components (centers) of the telephone office. The
class 1 regional centers are the fewest in number and cover the largest areas (typically
multistate regions). Classes 2, 3, 4, and 5 are increasingly more numerous and cover
smaller areas. Those covering the largest areas are owned by long-distance carriers,
and others are owned by local companies. Table 2.4 summarizes this information. We
will provide a brief discussion of the roles these centers play in the complex system

Figure 2.23 Telephone Network

heavy-use trunk lines


class 1 regional center class 1 regional center

path 1
other sectional other sectional
centers class 2 sectional center class 2 sectional center centers

other primary other primary


centers class 3 primary center path 2 class 3 primary center centers

other toll other toll


centers class 4 toll center class 4 toll center centers

other local other local


class 5 local exchange class 5 local exchange exchanges
exchanges

calling phone called phone

Table 2.4 Major Centers in Telephone Network


CENTER OWNER AREA COVERED
Class 1 regional center Long-distance carrier Multistate
Class 2 sectional center Long-distance carrier Statewide
Class 3 primary center Local company or Metropolitan
long-distance carrier
Class 4 toll center Local company One or more cities
Class 5 local exchange Local company Neighborhood
2942 | Ch 02 Page 91 Wednesday, February 16, 2000 2:42 PM

2.2 COMMUNICATION SERVICES AND DEVICES 91

Figure 2.27 Fax Machine (Courtesy of AT&T Archives)

Figure 2.28 Bit Map Representation of “Hello”

Most fax machines do not simply take a picture and transmit the resulting dots.
Proceeding that way would require long transmission times for simple documents.
For example, suppose a fax recognizes 200 dots per inch. A little arithmetic shows
that there are 200 × 200, or 40,000, dots for one square inch. But a typical sheet of
paper measures 8 1/2 by 11 inches, or 93.5 square inches. At 40,000 dots per square
inch, a typical sheet requires 40,000 × 93.5, or 3,740,000, dots. Using a typical
transmission rate of 28.8 K bits per second, we need 3,740,000/28.8 K, or more than
2 minutes, to send the image on one sheet of paper.
Your first reaction might be, “I have used a fax machine and it didn’t take nearly
that long.” Well, you are correct. Most fax machines will not take that long because
2942 | Ch 02 Page 91 Wednesday, February 16, 2000 2:42 PM

2.2 COMMUNICATION SERVICES AND DEVICES 91

Figure 2.27 Fax Machine (Courtesy of AT&T Archives)

Figure 2.28 Bit Map Representation of “Hello”

Most fax machines do not simply take a picture and transmit the resulting dots.
Proceeding that way would require long transmission times for simple documents.
For example, suppose a fax recognizes 200 dots per inch. A little arithmetic shows
that there are 200 × 200, or 40,000, dots for one square inch. But a typical sheet of
paper measures 8 1/2 by 11 inches, or 93.5 square inches. At 40,000 dots per square
inch, a typical sheet requires 40,000 × 93.5, or 3,740,000, dots. Using a typical
transmission rate of 28.8 K bits per second, we need 3,740,000/28.8 K, or more than
2 minutes, to send the image on one sheet of paper.
Your first reaction might be, “I have used a fax machine and it didn’t take nearly
that long.” Well, you are correct. Most fax machines will not take that long because
2942 | Ch 02 Page 95 Wednesday, February 16, 2000 2:42 PM

2.3 CODES 95

binary code to be transmitted

4F 6C 64 0A 0D 4D 61 6E 0A 0D 52 69 76 65 72

O l d LF CR M a n LF CR R i v e r

printed data
Old
Man
River

PC

printer

Figure 2.29 Transmitting an ASCII-Coded Message

Table 2.6 ASCII Control Characters


ACK Acknowledgment indicates an acknowledgment for a transmission sent previously. Chapter
5 discusses the concept of acknowledgments more thoroughly.
BEL Bell causes the receiving device (usually a CRT or terminal) to emit an audible sound
usually heard as a “beep.” This signal is commonly used to attract the user’s attention
when special messages are sent or when something significant is about to happen (Fig-
ure 2.30).
BS Back Space causes the print mechanism or cursor to move backward one position. This
“control character” can be used to print two characters in one position (useful for underlin-
ing) or to print a character in boldface (print the same character twice in the same position).
On a CRT it replaces the first character with the second one.
CAN Cancel causes previously submitted data to be canceled.
CR Carriage Return causes the print mechanism or cursor to return to the leftmost print position.
Note: This character is independent of a line feed.
DC1, Device Controls correspond to special functions or features dependent on the device. For
DC2, example, DC1 and DC3 sometimes correspond to X-ON and X-OFF characters generated
DC3, by the control-Q and control-S keyboard sequences. If a device’s buffers are filling up, it can
DC4 send an X-OFF character to the sender, causing it to stop sending. Sending an X-ON causes
transmission to continue.*
2942 | Ch 02 Page 102 Wednesday, February 16, 2000 2:42 PM

102 CHAPTER 2 TRANSMISSION FUNDAMENTALS

D IGITAL E NCODING S CHEMES


There is a natural connection between digital signals and digitally encoded data.
Data stored digitally are represented by a sequence of 0s and 1s. Because digital sig-
nals can alternate between two constant values, we simply associate 0 with one
value and 1 with the other. The actual values used are not important here. With elec-
trical signals, they are sometimes equal but opposite in sign. To keep the discussion
general, we will refer to them as “high voltage” and “low voltage.”

NRZ Encoding Perhaps the simplest encoding scheme is the nonreturn to zero
(NRZ). A 0 is transmitted by raising the voltage level to high and a 1 is transmitted
using a low voltage. Thus, any sequence of 0s and 1s is transmitted by alternating
appropriately between high and low. The name NRZ refers to the fact that the
voltage level stays constant (i.e., does not return to zero) during the time a bit is
transmitted. Figure 2.31 shows the NRZ transmission of the binary string 10100110.
NRZ coding is simple, but it has a problem. Look at the transmission in Figure
2.32. What is being transmitted? Your answer should be “A sequence of 0s.” Well,
that’s true, but how many zeros? To this question, you should respond that it depends
on the duration of one bit. Now suppose we tell you that graphically, the duration
corresponds to a line one millimeter long. All you have to do is measure the length
of the line and convert to millimeters. This calculation will tell you the number of
one-millimeter segments there are and, consequently, the number of 0 bits. In theory
this method works, but in practice it may not. Suppose one person used a ruler and
constructed 1000 one-millimeter line segments end to end. How long is the resulting
line? The answer should be one meter, but imprecisions in taking measurements and
actually drawing the lines will probably result in a line close to but not exactly one
meter long. Thus, a second person measuring the line will conclude there are
slightly more or less than 1000 segments. Even if the first person were lucky and

Figure 2.31 NRZ Encoding

T, duration of 1 bit

high
value

time

low
value
1 0 1 0 0 1 1 0
2942 | Ch 02 Page 103 Wednesday, February 16, 2000 2:42 PM

2.4 ANALOG AND DIGITAL SIGNALS 103

constant voltage level

high
value

time

low
value

Figure 2.32 NRZ Encoding of a Sequence of 0s

measured accurately, imprecisions in the second person’s measurements will cause a


discrepancy.
What does this have to do with data transmissions? When a device transmits a
digital signal for one bit, it generates a constant signal for a certain duration, say T.
An internal clock defines the timing. The receiving device must know the duration
of the signal so it can sample the signal every T units. It also has an internal clock
defining the timing. So all that is needed is to make sure both clocks use the same T.
Next question: Do all the clocks in your house have the same time down to the
last second? Mine don’t. Unfortunately, any physical device is subject to design lim-
itations and imperfections. There will almost certainly be very small differences
between the clocks that cause one’s signal sampling to drift from the other’s trans-
mission. It is similar to synchronizing two clocks on New Year’s Day, only to find
that by the year’s end they differ slightly. Similarly, musicians in an orchestra may
all start playing at the same time with the same tempo, but unless they watch the
conductor and listen to one another, their tempos may begin to drift. It won’t take
much timing drift to destroy the piece, making it sound as though it were played by
the author and his colleagues.
Communicating devices need some mechanism for making sure their timing
does not vary, much like the conductor makes sure the musicians stay synchronized.
With a constant signal, there is no synchronizing mechanism. However, if the signal
changes, the changes can be used to keep the devices synchronized. Some schemes
force signal changes for that reason.

Manchester Encoding The Manchester code uses signal changes to keep the
sending and receiving devices synchronized. Some call it a self-synchronizing
code. To avoid the situation of Figure 2.32, it distinguishes between a 0 and 1 by
changing the voltage. Specifically, it represents a 0 by a change from high to low and
a 1 by a change from low to high. Figure 2.33 shows the Manchester-encoded trans-
mission of the bit string 01011001. As the figure shows, the signal will never be held
constant for a time longer than a single bit interval. Even for a sequence of 0s or 1s,
the signal will change in the middle of each interval. This change allows the
2942 | Ch 02 Page 104 Wednesday, February 16, 2000 2:42 PM

104 CHAPTER 2 TRANSMISSION FUNDAMENTALS

T, duration of 1 bit

high
value

time

low
value
0 1 0 1 1 0 0 1

Figure 2.33 Manchester Encoding

receiving device’s clock to remain consistent with the sending device’s clock. A dis-
advantage of Manchester encoding is that twice the bandwidth is needed. That is, the
signals must change twice as frequently as with NRZ encoding.
A variation of this method is called differential Manchester encoding. Like
Manchester encoding, there is always a signal change in the middle of each bit
interval. The difference is in what happens at the beginning of the interval. A 0
causes the signal to change at the start of the interval. A 1 causes the signal to remain
where it was at the end of the previous interval. Thus, a 0 may go from low to high
or high to low depending on the initial value of the signal. Figure 2.34 shows the dif-

Figure 2.34 Differential Manchester Encoding

signal level at start of T, duration of 1 bit


transmission

high
value

time
low
value
1 0 1 0 0 1 1 0
2942 | Ch 02 Page 104 Wednesday, February 16, 2000 2:42 PM

104 CHAPTER 2 TRANSMISSION FUNDAMENTALS

T, duration of 1 bit

high
value

time

low
value
0 1 0 1 1 0 0 1

Figure 2.33 Manchester Encoding

receiving device’s clock to remain consistent with the sending device’s clock. A dis-
advantage of Manchester encoding is that twice the bandwidth is needed. That is, the
signals must change twice as frequently as with NRZ encoding.
A variation of this method is called differential Manchester encoding. Like
Manchester encoding, there is always a signal change in the middle of each bit
interval. The difference is in what happens at the beginning of the interval. A 0
causes the signal to change at the start of the interval. A 1 causes the signal to remain
where it was at the end of the previous interval. Thus, a 0 may go from low to high
or high to low depending on the initial value of the signal. Figure 2.34 shows the dif-

Figure 2.34 Differential Manchester Encoding

signal level at start of T, duration of 1 bit


transmission

high
value

time
low
value
1 0 1 0 0 1 1 0
2942 | Ch 02 Page 106 Wednesday, February 16, 2000 2:42 PM

106 CHAPTER 2 TRANSMISSION FUNDAMENTALS

y y

y = sin(t) y = sin(Nt)
1 1
2π 4π
t t
π 3π
–1 –1

2π 4π 6π
------ ------ ------
N N N
(a) Period 2π
(b) Period 2π
------
N

y = A × sin(t) y
A
y = sin(t + k)

1
2π 4π t
t
π 3π –k
–1
2π – k 4π – k
–A

(c) Amplitude A (d) Phase Shift k

Figure 2.35 Analog Signals

shift by adding or subtracting from the argument. For example, if k > 0, the graph of
y = sin (t + k) (Figure 2.35d) is that of Figure 2.35a shifted to the left k units. This
change is easily verified by evaluating both functions at different values of t.

Fourier’s Result We now see that an analog signal is more complex than a
simple sine wave (graph of a sine function). In general, its amplitude, frequency, and
phase shift can all vary with time and thus create complex functions. Perhaps the
most familiar example of an analog signal is the one produced by speaking into the
telephone (Figure 2.36). As you speak, you vary the sounds you make in order to
form words. Your voice also gets louder or softer depending on whether you are
having an argument with your boss or speaking to your fiancé. Speaking louder or
softer or in a higher or lower pitch creates sound that translates to electrical analog
2942 | Ch 02 Page 107 Wednesday, February 16, 2000 2:42 PM

2.4 ANALOG AND DIGITAL SIGNALS 107

blah!
blah!
blah!

sound

telephone
analog signal

Figure 2.36 Sound Creating an Analog Signal

signals. The amplitude reflects the volume and the frequency reflects the pitch. (At
this point, there is no simple sound equivalent corresponding to a phase shift.) The
result is a complex combination of signals that represents your voice.
The problem now is how to transmit complex signals. There are infinitely many
ways of varying the amplitude, frequency, and phase shift. Furthermore, electrical
engineering tells us that different signals can experience different amounts of distor-
tion. How do engineers design hardware to do the job? Do they design different
hardware and transmission media for different signal types? Do the functions that
represent different analog signals require separate analysis?
The answer to the last two questions is no. A famous mathematician, Jean Bap-
tiste Fourier, developed a theory stating that any periodic function can be expressed
as an infinite sum of sine functions of varying amplitude, frequency, and phase shift.
The sum is called a Fourier series. Its importance is that no matter how complex
periodic functions are, they all consist of the same components.
In more mathematical terms, suppose s(t) is a periodic function with period P.
One form for Fourier’s results states that

a
a i × cos  ---------- + b i × sin  ----------
2πit 2πit
s ( t ) = ----0 +
2 ∑  P   P 
i=1

(There are other forms, but this suits our needs here.)
The coefficients ai, i = 0, 1, 2, . . . and bi, i = 1, 2, 3, . . . are determined using
P/2

s ( t ) × cos  ---------- dt
2 2πit
a i = ---
P ∫  P 
for i = 0, 1, 2, 3, . . .
– P/2

and
P/2

s ( t ) × sin  ---------- dt
2 2πit
b i = ---
P ∫  P 
for i = 0, 1, 2, 3, . . .
– P/2
2942 | Ch 02 Page 109 Wednesday, February 16, 2000 2:42 PM

2.4 ANALOG AND DIGITAL SIGNALS 109

1 1

–1 –1

(a) Graph of s(t) (b) 1-Term Fourier Approximation to s(t)

1
1

–1
–1

(c) 3-Term Fourier Approximation to s(t) (d) 5-Term Fourier Approximation to s(t)

1 1

–1 –1

(e) 11-Term Fourier Approximation to s(t) (f) 21-Term Fourier Approximation to s(t)

Figure 2.37 Fourier Approximations

to explain why, for example, listening to someone’s CD player over a telephone is


different from listening to it in person.
High-fidelity equipment is capable of producing sounds within a bandwidth of
several tens of thousands of Hz. (Actual bandwidth, of course, depends on the
equipment.) It can produce sounds ranging from about 30 Hz (cycles per second) to
2942 | Ch 02 Page 111 Wednesday, February 16, 2000 2:42 PM

2.4 ANALOG AND DIGITAL SIGNALS 111

signal component
bit string sent corresponding to bit bit string received
b1 b2 . . . bn string b1 b2 . . . bn

transmitter transmission medium receiver

Figure 2.38 Sending Data via Signals

ferent signal components make up the actual transmitted signal. The frequency
with which the components change is the baud rate.
Precisely how the transmitter determines each component is the topic of the
next section and is not important here. If you would like something more concrete
for now, just think of a unique signal amplitude for each bit combination. For
example, the signal components may have up to 2n different amplitudes, one for
each unique combination of values for b1b2 . . . bn.
At the receiving end, the process is reversed. The receiver alternately samples
the incoming signal and generates a bit string. The bit string, of course, depends on
the sample. For this process to work, the receiver must be able to sample with a fre-
quency equal to the baud rate. (If it samples less frequently than components can
change, some can go unsampled, and the result is lost data.)
Consequently, the bit rate depends on two things: the frequency with which a
component can change (baud rate) and n, the number of bits in the string. Many
people often use the terms baud rate and bit rate interchangeably. Based on our dis-
cussion, we now see that this idea is not correct. In fact,
bit rate = baud rate × n
This would seem to imply that one can always increase the bit rate by increasing
either the baud rate or n. This is true, but only up to a point. Some classic results put
an upper bound on the data rate.
The first result is surprisingly old, dating back to the 1920s, when Harry Nyquist
developed his classic theory. References [Wa91] and [Bl95] provide a more formal
treatment. We will not prove it here, but we will state it and explain its importance to
data communications. First, Nyquist showed that if F is the maximum frequency the
medium can transmit, the receiver can completely reconstruct a signal by sampling it
2f times per second. (We interject here that he assumed absolutely no noise or distor-
tion altered the signal. That is, he assumed a perfectly noiseless channel. We discuss
noisy channels shortly.) Another way of saying this is that the receiver can recon-
struct the signal by sampling it at intervals of 1/(2f ) second or twice each period
(remember, one period = 1/f ). For example, if the maximum frequency is 4000 Hz,
2942 | Ch 02 Page 113 Wednesday, February 16, 2000 2:42 PM

2.4 ANALOG AND DIGITAL SIGNALS 113

cannot reconstruct the signal. For example, consider the digital signal in Figure
2.39a. (We use a digital signal simply because it is easier to illustrate. A similar dis-
cussion can certainly be made for analog signals.) The transmitter sends two signals,
each of which oscillates between two voltage levels. However, the transmitted signal
is subjected to some noise and the received signal differs from it. The distortion is
not too great, so the received signal still pretty clearly defines two voltage levels.
Thus, it would not be too difficult to reconstruct them.
Figure 2.39b shows a similar situation, except in this case the original two
voltage levels differ by less. Now when noise occurs the two distorted signals
overlap voltage levels and it is difficult, if not impossible, to reconstruct the original
signal from the received one.

Shannon’s Result We have learned that noise can alter and possibly destroy
information. Whether the information can be reconstructed depends on how
powerful the noise is. For example, a little static electricity is not going to do
much to transmissions from a 50,000-watt radio transmitting tower. However, a
lightning strike can do amazing things to computer communications. The differ-
ence, of course, is the strength of the noise relative to that of the transmitted
signal.
Electrical engineers use a parameter called the signal-to-noise ratio to quantify
how much noise there is in the presence of a signal. We define it as S/N, where S is
the signal power and N is the noise power. You may also recognize it as a specifica-
tion on audio equipment to measure clarity of sound. A large ratio means a clear
signal; a small one indicates more distortion. In high-fidelity equipment, high
signal-to-noise ratios indicate a higher-quality sound (although in some cases the

Figure 2.39 Effect of Noise on Digital Signal

noisy
transmitter transmission receiver
medium

(a) Large voltage difference

noisy
transmitter transmission receiver
medium

(b) Small voltage difference


2942 | Ch 02 Page 116 Wednesday, February 16, 2000 2:42 PM

116 CHAPTER 2 TRANSMISSION FUNDAMENTALS

blah!
blah!
blah!

sound
codec
telephone
analog signal digital signal

Figure 2.41 Voice Information Transmitted Digitally

transmitted. At some point it is converted back to an analog signal so it can be con-


verted to sound by the telephone’s receiver.
The purpose of this section is to explain how digital signals are converted to
analog and vice versa. We will cover digital-to-analog and analog-to-digital conver-
sion methods. Section 2.6 will discuss modem operations and modem standards.

D IGITAL - TO -A NALOG C ONVERSION


Converting a digital signal to an analog one is not difficult. Basically, all you need to
do is assign a group of one or more bit values to a particular analog signal. The pre-
vious section described three ways of varying an analog signal: by frequency, ampli-
tude, and phase shift.

Frequency Modulation The first method, frequency shift keying (FSK), also
called frequency modulation (FM), assigns a digital 0 to one analog frequency and
a 1 to another. For example, if 0 corresponds to a higher frequency and 1 to a lower
one, Figure 2.42 shows the analog signal resulting from the bit string 01001. For
each bit, the modem transmits a signal of the appropriate frequency for a specified

Figure 2.42 Frequency Shift Keying (Two Frequencies), One Bit per Baud

0 1 0 0 1
2942 | Ch 02 Page 118 Wednesday, February 16, 2000 2:42 PM

118 CHAPTER 2 TRANSMISSION FUNDAMENTALS

A4
A3
A2
A1

00 11 01 10

Figure 2.43 Amplitude Shift Keying (Four Amplitudes), Two Bits per Baud

frequencies, magnitudes, or phase shifts differ by just a little. In addition, noise may
distort signals so that differences between two signals may be unmeasurable.
One common approach is to use a combination of frequencies, amplitudes, or
phase shifts, which allows us to use a larger group of legitimate signals while main-
taining larger differences among them. A common technique is quadrature ampli-
tude modulation (QAM), in which a group of bits is assigned a signal defined by
its amplitude and phase shift.*
For example, suppose we use two different amplitudes and four different phase
shifts. Combining them allows us to define eight different signals. Table 2.11 shows
the relation between three-bit values and the signal. We define the amplitudes as A1
and A2 and the phase shifts as 0, 1/(4f ), 2/(4f ), and 3/(4f ), where f is the frequency.
The shifts correspond to 1/4, 2/4, and 3/4 of a period, respectively.
Figure 2.44 shows the changing signal resulting from the transmission of the bit
string 001-010-100-011-101-000-011-110. (The hyphens are inserted for readability
only and are not part of the transmission.) To understand why the signal looks this
way, let’s proceed carefully. The first three bits, 001, define a signal with amplitude

*
An electrical engineer may disagree with this definition. Quadrature amplitude modulated signals
are created by adding two analog signals with the same frequency. One signal corresponds to a sine
function and the other to a cosine. (Sine and cosine functions differ by a 90° angle, hence the term
quadrature.) This means the signal has the form C × sin(x) + D × cos(x). Variable x varies with time
depending on the signal’s frequency, and C and D depend on the initial signal. However, trigonometry
2 2
shows that C × sin(x) + D × cos(x) may also be written as A × sin(x + P), where A = C + D and
2 2
P = Arcsin ( C/ C + D ). Thus, for our purposes, we can think of the signal as one with a varying
amplitude and phase shift.
2942 | Ch 02 Page 119 Wednesday, February 16, 2000 2:42 PM

2.5 MODULATION AND DEMODULATION 119

Table 2.11 Signal Association for Quadrature Amplitude Modulation


AMPLITUDE OF PHASE SHIFT OF
BIT VAL- GENERATED SIG- GENERATED SIG-
UES NAL NAL

000 A1 0
001 A2 0
010 A1 1/(4f )
011 A2 1/(4f )
100 A1 2/(4f )
101 A2 2/(4f )
110 A1 3/(4f )
111 A2 3/(4f )

A2

A1

–A1

–A2

interval 1 interval 2 interval 3 interval 4 interval 5 interval 6 interval 7 interval 8


001 010 100 011 101 000 011 110

Figure 2.44 Quadrature Amplitude Modulation (Two Amplitudes and Four phases), Three
bits per Baud

A2 and phase shift 0. Consequently, as discussed in the previous section, the signal
starts at 0 volts and oscillates between A2 and –A2. As before, the number of cycles
depends on the frequency and the length of time the signal is transmitted. We have
drawn one cycle for convenience.
The next three bits, 010, define a signal with amplitude A1 and phase shift 1/(4f ).
Thus, as Figure 2.44 shows, the signal oscillates between A1 and –A1. Now, with no
phase shift the signal would start at 0 and increase to A1. However, as the previous
2942 | Ch 02 Page 120 Wednesday, February 16, 2000 2:42 PM

120 CHAPTER 2 TRANSMISSION FUNDAMENTALS

section discussed, a positive phase shift corresponds to a left horizontal shift in the
graph. To help illustrate, Figure 2.45 shows (a) a graph with no phase shift and (b)
one with a phase shift of 1/(4f ).
To understand the graph in Figure 2.45b, recall that p = 1/f where p is the
period. In other words, 1/(4f ) corresponds to one fourth of a period, and the graph in
Figure 2.45b is that of Figure 2.45a shifted left one fourth of a period. Therefore, it
can be viewed as starting at its maximum, decreasing to its minimum, and rising
again to its maximum. In effect, we can view the first one-fourth of a period, the part
where it goes from 0 to its maximum, as being cut out. This phenomenon is exactly
what the second interval in Figure 2.44 shows.
The third set of three bits, 100, defines a signal with amplitude A1 and phase shift
2/(4f ). Before we explain its effect, examine the signal at the end of the second interval.
It is currently at its maximum of A1. Now if there were no phase shift, the signal would
just continue starting at A1 and decrease to –A1. But a phase shift of 2/(4f ) means that
half of a period is eliminated. Because the previous signal ended at its maximum, half
of a period corresponds to that part of the signal that decreases from A1 to –A1. Conse-
quently the signal begins at its minimum value at the start of the third interval.
Now let’s provide a general description of how to generate a signal from a
three-bit group. The signal generated by a three-bit group depends on where the pre-
vious signal ends. The phase shift is relative to that ending point. Table 2.12 defines

Figure 2.45 Effect of Phase Shift on a Signal

1 cycle 1 cycle

(a) No phase shift (b) Phase shift of 1/(4f )

Table 2.12 Rules for Signal Definition Using Quadrature Amplitude Modulation
POSITION OF
PREVIOUS SIG- NO PHASE 1/4 P E R I O D 2/4 P E R I O D 3/4 P E R I O D
NAL SHIFT PHASE SHIFT PHASE SHIFT PHASE SHIFT
At 0, increasing Start at 0, increase Start at maximum Start at 0, decrease Start at minimum
At maximum Start at maximum Start at 0, decrease Start at minimum Start at 0, increase
At 0, decreasing Start at 0, decrease Start at minimum Start at 0, increase Start at maximum
At minimum Start at minimum Start at 0, increase Start at maximum Start at 0, decrease
2942 | Ch 02 Page 122 Wednesday, February 16, 2000 2:42 PM

122 CHAPTER 2 TRANSMISSION FUNDAMENTALS

sampled at regular intervals and then a pulse with amplitude equal to that of the
sampled signal is generated. Figure 2.46 shows the result of sampling at regular
intervals.

Pulse Code Modulation PAM-generated signals look digital, but because a pulse
may have any amplitude the signal has analog characteristics. One way of making
the pulses truly digital is to assign amplitudes from a predefined set to the sampled
signals. This process is called pulse code modulation (PCM). For example, sup-
pose we divide the amplitude range into a set of 2n amplitudes and associate an n-bit
binary number with each one. Figure 2.47 shows a division into eight values (n = 3).
As before, we sample the analog signal periodically. But this time we choose
one of 2n amplitudes that most closely matches the sample’s amplitude. We then
encode the pulse using the corresponding bit sequence. The bit sequence can then be
transmitted using whatever digital transmission is in use. By sampling at regular
intervals at a rate of s per second, we achieve a bit rate of n × s bits per second.
Figure 2.47 shows the process. The first sample corresponds to 001, the second to
010, and so on.

Figure 2.46 Pulse Amplitude Modulation

analog signal pulse amplitude modulated


signal

Figure 2.47 Pulse Code Modulation

111 111
110 110
101 101
100 100
011 011
coded digitally as
010 010 001-010-101-110-
001 001 111-110-101-011-
000 000 010-010-011-100
analog signal
2942 | Ch 02 Page 122 Wednesday, February 16, 2000 2:42 PM

122 CHAPTER 2 TRANSMISSION FUNDAMENTALS

sampled at regular intervals and then a pulse with amplitude equal to that of the
sampled signal is generated. Figure 2.46 shows the result of sampling at regular
intervals.

Pulse Code Modulation PAM-generated signals look digital, but because a pulse
may have any amplitude the signal has analog characteristics. One way of making
the pulses truly digital is to assign amplitudes from a predefined set to the sampled
signals. This process is called pulse code modulation (PCM). For example, sup-
pose we divide the amplitude range into a set of 2n amplitudes and associate an n-bit
binary number with each one. Figure 2.47 shows a division into eight values (n = 3).
As before, we sample the analog signal periodically. But this time we choose
one of 2n amplitudes that most closely matches the sample’s amplitude. We then
encode the pulse using the corresponding bit sequence. The bit sequence can then be
transmitted using whatever digital transmission is in use. By sampling at regular
intervals at a rate of s per second, we achieve a bit rate of n × s bits per second.
Figure 2.47 shows the process. The first sample corresponds to 001, the second to
010, and so on.

Figure 2.46 Pulse Amplitude Modulation

analog signal pulse amplitude modulated


signal

Figure 2.47 Pulse Code Modulation

111 111
110 110
101 101
100 100
011 011
coded digitally as
010 010 001-010-101-110-
001 001 111-110-101-011-
000 000 010-010-011-100
analog signal
2942 | Ch 02 Page 123 Wednesday, February 16, 2000 2:42 PM

2.5 MODULATION AND DEMODULATION 123

At the receiving end, the bit string is divided into groups of n bits and the analog
signal is reconstructed. The accuracy of the reconstruction depends on two things. The
first is the sampling frequency s. Sampling at a frequency less than that of the signal can
cause some oscillations to be missed completely (Figure 2.48). Consequently, the recon-
structed signal can be a poor approximation to the original one. Thus, we must sample
frequently enough to preserve all the characteristics of the original signal. It would seem,
therefore, that more samples are better. This conclusion is true, but only up to a point.
Recall the Nyquist result from the previous section. It stated that sampling a signal at a
rate twice its frequency is sufficient to preserve the signal’s information. Now we have a
nice application for the Nyquist result. If the original signal’s maximum frequency is f,
anything larger than s = 2f will not provide a better approximation than with s = 2f.
The second factor that affects accuracy is the number of amplitudes from which
to choose. Figure 2.47 showed just eight amplitudes for simplicity. With relatively
large differences between the sampled signal and the pulse, the reconstructed signal
becomes distorted. Reducing differences between adjacent pulse amplitudes helps
reduce distortion.
One more note: Higher sampling frequencies and more pulse amplitudes create
higher-quality transmissions, but at a price. Each produces more bits per second,
requiring a higher bit rate, which costs more.
There are several common applications of PCM. One is the digitizing of voice
signals over long-distance telephone lines. A worldwide standard makes 8000 sam-
ples per second and uses 8 bits per sample. In accordance with the Nyquist result, this
frequency represents a little more than twice the maximum voice frequency your tele-
phone can handle. It also requires a bit rate of 8 × 8000, or approximately 64K bps.*

Figure 2.48 Sampling at Too Low a Frequency

original signal reconstructed signal

sampling
interval

*
In practice, optical fibers used by long-distance carriers have much higher bit rates because they are capable of
carrying many phone conversations simultaneously by multiplexing. Section 3.3 discusses this in more detail.
2942 | Ch 02 Page 126 Wednesday, February 16, 2000 2:42 PM

126 CHAPTER 2 TRANSMISSION FUNDAMENTALS

The AT&T 103 modem works similarly. It uses 1070 Hz for a 0 bit and 1270 for
a 1 bit in originate mode, and 2025 Hz for a 0 bit and 2225 for a 1 bit in answer
mode. Another standard is the V.22 modem. It uses phase shift keying associating
two bits with each phase shift. It has a baud rate of 600 and a bit rate of 1200. Fre-
quency and amplitude are constant.

S IGNAL C ONSTELLATION
Current modems work by changing more than just one of an analog signal’s compo-
nents, typically the phase shift and amplitude (QAM). This change allows more differ-
ences to be introduced into signal components and, as a result, more bits per
component. QAM methods can visually be described by a signal constellation, a dia-
gram that uses points plotted on a coordinate system to define all legitimate signal
changes. Figure 2.50 shows how to interpret one point. It is quantified by its length (dis-
tance from the origin) and the angle it makes with the horizontal axis. Recall from the
previous section that length and angle (phase shift) are defined by variables C and D,
amplitudes of the sine and cosine functions that create the QAM signal. Each point
defines a legitimate signal change. The signal’s amplitude corresponds to the point’s dis-
tance from the origin, and the phase shift corresponds to the angle with the horizontal.
In general, angles on a signal constellation measure between 0° and 360°. Previ-
ously, however, we defined phase shifts as a fraction of a period ranging between
zero and one period. To interpret the signal constellation correctly, we define a linear
relationship between the angles in the constellation and the fraction of a period. Spe-
cifically, an angle of x° corresponds to x/360 of a period. So, for example, an angle
of 90° corresponds to 90/360 = 1/4 of a period.
Using this interpretation, Figure 2.51 shows the signal constellation for a V.22
modem. It shows four points all the same distance from the origin, which means the

Figure 2.50 Quantifying a Point on a Signal Constellation

2 2
distance from origin = C +D

C signal constellation point

angle = arcsin  -----------------------


C
2 2
C +D

D
2942 | Ch 02 Page 128 Wednesday, February 16, 2000 2:42 PM

128 CHAPTER 2 TRANSMISSION FUNDAMENTALS

shaded areas define


regions in which
constellation points
may lie

distorted distorted phase


amplitude shift

Figure 2.52 Distortion of Signal Constellation Points

arc. Worse yet, noise does not discriminate. Either type of distortion can occur inde-
pendent of the other. The result is that the constellation point for a distorted signal
may be anywhere within a circular region of where it should be.
If the initial points are separated enough and the noise is small enough, the
noisy regions do not overlap. Consequently, a modem can recognize a distorted
signal. However, if the noise is such that the regions overlap, then communication is
impaired. If the point for a distorted signal lies in the intersection of two shaded
regions, the modem cannot tell which one it should be in (Figure 2.53).
As you probably expect, there are many other modem standards. They vary in
baud rate, bits per baud, and modulation technique. Newer standards also define
error detection and correction methods and compression techniques. Table 2.13
summarizes some of the ITU-T standards. We must also note that many modems
adhere to several standards, which is useful when communicating with a site that

Figure 2.53 Interpreting Constellation Points for a Distorted Signal

points for distorted signal points for distorted signal

true constellation points, true constellation points,


nonoverlapping noise ranges overlapping noise ranges
2942 | Ch 02 Page 128 Wednesday, February 16, 2000 2:42 PM

128 CHAPTER 2 TRANSMISSION FUNDAMENTALS

shaded areas define


regions in which
constellation points
may lie

distorted distorted phase


amplitude shift

Figure 2.52 Distortion of Signal Constellation Points

arc. Worse yet, noise does not discriminate. Either type of distortion can occur inde-
pendent of the other. The result is that the constellation point for a distorted signal
may be anywhere within a circular region of where it should be.
If the initial points are separated enough and the noise is small enough, the
noisy regions do not overlap. Consequently, a modem can recognize a distorted
signal. However, if the noise is such that the regions overlap, then communication is
impaired. If the point for a distorted signal lies in the intersection of two shaded
regions, the modem cannot tell which one it should be in (Figure 2.53).
As you probably expect, there are many other modem standards. They vary in
baud rate, bits per baud, and modulation technique. Newer standards also define
error detection and correction methods and compression techniques. Table 2.13
summarizes some of the ITU-T standards. We must also note that many modems
adhere to several standards, which is useful when communicating with a site that

Figure 2.53 Interpreting Constellation Points for a Distorted Signal

points for distorted signal points for distorted signal

true constellation points, true constellation points,


nonoverlapping noise ranges overlapping noise ranges
2942 | Ch 02 Page 140 Wednesday, February 16, 2000 2:42 PM

140 CHAPTER 2 TRANSMISSION FUNDAMENTALS

3. Digital signals can be translated to analog signals by using relatively simple tech-
niques such as varying the amplitude or frequency between two specified values.
What is the advantage of using more complex schemes such as QAM?

4. Write a program that prompts its user with a message and a bell sound to input a
number and echo print it.

5. Write a program that reads a character string and prints it on the screen moving the
cursor from right to left rather than the usual left to right orientation.

6. Write a program that clears the screen.

7. What is the Baudot code for the character string SDG564FSDH65?

8. Table 2.5 shows ASCII codes for 0 through 9. Why is there not an ASCII code for 10?

9. Draw the digital signals for the bit string 0010100010 using each of the NRZ,
Manchester, and differential Manchester digital encoding techniques. Assume the
signal is “high” prior to receipt of the first bit.

10. What is the bit string associated with the following Manchester-encoded signal?
What is the bit string if it is a differential Manchester-encoded signal?

high
value

time

low
value
x x x x x x x x

11. Draw analog signals corresponding to the following functions.

a. y = sin(t)
b. y = sin(2t)
c. y = 4sin(2t)
d. y = 2sin(2t + π/2)
e. y = 3sin(t)
f. y = sin(t + π /4)
g. y = sin(2t –π /2)

12. Assume the maximum analog frequency of a medium is 6000 Hz. According to the
Nyquist result, what are the maximum bit rates for schemes that use one, two, three,
and four bits per signal component?
2942 | Ch 02 Page 141 Wednesday, February 16, 2000 2:42 PM

EXERCISES 141

13. According to Nyquist, what frequency is necessary to support a bit rate of 30,000
bps using only one bit per signal component? Three bits per signal
component?

14. In your own words, what is the significance of Shannon’s result?

15. What is the actual signal power (relative to the noise power) if the signal-to-noise
ratio is given as 60 decibels?

16. What is the decibel rating if the signal power is twice the noise power?

17. Assume the maximum analog bandwidth of a medium is 6000 Hz. According to the
Shannon result, what is the maximum bit rate if the signal-to-noise ratio is 40 deci-
bels? 60 decibels?

18. According to Shannon, what bandwidth is necessary to support a bit rate of 30,000
bps assuming a signal-to-noise ratio of 40 decibels? What bandwidth is necessary if
the number of decibels is doubled?

19. Suppose you want to achieve a bit rate of 64,000 bps using a maximum bandwidth
of 10,000 Hz. What is the minimum allowable signal-to-noise ratio?

20. Can a phase shift of one period be used to distinguish signals?

21. Using QAM, is it possible for the exact same signal in two different intervals to cor-
respond to different bit values?

22. Using QAM, do the same bits always correspond to the same analog signals?

23. Draw the QAM analog signal (carefully) that transmits the following bit
string:
001011010101101010110
Assume the current analog signal is established as shown here. You need draw only
one complete cycle for each modulation change.

A2

A1
2942 | Ch 02 Page 142 Wednesday, February 16, 2000 2:42 PM

142 CHAPTER 2 TRANSMISSION FUNDAMENTALS

24. Suppose a modem uses quadrature amplitude modulation as described by Table


2.11. What bit sequence corresponds to the following signal (starting with the
second time interval)?

A2

A1

–A1

–A2
interval 1 interval 2 interval 3 interval 4 interval 5 interval 6 interval 7 interval 8

25. Design a QAM technique that uses up to eight phase shifts and two amplitudes. How
many bits per baud are there?

26. Assume a QAM technique has up to m phase shifts and n amplitudes. How many
bits per baud are there?

27. Why don’t modems use PCM techniques?

28. If you have a CD player, examine its technical specifications and relate them to the
discussions on PCM.

29. Why can’t professionals design modems with arbitrarily high baud rates and thus
realize unlimited data rates?

30. If you have a modem, write a short summary listing the standards it supports.

31. Draw the signal constellation for a modem that uses the QAM defined by Table 2.11.
Draw another one for the QAM techniques described by Exercise 25.

32. Describe the signal changes (i.e., specify the amplitude and phase changes) associ-
ated with the signal constellations in Figure 2.51.

33. How many bits correspond to one signal component using the V.21 standard? What
is the duration for one signal component?

34. Repeat Exercise 33 for the V.32 standard.


2942 | Ch 03 Page 146 Wednesday, February 16, 2000 3:27 PM

146 CHAPTER 3 DATA COMMUNICATION

Are there ways to transmit fewer bits and preserve the meaning of a message (pre-
sumably to save on transmission costs)?
This chapter discusses these topics. Section 3.1 discusses ways of communi-
cating using serial, parallel, synchronous, and asynchronous transmission. It also
contrasts one-way and two-way communications. The best way to ensure that
devices send and receive in compatible ways is to adhere to standards. Section 3.2
discusses standards such as RS-232 and RS-449, which are commonly used to con-
nect devices.
Sections 3.3 and 3.4 discuss ways that allow many messages to be transmitted
on a single transmission medium. They discuss multiplexing and contention strate-
gies common to LANs and the airwaves. Section 3.5 covers various data compres-
sion methods, which reduce transmission costs by transmitting fewer bits without
losing any information.

3.1 TRANSMISSION MODES

A transmission mode defines the way in which a bit group goes from one device to
another. It also defines whether bits may travel in both directions simultaneously or
whether devices must take turns sending and receiving.

S ERIAL AND P ARALLEL T RANSMISSION


The first distinction we make is between serial and parallel transmission. Parallel
transmission means that a group of bits is transmitted simultaneously by using a
separate line (wire) for each bit (Figure 3.1a). Typically, the lines are bundled in a
cable. Parallel transmissions are common especially where the distance between the
two devices is short. For example, a PC-to-printer connection up to 25 feet is consid-
ered a safe distance. The most common examples are communication between a

Figure 3.1 Parallel and Serial Transmission

Sending 01101100,
rightmost bit first
0 0
1 0
1 1
Device 0 Device Device 1 Device
1 1 2 1 0 2
1 1 0 1 1 0 1 1 0 0
0 1
0
0

(a) Parallel Transmission (b) Serial Transmission


2942 | Ch 03 Page 148 Wednesday, February 16, 2000 3:27 PM

148 CHAPTER 3 DATA COMMUNICATION

Device Device
1 y b7 b6 b5 b4 b3 b2 b1 b0 x 2

stop bit start bit

Figure 3.2 Asynchronous Transmission

typical of byte-oriented input-output (I/O), an operating systems term meaning


that data is transferred a byte at a time.
There is a potential problem with asynchronous transmission. Remember that
the receiver does not know when data will arrive until it gets there. By the time it
detects it and can react, the first bit has come and gone. It is similar to someone
coming up behind you unexpectedly and starting to talk. By the time you react and
start listening, the first few words are missed. Consequently, each asynchronous
transmission is preceded by a start bit (Figure 3.2). It alerts the receiver to the fact
that data is arriving. This gives the receiver time to respond and accept and buffer
the data bits. At the end of the transmission, a stop bit indicates the transmission’s
end. By convention an idle line (one that is transmitting no data) actually carries a
signal defining a binary 1. The start bit then causes the signal to change, corre-
sponding to a 0. The remaining bits cause the signal to change depending on bit
values. Finally the stop bit brings the signal back to the equivalent of a 1, where it
stays until the next start bit arrives.
For example, suppose you enter the digits 321 at a terminal. Using an eight-bit
extended ASCII code (with a leading 0) defines the following bits to be sent:
00110001 for the digit 1
00110010 for the digit 2
00110011 for the digit 3
Suppose we send each digit (leftmost bit first) separately using NRZ coding. Figure
3.3 shows the transmitted signal. In each case the start bit raises the signal, alerting
the receiver that other bits will follow. When they have all arrived for that digit, the
stop bit lowers the signal. It remains low until the next start bit raises it.
Asynchronous transmission is designed for use with slow devices such as key-
boards and some printers. It also has a high overhead. In the example above, two extra
bits are transmitted for every eight. This represents a 25% increase in the total trans-
mission load. For slow devices that transmit little data, this is a small problem. How-
ever, for fast devices that transfer a lot of data, a 25% increase in load is significant.
2942 | Ch 03 Page 149 Wednesday, February 16, 2000 3:27 PM

3.1 TRANSMISSION MODES 149

With synchronous transmission much larger bit groups are sent. Instead of
sending many characters separately, each with its own start and stop bit, they are
grouped together and then transmitted as a whole. We call this group a data frame
or frame.
The precise organization of a data frame varies with the protocol, discussed in
Chapter 5. Data frames do have many common characteristics. Figure 3.4 shows the
organization of a generic data frame. The orientation is rightmost bits first.
The first part of the frame contains SYN characters, unique bit patterns that
alert the receiver that a frame is arriving. A SYN character is similar to the start bit
discussed previously, except that here the pattern also ensures the receiver’s sam-
pling rate and the consistency of the rate at which the bits arrive.
Next are control bits, which may include the following elements:
• Source address specifying where the frame originated.
• Destination address specifying where the frame should go. This is important in
networks in which a frame may go through several nodes to get to its destina-

Figure 3.3 Asynchronous Transmission of the Digits 1, 2, and 3 Using NRZ Coding

stop start stop start stop start


bit bit bit bit bit bit

code for ‘1’ code for ‘2’ code for ‘3’


1 1 0 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 0 1 1 0 0 0
idle idle

direction of transmission

time between transmissions

Figure 3.4 Synchronous Transmission


2942 | Ch 03 Page 151 Wednesday, February 16, 2000 3:27 PM

3.2 INTERFACE STANDARDS 151

Device Device Device


1 1 1
Half-duplex Full-duplex
Simplex communication can go communication can
communication: both ways, but devices go both ways
one way only. must alternate sending. simultaneously.

Device Device Device


2 2 2

Figure 3.5 Simplex, Half-Duplex, and Full-Duplex Communication

S IMPLEX , H ALF -D UPLEX , AND


F ULL -D UPLEX C OMMUNICATIONS
So far this chapter has dealt with ways to transmit information from one device
to another, with a definite distinction between sender and receiver. This is an
example of simplex communications (Figure 3.5). That is, communication
goes only in one direction. The many examples include airport monitors,
printers, television sets, or talking with an unsympathetic professor about a bad
grade.
Other applications require a greater flexibility in which a device can both send
and receive. The methods vary. Some use half-duplex communications, in which
both devices can send and receive, but they must alternate. It is used in two-way
radios, some modems, and some peripheral devices. For example, the previously
mentioned bisync protocol is half duplex.
The most flexible method is full-duplex communications. Here a device can
send and receive simultaneously. When a device is sending over one line it may be
receiving on another. Many computer terminals use full-duplex communications.
This is evidenced by the ability to continue typing at the same time that information
is being printed on the screen. Many modems are also full duplex.
Two-way communication becomes complex, especially over networks. Proto-
cols must be used to make sure information is received correctly and in an orderly
manner and to allow devices to communicate efficiently. Discussions of these issues
will be covered in the next two chapters.

3.2 INTERFACE STANDARDS

Chapter 2 and the previous section described several ways to transmit information.
One might conclude that as long as two devices use the same mechanisms to send
and receive, they can communicate. Communication does not necessarily occur,
however. If two people speak at the same time, neither listening to the other, they
are not communicating. Common sense dictates that in order to communicate, they
2942 | Ch 03 Page 152 Wednesday, February 16, 2000 3:27 PM

152 CHAPTER 3 DATA COMMUNICATION

data terminal data terminal


equipment (DTE) equipment (DTE)

DTE-DCE interface DTE-DCE interface

data circuit- data circuit-


terminating communications terminating
equipment (DCE) network equipment (DCE)

Figure 3.6 DTE-DCE Interface

must take turns listening and speaking. Orderly discussions require that rules (pro-
tocols) be established that recognize an individual wanting to speak. Communica-
tions among devices must be guided similarly by protocols. Sending modulated
signals to a device does no good if the device is not prepared to sense the signals
and interpret them.
Figure 3.6 shows a typical arrangement of connected devices. The acronym
DCE means data circuit-terminating equipment, and DTE means data terminal
equipment. The DTE (a PC, for example) does not connect to a network directly. It
communicates through a DCE (a modem, for example). We call the connection
between the DTE and DCE the DTE-DCE interface. This section focuses on DTE-
DCE interface standards.

RS-232 I NTERFACE
One well-known standard is the RS-232 standard. It was developed by the Elec-
tronic Industries Association (EIA) in the early 1960s and has been revised several
times. Probably the most common version, developed in the late 1960s, is known as
RS-232-C. The technical level of detail differentiating the versions is beyond the
scope of this text, but we will discuss the RS-232-C standard.*
The most obvious (visible) aspect of the standard is the number of lines (25)
between the DTE and DCE. If the standard is fully implemented, the DTE and DCE
are connected by a 25-line cable (sometimes called a DB-25 cable) connected to
each device using a 25-pin connector (Figure 3.7). Each line has a specific function
in establishing communication between the devices. Table 3.1 summarizes them and
specifies the signal direction (i.e., whether the line is used to transmit from the DCE

*
Some years ago the EIA decided to replace the ‘RS’ designation with ‘EIA’. Consequently, the standard
is properly called the EIA-232 standard. However, because of its popularity and the fact that old habits
die hard, the ‘RS’ designation is still commonly used.
2942 | Ch 03 Page 153 Wednesday, February 16, 2000 3:27 PM

3.2 INTERFACE STANDARDS 153

Transmit
data to
DCE over
Set DTR TD
(data Set RTS
terminal (request to
ready) send)
time
DTE
t1 t3 t5 t6

t2 t4 t7 t8 t9 time
DCE
Set DSR Set CTS Set DCD
(data set (clear to (incoming
ready) send) signal)
Receive data
DTE transmitting from channel
and send to
DTE over RD

DTE receiving

Figure 3.8 Sending and Receiving over an RS-232 Connection

to the DTE or vice versa). The table also contains the EIA designation (circuit code)
for each line.
We will not provide a thorough discussion of every connection, but we will
describe the role some of the circuits play in a typical DTE-DCE connection. If you
would like a more detailed description, consult a reference such as [Bl89] or [Sh90].
Suppose the DTE is a PC and the DCE is a modem. Chapter 2 discussed how a
modem communicates with the analog world, so we now focus on the exchange
between it and the PC. The first six circuits primarily are used to establish an
exchange that ensures that neither device will send data when the other is not
expecting it. Figure 3.8 shows the exchange that occurs over a period of time.
Since the DCE interfaces to a network on behalf of the DTE, it must know when
the DTE is ready. The DTE indicates its readiness by asserting (sending a signal on)
DTR circuit number 20 (time t1 in Figure 3.8). The DCE senses the signal and
responds by connecting (if it has not already done so) to the network. Once the DCE

Figure 3.7 RS-232 Connector

1 2 3 4 5 6 7 8 9 10 11 12 13

14 15 16 17 18 19 20 21 22 23 24 25
2942 | Ch 03 Page 153 Wednesday, February 16, 2000 3:27 PM

3.2 INTERFACE STANDARDS 153

Transmit
data to
DCE over
Set DTR TD
(data Set RTS
terminal (request to
ready) send)
time
DTE
t1 t3 t5 t6

t2 t4 t7 t8 t9 time
DCE
Set DSR Set CTS Set DCD
(data set (clear to (incoming
ready) send) signal)
Receive data
DTE transmitting from channel
and send to
DTE over RD

DTE receiving

Figure 3.8 Sending and Receiving over an RS-232 Connection

to the DTE or vice versa). The table also contains the EIA designation (circuit code)
for each line.
We will not provide a thorough discussion of every connection, but we will
describe the role some of the circuits play in a typical DTE-DCE connection. If you
would like a more detailed description, consult a reference such as [Bl89] or [Sh90].
Suppose the DTE is a PC and the DCE is a modem. Chapter 2 discussed how a
modem communicates with the analog world, so we now focus on the exchange
between it and the PC. The first six circuits primarily are used to establish an
exchange that ensures that neither device will send data when the other is not
expecting it. Figure 3.8 shows the exchange that occurs over a period of time.
Since the DCE interfaces to a network on behalf of the DTE, it must know when
the DTE is ready. The DTE indicates its readiness by asserting (sending a signal on)
DTR circuit number 20 (time t1 in Figure 3.8). The DCE senses the signal and
responds by connecting (if it has not already done so) to the network. Once the DCE

Figure 3.7 RS-232 Connector

1 2 3 4 5 6 7 8 9 10 11 12 13

14 15 16 17 18 19 20 21 22 23 24 25
2942 | Ch 03 Page 157 Wednesday, February 16, 2000 3:27 PM

3.2 INTERFACE STANDARDS 157

The other cross connections make sure each DTE is ready before any transmis-
sions occur. As described previously, the DTE asserts the DTR line 20 when it is
ready, expecting the DCE to respond by asserting DSR line 6. Here one DTE’s line
20 is routed to the other’s line 6, so that when each DTE signals it is ready the other
receives that signal. Again, this fools the DTE into thinking its DCE has connected
to a network and is also ready.
Figure 3.9 shows just one example of the many variations of null modems. They
vary depending on device requirements and how much of the full RS-232 protocol
they use. For other variations, see References [St94] and [Ru89].

RS-449 I NTERFACE
As mentioned previously, the RS-232 standard was limited in bandwidth and dis-
tance. Another standard, RS-449 (sometimes referred to as EIA-449), was designed
to replace it and increase both distance and bandwidth. The RS-449 standard, unlike
RS-232, differentiates between operational and electrical specifications. That is, RS-
449 defines pin functions, but relies on one of two other standards, RS-422 or RS-
423, for the electrical standards. We will discuss these standards shortly.
RS-449 defines a 37-pin connection and looks a lot like the one in Figure 3.7,
except that it has more pins. Many of the circuit functions are similar to those of RS-
232, and it also provides new ones for modem testing. Table 3.2 lists the circuits and
their functions. The left set of columns in the table defines circuits that have similar
counterparts in RS-232; the right columns define new functions. Describing each
function in detail is beyond this book’s goals; if you are interested in more detail
consult References [Bl89] and [St94].

Figure 3.9 Null Modem

Pin # Function Pin # Function


2 Transmit data 2 Transmit data
3 Receive data 3 Receive data

5 Clear to send 5 Clear to send


4 Request to send 4 Request to send

6 Data set ready 6 Data set ready


8 Data carrier detect 8 Data carrier detect

20 Data terminal ready 20 Data terminal ready

7 Electrical ground 7 Electrical ground

DTE DTE
2942 | Ch 03 Page 159 Wednesday, February 16, 2000 3:27 PM

3.2 INTERFACE STANDARDS 159

Noise affects signal’s Noise affects both signals, but relative


amplitude. difference stays the same.

Unbalanced
signal Balanced signal

Figure 3.10 Effect of Noise on Balanced and Unbalanced Signals

is the difference between it and the ground. If noise occurs, the level can change and
the signal may be interpreted incorrectly. With a balanced signal the lines have equal
but opposite signals. In this case, the important measure is the difference between
them, not an individual signal’s level. The rationale is that if noise does occur it will
affect both signals equally. The difference between them is still the same. Since the
receiving device measures only the difference between the signals, the noise hasn’t
destroyed the information that the difference represents.
This principle is similar to that used in providing homes with 220-volt circuits.
Contrary to what some might believe, the current’s voltage is not actually doubled.
The 110-volt circuit uses two wires, one carrying 110 volts of electricity and the
other a ground. With a 220-volt circuit, both lines carry an equal but opposite elec-
tric current (they differ in phase shift by 180°). The difference is 220 volts. (This
principle also explains why birds can sit on high-voltage lines without being electro-
cuted. As long as they don’t touch anything connected to the ground the voltage dif-
ference between their toes is 0.)
RS-449 using a balanced signal can transmit up to 10 Mbps over short distances
(about 40 feet). Lowering the data rate to 100 Kbps allows transmission up to about
4000 feet. Using an unbalanced circuit, the data rate is limited to 100 Kbps at 40 feet.
It also allows for communications up to 4000 feet, but only at a data rate of 1200 bps.
RS-449 also allows for an optional nine-pin connector. The shield, signal
ground, send, and receive are pins 1, 5, 9, and 6, respectively. It also defines a sec-
ondary data channel sending and receiving over circuits 3 and 4. The last three pins
are for secondary channel control, defining a request to send, clear to send, and
receiver ready as pins 7, 8, and 2.

X.21 I NTERFACE
The X.21 interface standard is defined by ITU-T. It uses a 15-pin connector and,
like RS-449, allows balanced (electrical standard X.27) and unbalanced (X.26 stan-
2942 | Ch 03 Page 161 Wednesday, February 16, 2000 3:27 PM

3.2 INTERFACE STANDARDS 161

DTE initially: C = I = OFF DCE


T=R=1

Call request: T = 0 t1
C = ON t2 Response to call request: R = ‘+’

Please call: T = control/data t3


t4 Call connect: R = 1
I = ON

Exchange data: T = data t5 t5 Exchange data: R = data

DTE wants
to disconnect: C = OFF t6
T=0 t7 DCE confirms
disconnect request: I = OFF
R=0
t8 DCE disconnects: R = 1
DTE disconnects: T = 1 t9

time time

Figure 3.11 Sending and Receiving over an X.21 Connection

phone and having the local switching office respond by transmitting the dial tone
back to your phone.
If you were placing a phone call your next step would be to dial the number. The
DTE responds similarly by transmitting control and data information over T (time t3).
This provides the DCE with necessary information, such as an address, to establish
communications with a remote DTE via the network. As the DCE is trying to make the
connection it sends a series of SYN characters over R. When the connection is estab-
lished, the DCE informs the DTE by sending 1s over R and setting I to ON (time t4).
At this point (time t5), the DTE and DCE can exchange data, with the DTE
using the T circuit and the DCE using R. Eventually, the DTE will decide to termi-
nate its activities. It indicates its intention to the DCE by transmitting 0s over T and
setting C to OFF (time t6). The DCE confirms the intention by transmitting 0s over R
and setting I to OFF (time t7). Finally, the DCE disconnects by transmitting 1s over R
(time t8), and the DTE disconnects by transmitting 1s over T (time t9). This brings
both devices to the idle state with which we began this example.
There are many other interface standards, but describing them all is far beyond
the scope of this text. (Reference [Sh90] lists approximately 100 such standards.)
We have described some of the most common or well-known standards here and
will describe a couple of others later (that is, the X.25 network interface in Chapter 7
and ISDN in Chapter 8).
2942 | Ch 03 Page 163 Wednesday, February 16, 2000 3:27 PM

3.3 MULTIPLEXING 163

F REQUENCY -D IVISION M ULTIPLEXING


Frequency-division multiplexing (FDM) is used with analog signals. Perhaps its
most common use is in television and radio transmission. A multiplexer accepts
analog signals from multiple sources, each of which has a specified bandwidth. The
signals then are combined into another, more complex signal with a much larger
bandwidth. The resulting signal is transmitted over some medium to its destination,
where another mux extracts and separates the individual components.
This method of multiplexing involves several steps. First, the available bandwidth
of the transmission medium is divided into separate ranges or channels. For example,
the bandwidth for broadcast television (54 Mhz to 806 MHz) is divided into 68 chan-
nels of 6 MHz each. VHF channels 2 to 13 correspond to 6 MHz bands between 54
MHz and 215 MHz. UHF channels 14 to 69 correspond to 6 MHz bands between 470
MHz and 806 MHz. Each channel corresponds to one of the multiplexer’s input signals.
Next, a carrier signal is defined for each channel. It is changed (modulated) by
the corresponding input signal to create another signal (modulated signal). There are
several ways to do this. For example, Figure 3.14 illustrates amplitude modulation.

Figure 3.12 Many Users Communicating over a Network

computer
network

terminals
2942 | Ch 03 Page 164 Wednesday, February 16, 2000 3:27 PM

164 CHAPTER 3 DATA COMMUNICATION

The carrier signal has a specified frequency, typically centered in a channel’s band-
width. Its amplitude is changed to alternate between values depending on the other
signal’s maximum and minimum values.

Figure 3.13 Multiplexing Low-Speed Devices

multiplexer

computer
network

Figure 3.14 Amplitude Modulation

carrier signal
modulator

modulating signal modulated signal


2942 | Ch 03 Page 164 Wednesday, February 16, 2000 3:27 PM

164 CHAPTER 3 DATA COMMUNICATION

The carrier signal has a specified frequency, typically centered in a channel’s band-
width. Its amplitude is changed to alternate between values depending on the other
signal’s maximum and minimum values.

Figure 3.13 Multiplexing Low-Speed Devices

multiplexer

computer
network

Figure 3.14 Amplitude Modulation

carrier signal
modulator

modulating signal modulated signal


2942 | Ch 03 Page 165 Wednesday, February 16, 2000 3:27 PM

3.3 MULTIPLEXING 165

y = f(t)×g(t)
1 y = f(t)

t=2

y = –f(t)
–1

f(t)= sin(2πt)+ 0.5


4
g(t)= sin(10 × 2πt)

Figure 3.15 Graphs of Modulated Signal

A complete understanding of amplitude modulation requires some knowledge


of the mathematical representation of wave forms and Fourier series. Consequently,
a detailed explanation is beyond the scope of this text. If you want a more rigorous
discussion, see References [St94], [Wa91a], and [St96]. We can, however, illustrate
the process using a simple example.
Consider an analog signal corresponding to the formula f(t) = [sin(2πt)/4] + 0.5.
Figure 3.15 shows its graph between t = 0 and t = 2. Suppose the carrier signal cor-
responds to g(t) = sin(10 × 2πt). Figure 3.15 does not show the graph of g(t) but, if
drawn, its graph would oscillate 20 times between 1 and –1 as t ranged from 0 to 2.
Multiplying f(t) and g(t) generates the modulated signal shown in Figure 3.15.
In general, signals have much higher frequencies and correspond to complex
sums of sine functions. Still, the process of amplitude modulation remains essen-
tially the same as in the example. Other modulation techniques are frequency modu-
lation and phase modulation. As you might expect, frequency modulation alters the
frequency of the carrier depending on the input signal, and phase modulation alters
2942 | Ch 03 Page 167 Wednesday, February 16, 2000 3:27 PM

3.3 MULTIPLEXING 167

In Figure 3.17 the bit streams A1, B1, C1, and D1 are buffered separately. The
multiplexer packages them into a single frame and transmits it. It then follows by
gathering A2, B2, C2, and D2 and sending another frame. The process continues as
long as the sources are providing bit streams.
The multiplexer’s design depends in part on the input and output transmission
rates. For example, if source bits from the combined inputs arrive faster than the pre-
vious frame can be sent, frames are generated more quickly than they can be for-
warded. If the multiplexer has no capacity to store the extra frames, they are lost. We
must not supply the multiplexer with information faster than it can release it. On the
other hand, if the source bits arrive too slowly, the previous frame will have been
sent and the multiplexer has to wait for enough bits to arrive to form a new one.
During this time the output line is idle and the multiplexer is not using it to its fullest
capacity.
The optimal situation is when the global input rate (sum of rates from each
source) equals the output rate. Suppose ri is the input rate from the ith source and
routput is the multiplexer’s transmission rate. Mathematically, we express this as
n

∑ ri = r output . For example, if data from 10 sources arrived at a rate of 9.6 Kbps,
i =1
the multiplexer should be able to send them at a rate of 96 Kbps. (We describe an
alternative shortly.)
Another part of the multiplexer’s design is the size of the frame compo-
nents. One design defines Ai, Bi, Ci, and Di as eight bits or one byte. In this case
it is called a byte multiplexer. In other cases, Ai, Bi, Ci, and Di are larger, con-
taining many bytes (a block). In this case, strangely enough, it is called a block
multiplexer.

Figure 3.17 Time-Division Multiplexing

frames

A4 A3 A2 A1 A4 A3 A2 A1
M M

U U
B4 B3 B2 B1 B4 B3 B2 B1
A3 B3 C3 D3 A2 B2 C2 D2 A1 B1 C1 D1
X X
C4 C3 C2 C1 C4 C3 C2 C1

Transmitted signal: Substreams from each source


D4 D3 D2 D1 are grouped into frames and transmitted D4 D3 D2 D1
independently.

received
Signal sources: Ai, Bi, Ci, and Di represent bit streams. signals
2942 | Ch 03 Page 169 Wednesday, February 16, 2000 3:27 PM

3.3 MULTIPLEXING 169

As defined, a statistical multiplexer may not fully use its output capacity. In the
extreme case, if no sources are active there are no transmissions. The probability
that none are active depends on how many sources there are. An astute observer may
notice that we could connect additional sources to decrease this probability and keep
n
the output line busier. If this happens, then ∑ r i > r output . That is, the input capacity
i =1
of the multiplexer is now larger than its output capacity.
Having a higher input rate is not necessarily a problem. Remember, ri repre-
sents the capacity of the ith source, not its actual rate. If it is inactive, the actual bit
rate is 0. The design assumes that although the sum of input rates is larger than routput
the sources are not all active at the same time. The ideal is where the combined input
rate from active sources is equal to routput. Since activity depends on the user, it is
hard to predict and the ideal is difficult to achieve. There will be times when the
combined input rate from active sources is smaller or even larger than routput. In the
latter case, additional logic and buffers must be designed in order to accommodate
temporary surges in data. This is one reason they are sometimes called concentra-
tors: They concentrate additional data for brief periods.
An analysis of statistical multiplexers can be difficult because of the random
way in which the sources send data. Many questions must be asked. How fre-
quently will the combined input rates exceed the output rate? How often will all
sources be busy? How large must the internal buffers be to handle temporary
surges? How long are the delays when surges occur? One approach to the analysis
is the use of queuing theory, a field of mathematics that defines models for
studying events such as waiting in lines (queues) for events to occur. It can be
applied to many areas, including communications systems in which input streams

Figure 3.18 Statistical Time Division Multiplexing

frames

Ø Ø A3 A2 A1 M M ------ A3 A2 A1

U U
B4 B3 B2 B1 Ø B4 B3 B2 B1
B4 C3 D3 B3 D2 A3 B2 D1 A2 B1 C2 A1 C1
X X
C3 Ø Ø C2 C1 C3------- C2 C1
transmitted signal

D3 D2 D1 Ø Ø D3 D2 D1

signal received
sources signals
Pulse code Pulse code
modulator T T modulator
D D
M M
2942 | Ch 03 Page 171 Wednesday, February 16, 2000 3:27 PM

Pulse code Pulse code


modulator M M modulator
u u

Figure 3.20 T-1 Carrier System


l l
t DS-1 DS-1 t
i frame frame i
p p
l l
e e
x x
e e
Pulse code r r Pulse code
modulator modulator
3.3
MULTIPLEXING
171
2942 | Ch 03 Page 173 Wednesday, February 16, 2000 3:27 PM

3.4 CONTENTION PROTOCOLS 173

Figure 3.21 No Contention Protocol

the interstate highway system does. Access to the medium from many entry points
is called contention. It is controlled with a contention protocol. Figure 3.21
shows what happens with no contention protocol in the highway system. Vehicles
enter randomly and collisions occur periodically. At best they are unpleasant; at
worst they are fatal. Fortunately, the highway system is not set up this way
(although, with some drivers, you’d never know it). Figure 3.22 shows a common
and simple contention strategy for traffic. This stop-and-go protocol uses traffic
lights to control access. As long as motorists abide by the protocol they can avoid
the situation shown in Figure 3.21. We assume that unless you are from a remote
area in the Himalayas you are familiar with the details of this protocol and we
won’t discuss it further.
Communications require some protocol to ensure that transmitted data
reaches its destination. This section explores some of the protocols used. Perhaps
not surprisingly, there are many options depending on the actual medium, the
amount of traffic, and the sophistication of the needs (which has a direct correla-
tion to cost).

A LOHA P ROTOCOLS
One of the earliest contention protocols was developed in an area quite different from
the remote area of the Himalayas. The Aloha protocol was developed at the Univer-
sity of Hawaii in the early 1970s. We also call it pure Aloha in contrast to another
protocol we discuss shortly. The Aloha system was designed to establish communica-
tion among the islands using a packet radio system. The word packet or frame* refers
to the information broadcast during a single transmission. Terminals (Figure 3.23)
2942 | Ch 03 Page 174 Wednesday, February 16, 2000 3:27 PM

174 CHAPTER 3 DATA COMMUNICATION

Figure 3.22 Stop-and-Go Access Protocol

were connected to a radio channel, which in turn broadcast information from the ter-
minal to a central facility called the Menehune. Stations broadcast frames at the same
frequency. Consequently, the medium (the airspace) was truly shared. Any attempt to
broadcast two different frames simultaneously using the same frequency disrupted
both signals. The end result, of course, was that neither transmission was successful.
The Aloha protocol worked on a very simple principle. Essentially, it allowed
for any station to broadcast at any time. If two signals collided, so be it. Each station
would simply wait a random time and try again. The highway analogy would be to
enter the freeway with your eyes closed. If you have a collision, get a new car and
try again. Although it would be an expensive protocol for traffic control, it worked
well for the Aloha system.
Collisions were detected quite easily. When the Menehune received a frame it
sent an acknowledgment. It used a different frequency so as not to interfere with
incoming signals. If a station received an acknowledgment, it concluded that its
frame was transmitted successfully. If not, it assumed a collision occurred and
waited to send again. Because each station waited a random time, the chance that
two or more stations waited the same time was reduced. In turn this reduced the
chances of a second collision. If they did collide a second time (perhaps even with
another station) the same rules applied: Wait a random amount of time and try again.
2942 | Ch 03 Page 175 Wednesday, February 16, 2000 3:27 PM

3.4 CONTENTION PROTOCOLS 175

In this type of situation, collisions occur not only when two stations send simul-
taneously, but also when two transmissions overlap even by the smallest amount. It
does not matter if all or part of the frame is destroyed. It’s like receiving a telephone
call and hearing “I’ve got good news for you. You have just $%^#$%.” If the
“$%^#$%” represents static you don’t know if you won the lottery, received an
inheritance, or were elected to political office (good news?). What’s lost is gone, and
conventional wisdom dictates the entire frame be sent again.
The advantage of the Aloha protocol is its simplicity. It works very well if there
are not many transmissions, but if a station broadcasts more frequently or there are
more stations, the protocol is less effective. In either case, more collisions occur—
just as they do on heavily traveled roads.
When we are faced with increased transmissions, what can we do to decrease
the collisions? First, let us analyze a little more closely how collisions occur. As
stated, a collision occurs if any part of two transmissions overlaps. Suppose that T is

Figure 3.23 Aloha System

f1

f2
f1 f2

f1

central station
(Menehune)

f1 = broadcast frequency from individual stations

f2 = broadcast frequency from Menehune

*
Depending on the protocol, the term packet or frame may be used to indicate the contents of a single
transmission. For now we continue to use the term frame.
2942 | Ch 03 Page 176 Wednesday, February 16, 2000 3:27 PM

176 CHAPTER 3 DATA COMMUNICATION

First Second First Second Second


frame frame Time of frame frame frame
sent sent collision sent ready sent

0 T 2T 0 T 2T
(a) Transmission Using Pure Aloha (b) Transmission Using Slotted Aloha

Figure 3.24 Transmission Using Pure Aloha and Slotted Aloha

time required for one transmission and that two stations must transmit. The total
time required for both stations to do so successfully is 2T.
Next, consider an arbitrary interval of time 2T. Unless one station begins its
transmission at the start of the interval, completing both transmissions before the
end of the interval is impossible. (Why?) Consequently, allowing a station to
transmit at arbitrary times can waste time up to 2T.
As an alternative, suppose we divide time into intervals (slots) of T units each and
require each station to begin each transmission at the beginning of a slot. In other
words, even if a station is ready to send in the middle of a slot, it must wait until the start
of the next one (Figure 3.24b). This way, the only time a collision occurs is when both
stations become ready in the same slot. Contrast this to the previous scenario (3.24a),
where a collision occurs if the second station transmits when the frame is ready.
Requiring a station to transmit at the beginning of a time slot is the slotted
Aloha protocol. According to the previous discussion, it would seem to perform
better than the pure Aloha protocol. In fact, a rigorous analysis of both protocols
shows that the slotted Aloha protocol does perform better. We’ll not provide a
detailed description of the analysis here, but we will summarize the findings and
interpret them. More rigorous discussions are found in references [Wa91a], [St94],
[Ro75], [Ru89], and [Mi87].
Intuitively, we know there is a relationship between the number of frames sent
and the number sent successfully. A mathematical model can be created that, under
certain assumptions, defines the relationship as follows.
Let G represent the traffic measured as the average number of frames generated
per slot. Let S be the success rate measured as the average number of frames sent
successfully per slot. (e is the mathematical constant 2.718 . . . .) The relationship
between G and S for both pure and slotted Aloha is
2942 | Ch 03 Page 177 Wednesday, February 16, 2000 3:27 PM

3.4 CONTENTION PROTOCOLS 177

G is the traffic rate measured as the


0.5 average number of frames generated
per slot.
0.4 Slotted Aloha: S = Ge–G

0.3 S is the average number of


Pure Aloha: S = Ge–2G successful frames sent per slot.
0.2

0.1

1 2 3 4 5 G

Figure 3.25 Success Rate for Slotted and Pure Aloha Protocols

– 2G
S = Ge (pure Aloha)
–G
S = Ge (slotted Aloha)
Your next logical question is probably “So what? What does it mean?” For an
answer, look at the graphs in Figure 3.25. The vertical axis represents S and the hor-
izontal one represents G. Values for S range from 0 to 1. Since we have chosen the
slot time to equal that required to send one frame, S can be no larger.
First note that both graphs have the same basic shape. If G is small, so is S. This
makes sense since few frames will be sent successfully if there are only a few frames
generated. As G increases so does S, up to a point. More transmissions mean more
successfully sent frames, until they start colliding. At that point, which corresponds
to the high point on each graph, the success rate decreases. As G continues to
increase, S approaches 0. This corresponds to the situation in which there are so
many frames that they are almost always colliding. It becomes a rare event when a
frame gets through without colliding.
The model shows how the pure and slotted Aloha protocols compare. Differen-
tial calculus shows how to calculate the maximum value in each case. If you are
familiar with the details, just take the derivative of each function with respect to G
and equate with 0. In any case, the maximum for slotted Aloha occurs at G = 1, for
which S = 1/e ≈ 0.368. In other words, the best rate of successful transmissions is
approximately .368 frames per slot time. Another way to say it is that about 37% of
the time will be spent on successful transmissions. The rest will be on collisions or
idle time.
For pure Aloha, the maximum occurs at G = 0.5, for which S = 1/2e ≈ 0.184.
Again, this means that approximately 18% of the time is spent on successful
transmissions.
2942 | Ch 03 Page 181 Wednesday, February 16, 2000 3:27 PM

3.4 CONTENTION PROTOCOLS 181

so, it could stop transmissions immediately and decrease the time that signals are
colliding.
Figure 3.27 illustrates. In Figure 3.27a, the time of collision spans from the
transmission of the first frame to the end of the second one. The wasted time could
extend up to two time slots. In Figure 3.27b, both stations stop transmitting when the
collision occurs. Typically each will send a jamming signal (a type of electronic
scream) to ensure that all stations know a collision has occurred. In this case, the
wasted time spans only part of a slot and the time to send a short jamming signal.
Such a protocol exists and is commonly used with CSMA. We call it Carrier
Sense Multiple Access with Collision Detection (CSMA/CD). CSMA/CD typi-
cally is used with one of the persistence algorithms. We summarize it as follows:
• If a medium is busy, the station waits per the persistence algorithm.
• If the medium is quiet, the station transmits the frame and continues to listen.
• If it detects a collision, it immediately stops transmitting and sends a short jam-
ming signal.
• After a collision it waits a random amount of time before trying to send again.
The last step is important to reduce the chances that two frames will collide a second
time. There is certainly no point in two stations waiting the same amount of time just
to have their frames collide again.
Two issues that surface in a discussion of collision detection are frame size and
transmission distance. If frames are too large, one station can monopolize the
medium. On the other hand, collision detection requires that frames be at least a
minimum size so that a station can detect a collision before it finishes sending the
frame. If it detects a collision after the frame is sent, it does not know if its frame
was involved. The frame may have reached its destination and two others collided.

Figure 3.27 Collision with and without Detection

Collision detected:
Second Second packet transmission
frame frame stopped and jamming
sent Time of sent signal sent
collision
First First
frame frame
sent sent

time time
Wasted time because Wasted time because
of collision of collision

(a) Collision Without Detection (b) Collision Detection


2942 | Ch 03 Page 184 Wednesday, February 16, 2000 3:27 PM

184 CHAPTER 3 DATA COMMUNICATION

called a token. It contains bit codes that the NIC recognizes and circles the ring vis-
iting each NIC. According to the protocol, a PC can send when its NIC has the token.*
Chapter 6 describes exactly how stations exchange frames. In general, the con-
cept is as follows. When a station receives the token, one of two things occurs. If it
has nothing to send it simply sends the token on to its neighbor. If it does have some-
thing to send it inserts the data and the destination address into the token. It also
changes some control bits to identify the token as a data frame (one containing
information). Proceeding this way allows the token to visit each station and pick up
data when it is available. (It’s a lot like an electronic Federal Express traveling
around picking up and dropping off frames.)
When a station receives a frame it examines the control bits. If they indicate that
the frame contains no data, the station proceeds as before according to whether it
has data to send. If the frame contains data, the station examines the destination
address. If it is destined for some other station it just routes it to its neighbor. Other-
wise the station copies the information and sends it to the PC. It then puts the frame
back onto the ring. Eventually the frame returns to the sending station, which

Figure 3.28 Token Ring Network

NIC
NIC

Token containing bit sequence


circulating around the ring

NIC
NIC

NIC

*
In some situations this is not true. Chapter 6 provides a more detailed discussion of the token ring
protocol.
2942 | Ch 03 Page 185 Wednesday, February 16, 2000 3:27 PM

3.4 CONTENTION PROTOCOLS 185

Station C
NIC = network interface card

NIC NIC

NIC
NIC

NIC

Station A
Station B
List of frames
to send List of frames
to send
data frame
data frame

data frame
data frame

data frame

data frame

Figure 3.29 One Station Sending Many Frames

removes it and puts the token or another frame back onto the ring. Proceeding this
way, the data eventually reaches its destination.
Token ring operations can be expanded to include prioritization and a reserva-
tion system that allows a station to reserve a token that already has data for future
use. We will discuss these operations in Section 6.3.

Slotted Ring Our description so far allows only one data frame per token. Thus a
station will not send data until it receives an empty token. This fairly simple
approach can have drawbacks, as Figure 3.29 shows.
2942 | Ch 03 Page 187 Wednesday, February 16, 2000 3:27 PM

3.4 CONTENTION PROTOCOLS 187

tions on the bus. That is, two stations numbered consecutively need not be physi-
cally adjacent.
As with a token ring, the station with the token transmits. Because the stations
are not connected physically in a ring, a station can transmit to any other directly. As
with the previous protocols, the bus interface examines the addresses of transmitted
frames and reads the frames destined for it.
The strongest proponents of the token bus were people interested in factory
automation. The common bus structure allowed computer-controlled devices to be
positioned along an assembly line. However, these proponents were uncomfortable
with CSMA/CD approaches because there was no theoretical limit on the number of
collisions that could occur and, consequently, no theoretical limit on frame delays.
For obvious reasons they wanted to ensure that when a large piece of machinery
came rolling down the assembly line, the computer-controlled devices would be
ready to receive it.
Token bus protocols have one difficulty we have not yet encountered. A new sta-
tion cannot be added as simply as with the previous protocols. Here, a station sends a
token to its neighbor via the common bus, and since all stations sense the bus the sta-
tion must know who or where its neighbor is. (No isolationism here.) Consequently,
adding or deleting stations does require some additional work to be done to inform
appropriate stations of the change. A discussion of this process requires some knowl-
edge of higher-level protocols. We will revisit this topic more fully in Chapter 6.

Figure 3.30 Token Bus Network

NIC = network interface card

NIC NIC
communications bus

NIC NIC NIC


Token travels the bus visiting
each station.
2942 | Ch 03 Page 191 Wednesday, February 16, 2000 3:27 PM

3.5 DATA COMPRESSION 191

Huffman codes, so how do we interpret the Huffman-coded bit stream? How do we


know where one letter ends and the next one begins?
The answer lies in a property of Huffman codes called the no-prefix property.
That is, the code for any character never appears as the prefix of another code. For
example, the Huffman code for A is 01, so no other code starts with a 01.
Figure 3.31 shows how to interpret a Huffman-coded string. As bits are
received, a station builds a substring by concatenating them. It stops when the sub-
string corresponds to a coded character. In the example of Figure 3.31, it stops after
forming the substring 01, meaning that A is the first character sent. To find the
second character, it discards the current substring and starts building a new one with
the next bit received. Again, it stops when the substring corresponds to a coded char-
acter. In this case, the next three bits (110) correspond to the character B. Note that

Table 3.7 Frequencies for the Letters A through E


LET- FRE-
TER QUENCY

A 25%
B 15%
C 10%
D 20%
E 30%

Table 3.8 Huffman Code for the Letters A through E


LET- COD
TER E

A 01
B 110
C 111
D 10
E 00

Figure 3.31 Receiving and Interpreting a Huffman-Coded Message

Bit stream transmission

(01110001110110110111)
First character sent A B E C A D B C Last character sent
2942 | Ch 03 Page 194 Wednesday, February 16, 2000 3:27 PM

194 CHAPTER 3 DATA COMMUNICATION

Runs of the Same Bit There are a couple of ways to implement run-length
encoding. The first is especially useful in binary streams where the same bit appears
in most of the runs. In a fax example consisting primarily of characters, there will be
many long runs of 0s (assuming a light spot corresponds to a 0). This approach just
transmits the length of each run as a fixed-length binary integer. The receiving sta-
tion receives each length and generates the proper number of bits in the run,
inserting the other bit in between.
For example, suppose four bits are used to represent the run length. Consider the
bit stream of Figure 3.33a. Figure 3.33b shows the compressed stream that is sent.
The original stream starts with 14 zeros, so the first four bits in the compressed stream
are 1110 (binary 14). The next four bits in the compressed stream are 1001 (binary 9
for the second run of nine 0s). After the second run there are two consecutive 1s.
However, this approach sees them as two distinct 1s separated by a run of no 0s. Con-
sequently, the third group of four bits is 0000.
The fourth run has 20 zeros. Unfortunately, 20 cannot be expressed using four
bits. In this case, the run length is expressed using a second four-bit group. The two
four-bit numbers are then added to determine the run length. In Figure 3.33b, the
1111 (binary 15) and 0101 (binary 5) groups determine a run length of 20.
If the run length is too large to be expressed as a sum of two four-bit numbers,
the method uses as many four-bit groups as necessary. The receiving station must
know that a group of all 1s means the next group corresponds to the same run. Thus,
it continues summing the group values and stops after it receives something other
than all 1s. Consequently, the run of length 30 is represented by 1111, 1111, and
0000. In this case the 0s are needed to tell the station that the run stops at 30 zeros.

Figure 3.33 Stream Prior to Compression and Run-Length-Encoded Stream

Bit stream 0 . . . 010 . . . 0110 . . . 010 . . . 0110 . . . 0 91 bits

Number of 0s 14 9 20 30 11
in run

no 0s no 0s

(a) Stream prior to compression

Run lengths (binary) 1110 1001 0000 1111 0101 1111 1111 0000 0000 1011 40 bits

Run lengths (decimal) 14 9 0 15 5 15 15 0 0 11

(b) Run-ength-encoded stream


2942 | Ch 03 Page 198 Wednesday, February 16, 2000 3:27 PM

198 CHAPTER 3 DATA COMMUNICATION

COMPRESSION DECOMPRESSION
1 void compress (FILE * fileid) 1 void decompress
2 { 2 {
3 initialize(code table); 3 initialize(code table);
4 buffer=string consisting of first 4 receive first code, call it prior;
character from the file.
5 while ( (c=getc(fileid)) != EOF) 5 print the string associated with prior;
6 { 6 while (true)
7 tempstring=concat(buffer, c); 7 {
8 search for tempstring in the code table; 8 receive code, call it current; if no code then break;
9 if found 9 search for current in the code table;
10 buffer = tempstring; 10 if not found
11 else 11 {
12 { 12 c=1st character of string associated with prior;
13 send the code associated with buffer; 13 tempstring=concat(string associated with prior, c);
14 assign a code to tempstring; store 14 assign a code to tempstring; store both in the
both in the code table; code table;
15 buffer=string consisting of one character c; 15 print tempstring;
16 } 16 }
17 } //while loop 17 else
18 send the code associated with buffer; 18 {
19 } //compress 19 c=1st character of string associated with current/;
20 20 tempstring=concat(string associated with prior, c);
21 21 assign a code to tempstring; store both in the code
table
22 22 print string associated with current
23 23 }
24 24 prior=current
25 25 } //while loop
} //decompress

Figure 3.35 Lempel-Ziv Compression And Decompression Algorithms

provide all the C language–specific details and declarations. We leave that as an exer-
cise. The compression algorithm is based on the following central ideas:

1. Assign a code to each letter or character that is part of the initial text file (line 3
of the compression algorithm) and store in a code table.
2. Set up a loop and get characters one at a time from the file. We will use a buff-
ered string (initially the first character, line 4) built by concatenating characters
from the file.
2942 | Ch 03 Page 207 Wednesday, February 16, 2000 3:27 PM

3.5 DATA COMPRESSION 207

Figure 3.38 shows the results of applying the discrete cosine transform on two
different arrays. The first array (Figure 3.38a) contains P values that change uni-
formly. This would correspond to an image with uniform color changes and little
fine detail. In this case, the T array contains many AC coefficients that are 0. Note
how the AC coefficients become generally smaller as they get further away from the
upper left position in the array. Values that are further away from that position corre-
spond to high spatial frequencies, or fine detail in the image. Since this particular
image has little fine detail, these values are small and mostly 0.
In the second case (Figure 3.38b), the P values change a lot throughout the
array. This would correspond to an image with large color changes over a small area.
In effect, it represents an image with a lot of fine detail. In this case, the AC coeffi-
cients are all nonzero.
In general, if the pixel values change more rapidly and less uniformly as a function
of their position, the AC coefficients correspond to values with larger magnitudes. In
addition, more of the higher spatial frequency values become nonzero. In summary, the
AC coefficients are essentially a measure of pixel variation. Consequently, images with
a lot of fine detail will be harder to compress than images with little color variation.
F i g u re 3 . 3 8 Discrete Cosine Transform Results on Two Different Arrays

P array T array (values rounded to the nearest integer)

20 30 40 50 60 70 80 90 720 – 182 0 – 19 0 –6 0 –1
30 40 50 60 70 80 90 100 – 182 0 0 0 0 0 0 0
40 50 60 70 80 90 100 110 0 0 0 0 0 0 0 0
50 60 70 80 90 100 110 120 – 19 0 0 0 0 0 0 0
60 70 80 90 100 110 120 130 0 0 0 0 0 0 0 0
70 80 90 100 110 120 130 140 –6 0 0 0 0 0 0 0
80 90 100 110 120 130 140 150 0 0 0 0 0 0 0 0
90 100 110 120 130 140 150 160 –1 0 0 0 0 0 0 0
(a) P array representing small changes in the image

P array T array (values rounded to the nearest integer)

100 150 50 100 100 150 200 120 835 15 – 17 59 5 – 56 69 – 38


200 10 110 20 200 120 30 120 46 – 60 – 36 11 14 – 60 – 71 110
10 200 130 30 200 20 150 50 – 32 –9 130 105 – 37 81 – 17 24
100 10 90 190 120 200 10 100 59 –3 27 – 12 30 28 – 27 – 48
10 200 200 120 90 190 20 200 50 – 71 – 24 – 56 – 40 – 36 67 – 189
150 120 20 200 150 70 10 100 – 23 – 18 4 54 – 66 152 – 61 35
200 30 150 10 10 120 190 10 2 13 – 37 – 53 15 – 80 – 185 – 62
120 120 50 100 10 190 10 120 32 – 14 52 – 93 – 210 – 48 – 76 80

(b) P array representing large changes in the image


2942 | Ch 04 Page 228 Wednesday, February 16, 2000 3:28 PM

228 CHAPTER 4 DATA SECURITY AND INTEGRITY

just mentioned, some simple encryption schemes are not very secure and some the-
oretically difficult ones are very secure. We finish the chapter by discussing some
of the most serious threats to computer and communications security: worms,
viruses, and hackers. We will describe them and discuss some common approaches
to battling them.

4.2 PARITY CHECKING

Most error detection techniques require sending additional bits whose values depend
on the data that is sent. Thus, if the data is changed the additional bit values no
longer correspond to the new data (at least in theory). Probably the most common
approach is parity checking, which involves counting all the 1 bits in the data and
adding one more bit to make the total number of 1 bits even (even parity) or odd (odd
parity). The extra bit is called the parity bit. We will base our discussions on an even
parity and leave it to the reader to construct similar discussions for odd parity.
To illustrate, suppose the number of 1 bits in the data is odd. By defining the
parity bit as 1, the total number of 1 bits is now even. Similarly, if the number of 1
bits in the data is already even, the parity bit is 0. Consider the bit streams in Figure
4.1. The first one has four 1 bits. Therefore, its parity bit is 0. The second one has
five 1 bits, so its parity bit is 1.

P ARITY C HECKING A NALYSIS


Parity checking will detect any single-bit error. The parity bit is transmitted with the
data bits and the receiver checks the parity. If the receiver finds an odd number of 1
bits, an error has occurred. Single-bit errors are very rare in electronic transmissions,
however. For example, suppose an error occurred because of a brief power surge or
static electricity whose duration is a hundredth of a second. In human terms, a hun-
dredth of a second is barely noticeable. But if the data rate is 64 Kbps (kilobits per
second), approximately 640 bits may be affected in that hundredth of a second.
When many bits are damaged we call this a burst error.
How does parity checking work for arbitrary burst errors? Suppose two bits
change during transmission. If they were both 0, they change to 1. Two extra 1s still
make the total number of 1 bits even. Similarly, if they were both 1 they both change

Figure 4.1 Detecting Single-Bit Errors Using Parity Checking

data bits data bits


11010100 0 01101101 1

Parity bit is 0 to make the Parity bit is 1 to make the


total number of 1s even. total number of 1s even.
2942 | Ch 04 Page 229 Wednesday, February 16, 2000 3:28 PM

4.2 PARITY CHECKING 229

to 0 and there are two fewer 1 bits, but still an even number. If they were opposite
values and both change, they are still opposite. This time the number of 1 bits remains
the same. The bottom line is that parity checks do not detect double-bit errors.
In general, if an odd number of bits change, parity checking will detect the
error. If an even number of bits change, parity checking will not detect the error. The
conclusion is that parity checks will catch about 50% of burst errors, and a 50%
accuracy rate is not good for a communications network.
Does this make parity checks useless? The answer is no, for two reasons.
First, some computer memory organizations store the bits from a byte or word on
different chips. Thus, when the word is accessed the bits travel different paths. In
such cases the malfunction of one path can cause a single-bit error. Such archi-
tectures often use additional memory chips for parity bits. (The details are
beyond the scope of this text.) The second reason is that parity checking is the
basis for other, more sophisticated detection techniques, discussed in this and the
next sections.

D OUBLE -B IT E RROR D ETECTION


Since a single parity check will detect any single-bit error, you might guess that
extra parity checks can detect multiple errors. They can, up to a point. For example,
suppose we wanted to detect double-bit errors. One approach is to use two parity
checks, one for the odd-numbered bits and one for the even-numbered bits. Figure
4.2 shows how to do this. In the figure, one parity bit is used for positions 1, 3, 5,
and 7 and the other for positions 2, 4, 6, and 8. Consequently, if any single bit or any
two consecutive bits are changed, one or both parity checks fail.
You might respond by asking what happens if two even- (or odd-) numbered bits
change. The answer is simple: It doesn’t work. Even though this method provides a little
more error checking than single parity checks, it still won’t detect all errors. It is pos-
sible to define additional parity checks to account for different combinations of errors,
but the choice of which positions to check becomes more difficult. In addition, the

Figure 4.2 Detecting Consecutive Double-Bit Errors Using Parity Checking

position position Interference changes these


1 8 two bits.

Sender
Receiver
01101000 01 01101000 01 01110000 01
Neither parity check
is valid.
parity bit for parity bit for
positions 1, 3, 5, positions 2, 4, 6,
and 7 and 8
2942 | Ch 04 Page 230 Wednesday, February 16, 2000 3:28 PM

230 CHAPTER 4 DATA SECURITY AND INTEGRITY

number of parity bits increases, resulting in more transmission overhead. Nevertheless,


one error correction method does use this approach; we will discuss it in Section 4.4.

B URST E RROR D ETECTION


Trying to detect errors in arbitrary positions (burst errors) certainly can be difficult. But
perhaps we are approaching this problem the wrong way. Earlier we stated that some
computer memory organizations store bits from a byte in separate chips. The bits travel
different paths and the byte is assembled afterward. We can use this idea in communi-
cations as well. Frequently, messages (especially long ones) are divided into smaller,
more manageable units called frames. Rather than sending all bits from one frame
together, we can send them separately. Transmitting just one bit of information is not
very efficient, however. It is analogous to writing a letter, cutting out the words and
stuffing them into separate envelopes, and mailing them. On the other hand, if there are
many frames to send perhaps we can transmit many bits together but just one from
each frame. The sender has to disassemble them and the receiver reassemble them.
Figure 4.3 illustrates this principle. Create a two-dimensional bit array in which
each row corresponds to one frame. The first column contains the first bits from each
frame, the second column contains the second bits from each frame, and so on. The
figure shows 10 frames of 5 bits each. Next we construct a single parity bit for each
frame, which gives us an extra column. Now instead of sending each frame with its
parity bit, we send each column separately. In Figure 4.3 we would send six columns
consisting of 10 bits each.
Now suppose a burst error occurs and interferes with one transmission. At the
most, one bit from each original data frame is actually changed, and the parity checks
will detect them. In Figure 4.3, column 4 was damaged, making all the bits 0.* The

Figure 4.3 Detecting Burst Errors Using Parity Bits

Sender Receiver

Row (frame) Parity bit for Row Parity bit


number one row number for one row
1 01101 1 1 01101 1
2 10001 0 2 10001 0
3 01110 1 3 01100 1*
4 11001 1 Burst error occurs and 4 11001 1
5 01010 0 destroys column four, 5 01000 0*
6 10111 0 making it all zeroes. 6 10101 0*
7 01100 0 7 01100 0
8 00111 1 8 00101 1*
9 10011 1 9 10001 1*
10 11000 0 10 11000 0
Column number 12345 6 Column number 12345 6

* Parity bit is not correct


2942 | Ch 04 Page 233 Wednesday, February 16, 2000 3:28 PM

4.3 CYCLIC REDUNDANCY CHECKS 233

x6 + x3 +x

x4 + x3 + 1 x10 + x9 + x7 + x5 + x4

x10 + x9 + x6

x7 + x6 + x5 + x4

x7 + x6 + x3

x5 + x4 + x3

x5 + x4 +x

x3 +x remainder

Figure 4.4 Calculation of (x 10 + x 9 + x 7 + x 5 + x 4) / (x 4 + x 3 + 1)

10 9 7 5 4
T ( x) = x + x + x + x + x
and
4 3
G( x) = x + x + 1

This is just like polynomial division from an algebra course except that the
calculations use modulo 2 arithmetic. Modulo 2 addition and subtraction are
defined by

0+0=0
1+0=1
0+1=1
1+1=0

and

0–0=0
1–0=1
0–1=1
1–1=0

Note that modulo 2 addition and subtraction are the same as and, in fact, correspond
to the exclusive OR operation. This is an important fact we use later when we dis-
cuss CRC implementation.
Figure 4.5 shows the same division using synthetic division. You might recall
from the same algebra class that it is a shortcut that uses only the coefficients of the
2942 | Ch 04 Page 234 Wednesday, February 16, 2000 3:28 PM

234 CHAPTER 4 DATA SECURITY AND INTEGRITY

1001010
11001 11010 110000
11001
001 1 1
000 0 0
01 1 11
00 0 00
1111 0
11001
01110
00000

11100
11001
01010
00000
1 0 1 0 remainder

Figure 4.5 Synthetic Division of (x10+ x9+ x7+ x5+ x4) / (x4+ x3 + 1)

polynomials (in this case, bit strings). Remembering to use zeros where there are no
polynomial terms, the coefficient list for x10 + x9 + x7 + x5 + x4 is 11010110000 and
for x 4 + x3 + 1 is 11001.

H OW CRC W ORKS
Let’s now describe how CRC works. Suppose we want to send the bit string
1101011, and the generator polynomial is G(x) = x4 + x3 + 1. (We will discuss some
criteria for choosing G(x) later.)
Step 1: Append 0s to the end of the string. The number of 0s is the same as the
degree of the generator polynomial (in this case, 4). Thus the string becomes
11010110000.
Step 2: Divide B(x) by G(x). Figures 4.4 and 4.5 show the result for this
example, giving a remainder of R(x) = x3 + x, or its bit string equivalent of 1010.
Note that we can write this algebraically as

B( x) R( x)
------------ = Q ( x ) + ------------
G( x) G( x)

where Q(x) represents the quotient.


Equivalently, we can write
2942 | Ch 04 Page 235 Wednesday, February 16, 2000 3:28 PM

4.3 CYCLIC REDUNDANCY CHECKS 235

B( x) = G( x) × Q( x) + R( x)

Step 3: Define T(x) = B(x) – R(x). Since the subtraction takes the difference of
coefficients of like terms, we calculate the difference by subtracting the bit
strings associated with each polynomial. In this case, we have

11010110000 bit string B


– 1010 bit string R
11010111010 bit string T
Note that the string T is actually the same as string B with the appended 0s
replaced by R. Another important fact, as shown by Figure 4.6, is that if we divide
T(x) by G(x) the remainder is 0.* The sender then transmits the string T.
Step 4: If the string T arrives without damage, dividing by G(x) will yield a 0
remainder. But suppose that during transmission string T is damaged. For
example, suppose that four bits in the middle changed to 0 and the string arrives
as 11000001010. The receiver synthetically divides it by G(x) and the remainder
is not 0 (Figure 4.7). Since the remainder is not 0, the receiver concludes that an

Figure 4.6 Dividing T(x) by G(x)

1001010
11001 11010111010
11001
00111
00000
01111
00000
11111
11001
0110 0
00000
11001
11001
00000
00000
0 0 0 0 remainder

*
There is an analogy using integers that says if p and q are integers and r is the integer remainder
obtained by dividing p by q, then p – r is evenly divisible by q. For example, 8/3 generates a remainder
of 2 and 8 – 2 is evenly divisible by 3.
2942 | Ch 04 Page 236 Wednesday, February 16, 2000 3:28 PM

236 CHAPTER 4 DATA SECURITY AND INTEGRITY

1000111
11001 11000001010
11001
step 1 00010
00000
step 2 00100
00000
step 3 0100 1
00000
step 4 1001 0
11001
step 5 10111
11001
step 6 11100
11001
step 7 0 1 0 1 remainder

Figure 4.7 Division of Received Polynomial by G(x)

error has occurred. (Note: This is not the same as saying that dividing a dam-
aged string by G(x) will always yield a nonzero remainder. It can happen, but if
G(x) is chosen wisely it occurs only rarely. We will discuss this topic next.)

A NALYSIS OF CRC
The mechanisms of CRC are fairly straightforward. The question we have yet to
answer is whether the method is any good. Will the receiver always be able to detect
a damaged frame? We relied on the proposition that a damaged frame means that
dividing by G(x) yields a nonzero remainder. But is this always true? Is it possible to
change the bit string T in such a way that dividing by G(x) does give a zero
remainder?
A complete and detailed proof requires knowledge of factorization properties of
polynomial rings (a field in abstract mathematics), and we will not provide one here.
Instead, we will provide a brief discussion to give some sense of why it works. To
begin, let’s specify more accurately what we are looking for. Changing the bits in T
is analogous to adding some unknown polynomial to T(x). Thus, if T′ represents the
received string and T′(x) the associated polynomial, then T′(x) = T(x) + E(x), where
E(x) is unknown to the receiver of T′. In the previous example,
string T = 11010111010 corresponds to T(x) = x10 + x9 + x7 + x5 + x4 + x3 + x
string E = 00010110000 corresponds to E(x) = x7 + x5 + x4
2942 | Ch 04 Page 242 Wednesday, February 16, 2000 3:28 PM

242 CHAPTER 4 DATA SECURITY AND INTEGRITY

Table 4.1 Number of Combinations of Parity Successes and Failures as a Function of n


n
2 (N U M B E R O F C O M B I N A -
TIONS
n (N U M B E R O F NUMBER OF POSSIBLE PARITY SUC-
PARITY OF CESSES
CHECKS) BITS SENT AND FAILURES)

1 9 2
2 10 4
3 11 8
4 12 16
In general, if n parity checks are used, there are 2n possible combinations of
failures and successes. We must associate each bit position with a unique combina-
tion to allow the receiver to analyze the parity checks and conclude where an error
occurred (if one occurred). However, in order to account for every bit position, we
need n so that 2n is larger than the number of bits sent. We also must remember that
each additional parity check requires another bit to be sent.
Table 4.1 shows the relationship between n and the number of bits sent,
assuming we start with an 8-bit frame. As it shows, if we use four parity checks there
are 16 possible combinations of parity successes and failures. The four additional
parity bits with the eight original bits means 12 bits are actually sent. Thus, 13 events
are possible: There is no error or there is a single-bit error in one of 12 positions.
The next step is to associate a combination with a unique event. To do this, con-
struct four parity bits p1, p2, p3, and p4 and insert them into the frame as shown in
Figure 4.9. Each parity bit establishes even parity for selected positions listed in the

Data to send: m1 m2 m3 m4 m5 m6 m7 m8

Hamming code: p1 p2 m1 p3 m2 m3 m4 p4 m5 m6 m7 m8

Bit position 1 Bit position 12

p1 even parity for positions 1, 3, 5, 7, 9, 11

p2 even parity for positions 2, 3, 6, 7, 10, 11

p3 even parity for positions 4, 5, 6, 7, 12

p4 even parity for positions 8, 9, 10, 11, 12

Figure 4.9 Hamming Code for Single-Bit Error Correction


2942 | Ch 04 Page 244 Wednesday, February 16, 2000 3:28 PM

244 CHAPTER 4 DATA SECURITY AND INTEGRITY

Received bit stream: 0 1 0 1 0 1 0 1 0 1 1 1


• • • • • •

Position Number
• Indicates bits checked using p1; parity check fails. 1

Indicates bits checked using p2; parity check succeeds. 0

Indicates bits checked using p3; parity check fails. 1

Indicates bits checked using p4; parity check succeeds. 0

Error is in position 0101 = 5

Figure 4.11 Parity Checks of Frame After Transmission

Figure 4.11 shows the received frame 0 1 0 1 0 1 0 1 0 1 1 1. Now, if we per-


form each parity check, we see that the checks for p1 and p3 are invalid. That is,
there is an odd number of 1 bits in positions 1, 3, 5, 7, 9, and 11, and in positions 4,
5, 6, 7, and 12. Thus, according to Table 4.2, the error is in bit 5. Since bit 5 is 0, the
receiver changes it to 1 and the frame is corrected.

M ULTIPLE -B IT E RROR C ORRECTION


We can make similar comments about single-bit error correcting codes that we made
about single-bit error detection codes. That is, single-bit errors are not common in
data communications. One response to this information applies when there are many
data frames to send. We can create a Hamming code for each, visualize all the
Hamming codes as a two-dimensional bit array, and transmit the array one column
at a time. If a single burst error affects no more than one column, no more than one
bit in each row is destroyed. The receiver can determine the original data. The
second response is to generalize Hamming codes for double- or multiple-bit error

Figure 4.10 Bit Stream Before Transmission

Data: 0 1 1 0 0 1 1 1
m1 m2 m3 m4 m5 m6 m7 m8

Hamming code: 0 1 0 1 1 1 0 1 0 1 1 1
p1 p2 m1 p3 m2 m3 m4 p4 m5 m6 m7 m8
2942 | Ch 04 Page 244 Wednesday, February 16, 2000 3:28 PM

244 CHAPTER 4 DATA SECURITY AND INTEGRITY

Received bit stream: 0 1 0 1 0 1 0 1 0 1 1 1


• • • • • •

Position Number
• Indicates bits checked using p1; parity check fails. 1

Indicates bits checked using p2; parity check succeeds. 0

Indicates bits checked using p3; parity check fails. 1

Indicates bits checked using p4; parity check succeeds. 0

Error is in position 0101 = 5

Figure 4.11 Parity Checks of Frame After Transmission

Figure 4.11 shows the received frame 0 1 0 1 0 1 0 1 0 1 1 1. Now, if we per-


form each parity check, we see that the checks for p1 and p3 are invalid. That is,
there is an odd number of 1 bits in positions 1, 3, 5, 7, 9, and 11, and in positions 4,
5, 6, 7, and 12. Thus, according to Table 4.2, the error is in bit 5. Since bit 5 is 0, the
receiver changes it to 1 and the frame is corrected.

M ULTIPLE -B IT E RROR C ORRECTION


We can make similar comments about single-bit error correcting codes that we made
about single-bit error detection codes. That is, single-bit errors are not common in
data communications. One response to this information applies when there are many
data frames to send. We can create a Hamming code for each, visualize all the
Hamming codes as a two-dimensional bit array, and transmit the array one column
at a time. If a single burst error affects no more than one column, no more than one
bit in each row is destroyed. The receiver can determine the original data. The
second response is to generalize Hamming codes for double- or multiple-bit error

Figure 4.10 Bit Stream Before Transmission

Data: 0 1 1 0 0 1 1 1
m1 m2 m3 m4 m5 m6 m7 m8

Hamming code: 0 1 0 1 1 1 0 1 0 1 1 1
p1 p2 m1 p3 m2 m3 m4 p4 m5 m6 m7 m8
2942 | Ch 04 Page 246 Wednesday, February 16, 2000 3:28 PM

246 CHAPTER 4 DATA SECURITY AND INTEGRITY

different, unintelligible form is called encryption. The authorized receiver must be


able to understand the information, so he must be able to change the encrypted data
to its original form. We call this decryption. We also use the terms plaintext for the
original message and ciphertext for the encrypted one.
Figure 4.13 illustrates the process. The sender uses an encryption key (usually
some character or numeric constant) to change the plaintext (P) into a ciphertext (C).
We write this symbolically as C = Ek(P), where E and k represent the encryption
algorithm and key, respectively. If some unauthorized person gets C, its unintelli-
gible form makes it useless. Eventually the receiver gets C and decrypts it to get the
original message. We write this symbolically as P = Dk′ (C), where D and k′ repre-
sent the decryption algorithm and key. In general, P = Dk′(Ek(P)). Also, in many
cases (but not always) k = k′.
As usual, questions arise. How do the encryption and decryption algorithms
work? Is an encrypted message really unintelligible to an unauthorized receiver? If
an unauthorized receiver knows how the message was encrypted can she decrypt it?
Ideally an encrypted message should be impossible to decrypt without knowing the
decryption algorithm and key. Unfortunately, most completely secure codes are
analogous to unsinkable ships such as the Titanic: As soon as you are sure it is
secure someone will prove you wrong.

C AESAR C IPHER
One of the earliest and simplest codes replaces each plaintext character with another
character. The choice of a replacement depends only on the plaintext character. This
method is called a monoalphabetic cipher or Caesar cipher, reputedly dating back
to the days of Julius Caesar. For example, you might add 1 (the encryption key) to

Figure 4.12 Sending Unsecured Messages

Please add money to my bank


account #123456789.

Sender Receiver

Unauthorized Snooper
2942 | Ch 04 Page 249 Wednesday, February 16, 2000 3:28 PM

4.5 ENCRYPTION AND DECRYPTION 249

int encrypt(char P[], char C[], char V[26] [26]);


/* is the plain text*/
/* is the cipher text*/
/* is the Vigenere
` cipher key*/

{
int i, j;

for i = 0 to end of plaintext


{
j = P[i] - ’A’ ; /* relative position of P[i] in the alphabet */
C[i] = V[i % 26] [j]; /* % is the mod operator in C */
}
}

Figure 4.15 Encryption Algorithm for Vigenère Cipher

To replace a letter, let i be its relative position (first position is relative position
zero) in the message and j its relative position in the alphabet. Let V be the array.
Replace the letter with the one in V[(i mod 26), j]. Figure 4.15 shows a procedure
written in partial C code that does this, assuming the plaintext letters are all upper-
case.* For example, suppose the word THE appears three times in a message, begin-
ning in positions 25, 54, and 104. Table 4.3 shows the required calculations and the
substituted ciphertext letters. As the table shows, the three occurrences of the word
THE encrypt to SHF, VKI, and TIG.
The Vigenère cipher seems to solve the repetition problems, but in fact it has
only reduced them. Repetitions and patterns still occur. For example, the two

Figure 4.14 Key for Vigenère Cipher

row 0: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
row 1: B C D E F G H I J K L M N O P Q R S T U V W X Y Z A
row 2: C D E F G H I J K L M N O P Q R S T U V W X Y Z A B
row 3: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

row 24: Y Z A B C D E F G H I J K L M N O P Q R S T U V W X
row 25: Z A B C D E F G H I J K L M N O P Q R S T U V W X Y

*
It also assumes that the letters correspond to consecutive binary codes such as in the ASCII code.
2942 | Ch 04 Page 252 Wednesday, February 16, 2000 3:28 PM

252 CHAPTER 4 DATA SECURITY AND INTEGRITY

this is an indication that letter substitutions were probably not used and that this may
be a transposition cipher. The next step in breaking the code would be to group the
characters and store them in different columns. The receiver would not try column
arrangements randomly but would instead try arrangements that yielded commonly
used sequences such as THE, ING, or IS in a row. This process would reduce the
number of guesses greatly and provide a lot of help and information to the unautho-
rized but highly motivated receiver.

B IT -L EVEL C IPHERING
Not all transmissions are character sequences. Consequently, not all encryption
methods work by manipulating or substituting characters. Some work at the bit level.
One method defines the encryption key as a bit string. The choice is determined ran-
domly and secretly. The bit string to be transmitted is divided into substrings. The
length of each is the same as the length of the encryption key. Each substring is then
encrypted by computing the exclusive OR between it and the encryption key.
In this case the decryption does not reverse the encryption steps, as in previous
methods, but instead repeats them. In other words, to decrypt we compute the exclu-
sive OR between the encryption key and each of the encrypted substrings. Here, the
encryption and decryption keys are the same.
Figure 4.16 demonstrates that doing the exclusive OR operation twice produces
the original string. But does it always work this way? Yes! To see how, let pi be any
plaintext bit and ⊕ represent the exclusive OR operation. During the encryption/
decryption process pi is exclusively OR’d with either 0 or 1 twice. If it is 0 we have
( pi ⊕ 0 ) ⊕ 0 = ( pi ) ⊕ 0 = pi

If it is 1 we have
( pi ⊕ 1 ) ⊕ 1 = pi ⊕ ( 1 ⊕ 1 ) = pi ⊕ ( 0 ) = pi

Either way, performing the exclusive OR twice generates the original bit p1.
The security of this code depends largely on the length of the encryption key. A
short key means the original string is divided into many substrings with each
encrypted separately. With many substrings, there is a greater chance that repetitions
will occur. Since they are encrypted using the same key, the encrypted substrings are
also repeated. As before, the repetitions can help an unauthorized receiver trying to
break the code.

Figure 4.16 Encryption Using Exclusive OR Bit Operation

1101100101001 Plaintext
1001011001010 Encryption key
0100111100011 Ciphertext = plaintext exclusive-or'd with the encryption key
1001011001010 Decryption key (same as the encryption key)
1101100101001 Plaintext = ciphertext exclusive-or'd with the decryption key
2942 | Ch 04 Page 254 Wednesday, February 16, 2000 3:28 PM

254 CHAPTER 4 DATA SECURITY AND INTEGRITY

the fact that it is determined completely from R32. The algorithm also changes the 56-
bit key by dividing it in half and doing a circular bit-shift on each half. The number of
bits shifted depends on which of the 16 steps the algorithm is in. The point is that each
step uses a different key. After the shifts the key is transposed. The result is labeled K56.
Next, the algorithm does an exclusive OR operation between R48 and the first 48
bits of K56. The result is labeled X56. Next, X48 is divided into eight 6-bit groups (X6.)
Each 6-bit group goes through a substitution algorithm and is replaced by a 4-bit
group X4. The resulting eight 4-bit groups are then combined and subjected to
another transposition, giving another 32-bit group X32. The algorithm then does an
exclusive OR operation between this string and L32. Again, we call the result X32.
Finally, the algorithm creates a 64-bit string by using R32 as the first 32 bits and X32
as the last 32 bits.
Confusing? Well, it is supposed to be. IBM’s intent was not to design a method
everyone understands easily. The idea was to design a method that consists of many
convoluted steps and is virtually impossible to reproduce without prior knowledge
of the encryption key.

Figure 4.17 Outline of the DES

64-bit plaintext

transposition

encryption

16 steps, each using a


different 56-bit key
derived from the initial
key

encryption

swap

transposition

64-bit ciphertext
2942 | Ch 04 Page 255 Wednesday, February 16, 2000 3:28 PM

4.5 ENCRYPTION AND DECRYPTION 255

Figure 4.18 One of Sixteen Encryption Steps of the DES

R32 K56

C64 = 64 bits to be encrypted Expand to 48 bits by Do left circular shifts on each half
L32 = first 32 bits of C64 transposing some bits of the 56-bit string and do a
and duplicating others. transposition.
R32 = last 32 bits of C64
K56 = 56-bit key
R48 K56

Exclusive OR on 48 bits.

X48

Divide into eight


6-bits groups.

X6 X6 X6 X6 X6 X6 X6 X6

For each 6-bit group perform a substitution producing a 4-bit result.

X4 X4 X4 X4 X4 X4 X4 X4

Combine into a 32-bit string and do a transposition.

L32
X32

Exclusive OR.

R32
X32

Form a 64-bit number by using R32 as the


first 32 bits and X32 as the last 32 bits.

C64
2942 | Ch 04 Page 264 Wednesday, February 16, 2000 3:28 PM

264 CHAPTER 4 DATA SECURITY AND INTEGRITY

Such systems are called public key cryptosystems. Typical uses include a bank
receiving sensitive financial requests from many customers or a military command
center receiving reports from various locations. It also is being used in networking
software such as Novell’s NetWare 4.0.

RSA A LGORITHM
The RSA algorithm (named after its developers, Rivest, Shamir, and Adleman),
described in Reference [Ri78], uses modular arithmetic and the factorization of very
large numbers. The ciphertext is surprisingly easy to calculate and very difficult to
break, even when Ek is known. Some of the theory behind this algorithm is based in
mathematical number theory, specifically in notable results known as Fermat’s The-
orem and Euler’s Theorem. We won’t diverge into a discussion of number theory,
but if you have the inclination, Reference [St95a] summarizes some of the important
number theoretic results.
To describe how this method works, we consider messages consisting of capital
letters only. However, the method can be generalized to include a larger character
set. The following steps describe the RSA encryption algorithm and include an
example to illustrate the steps.
1. Assign a simple code to the letters, such as 1 through 26 for A through Z,
respectively.
2. Choose n to be the product of two large prime numbers p and q. (A prime
number has no factors except itself and 1.) In practice, a large prime number
consists of 200 or more digits. However, we will conserve space and energy by
using n = p × q = 11 × 7 = 77.

Figure 4.22 Multiple Senders Using the Same Encryption Method

A: Plaintext B: Plaintext

sender sender
Ek(A) is sent Ek(B) is sent

A = Dk'(Ek(A)) B = Dk'(Ek(B))

receiver
2942 | Ch 04 Page 268 Wednesday, February 16, 2000 3:28 PM

268 CHAPTER 4 DATA SECURITY AND INTEGRITY

a message

sender receiver

“Thanks for the


message.”

sender receiver

“What? I
never sent a
message.”

sender receiver

Figure 4.23 Sender Denying Sending a Message

P: Plaintext message to send Has P

sender receiver

Form M = Ej(Dk'(P)) Form Ek(Dj'(M)) = P

Transmit M

sender receiver

Figure 4.24 Sending a Message Using a Digital Signature

Suppose the sender wants to send an encrypted message and identify himself. If
P is the plaintext message, the sender calculates Ej(Dj′ (P)) and sends it.* The
receiver applies Dj′ to the message. Since Dj′ and Ej are inverse operations, the result
Dk′(P).† The receiver stores Dk′(P) in the event the sender eventually denies sending
2942 | Ch 04 Page 268 Wednesday, February 16, 2000 3:28 PM

268 CHAPTER 4 DATA SECURITY AND INTEGRITY

a message

sender receiver

“Thanks for the


message.”

sender receiver

“What? I
never sent a
message.”

sender receiver

Figure 4.23 Sender Denying Sending a Message

P: Plaintext message to send Has P

sender receiver

Form M = Ej(Dk'(P)) Form Ek(Dj'(M)) = P

Transmit M

sender receiver

Figure 4.24 Sending a Message Using a Digital Signature

Suppose the sender wants to send an encrypted message and identify himself. If
P is the plaintext message, the sender calculates Ej(Dj′ (P)) and sends it.* The
receiver applies Dj′ to the message. Since Dj′ and Ej are inverse operations, the result
Dk′(P).† The receiver stores Dk′(P) in the event the sender eventually denies sending
2942 | Ch 04 Page 276 Wednesday, February 16, 2000 3:28 PM

276 CHAPTER 4 DATA SECURITY AND INTEGRITY

Request to execute Request to execute


some process some process
branch
Process
code Process
code

Do
something
unusual Virus
branch

Memory
Memory
Uninfected software Infected software

Figure 4.26 Virus on an Executable File

I NFECTING F ILES
A virus is a collection of instructions attached to an executable file that does some-
thing the original executable file was not designed to do. On PCs, a virus commonly
attaches to a file with the .EXE or .COM extension. On a Macintosh, a file’s
resource fork typically is infected. When a virus attaches to a file, we say the file is
infected. Worms are a lot like viruses, but they usually appear as a separate pro-
gram. Like a virus, they are an intrusion to the system and are potentially damaging
to the system’s security.
Figure 4.26 shows one way to differentiate between an infected and an unin-
fected file. There are other ways and, if interested, you should consult References
[Sp90] and [Ka94]. The uninfected file contains executable code that runs when it is
referenced. In an infected file, however, the virus has placed a branch command to
the virus’s code. When the user calls on the infected file to do some task, the branch
command transfers control to the virus code first. The virus does its deed and exe-
cutes another branch to begin the requested task. As far as the user is concerned, the
requested task is done. Unless the virus performed an obvious task such as erasing
the hard disk, the user may not know the virus exists.
What is a virus capable of doing? Unfortunately, just about anything. A virus
may do “harmless” tasks such as displaying Christmas trees on your PC during the
holiday season.* It may be very destructive and erase your hard disk or destroy your

*
Some “harmless” viruses may actually do a great deal of harm, even if they do not explicitly destroy or
damage existing information. We will see a few examples shortly.
2942 | Ch 04 Page 277 Wednesday, February 16, 2000 3:28 PM

4.7 VIRUSES, WORMS, AND HACKERS 277

Running
virus

Look for executable files.


If found, duplicate and
attach to them.
File
System

Memory

= Executable file such as an .EXE or .COM file in PCs

Figure 4.27 Virus Duplicating Itself

file system. In these cases the effects usually can be minimized, but only if you have
backups! If not, you’re in serious trouble.
The worst viruses do not cause massive destruction immediately. Instead, they are
very subtle, making small (and usually unnoticeable) changes in files as they run. Over
a period of time the small changes compound and eventually are noticed. By that time,
the information has been corrupted. Worse yet, if you made backups diligently they
also may be infected. Restoring the uninfected versions of the files may be difficult.
How does the virus attach itself to an executable file? The first step is to bring
an infected file into your computer and run it. Once it runs, the attached virus can
infect files in different ways. For example, it might probe your file system looking
for other executable files (Figure 4.27). With a little knowledge of a file system this
is not difficult. Whenever it finds an executable file the virus can execute instructions
to duplicate itself and store the copy on the file, as in Figure 4.27.
Such viruses can be detected more easily than others. The process of seeking
executable files and changing them requires extra disk activity. Consequently, if you
notice a lot of disk activity when you do a simple task, be suspicious. On the other
hand, it’s very easy to be preoccupied with what you are doing and not even notice
the hardware. If the virus is subtle and infects only a few files, you may not notice
the extra activity, especially with a fast hard drive.

M EMORY -R ESIDENT V IRUSES


Rather than scanning the disk’s file system, the virus may copy itself into memory
and wait for an executable file to be stored in memory. When a file enters, the virus
2942 | Ch 04 Page 278 Wednesday, February 16, 2000 3:28 PM

278 CHAPTER 4 DATA SECURITY AND INTEGRITY

Interrupt
Table

Service
Routine

Memory
resident
virus

Branch

Memory

Figure 4.28 Memory-Resident Virus

attacks it. Picking the files off one by one as they enter memory is a much more
subtle type of attack—not unlike a sly predator hiding and waiting for its prey to
arrive unsuspecting, only to become the predator’s next meal.
But how does a memory-resident virus become activated? It is still a program
and cannot be activated until it is called. On PCs some viruses take advantage of
internal interrupt mechanisms. Typically BIOS and operating system service rou-
tines are located via an interrupt table or interrupt vector. The interrupt table is a
collection of addresses to service routines. When a user requires a service or when
some asynchronous event occurs that needs action, the operating system locates the
required service by finding its address in the table and begins executing the program
at that location. A memory-resident virus will change the interrupt table to create
addresses that locate the virus instead (Figure 4.28). Consequently, when an inter-
rupt occurs, the routine located via the table’s address is called. In this case, it is the
virus, which does its deed. As before, it may try to disguise what it did by calling the
intended service routine, making the user think everything is progressing normally.

V IRUS E VOLUTION
The history of the computer virus goes back to 1949, a time when most people did
not even know computers existed. John Von Neumann wrote a paper entitled
“Theory and Organization of Complicated Automata” describing a theory that com-
puter programs could in fact multiply. It outlined, in effect, the model for a computer
virus. Since the only computers then were just a few huge mainframes and the only
2942 | Ch 04 Page 283 Wednesday, February 16, 2000 3:28 PM

4.7 VIRUSES, WORMS, AND HACKERS 283

$10,000, and ordered to do 400 hours of community service [Mo90]. So much for
harmless worms! (Computer worms and viruses are federal crimes and in most cases
will be investigated by the FBI. Federal laws are stricter than most state laws.)
The worm itself was written in C and attacked UNIX systems through flaws in
the software. It used several techniques, each of which is described in Reference
[Sp89]. In one approach, it used a utility called fingerd that allows one user to
obtain information about other users. The fingerd program is designed to accept a
single line of input from a remote site (a request) and send back output corre-
sponding to the request (Figure 4.30). The flaw that was exploited was that the fin-
gerd program’s input command (the C language gets command) did not check for
buffer overflow. Consequently, a worm running on a remote machine could connect
to the fingerd program and send a specially constructed message that overflowed the
fingerd program input buffer.
Figure 4.31 shows what happened. The transmitted message overflowed the
input buffer and overwrote parts of the system stack. However, the stack contains a

Figure 4.30 The fingerd Utility

Site 1 Site 2
t1 Request connection to the fingerd
program at site 1.

fingerd connects and accepts a line of t2


input from a remote site.

fingerd produces output which it t3


sends to the remote site.
t4 Receive information sent by fingerd
utility

time

Figure 4.31 Intruding into the System

Invoke UNIX
shell. Return
address
Overflow into stack.
fingerd buffer

Stack
2942 | Ch 04 Page 283 Wednesday, February 16, 2000 3:28 PM

4.7 VIRUSES, WORMS, AND HACKERS 283

$10,000, and ordered to do 400 hours of community service [Mo90]. So much for
harmless worms! (Computer worms and viruses are federal crimes and in most cases
will be investigated by the FBI. Federal laws are stricter than most state laws.)
The worm itself was written in C and attacked UNIX systems through flaws in
the software. It used several techniques, each of which is described in Reference
[Sp89]. In one approach, it used a utility called fingerd that allows one user to
obtain information about other users. The fingerd program is designed to accept a
single line of input from a remote site (a request) and send back output corre-
sponding to the request (Figure 4.30). The flaw that was exploited was that the fin-
gerd program’s input command (the C language gets command) did not check for
buffer overflow. Consequently, a worm running on a remote machine could connect
to the fingerd program and send a specially constructed message that overflowed the
fingerd program input buffer.
Figure 4.31 shows what happened. The transmitted message overflowed the
input buffer and overwrote parts of the system stack. However, the stack contains a

Figure 4.30 The fingerd Utility

Site 1 Site 2
t1 Request connection to the fingerd
program at site 1.

fingerd connects and accepts a line of t2


input from a remote site.

fingerd produces output which it t3


sends to the remote site.
t4 Receive information sent by fingerd
utility

time

Figure 4.31 Intruding into the System

Invoke UNIX
shell. Return
address
Overflow into stack.
fingerd buffer

Stack
2942 | Ch 05 Page 295 Wednesday, February 16, 2000 3:30 PM

5.2 BASIC FLOW CONTROL 295

The final two sections take a practical approach and discuss actual protocols in
use today. Section 5.5 discusses data link protocols such as High-level Data Link
Control (HDLC) and binary synchronous communications (BSC). Section 5.6 dis-
cusses Kermit, a common file transfer protocol.

5.2 BASIC FLOW CONTROL

S IGNALING
This section introduces relatively elementary approaches to flow control useful in
simple communications systems. The first approach, signaling, is straightforward
(Figure 5.1). The sender transmits data as long as the receiver is able to receive it.
The receiver may not be able to receive data all the time, however. For example, the
buffers that hold received data may be filling up, or the receiver may not be ready if
it is doing other things. In such cases, the receiver sends a signal to the sender. On
receipt of the signal, the sender stops transmitting. The protocol also allows for
another signal to be sent when the receiver is again ready to receive more data. This
approach is analogous to a nonproductive argument in which one person says,
“Stop! I don’t want to hear any more.”

Figure 5.1 Flow Control Using Signaling

I have room in my buffers


so I will accept data.

xxxxx.....xxx
data stream

Sender Receiver
My buffers are filling up,
please stop sending.
signal

xxxxx.....xxx
data stream
Sender Receiver
I have received your signal
and I will not send anything
until I receive another
signal.
signal

Sender Receiver
2942 | Ch 05 Page 296 Wednesday, February 16, 2000 3:30 PM

296 CHAPTER 5 PROTOCOL CONCEPTS

DTE-DCE Flow Control Section 3.2 discussed one way to signal readiness to
send and receive data over an RS-232 interface. It involved sending signals over
specified lines (DTR and DSR) to indicate a state of readiness. When the DTE
wanted to send to the DCE, it sent another signal (RTS) requesting to send. It then
waited for a Clear to Send signal (CTS) before transmitting. The details are in Sec-
tion 3.2 so we won’t rehash old material here.

X-ON/X-OFF The RS-232 interface was complex in that it required separate


lines for separate signals. Another approach is to send the signal as part of the trans-
mitted data. This is called inband signaling. In this case, the receiver has to analyze
the incoming data looking for any special signals to which it must respond.
The ASCII character set defines two control characters for flow control (see Table
2.4 in Section 2.3). Symbolically, they are DC3 (ASCII code 19) and DC1 (ASCII
code 17), also called X-OFF and X-ON, respectively.* They are commonly used for
flow control between a terminal and mainframe. Figure 5.2 shows how this works.
The figure assumes full-duplex communications, so there is no distinction
between a sender and receiver. Stations A and B both send to and receive from each
other. If A’s buffers are starting to fill up it can respond by inserting the X-OFF char-
acter into the data it is sending to B. When the X-OFF character arrives, B sees it and
stops transmitting its data to A. (Note, however, that A is still sending to B.) If A has
more room in the buffers later, A can send the X-ON character to B, which signals B
that it is permissible to resume transmitting.
When one station sends the X-OFF character, it continues to receive data for a
short time because of the small delay between the time the X-OFF character is sent
and the time the other station can respond to it. Consequently, a station usually will
send when data in its buffers exceeds some threshold value.
Your first exposure to this protocol may have been by accident. For example, a
common activity in a programming class is to list text files on the screen. Occasion-

Figure 5.2 Flow Control Using Inband Signaling

yyyyy.....yyy

x X-OFF x.....xxx
Station A Station B

X-OFF character (ASCII code


DC3). When B gets it, B will stop
transmitting.

*
They also correspond to the control-S and control-Q keyboard sequences.
2942 | Ch 05 Page 298 Wednesday, February 16, 2000 3:30 PM

298 CHAPTER 5 PROTOCOL CONCEPTS

Typically, the sender, receiver, and patrons of Figure 5.3 define consecutive
layers in some communications software. This is typical of the interaction between
the data link (sender and receiver) and network layer (patron) in the OSI model.
Flow control also exists in higher-layer protocols such as TCP/IP and is part of
IBM’s SNA architecture. (We describe each of these later in this book.) At this
point, where the sender, receiver, and patron exist is not important. Flow control
exists in different models and in different layers. However, it is important to realize
that flow control typically is part of the interaction between two consecutive layers
in some protocol.

Unrestricted Protocol The easiest protocol, unrestricted protocol, assumes the


receiver either has an unlimited capacity to receive frames or processes them fast
enough so that buffer space is always available. Figure 5.4 shows the sender and
receiver logic written in partial C code.* The sender and receiver use the primitive
calls send and receive. Typically, they are calls to a layer below the sender and
receiver that take care of details required to transmit the frame or retrieve it.
The sender executes a loop repeatedly as long as there is information to send.
With each pass of the loop it gets a packet from its patron, puts it into a frame, and
sends the frame. It sends frames repeatedly and makes no effort to limit the number

Figure 5.3 Sending and Receiving between Patrons

Patron retrieves Patron stores


information. information.
information information

Patron Patron
Sender gets packet from Receiver extracts packet
the patron and puts from frame and gives the
it in a frame. data to the patron.

Sender Receiver

Send data one frame Receive data one frame


at a time. at a time.

Transmission medium or channel

*
We make no attempt to write syntactically correct code. We will combine C syntax with informal
statements to convey the program’s meaning without a lot of language detail. A good exercise is to
modify all the protocols we discuss into syntactically and logically correct programs.
2942 | Ch 05 Page 299 Wednesday, February 16, 2000 3:30 PM

5.2 BASIC FLOW CONTROL 299

void send_data; void receive_data;


{ {
while there are packets to send while there are frames to receive
{ {
get packet from the patron; wait for frame to arrive;
put packet into a frame; receive(frame);
send(frame); Extract packet from the frame;
} Give packet to the patron;
} }
}
Sender code Receiver code

Figure 5.4 Unrestricted Flow Control

it sends. The receiver also executes a loop repeatedly. We assume the receiver is
always capable of receiving a frame. With each pass through the loop, the receiver
waits (i.e., exists in a suspended or wait state) until a frame arrives. The arrival
causes the receiver to wake up and receive the frame. It extracts the packet and
passes it to its patron and then goes back into a wait state until another frame arrives.
This approach does not consider any of the problems we have discussed previ-
ously. There is no attempt to check for damaged, lost, or delayed frames or to con-
trol the number of frames sent. It assumes that every frame will arrive without
damage and in the order sent. It is much like our dependence on the Post Office
when we mail letters.

Stop and Wait Protocol This protocol differs from the previous one in two ways.
First, every time the receiver gets a frame it sends an acknowledgment back to the
sender. The acknowledgment is another frame specifying whether the received
frame was damaged. Second, after sending a frame the sender waits for an acknowl-
edgment before sending another frame. Thus rather than sending all the frames in
rapid sequence, this protocol sends one, waits for an acknowledgment, sends
another, waits for an acknowledgment, and so on. We call this the stop and wait
protocol. In some ways it represents the opposite extreme of the previous method.
Whereas the unrestricted protocol sent the maximum number of frames per unit of
time, this one sends the minimum number.
Figure 5.5 outlines the sender’s and receiver’s protocol. The receiver protocol is
similar to the unrestricted one. It consists of an infinite loop in which it waits for a
frame to arrive. When a frame arrives, the receiver checks it for damage. Whether it
uses CRC or some form of parity checking discussed in Chapter 4 is not relevant at
this level of the discussion. The important thing is that it can detect a damaged
frame.
If the frame was not damaged, the receiver defines an error field in a record
structure called ack as 0. It proceeds to extract the packet from the frame and give it
to the patron. If the frame was damaged the error field of ack is set to 1. It does not
2942 | Ch 05 Page 300 Wednesday, February 16, 2000 3:30 PM

300 CHAPTER 5 PROTOCOL CONCEPTS

void send_data; void receive_data;


{ {
damaged=0; while there are packets to receive
while there are packets to send {
{ Wait for frame to arrive;
if (!damaged) receive(frame);
/* !0 is the same as true in C */ Examine frame for transmission error;
{ if no transmission error
Get packet from the patron; {
Put packet into a frame; ack.error=0;
} Extract packet from the frame;
send(frame); Give packet to the patron;
Wait for acknowledgment to arrive; }
receive(ack); else
if ack.error ack.error=1;
damaged=1; send(ack);
else }
damaged=0; }
}
}
Sender code Receiver code

Figure 5.5 Stop and Wait Flow Control

extract a packet from the frame and the patron gets nothing. In any case, the receiver
sends the acknowledgment back to the sender. Since the error field specifies the
status of the received frame, the sender can respond accordingly.
The sender executes a loop repeatedly, sending frames and waiting for
acknowledgments. Prior to sending a frame, the sender must decide whether it
should send a new one or resend the old one. It does this through a local variable
called damaged whose value indicates the status of the most recently sent frame (1
means the frame was damaged; 0 means it was not). Initially, it is 0. At the
beginning of the loop, the sender checks damaged. If it is 0, the sender gets a new
packet from the patron, puts it into a frame, and sends it. If damaged is 1, the
sender sends the current frame (the one it sent earlier). Either way, it waits for an
acknowledgment after sending the frame. When the acknowledgment arrives, the
sender checks the error field, which the receiver defined. If the error field indi-
cates the previous frame was damaged, the sender defines damaged = 1. Thus, the
next time through the loop, the sender does not get new data from the patron but
resends the frame. If damaged = 0, the sender gets a new packet in the next pass
and sends it.
As we have described it, stop and wait seems preferable to the unrestricted pro-
tocol. Still, it has some shortcomings:
2942 | Ch 05 Page 302 Wednesday, February 16, 2000 3:30 PM

302 CHAPTER 5 PROTOCOL CONCEPTS

We begin by determining the amount of time needed to construct and send a frame
(Figure 5.6). Assume the sender begins at time zero. The sender will have gotten
information and put it into a frame at time T. The next step is to transmit the frame
(put its bits on the channel). Since R is the data rate, then 1/R is the time needed to
transmit one bit. Therefore, F/R is the time needed to transmit one frame. The total
time used so far is T + F/R.
Once the sender has transmitted the frame, the bits require time to travel
through the channel to the receiver. The travel time is D/S. Thus, after the last bit is
transmitted, it requires another D/S time units to reach the receiver. Therefore, the
receiver receives the last bit at time = T + F/R + D/S. Note that the amount of time a
frame is in transit is F/R + D/S.
For the stop and wait protocol the receiver must send an acknowledgment. A
similar argument shows that the time required for the sender to receive the acknowl-
edgment is T + A/R + D/S.*
Next question: How much time elapses between sending two data frames? With
the unrestricted protocol, the sender starts building the next frame as soon as it has
transmitted the last bit from the previous one. With stop and wait, the sender must
wait for each acknowledgment. Therefore, the elapsed time between sending two
consecutive frames is
F
time = T + --- for the unrestricted protocol (5.1)
R
and

time =  T + --- + ---- +  T + --- + ----


F D A D
 R S  R S
(5.2)
= 2  T + ---- + -------------- for the stop and wait protocol
D F+A
 S R

Figure 5.6 Time Required to Send a Frame to a Receiver

Create Put frame bits Time for the last


one onto the bit to travel from
frame. medium. sender to receiver.
time
0 T FF FF DD
TT ++ ---
---
RR
+ ------++------
T+ --
RR SS

*
Strictly speaking, the amount of time needed for the receiver to construct the acknowledgment frame is
different from T. However, specifics depend on CPU speed, efficiency of compiled code, and software
scheduling. To simplify matters, we just assume both the sender and receiver can construct a frame in
the same amount of time.
2942 | Ch 05 Page 305 Wednesday, February 16, 2000 3:30 PM

5.3 SLIDING WINDOW PROTOCOLS 305

Frame number

All frames before the window must


have been acknowledged.
w–1
w

Window slides down as


Frames in this window can frames are acknowledged
be outstanding. and new ones are sent.

w+i–1
w+i
No frame beyond the window may be
sent until the window slides down.

Sender’s frames

Figure 5.7 A Sliding Window Protocol

Initially, the window contains frames starting with frame 0. As the patron pro-
vides packets, the window expands to include new frames, which then are sent. A
limit on the window’s size, however, limits the number of outstanding frames. When
the limit is reached, the sender takes no more packets from the patron. As out-
standing frames are acknowledged, the window shrinks to exclude acknowledged
frames. Subsequent to this the window can expand again to include more new
frames to send.
As the window changes, the previous conditions must always be met and the
window must always contain frames numbered consecutively. For example, if frame
w + 1 is acknowledged but frame w is not, the window will not change until frame w
is acknowledged. Even if every frame was acknowledged except frame w, the
window will not change. Frames are excluded from the window in the same order in
which they were included.
This approach is a compromise because it allows multiple (but not necessarily
all) frames to be sent before receiving acknowledgments for each. The maximum
window size defines the number of frames that may be outstanding. If the window
size is 1, we have essentially the stop and wait protocol. If the window size is greater
than the total number of frames, we have essentially the unrestricted protocol.
Adjusting the window size can help control the traffic on a network and change the
buffering requirements.
There are two common implementations of a sliding window protocol. The
go-back-n protocol requires frames to be received in the same order they are
2942 | Ch 05 Page 306 Wednesday, February 16, 2000 3:30 PM

306 CHAPTER 5 PROTOCOL CONCEPTS

sent.* The selective repeat protocol does not. Go-back-n is simpler as the receiver
rejects every frame except the one it is supposed to receive. Selective repeat
requires the receiver to be able to hold onto frames received out of order before
passing them on to a higher layer in the correct order.

F RAME F ORMAT
With these protocols we drop a previous assumption and eliminate the sharp distinc-
tion between sender and receiver. That is, we assume a more realistic model in
which two stations (A and B) are sending to (and receiving from) each other (Figure
5.8). This is a conversational or full-duplex mode of communication. Thus the pro-
tocol must be able to not only send frames but receive them as well.
Let’s review briefly what a frame actually contains. Figure 5.9 shows typical
fields. We will see some specific formats in Sections 5.5 and 5.6. The frame fields
are as follows:
• Source address. This is the address of the station sending the frame. It is
often needed so that a station receiving a frame knows where to send an
acknowledgment.
• Destination address. This is the address where the frame should be sent. It is
needed so that a station can determine which frames are destined for it.
• Frame number. Each frame has a sequence number starting with 0. If this field
has K bits, the largest number is 2K – 1. More than 2K frames causes complica-
tions, which we discuss shortly.

Figure 5.8 Two-Way Communication between Stations A and B

Sending data and acknowledgments

Sending data and acknowledgments


Station A Station B

Figure 5.9 Typical Frame Format

Source Destination Number ACK Type ...Data... CRC

*
The reason frames can arrive out of order varies. It is a lot like the Post Office. The letter you mailed on
Monday will probably arrive before the one you mail on Tuesday, but don’t bet your retirement pension
on it. Heavy traffic, hardware or software failures, and damaged frames can all contribute to delaying or
even losing a frame.
2942 | Ch 05 Page 306 Wednesday, February 16, 2000 3:30 PM

306 CHAPTER 5 PROTOCOL CONCEPTS

sent.* The selective repeat protocol does not. Go-back-n is simpler as the receiver
rejects every frame except the one it is supposed to receive. Selective repeat
requires the receiver to be able to hold onto frames received out of order before
passing them on to a higher layer in the correct order.

F RAME F ORMAT
With these protocols we drop a previous assumption and eliminate the sharp distinc-
tion between sender and receiver. That is, we assume a more realistic model in
which two stations (A and B) are sending to (and receiving from) each other (Figure
5.8). This is a conversational or full-duplex mode of communication. Thus the pro-
tocol must be able to not only send frames but receive them as well.
Let’s review briefly what a frame actually contains. Figure 5.9 shows typical
fields. We will see some specific formats in Sections 5.5 and 5.6. The frame fields
are as follows:
• Source address. This is the address of the station sending the frame. It is
often needed so that a station receiving a frame knows where to send an
acknowledgment.
• Destination address. This is the address where the frame should be sent. It is
needed so that a station can determine which frames are destined for it.
• Frame number. Each frame has a sequence number starting with 0. If this field
has K bits, the largest number is 2K – 1. More than 2K frames causes complica-
tions, which we discuss shortly.

Figure 5.8 Two-Way Communication between Stations A and B

Sending data and acknowledgments

Sending data and acknowledgments


Station A Station B

Figure 5.9 Typical Frame Format

Source Destination Number ACK Type ...Data... CRC

*
The reason frames can arrive out of order varies. It is a lot like the Post Office. The letter you mailed on
Monday will probably arrive before the one you mail on Tuesday, but don’t bet your retirement pension
on it. Heavy traffic, hardware or software failures, and damaged frames can all contribute to delaying or
even losing a frame.
2942 | Ch 05 Page 309 Wednesday, February 16, 2000 3:30 PM

5.3 SLIDING WINDOW PROTOCOLS 309

Station A Station B

Send frames 0 t1
through 7.

Receive frames 0 through


t2 7 in order and send an
acknowledgment for frame 7.

The piggyback
acknowledgment gets
delayed somewhere.

Assume the frames


were lost and resend t3
frames 0 through 7. Receive frames 0 through 7.
Since the receiver was
expecting these numbers, it
t4
accepts them as new frames,
not recognizing them as
duplicates.

time time

Figure 5.10 Protocol Failure When Window Size Equals 2K

Assume both stations have been exchanging frames prior to time t1. At time t1 station
A sends frames 0 through 7 to station B. Station B receives each of them in the correct
order and at time t2 sends an acknowledgment for the most recent one received,
number 7. Unfortunately, this acknowledgment gets lost because of a hardware or
software error somewhere or a hungry gremlin with a voracious appetite for frames.
Station B has no way of knowing the acknowledgment was lost and is waiting
for the frame after frame 7 (frame 0). Station A, on the other hand, does not receive
the acknowledgment and does not know whether the frames arrived or not. Fol-
lowing the protocol, it resends frames 0 through 7 at time t3. At time t4 station B
receives frame 0. The problem is that this frame 0 is a duplicate of the previous
frame 0. But station B is expecting a new frame 0 and has no way of knowing it has
received a duplicate. It therefore accepts the duplicate as a new frame, and the pro-
tocol fails.
The problem occurs because two consecutive windows contain the same frame
numbers. Station B had no way of knowing which window frame 0 was in. Reducing
the window size by 1 corrects this problem. Figure 5.11 shows what happens if sim-
ilar events happen with the reduced window size. Here, station A sends frames 0
through 6 at time t1 and station B receives them all. At time t2 station B acknowledges
2942 | Ch 05 Page 310 Wednesday, February 16, 2000 3:30 PM

310 CHAPTER 5 PROTOCOL CONCEPTS

Station A Station B

Send frames 0
through 6. t1

Receive frames 0 through


t2 6 in order and send an
acknowledgment for frame 6.

The piggyback
acknowledgment gets
delayed somewhere.

Assume the frames


were lost and resend t3
frames 0 through 6.

Receive frames 0 through 6.


t4 Since the receiver was
expecting frame 7
it ignores them.

time time

Figure 5.11 Protocol Success When Window Size Equals 2K – 1

frame 6 and the acknowledgment gets lost. The difference now is that station B is
expecting to receive frame 7. When station A resends frames 0 through 6 (at time t3),
they arrive at B at time t4. Since they are not what B is expecting, B ignores them.
Eventually B sends another acknowledgment, which A receives (we hope).* Station A
advances its window to include frame 7 and the protocol continues. From this, we
conclude that the window size must be strictly less than 2K or the go-back-n protocol
can fail.
We are finally ready to present a more detailed description of the go-back-n pro-
tocol. Figure 5.12 shows a partially coded C program containing the logic and vari-
able names. Figure 5.7 should also help you understand the use of protocol variables
w and i. As before, we make no attempt to be syntactically correct or worry about
whether the code compiles correctly. The intent is to describe how the protocol

*
We have not yet explained how we know B sends another acknowledgment. When we discuss specifics
of the algorithm we will describe how the protocol guarantees the acknowledgment.
2942 | Ch 05 Page 311 Wednesday, February 16, 2000 3:30 PM

5.3 SLIDING WINDOW PROTOCOLS 311

#define MAX=2K; /* K = number of bits in the


frame.number field */
#define N=MAX–1; /* N is the maximum window size and largest frame
number */
#define increment(x) x=(x+1) % MAX; /* Increment x modulo MAX */
void go_back_N;
{
int w=0; /* First position in the window */
int i=0; /* Current size of window */
int last=N; /* Frame number of last data frame received */
packettype buffer[MAX]; /* Packet buffers */
while (the earth rotates on its axis)
{
wait for an event;
if (event is "packet from patron") && (i<N)
{ /* If frame fits in the window, send it */
get packet from the patron and store in buffer[(w+i) % MAX] ;
construct frame with frame.ack=last, frame.type=data, and frame.number=(w+i) % MAX;
send frame;
reset frametimer(frame.number); /* Define timer for expected ACK of this frame*/
stop acktimer; /* Stop ACK timer since an ACK is piggybacked */
i++; /* Increase window size by 1 */
continue; /* Skip to the end of the while loop */
}
if (event is "expired acktimer")
{ /* No frames have been sent in a while. Send a
special ACK frame */
Construct and send a frame with frame.type=ack and frame.ack=last;
continue;
}
if (event is "expired frametimer")
{ /* Have not received an ACK in a while; resend all
frames in the window */
for (j=w; j is “between” w and (w+i-1) % MAX; increment(j) )
{
construct and send a data frame as before with packet from buffer[j];
reset frametimer(j); /* Start timer for expected ACK of this frame*
}
stop acktimer; /* Stop ACK timer; an ACK is piggybacked */
continue;
}
if (event is "damaged frame arrives")
{

Figure 5.12 Go-back-n Protocol (continues on next page)


2942 | Ch 05 Page 312 Wednesday, February 16, 2000 3:30 PM

312 CHAPTER 5 PROTOCOL CONCEPTS

Construct a frame with frame.type=nak and frame.ack=last and send it;


stop acktimer; /* Stop ACK timer; an ACK is being sent */
continue;
}
if (event is "undamaged frame arrives")
{ /* Remove all frames “between” w and frame.ack
from window */
receive(frame);
for (j=w; j is “between” w and frame.ack; increment(j) )
{
i--;
stop frametimer(j); /* Stop frame timer; the ACK has been received */
}
w=(frame.ack+1) % MAX;
if (frame.type==data) && (frame.number==((last+1) % MAX))
{ /* If data frame is received in sequence, pass it to
the patron */
/* Ignore any frame received out of sequence */
increment(last);
extract packet from the frame and give it to the patron;
if acktimer not active then
reset acktimer; /* Start ACK timer for the frame being accepted */
continue;
}
if (frame.type == nak)
{ /* resend all buffered packets */
for (j=w; j is “between” w and (w+i-1) % MAX; increment(j) )
{
construct and send a data frame as before with packet from buffer[j];
reset frametimer(j); /* Start timer for expected ACK of this frame*/
}
stop acktimer; /* Stop ACK timer; an ACK is piggybacked */
continue;
}
if (frame.type==data) && (frame.number!=(last+1) % MAX)
{ /* Send a NAK for the frame that was expected */
construct and send a frame with the frame.type=nak and frame.ack=last;
stop acktimer; /* Stop ACK timer; an ACK is piggybacked */
}
} /* end of “undamaged frame arrives” event */
} /* end of while loop */
} /* end of go_back_N */

Figure 5.12 (continued)


2942 | Ch 05 Page 315 Wednesday, February 16, 2000 3:30 PM

5.3 SLIDING WINDOW PROTOCOLS 315

all arrive? This question is answered by another sliding window protocol called
selective repeat.
The selective repeat protocol is similar to go-back-n in the following ways:
• Frame formats are similar and frames are numbered using a K-bit field
(Figure 5.9).
• The sender has a window defining the maximum number of outstanding frames.
• It uses piggybacked acknowledgments where possible and does not acknowl-
edge every frame explicitly. If a frame is acknowledged, the sending station
assumes that all prior ones have also been received.
• The protocol uses NAKs for damaged frames and frames received out of order.
• It uses timers to send special acknowledgment frames during periods of low
traffic and to resend frames that have not been acknowledged for a while.
The similarities end here. Probably the most apparent difference is that the
selective repeat protocol defines two windows, one each for the sending and
receiving parts of the protocol (Figure 5.13). Thus, each station using a selective
repeat protocol has both a sending and a receiving window. The sending window is
the same as for the go-back-n protocol. It defines which frames may be outstanding.
The receiving window defines which frames can be received. As with the
sending window, frames in the receiving window are numbered consecutively
(modulo 2K, where K = number of bits used for the frame number). Thus, the
receiving station is not required to receive frames in order. A frame arriving out of
order can be received as long as it is in the window. However, you will recall that

Figure 5.13 Sending and Receiving Windows for Selective Repeat Protocol

Frame numbers Frame numbers

sw rw

Receiving window—
Sending any frame in this
window window may be
accepted.
sw + i – 1 rw + N – 1
Window Window advances as
sw + i rw + N
advances as frames are received.
frames are
acknowledged.
Outgoing frames Incoming frames
2942 | Ch 05 Page 317 Wednesday, February 16, 2000 3:30 PM

5.3 SLIDING WINDOW PROTOCOLS 317

Station A Station B
Send frames 0
t1
through 3.
Receive frames 0 through 3;
t2 advance window to include
frames 4, 5, 6, 7, and 0.

The acknowledgment
gets lost.

Assume the frames


were lost and resend t3
frames 0 through 3.
Receive frame 0 and
t4 assume incorrectly
it is a new frame.

time time

Figure 5.14 Protocol Failure: Receiving Window Size Is Greater Than 2K–1

At time t1 station A sends the maximum number of frames, frames 0 through 3.


Since station B has a window size of 5, it can accept any frame numbered between 0
and 4, inclusive. At time t2, B receives frames 0 through 3. Since they are in the
window, they are accepted and passed to the patron. B then advances its window to
include frames 4, 5, 6, 7, and 0.
Meanwhile, the acknowledgment that B sends is lost. Eventually A gets tired of
waiting and assumes something went wrong. Consequently, as dictated by the pro-
tocol, A resends frames 0 through 3 (time t3). Since frame 0 is in the receiving
window, B accepts it (time t4), not realizing it is a duplicate of the previous frame 0.
The protocol fails.
Similar problems can occur if the receiving window size meets the constraint
but the sending window does not. For example, suppose this time that A’s window
size is 5 and B’s window size is 4 (Figure 5.15). At time t1, A sends frames 0 through
4. Since B’s window size is 4 it can accept only frames 0 through 3. But suppose
frame 4 was delayed because it met an attractive frame going the other way and “did
lunch” before arriving. Meanwhile frames 0 through 3 arrive and are accepted (time
t2). B advances its window to include frames 4 through 7.
When frame 4 eventually arrives, it is within the new window and is accepted.
The window advances again and now includes frames 5, 6, 7, and 0. At this point B
sends something to A with the acknowledgments piggybacked. The same mysterious
gremlin that ate the previous acknowledgments is insatiable and gets another one.
Again, A gets tired of waiting and resends frames 0 through 4 (time t3). The frames
2942 | Ch 05 Page 318 Wednesday, February 16, 2000 3:30 PM

318 CHAPTER 5 PROTOCOL CONCEPTS

Station A Station B

Send frames 0
through 4. t1
Receive frames 0 through 3 and
advance window to include frames
4 through 7. Receive frame 4 and
t2
send an acknowledgment to A.
Advance window again to include
frames 5, 6, 7, and 0.

The acknowledgments
get lost.

Assume the frames


were lost and resend t3
frames 0 through 4.

Receive frame 0
t4 and assume incorrectly
it is a new frame.

time time

Figure 5.15 Protocol Failure: Sending Window Size Is Greater Than 2K–1

finally get through (the gremlin is resting from its lunch) and since frame 0 is within
the receiving window, it is accepted (time t4). Again, B does not recognize that it is a
duplicate of the previous frame 0, and the protocol fails.
Each of these problems can be corrected by making both window sizes equal to
4. In fact, these problems could have been eliminated by using window sizes of 5
and 3 instead of 5 and 4 (or 3 and 5 instead of 4 and 5). The problem occurs when
the receiving window advances to the point of including new frame numbers still in
the sending window. This can happen when the two sizes sum to a value larger than
2K (the number of distinct frame numbers). By reducing the window sizes so that
this won’t happen we eliminate that type of problem. Typically, the window sizes are
the same (2K–1).
Figure 5.16 contains a partially C-coded algorithm for the selective repeat pro-
tocol. It is designed similarly to the go-back-n protocol in that it loops continu-
ously, responding to events as they occur. Both sending and receiving windows
have size N = 2K–1.
The algorithm has a few additional variables that the go-back-n algorithm does
not have. In addition to the sending buffer (sbuffer) there is a receiving buffer
(rbuffer). Since each window size is N, both buffers are defined as packet arrays with
N elements. This generates another difference from the go-back-n algorithm. With
2942 | Ch 05 Page 319 Wednesday, February 16, 2000 3:30 PM

5.3 SLIDING WINDOW PROTOCOLS 319

#define MAX=2K; /* K = number of bits in the frame.number field */


#define N=MAX/2; /* N = maximum sending window size, actual receiving window
size, and number of buffers */
#define increment(x) x=(x+1) % MAX; /* Increment x modulo N */
#define prior(x) (x==0 ? MAX-1 : x-1) /* Return integer prior to x modulo N */
void selective_repeat;
{
int frame_no=0; /* Maintain frame numbers of outgoing frames */
int sw=0; /* First position in sender’s window */
int rw=0; /* First position in receiver’s window */
int i=0; /* Current size of sender’s window */
packettype sbuffer[N]; /* Sender’s packet buffers */
packettype rbuffer[N]; /* Receiver’s packet buffers */
int status[N]; /* Status of frame in receiving window. 1 means it arrived;
0 means it has not */
while (Hades does not freeze over)
{
wait for an event;
if (event is "packet from patron") && (i<N)
{ /* If frame fits in window, send it */
Get packet from the patron and store it in sbuffer[(sw+i) % N];
construct frame with frame.ack=prior(rw), frame.type=data, and frame.number=frame_no;
send frame;
increment(frame_no); /* Define number of next outgoing frame */
reset frametimer(frame.number); /* Start timer for expected ACK of this frame */
stop acktimer; /* Stop ACK timer; an ACK is piggybacked */
i++; /* Increase sending window size by 1 */
continue; /* Skip to the end of the while loop */
}
if (event is "expired acktimer")
{ /* No frames have been sent in a while. Send a special
ACK frame */
Construct and send a frame with frame.type=ack and frame.ack=prior(rw);
continue;
}
if (event is "expired frametimer")
{ /* Have not received an ACK in a while; resend frame */
fn = frame number corresponding to the timer;
construct and send as before a data frame with packet from sbuffer[fn % N];
reset frametimer(fn); /* Start timer for expected ACK of this frame */
stop acktimer; /* Stop ACK timer; an ACK is being sent */
continue;
}
if (event is "damaged frame arrives")

Figure 5.16 Selective Repeat Protocol (continues on next page)


2942 | Ch 05 Page 320 Wednesday, February 16, 2000 3:30 PM

320 CHAPTER 5 PROTOCOL CONCEPTS

{
Construct a frame with frame.type=nak and with frame.ack=prior(rw); send it;
stop acktimer; /* Stop ACK timer; an ACK is being sent */
continue;
}
if (event is "undamaged frame arrives")
{ /* Remove all frames “between” sw and frame.ack from
sender’s window */
receive(frame);
for (j=sw; j is “between” sw and frame.ack; increment(j) )
{
i--;
stop frametimer(j); /* Stop frame timer; the ACK has been received */
}
sw=(frame.ack+1) % MAX;
if (frame.type==data) && (frame.number != rw)
{
construct a frame with frame.type=nak and frame.ack=prior(rw) and send it;
stop acktimer; /* Stop ACK timer; an ACK is being sent */
}
if (frame.type==data) && (frame.number is in the receiving window) && (status[frame.number % N]==0)
{ /* If data frame is in the window and has not yet arrived,
buffer it */
extract packet from the frame and put in rbuffer[frame.number % N];
status[frame.number % N]=1;
for(;status[rw % N]==1; increment(rw) )
{ /* Give received packets stored in consecutive window
slots to the patron */
extract packet from rbuffer[rw % N] and give to patron;
status[rw % N]=0;
}
reset acktimer; /* Start ACK timer for frames being accepted */
}
if (frame.type == nak) && ( framenum = (frame.ack+1) % MAX is in the sending window)
{ /* Resend the frame the receiving station expected to
receive */
construct and send a frame with packet from sbuffer[framenum % N];
reset frametimer(framenum % N); /* Start timer for expected ACK of this frame */
stop acktimer; /* Stop ACK timer; an ACK is being piggybacked */
continue;
}
}
}
}

Figure 5.16 (continued)


2942 | Ch 05 Page 323 Wednesday, February 16, 2000 3:30 PM

5.3 SLIDING WINDOW PROTOCOLS 323

are sent. Once this happens, and assuming there are no delays at the other end, the
sender never has to wait for an acknowledgment. In other words, old frames are
removed from the window as fast as new ones are added to it. In effect, the sending
protocol behaves just like the unrestricted protocol.
In the second case, when all W frames have been sent and the first acknowledg-
ment has not yet arrived (Figure 5.17), the protocol must wait for it. When it does
arrive the protocol then can send the next frame. If the acknowledgments arrive at
the same rate that data frames are sent, W more frames are sent before the protocol
must wait again. In other words, the protocol sends W frames, waits for the first
acknowledgment, sends W more frames, waits for an acknowledgment, and so on.
This protocol now resembles stop and wait. However, instead of sending and waiting
for individual frames, it sends and waits for a window full of frames.
Mathematically, these two cases can be distinguished by comparing the time to
send W frames with the time to send one frame and receive an acknowledgment.
From Equation 5.1, the time to build and send one frame is T + F/R. Thus, the time
to build and send W frames is W × (T + F/R). From Equation 5.2, the time to send a

Figure 5.17 Sending All Windowed Frames and Waiting

Build frame

Send frame frame


Build frame
W Send frame frame
frames
sent

 DD  + (------------------
F( F++AA )
-)
time 2=∗ 2T T++---
----
- + ------------------
RR -
Build frame Build ACK
 S S 
Send frame frame ACK Send ACK

Build ACK
Wait ACK Send ACK

Begin sending W Build ACK


more frames frame
ACK Send ACK

time time
2942 | Ch 05 Page 326 Wednesday, February 16, 2000 3:30 PM

326 CHAPTER 5 PROTOCOL CONCEPTS

Similarly, we can view an algorithm as a sequence of states. Each state is


defined in part by the values of program variables at an instant in time. In theory, we
can categorize (list) all possible states and the events that cause a change from one
state to another. The term finite state machine (sometimes finite state model) cor-
responds to this categorization. An event that causes a change of state is called a
state transition.
Viewing an algorithm in this discrete way allows us to represent it through a
directed graph called a state transition diagram (STD). Recall that a directed graph
consists of a set of vertices and edges. Each vertex represents a state and usually is rep-
resented visually by a dot or circle. Each edge is an ordered pair of vertices and usu-
ally is represented visually by an arrow from the first vertex to the second. Through
graph theory we can analyze the state transition diagram and draw conclusions with
regard to the reachability of certain states or possible sequences of events (transitions).
Figure 5.18 shows a state transition diagram. It has six different states, and the
arrows show the possible transitions. For example, if the system is currently in state
S1, three different events could occur, one causing the system to move to state S2, the
others causing it to move to state S4 or S5.
By analyzing the graph we can draw conclusions about the system it represents.
For example, note that there are no edges pointing to S1. This means there are no
transitions to state S1. If this graph represented an algorithm designed to respond to
events, this observation could mean a flaw in the algorithm’s logic. That is, the algo-
rithm does not respond to any event that puts the system into state S1. If this is in
contrast to what we know about the system, we have detected a flaw.
This graph shows another potential problem. Suppose an event occurs that
causes a transition to state S5. It can respond only to events that cause it to move to
state S6. Once there, it can only go back to state S5. In other words, once this model
progresses to state S5 or S6, it will remain in one of those two states forever. This
might correspond to an infinite loop or a deadlock (waiting for an event that will
never happen). As before, this most likely represents a flaw in our algorithm.

STD for a Simplified Go-back-n Protocol How can we apply this diagram to an
actual protocol? First consider the go-back-n protocol with a sender window size of

Figure 5.18 General State Transition Diagram

S1 S2 S3

S4 S5 S6
2942 | Ch 05 Page 327 Wednesday, February 16, 2000 3:30 PM

5.4 PROTOCOL CORRECTNESS 327

1 and a one-bit frame number field. Assume that no timeouts or transmission errors
occur, all data goes in one direction only (sender to receiver), and the receiver
acknowledges each frame received. Essentially, it is the stop and wait protocol with
frame numbers. The following events occur:
• Send frame 0.
• Receive frame 0; send ACK 0.
• Receive ACK 0; send frame 1.
• Receive frame 1; send ACK 1.
• Receive ACK 1; send frame 0.
We can associate four distinct states with this protocol. They are labeled by
ordered pairs (x, y) in Figure 5.19. The value of x is either 0 or 1 depending on the
ACK number for which the sender is waiting. Similarly, y is either 0 or 1 depending
on the frame number for which the receiver is waiting. Thus, state (0,0) means the
sender has sent frame 0 and is expecting its acknowledgment. It also means the
receiver is waiting for frame 0.
The arrival of frame 0 is an event that causes a transition from state (0,0) to
(0,1). The receiver has received frame 0, sent its acknowledgment, and is now
waiting for frame 1. However, the sender is still waiting for an acknowledgment to
frame 0. When that acknowledgment arrives the sender accepts it, sends frame 1
next, and begins waiting for its acknowledgment. This is state (1,1) because the
receiver is still waiting for frame 1. The sending and receiving of frames and
acknowledgments continues and the states in Figure 5.19 occur in clockwise order.
An observant reader might ask: Aren’t there really more states associated with
this protocol? For example, there is a period of time after the sender receives the
acknowledgment but before it sends its next frame. Shouldn’t there be a state for
which the sender is waiting for the patron to provide a packet? Yes! In fact, we could
go to the extreme and define a state corresponding to the execution of each step in
the algorithm. But does it pay to do so?
Defining states is an important design issue. Ideally, we would like to define
states that represent significant steps in a system’s evolution and not worry about
insignificant or trivial differences. But determining what is significant is often difficult

Figure 5.19 STD for a Stop and Wait Protocol with Frame Numbers

Frame 0 arrives
(0,0) (0,1)

ACK 1 arrives ACK 0 arrives

Frame 1 arrives
(1,0) (1,1)
2942 | Ch 05 Page 329 Wednesday, February 16, 2000 3:30 PM

5.4 PROTOCOL CORRECTNESS 329

void send_data; void receive_data;


{ {
#define increment(x) x=(x==0 ? 1 : 0); #define increment(x) x=(x==0 ? 1 : 0);
int w=0; int last=-1;
int i=0; while there are packets to receive
packettype buffer[2]; {
while there are packets to send wait for an event;
{ if (event is "damaged frame arrives")
wait for an event; {
if (event is "packet from patron") && (i<2) Construct a frame with frame.type=nak and
{ frame.ack=last and send it;
get packet from the patron and store in stop acktimer;
buffer[(w+i) % 2]; continue;
construct and send frame with }
frame.number=(w+i) % 2; if (event is "undamaged frame arrives")
reset frametimer(frame.number); {
i++; receive(frame);
continue; if (frame.number != last)
} {
if (event is "expired frametimer") increment(last);
{ extract packet from the frame and give it to
resend one or both frames in window; the patron;
reset one or both frametimers; if acktimer not active then reset acktimer;
continue; continue;
} }
if (event is "undamaged frame arrives") if (frame.number == last)
{ {
receive(frame); construct and send a frame with the
remove any acknowledged frames from window; frame.type=nak and frame.ack=last;
decrement i by number of frames removed; stop acktimer;
stop frametimers for acknowledged frames; }
w=(frame.ack+1) % 2; if (event is "expired acktimer")
if (frame.type == nak) {
{ Construct and send a frame with frame.type=ack
resend frames in the window; and frame.ack=last;
reset frametimers; continue;
} }
} }
}

Sender code Receiver code

Figure 5.20 Go-back-n Protocol for One-Way Data Transfer (Window Size = 2)
2942 | Ch 05 Page 331 Wednesday, February 16, 2000 3:30 PM

5.4 PROTOCOL CORRECTNESS 331

Timeout,
Send F1 resend F1
(Y,Y,0) : (B,N) (Y,Y,0) : (0,N)

F0 accepted
Send A0 Timeout, resend F0

(Y,Y,1) : (1,0) (Y,Y,0) : (N,N)

F1 accepted
Send A1 A1 lost

A0 lost
(Y,Y,0) : (N,B) (Y,Y,0) : (N,1)

Figure 5.22 Partial Refinement of STD from Figure 5.21

cycle repeatedly. This defines a sequence of events that causes the receiver to alter-
nately expect and receive frames 0 and 1. However, none of the events corresponds
to sending new frames (just resending old ones). This means the receiver repeatedly
accepts new frames even though no new ones are being sent. That is, the receiver is
accepting old frames as if they were new, just as we discussed in Section 5.3.
In general, STDs can be used to trace sequences of events and intermediate
states. If a path exhibits state changes that should not occur given the events, there is
a flaw in the model.

P ETRI N ETS
Like a finite state model, a Petri net uses a graph to represent states and transitions,
but the way it does so is different. A Petri net consists of four parts:
1. Places. Represented visually by circles, places correspond to part of a state.
This is one difference from the finite state model. Each vertex of an STD repre-
sents a complete state; with a Petri net we may need several places to represent
the complete state. We’ll see an example shortly.
2. Transitions. Represented visually by a short horizontal or vertical line, transi-
tions show movement between places.
3. Arrows. Arrows connect a place to a transition or vice versa. A place at the
source of the arrow is called the input place of the transition to which the arrow
points. Any place pointed to by the arrow is the output place of the transition at
the arrow’s source.
4. Tokens. Tokens, represented by heavy dots inside places, collectively define the
current state of the system.
2942 | Ch 05 Page 333 Wednesday, February 16, 2000 3:30 PM

5.4 PROTOCOL CORRECTNESS 333

Figure 5.24 shows part of the Petri net for it. As before, we have left out some parts
of the Petri net to simplify the diagram and our discussion.
Instead of trying to describe the state of the system in one vertex, we divide the
system into its parts and represent the state of each. In this case, the system consists
of a sender, receiver, and channel between them. Thus, the system state depends on
what the sender and receiver are waiting for and what is on the channel, just as with
our previously refined STD. Specifically, the sender has two states, each represented
by a place. The sender is waiting for an acknowledgment for frame 0 (Wait for A0)
or for frame 1 (Wait for A1). The receiver also has two states: waiting for frame 0
(F0) or frame 1 (F1). The four places in the middle correspond to what is on the
channel. F0 and F1 are places corresponding to frame 0 or 1 being transmitted. A0
and A1 correspond to the acknowledgments for frame 0 or 1 being transmitted.
The tokens in Figure 5.24 show the current state of the system. The sender has
sent frame 0, which is currently on the channel. The receiver is waiting for it and the
sender is waiting for an acknowledgment of it.
Next let’s consider the transitions. Transitions correspond to events that can
occur, and their input places correspond to states that must exist before the event can
occur. For example, look at the first transition for the sender labeled “Receive A1,

Figure 5.24 Partial Petri Net for Go-back-n with Sender Window Size = 1

Receive A1 F0
Send F0

Timeout, resend F0

• Wait for F0
Wait for A0 • A0
Receive F0
Send A0
Receive A0
Send F1
Timeout, resend F1
F1 Wait for F1
Wait for A1
Receive F1
Send A1

A1

Sender Channel Receiver


2942 | Ch 05 Page 337 Wednesday, February 16, 2000 3:30 PM

5.5 DATA LINK CONTROL PROTOCOLS 337

configurations. In a point-to-point link (Figure 5.26a), the primary station


communicates with a single secondary station. In a multipoint link (sometimes
called a multidrop link), the primary station can communicate with several
secondary stations (see Figure 5.26b). Of course, it must manage and keep sep-
arate the different sessions it maintains with each of them.
• Asynchronous response mode (ARM). Like NRM, ARM involves communi-
cation between a primary station and one or more secondary stations. Here,
however, the secondary station is more independent. Specifically, it can send
data or control information to the primary station without explicit instructions
or permission to do so. However, it cannot send commands. The responsibility
for establishing, maintaining, and eventually ending the connection still resides
with the primary station. This mode is most common in the point-to-point links
of Figure 5.26a.
• Asynchronous balanced mode (ABM). ABM is used in configurations con-
necting combined stations (Figure 5.26c). Either station can send data, control
information, or commands. This is typical in connections between two com-
puters and in the X.25 interface standard (discussed in Chapter 7).

Figure 5.26 HDLC Configurations

commands
primary secondary
station station
responses

(a) Point-to-point link

commands
primary
station
responses

secondary secondary secondary


station station station

(b) Multipoint link

commands and responses


combined combined
station station
commands and responses

(c) Point-to-point link between combined stations


2942 | Ch 05 Page 339 Wednesday, February 16, 2000 3:30 PM

5.5 DATA LINK CONTROL PROTOCOLS 339

data
0 0 1 1 1 1 1 1 1 0 0
transmitted data
0 0 1 1 1 1 1 0 1 1 0 0

first bit “stuff” 0 bit after the fifth 1

stuffed bit

(a) More than five consecutive 1s

data
0 1 1 1 1 1 0 1 1 0 0
transmitted data
0 1 1 1 1 1 0 0 1 1 0 0

first bit “stuff” 0 bit after the fifth 1

stuffed bit

(b) Five consecutive 1s

Figure 5.28 Bit Stuffing

The data field contains the data, and its length is variable. We will see that in
some cases there is no data and this field does not exist. The frame check sequence
(FCS) is used for CRC error detection. The field may be 16 (standard format) or 32
(extended format) bits long. Most common is a 16-bit field defined as described in
Section 4.3 using the CRC polynomial x16 + x12 + x5 + 1.
The control field is 8 (standard format) or 16 (extended format) bits long and is
used to send status information or issue commands. Its contents depend on the
frame’s type. The three types are information frame, supervisory frame, and unnum-
bered frame. Figure 5.29 shows the format for each using the standard format. With
the extended format, the fields are larger or the frame contains unused bits; the dif-
ferences are not important here.
The first one or two bits define the frame type. As Figure 5.29 shows, an infor-
mation frame always starts with 0, a supervisory frame always starts with 10, and an
unnumbered frame always starts with 11. These definitions allow the receiving sta-
tions to determine the type of an arriving frame.
Information frames are used primarily to transfer information (data field of
Figure 5.27) using either the go-back-n or the selective repeat sliding window proto-
cols. The fields N(R) and N(S) are similar to what we previously called frame.ack and
frame.number, respectively. Specifically, N(R) (number of received frame) is a piggy-
back acknowledgment indicating that all frames up to N(R) – 1 have been received.
2942 | Ch 05 Page 343 Wednesday, February 16, 2000 3:30 PM

5.5 DATA LINK CONTROL PROTOCOLS 343

Table 5.2 (continued)


FUNCTION
(C = C O M M A N D ; R = R E S P O N S E ) MEANING
TEST: Test (C or R) Request to the other station to send a test response. The
sending station may put something in the data field for the
receiving station to return to test the link.
FRMR: Frame reject (R) Used to indicate an arriving frame was rejected. The REJ func-
tion rejects frames that are damaged or received out of order.
FRMR is used if, for example, a control field is defined incor-
rectly or a frame that was never sent is acknowledged.

Figure 5.30 Communicating Using HDLC

Station A Station B Station A Station B


Send RIM Send i frames
N(R) = 0, N(S) = 0
Send SIM Send i frames N(R) = 0, N(S) = 1
Send UA
N(R) = 0, N(S) = 0

Send SARM N(R) = 0, N(S) = 1


Frame arrives damaged
Send UA
N(R) = 1, N(S) = 2
Frame rejected
time
Send REJ with N(R) = 1

(a) Establishing link


Send i frames
N(R) = 2, N(S) = 1 no activity

N(R) = 2, N(S) = 2
Station A Station B
Send RR with N(R) = 3
N(R) = 2, N(S) = 3
Send DISC
Send UA

time time

(c) Terminating link (b) Exchanging frames


2942 | Ch 05 Page 347 Wednesday, February 16, 2000 3:30 PM

5.5 DATA LINK CONTROL PROTOCOLS 347

Table 5.3 BSC Control Characters


BSC C H A R A C T E R MEANING
ACK: Acknowledge Verifies that a block of data was received cor-
rectly. Since BSC is a half-duplex, stop and
wait protocol, ACK also tells the sender that it
may send the next frame.
DLE: Data link escape Typically used with STX. The DLE/STX
sequence specifies that all successive bytes,
including control bytes up to a DLE/ETX or
DLE/ETB sequence, are to be treated as data.
Afterward, any control character is interpreted
accordingly.
ENQ: Enquiry Requests a response from another station.
Responding stations might send a data frame
or an ACK or NAK, depending on their status.
EOT: End of transmission Indicates end of transmission and tells the sta-
tions they may disconnect.
ETB: End of transmission block If a message requires many frames, ETB indi-
cates the end of an intermediate frame.
ETX: End of text Indicates the end of the last frame in a multi-
frame message or the end of a frame in a
single-frame message
NAK: Negative acknowledgment Indicates the previous frame was received
incorrectly.
NUL: Null Used as a filler character where frames must be
a minimal length.
SOH: Start of header Indicates the start of header information in the
frame.
STX: Start of text Indicates the start of data within the frame.
SYN: Synchronous idle Two SYN characters are at the start of each
frame, alerting the station of an arriving frame.

Figure 5.32 Encountering Control Bytes in Data

SYN SYN SOH header STX . . . data . . . ETX . . . data . . . ETX BCC

lost data
2942 | Ch 05 Page 348 Wednesday, February 16, 2000 3:30 PM

348 CHAPTER 5 PROTOCOL CONCEPTS

interpreting it as a control byte and missing the remaining data? A station using
the BSC protocol handles this by preceding the STX character with a DLE char-
acter. The DLE, which stands for data link escape, acts like a toggle switch.
When the receiving station sees the DLE-STX pair, it disables any checking for
control bytes such as ETX or ETB. Moreover, the checking remains disabled until
the receiving station encounters another DLE character. Once this DLE is encoun-
tered, the receiving station enables its checking for ETX or STX characters.
At first glance it may seem we have not solved any problems. What if the data
contains a DLE character? The protocol gets around this problem by disguising DLE
characters in its data. Figure 5.33 shows how. A sending station examines the charac-
ters it sends as data. Whenever there is a DLE character, it inserts an extra DLE char-
acter. This process is called byte stuffing and is similar to bit stuffing, discussed
previously; it just operates on a different level. Thus, when a receiving station
encounters a DLE it looks for a second one following immediately. If it finds one, it
knows the second one is bogus and accepts the first as data. If not, it knows the DLE
is not data and enables control character checking. Data delimited this way is called
transparent data. That is, the data field’s contents are transparent to the receiving
station. Data delimited with STX and ETX (or ETB) only is nontransparent data.
The last character from the formats shown in Figure 5.31 is BCC, block check
character. It is used in BSC’s error checking method. The BCC field’s contents
depend on which error checking method is used. If the protocol uses the CRC check,
BCC will correspond to the CRC-16 polynomial (see Section 4.3). In other cases,
BSC uses a longitudinal redundancy check. This method visualizes the frame as a
two-dimensional bit array where each row represents one byte. For each column a
parity bit is determined from the bits in that column and is stored in the BCC field.

Frame Exchange Because BSC is a half-duplex protocol using stop and wait
flow control, the process of sending and acknowledging frames is simplified. Figure
5.34 shows a typical sequence of events. Station A (primary station) sends an ENQ
control frame to B. Since ENQ frames request a response, station B sends an
acknowledgment. After A receives the acknowledgment, A and B exchange a
sequence of data frames and acknowledgments. If B receives a frame correctly it

Figure 5.33 Byte Stuffing

BSC frame

extra byte .... DLE STX . . . data . . . DLE . . . data . . . DLE ETX ...

.... DLE STX . . . data . . . DLE DLE . . . data . . . DLE ETX ...

transmitted frame
2942 | Ch 05 Page 349 Wednesday, February 16, 2000 3:30 PM

5.5 DATA LINK CONTROL PROTOCOLS 349

Receive Receive
Receive Send data Send data Receive Send
ENQ ACK frame ACK frame EOT EOT
Station B
Continue with time
alternating exchange of
data frames and
acknowledgments.
Station A
Send Receive Send Receive Send Send Receive time
ENQ ACK data ACK data EOT EOT
frame frame

Figure 5.34 Frame Exchange

sends a control frame containing the ACK control character. When A receives it, the
ACK character indicates the previous frame has been received. Consequently, A
sends the next one. This exchange continues as long as A has frames to send. When
A has no more data to send it sends an EOT frame. B responds by sending its own
EOT frame. When A receives it the connection between the two is terminated.
Naturally there are provisions for responding to damaged frames or for using
timers to check for lost frames. But since these methods do not differ significantly
from what we have discussed previously, we will not duplicate the discussions.

S UMMARY : D ATA L INK P ROTOCOLS


HDLC (and its many variations) and BSC represent two of the most common data
link protocols. Table 5.4 summarizes the main differences between them.

Table 5.4 Comparison of BSC and HDLC Protocols


HDLC BSC
Full duplex Half duplex
ARQ with go-back-n or selective repeat flow ARQ with stop and wait flow control
control
Bit-oriented protocol Byte-oriented protocol
Code independent Requires ASCII, EBCDIC, or Transcode
One frame format specifying three frame types Multiple frame formats
Achieves data transparency through bit stuffing Achieves data transparency through byte (DLE)
stuffing
Bit flags delimit frames SYN , ETX, and ETB characters delimit frames
Uses control field for control information Uses control frames for control information
2942 | Ch 05 Page 350 Wednesday, February 16, 2000 3:30 PM

350 CHAPTER 5 PROTOCOL CONCEPTS

5.6 CASE STUDY: KERMIT

We finish this chapter by describing Kermit, a popular file transfer protocol. By


now, we have covered enough material to describe adequately how a specific pro-
tocol runs. We choose Kermit because it is available on most, if not all, the major
platforms. We describe only the aspects of Kermit that relate to what we have dis-
cussed thus far. If you are interested in an in-depth study, Reference [Da87] does a
thorough and understandable job.
Kermit was written at Columbia University in the early 1980s in response to a
growing demand to transfer mainframe files to a new and emerging technological
wonder, the floppy disk. Kermit is unique in that it is not proprietary software. In
other words, it doesn’t cost anything. It is exchanged freely and is widely available.
Its availability has allowed many people to study it and make suggestions for
improving it. Consequently, Kermit has grown and appears in many versions.
Because there are so many versions the features we discuss here may or may
not be true for your version. We intend this discussion to be general and to relate to
the topics we have discussed previously. For complete details you should consult the
documentation at your site.
The name Kermit probably seems familiar. Indeed, Kermit is named after one of
the late Jim Henson’s Muppet characters. According to daCruz (Ref. [Da87]), the
name Kermit was chosen because the Muppet frog is “a pleasant, unassuming sort of
character” and the protocol designers liked the association. To justify its use they
tried to think of a phrase for which Kermit was an acronym. After failing in their
attempt, they decided to use the name anyway and requested (and got) permission
from Henson Associates, Inc. to do so.
To transfer a file between two computers, each must run a copy of Kermit.
Figure 5.35 shows the general approach involving a PC and a remote computer con-

Figure 5.35 Kermit File Transfer

datafile myfile

some connection such as a


phone line with modem or a
$Kermit null modem cable $Kermit
Kermit>Send Kermit>
datafile Receive myfile

Local PC Remote computer


2942 | Ch 05 Page 351 Wednesday, February 16, 2000 3:30 PM

5.6 CASE STUDY: KERMIT 351

nected by a phone line and modem. The PC’s user runs some communication soft-
ware to log on to the remote machine. Once logged on, he or she calls Kermit by
entering its name. The user then enters the command Receive myfile. At this point,
the Kermit running on the remote computer is waiting for a file to arrive. The bold-
face characters in the figure indicate system prompts (which will vary with the
system).
Next, the user calls Kermit from the local PC and enters the command Send
datafile. This activates the PC’s Kermit. At this point, the user’s interaction is done
and Kermit does the rest. It looks for a file named “datafile” on the local PC and
divides it into packets, the number depending on the size of the file and a packet.
The PC Kermit constructs and sends frames through the modem and phone lines
using the techniques, standards, and protocols described in Chapters 2 through 5.
When the frames arrive at the remote computer, its Kermit receives them. If there are
no errors, it extracts the packets and creates a file named “myfile.” Once all the
packets have been reassembled, the PC’s Kermit informs the user the file transfer
was successful.
From the user’s perspective, the transfer was almost trivial. Two commands
on each end were enough to do the job. But each of the topics discussed in the
previous four chapters must be addressed somewhere, making the transfer far
from trivial.

F RAME F ORMAT
Kermit is a byte-oriented protocol. As with BSC, the Kermit frame consists of a
sequence of bytes. Each byte’s placement in the frame determines its meaning.
Figure 5.36 shows the frame format and, as you might expect, it differs little from
what we have discussed previously. It contains the ASCII SOH character, a frame
number, and data. It also contains the number of bytes or length of a frame. This dif-
fers from previous protocols in which variable-length frames were terminated by a
special character. With Kermit, the receiving station finds the frame’s end by
counting the number of bytes and comparing with the length field.
Each frame also contains an error checking field. Error checking may be done
using the CRC method or checksums. The checksum method computes a modular
sum of frame bytes treated as integers. The sum is stored and sent with the frame.
The receiving station recalculates the sum and compares it with the stored sum. Any
discrepancy indicates an error.
Finally, each frame has a type field represented by a character. Kermit’s frame
types are similar to previously discussed types. Table 5.5 summarizes some of them.
A complete list is found in Reference [Da87].

Figure 5.36 Kermit Frame Format

SOH Length Number Type ... data ... ErrorCheck


2942 | Ch 05 Page 354 Wednesday, February 16, 2000 3:30 PM

354 CHAPTER 5 PROTOCOL CONCEPTS

Station A Station B
S frame

Y frame

F frame

Y frame
S- send initiation frame
Y- acknowledgment frame
Exchange D and F- file header frame
Y frames D- data frame
Z- end of file frame
Z frame
B- break transmission
Y frame

B frame

Y frame
disconnect

time time

Figure 5.37 Kermit Protocol to Send a File

C OMMANDS
Many people who use Kermit do not know how it works. In many cases they do not
want or need to know. However, they do need to know how to interact with it to per-
form necessary tasks. We finish this section by discussing some of the more
common commands to which Kermit responds. Remember, this description is gen-
eral, and all commands may not be available on every Kermit. Reference [Da87]
lists approximately 100 commands; to completely cover each one in detail, spelling
out where they are used, is far beyond our scope here. However, Table 5.6 lists some
of the commands that relate to previous discussions.
Kermit is included here primarily because of its widespread use, but the reader
should not conclude that it is the only file transfer protocol. There are others, such as
XMODEM, XMODEM-CRC, XMODEM-1K, WXMODEM, YMODEM, and
ZMODEM. The differences among them, including frame sizes and formats, error
checking methods, and control characters used, are not huge. On the other hand, as
anyone who has ever written a program knows, even the smallest differences can
make protocols incompatible. If you are interested in further distinctions, Reference
[Ra96] has a short discussion of each protocol.
2942 | Ch 06 Page 365 Wednesday, February 16, 2000 3:30 PM

6.1 NETWORK TOPOLOGIES 365

(a) Bus topology (b) Ring topology

(c) Star topology (d) Fully connected topology

Figure 6.1 Network Topologies

Other topologies are the star topology and a fully connected topology. In a star
topology (Figure 6.1c) one station (often a mainframe or file server) is a logical
communication center for all others. Any two communicating stations must go
through it. Finally, a fully connected topology (Figure 6.1d) connects every pair of
stations directly. Fully connected topologies represent an extreme case and are
rarely used in practice (except perhaps in small isolated cases). Therefore we will
not discuss them further.
An advantage of the bus topology is its simplicity. The segment may run through
one or more buildings, with feeder lines going to specific offices or classrooms
(Figure 6.2) and connecting to PCs. It may run the length of an assembly line, con-
necting devices necessary for the assembly of a product such as an automobile. Because
of the linear organization, adding new stations or removing old ones is relatively easy.*

*
Be cautious of this statement. Insertion and deletion of stations depends on more than topology. Two
very different protocols, Ethernet and token bus, both use the linear organization. We will see that the
way in which stations are added and deleted is more different.
2942 | Ch 06 Page 366 Wednesday, February 16, 2000 3:30 PM

366 CHAPTER 6 LOCAL AREA NETWORKING

offices offices

feeder feeder
line line
segment

Building Building

Figure 6.2 Bus Topology Connecting Multiple Buildings

A disadvantage of the linear organization is that only one station can send at a time.
With many applications this limitation poses no problem. However, as the number of
transmissions increases, serious bottlenecks can occur. You might want to refresh your
memory by reviewing the discussion of contention protocols in Section 3.4.
Ring topologies allow multiple stations to send using one or more tokens that
circulate the ring. Recall from Section 3.4 that a token is a special frame and a sta-
tion in possession of it may send. The most common ring networks use just one
token but some protocols have provisions for more. Ring topologies are common in
office environments where multiple PCs must communicate among themselves or
with a file server or shared printer.
Sections 6.2 through 6.4 discuss three standards for bus and ring networks: the
Ethernet, token ring network, and token bus network. The discussions cover the pro-
tocols used to control and maintain the integrity of the network. We will see that the
differences among these standards go far beyond the diagrams we have drawn so far.
As the need to communicate increases, the bus and ring topologies become
less effective. Greater needs usually require more flexibility than these topologies
can provide. As the number of frames increases, the LANs become saturated and
performance degrades. Recall again from Section 3.4 how too many frames affect
efficiency.
One way to avoid serious bottlenecks is to use more LANs, thus reducing the
number of stations per LAN. This solution helps maintain performance at an accept-
able level. However, dividing all the stations into multiple LANs raises the question
2942 | Ch 06 Page 367 Wednesday, February 16, 2000 3:30 PM

6.2 E T H E R N E T : I E E E S T A N D A R D 802.3 367

bus network

ring network

ring network
bus network
wide area network
network node

Figure 6.3 Interconnecting Networks

of which stations are assigned to which LANs. A corollary to Murphy’s law states
that no matter how you group them, two stations on two different LANs will need to
communicate. Consequently, we must provide some way for communication across
LANs. This invariably leads to connecting networks in a manner similar to that in
Figure 6.3. The figure shows two bus and two ring networks. Any two stations on a
LAN communicate using the LAN’s protocols. In addition, connections between
LANs allow cross communications. Locating the proper stations across LANs can
be tricky. Section 6.5 discusses methods of connecting LANs and the protocols that
allow inter-LAN communication.
After studying various LAN protocols you realize that a lot of software is nec-
essary to make them function. There are two ways to get such software: Write it or
buy it. Since most people buy it, we present a case study of one of the more popular
network software products, Novell NetWare. We chose this package because it is
popular and because books are available for anyone wanting more information.

6.2 ETHERNET: IEEE STANDARD 802.3

Ethernet has a bus topology. Stations contend for the segment using a form of the
CSMA/CD contention protocol (Section 3.4). It is commonly used to connect PCs,
workstations, printers, file servers, and even mainframes. Part of the Ethernet’s his-
tory dates back to 1973. In his Ph.D. thesis, Robert Metcalfe described much of his
research on LAN technology. After graduation, he joined the Xerox Corporation and
2942 | Ch 06 Page 375 Wednesday, February 16, 2000 3:30 PM

6.2 E T H E R N E T : I E E E S T A N D A R D 802.3 375

number of octets
7 1 2 or 6 2 or 6 2 46–1500 4

Preamble Start of frame Destination Source Data field Data Pad Frame check
delimiter address address length sequence

Figure 6.8 Ethernet Frame Format

• Start of frame delimiter. The special pattern 10101011 indicates the start of a
frame.
• Destination address. If the first bit is 0, this field specifies a specific station. If
it is 1, the destination address is a group address and the frame is sent to all sta-
tions in some predefined group specified by the address. Each station’s interface
knows its group address and responds when it sees it. If all bits are 1, the frame
is broadcast to all stations.
• Source address. Specifies where the frame comes from.
• Data length field. Specifies the number of octets in the combined data and pad
fields.
• Data field. Self-explanatory.
• Pad field. The data field must be at least 46 octets (more about this shortly). If
there is not enough data, extra octets are added (padded) to the data to make up
the difference.
• Frame check sequence. Error checking using 32-bit CRC.
From Figure 6.8, we see an upper and lower limit (from 46 to 1500) on the
number of data and pad octets. The upper limit is used to prevent one transmission
from monopolizing the medium for too long. The lower limit is to make sure the col-
lision techniques work properly. In Section 3.4 we stated that frame sizes must be a
minimum length so a sending station can detect a collision before sending the
frame’s last bit. The length is determined by the distance a frame travels, a bit’s
propagation speed, the data rate, and the delays caused by any repeaters. Consid-
ering all these factors, the 802.3 standard defines a minimum frame length as 512
bits (64 octets). If all the fields (except the pad) in Figure 6.8 have the smallest
number of octets possible, the total comes to 18 octets. The 46 pad octets then make
up the difference.

E FFICIENCY
We now address one measure of the efficiency of the 802.3 standard. As we have
stated previously in this text, there are many ways to define efficiency, and we leave
more extensive treatments of the topic to References [Ll96], [Wa91], [Be92], and
[Wa96]. The measure we address here defines the average amount of time to make a
2942 | Ch 06 Page 376 Wednesday, February 16, 2000 3:30 PM

376 CHAPTER 6 LOCAL AREA NETWORKING

successful transmission. It should depend on several factors such as the data rate,
cable length (including repeaters), frame size, and the number of stations. We will
see that this is indeed true.
We begin by dividing time into slots of T units each (there was a similar division
in Section 3.4). Typically, T is the maximum amount of time needed to detect a colli-
sion and is also the maximum round-trip propagation time between the two farthest
points on the network. Figure 6.9 helps show why they are the same. Suppose that
station A sends a frame. The frame takes 0.5T to reach the farthest point (station B).
Suppose that just prior to the frame’s arrival, B sends. Remember, the frame has not
yet reached B, so B still detects an idle medium. Thus, a collision occurs at approxi-
mately 0.5T after the frame was sent. The collision’s noise must propagate back to A
before A can detect it, which requires another 0.5T, for a total time equal to T.
What are the chances a station will send a frame successfully during a time
slot? It depends on two things: the total number of stations and the probability of a
given station sending during the slot. Suppose N is the total number of stations, each
of which sends with probability ps (0 ≤ ps ≤ 1) during slot time T. Equivalently, the
probability that a station does not send during T is 1 – ps.
The probability (P) of a frame being sent without collision during a slot time is
the probability that one station sends (ps) times the probability that all others do not
[(1 – ps)N–1] multiplied by N (because any of the N stations could be the one that
sends). We therefore write
N– 1
P = N × ps × ( 1 – ps )

Equivalently, 1 – P is the probability that a frame is not sent successfully, due either
to a collision or to the fact that no one sent anything.
We would like to know under what conditions the largest number of frames are
sent successfully. They can be found by finding the largest value for P. Calculus

Figure 6.9 Maximum Time to Detect a Collision

transmitted bits

Time to collide with first bit sent from B = 0.5T. collision

....bbbb b

Station A Station B

Time for collision noise to propagate back to A= 0.5T.


2942 | Ch 06 Page 381 Wednesday, February 16, 2000 3:30 PM

6.3 T O K E N R I N G : I E E E S T A N D A R D 802.5 381

D
wire
center

Figure 6.11 Token Ring Network Using Wire Center

• 20 stations, each separated by 10 meters, for a total ring length of 200 meters
• Transmission at 4 Mbps, or one bit every 0.25 µsec
• Propagation speed of 200 m/µsec
According to these characteristics, each bit would travel the ring in 1 µsec. But if
the bits are sent at a rate of one every 0.25 µsec, no more than four bits are ever on
the ring at any time. This is a problem because if no stations have anything to send,
the token won’t even fit on the ring, much less circulate around it. In order to get
more bits on the ring, there is a delay at each station allowing it to examine each bit
before deciding whether to copy it or repeat it. The delay is typically one bit-time,
the time required for one bit to be transmitted. For a 4 Mbps data rate, the bit-time is
0.25 µsec.
In our example, if each station had a one bit-time delay, 24 bits would fit on the
ring. As we will see, a token is 24 bits and the ring would accommodate the token. If
the number of stations were reduced, however, fewer bits would fit and the token
would be too big. Typically, to make the circulating token independent of the
number of stations on the ring, one monitor station will have an extra delay to allow
all 24 bits to fit on the ring. This monitor station is discussed further under ring
maintenance in this section.

T OKEN AND F RAME F ORMATS


We already stated that a token is simply a special frame. Figure 6.12 shows both the
token and frame formats. The four fields labeled “destination address,” “source
2942 | Ch 06 Page 382 Wednesday, February 16, 2000 3:30 PM

382 CHAPTER 6 LOCAL AREA NETWORKING

SD AC ED

(a) 3-octet token

number of octets
1 1 1 2 or 6 2 or 6 0–5000 4 1 1

Destination Source Frame check


SD AC FC ....data.... ED FS
address address sequence

(b) Variable-octet frame

SD (starting delimiter): J K 0 J K 0 0 0
AC (access control): p p p t m r r r
p p p: priority bits
t: token bit
m: monitor bit
r r r: reservation bits
ED (ending delimiter): J K 1 J K 1 I E
FC (frame control): f f z z z z z z
f: frame type bits
z: control bits
FS (frame status): a c x x a c x x
a: address recognized bit
c: frame copied bit
x: undefined bit

Figure 6.12 Token and Frame Formats

address,” “data,” and “frame check sequence” have the same meanings as those we
have discussed in previous sections, so we will not elaborate again. The destination
address may be an individual, group, or broadcast address. The data field has no the-
oretical maximum length, but there is a limit on how long a station can transmit
uninterrupted, which puts a practical limit of about 5000 data octets.
Each frame has a starting delimiter (SD) and ending delimiter (ED) that des-
ignate a token’s boundaries. SD has the special signal pattern JK0JK000. The 0s are
binary 0s as defined by the differential Manchester code. The symbols J and K cor-
respond to special signals. To understand what they are, recall that the differential
Manchester code defines a signal transition (high to low or low to high) in the
middle of each signal interval. The J and K signals violate that rule. The J signal
starts out like a 0 but there is no transition in the middle. Similarly, the K signal
starts out like a 1 and has no transition. Sometimes these signals are referred to as
non-data-J and non-data-K. Because these signals do not conform to the
2942 | Ch 06 Page 385 Wednesday, February 16, 2000 3:30 PM

6.3 T O K E N R I N G : I E E E S T A N D A R D 802.5 385

while (Peter Pan lives in the Never Land)


{
wait for an event;
if (event is "frame arrives")
{
1 if (frame originated at current station)
{
drain frame;
2 if (frame.res > frame.priority)
{
create and send token with token.priority = frame.res and token.res = 0;
put old and new priorities on stack and designate this station as a stacking station;
continue;
} /* end - frame.res > frame.priority */
3 if (current station is stacking station for this frame)
{
create and send token with token.priority = max(token.res, old priority on stack);
if token.res is used replace the current priority at the top of the stack with it;
if the old priority from the stack is used, pop the old and current priorities from the stack
and discontinue the stacking station designation if that stack is empty;
continue;
} /* end - current station is stacking station for this frame */
create and send token with token.res = frame.res and token.priority = frame.priority;
} /* end - frame originated at current station */
4 if (frame originated elsewhere)
{
5 if (there is a frame to send) && (station priority > frame.res) store sending priority
in frame.res ;
send frame;
}
} /* end - event is "frame arrives" */
if (event is "token arrives")
{
6 if (current station is stacking station for this token)
{
create token with token.priority = max(token.res, old priority on stack);
if token.res is used replace the current priority at the top of the stack with it;
if the old priority from the stack is used, pop the old and current priorities from the stack
and discontinue the stacking station designation if that stack is empty;
}
7 if (there is a frame to send)
{

Figure 6.13 Token Ring Protocol to Reserve and Claim a Token (continues on next page)
2942 | Ch 06 Page 386 Wednesday, February 16, 2000 3:30 PM

386 CHAPTER 6 LOCAL AREA NETWORKING

8 if (station priority >= token.priority)


claim token, create, and send frame;
else
9 if (station priority > token.res)
store sending priority in token.res;
} /* end - frame to send */
send frame or token;
} /* end - event is "token arrives" */
} /* end of while loop */

Figure 6.13 (continued)

First, suppose some station with a higher priority than the frame’s priority has
made a reservation (condition 2). The station gives the token a priority equal to that
of the station making the reservation (contents of frame.res). It also defines
token.res = 0 to give any station a chance to make another reservation. But raising
the token’s priority is an awesome responsibility. Any station that does this also has
the responsibility of lowering it later when the only stations with something to send
have a priority lower than the token’s priority. At that point the station must recog-
nize a token whose priority it raised and lower it. To achieve this, the station (desig-
nated as a stacking station) stores the old and new (now current) priorities on a
stack whenever it raises the priority.
The second answer occurs when the reservation on the incoming frame was
made by a station with a lower priority than the frame’s priority. This means that as
the frame travels the ring, no station that wants to send has a high enough priority to
do so. Consequently, the new token’s priority must be lowered, but which station has
the authority to do so? If the current station did not raise the priority it cannot lower
it. Thus, it simply creates a token with the same priority and reservation value as the
incoming frame’s (last statement under condition 1). Presumably the token will
reach the stacking station, which will lower the priority.
However, if the current station is the stacking station* (condition 3), it creates a
new token with a lower priority. Next question: What is the new priority? The
stacking station compares the incoming reservation value with its old stacked pri-
ority and chooses the larger value. If the reservation value is larger, it replaces the
current priority on the stack. The station is still the stacking station because it has
not restored the priority that existed prior to its becoming the stacking station. If the
reservation value is not larger, the token gets the old stacked priority. The old and
current priorities are popped from the stack and, if the stack is empty, the station is

*
There may actually be several stacking stations because a token’s priority can be raised by more than
one station. What we really need here is the station that became a stacking station most recently. The
station can determine this by comparing the frame’s priority field with the current priority on the
station’s local stack. If they are the same, the current station can lower the token’s priority. If not, then
another station raised the priority and must subsequently lower it.
2942 | Ch 06 Page 387 Wednesday, February 16, 2000 3:30 PM

6.3 T O K E N R I N G : I E E E S T A N D A R D 802.5 387

no longer a stacking station. Note that the stacking station designation is removed
only when the stack is empty, as the station could be a stacking station from a pre-
vious priority increase.
Now consider what happens when a token arrives. If the station is a stacking
station (condition 6) it proceeds as we have just discussed. Afterward, it determines
whether there is a frame to send (condition 7). If so, it compares the token’s priority
with the station’s priority (condition 8). If the station has a high enough priority it
claims the token. If not, it compares its priority with the value specified by the reser-
vation bits (condition 9). Again, if it has a high enough priority it makes the reserva-
tion. Finally, it sends either the token or the frame (if it created one) to its neighbor.
This discussion is general and describes the major aspects of the priority and
reservation system. Now it is time to see an example. Suppose four stations are
ready to transmit (Figure 6.14) and that each has just one frame to send. Suppose
also that station C has just captured the token and is sending its frame. We now
apply the algorithm to the situation of Figure 6.14.
To help follow the algorithm, Table 6.2 summarizes what happens at each sta-
tion as a frame or token travels the ring. The first column lists the steps. The second
column indicates the station receiving the frame or token. The third column lists the
conditions from Figure 6.13 that are true when the frame or token arrives. The fourth
column specifies whether it sends a frame or token. The last two columns specify the
priority and reservation values (values 0 through 7) of the outgoing frame or token.
We begin the discussion at the point where station C has just captured a token and
sent its frame.
We pick up the algorithm after C sends the frame, so the first line in Table 6.2
corresponds to the arrival of a frame at D (step 1). In this case, conditions 4 and 5 are
true. That is, the frame did not originate at D, D has a frame to send, and its priority
is higher than that of the incoming frame. As a result, D stores its priority (2) in

Figure 6.14 Reserving Tokens on a Token Ring

priority = 1
priority = 2
A
D
token

B
C
priority = 5 priority = 0
2942 | Ch 06 Page 391 Wednesday, February 16, 2000 3:30 PM

6.3 T O K E N R I N G : I E E E S T A N D A R D 802.5 391

detecting a problem sends a continuous stream of beacon frames containing the


address of its upstream neighbor. If they return, the station assumes there is no break
(or it has been corrected) and begins sending CT frames as before. If the beacons do
not return in a specified amount of time, the station concludes there is a break some-
where and reports the error to a higher layer in the protocol. If the station receives
beacons from another station, it suspends sending its own and repeats the ones it
receives. Eventually, if there is a break, the only station sending beacon frames
(Figure 6.15) is the one downstream from the break.
One last function of the monitor is to make sure the token fits on the ring. Previ-
ously we discussed the fact that the number of bits that fit on the ring depends on the
ring’s length and the delays at each station. If both parameters are small, the number
of bits that will fit is small. This is not a problem when a frame is being sent because
a station can be sending a frame’s bits at the same time it is receiving previously sent
ones. A circulating token, however, is not drained until it is claimed and it must fit
on the ring. The monitor inserts extra delays to allow a full token to occupy the ring
and circulate.

E FFICIENCY
The discussion on token ring efficiency is mercifully short compared with similar
discussions of other protocols. This is because there are no collisions to waste band-
width and complicate the efficiency. The CSMA/CD contention suffers badly under
heavy loads, but token rings achieve very high rates of efficiency. For example, sup-
pose we consider the percent utilization, defined in Section 6.2. Recall that it is the
amount of time spent on an actual successful transmission as a percentage of the

Figure 6.15 Locating a Ring Break

A E

ring break

D
B

C
sending
beacon frames
containing A’s
location
2942 | Ch 06 Page 395 Wednesday, February 16, 2000 3:30 PM

6.3 T O K E N R I N G : I E E E S T A N D A R D 802.5 395

Preamble SD FC ED

(a) FDDI token

Destination Source Frame check


Preamble SD FC address address ....data.... sequence ED FS

(b) FDDI frame

Figure 6.17 Frame and Token Formats

tion claims a token it inserts a frame onto the ring, as in the token ring. This time,
however, instead of draining the token the sending station reinserts it immediately
after the frame. This way the token is always on the ring and any station has the
opportunity to insert a frame when the token passes by.
Figure 6.18 illustrates in more detail. Suppose stations A, B, and C have frames
frA, frB, and frC to send. When the token reaches A (Figure 6.18a), only the token
(T) is on the ring. When A gets the token it sends the frame followed by the token
(Figure 6.18b). When the frame and token reach B, B repeats the frame, sends its
own, and puts the token back onto the ring (Figure 6.18c). After passing station C
(Figure 6.18d), the ring contains all three frames followed by the token.
After comparing the token ring with FDDI you might ask, Why doesn’t the
IEEE standard allow multiple frames in its token ring? There are a couple of ways to
answer this. First, for a long time the 4 Mbps data rate with a single token met the

Figure 6.18 FDDI Ring Contents

T
A A A A
T frA
frA frB
frC
T
B B B T frB frA B
C C C C

(a) Before reaching A (b) After leaving A (c) After leaving B (d) After leaving C

T: token
frA: frame sent by A
frB: frame sent by B
frC: frame sent by C
2942 | Ch 06 Page 395 Wednesday, February 16, 2000 3:30 PM

6.3 T O K E N R I N G : I E E E S T A N D A R D 802.5 395

Preamble SD FC ED

(a) FDDI token

Destination Source Frame check


Preamble SD FC address address ....data.... sequence ED FS

(b) FDDI frame

Figure 6.17 Frame and Token Formats

tion claims a token it inserts a frame onto the ring, as in the token ring. This time,
however, instead of draining the token the sending station reinserts it immediately
after the frame. This way the token is always on the ring and any station has the
opportunity to insert a frame when the token passes by.
Figure 6.18 illustrates in more detail. Suppose stations A, B, and C have frames
frA, frB, and frC to send. When the token reaches A (Figure 6.18a), only the token
(T) is on the ring. When A gets the token it sends the frame followed by the token
(Figure 6.18b). When the frame and token reach B, B repeats the frame, sends its
own, and puts the token back onto the ring (Figure 6.18c). After passing station C
(Figure 6.18d), the ring contains all three frames followed by the token.
After comparing the token ring with FDDI you might ask, Why doesn’t the
IEEE standard allow multiple frames in its token ring? There are a couple of ways to
answer this. First, for a long time the 4 Mbps data rate with a single token met the

Figure 6.18 FDDI Ring Contents

T
A A A A
T frA
frA frB
frC
T
B B B T frB frA B
C C C C

(a) Before reaching A (b) After leaving A (c) After leaving B (d) After leaving C

T: token
frA: frame sent by A
frB: frame sent by B
frC: frame sent by C
2942 | Ch 06 Page 397 Wednesday, February 16, 2000 3:30 PM

6.4 T O K E N B U S : I E E E S T A N D A R D 802.4 397

NIC = network interface card

NIC
NIC slot
slot

t
slot slo
NIC slot NIC
NIC

Figure 6.19 Slotted Ring

an empty slot passes a station that has something to send, the station stores the nec-
essary address and as much data as will fit. If a slot is full the station waits for the
first empty slot. When the slot returns, the sending station marks the slot as empty
by changing one of its status bits. If the station has more data to send it will not use
the same slot but will wait for the next empty slot. This forces empty slots onto the
ring and prevents one station from monopolizing the slots.
We should note that slotted rings allow many bits to be on the ring simulta-
neously. Previous discussions showed the number of bits on a ring to be typically
small. However, by using longer rings or longer propagation delays at each station,
the number of bits on the ring simultaneously can be increased to meet the require-
ments of multiple slots.

6.4 TOKEN BUS: IEEE STANDARD 802.4

The third and last MAC protocol we discuss is the token bus protocol. It combines
features of the Ethernet and the token ring protocols. For example, the token bus
operates on the same principle as the token ring. The stations are logically organized
into a ring and a token passes among them. A station wanting to send something
must wait for the token to arrive. Here, however, the stations communicate via a
common bus as in an Ethernet. For example, Figure 6.20 shows five stations, A
through E, connected to a bus. If the logical order is A-B-C-D-E, then A starts by
sending a token to B along the bus. As with Ethernet, each station is capable of
receiving it, but the token’s destination address specifies which station gets it. When
2942 | Ch 06 Page 398 Wednesday, February 16, 2000 3:30 PM

398 CHAPTER 6 LOCAL AREA NETWORKING

A E D

Broadband bus

C B
Token circulates: A-B-C-D-E

Figure 6.20 Token Bus

B receives the token, it has permission to send a frame. If it has no frame it sends a
token to C. Similarly, C sends either a token to D or a data frame, and so on.
Generally, a station receives a token from its predecessor and sends a token to
its successor. Another immediate difference between the token bus and token ring is
that token bus stations must know their predecessor and successor. They must know
their successor so they know which destination address to put in the token. The rea-
sons for knowing their predecessor will be discussed later.
Token bus networks have the most support from those involved in factory auto-
mation and process control, applications that require real-time processing. The real-
time environments made many people nervous about embracing the 802.3 standard
because there was no theoretical limit on the number of collisions that could occur.
This meant that there was no theoretical limit on the delays one of the network com-
ponents could experience. With large objects moving down the assembly line, the
possibility of unexpected delays was unacceptable (reminiscent of the old television
gag where pies or pieces of candy are rolling down the assembly line faster than the
worker can pack them). In addition, the token ring did not satisfy their needs. First,
the physical ring is not the best fit for the linear organization of an assembly line.
Second, the point-to-point connections made the system susceptible to disaster if
one of the links failed. Thus, their solution was to use the linear organization to fit
the physical environment but a logical ring order to put an upper limit on the time a
station must wait for a token.
There also are some differences between the bus of the IEEE 802.5 and 802.3
physical layers. The token bus specifies signals to be sent over a baseband cable or a
broadband cable like that used for cable television. It allows for three different mod-
ulation schemes: continuous FSK (baseband), phase coherent FSK (baseband), and
multilevel duobinary AM/PSK (broadband). As these are variations on the modula-
tion schemes discussed in Section 2.5, we will not discuss them further. If you are
interested in specifics, you can consult References [St90] and [Mo89]. Data rates
may be as high as 10 Mbps, depending on the modulation technique.
2942 | Ch 06 Page 399 Wednesday, February 16, 2000 3:30 PM

6.4 T O K E N B U S : I E E E S T A N D A R D 802.4 399

Figure 6.21 shows the token bus frame format. All the fields in the frame are
similar to similarly named fields discussed previously. The only difference is that
there is no special token format. The FC field specifies whether the frame contains
data, is a token, or is any of several other control frames we will discuss shortly.
Remember, since the tokens are sent along a bus the destination and source
addresses must be specified.

T OKEN B US O PERATIONS
The linear physical topology coupled with the logical ring organization adds some
complexity to the token bus operations. For example, how is a new station added to
the network? With token ring it is added between two others and automatically gets
the token from its upstream neighbor. In a token bus a predecessor must be deter-
mined and notified of its new successor. Similarly, if a station is removed, its prede-
cessor must be informed so it does not send the deleted station any tokens.
How is the logical order determined? Typically, the stations’ addresses deter-
mine the order, but how do the stations notify each other where they are? How does
each one determine who its predecessor and successor are? What makes these ques-
tions difficult is that no one station has a global view of anything. Each knows only
what it has and what arrives on incoming frames. With no central control the stations
must somehow exchange information and come to some consensus about order. It’s
a bit like an anarchistic society establishing some order without agreeing to any cen-
tralized government.
The answers to these questions lie in the different control frames and the rules
for using them. Table 6.5 shows the different token bus control frames, their FC
fields, and a brief summary of their use.

Removing Stations What happens when a station leaves the ring? Suppose the
token passes through three stations in the order A, B, and C. Suppose station A has
the token and has nothing to send. It creates a new token addressed to B and sends it.

Figure 6.21 Token Bus Frame Format

number of octets
1 or more 1 1 2 or 6 2 or 6 0–8191 4 1

Preamble SD FC DA SA ....data.... FCS ED

SD: Start delimiter


FC: Frame control
DA: Destination address
SA: Source address
FCS: Frame check sequence
ED: End delimiter
2942 | Ch 06 Page 401 Wednesday, February 16, 2000 3:30 PM

6.4 T O K E N B U S : I E E E S T A N D A R D 802.4 401

sends a set successor frame to A specifying C as A’s new successor. A records the
information and B’s final activity is to send the token to C. When the token eventu-
ally returns to A, A sends it to its new successor, C.

Adding Stations Adding new stations is a bit more complex. The insertion pro-
tocol does not allow a new station to insert itself into the ring. Rather, a new station
must wait for an existing station to invite it into the ring. It’s like attending a party at
a fashionable country club: Don’t try to get in without an invitation. Periodically
(i.e., according to timers) each station sends a solicit successor 1 frame specifying
its own and its successor’s addresses and waits a sufficient time for a station to
respond. If none respond, the station assumes no one wants to enter and passes the
token to its successor. If there is a station with an address between the two specified
ones it may now submit a bid to enter the ring. It does so by sending a set successor
frame to the station extending the invitation. That station records its new successor
and sends its next token there.
For example, Figure 6.22 shows a token bus containing three stations, A, B, and
C. Two new stations, X and Y, want to enter but have not yet done so. That is, they are
physically connected but do not participate in the token passing. Assume the
addresses are ordered A > X > B > C > Y and that the token must follow that order. At
some point A sends a solicit successor 1 frame specifying A’s and B’s addresses.
Only X’s address is between them, so X sends a set successor frame to A. A recog-
nizes X as its new successor and sends all subsequent tokens to X.
Since the solicit successor 1 frame is an invitation to stations with an address
between two given ones, a new station with an address less than or greater than all
others will never respond. The solicit successor 2 frame is used for those stations.
The station with the smallest address sends it periodically, specifying the current and
successor’s addresses (the smallest and largest addresses). Any station with an even
smaller or larger address responds as before by sending a set successor frame. In the
example of Figure 6.22, station Y cannot enter the ring until station C broadcasts a

Figure 6.22 Adding New Stations to a Token Bus

A C B

Initial token-passing sequence


is A-B-C-A-etc.
X Y Order of addresses
new station new station is A > X > B > C > Y.
2942 | Ch 06 Page 404 Wednesday, February 16, 2000 3:30 PM

404 CHAPTER 6 LOCAL AREA NETWORKING

effect, and all the other stations are viewed as new stations waiting to enter the ring.
Consequently, the station in the ring eventually sends a solicit successor frame and
another station enters the ring. Over a period of time solicit successor frames are
sent, thus allowing all of the waiting stations to enter the ring.

P RIORITIZING F RAMES
The token bus does not prioritize stations and tokens as did the token ring, but it
does define priorities for data to be sent. Each station maintains four priorities, or
service classes, numbered 0, 2, 4, and 6. The classes are ordered with class 0 having
the lowest priority and class 6 having the highest. As information comes down to the
MAC layer from a higher layer, the protocol determines the information’s priority.
The protocol then creates data frames and stores them in one of four queues (one for
each class) that the station maintains (Figure 6.23).
When a station gets a token, it sends class 6 frames first. If there are none it
looks for class 4 frames, then class 2 frames, and finally class 0 frames. A station
sends frames in a class until either a timer expires or there are no more frames in that
class. Afterward, the station passes the token to its successor or sends frames from
the next lowest class.
To control frame transmissions each station maintains two timers: a token-
holding timer (THT) and a token-rotation timer (TRT).* The THT is the max-

Figure 6.23 Prioritizing Frames

f f f f

f f f f

f f f f
class 6 class 4 class 2 class 0
frames frames frames frames

*
Actually, there are three token-rotation timers, one for each of classes 0, 2, and 4. To simplify our
discussion we assume all three timers are equal and are represented by TRT. If you are interested,
Reference [St90] discusses the more specific case and provides a more detailed analysis.
2942 | Ch 06 Page 405 Wednesday, February 16, 2000 3:30 PM

6.4 T O K E N B U S : I E E E S T A N D A R D 802.4 405

imum time a station may spend sending class 6 frames. The TRT determines the
maximum time for a token to rotate around the ring. It also determines the max-
imum time allowed for the station to send frames in the lower classes. On receipt of
the token a station starts its THT and sends class 6 frames until there are no more or
until the THT expires. The station starts its TRT prior to sending the token to its suc-
cessor. The timer then continues counting while the token travels the logical ring.
When the token returns and the station has sent its class 6 frames, the remaining
time on the TRT determines how long it has to send any remaining frames. If other
stations had little to send the current station has more time sending frames. If other
stations send more frames the current one sends fewer. The intent is to minimize
delays as the token travels the logical ring.
Figure 6.24 shows pseudocode of the logic behind sending frames. When a
token arrives, the station starts the THT timer and sends class 6 frames until the THT
expires or there are no more class 6 frames. It then sends class 4 frames until the
TRT expires or there are no more class 4 frames. It performs similarly for class 2
and class 0 frames. Finally, when the station has finished sending frames, it starts the
TRT and sends the token to its successor. The TRT continues counting the entire
time the token is traveling the ring.
For example, suppose a token circulates among four stations in the order A-B-
C-D. As the token arrives at A, Table 6.6 shows how many frames of each class each
station has to send and the time left on each station’s TRT. We simplify the example
by assuming that all frames are the same size and require the same amount of time to
send. Suppose timer units are slot times, the time required to send one frame. That
is, THT = 6 means a station can send up to six class 6 frames at a time.
When A gets the token, it sends six class 6 frames and two class 4 frames. It
then sets its TRT to 32 before sending the token to B. Meanwhile, the time left on

Figure 6.24 Protocol for Sending Frames

while (Horton hears a Who)


{
wait for arriving token;
start THT timer;
while (THT not expired) && (class 6 queue not empty)
send class 6 frames;
while (TRT not expired) && (class 4 queue not empty)
send class 4 frames;
while (TRT not expired) && (class 2 queue not empty)
end class 2 frames;
while (TRT not expired) && (class 0 queue not empty)
send class 0 frames;
set TRT timer;
send token to successor;
} /* end of while loop */
2942 | Ch 06 Page 408 Wednesday, February 16, 2000 3:30 PM

408 CHAPTER 6 LOCAL AREA NETWORKING

B
wide area network

token ring connector

connector

connector

A Ethernet LAN
C

file server
Ethernet LAN

file server

Texas
file server
New York

Figure 6.25 Interconnecting Networks

we have discussed in previous sections. Texas station C does similarly. However, all
three stations need access to the other LANs periodically. The two New York net-
works can be connected directly, but distance prohibits a direct connection with the
Texas LAN. Consequently, a larger wide area network* is used to connect Texas and
New York.
The ability to connect networks is certainly not new. There are standards for
software and connecting devices, and any computer vendor has many such products
to sell. The question is where in the hierarchy of hardware and software these prod-
ucts fit. That is, what do they actually do? Models such as OSI provide several layers
of protocols for computer networks. For example, suppose the two New York LANs
of Figure 6.25 differ only in the MAC sublayer of the data link layer (Figure 6.4),
but the wide area network is different at higher layers. A connection to the wide area
network deals with more incompatibilities and is more complex than one connecting
the two LANs.
In general, we can connect two identical networks at layer 1, which amounts to
little more than an electronic connection to regenerate and repeat signals. We also

*
The next chapter discusses wide area networks. For now, just think of it as a network spanning a larger
geographical area than a LAN and having different protocols.
2942 | Ch 06 Page 409 Wednesday, February 16, 2000 3:30 PM

6.5 INTERCONNECTING LANS 409

can connect two totally incompatible networks at the highest layer. Such a connec-
tion requires complete knowledge of both protocols and the ability to translate one
to another. We also can connect anywhere between the highest and lowest layers,
depending on the degree of compatibility between the two networks. This section
discusses OSI layer 1 and layer 2 connections.

L AYER 1 C ONNECTIONS
Figure 6.26 shows several networks connected using repeaters, devices connecting
networks at the physical layer. A repeater accepts a frame’s bits from a LAN to
which it is connected and retransmits them onto another LAN. It assumes the LANs
to which it is connected use the same protocols and same frame formats. A
repeater’s primary function is to regenerate signals, thereby extending the distance
covered by the LAN.
In Figure 6.26 stations A, B, C, and D are each connected to a different LAN.
Each station, however, will see any frame that any other sends. For example, D sees
everything A sends. Whether they accept the frame depends on to whom the frame is
addressed. The stations have no knowledge of the repeater’s existence; as far as they
are concerned, they are all connected by a single, but larger, LAN.
Repeaters do present problems, however. One is that more stations can access
the medium, which leads to more traffic and can degrade LAN performance. For
example, if A sends a frame to E (both on LAN L1), the repeaters still send the
frame to LANs L2, L3, and L4. They have no built-in logic to know that A and E
are on the same LAN and that repeating the frame is pointless. The result, of
course, is that none of the other stations can send until station A has finished. A
second problem is security. Generally, as more people have access to information,
security is more difficult to implement. If A and E are exchanging sensitive infor-
mation, the frames pass by all the other stations and the potential for a security
breach increases.

Figure 6.26 LANs Connected with a Repeater

A E B

LAN L1 LAN L4

repeater

repeater
LAN L2

D repeater

LAN L3

C
2942 | Ch 06 Page 410 Wednesday, February 16, 2000 3:30 PM

410 CHAPTER 6 LOCAL AREA NETWORKING

L AYER 2 C ONNECTIONS
Another way to connect LANs is to use a bridge, a connector with the ability to exe-
cute a subset of a protocol. Typically a bridge is a connector at the OSI layer 2. As
such it performs data link functions such as error detection, frame formatting, and
frame routing. For example, suppose station B sends a frame on LAN L2 in the net-
work configuration of Figure 6.27. Bridge B1 examines the destination address and,
if it is destined for any station on LAN L1 (say A), accepts the frame and buffers it.
(How B1 knows what is on L1 is a major issue that we discuss shortly.) If the frame
is destined for a station on one of the other LANs, B1 ignores the frame. Thus, B1
acts like any other station selectively rejecting or accepting frames based on their
destination.
If B1 accepts the frame, it executes error detection routines to determine
whether the frame is correct. If there are no errors it sends the frame over LAN L1.
If L1’s frame format is the same as L2’s, the bridge sends the frame as is. If it is dif-
ferent, the bridge must reformat the frame it received into a format consistent with
L1’s standard. In some cases, reformatting is a simple matter of reorganizing the
fields, adding required ones, and dropping unnecessary ones. Unfortunately, as we
soon will see, in some cases the reformatting causes other problems, some of which
layer 2 protocols cannot handle.
Before discussing bridge design let’s pose one last question: What are the rea-
sons for using bridges in the first place? One reason is to enhance efficiency. With
repeaters we saw that every frame propagates throughout each LAN, causing a lot of
unnecessary traffic. To avoid this possibility a network designer can create a
topology in which frequently communicating stations are on the same LAN. For
example, each LAN of Figure 6.27 could correspond to a different department in a
large company. Thus, stations within a department can communicate with each

Figure 6.27 LANs Connected with a Bridge

A D

LAN L1 LAN L4

bridge
B B1

bridge
LAN L2 B4

bridge bridge
B2 B3 LAN L6

LAN L5 LAN L3 F

E C
2942 | Ch 06 Page 412 Wednesday, February 16, 2000 3:30 PM

412 CHAPTER 6 LOCAL AREA NETWORKING

happens if a frame goes from a token ring to an Ethernet and then to another token
ring? The frame has an initial priority, loses it when it goes on the Ethernet, and then
gets another priority when it reaches the second token ring. There is no guarantee,
however, that the initial and ending priorities are the same.
Yet another problem occurs due to the different maximum frame sizes with each
LAN protocol. For example, both token ring and token bus may use frames larger
than the maximum allowed on an Ethernet. Therefore, a large frame sent to an
Ethernet station is not consistent with the Ethernet protocol. There are two possible
solutions to this problem. The first is to make each station aware of the different
LAN standards that may be encountered when it sends a frame. Then the station’s
network software can construct frames small enough so they meet the maximum
size requirements of any LAN the frame may encounter. Many network packages
allow this option. The problem is that each station’s protocol now depends on the
interconnection topology. Adding new bridges and LANs may require giving each
LAN station new parameters. Since a major goal of communication is to create pro-
tocols that work regardless of the connection scheme, this is a significant constraint.
The second solution is for the bridge to break large frames into smaller ones.
For example, Figure 6.28 shows a 4000-byte frame being sent to an Ethernet. Since
the Ethernet does not allow frames above 1518 bytes, the bridge divides the frame
into three pieces. The problem with this is that flow control protocols at the data link
layer depend on the sending and acknowledging of frames. When a sending station
sends a frame it anticipates that the receiving station will or will not receive it. There
is no provision for the receiving station to receive what amounts to part of a frame.
The situation is not hopeless, however. Additional logic can be added to the
bridge that divides frames and provides for proper acknowledgment of each piece.
The logic to do so resides above the data link layer protocol, so the connection
between the networks must occur at a higher OSI layer. Devices that achieve this
maintain some bridge functions and assume some functions of a router.* They are
called Brouters.

Figure 6.28 Dividing a Large Frame into Smaller Ones

token bus LAN


4000-byte frame
bridge

three frames each less than 1518 bytes

Ethernet LAN

*
A router connects two networks at the OSI layer 3.
2942 | Ch 06 Page 414 Wednesday, February 16, 2000 3:30 PM

414 CHAPTER 6 LOCAL AREA NETWORKING

SOURCE LAN SOURCE LAN SOURCE LAN SOURCE LAN


L1 L2 L2 L5
DESTI- NEX NEX DESTI- NEX NEX
NATIO T DESTI- T NATIO T DESTI- T
N LA N NATION LAN N LAN NATION LAN
A — A L1 A — A L2
B L2 B — B — B L2
C L2 C — C — C L2
D L2 D — D — D L2
E L2 E — E L5 E —
F L2 F — F — F L2

SOURCE LAN S O U R C E LA N SOURCE LAN SOURCE LAN SOURCE LAN


L2 L3 L3 L4 L6
DESTI- NEX NEX DESTI- NEX NEX NEX
NATIO T DESTI- T NATIO T DESTI- T DESTI- T
N LAN NATION LAN N LAN NATION LAN NATION LAN
A — A L2 A — A L3 A L3
B — B L2 B — B L3 B L3
C L3 C — C — C L3 C L3
D L3 D — D L4 D — D L4
E — E L2 E — E L3 E L3
F L3 F — F L6 F L6 F —

Figure 6.29 Routing Tables for Bridges in Figure 6.27

to different locations. Entire LANs may be added or removed. We need correct


routing regardless of a station’s location and network topology. This will provide the
transparency that makes a network easier to use.
If we want to use routing tables in a more dynamic environment, we have two
choices. One is to reprogram the bridges every time someone adds, deletes, or
moves a station. In a dynamic environment this approach is not viable, so we are left
with the second choice: determine some way for the bridges to update their routing
tables automatically.

Transparent Bridges We call bridges that create and update their own routing
tables transparent bridges. They have their own standard (IEEE 802.1d). They
are designed so that you can plug them in and have them work immediately
regardless of topology and the stations’ locations. There is no need to tell them
where the stations are. They will determine that automatically and initialize their
routing tables. They require no special programming. If a station moves from
2942 | Ch 06 Page 417 Wednesday, February 16, 2000 3:30 PM

6.5 INTERCONNECTING LANS 417

system in the event of failures. If the first bridge fails, the second one is already in
place and there is no (or very little) delay caused by the failure. This is particularly
useful in real-time systems where delays caused by equipment failure can lead to a
disaster.
For example, the simple LAN connection of Figure 6.30 shows two bridges
between the same two LANs. Suppose the routing tables are empty and A sends a
frame to B. Since neither bridge is aware of the other, each accepts the frame and
forwards it onto LAN L2. Next, bridge B1 sees B2’s frame and B2 sees B1’s frame
on L2. Since neither knows where B is, both bridges accept the frame and forward it
onto LAN L1. Again each will see the other’s frame and forward it back to L2. Until
B identifies its location the frames will be transferred back and forth repeatedly
between both LANs.
The situation is made worse if there is a third bridge (B3) connecting the LANs.
If A sends one frame along L1, each bridge forwards it to L2, putting three frames
on L2. Each bridge sees two of them (one from each of the other two bridges) and
forwards them onto L1, putting six frames on L1. Each bridge now sees four frames
(two from each of the other two bridges) and forwards them, putting twelve frames
back on L2. This process continues, causing an explosion of frames that eventually
clogs the system and brings communication to a standstill.
We illustrated the problem with a simple topology showing two bridges
between two LANs. The potential for endlessly circulating frames exists in other
topologies as well. In particular, two distinct routes between two stations will cause
a loop in the topology. This means that a frame may leave a LAN via one route only
to return via another. Figure 6.31 shows a topology with multiple routes between A
and B. (We’ll see what the costs mean shortly.) In fact, there are at least seven routes
if we ignore routes going through the same bridge twice (can you find them?). To
see the magnitude of this problem, suppose A sends B a frame and the bridges use
the flooding algorithm. Suppose a frame takes the route from L1 to L4 through
bridges B1 and B2. Bridge B6 will forward the frame back to L1. Bridge B4 will
forward the frame to L3. From here B5 forwards it to L1, and B3 forwards it to L2.
Next B1 forwards it to L1, B2 forwards it back to L4, and the process continues. As

Figure 6.30 Two Bridges Connecting Two LANs

LAN L1

bridge bridge
B1 B2

LAN L2

B
2942 | Ch 06 Page 418 Wednesday, February 16, 2000 3:30 PM

418 CHAPTER 6 LOCAL AREA NETWORKING

LAN L1

cost = 4 cost = 4
bridge cost = 6 bridge
B1 B5
bridge
cost = 2 B6 cost = 1
cost = 5
LAN L2
cost = 2
bridge
B3
cost = 6
bridge cost = 3
B2 LAN L3
LAN L3 cost = 6
cost = 4
bridge
B4
cost = 5
LAN L4

Figure 6.31 Multiple LANs with Loops

before, the single frame causes an unending increase in the number of frames
moving through the network. If we consider the other routes from L1 to L4, the
increase is even more rapid. The number of frames becomes excessive very quickly
and the network shuts down.

Spanning Tree Algorithm One approach to this problem is to eliminate the loops
by not using certain bridges. We don’t disconnect the bridges physically, but we pre-
vent them from forwarding frames. Instead they are used as backups in case another
bridge fails. The tricky part is determining which bridges are used and when they
should automatically reconfigure if a bridge fails. As usual, we want to let the
bridges do the work themselves and make the configuration transparent to the user.
One solution calls for the bridges to execute a spanning tree algorithm. A span-
ning tree, a term from data structures, corresponds to a minimal subset of edges
taken from a connected graph that connects the graph’s vertices. The subset is min-
imal in that the spanning tree has no loops.* For more information on spanning trees,
consult a reference on data structures, such as Reference [Dr95] or [Pa95].

*
In data structures, the term cycle is often used in place of loop.
2942 | Ch 06 Page 419 Wednesday, February 16, 2000 3:30 PM

6.5 INTERCONNECTING LANS 419

To make the algorithm work, we first associate a cost with each bridge-to-LAN
connection, or bridge port. It may correspond to a bit rate at which a bridge port
can transmit onto a LAN. Typically, lower bit rates mean a higher cost. The cost of
sending a frame from one LAN to another is the sum of costs of ports in the route. In
some cases, all costs are set to 1 so that the cost of a route is simply the number of
bridges in it. Figure 6.31 shows the cost of each bridge port. The cost of sending a
frame from L1 to L4 via bridges B1 and B2 is 6, the sum of the costs of going from
B1 to L2 (2) plus B2 to L4 (4). Note that the costs associated with the B1 to L1 and
B2 to L2 ports are not included here. They are used for frames going in the other
direction.
Next, we visualize the LAN topology as a graph. The LANs and bridges are
vertices and the connections between a LAN and a bridge are the edges. Figure 6.32
shows a graphical representation of the topology in Figure 6.31. The figure lists
costs for each edge. Remember that as frames move through the graph, only costs
from a bridge node to a LAN node accrue.
The spanning tree algorithm determines a set of edges that connect all the LAN
nodes of Figure 6.32. Remember as we discuss the algorithm that we have the
advantage of seeing the entire network topology; the bridges that execute the algo-
rithm have no such view. They know only the LANs to which they are connected.
This makes the algorithm more complex than it would be if executed by a processor
that knows the entire topology.
To begin the spanning tree algorithm, the bridges elect one of their own (true
partisan politics) to be a root bridge. It is usually the one with the lowest ID,

Figure 6.32 Graph Representation of the LAN Topology in Figure 6.31

L1

4
4 6 B5
B1
B6
1

2
L3
2 B3 3
L2
6
5
6
5 B4
4 L4
B2
2942 | Ch 06 Page 421 Wednesday, February 16, 2000 3:30 PM

6.5 INTERCONNECTING LANS 421

During the election process each bridge records the cost to the root bridge
through each of its ports, and then selects the cheapest one. Figure 6.33 shows the
root ports (designated by an arrow) and paths to the root bridge (designated by red
lines). The path costs are also listed next to the arrows. For example, bridge B2’s
root port is the one connected to L2. The cheapest path is B2-L2-B1, for a cost of 6.
Remember, we only accrue costs from bridges to LANs. B4’s root port is the one
connected to L3. The path to the root bridge is B4-L3-B3-L2-B1, for a cost of 8. As
the figure shows, there are other paths but their costs are higher. You should take
some time to understand why the other root ports were chosen as they were.
The last step determines the designated bridge for each LAN. The root ports
connect bridges to some LANs, but there may be other LANs that are not part of the
developing connection scheme. For example, in Figure 6.33 there is no root port
connected to L4, and we need to determine a bridge to forward information from L4.
To do this, bridges B2, B4, and B6 send BPDUs along L4 requesting to be the desig-
nated bridge. B4 states that its cost to the root bridge is 8; B2 and B6 indicate their
cost to be 6. Consequently, B4 gives up its request because of its higher cost and B6
gives up its request because of its higher ID. Thus, B2 becomes the designated
bridge for L4. Proceeding similarly, B3 is the designated bridge for L3, and B1 is
the designated bridge for L1 and L2 (Figure 6.34).
Figure 6.34 shows the resulting spanning tree and Figure 6.35 relates it to the
original network topology. The dotted lines indicate physical but not active connec-
tions. The bridges use these connections to send and receive BPDUs but not to for-
ward frames in general. The tree connects all the LANs even though some of the

Figure 6.33 Graph After Determining Root Ports

L1

4
4 6 B5
root B1 cost = 6 cost = 3
B6
1 Indicates root port.
2
Denotes cheapest path
L3
2 B3 from each bridge to the root
3
bridge B1. Only costs from
L2 cost = 2 a bridge to a LAN are accrued.
6
5
cost = 8
6
5 B4
4 L4
cost = 6 B2
2942 | Ch 06 Page 422 Wednesday, February 16, 2000 3:30 PM

422 CHAPTER 6 LOCAL AREA NETWORKING

L1

4 B5
root B1
B6

2
L3
2 B3 3
L2

6
B4
4 L4
B2

Figure 6.34 Graph After Determining Designated Bridges

bridges are not used. That is to be expected, however, as the bridges are redundant
devices to be used in the event of a failure of another one. As long as no failure
occurs, the LANs communicate using the topology of Figure 6.35.
In order to detect a bridge failure and reconfigure the connection scheme, each
bridge maintains a timer called a message age timer. During the specified time,
each bridge (even the ones not part of the spanning tree) expects to hear from the
root bridge confirming its status as root bridge. When a bridge receives this confir-
mation, it resets its timer. The root bridge, of course, cooperates by sending a config-
uration BPDU periodically to confirm its status. If a bridge malfunctions, one or
more bridges do not receive a configuration BPDU and their timers expire. If a
bridge other than the root bridge fails, the affected bridges exchange BPDUs to elect
a new designated bridge for their LANs. If the root bridge fails they must elect a new
root bridge. Either way, they reconfigure the active topology dynamically.

Source Routing Bridges The last approach to forwarding frames on a LAN inter-
connection puts the burden of routing on the individual stations instead of the
bridges. Specifically, network software at the sending station determines a route to
the destination and stores it in the frame (Figure 6.36). The route consists of a
sequence of route designators, each consisting of a LAN and a bridge ID. When a
bridge sees a frame, it determines whether there is a designator containing its ID and
the ID of the LAN carrying the frame. If so, the bridge accepts the frame and for-
wards it to the LAN specified in the next designator.
For example, suppose A sends B (from Figure 6.31) a frame and specifies the
route as L1-B5-L3-B4-L4. Both bridges connected to L1 see the frame, but since B5
2942 | Ch 06 Page 423 Wednesday, February 16, 2000 3:30 PM

6.5 INTERCONNECTING LANS 423

LAN L1

cost = 4
bridge bridge
B1 B5
bridge
cost = 9 B6

LAN L2
cost = 2
bridge
B3
cost = 6
bridge cost = 3
B2 LAN L3
cost = 4 LAN L3
bridge
B4

LAN L4

Figure 6.35 Network Topology Showing Active Bridge Connections

follows L1 in the sequence only B5 accepts it. B5 then forwards the frame to L3,
where bridges B3 and B4 see it. Similarly, since B4 follows L3 in the sequence only
B4 accepts the frame. Finally, B4 forwards the frame to L4, where station B eventu-
ally receives the frame.
At first this may seem like a variation of the fixed-routing strategy discussed at
the beginning of this section. Each station must be aware of the interconnection
strategy and be able to specify a path to any other station. It may seem the only way
to do this is to program the topology’s structure into each station, which would

Figure 6.36 Partial Frame Format for Source-Routing Bridges

routing field

........ destination ..... control 1st route 2nd route ..... last route ......
address designator designator designator

control = routing field length route designator = LAN#, bridge#


routing type
route direction
2942 | Ch 06 Page 425 Wednesday, February 16, 2000 3:30 PM

6.5 INTERCONNECTING LANS 425

A
frame with no routing information

L1
L1-B1
B1
L1-B3
L1-B1 L1-B3-L3-B1

B3

L2
L1-B3

B2
L3

L1-B1-L2-B2 L1-B3-L3-B1-L2-B2 L1-B1-L3-B4 B4 L1-B3-L3-B4

L4

Figure 6.37 Sending an All-Routes Broadcast Frame

redundant bridges increases, so does the number of routes and the number of frames
on the network.
Another approach to route discovery has the sending station transmit a
single-route broadcast frame. Like the all-routes broadcast frame, it contains
no routing information. This time, instead of broadcasting to all LANs each
bridge forwards a frame only through a port that is part of a spanning tree. In this
case the destination receives just one request. However, instead of relying on the
spanning tree’s route the destination station sends an all-routes broadcast frame
as its response. The bridges forward the all-routes broadcast frame as before,
determining the route as they do so. Eventually the source station receives many
responses, one for each route and, as before, can choose the one it wants for sub-
sequent frames. The advantage of this approach is that there are fewer frames
traveling from source to destination (although there are just as many going the
other way). The disadvantage is that the bridges must determine the spanning
tree first.
2942 | Ch 06 Page 428 Wednesday, February 16, 2000 3:30 PM

428 CHAPTER 6 LOCAL AREA NETWORKING

client workstation client workstation

client workstation
client workstation file server

print server

client workstation
printer printer printer

Figure 6.38 Novell Network

number of requests more efficiently. Also, security is usually more of a concern and
providing a sharp distinction between client and server hardware aids security
efforts.
Another PC may be designated as a print server. Its job is to allow users to
access shared printers. A print server manages both requests and printers. It analyzes
a print request and determines the type of printer (i.e., what format or model) on
which it should be printed. It then stores requests in a queue to await the printer. In
general, one print server can manage several printers. Conversely, several print
servers may have access to a common printer. Consequently, NetWare protocols
must allow print servers to access common files. The print server also allows users
to examine the queues, request status on queue entries, and even delete them.
While these are perhaps the most visible servers, there are others. A message
server will transfer email messages between a client PC and a user’s mailbox. A
database server is common in a client/server database system. We will discuss client/
server systems in Chapter 7, but essentially it is a mode of operation in which an
activity involves processing both at the user and application ends. For example, a typ-
ical scenario has a user making a request for a database search. Software at the user
end (client software) may accept a user request and format it into a standard form
required by the database system. The request is then sent to the database server, which
performs the search and returns the results to the user. Client software may then inter-
cept the response and display the results in a specific format requested by the users.
2942 | Ch 06 Page 430 Wednesday, February 16, 2000 3:30 PM

430 CHAPTER 6 LOCAL AREA NETWORKING

OS com-
mands sent
to OS for
processing. IPX creates and file server
OS routes packets to
the file server via
the network.
NetWare shell
NetWare
Intercept user protocols network
input and deter-
mine where to Accept input and
route it. create
formatted request
defined by the
NCP protocol.

Figure 6.39 NetWare Handling User Requests

analyzes the request and determines whether the operating system or NetWare
should handle it. If it is destined for the operating system (OS), the requester passes
it on and does not involve the network or any NetWare software.
If the user input is destined for NetWare service, the shell creates and formats a
request according to the definitions of the NetWare core protocol (NCP). NCP
defines the types of requests that can be made and how the server responds to the
request it eventually receives. Once the request has been properly formatted
according to NCP, the shell then gives it to the Internetwork Packet Exchange
(IPX), a protocol used to establish and maintain connections between network
devices. IPX determines source and destination addresses and stores them in a
packet along with the request. When the server receives the packet, it extracts the
data, determines the request as defined by NCP, and responds accordingly. IPX does
not guarantee packet delivery. Another protocol, Sequenced Packet Exchange
(SPX), monitors packet transmissions to ensure proper delivery. Similar to the flow
control protocols of Chapter 5, SPX sends and receives acknowledgments. If it does
not receive an expected acknowledgment it will call on IPX to resend the packet.
All packets must eventually pass through a NIC and onto the actual network. A
network driver is the interface that ensures that packets are sent according to the
network protocol. It is important to realize that network protocols differ from Net-
Ware protocols. NetWare defines the rules and formats to respond to clients’
requests. The network protocol, such as token ring or Ethernet, defines how the
packets are actually transmitted. Using a network driver builds flexibility into the
system and allows IPX to send packets over a variety of different networks.
To give the system even more flexibility, Novell has added another component
to its protocol called the Open Data-link Interface (ODI). It allows greater inter-
connectivity among devices and networks running different protocols by providing
multiple network connections through a single NIC. ODI contains a link support
2942 | Ch 06 Page 433 Wednesday, February 16, 2000 3:30 PM

6.6 CASE STUDY: NOVELL NETWARE 433

directory A

subdirectory subdirectory subdirectory


X Y Z
(IRF blocks road access)

Figure 6.40 Filter to Block Inherited Rights

For example, suppose subdirectory Z had an IRF that filtered out read access. Then
no one in the group would have an inherited right to read anything in subdirectory Z.
This still doesn’t solve our problem since we want the group leader to have read
access to Z. However, this can be done by specifically granting read access to that
individual.
In the first case, the default allowed everyone read access to Z and it had to be
removed explicitly for each member except the leader. In the second case, the
default allowed no one read access to Z. However, the leader could be granted read
privilege explicitly, thus overriding the default. The second case provides an easier
way of assigning the desired rights correctly.
In addition to providing security, NetWare protects the integrity of information
when related updates must be made to several files. For example, suppose a company
database maintains a list of its sales personnel and customers. Each salesperson’s
record contains a reference to one or more customers for which he or she is respon-
sible (Figure 6.41a). If the company loses a customer, not only is the customer’s

Figure 6.41 Maintaining Consistent Files in NetWare

salesperson’s customer’s
record record

sales personnel file customer file


(a) Status of files prior to losing customer

salesperson’s nonexistent
record entry

sales personnel file customer file


(b) Status of files after losing customer
and after network protocol error
prevents the customer’s reference
from being deleted.
2942 | Ch 06 Page 434 Wednesday, February 16, 2000 3:30 PM

434 CHAPTER 6 LOCAL AREA NETWORKING

record deleted from the database but any references to it from the salesperson’s file
also must be deleted. If the customer record was deleted and a network protocol error
then prevented the reference to it from being deleted (Figure 6.41b), the database
would be inconsistent. To prevent this situation, NetWare provides a transaction
tracking system (TTS) that allows multiple updates to files to be regarded as a
single transaction. TTS performs all of the updates or none at all. If it performed
some of the updates and a protocol error prevented the others from being completed,
TTS would restore the affected records to their pretransaction values.
Hardware failures can be devastating, as anyone who has ever experienced a
head crash (contact between the disk head and disk) knows. Eventually, all disk
drives will fail. In some cases, only the drive mechanism fails, allowing the disk to
be removed and inserted in another drive. In other cases, the disk’s directory is dam-
aged but special utilities can often recover the data on it. If the cause is a head crash,
however, the disk surface may be destroyed, making any recovery impossible.
NetWare provides two ways of reducing such problems (Figure 6.42). Both
make duplicate copies of updated data by copying it onto different disks, but they
differ in how that is done. Disk duplexing uses two different controllers connected
to the server. When the server must make a change, both controllers write the
updated data to their respective disks. With disk mirroring, one controller writes
the information on two different disks. Disk duplexing is faster because two control-
lers are doing the work of one. It is also more reliable. If one controller fails, the
other can proceed with required changes. On the other hand, disk mirroring provides
a more economical approach.

S ELECTED N OVELL C OMMANDS


Perhaps nothing gives a user a better feel for how software works than a description
of the commands he or she uses to interact with it. For this reason we provide a brief
description of some of NetWare’s more common commands. This is not a complete

Figure 6.42 Disk Mirroring and Duplexing

server server

controller

controller controller

(a) Duplexing (b) Mirroring


2942 | Ch 06 Page 437 Wednesday, February 16, 2000 3:30 PM

6.6 CASE STUDY: NOVELL NETWARE 437

1 BREAK OFF
2 MAP DISPLAY OFF
3 FDISPLAY SYS:PUBLIC/WELCOME.MSG
4 MAP S1:=SYS:SOFTWARE/PCAPPS
5 MAP S2:=SYS:SOFTWARE/WEBAPPS
6 IF MEMBER OF "COMPSCI" THEN
7 MAP S3:=SYS:SOFTWARE/LANGUAGE
8 #CAPTURE Q=CS_HPPL5 NB NFF
9 END
10 IF MEMBER OF "STATS" THEN
11 MAP S3:=SYS:SOFTWARE/STATLAB
12 #CAPTURE Q=STAT_LASER NB NFF
13 END
14 IF DAY_OF_WEEK = "MONDAY" THEN
15 FDISPLAY SYS:PUBLIC/MONDAY.MSG
16 FIRE PHASERS 5 TIMES
17 END
18 MAP H:=SYS:USERS/%LOGIN_NAME
19 DRIVE H:

Figure 6.43 System Login Script

SOFTWARE/PCAPPS directory in the SYS volume and line 5 maps driver letter
Y to the SOFTWARE/WEBAPPS directory in the same volume. The directory
names, of course, are site dependent.
Lines 6 through 17 show how NetWare can define the working environment
for different user groups. In general the network manager can set up a collec-
tion of groups, each containing users with similar needs. In our example, we
assume there are two groups named COMPSCI and STATS that correspond to
people whose area of expertise is in computer science or statistics. When log-
ging in, the system script can check to which group the user belongs using an
IF-THEN command statement. The script IF statement is just like the IF statement
in your favorite language. It tests a condition and, if true, executes specified
statements.
Conditions can take several forms in a NetWare script, but line 6 checks
whether the current user is a member of the COMPSCI group. If so, line 7 maps
search drive S3 (actually, drive X) to the SOFTWARE/LANGUAGE directory set up
for that group. Presumably, it contains language compilers for which no other user
has a need. Lines 10 and 11 check whether the user is a member of the STATS group
and, if so, assigns search drive S3 to an entirely different directory containing some
statistical software. Thus, a user in either group has search drive S3 locating soft-
ware or tools relevant to his or her needs (Figure 6.44).
2942 | Ch 07 Page 450 Thursday, February 17, 2000 1:18 PM

450 CHAPTER 7 WIDE AREA NETWORKING

network network

data link data link data link data link data link data link

physical physical
physical physical
physical repeater physical
bridge
(a) Layer 1 connection (b) Layer 2 connection

transport transport application application


application application

network network
network network

data link data link data link data link data link data link data link data link

physical physical physical physical


physical physical physical physical
router gateway
(c) Layer 3 connection (d) Layer 7 connection

Figure 7.1 OSI Connections

In theory, two different networks may differ at any of the OSI layers. The logic
required to connect them becomes more complex as the number of layers where
they differ increases. In the extreme case, there may be total incompatibility (up
through layer 7). For example, they may use different codes, encryption techniques,
or compression techniques. They may use different rules for establishing and main-
taining connections. In such cases, a connection at layer 7 called a gateway (Figure
7.1d) converts between protocols.
This chapter discusses some of the issues of WAN design and protocols. For
example, Section 7.2 discusses routing, the logic required by network nodes to make
sure information gets to its destination. It will present and compare a few common
strategies and will address problems, such as congestion, caused by poor routing
decisions. Section 7.3 discusses a popular WAN called a packet-switched network,
one that divides all its information into packets and transmits them individually. This
section also discusses the ITU X.25 protocol, which is commonly used to connect to
packet-switched networks.
2942 | Ch 07 Page 452 Thursday, February 17, 2000 1:18 PM

452 CHAPTER 7 WIDE AREA NETWORKING

Z
X W
A

D
B
C

Y
T

Figure 7.2 Generalized Network Topology

people will choose to drive a longer distance if it means using a road that has more
lanes, is in better condition, or has more rest stops than a shorter alternative. Even
though they drive farther they may reach their destination more quickly and with
less difficulty.

R OUTING T ABLES
Similar to the bridges shown in Section 6.5, network nodes may use routing tables.
Like those in Section 6.5, routing tables here do not normally specify the entire
route. Instead they specify the next node in a route to a specified destination and the
cost to get there. For example, consider the network in Figure 7.3, where a cost is
associated with the connection between two adjacent nodes. Suppose we want to
find the cheapest route, the one that minimizes the sum of the costs of the connec-
tions between adjacent nodes in the route. For example, there are several routes from

Figure 7.3 Network and Associated Connection Costs

B 5 D
2
4
3 7
A

4 F
1
7 2
C 6
E
2942 | Ch 07 Page 452 Thursday, February 17, 2000 1:18 PM

452 CHAPTER 7 WIDE AREA NETWORKING

Z
X W
A

D
B
C

Y
T

Figure 7.2 Generalized Network Topology

people will choose to drive a longer distance if it means using a road that has more
lanes, is in better condition, or has more rest stops than a shorter alternative. Even
though they drive farther they may reach their destination more quickly and with
less difficulty.

R OUTING T ABLES
Similar to the bridges shown in Section 6.5, network nodes may use routing tables.
Like those in Section 6.5, routing tables here do not normally specify the entire
route. Instead they specify the next node in a route to a specified destination and the
cost to get there. For example, consider the network in Figure 7.3, where a cost is
associated with the connection between two adjacent nodes. Suppose we want to
find the cheapest route, the one that minimizes the sum of the costs of the connec-
tions between adjacent nodes in the route. For example, there are several routes from

Figure 7.3 Network and Associated Connection Costs

B 5 D
2
4
3 7
A

4 F
1
7 2
C 6
E
2942 | Ch 07 Page 453 Thursday, February 17, 2000 1:18 PM

7.2 NETWORK ROUTING 453

A to F, but the cheapest one goes from A to B (cost of 2), B to E (cost of 3), and E to
F (cost of 2) for a total route cost of 7.
Figure 7.4 shows partial routing tables of nodes A, B, and E. (We will discuss
how these tables are created shortly.) Node A’s table indicates that anything destined
for node B, E, or F should be sent directly to B, where B’s routing table will indicate
the next node in the cheapest route. Similarly, anything destined for C or D should
be sent to node C. From there, C’s routing table indicates the next step.
To illustrate, suppose an application at node A wants to send data to node F.
Logic at A looks for an entry in its routing table with destination F. The entry states
that node B is the successor on the route, and the network protocol sends the data to
B. Logic at B examines its routing table looking for an entry corresponding to desti-
nation F. The table’s third entry indicates the data should go to node E next. Finally,
the routing table at node E indicates that F is the next node on the route.

T YPES OF R OUTING
Who defines the routing tables and how? The process by which a routing table is
defined is called a routing algorithm. There are several basic types, and we will
discuss four of them: centralized routing, distributed routing, static routing, and
adaptive routing. Then we will discuss in detail some specific routing algorithms.

Centralized Routing Centralized routing means that all interconnection infor-


mation is generated and maintained at a single central location. That location then
broadcasts this information to all network nodes so that each may define its own
routing tables. One way to maintain routing information centrally is a routing
matrix. It consists of a row and column for each node in the network. A row corre-
sponds to a source node, and a column to a destination node. The entry in the posi-
tion specified by the row and column indicates the first node in the route from the
source to the destination. From this entry the entire route can be extracted.
Figure 7.5 shows a routing matrix for the network in Figure 7.3. As before, the
routes selected are the cheapest ones. In the case where two routes both have the

Figure 7.4 Partial Routing Tables for Nodes A, B, and E

NEXT NEXT NEXT


DESTINATION NODE COST DESTINATION NODE COST DESTINATION NODE COST
B B 2 D D 5 F F 2
C C 1 E E 3
D C 5 F E 5
E B 5
F B 7
(b) Partial routing table for (c) Partial routing table for
(a) Partial routing table for node A node B node E
2942 | Ch 07 Page 454 Thursday, February 17, 2000 1:18 PM

454 CHAPTER 7 WIDE AREA NETWORKING

A B C D E F
A — B C C B B
B A — A D E E
Source Node C A A — D E F
D C B C — F F
E B B C F — F
F E E C D E —

Figure 7.5 Routing Matrix for the Network in Figure 7.3

cheapest cost, one is chosen arbitrarily. Consider again the route from A to F.
According to the matrix’s first row and sixth column, node B is the first one in the
cheapest route. The next node is determined by considering the route from B to F.
Examining the second row and sixth column indicates that node E is next. Finally,
the node following E (node F) is found in the fifth row and sixth column. Thus, the
route is from A to B to E to F.
Creating a routing table for a network node requires the row from the matrix
corresponding to the node. For example, node A’s routing table in Figure 7.4 (minus
the cost*) is the same as row 1 of the matrix. Similar statements can be made for the
other nodes.

Distributed Routing Distributed routing means there is no central control.


Each node must determine and maintain its routing information independently. It
usually does this by knowing who its neighbors are, calculating the cost to get
there, and determining the cost for a neighbor to send data to specific destinations.
Each neighbor, in turn, does the same thing. From that information each node can
derive its own routing table. This method is more complex than centralized
routing because it requires each node to communicate with each of its neighbors
independently.
It is difficult to appreciate the complexity of this approach because examples
typically show a global view of a network with its connections and their costs. This
overview can bias the way we see the strategy unless we constantly remind our-
selves that one node’s knowledge of the entire network is very limited. To illustrate,
consider the network shown in Figure 7.6. Assume that each node initially knows
only the cost to its neighbor; later it can add to its information base anything its
neighbors tell it. For example, A initially knows only that it can send something to B
(cost = 1) or to D (cost = 2). It has no knowledge whatsoever that nodes C and E
even exist. Other nodes have similar knowledge (or lack of it). However, if neigh-
boring nodes communicate, A learns the identity of B’s and D’s neighbors and soon

*
We did not include costs in the routing matrix, but it is a simple matter to do so by storing the cost with
each node in the matrix.
2942 | Ch 07 Page 455 Thursday, February 17, 2000 1:18 PM

7.2 NETWORK ROUTING 455

A D
2

7
1 2 E

4
B C

Figure 7.6 Network Example for Distributed Routing

learns of nodes C and E. By learning of B’s and D’s costs to get there, and knowing
the cost to get to B and D, node A can calculate the cost to get to C and E. By period-
ically exchanging information about neighboring nodes, each one learns the identity
of others in the network and the cheapest paths to them. Shortly we will discuss a
specific distributed algorithm to do this.

Static Routing Static routing means that once a node determines its routing table,
the node does not change it. In other words, the cheapest path is not dependent on
time. There is an underlying assumption that the conditions that led to the table’s def-
inition have not changed. This is sometimes a valid assumption because costs often
depend on distances and the data rates between intermediate nodes. Except for major
equipment upgrades and moving of equipment, these parameters do not change.

Adaptive Routing Static routing works well as long as network conditions do not
change. In some networks, however, this is a bad assumption. For example, if the
cost of each link depends on network traffic, it is time dependent. Consider the
problem of sending packets from node A to node E in the network of Figure 7.6. The
optimal route is A-D-C-E. Suppose that after node A transmits the packet to node D,
the D-C link and the D-E link costs each increases to 10 because of a surge of heavy
traffic. The cheapest route from A is now A-B-C-E, and the route on which the
packet embarked initially is now very expensive. In this case it would actually be
cheaper to send the packet back to A and start over again. An adaptive routing
strategy allows a network node to respond to such changes and update its routing
tables accordingly.
There are pitfalls to this system. For example, suppose that in our current
example D does send the packet back to A and then the cost of the A-B link increases
to 10. The logical choice would be to send the packet back to D. You can now see the
problem: Conceivably, the packet could shuttle back and forth among several nodes,
never making any progress toward its eventual destination. One technique to avoid
this maintains a counter in the packet header that is incremented on each transmis-
sion. If the count exceeds some value, the packet is removed from the network. In
such cases the routing logic will not guarantee delivery of the packets. However,
2942 | Ch 07 Page 457 Thursday, February 17, 2000 1:18 PM

7.2 NETWORK ROUTING 457

Figure 7.7 shows an outline of the algorithm. Initially, it defines a set S con-
sisting of just one node, A, the node executing the algorithm. It then defines a func-
tion where, for each node X, Cost(X) = the cost of the cheapest route from A to X for
which intermediate nodes are in S. Initially, since S contains only node A, Cost(X) is
the cost of a direct link from A to X. If there is no such link, Cost(X) is assigned an
arbitrarily large number. The function Prior(X) in the algorithm contains the node
preceding X in the cheapest route.
The algorithm contains a loop. With each pass it determines a set W consisting
of all nodes not in S but with a direct link to something in S (Figure 7.8). It chooses
one node X in W for which Cost(X) ≤ Cost(Y) for any other node Y in W. It then adds
X to set S and updates the cost function Cost(V) for every V not yet in S. It compares
the current Cost(V) with Cost(X) plus the cost of any direct link from X to V. If the
latter value is smaller, the algorithm redefines Cost(V) to be that value. The intent is
to determine whether the addition of X to S allows a cheaper route from A to V
through nodes in S.
The correctness of the algorithm is not obvious, and proof that it is correct
exceeds the goals of this text. For a more formal treatment, see Reference [Ah83].
We will, however, apply this algorithm to the example network of Figure 7.9.
Table 7.2 shows the values the algorithm generates when applied to this network.
In step 1, the set S contains only the source node A. The only nodes connected to A
are B and C, and the costs of those edges are 2 and 1, respectively. Consequently,
Cost(B) = 2 and Cost(C) = 1. Initial values for Cost(D), Cost(E), and Cost(F) are
arbitrarily large and are designated by ∞. Also, Prior(B) = A and Prior(C) = A.
Since the algorithm has not yet found any routes to D, E, and F, the Prior function
is undefined at those nodes.
As we enter the loop, the set W contains nodes B and C, because they are the
only ones connected to A. Next, since Cost(C) < Cost(B), we choose X = C and add
it to S. The last line in the loop now requires that we examine Cost(V) for each V not

Figure 7.7 Dijkstra’s Algorithm

Define S as a set of nodes. Initially S contains node A.


Define Cost(X) as the cost of the cheapest route from A to X using only nodes from S
(X excepted). Initially, Cost(X) is the cost of the link from A to X. If no such
link exists, then Cost(X) is an arbitrarily large value (larger than any possible
route cost). For those nodes linked to A define Prior(X) = A.
do {
Determine the set of nodes not in S, but connected to a node in S. Call this set W.
Choose a node X in W for which Cost(X) is a minimum. Add X to the set S.
For each V not in S, define Cost(V) = minimum {Cost(V), Cost(X)+cost of link
connecting X to V}. If Cost(V) is changed define Prior(V) = X.
}
while not all nodes in S.
2942 | Ch 07 Page 458 Thursday, February 17, 2000 1:18 PM

458 CHAPTER 7 WIDE AREA NETWORKING

S = nodes to which cheapest route from A is known.


W = nodes connected to a node in S via a direct link.
S
direct link
W
route

X
put this node in S

Is there a cheaper route


to V through X whose
cost is Cost(X) + cost
A V from X to V?

Cost(V) represents cost of the current route (if it exists) from A to V

Figure 7.8 Adding Nodes to S Using Dijkstra’s Algorithm

B D
3
2 4 2
A 7

1 3 F
6
7
6
C
E

Figure 7.9 Network and Associated Connection Costs

yet in S. This consists of nodes B, D, E, and F. Since the cost function represents the
cheapest path from A through nodes in S, we must ask whether the additional node
in S provides a cheaper route. In other words, consider any node V not in S. If
Cost(C) plus the cost of the direct link connecting C to V is less than Cost(V), then
the route from A to C followed by the link from C to V represents a cheaper route.
Table 7.3 shows the necessary comparisons for each node V not in S. For nodes D, E,
and F, the latter values are smaller, and node C is established as their prior node. The
second row of Table 7.2 reflects these changes.
The second pass through the loop proceeds similarly. Node B is added to S
because Cost(B) is smallest among nodes outside of S. Furthermore, the inclusion of
2942 | Ch 07 Page 458 Thursday, February 17, 2000 1:18 PM

458 CHAPTER 7 WIDE AREA NETWORKING

S = nodes to which cheapest route from A is known.


W = nodes connected to a node in S via a direct link.
S
direct link
W
route

X
put this node in S

Is there a cheaper route


to V through X whose
cost is Cost(X) + cost
A V from X to V?

Cost(V) represents cost of the current route (if it exists) from A to V

Figure 7.8 Adding Nodes to S Using Dijkstra’s Algorithm

B D
3
2 4 2
A 7

1 3 F
6
7
6
C
E

Figure 7.9 Network and Associated Connection Costs

yet in S. This consists of nodes B, D, E, and F. Since the cost function represents the
cheapest path from A through nodes in S, we must ask whether the additional node
in S provides a cheaper route. In other words, consider any node V not in S. If
Cost(C) plus the cost of the direct link connecting C to V is less than Cost(V), then
the route from A to C followed by the link from C to V represents a cheaper route.
Table 7.3 shows the necessary comparisons for each node V not in S. For nodes D, E,
and F, the latter values are smaller, and node C is established as their prior node. The
second row of Table 7.2 reflects these changes.
The second pass through the loop proceeds similarly. Node B is added to S
because Cost(B) is smallest among nodes outside of S. Furthermore, the inclusion of
2942 | Ch 07 Page 460 Thursday, February 17, 2000 1:18 PM

460 CHAPTER 7 WIDE AREA NETWORKING

C
A Z

Figure 7.10 Cheapest Route from A to Z

 cost of link from A to B + cost of cheapest route


from B to Z

 cost of link from A to C + cost of cheapest route

Cost ( A, Z ) = smallest of  from C to Z

...


 cost of link from A to D + cost of cheapest route

 from D to Z
According to this principle, node A can determine the cheapest route to Z as
long as A knows the cost to each neighbor and each neighbor knows the cheapest
route to Z. Node A then can perform the preceding calculation and determine the
cheapest route. But how does each neighbor know the cheapest route to Z? The
answer is in how the algorithm works. There are both centralized and distributed
versions of the algorithm. Having already discussed a centralized algorithm, we will
present the distributed version.
As mentioned previously, each node knows only the cost to each neighbor and
any information the neighbor can provide. Thus, in the distributed algorithm each
node broadcasts what it knows to each of its neighbors. Each node receives new
information and updates its routing tables accordingly. As the neighbors continue to
broadcast the information periodically, information about each of the network nodes
and connections eventually propagates throughout the network. Information coming
in to nodes may allow them to discover new nodes and new cheapest paths to other
nodes.
To illustrate, we apply the algorithm to the network in Figure 7.11. Each node
maintains information on the cheapest route to other nodes. It contains the route’s
cost and the first node on that route. Initially, each node knows only the cost to get to
its neighbor. Table 7.4a shows how this information is stored. Each row corresponds
to a source and each column to a destination. Each table entry contains the first node
on the route and the route’s cost. In Table 7.4a the first node on a route is always the
2942 | Ch 07 Page 461 Thursday, February 17, 2000 1:18 PM

7.2 NETWORK ROUTING 461

A D
2

7
1 2 E

4
B C

Figure 7.11 Network for the Bellman-Ford Algorithm

same as the node in the column heading because no routes other than those to neigh-
bors are known yet. This situation will change as the algorithm proceeds, however.
Keep in mind that although this table lists a row and column for each node, each
node knows only what is in a row corresponding to it. For example, A knows only
that the costs to B and D are 1 and 2, respectively; B knows only that the costs to A
and C are 1 and 4, respectively; and so on. Some nodes may not even know of
others’ existence. For example, A does not know nodes C and E exist. B does not
know nodes D and E exist; and so on. This is indicated by Unknown in the table.
Figure 7.12 contains a pseudocoded version of the algorithm.* Initially, a node
stores information about routes to its neighbors in its routing table. The first while
loop indicates that the algorithm continually monitors information coming in from
its neighbors. Inside the loop a node receives information from each of its neigh-
bors.† From each neighbor it learns of nodes to which the neighbor has access and
the costs of the associated routes. For each node Z to which a neighbor N has access
there are two possibilities:
1. The current node has no previous knowledge of Z. The current node inserts the
entry (N, current cost to N + N’s cost to Z) in its routing table. The current node
now knows of a route to Z via N.
2. The current node already has a route to Z. The current node compares the cost of
that route with the cost of going to N plus N’s cost to Z. If the latter value is
smaller the current node has found a cheaper route to Z. It replaces its current
cost with the cheaper one and specifies N as the new first node along a route to Z.
Table 7.4b shows how each node’s information changes as each of its neighbors
tells it what it knows. B tells A it has access to C with a cost of 4. Since A knows it
already has access to B with a cost of 1, it concludes it now has access to C with a
cost of 5 (cost to B plus cost from B to C). Similarly, D also tells A it has access to C
but with a cost of 2. Node A now concludes that it has access to C via D with a total
cost of 4. Since this is cheaper than going through B, it inserts the entry (D, 4) in its
routing table (Table 7.4b). D also tells A that it has access to E with a cost of 7. Since
2942 | Ch 07 Page 463 Thursday, February 17, 2000 1:18 PM

7.2 NETWORK ROUTING 463

For each neighbor insert the entry (neighboring node, link cost) in the current
routing table.
while network protocols baffle me do
for each neighboring node N do
{
receive information from N’s routing table;
for each node Z in N’s routing table do
if Z is not in the current routing table
insert the pair (N, current cost to N + N’s cost to Z) in it;
else
if the current cost to N + N’s cost to Z < current cost to Z
replace the current cost to Z with the current cost to N + N’s cost to Z and
specify N as the new first node along a route to Z;
}

Figure 7.12 Bellman-Ford Algorithm

with a cost of 6 and a route to E with a cost of 6. Assimilating this information


and choosing the cheapest routes, row 2 of Table 7.4b shows B’s new routing
information.
After each node has heard from each neighbor once, Table 7.4b shows each
node’s routing table. At this point each node knows the best way to get to each
neighbor and to each of its neighbor’s neighbors. However, it may not yet know of
any optimal routes requiring three or more links. Thus, each node goes through
another round of gathering information from each neighbor and determining
whether there are better routes. For example, A knows from Table 7.4b that the
cheapest route to E is via D for a total cost of 9. However, when A hears from D
again it learns that D can now get to E with a cost of 4. Therefore, since the link cost
from A to D is 2, A now concludes it can get to E via D with a total cost of 6. You
should follow all the steps of the algorithm in Figure 7.12 and verify the entries in
Table 7.4b and 7.4c.

*
This algorithm is not complete because there are cases in which it will fail. However, our intent now is to
illustrate the concept of backward learning in order to find shorter paths. We will examine shortcomings
of this version later.

Although the algorithm depicts an orderly sequence of receptions from each neighbor, it will almost
certainly not happen this way. The actual reception of information depends on many real-time events
and is very unpredictable. Our main goal is to describe how a node responds to that information, so the
algorithm serves our purposes.
*
Exactly what B receives from A depends on whether A sent information before or after it received
information from D. Since we cannot guarantee the timing, we will assume that each node sends what it
has at the beginning of each step.
2942 | Ch 07 Page 468 Thursday, February 17, 2000 1:18 PM

468 CHAPTER 7 WIDE AREA NETWORKING

Suppose node X wants to send a packet to node Y. If they are in the same domain
the route can be determined using any of the previously discussed techniques. On
the other hand, suppose they are in different domains (Figure 7.13). Node X sends
the packet to router A within its domain. Node A then has the responsibility of deter-
mining the best route to node Y’s domain (domain 2) and sending the packet. Since
node B is a router for domain 2, it receives the packet and then sends it to node Y.
This approach applies for any pair of nodes from domains 1 and 2. Effectively, A is
performing necessary routing on behalf of any node in its domain, thus reducing the
total number of nodes that must perform such tasks.
We can represent the domain concept using a hierarchical structure (Figure 7.14).
All domains correspond to second-level tree nodes under a common root.* All net-
work nodes within a domain correspond to third-level tree nodes under the domain. If
the domain contains subdomains they also are third-level tree nodes, and any network
nodes in them are at the fourth level under the appropriate subdomain.
In general, network routers are defined partly by the hierarchy. Thus, suppose Z in
Figure 7.13 wants to send a packet to X. Since Z is in subdomain 1, it sends the packet
to W, the router for Z’s subdomain. In turn, W routes across subdomains to C, the router
for domain 3. C then routes across domains to A, which finally sends the packet to X.
So far we have omitted one detail. For hierarchical routing to work, the sending
node specifies the destination’s address, including its domain and any subdomains.
By including the address, each router determines whether the destination is in the
current domain (or subdomain). If it is, the router can deliver the packet. If not, the

Figure 7.13 Domains in Hierarchical Routing

designated nodes

X A
B

Domain 2
Domain 1

Subdomain 2 C

W
Subdomain 1
Z
Note: Example assumes only
Domain 3 one designated node per domain.

*
Don’t think of the root as an actual network node. It simply means all its dependents (domains) are
connected.
2942 | Ch 07 Page 469 Thursday, February 17, 2000 1:18 PM

7.2 NETWORK ROUTING 469

Root

Domain 1 Domain 3
Domain 2

X A other other Subdomain 1 Subdomain 2


Y B
nodes nodes
Z W other other
C
nodes nodes

Figure 7.14 Hierarchical Arrangement of Domain Nodes

router must determine the domain to which the packet must go. This is similar to
sending letters via the postal system using the typical address format,
Name
Street address
City, State, Zip code
Postal workers in Hartford, Connecticut, don’t care if a letter is addressed to
Jane Smith at 123 Main Street unless the city and state are also specified as Hart-
ford, Connecticut. If the city and state are different, the Hartford postal workers’
routing responsibility is to make sure the letter is sent to the appropriate city, where
that city’s postal workers deliver letters according to address and name. Similarly, a
network node specifies an address as a sequence of domain and subdomain speci-
fiers. For example, in Figure 7.13 node X might send a packet to node Z by
addressing it to Z.subdomain-1.domain-3.
The Internet is a network that uses hierarchies in its addressing scheme. The
hierarchy reflects the fact that the Internet is actually a collection of networks, each
with its own set of protocols. Universities, companies, and government agencies
typically have a network connecting their computers. These networks, in turn, may
also be part of the Internet.
An Internet address is a 32-bit number represented as a sequence of four 8-bit
numbers separated by dots. For example, the author’s Internet address is
143.200.128.3, where each of the four numbers has an 8-bit representation. Each
Internet address may also be interpreted as having two parts: an Internet Protocol
(IP) network address assigned to a site network and an address for a local device
(i.e., a PC) on that network. The address given is an example of a Class B address,*

*
The Internet Protocol also defines Class A addresses (8-bit network address and 24-bit local identifier)
and Class C addresses (24-bit network address and 8-bit local identifier). There are even Class D and E
addresses, but we’ll discuss that in Section 7.4.
2942 | Ch 07 Page 471 Thursday, February 17, 2000 1:18 PM

7.2 NETWORK ROUTING 471

N1 N3 R4
N5
R2 R1
R3
N2 N4 N6

Figure 7.15 Routers Connecting Networks

They store this information in their routing tables and periodically broadcast it over
the networks. By repeatedly receiving information, storing it, and broadcasting it,
each router eventually knows the smallest number of hops to a given network.
Let’s see how this would work on the network of Figure 7.15. Using RIP, the
following events can occur:
1. R2 sends a message along N2 that it can get to N1 in one hop. (It also sends a
message along N1 that it can get to N2 in one hop.)
2. Because R1 is connected to N2, it now knows it can get to N1 in two hops and
stores that fact in its routing table. Subsequently, R1 broadcasts the following
over N4: It can get to N2 and N3 in one hop and to N1 in two hops. (It also
broadcasts similar information over N3 and N2.)
3. R3 receives and stores the information it received over N4 and broadcasts the
following over N5: It can get to N4 and N6 in one hop, N2 and N3 in two
hops, and N1 in three hops. It also will broadcast similar information over N4
and N6.
At this point some of the broadcast information becomes redundant. For
example, because of R3’s broadcast over N5, R4 learns it can get to N2 in three
hops. Of course, if it previously received R1’s broadcast over N3 it already knows it
can get to N2 in two hops. In this case it does not store the most recent information.
What happens if a router or network along a route fails? For example, R4 knows
it can get to N2 in two hops, but what if network N3 fails? When a router stores
routing information it also starts a timer. When the timer expires it marks the route
as invalid. It depends on new routing information to reestablish a route. Of course,
the routers must cooperate by sending routing information on a regular basis (typi-
cally every 30 seconds). Thus, if N3 failed, events 1 to 3 would still occur (except
those involving N3). This time when R4 learns that it can get to N2 in three hops it
stores that fact because there is no alternative.

O PEN S HORTEST P ATH F IRST


Another example of an interior routing scheme is Open Shortest Path First
(OSPF). The “open” means that the algorithm is nonproprietary, that is, not owned
2942 | Ch 07 Page 476 Thursday, February 17, 2000 1:18 PM

476 CHAPTER 7 WIDE AREA NETWORKING

B’s buffers containing A’s buffers containing


packets destined for packets destined for
C are full. B A B are full.

C
C’s buffers containing
packets destined for
A are full.

Figure 7.16 Store-and-Forward Deadlock

host

packet 1 from A Shared buffer


packet 2 from A has a 6-packet
capacity.
packet 1 from B
packet 3 from A
packet 2 from B Packets 0 from both A
packet 3 from B and B never arrived.

A B

Figure 7.17 Reassembly Deadlock

repeat sliding window protocol for receiving packets from A and B destined for the
node’s host. Recall that the selective repeat protocol allows packets to arrive out of
order. The receiver then reassembles them before sending them to the host.
In our example, A and B both sent a packet 0, neither of which arrived. How-
ever, subsequent packets numbered 1 through 3 from both A and B have arrived. If
we assume the buffers are filled, the node cannot accept any more packets. Because
both packet 0s are missing, however, the node cannot reassemble them and deliver
them in order to the host. Moreover, the node will not accept either packet 0 even if
it does arrive. Consequently, the node is placed in a state in which it can neither take
action nor respond to an event that would allow it to take action. It is deadlocked.
Reassembly deadlock can be prevented through a handshake establishing a con-
nection between the sending and receiving nodes. The handshake can establish the
window size and the receiver can reserve sufficient space and use it only for that
connection. Store-and-forward deadlock is a bit more problematic. It can be reduced
2942 | Ch 07 Page 476 Thursday, February 17, 2000 1:18 PM

476 CHAPTER 7 WIDE AREA NETWORKING

B’s buffers containing A’s buffers containing


packets destined for packets destined for
C are full. B A B are full.

C
C’s buffers containing
packets destined for
A are full.

Figure 7.16 Store-and-Forward Deadlock

host

packet 1 from A Shared buffer


packet 2 from A has a 6-packet
capacity.
packet 1 from B
packet 3 from A
packet 2 from B Packets 0 from both A
packet 3 from B and B never arrived.

A B

Figure 7.17 Reassembly Deadlock

repeat sliding window protocol for receiving packets from A and B destined for the
node’s host. Recall that the selective repeat protocol allows packets to arrive out of
order. The receiver then reassembles them before sending them to the host.
In our example, A and B both sent a packet 0, neither of which arrived. How-
ever, subsequent packets numbered 1 through 3 from both A and B have arrived. If
we assume the buffers are filled, the node cannot accept any more packets. Because
both packet 0s are missing, however, the node cannot reassemble them and deliver
them in order to the host. Moreover, the node will not accept either packet 0 even if
it does arrive. Consequently, the node is placed in a state in which it can neither take
action nor respond to an event that would allow it to take action. It is deadlocked.
Reassembly deadlock can be prevented through a handshake establishing a con-
nection between the sending and receiving nodes. The handshake can establish the
window size and the receiver can reserve sufficient space and use it only for that
connection. Store-and-forward deadlock is a bit more problematic. It can be reduced
2942 | Ch 07 Page 477 Thursday, February 17, 2000 1:18 PM

7.2 NETWORK ROUTING 477

or even eliminated by using sufficient buffer space, but the problem is knowing just
how much buffer space to reserve, especially in datagram services in which packets
come and go randomly.
One approach to deadlock is to let it happen and then deal with it. When dead-
lock occurs the typical response is to discard some packets and release the buffer
space. The discarded packets, of course, never reach their destination. This is the
price to be paid for breaking the deadlock. Presumably, communication protocols
will determine that the packets never arrived and will send them again later. If dead-
lock occurs rarely, this may be the best way to deal with it.
On the other hand, for a network more susceptible to deadlock it may be less
costly to take steps to prevent it from happening or at least decrease its probability of
occurrence. Any of the previously mentioned congestion control techniques will
decrease the chances of deadlock, but there is still no guarantee deadlock will not
occur. Another approach, presented in Reference [Me80], maintains the number of
hops (nodes through which a packet travels) in each packet. When a host first inserts
a packet into the network the hop count is 0. As the packet travels through the net-
work each node increments the hop count by one. In addition, each node divides its
buffers into distinct groups, each one corresponding to a hop count from 0 up to the
maximum expected hops. The node then stores an incoming packet into a buffer
depending on the number of hops in the packet, but only if a buffer is available. If
not, the packet waits at the preceding node until it is available. Figure 7.18 shows
how it works. A host submits a packet initially and the host’s node stores the packet
in buffer 0. The next node to receive the packet stores it in buffer 1, the next one in
buffer 2, and so on.
This method prevents deadlock because a packet always goes to (or waits for) a
higher numbered buffer. Another way to state it is that a packet in one buffer will
never wait for a lower or equal numbered buffer. Because of this the circular wait
condition of Figure 7.16 can never occur. The argument against this approach is that

Figure 7.18 Storing Packets Depending on Hop Count

buffer # buffer # buffer # buffer #

host 0 packet 0 0 0
1 1 packet 1 1
2 2 2 packet 2

3 3 3 3 packet

4 4 4 4
: : : :

: : : :
2942 | Ch 07 Page 478 Thursday, February 17, 2000 1:18 PM

478 CHAPTER 7 WIDE AREA NETWORKING

buffers may be underutilized. Preassigning a packet to a buffer prevents its transmis-


sion whenever that buffer is occupied; however, if it is the only buffer occupied, the
others go unused.

7.3 PUBLIC DATA NETWORKS: THE X SERIES PRO-


TOCOLS

In the 1970s many European countries began to develop public data networks (net-
works available to anyone with a need for network services). The problems they
faced were different from those in the United States. In the United States, public net-
works could be developed in large part by leasing existing telephone lines. In
Europe this could not be done easily due to problems inherent in traversing commu-
nications systems across international boundaries. Thus, instead of developing sepa-
rate and incompatible standards European countries worked under the auspices of
ITU to develop a single standard. The result is the public data network service inter-
face referred to as the X series of protocols. This section discusses four common
protocols: X.25, X.3, X.28, and X.29.
Public data networks are commonly packet-switched networks, represented
by the ubiquitous network cloud shown in Figure 7.19. They operate by transporting
packets submitted at one part of the “cloud” and routing them to their destinations.
Typically, switching logic (circuits) at nodes in the network make routing decisions.
The previous section focused on this aspect of networks, so we will not discuss it
further here. Instead we take the perspective of someone interacting with the net-
work. Packets enter from point A and exit at points B, C, or D. We do not necessarily

Figure 7.19 Packet-Switched Network

A
5
4 B
3
1
2
1
packet-
switched
network 4 5 C

3
2

D
2942 | Ch 07 Page 479 Thursday, February 17, 2000 1:18 PM

7.3 PUBLIC DATA NETWORKS: THE X SERIES PROTOCOLS 479

know (or care) how they get there. Our main focus is to define the logical connection
between the source and the destination.

P ACKET -S WITCHED N ETWORK M ODES


Virtual Circuits Packet-switched networks typically operate in one of two modes.
The first is by a virtual circuit between two points. It is somewhat analogous to cre-
ating a telephone connection between two people. A device connected to the net-
work requests a connection to a device somewhere else. This request is routed
through network nodes, establishing a path between the caller and destination. All
subsequent packets sent by the caller follow that same path. (We will discuss the
actual process of calling and establishing the connection later in this section.)
The connection is not a physical one, however. The connections between nodes
are not dedicated solely to one virtual circuit. In fact, a node and its connection to a
neighbor may participate in several virtual circuits. Figure 7.20 shows two overlapping
virtual circuits. A and B have both requested and established connections to C and D,
respectively. The paths begin at different locations but overlap at nodes X and Y. X han-
dles packets corresponding to either virtual circuit and routes them to Y. Y, in turn,
routes packets differently depending on the virtual circuit on which they arrive.
Because virtual circuit paths can overlap, each node must be able to determine
the virtual circuit corresponding to an incoming packet. As the initial connection
request goes through each node, the node assigns a virtual circuit number to it,
determines the next node to which it sends the request, and makes an entry in its
routing table. The routing table contains each virtual circuit number and the next
node along the corresponding path.
Note that each node assigns virtual circuit numbers independently, so one vir-
tual circuit may be identified by different numbers at different nodes. Consequently,
each node informs the circuit’s preceding node of the virtual circuit number it uses
for incoming packets. This allows a preceding node to know the virtual circuit

Figure 7.20 Overlapping Virtual Circuits

A
C

Virtual circuit 1
Virtual circuit 2
X Y

B packet-switched network
D
2942 | Ch 07 Page 480 Thursday, February 17, 2000 1:18 PM

480 CHAPTER 7 WIDE AREA NETWORKING

number assigned by the next node and to store it in the packet. Thus, incoming
packets contain the number of the virtual circuit coming in to the node. The node’s
routing logic accesses the routing table entry corresponding to it and sends it to the
next node. If the next part of the virtual circuit has a different number, the node
stores it in the packet as well. For example, Figure 7.21 shows a packet traversing
each of the virtual circuits of Figure 7.20. The virtual circuit between A and C is
assigned the numbers 1 (by X), 5 (by Y), and 3 (by C). The circuit between B and D
is assigned the numbers 2 (by X), 3 (by Y), and 1 (by D).
Table 7.6 shows what the relevant entries of X’s and Y’s routing tables look like.
A packet coming in to X from A contains the virtual circuit number 1. X’s routing
table indicates that the next node is Y and that it uses 5 as the virtual circuit number.
Consequently, X stores 5 into the packet and sends it to Y. A packet entering Y from X
will contain a virtual circuit number of 5 or 3. If it is 5, Y’s routing table indicates C
as the next node and an outgoing virtual circuit number of 3. If it is 3, D is the next
node and the outgoing virtual circuit number is 1.

Datagram Service One advantage of virtual circuits is that routing decisions are
made just once for each circuit, eliminating the need to make such decisions for each
packet. Your first thought might be that this is particularly beneficial when many

Figure 7.21 Sending Packets along a Virtual Circuit

A
C
vc #1
vc #3
vc #5
X Y
vc #3
vc #2 vc #1

Table 7.6 Routing Tables for Nodes X and Y from Figure 7.20
ROUTING TABLE FOR X ROUTING TABLE FOR Y
INCOMING OUTGOING INCOMING OUTGOING
VC VC NEXT VC VC NEXT
NUMBER NUMBER NODE NUMBER NUMBER NODE
1 5 Y 5 3 C
2 3 Y 3 1 D
2942 | Ch 07 Page 481 Thursday, February 17, 2000 1:18 PM

7.3 PUBLIC DATA NETWORKS: THE X SERIES PROTOCOLS 481

packets are sent. The opposite may be true, however, because many packets usually
means more time has elapsed since the circuit was established. Consequently, the
conditions that may have made the current path a good one may no longer be true.
That is, conditions may have changed so that the current path takes longer. The
result, in that case, is reduced efficiency.
Another option is a datagram service. With it each packet contains the source
and destination addresses. As packets enter the network, nodes apply routing logic
to each packet separately. Presumably, this allows each node to route depending on
the most current information it has regarding potential paths. Figure 7.22 shows
datagrams traversing the network. Packets 1 through 3 enter at A and A routes them
to X. Just after packet 3 enters the network, A gets new routing information that indi-
cates Y is now a better choice for packets destined for D. Consequently, it routes
packets 4 and 5 to Y.
In theory, all packets may travel different routes and take advantage of the best
routes currently available. A disadvantage is that there is no guarantee that packets
will arrive at D in the same order they were sent. Consequently, more complex logic
is required to reassemble packets at their destination (recall the selective repeat pro-
tocol of Section 5.3). Table 7.7 lists some other advantages and disadvantages of the
virtual circuit and the datagram service.

X.25 P UBLIC D ATA N ETWORK I NTERFACE S TANDARD


An important part of working with public data networks is their interface. One
widely used interface is the ITU X.25 standard. Many people use the term X.25 net-
work, causing some to believe mistakenly that X.25 defines the network protocols. It
does not. X.25 defines the protocol between a DTE and a DCE connected to a public
data network (Figure 7.23). We note that early versions focused mainly on the asym-
metric DTE-DCE relationship. Recent versions have recognized the need for peer-
to-peer communications between two DTEs. Consequently, X.25 can be used
strictly as a user-to-network interface or as a user-to-user connection across a public

Figure 7.22 Datagram Service

A 5 4
3 Y
2
1

X
packet-switched network
D
2942 | Ch 07 Page 482 Thursday, February 17, 2000 1:18 PM

482 CHAPTER 7 WIDE AREA NETWORKING

Table 7.7 Comparison of Virtual Circuits and Datagrams


VIRTUAL CIRCUIT DATAGRAM
Helps prevent congestion. Since a Unexpected packets make congestion
node knows it is part of a virtual circuit control more difficult.
it can reserve space for the anticipated
arrival of packets.
If a virtual circuit is open too long, the Nodes route each packet using the
current path may not be the best given most current information about the
current network conditions. network.
A routing decision is made just once Separate routing decisions are made
for each set of packets sent along the for each packet.
virtual circuit.
Packets arrive in the order they were Packets can arrive out of order requir-
sent. ing the destination to order them.
A node failure breaks the virtual cir- If a node fails packets can be routed
cuit connection, causing a loss of around it.
packets.

X.25 protocol
DTE DCE public data network

X.25 protocol
DTE
DCE
network-defined protocol

Figure 7.23 X.25 Public Data Network Interface

data network. The latter use partially explains why some people refer to public data
networks as X.25 networks. The term is technically incorrect, but to those for whom
X.25 defines the communication protocol via the network, the misnomer is under-
standable.
X.25 defines a synchronous transmission analogous to the three lowest layers of
the OSI (Figure 7.24). The network layer receives user data and puts it into an X.25
packet. The X.25 packet is passed to the data link layer, where it is embedded in a
LAPB frame (Section 5.5 discussed LAPB). The physical layer then transmits the
2942 | Ch 07 Page 483 Thursday, February 17, 2000 1:18 PM

7.3 PUBLIC DATA NETWORKS: THE X SERIES PROTOCOLS 483

packet layer
network network
layer layer

data link LAPB


data link
layer layer

physical X.21 or X.21bis


physical
layer layer

Figure 7.24 X.25 Protocol Layers

LAPB frame using the X.21 protocol discussed in Section 3.2. Alternatively, X.25
may use the X.21bis standard, which was designed as an interim standard to connect
V series modems with packet-switched networks. The X.21 standard was supposed
to replace it, but, as with many plans, it did not happen. A more extensive treatment
of X.21bis is found in Reference [Bl91]. In some cases, X.25 may even use the EIA
232 protocol.
Accomplishing all of this requires intelligent DTEs capable of creating packets
and implementing the protocols. One problem that sometimes occurs is that DTEs
correspond to asynchronous terminals, which lack the intelligence to do this. We
will treat this case later. Since we have already discussed the two lower layers, we
will focus here on the network layer’s packet protocol.

Packet Format The first step is defining the packet format. As with previous pro-
tocols, formats vary depending on the type of packet. Figure 7.25 shows two pri-
mary formats. The relevant packet fields are as follows:
• Flags. The first four bits define the general format indicator (GFI) and, to
some extent, define the packet format. For example, two of the bits specify
whether 3-bit or 7-bit numbers are used for sequencing and acknowledging.
Another bit, called the D bit, specifies how to interpret acknowledgments. If the
D bit is 0, acknowledgments come from the DCE. If the D bit is 1, they come
from the remote DTE. In effect, the D bit determines whether flow control is
being managed for a local DTE-DCE connection or for a logical connection
with the remote DTE.
• Logical group number and logical channel number. Together they define a
12-bit number for a virtual circuit the DTE has established. This allows the
DTE to establish up to 4096 virtual circuits.
2942 | Ch 07 Page 484 Thursday, February 17, 2000 1:18 PM

484 CHAPTER 7 WIDE AREA NETWORKING

number of octets

1 1 1 or 2 variable

flags, logical group number logical channel number control data

(a) Data packet

number of octets

1 1 1 variable

flags, logical group number logical channel number packet type other information

(b) Control packet

F i g u re 7 . 2 5 X.25 Packet Formats

• Control (data packet). Contains either 3-bit or 7-bit sequence and acknowledg-
ment numbers used for flow control. X.25 flow control uses windows and is not
significantly different from flow control protocols discussed previously. This
field also contains a bit set in the last of a series of packets to indicate the end of
a packet stream.
• Data (data packet). Self-explanatory.
• Packet type (control packet). There are several packet types, defined in Table 7.8.

Virtual Calls X.25 provides two types of virtual circuits between DTEs. A per-
manent virtual circuit is similar to leasing a telephone line: Either DTE can send
data without the overhead of making and establishing a call. It is particularly useful
when a high volume of data is transferred. A virtual call, the second type, requires a
call connection protocol to be performed prior to any data transfer.
Figure 7.26 shows the call connection and termination process between two
DTEs. (For brevity, we have not shown the DCEs or the network, but don’t forget
they are there.) The DTE wanting to make a call constructs a call request packet
containing the virtual call (or logical channel) number and sends it via its DCE and
the network. When the receiving DCE gets the packet it assigns a virtual call number
to the request and delivers the packet to the receiving DTE. Note that there is no
requirement that the channel numbers be the same at each end. As described previ-
ously, they are defined dynamically. If that DTE is willing and able to accept the
call, it sends a call accepted packet. Once the first DTE receives the call accepted
packet the virtual call is established.
Next, the DTEs exchange data and acknowledgment packets in a full-duplex
mode, using a flow control similar to that used in HDLC* (Section 5.5). When
either DTE decides to end the connection (DTE A in Figure 7.26), it creates and
sends a clear request packet. The local DCE responds by doing two things. First,
2942 | Ch 07 Page 486 Thursday, February 17, 2000 1:18 PM

486 CHAPTER 7 WIDE AREA NETWORKING

it sends the clear request packet to the remote DTE. Second, it responds to its local
DTE by sending it a clear confirmation packet. As far as the local DTE is con-
cerned, the virtual call is terminated and the logical channel number is available
for future calls. Eventually, the remote DTE receives the clear request packet. It
sees it as a clear indication packet and responds by sending a clear confirmation
packet to its DCE. That DCE also clears the channel number, making it available
for other calls.
Although X.25 is popular, perhaps more so in Europe, it has its critics. For
example, one of the strongest criticisms is that X.25-based protocols provide only a
connection-oriented service. Another is that its network layer (layer 3) is incomplete
and actually contains features found in higher-layer protocols. For example, the OSI
layer 3 provides routing capability, but the X.25 layer 3 has no such capability. Fur-
thermore, X.25 provides for some connection-oriented features with the remote
DTE. Since end-to-end connections are more typical in layer 4 protocols, some see
this as a blending of two layers into one, thus blurring the distinction between layers
as defined by OSI.

Figure 7.26 Virtual Call

DTE A DTE B
Send call request packet.
Receive call request packet.

Send call accepted packet.


Receive call accepted packet.
Virtual call established.
Send first data packet.

Exchange
data/acknowledgment
packets using an HDLC-
like flow control.
Send clear request packet.
A’s DCE Receive clear request packet.
Receive clear confirmation packet. Send clear
confirmation packet. Send clear confirmation packet.

B’s DCE
Virtual call terminated.
time time

*
There are some differences between HDLC and X.25 flow control, but they are not significant at this
level of discussion.
2942 | Ch 07 Page 487 Thursday, February 17, 2000 1:18 PM

7.3 PUBLIC DATA NETWORKS: THE X SERIES PROTOCOLS 487

T RIPLE -X S TANDARD FOR N ON -X.25 D EVICES


One disadvantage of the X.25 protocol is the need for DTEs that support it. In other
words, it requires a computer, workstation, or other intelligent device capable of cre-
ating and interpreting X.25 packets. These categories leave out the almost countless
number of dumb terminals or character-oriented devices still in use. How can they
communicate with devices that support X.25? One approach is to purchase X.25-
supported devices and replace the non-X.25 devices. For anyone who must manage
a budget, however, this may not be a practical solution.
Fortunately, another solution does exist: a set of protocols defined by the ITU.
They are the X.3 packet assembler/disassembler (PAD), X.28 PAD-terminal
interface, and X.29 PAD-host interface (Figure 7.27). The PAD replaces the DCE
as a network interface. It accepts characters from character-oriented devices and
assembles them into packets before sending them onto the network. Similarly, it can
receive packets from the network, disassemble them, and transmit the data as a char-
acter stream to the terminal. The X.28 protocol defines a set of commands that the
terminal and PAD use to exchange information. Similarly, X.29 defines a communi-
cation protocol between the PAD and the remote host.

X.3 Packet Assembler/Disassembler A PAD works with dumb terminals, that


is, those with no local computing ability. Dumb terminals are little more than
electronic typewriters that transfer characters to and from the network. One
problem is that many of them work in unique ways. A simple example is the
deletion of characters. Most of us are poor typists who make many mistakes, but
we usually can correct them by backspacing and deleting unwanted characters.
The trouble is that on some terminals you backspace by typing the backspace
key. On others you use the Delete key, an arrow key (←), a backslash key ( \ ), or
a combination of keys (for example, Ctrl-D or Alt-F). It is like trying to find the

Figure 7.27 Triple-X Protocols

X.29
non-X.25
device
host
X.25 public
data X.3 X.28
DCE network
PAD

network-defined protocol
2942 | Ch 07 Page 490 Thursday, February 17, 2000 1:18 PM

490 CHAPTER 7 WIDE AREA NETWORKING

non-X.25 X.3 call request


device PAD packet
virtual call
request Create packet
and send to
remote host.

(a) Call request

non-X.25 X.3 call accepted


device PAD packet
virtual call
acknowledged received from remote host

(b) Call acknowledged

Figure 7.28 PAD Responding to Virtual Call Requests

entered characters are echoed back to the terminal. This is useful except when a user
is entering a password as part of a login. Thus, when a remote host is ready to accept
a password it can send a command to the PAD changing parameter 2 to suppress
echoing. After the password has been entered the remote host resets the parameter to
resume echoing.
The X.29 protocol is particularly useful when the user has no knowledge of
the PAD or network. The user simply wants to use the terminal to connect to a
remote device for some service. He or she does not want to worry about specific
terminal characteristics (such as those described previously) or about setting PAD
parameters. This way the remote host can instruct the PAD to set its parameters
accordingly and allow the user to focus on the reason for the remote connection in
the first place.

7.4 INTERNET PROTOCOLS

Probably the best-known wide area network actually consists of many networks and
is collectively called the Internet. Its history dates back to the late 1960s, when the
Advanced Research Projects Agency (ARPA) of the U.S. Department of Defense
(DoD) began funding universities and private organizations for the purpose of devel-
oping communications systems. The research eventually led to the development of
ARPANET, a small experimental network that demonstrated the feasibility of con-
necting different computers by a packet-switching network. It has since grown and
evolved into the Internet and connects thousands of universities, private institutions,
and government agencies worldwide.
Many use the term internet to refer to any collection of connected networks.
The network that resulted from the ARPA project is commonly referred to as the
Internet (with a capital I). The Internet consists of thousands of separate networks. It
services people in probably every corner of the industrialized world, not to mention
2942 | Ch 07 Page 491 Thursday, February 17, 2000 1:18 PM

7.4 INTERNET PROTOCOLS 491

some remote areas as well. It is difficult to know just how many people use the
Internet, but with networks existing in virtually every private and public organiza-
tion and the proliferation of Internet service providers, they easily number in the
tens of millions and quite possibly, hundreds of millions world-wide. This section
and the next will present an overview of both IP and TCP. However, there are books
devoted solely to these topics and the interested reader is encouraged to consult ref-
erences such as [Co94], [Co95], and [Mi96].

O VERVIEW OF TCP/IP
The Internet connects many networks, each of which runs a protocol known as
TCP/IP. TCP (Transmission Control Protocol) and IP (Internet Protocol) corre-
spond roughly to layers 4 and 3 of the OSI model, respectively, although they are
not part of the OSI model. They were developed along with the ARPA project and
have become DoD standards. TCP/IP is probably the most widely implemented pro-
tocol in the world and runs on almost anything from PCs to supercomputers.
The TCP/IP pair of protocols is part of a protocol collection called the TCP/IP
protocol suite (Figure 7.29). TCP provides connection-oriented services for higher-
layer applications and relies on IP to route packets through the network in order to
make those connections. These applications, in turn, provide specific services for
Internet users. For example, SMTP (Simple Mail Transfer Protocol) defines the
protocol used for the delivery of mail messages over the Internet. The TELNET
protocol allows users to log in to remote computers via the Internet. FTP (File
Transfer Protocol) allows Internet users to transfer files from remote computers.
DNS (Domain Name System) provides a mapping of host names to addresses. We
will discuss these protocols later.
TCP is a connection-oriented transport protocol designed to provide reliable com-
munications over different network architectures. Its predecessor in the original
ARPANET was NCP (Network Control Protocol), which was designed to run on top of
a reliable network. ARPANET was sufficiently reliable, but as it evolved into an inter-
network reliability was lost. Consequently, the transport protocol was forced to evolve
as well. NCP, redesigned to run over unreliable networks, became TCP. UDP (User

Figure 7.29 Internet Protocols

SMTP FTP TELNET DNS

TCP UDP

IP and ICMP

lower layer protocols


2942 | Ch 07 Page 492 Thursday, February 17, 2000 1:18 PM

492 CHAPTER 7 WIDE AREA NETWORKING

Datagram Protocol) provides a connectionless mode of communication over dissim-


ilar networks. UDP and TCP provide the transport user with the two typical modes of
communication. We will discuss both TCP and UDP in more detail in the next section.
The Internet Protocol is a layer 3 protocol designed to provide a packet delivery
service between two sites. It is commonly, but not exclusively, used with TCP.
Figure 7.30 shows how it works with TCP. Suppose two sites (A and B) need a con-
nection-oriented service requiring the transmission of some data. Common exam-
ples are email and file transfers. TCP provides the reliable connection independent
of the network architectures in between the two, and IP does the work of routing
packets through different networks. It’s a little like making a telephone call. At one
level, you simply dial and someone at the other end answers (you hope). You have
made a connection. Furthermore, you have no knowledge of how that connection
was made or how many telephone switches your call may have been routed through.
That’s handled by the telephone companies involved. Figure 7.30 shows a possible
Internet connection between A and B.
To begin, the TCP at site A creates a TCP segment* containing the user’s data
and “sends” the segment to site B. If all goes well B will acknowledge what it
receives. From TCP’s point of view it has made a direct connection with B (dotted
line). IP, however, intercepts the segment and creates an IP packet (whose format
we discuss shortly) containing the TCP segment. Perhaps site A is a company com-
puter and the packet needs to get to a router over a token ring LAN. In that case, data
link protocols create a token ring frame, put the IP packet in the frame’s data field,
and send it to the router via the token ring network. The lower-layer protocols really

Figure 7.30 IP Transmitting Packets over Different Networks

A running TCP/IP B running TCP/IP


data data

TCP TCP
data data segment
segment
router running IP router running IP
IP
packet TCP TCP
segment
IP
segment token ring frame X.25 frame X.25 frame Ethernet frame packet
IP IP IP IP
packet packet packet packet
token Ethernet
IP IP
ring packet packet
frame
frame
token ring X.25 public Ethernet
LAN data network LAN

*
A TCP segment, similar to a packet, contains data and other overhead information. We discuss its
format in Section 7.5.
2942 | Ch 07 Page 496 Thursday, February 17, 2000 1:18 PM

496 CHAPTER 7 WIDE AREA NETWORKING

to a UNIX system you can test DNS translation using the utility nslookup. For
example, entering the command nslookup gbms01.uwgb.edu returns the 32-bit address
143.200.128.3. Try it on some other text addresses.
It sounds simple enough and, yes, we did oversimplify. Still, the basic idea of
address lookup is correct. The difficult part is in the implementation and in managing
the millions of addresses among the servers and providing a quick translation of a
text address. This is where the domain concept comes in. We can view DNS as a
hierarchical arrangement of text addresses organized first by the domain name.
Figure 7.31 shows how some text addresses are organized (space limitations dictate
that we do not try to list all Internet addresses).
At the top level the hierarchy is organized by domain. For example, all “edu” insti-
tutions are grouped, as are “com” institutions, and so on. Still the edu domain is rather
large, so a second-level hierarchy organizes subgroups. Universities such as UWGB
(University of Wisconsin-Green Bay), UWM (University of Wisconsin-Milwaukee),
MIT, and so forth are grouped under the edu domain. Similarly, there are other sub-
groupings under the com, org, and other domains. There may be additional hierarchies
depending on whether large institutions are divided further into departments.
Now, just because we stated that text addresses are organized in a hierarchy
does not mean they are stored that way. Storing and organizing are not the same. We
have already mentioned the existence of servers scattered throughout the Internet
and that no one server contains all of the information in DNS. The information rep-
resented by the hierarchy of Figure 7.31 is divided into zones, each of which is a
hierarchy of one or more nodes. Furthermore, no two zones overlap. Each zone cor-
responds to at least two servers (primary and backups), each of which has the
responsibility of managing information in that part of the hierarchy. Consequently,
the hierarchy is perhaps more accurately applied to an organization of servers.
When a host needs an address translation it sends a request to a local name
server. If the local server can provide the translation it does so. If not then the
request is sent to one of the DNS servers represented at the top of the hierarchy. For
example, text addresses that end in com and edu go to different servers. If that server
has access to the information represented by the text address specified, it returns the
Internet address; if not, the server knows of another server that should be able to
provide more information.

Figure 7.31 DNS Hierarchy

edu com org

uwgb mit uwm brooks microsoft acm ieee


cole
gbmso1 gbraxa
2942 | Ch 07 Page 497 Thursday, February 17, 2000 1:18 PM

7.4 INTERNET PROTOCOLS 497

com

acme

product personnel

r&d sales

Figure 7.32 Zones in a DNS Hierarchy

Figure 7.32 shows how this works for one case. This figure shows one small fic-
titious branch coming off the com domain. The ACME company maintains two net-
works, one each for the products and personnel departments. The products
department, in turn, consists of research and development and sales divisions. Cir-
cles around the nodes define zones.
Suppose an outsider specifies the text address hercules.products.acme.com.
“hercules” is a computer in the research and development division of the products
department of the ACME company. The server for the com domain cannot be
expected to know the full address of every host computer in every commercial net-
work (there are just too many). However, the “acme” part of the text address tells the
server that another server at the ACME site can provide more information. The text
address is then sent to the ACME site.
A possible scenario is that the personnel department is fairly small but the prod-
ucts department is larger; consequently, management at ACME decided to use a sep-
arate server for their products network. Perhaps the network managers at the
products department simply did not want to bother with the personnel network. In
any event, the server in the ACME zone still cannot resolve the full address because
the text address indicates a zone for which it is not responsible. Note that if the text
address contained “personnel.acme.com” then it could because both the ACME and
personnel nodes are in the same zone. However, since the products node is in a dif-
ferent zone, a request is sent to another server in the products zone. At that point, the
remaining part of the text address is the responsibility of that server, which accesses
and returns the corresponding Internet address.
Through a sequence of exchanges among various servers, a text address can be
translated into a 32-bit Internet address. For further study, one could investigate the
actual protocols to do that, including the formats and types of exchanges among var-
ious servers. References [Ta96] and [Pe96] provide some of that information.
2942 | Ch 07 Page 498 Thursday, February 17, 2000 1:18 PM

498 CHAPTER 7 WIDE AREA NETWORKING

header type of
version packet length
length service
fragment
identification flags
offset

time to live protocol checksum


32 bits
header
each
source IP address

destination IP address

options

data

Figure 7.33 Internet Packet

IP P ACKETS
Having provided the basics of Internet terminology and operation we can now dis-
cuss the packet format and some specific features of the Internet Protocol. An IP
packet is similar in many ways to the packet and frame formats previously dis-
cussed. Still, there are some unique features that warrant discussion. Figure 7.33
shows the contents of an IP packet.
The following list explains the IP packet fields:
• Version. Specifies the version of IP that created the packet. This allows dif-
ferent versions of IP to work together.
• Header length. Specifies the number of 32-bit words in the packet header (the
fields preceding the data).
• Type of service. Specifies transport-layer requests regarding handling of the
packet. This field allows four request options: precedence, low delay, high
throughput, and high reliability. A 3-bit precedence field allows packets to be
prioritized (0 for low and 7 for high priority). Protocols would allow high-
priority (or precedence) packets to be transmitted before low-priority ones. This
would be especially useful for exchanging control packets indicating status. It
also could be used to execute distributed congestion control algorithms without
being affected by the congestion it is trying to control (similar to a police
vehicle making its way through a heavily congested traffic area to get to an acci-
dent so they can get traffic moving again.) Currently, most routers ignore ser-
vice type, but its implementation allows for changes in newer versions.
A transport protocol can request a low-delay transmission, useful when the
transport user has logged into a remote computer and wants quick responses. IP
protocols at various routers then can route the packets (containing user requests
2942 | Ch 07 Page 501 Thursday, February 17, 2000 1:18 PM

7.4 INTERNET PROTOCOLS 501

sending station uses the message to determine threshold values at which frag-
mentation occurs. That is, if the current packet size is too large, the sender
could repeat with smaller packet sizes to eventually determine when fragmen-
tation occurs.
• Since a fragment contains part of a packet’s data, the router also determines the
offset in the packet’s data field from where the data was extracted and stores it
in the fragment offset field. It measures offsets in units of eight bytes each.
Thus, offset 1 corresponds to byte number 8, offset 2 to byte 16, and so on.
Figure 7.34 shows a packet being divided into three fragments. It assumes the
network has an MTU that allows no more than 1400 bytes of data. Consequently, the
router divides an incoming packet with 4000 data bytes into three fragments. Each
of the first two fragments has 1400 data bytes. The first one’s fragment offset field is
0, indicating its data begins at offset 0 in the packet. The second one’s fragment
offset field is 175, indicating its data begins at byte 1400 (8 × 175) of the packet. The
third has 1200 bytes of data and an offset of 350. The mfb bits in the first two frag-
ments are 1, indicating that each is a fragment and that more fragments exist. The
last fragment’s mfb is 0, indicating that it is the last fragment. The fact that it is a
fragment at all is deduced from the value in the offset field.
When the destination IP sees two different fragments with the same identifica-
tion, source, and destination address, it knows they came from the same packet. It
reassembles all such packets ordered by the values in their respective offset fields. It
recognizes the last fragment as the one with the mfb equal to 0 and a nonzero offset.
As part of the reassembly process it also sets a reassembly timer on receipt of the

Figure 7.34 Packet Fragmentation

1400–data-byte
fragment with
offset = 0
mfb = 1
first fragment
packet 1400–data-byte
with 4000 fragment with
data bytes router
offset = 175
mfb = 1
second fragment

1200–data-byte
fragment with
offset = 350
mfb = 0
third fragment
Fragments all have the same identification,
source, and destination fields.
2942 | Ch 07 Page 504 Thursday, February 17, 2000 1:18 PM

504 CHAPTER 7 WIDE AREA NETWORKING

router 2

packet

B
router 1 143.100.20.4
LAN

A
143.200.10.5

Figure 7.35 IP Routing

Since it is a broadcast frame each station on the LAN gets it, but only station A
responds by returning a frame to the router containing A’s physical address. The router
then stores the IP packet into a frame containing A’s physical address and sends it.
On the other hand, suppose router 1 receives a packet containing address
143.100.20.4. Router 1 knows it is not connected to network 143.100 and that it must
route the packet to another router. It examines its routing table and finds it should
forward the packet to router 2. When router 2 gets the packet it performs tasks sim-
ilar to those we just described for router 1. Of course the packet may have traveled
through several routers, but the steps are all similar to those we have just outlined.

I NTERNET C ONTROL M ESSAGE P ROTOCOL


Because IP does not provide a guarantee of reliable service, the Internet Control
Message Protocol (ICMP) is a protocol used for reporting errors and for providing
routers updates on conditions that can develop in the Internet. ICMP sends messages
by encapsulating them in IP packets and setting the header’s protocol field to 1.
The following list explains some typical control messages sent by ICMP.
• Destination unreachable. As we have stated previously, IP cannot guarantee
delivery of a packet. The destination may not exist or it may be down, the
sender may have made a source route request that cannot be carried out, or a
packet with its do not fragment bit set may be too large to be encapsulated into
a frame. In such cases the router detecting the error sends an ICMP packet to
the original sender. It contains the entire IP header of the undeliverable packet
and the first 64 bits of its data, thus allowing the sender to recognize which
packet was undeliverable.
• Echo request. ICMP uses this packet to determine whether a particular destina-
tion is reachable. For example, if A wants to know whether B is reachable it
sends an echo request packet addressed to B. If B receives the packet it responds
by sending an echo reply packet back to A. The echo reply packet will return
any data placed in the echo request packet. This may be simpler than commit-
2942 | Ch 07 Page 509 Thursday, February 17, 2000 1:18 PM

7.4 INTERNET PROTOCOLS 509

32 bits version priority flow label

next hop
32 bits payload length
header limit

128 bits source address

128 bits destination address

Figure 7.36 IPv6 Packet Header

Figure 7.36 shows the IPv6 packet header. On comparison with the IPv4 packet of
Figure 7.33, two things are immediately evident. The addresses have more bits and
the header format has fewer options. The latter may seem to contradict the goal of
providing additional capabilities, but it doesn’t, as we will soon see.
The version field has four bits and identifies which version of IP this packet
represents (4 for the current IP and 6 for the new one).
The priority field also has four bits and is particularly useful in congestion con-
trol. The concept of priority is simple: Higher values indicate more important
packets. It is how priorities are used that is significant. We have already discussed
congestion and some ways to deal with it. IPv6 recognizes that delays in some appli-
cations such as email are often not noticeable, whereas delays in others such as mul-
timedia applications render viewing next to impossible. The trick is identifying
which packets correspond to which applications.
A site sending out IP packets can use this field to indicate importance relative to
other packets the site sends. Priority values between 0 and 7, inclusive, correspond
to packets that the site may hold a little longer in response to congestion. IPv6 rec-
ommends values depending on the application. For example, email has a priority of
2, FTP and HTTP (Hypertext Transfer Protocol of the World Wide Web) have a pri-
ority of 4, Telnet (remote login protocol) has a priority of 6, and SNMP has a pri-
ority of 7. As you can see, the higher values correspond to applications for which
delays are typically more noticeable. Values above 7 correspond to real-time or mul-
timedia applications, cases where delays range from very inconvenient to unaccept-
able. For example, downloading sound or video files for real-time viewing requires
little or no delay. (Of course, if delays could somehow be synchronized with your
need for snack breaks then they could be tolerated.)
The 24-bit flow label field is used in conjunction with the priority field. Spe-
cifics as to exactly how this field will be used have not been finalized as of this
writing, but the idea is to identify packets that require “special handling” by routers.
Normal handling requires routers to search routing tables before forwarding packets.
2942 | Ch 07 Page 512 Thursday, February 17, 2000 1:18 PM

512 CHAPTER 7 WIDE AREA NETWORKING

taining 16 three-digit number separated by dots. Naturally, this becomes somewhat


unwieldy. Instead, colons will replace dots, and each 16 bits in an address will have
a four-digit hexadecimal number notation. An example IPv6 address has the form
7477:0000:0000:0000:0000:0AFF:1BDF:7FFF
Each hexadecimal digit in this representation has a unique 4-bit equivalent. The
result is still unwieldy but better than the alternative. For addresses that contain a lot
of 0s (and with 2128 addresses, a lot of them will), a shorthand notation will be used.
Essentially, the 0s will not be listed and a double colon (::) will indicate their pres-
ence. The actual number of 0s that are missing is calculated by subtracting the
number of hexadecimal digits in the notation from 32, the number of hexadecimal
digits needed for a full 128-bit representation. For example, the above address
would be written as
7477:: 0AFF:1BDF:7FFF
Since this notation contains 16 digits, we know there must be 16 missing 0s. In cases
where the 0 string begins the address, the notation will start with the double colon.
In other words, the address
0000:0000:0000:0000:0AFF:1BDF:000F:0077
could also be written as
:: 0AFF:1BDF:000F:0077
To further simplify addresses, leading 0s within a 4-digit group need not be
listed. This allows us to simplify this address’ notation as
::AFF:1BDF:F:77
Just as IPv4 divided its addresses into Class A, B, C, D, and E, depending on the
leading bits, IPv6 does something similar. There are currently 22 types of addresses,
each having a unique bit prefix. The prefixes range from three to ten bits. For
example, an address beginning with eight 0s corresponds to an IPv4 address. (Actu-
ally, IPv4 addresses begin with many more 0s, but more about that later.) Those
beginning with eight 1s are multicast addresses. Those starting with 0000 010 are
compatible with Novell’s IPX protocol. Most of the predefined prefixes have not
been assigned and are being reserved for future growth. This leaves about 85% of
the addresses reserved for the future.
Of particular interest are the unicast addresses, which are the most analogous to
IPv4 addresses. Figure 7.37 shows the format of a unicast address. Like an IPv4
address, there is an implied hierarchy; it is just more complex. The first three bits of

Figure 7.37 Unicast Address Format

010 registry provider subscriber subnet interface

128-bit address
2942 | Ch 07 Page 513 Thursday, February 17, 2000 1:18 PM

7.4 INTERNET PROTOCOLS 513

company network
Interface A

subnet Interface B

subnet
subnet

network
The World
service regional
via the
provider’s network
Internet
router
university network
subnet

Interface C subnet Interface D

Figure 7.38 IPv6 Organization

a unicast address are 010. The remaining bits define a five-level hierarchy. The
example topology of Figure 7.38 illustrates how the hierarchy can be organized.
In general, a network service provider contracts with customers to provide
access to the Internet. The customers for a particular provider may all be connected
through some regional network spanning a city, county, or several counties,
depending on the population base. In some cases, the customers might be large com-
panies or universities that have their own internal hierarchical structure. As Section
7.2 discussed, they may divide their network into subnets, each having a unique
identifier. These subnets would then provide eventual access to the people who use
the services.
Since there will be many network providers, part of the address of Figure 7.37
will identify the provider. Thus, routing done to find the correct provider is done
independent of the provider’s customers. The network provider would then assign
subscriber IDs to its customers. Some large companies may define their own sub-
nets. Each would have its own subnet number, and the full IPv6 addresses of each
subnet would contain the same subscriber number. Finally, the subnets connect
users. Each user on the same subnet has a different interface ID but they all have the
same subnet, subscriber, and provider IDs. All of this is really just an extension of
the hierarchical routing strategies discussed in Section 7.2.
Finally, the registry ID in Figure 7.37 accounts for international or continental
borders. A Canadian registry will maintain a list of authorized providers in Canada.
Similar registries will exist in the United States, Europe, and so on. Thus, the reg-
istry ID is at the top level in the hierarchy and allows for some routing decisions to
2942 | Ch 07 Page 514 Thursday, February 17, 2000 1:18 PM

514 CHAPTER 7 WIDE AREA NETWORKING

80 bits
16 bits 32 bits

00 0 11 1 IPv4 address

(a) IPv4-mapped address

96 bits
32 bits

00 0 IPv4 address

(b) IPv4-compatible address

F i g u re 7 . 3 9 IPv4 Addresses in an IPv6 Format

be made based on geography. This would help packets sent from Canada to the
United States to avoid European routers.

Compatibility with IPv4 There are many millions of computers communicating


using IPv4. Such a large number prohibits any possibility of converting to IPv6
overnight or during a weekend. The coordination difficulty, inevitable problems,
and costs make this scenario impossible. Upgrading the world’s computers to IPv6
will require many years because individual sites must define their own timetables
for implementation. Consequently, both IPv4 and IPv6 routers must be able to
coexist and maintain all necessary connections. IPv6 protocols are designed to rec-
ognize IPv4 protocols. On the other hand, IPv4 protocols were designed well
before IPv6 and have no knowledge of it. This presents some problems that must be
solved.
To help solve these problems the IPv6 address structure allows IPv4 address
types. Figure 7.39 shows two ways to put an IPv4 address into an IPv6 address struc-
ture. Since the IPv6 addresses are larger than IPv4 ones, it is not terribly difficult to
find a way to store IPv4 addresses. The tricky part is to make the two protocols work
together. Figure 7.39a shows an IPv4-mapped address. Suppose a packet must go
through a network of IPv6 routers to get to an IPv4 destination. One option is for the
routers to revert to IPv4 whenever the destination is an IPv4 node. Since the purpose
of IPv6 was to improve on IPv4, that’s not a good option.
If routers run IPv6, how will they know the address is that of an IPv4 node and
that they should not interpret it according to the IPv6 hierarchy? Again, this is where
the address type comes in. The eighty 0s and sixteen 1s designate an IPv4 address.
Consequently, routers interpret addresses according to IPv4 rules as opposed to
those suggested by Figure 7.37.
2942 | Ch 07 Page 517 Thursday, February 17, 2000 1:18 PM

7.5 TRANSPORT PROTOCOLS 517

buffer
Error occurs during translation
of frame format or during
buffering.
router

token ring frame X.25 frame


IP IP
packet packet

X.25 packet-
token ring
LAN switched
network

Figure 7.41 Error Undetected by Lower-Layer Detection Techniques

• Flow control. It limits how much information one station can send to another
without receiving some acknowledgment. If this sounds familiar, great! You are
remembering some of the information from previous chapters. In Chapter 5 we
discussed flow control and its relevance to the data link layer. To have flow con-
trol again in the transport layer may seem strange at first, but remember that the
transport layer must operate independently of the lower layers. Lower layers
may allow more or less (or no) flow control. In order to preserve this indepen-
dence a transport layer may use its own flow control. Thus, it may seem redun-
dant, but independence often introduces redundancy. Furthermore, the transport
layer defines flow control between the end users. Data link protocols define flow
control between two intermediate, but adjacent, entities.
• Error detection. This is another case that seems to duplicate lower-layer fea-
tures. Some errors, however, escape lower-layer error detection. This statement
does seem unusual because it means that even if data link error detection
provides reliable transmission along each link there is still no guarantee of
error-free transmission between the source and destination. How can this be?
Consider the router in Figure 7.41 (taken from Figure 7.30). Suppose it receives
the IP packet intact, but an error that affects the packet’s contents occurs during
reformatting of the frame containing the packet. Any number of software or
hardware errors can cause such a problem. Since the checksum is calculated
after the new frame is created it includes the erroneous data. Strictly speaking, it
is not a transmission error because it occurred while the packet was in the pos-
session of the router. But try telling that to the transport user, who saw his or her
data changed while in transit. A transport-layer error detection mechanism
would detect this error.
2942 | Ch 07 Page 519 Thursday, February 17, 2000 1:18 PM

7.5 TRANSPORT PROTOCOLS 519

source port destination port

sequence number

acknowledgment number
32 bits
header
each header flags window
length

checksum urgent pointer

options

data

Figure 7.43 TCP Segment

• Destination port (16 bits). Identifies the application to which the segment is
sent. This is different from the IP address, which specifies an Internet address.
Since many applications can run at the same Internet node, this field identifies
which one. In the next section we’ll see how you can define your own ports to
define communications between applications running at different sites. Port
numbers below 256 are called well-known ports and have been assigned to

Figure 7.42 TCP as a User-to-User Service

TCP user TCP user

data data

TCP data data TCP


segment segment

IP TCP
segment internetwork
TCP
segment
IP
packet packet
2942 | Ch 07 Page 519 Thursday, February 17, 2000 1:18 PM

7.5 TRANSPORT PROTOCOLS 519

source port destination port

sequence number

acknowledgment number
32 bits
header
each header flags window
length

checksum urgent pointer

options

data

Figure 7.43 TCP Segment

• Destination port (16 bits). Identifies the application to which the segment is
sent. This is different from the IP address, which specifies an Internet address.
Since many applications can run at the same Internet node, this field identifies
which one. In the next section we’ll see how you can define your own ports to
define communications between applications running at different sites. Port
numbers below 256 are called well-known ports and have been assigned to

Figure 7.42 TCP as a User-to-User Service

TCP user TCP user

data data

TCP data data TCP


segment segment

IP TCP
segment internetwork
TCP
segment
IP
packet packet
2942 | Ch 07 Page 523 Thursday, February 17, 2000 1:18 PM

7.5 TRANSPORT PROTOCOLS 523

(modulo 232) sequence numbers, where each increment is equal to the number of data
bytes in the previous segment. We will elaborate shortly when we discuss flow control.
Terminating connections is similar to establishing them. TCP provides full-
duplex communication, however, so one entity wanting to disconnect does not nec-
essarily mean the other is ready. Basically, both parties must agree to disconnect
before doing so. Consequently, another three-way handshake protocol is used to ter-
minate a connection (Figure 7.45):
1. TCP entity A gets a CLOSE request from its application (time t1). It responds by
sending a TCP segment with the FIN flag set and sequence field = x. The FIN
flag indicates there is no more data and that the current segment represents a
disconnect request. The parameter x represents the current sequence count the
TCP entity had been maintaining.
2. TCP entity B receives the segment (time t2). It responds by notifying its applica-
tion of the request to disconnect, effectively telling it no more data is on the
way. It also sends a TCP segment back to A acknowledging receipt of the
request. Meanwhile B’s application could continue to send data or simply pre-
pare to issue its own disconnect request.
3. TCP entity B gets a CLOSE request from its application (time t3). It sends a TCP
segment to A with the FIN flag set and acknowledgment field = x + 1.

Figure 7.44 Three-Way Handshake Protocol

A B
Send TCP segment
with SYN = 1 and t1
sequence field = x.
Send TCP segment with SYN = 1,
t2 acknowledgment field = x + 1,
and sequence field = y.

Send TCP segment


with acknowledgment t3
field = y +1.

Send data TCP segments. Include


sequence numbers beginning with
y + 1 and acknowledgments
Send data TCP segments. Include beginning with x + 1.
sequence numbers beginning with
x + 1 and acknowledgments
beginning with y + 1.

time time
2942 | Ch 07 Page 524 Thursday, February 17, 2000 1:18 PM

524 CHAPTER 7 WIDE AREA NETWORKING

4. When TCP entity A receives the acknowledgment (time t4), it sends an acknowl-
edgment and disconnects. When the acknowledgment arrives at B (time t5), it
also disconnects.

Flow Control Once the initial connection is made the two TCP entities can
exchange segments using full-duplex communication, buffering both the segments they
send and those they receive. The TCP entity buffers segments it sends because there is
no guarantee the segment will arrive. Therefore it may have to retransmit it. It buffers
the ones it receives because there is no guarantee segments arrive in order. Remember,
this is a logical connection as opposed to a physical one and any number of problems in
a lower layer can cause delivery problems. Effectively the entities exchange segments
using a variation of the sliding window protocols discussed in Chapter 5. We will not
repeat a detailed discussion of flow control, but we do focus on a couple of differences
between TCP flow control and the flow control discussed in Chapter 5:
• Here, the sequence number refers to byte sequences instead of packet (or seg-
ment) sequences.
• Each entity can alter the size of the other’s sending window dynamically using
the segment’s window field.
Each entity implements flow control using a credit mechanism, also called a
window advertisement. A credit, stored in the segment’s window field, specifies
the maximum number of bytes the entity sending this segment can receive and
buffer from the other entity. This number is in addition to those already received and
buffered (but not yet taken by a higher layer). The TCP entity getting this segment

Figure 7.45 TCP Disconnect Protocol

TCP A TCP B
Receive an CLOSE
primitive from the application. t1 Receives disconnect
Send TCP segment with FIN = 1 request and notifies application there
and sequence field = x. t2 is no more data. Acknowledge
request by sending TCP segment
with acknowledgment field = x + 1.

Receive an CLOSE primitive


from the application. Send TCP segment
t3 with FIN = 1, sequence field = y,
and acknowledgment field = x + 1.
Send TCP segment with t
acknowledgment field = y + 1. 4
t5

time time
2942 | Ch 07 Page 525 Thursday, February 17, 2000 1:18 PM

7.5 TRANSPORT PROTOCOLS 525

A B
initial sequence number = 100 initial sequence number = 700

data , s = 101, a = 701,

data , s = 201, a = 701,

wait for t1 data , s = 701, a = 301, c = 0 t2 first segment


more credit removed from
data , s = 801, a = 301, c = 200 buffer; also finds
100 more bytes
of buffer space
data , s = 301, a = 901,

data , s = 401, a = 901,


wait for t3
more credit

time time
All segments contain 100 data bytes
s = sequence; a = acknowledgment

Figure 7.46 Flow Control Using a Credit Mechanism

uses the credit to determine how many more bytes it can send before it must wait for
an acknowledgment or for the credit to increase.
Figure 7.46 shows an example of this mechanism. We assume that the two enti-
ties have already negotiated the initial connection, initial sequence numbers, and
credits using the three-way handshake. TCP entities A and B have initial sequence
numbers 100 and 700, respectively. We also assume that each segment contains 100
bytes of data and that each entity can buffer up to 200 bytes. That is, each has a
credit of 200. Entity A starts by sending two segments, one with sequence number
(s) 101 and the other with sequence number 201. The acknowledgments (a) indicate
what A is expecting from B. To simplify this example we will show only the credit
values in packets that B sends to A.
After sending the second frame, A has used up its credit and must wait (time t1).
Later it receives a segment from B containing a sequence number equal to 701 and an
acknowledgment equal to 301. This means B has received bytes sequenced up to 300
and is expecting byte number 301 next. The segment also contains a credit (c) of 0
because the two segments that B has received are still in B’s buffers. In short, B has no
room for new segments and indicates this using a credit of 0. Consequently, A must
still wait. At time t2, B delivers the first segment it received to a higher layer, thus
freeing up 100 bytes of buffer space. The second segment is still there, so that buffer
space is still not available. However, let’s assume that at this point B has also been able
to increase its total buffer space to 300 bytes. Since the second segment containing the
2942 | Ch 07 Page 529 Thursday, February 17, 2000 1:18 PM

7.5 TRANSPORT PROTOCOLS 529

a connectionless transport-layer protocol. It is less complex than TCP, as indi-


cated by the format of a UDP segment (Figure 7.47). It contains very little over-

Table 7.12 TCP Primitives


NAME TYPE DESCRIPTION
ABORT Request Close the connection because of error.
ACTIVE-OPEN Request Initiate a connection.
ACTIVE-OPEN- Request Initiate a connection and include data with the
W/DATA request.
ALLOCATE Request Increase buffer space for incoming data.
CLOSE Request Close the connection normally.
CLOSING Indication Tells TCP user that the remote TCP entity has
issued a CLOSE.
DELIVER Indication Tells TCP user that data has arrived.
ERROR Indication Indicates an error has occurred.
FULL-PASSIVE- Request Tells the TCP entity the user is able to accept con-
OPEN nection requests from a specified remote site.
OPEN-FAILURE Confirm Tells TCP user the previous ACTIVE-OPEN request
failed.
OPEN-ID Confirm Provides the name associated with the connection
requested by the ACTIVE-OPEN request. Requires
acceptance of the request by the remote site.
OPEN-SUCCESS Confirm Tells TCP user the previous ACTIVE-OPEN request
succeeded.
SEND Request Request to send data over the connection.
STATUS Request Requests connection status.
STATUS-RESPONSE Confirm Responds to STATUS request with connection status.
TERMINATE Confirm Tells the TCP user the connection has ended.
UNSPECIFIED- Request Tells the TCP entity the user is able to accept con-
PASSIVE-OPEN nection requests from any remote site.

Figure 7.47 UDP Segment

source port destination port

length checksum

data
2942 | Ch 07 Page 534 Thursday, February 17, 2000 1:18 PM

534 CHAPTER 7 WIDE AREA NETWORKING

user makes request


through a client program

Local Remote
machine machine
runs a runs a
client Network server
program program

server has access


to user files

Auxiliary
storage

Figure 7.49 Client/Server Model

S OCKET D ATA S TRUCTURES


When we eventually discuss some of the socket calls, we will have to describe the
parameters passed to them. Some of these parameters have types that are designed
specifically for network communications. Therefore, we begin by discussing different
data structures required by socket calls. Each of these structures is located in a UNIX
header file. We will specify which header files are required later.
The first structure we need is
struct sockaddr_in {
u_short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8]
}

where
struct in_addr {
2942 | Ch 07 Page 539 Thursday, February 17, 2000 1:18 PM

7.6 SOCKET PROGRAMMING 539

also contains a sequence number, a field indicating how many data bytes it contains, a
field indicating which packet is the last in a stream, and a checksum field (which we
don’t use here). For simplicity, these fields are type int. Finally, the remaining field is
an array with a storage capacity of 20 bytes, representing the data in the packet.
A cursory examination of the client shows it has four C functions: openfile,
opensocket, makeconnection, and getfile. The function openfile prompts the user to
enter a name under which the client will store the transferred file. Once the user
enters the name, the function opens it in write mode. If all goes well the function
returns the file identifier. The second function, opensocket, creates a socket. It con-
tains a provision to exit the program if the socket call fails. If successful the function
returns the socket identifier.

Figure 7.50 Outline of Client and Server Using Socket-Related Commands

CLIENT SERVER
socket (creates socket) socket (creates socket)
: :
: :
gethostbyname (maps remote host name to an IP gethostname (gets local host’s name)
address)
: gethostbyname (maps the name to an IP address)
: :
connect (issues a connection request to a specified :
server on the remote host)
: bind (specifies IP address and port number)
: :
: :
: listen (puts socket in passive mode; server is ready
to accept requests)
: :
: :
: accept (accepts a connection request)
: :
: :
:
exchange information via send and recv commands exchange information via send and recv commands
: :
: :
close (terminates connection) close (terminates current connection)
2942 | Ch 07 Page 540 Thursday, February 17, 2000 1:18 PM

540 CHAPTER 7 WIDE AREA NETWORKING

/*************************************/
/* CLIENT */
/* CLIENT */
/* CLIENT */
/*************************************/
/* This program is designed as a client that will call on a server running on another machine. The assumed
protocol is TCP/IP and connections are via the Internet */

#define PACKETSIZE 20
#include <sys/types.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

#define PORTNUM 50000

typedef enum {data, ack} servicetype;

/* transmission unit for this program’s protocol */


typedef struct
{
servicetype service; /* type of packet */
int sequence; /* packet’s sequence number */
int datasize; /* amount of data (in bytes) in packet */
int last; /* last packet indicator */
char data[PACKETSIZE]; /* holds data */
int checksum; /* for error detection */
} PACKET;

/*******************************************/
/* open a file and return its identifier */
/*******************************************/
FILE * openfile( )
{
char * filename;
FILE * fid;

printf("This program will copy a file from a remote server\n");


printf("Enter the name under which the file should be saved>");
filename = (char *) malloc(30);
scanf("%s", filename);

Figure 7.51 Client Program (continues on next page)


2942 | Ch 07 Page 541 Thursday, February 17, 2000 1:18 PM

7.6 SOCKET PROGRAMMING 541

if ((fid = fopen(filename, "w")) == NULL)


{
printf("error opening file\n");
exit (1);
}
free(filename);
return fid;
}

/*********************/
/* create a socket */
/*********************/
int opensocket( )
{
int s;

if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0)


{
perror ("socket error");
exit (1);
}
return s;
}

/*************************************************************/
/* get remote host information and connect to remote server */
/*************************************************************/
void makeconnection(int argc, char *argv[ ], int s)
{
struct hostent * ph; /* holds remote host name and address information */
struct sockaddr_in sa; /* holds IP address and protocol port */

memset(&sa,0,sizeof(sa)); /* zero out the sa structure */


if (argc !=2) /* Be sure the command to run the client contains the remote
host's text address */
{
printf ("Error in command line\n");
exit (1);
}
if ((ph = gethostbyname (argv[1])) == NULL) /* get relevant information about the remote host */
{
printf("error in gethostbyname\n");
exit(1);

Figure 7.51 (continued)


2942 | Ch 07 Page 542 Thursday, February 17, 2000 1:18 PM

542 CHAPTER 7 WIDE AREA NETWORKING

}
/* Store remote host’s IP address, server’s port number,
protocol type into sa structure */
memcpy((char*) &sa.sin_addr, ph->h_addr, ph->h_length);
sa.sin_port = htons ((u_short) PORTNUM); /* specify port number of remote server */
sa.sin_family = ph->h_addrtype;
if (connect (s, &sa, sizeof (sa)) < 0) /* connect to remote server */
{
perror ("connect error");
exit (1);
}
}

/***********************************************************/
/* get a file from the remote server in fixed-size packets */
/***********************************************************/
void getfile(FILE * fid, int s)
{
PACKET * packet; /* protocol packet */
int i;

packet = (PACKET *) malloc (sizeof(*packet));


do
{
if (recv(s, packet, sizeof(*packet), 0) <= 0) /* get packet from remote server */
{
printf("error reading\n");
exit(1);
}
printf("Received packet %4d: %s\n", packet->sequence, packet->data);
for (i=0;i < packet->datasize; i++) /* Store packet's contents into text file */
putc (packet->data[i], fid);
if (packet->sequence % 5 == 4) /* If this was the 5th packet, send an acknowledgment */
{
printf("acknowledging 5th packet-Press enter to continuen");
getchar();
packet->service = ack;
if (send(s, packet, sizeof *packet, 0) <= 0) /* Send the acknowledgment */
{
printf("ERROR in send\n");
exit(1);
}
}

Figure 7.51 (continued)


2942 | Ch 07 Page 543 Thursday, February 17, 2000 1:18 PM

7.6 SOCKET PROGRAMMING 543

} while (!packet->last); /* Continue repeating the above until the last packet is
received */
fclose(fid);
}

void main (int argc,char *argv[])


{
int s;
FILE * fid;

fid = openfile();
s = opensocket();
makeconnection(argc, argv, s);
getfile(fid, s);
close(s);
}

Figure 7.51 (concluded)

The function makeconnection gets remote host information and connects to the
server running on it associated with the specified port number. Remember, we are
assuming that the user enters the text address of the remote host when typing the
name of an executable client (e.g., myftp hercules.uwgb.edu). As such, the text string
hercules.uwgb.edu is stored in the main function parameter argv[1], and the other main
function parameter, argc, has a value of 2. The function calls gethostbyname to put rel-
evant remote host information into the hostent structure located via the pointer vari-
able ph. Then it moves other relevant information such as the server’s port number
into the socket address structure specified by the variable sa.* Once variable sa con-
tains necessary information, the function calls the function connect, thereby sending
a connection request to the server.
The last function is the most complex because it contains the rules governing
the file transfer. Yet, mercifully, it is simpler than many other protocols we have
described. We are truly beginning to see the advantages of layering now. As men-
tioned previously, the protocol requires the client to receive five packets, extract
their contents, and write them to a file. After receiving every fifth packet, the client
creates a packet of type ack (acknowledgment) and sends it back to the server. It
continues doing this until it receives a packet for which packet->last is 1. The func-
tion has a few printf and getchar commands that serve no purpose other than to let

*
The code contains a reference to a function htons (host to network short). When dealing with different
machines, an incompatibility in the way integers are stored may occur. Some machines store the most
significant bits in bytes with a larger address (little endian), whereas some store the most significant bits
in bytes with a smaller address (big endian). The htons operator makes sure that the network correctly
interprets data defined in your program.
2942 | Ch 08 Page 561 Wednesday, February 16, 2000 3:32 PM

8.1 INTERNET APPLICATIONS 561

window delimiters

scroll up scroll down

window buffered text not visible on screen

buffered text visible on screen

virtual terminal

Figure 8.1 Windowing of Buffered Text

T ELNET
One example of a network virtual terminal protocol is Telnet. It was designed for
the ARPANET and is one of the protocols in the TCP/IP suite. Perhaps most people
know Telnet as the application that allows remote logins.
To the user, a remote login appears to be no different than a login to a local
computer (Figure 8.2a). However, Figure 8.2b reflects the situation more accurately.
A user works at a PC (or is connected to another computer) that runs protocols to
connect to a network. The protocols establish a connection over the network to a
remote computer. The user and remote computer exchange commands and data
using protocols such as those discussed in Chapter 7. The user is working at a higher
layer, however, so this is all transparent and appears much like a local login. The
only difference may be slight delays between responses, especially if the remote
computer is far away or network traffic is heavy.
Telnet works in a client/server mode (Figure 8.3). That is, a PC (or other com-
puter) runs Telnet (client) locally and transmits data between the user and network
protocols. It also can format and send specific commands, some of which we will
describe shortly. The remote computer (server) also runs its version of Telnet. It per-
forms similar functions, exchanging data between network protocols and the oper-
ating system and interpreting user-transmitted commands.
A user typically uses Telnet in a couple of ways. One is to log in to a local com-
puter, wait for a system prompt (“>” in our example), and enter the command
> Telnet text-address
The text address specifies the host computer to which the user wants to connect.
Telnet then calls on the transport protocol to negotiate and establish a connection with
2942 | Ch 08 Page 562 Wednesday, February 16, 2000 3:32 PM

562 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

the remote site. Once connected, the user must log in to the remote site by specifying
the account number and password. Another way to use Telnet is to enter the command
Telnet without a text address. The local system will respond with a Telnet prompt
(Telnet >). If you are running on a graphical user interface (GUI), there is typically a
Telnet icon you can access. Either way you can enter Telnet commands (or select
them from a menu). For example, you can connect to the remote site by entering a
connect or open command (depending on the local system) specifying the text address.
Once connected, Telnet works in the background completely transparent to the
user. However, the user can escape from the remote login to give subsequent com-

Figure 8.2 Remote Connection

computer

(a)
computer

network
computer

(b)

Figure 8.3 Telnet Client/Server Relation

User

client running server running


Telnet Telnet

computer

network
2942 | Ch 08 Page 562 Wednesday, February 16, 2000 3:32 PM

562 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

the remote site. Once connected, the user must log in to the remote site by specifying
the account number and password. Another way to use Telnet is to enter the command
Telnet without a text address. The local system will respond with a Telnet prompt
(Telnet >). If you are running on a graphical user interface (GUI), there is typically a
Telnet icon you can access. Either way you can enter Telnet commands (or select
them from a menu). For example, you can connect to the remote site by entering a
connect or open command (depending on the local system) specifying the text address.
Once connected, Telnet works in the background completely transparent to the
user. However, the user can escape from the remote login to give subsequent com-

Figure 8.2 Remote Connection

computer

(a)
computer

network
computer

(b)

Figure 8.3 Telnet Client/Server Relation

User

client running server running


Telnet Telnet

computer

network
2942 | Ch 08 Page 566 Wednesday, February 16, 2000 3:32 PM

566 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

user A user B

convert file structure convert virtual file


to a virtual file structure to a real file
structure. structure.

virtual file virtual file


structure transmit virtual file. structure

Figure 8.4 File Transfer between Computers Supporting Different File Structures

A virtual file must preserve the essential ingredients of a file. For example, it
must contain the file’s name, attributes, and coded information on the actual struc-
ture to allow for proper translation. Of course, it must also contain the data.
Another issue in file transfer is accessibility. A file transfer system should not
honor every request. It must consider protection. Is the file read-only? Can the user
update the file or execute its contents? For that matter is the requester allowed access
at all? Law enforcement and defense agencies would not want a system that allows
access to all of their files. Multiple accesses to files also must be considered. Are
they allowed? Passwords, locks, and keys are used for file protection and concur-
rency control.

FTP One common file transfer protocol is called just that—File Transfer Pro-
tocol, or FTP (no kudos for imagination here). It is another protocol in the TCP/IP
suite and is built on the same client/server paradigm as Telnet. A user, interacting
with a local FTP program, connects to a remote site also running FTP. As with
Telnet this can be done in a couple of ways. First is to simply enter the command*
ftp text-address
which will establish a connection to the specified remote computer, much as Telnet
does. The second way is to enter
ftp
and wait for the prompt ftp>. Next the user enters
ftp> open text-address
to establish the connection. Sometimes connect is used instead of open. Once con-
nected, the user is asked to enter a user identification followed by a password. On
entering the appropriate identification and password the user then can peruse subdi-
rectories, get directory lists, and get copies of files.

*
As with Telnet, FTP can be run from a GUI that allows you to choose menu options from a list. We’ll
proceed as if you were entering your own commands. It works the same either way.
2942 | Ch 08 Page 571 Wednesday, February 16, 2000 3:32 PM

8.1 INTERNET APPLICATIONS 571

1 /usr/users/shayw-$>ftp ds.internic.net
2 Connected to ds.internic.net.
3 220- InterNIC Directory and Database Services
4 220-
5 220-
6 220-Welcome to InterNIC Directory and Database Services provided by AT&T.
7 220-These services are partially supported through a cooperative agreement
8 220-with the National Science Foundation.
9 220-
10 220-Your comments and suggestions for improvement are welcome, and can be
11 220-mailed to [email protected].
12 :
13 :
14 display message not relevant to our discussion
15 :
16 :
17 220-
18 220- ****************************
19 220 ds2 FTP server (Version 4.105 Fri Jan 5 14:34:54 EST 1996) ready.
20 Name (ds.internic.net:shayw): anonymous
21 331 Guest login ok, send your email address as password.
22 Password: [email protected]
23 230- Guest login ok, access restrictions apply.
24 230- Local time is: Wed Aug 6 16:17:05 1997
25 230
26 Remote system type is UNIX.
27 Using binary mode to transfer files.
28 ftp> cd rfc
29 250 CWD command successful.
30 ftp> get rfc-index.txt
31 200 PORT command successful.
32 150 Opening BINARY mode data connection for rfc-index.txt (299856 bytes).
33 226 Transfer complete.
34 299856 bytes received in 3.6 seconds (82 Kbytes/s)
35 ftp> quit
36 221 Goodbye.
37 /usr/users/shayw-$>

Figure 8.5 Figure 8.5 Sample Use of FTP to Transfer a File

mary responsibility is to make sure mail is transferred between different hosts. By


contrast, the local service is responsible for distributing mail to specific recipients.
Figure 8.6 shows the interaction between local mail, SMTP, and TCP. When a
user sends mail, the local mail facility determines whether the address is local or
requires a connection to a remote site. In the latter case, the local mail facility stores
2942 | Ch 08 Page 572 Wednesday, February 16, 2000 3:32 PM

572 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

mail mail

local
mail
Call mail facility service Store mail in mailbox.
to send mail. mailbox SMTP retrieves
user mail and establishes
a remote connec-
mail mail tion via TCP. It then
delivers mail
according to its
local mail protocol.
mail
Deliver mail to service Call local service
recipient. to deliver mail.
recipient remote host

Figure 8.6 SMTP Interacting with Local Mail and TCP

the mail (much as you would put a letter in a mailbox), where it waits for the client
SMTP. When the client SMTP delivers the mail, it first calls TCP to establish a con-
nection with the remote site. When the connection is made, the client and server
SMTPs exchange packets and eventually deliver the mail. At the remote end the
local mail facility gets the mail and delivers it to the intended recipient.
Figure 8.7 shows the packet exchange between the client and server. The
packets are also called SMTP protocol data units (PDUs) or simply commands.
When the TCP connection is made the server sends a 220 PDU indicating it is ready
to receive mail. The number 220 serves to identify the type of packet. Afterward, the
client and server exchange the identities of their respective sites. Next, the client
sends a MAIL FROM PDU indicating there is mail and identifying the sender. If the
server is willing to accept mail from that sender it responds with a 250 OK PDU.
The server then sends one or more RCPT TO PDUs specifying the intended recipi-
ents to determine whether the recipients are there before sending the mail. For each
recipient, the server responds with a 250 OK PDU (recipient exists) or a 550 recipient
not here PDU. After the recipients have all been identified, the client sends a DATA
PDU indicating it will begin mail transmission. The server’s response is a 354 start
mail PDU, which gives the OK to start sending and specifies a sequence the client
should use to mark the mail’s end. In this case the sequence is <CR> <LF> . <CR>
<LF>.* The client sends the mail in fixed-size PDUs, placing this sequence at the
mail’s end. When the server gets the last PDU, it acknowledges receipt of the mail

*
This is the same as carriage return, line feed, period, carriage return, line feed. This sequence cannot
appear in the body of the mail because SMTP disallows sending mail containing a single period on a
separate line.
2942 | Ch 08 Page 573 Wednesday, February 16, 2000 3:32 PM

8.1 INTERNET APPLICATIONS 573

mail client mail server


TCP entities
establish a TCP connection.
220: ready for mail
HELO: client name

server name
MAIL FROM: sender’s name

250 OK

RCPT TO: recipient name 1


250 OK or 550 no such recipient

RCPT TO: recipient name n

250 OK or 550 no such recipient


DATA
354 start mail, end with
<CR> <LF>. <CR> <LF>
send mail messages
{
<CR> <LF>. <CR> <LF>

250 OK
QUIT
221 closing channel

TCP entities
time close connection. time

Figure 8.7 Sending Email Using SMTP

with another 250 OK PDU. Finally, the client and server exchange PDUs indicating
they are ceasing mail delivery, and TCP releases the connection.
This description has outlined the basic functionality of SMTP and has not gone
into the details of PDU format or issues such as forwarding mail or responding to
nonexistent addressees. More information on SMTP can be found in References
[Co95] and [Ru89] and in RFC documents 788 and 821.

S IMPLE N ETWORK M ANAGEMENT P ROTOCOL


The Simple Network Management Protocol (SNMP) is a management protocol
designed to make sure network protocols and devices not only work but work well.
It allows managers to locate problems and make adjustments by exchanging a
sequence of commands between a client and a server. Unlike previous applications,
2942 | Ch 08 Page 574 Wednesday, February 16, 2000 3:32 PM

574 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

SNMP router
client

user
Client gets information
from SNMP servers via router Routers and hosts run
UDP. SNMP servers and
maintain basic
host information.
network

Figure 8.8 SNMP Architecture

it runs on top of UDP instead of TCP. Still, because it is an important part of Internet
management it warrants a discussion.
Figure 8.8 shows the SNMP architecture. A network manager runs a manage-
ment client program at a site that communicates with a management server program
at another site. Typically the server programs are run on remote hosts and especially
network routers. Both management programs use commands defined by the SNMP
protocol. Primarily the commands define how to request information from a server
and send information to a server or client.
SNMP has several goals (described in RFC 1157). The first is to simplify
SNMP functions to reduce support costs and make SNMP easier to use. Second, it
must be extensible to accommodate future updates in network operations and man-
agement. Third, the protocol must be independent of design specifics of hosts or
routers. The result is an application-layer protocol that interfaces with transport
services.
Because SNMP is a management application it must know what processes it is
to manage and how to refer to them. The routers and hosts that SNMP manages are
called objects. An object has a formal definition according to ASN.1 (Abstract
Syntax Notation 1), a formal language designed expressly for the definition of PDU
formats and objects. A formal treatment of the objects and ASN.1 is far beyond the
scope of this text, but you can find some additional information in References
[Co95], [Co94], and [Ro96].

Management Information Base Each object’s server maintains a database of


information that describes its characteristics and activities. Because there are dif-
ferent object types, a standard defines precisely what should be maintained. This
standard, the management information base (MIB) was defined by the group that
proposed SNMP. There are eight categories of information specified by MIB. As
before, a complete description of each one is very detailed, and References [Co95],
[Co94], and [Ro96] have more information. Here we will specify each of the cate-
gories and some examples of the information they contain.
2942 | Ch 08 Page 581 Wednesday, February 16, 2000 3:32 PM

8.2 WORLD WIDE WEB 581

<html>
<head>
<title>The Title Goes Here</title>
</head>
<body>
<center><img src = “logo.gif"></center>
<hr>
<center> <h1>Links to Courses </h1> </center>
This is a short paragraph containing links to three courses. Each can be accessed by clicking
on the course number. The first one is titled<B> Numerical Analysis</B> and has a course
number of <A HREF = “http://www.uwgb.edu./~shayw/syll350.htm">266-350</A>. The second course
is titled <B>Data Structures</B> and has a course number
<A HREF = “http://www.uwgb.edu./~shayw/syll351.htm">266-351</A>. Finally the third course is
titled <B> Data Communications and Computer Networks</B> and has a course number
<A HREF = “http://www.uwgb.edu./~shayw/syll358.htm">266-358</A>.
<hr>
If you have any comments or questions you can send them to <A HREF="mailto:[email protected]">
Bill Shay</A> at the University of Wisconsin-Green Bay
<hr>
</body>
</html>

Figure 8.10 Figure 8.10 Sample HTML Document

The body is where all of the text information, graphic images, and hypertext
links will eventually go. For example, to display an image you must first create an
image and store it in a file. The HTML image tag (<img>) specifies that file, and the
image is displayed when viewing the document. The option in the image tag of
Figure 8.10 specifies the file as “logo.gif.” The image in Figure 8.11, which is our
university’s logo, was created previously and stored in that file. The center tag
delimiters (<center> and </center>) on either side of the image tag cause the image
to be centered on the screen. If the center tag delimiters were not present, the image
in Figure 8.11 would have appeared on the left side of the screen. The body contains
a couple tags (<hr>) that insert a horizontal rule. Figure 8.11 shows three dim hori-
zontal lines that are used as separators. This is a common visual aid to help separate
different parts of a display.
Most of the rest of the body contains text, which appears in Figure 8.11. There
are, however, some differences in the way the text is displayed. Some text has a
larger typeface, some is in boldface, and some is underlined (which actually corre-
sponds to links). Again, HTML tags make the difference. The header tag delimiters
(<h1> and </h1>) define a level 1 header. They cause any text between them to be
displayed in a larger typeface. There are also tags corresponding to <h2>, <h3>,
<h4>, <h5>, and <h6>, which have a similar effect except the type sizes vary. Tag
<h1> defines the largest and tag <h6> the smallest. Also, any text between the bold
tags (<B> and </B>) appears in boldface.
2942 | Ch 08 Page 586 Wednesday, February 16, 2000 3:32 PM

586 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

The first step is to show how to define a form and how to use it for both input and
output. Figure 8.14 shows HTML commands that define the form of Figure 8.12. The
first half of the form simply contains the text providing user instructions, as shown in
Figure 8.12. Within the text are two font tags with a color option specifying the 24-bit
color value (8 bits for each of red, green, and blue) of the delimited text. In this case
the color value of ff0000 means there is only a red component, so the delimited text
(in this case, the words calculate and clear) appears on a Web browser in red.

Figure 8.13 Responses to Unexpected User Actions

(a) User did not check any boxes (b) User did not enter any numbers

Figure 8.14 HTML Commands to Define the Form of Figure 8.12

<form>
This is a form that uses a JavaScript function and an event handler to calculate
different statistical functions. You can find the total, the largest, and/or the
smallest of a list of numbers that you can enter in the text window below. All you
need to do is enter a collection of numbers one at a time and separated by a space.
Next click on the boxes depending on whether you want to calculate the total, find the
largest, or find the smallest. (You can click on any or all three).
When done click on the <FONT COLOR="ff0000">calculate </FONT>button. If you want to
start over, click on the <FONT COLOR="ff0000">clear </FONT>button. It will erase the
numbers you have entered and the results that are being displayed. You might notice
that the calculation will not work if you type more than one space between any two
numbers or if you leave a space after the last number. Well, I am not going to do
everything. This is a good exercise for you to do. Good Luck!!!<BR><BR><BR>
<left> Enter numbers here--> <Input type="text” Name="expr” size=30>
<Input Type="button” Value="calculate” Onclick="compute(this.form)">
<Input Type="reset” Value="Clear"><BR><BR></left>
<Input Type="checkbox” Name="gettotal">Click here to find the Total<BR>
<Input Type="checkbox” Name="getmin” >Click here to find the Smallest<BR>
<Input Type="checkbox” Name="getmax">Click here to find the Largest<BR><BR>
Total:------><Input Type="text” name="total” size=15><BR>
Smallest:---><Input Type="text” name="min” size=15><BR>
Largest:----><Input Type="text” name="max” size=15><BR>
</Form>
2942 | Ch 08 Page 589 Wednesday, February 16, 2000 3:32 PM

8.2 WORLD WIDE WEB 589

<Script language = javascript>

function MakeArray(form)
{
var ind1=0;
var ind2=0;
var blank=” “;
var i = 0;

while ( (ind2=form.expr.value.indexOf(blank, ind1)) != -1)


{
this[++i]= parseInt(form.expr.value.substring(ind1, ind2));
ind1=ind2+1
}
this[++i]=parseInt(form.expr.value.substring(ind1,form.expr.value.length));
this.length=i;
}

function dototal(myarray, form)


{
var sum=0;
for (var i=1; i<=myarray.length; i++)
sum = sum + myarray[i];
form.total.value=sum;
}

function domin(myarray, form)


{
var temp=myarray[1];

for (var i=2; i<=myarray.length; i++)


if (myarray[i] < temp)
temp = myarray[i];
form.min.value=temp;
}

Figure 8.15 JavaScript Code for Client-side Programming (continues on next page)
2942 | Ch 08 Page 590 Wednesday, February 16, 2000 3:32 PM

590 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

function domax(myarray, form)


{
var temp=myarray[1];

for (var i=2; i<=myarray.length; i++)


if (myarray[i] > temp)
temp = myarray[i];
form.max.value=temp;
}

function compute(form)
{
var myarray;

if (form.expr.value.length==0)
alert("You haven’t entered any numbers")
else
if ( !form.gettotal.checked && !form.getmin.checked && !form.getmax.checked )
alert("You haven’t checked any of the boxes")
else
{
myarray = new MakeArray(form);
if (form.gettotal.checked)
dototal(myarray, form);
if (form.getmin.checked)
domin(myarray, form);
if (form.getmax.checked)
domax(myarray, form);
}
}

</script>

Figure 8.15 (continued)

sequence of properties defined by the object hierarchy in Figure 8.16). If it is a


match, JavaScript calls an alert function, passing the string “you haven’t entered any
numbers”. The alert function causes a window like that in Figure 8.13b to appear. Of
course, if the length is not 0 that step is skipped and no alert box appears. Note that a
non-zero length does not mean the user has actually entered numbers. It means only
2942 | Ch 08 Page 591 Wednesday, February 16, 2000 3:32 PM

8.2 WORLD WIDE WEB 591

that the user has typed something. This script does not check the string for non-
numeric characters. We leave it as an exercise to expand error-checking capabilities.
Next, JavaScript must determine whether any of the checkboxes were selected.
Again it uses the object hierarchy to do this. There are three checkboxes named
gettotal, getmin, and getmax, and each is a property of the object form. Because each is
defined as type "checkbox", each has a property called checked. If the user moves the
mouse cursor over a checkbox and clicks a mouse button, the corresponding checked
property is set to true. Consequently, each checked property is either true or false
according to whether the corresponding checkbox was selected by the user. The
second if statement in compute compares the checked property of each checkbox and,
if all are false, displays another alert box.
If at least one checkbox is selected, control passes to the last else clause. The
first line,
myarray = new MakeArray(form)
calls a function that parses the user-entered string, and stores all the numbers in the
array named myarray. (We’ll see how that works shortly.) The remaining three if
statements again determine which checkboxes were selected. For each one that was
selected, JavaScript calls a function to do the designated task. For example, the func-
tion dototal sums up the values in the array myarray using a variable sum. The last line
in dototal stores the sum in form.total.value. This latter expression follows the object
hierarchy and assigns the sum as the value of a text box named total. Because of
this, the actual sum appears in that box on the form, as shown in Figure 8.12.
The functions domin and domax determine the smallest and largest values in
myarray, respectively. They assign the results in a manner similar to that in dototal.
The last piece of the puzzle is to describe how JavaScript extracts the numbers
from the user-entered text string. A full understanding of how this happens is prob-
ably not possible without a more complete description of JavaScript and its objects
and types. We will outline the main ideas and leave it to the reader to consult a text-
book on JavaScript for further details on their implementation.

Figure 8.16 JavaScript Object Hierarchy Relevant to Figure 8.15

document

form

expf get total get min get max total min max

value checked checked checked value value value

length index of substring


(method) (method)
2942 | Ch 08 Page 592 Wednesday, February 16, 2000 3:32 PM

592 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

form.expr.value

2 3 4 6 4 2

ind1 ind 2

The method substring


extracts the characters
between ind 1 and ind 2
and converts them to a
numeric format

Figure 8.17 Extracting Numbers from a Text String

Essentially, the line (from the function compute)


myarray=new MakeArray(form)
calls on a function MakeArray, which creates and returns an array object containing the
needed numbers. Within that function JavaScript code assumes the numbers are
stored in a text string with a single blank space separating each number. As before,
JavaScript refers to the string using the object notation form.expr.value. It then calls
on a method form.expr.value.indexOf(blank, ind1), which returns the first index (or
subscript) of the first blank character located past position ind1. Initially, ind1 is 0, so
the first call to this method finds the index of the first blank in the string. As the loop
is executed, Figure 8.17 shows how ind1 and ind2 relate to the text string. In general,
they delimit the characters representing one of the numbers entered by the user. The
two index values are used in a substring method that extracts a substring consisting
of characters between them. Finally, JavaScript uses the function parseInt to convert
that substring into a numeric format.
As JavaScript goes through the loop, it stores converted substrings into an
array object named this. As mentioned before, this is a keyword used to refer to a
calling object. In this case the function MakeArray acts much like a constructor for
the array object myarray. Consequently, used in this context this actually corre-
sponds to the object array myarray.

C OMMON G ATEWAY I NTERFACE AND


S ERVER - SIDE P ROGRAMMING
The last topic in this section addresses server-side programming. For example,
during your hours of Web surfing you may have wondered how a search engine
works. You know it accepts one or more keywords you give it and that something at
another site looks up possible references and sends them back to you. Our task here
2942 | Ch 08 Page 594 Wednesday, February 16, 2000 3:32 PM

594 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

www.uwgb.edu/htbin/cgi.exe).* The latter option indicates that the gateway program is


in a file named cgi.exe in a system directory named htbin. Generally, network
administrators require that gateway programs reside in a specific directory. For secu-
rity reasons, they want to avoid defining protection limits that allow anyone off site
to run programs in arbitrary accounts.
When a form is submitted using a get method, the HTTP client passes informa-
tion as a string. The string consists of the referenced URL and a list of name/value
pairs, each having the form “name=value.” There is typically one name/value pair
for each input item used to enter information. The name is that defined in the HTML
code and the value is whatever the user has indicated. A question mark character (?)
separates the name/value pairs from each other and from the URL. For example,
suppose the user entered “266-351” in the above form, as shown in Figure 8.18. The
HTTP client sends a character string of the form
http://www.uwgb.edu/htbin/cgi.exe?srch=266-351
Since there is only one input box in which to enter information, the string consists
only of the URL and one name/value pair, srch=266-351.
Because the action option specified a gateway program named cgi.exe, the
HTTP server passes the string to it. The gateway program must access that string
and extract the necessary information. To do this, the CGI uses environment vari-
ables accessible by the gateway program. There are several different environment
variables, but the one of concern here is query_string.
Figure 8.20 shows a gateway program written in C that does a “search” for whatever
the user enters in our form. Examination of the gateway program reveals that this is really
just a stub designed to test whether it can get the correct information from the environ-
ment variable and return the appropriate information to the user. The program contains an
array of structures hard-coded into it containing the information being sought. Each struc-

Figure 8.19 HTML Code for the Form of Figure 8.18

<form method="get” action="http://www.uwgb.edu/htbin/cgi.exe">


This form is used to simulate a search based on a course number. Enter a course number
in the space provided and a gateway program will return a link to the matching course
syllabus. Enter the word all and the program will return links to all courses to
which it has access.
<BR><BR>
Search String <Input Type="Text” Name="srch” size=8>
<Input Type="submit” Value = “submit">
<Input Type="reset">
</form>

*
This references a gateway program at the author’s site. Attempts at setting up your own gateway
programs must be cleared with network personnel at the intended site.
2942 | Ch 08 Page 595 Wednesday, February 16, 2000 3:32 PM

8.2 WORLD WIDE WEB 595

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include “cgilib.h”

// int cgi_show_env();

void listmatches();

// structure type subject to search


typedef struct {
char cnum[32];
char url[50];
char cname[32];
} entry;

void main(int argc, char *argv[])


{
// list of elements subject to search
entry mystuff[25]=
{ “266-350", “http:// www.uwgb.edu/~shayw/syll350.htm", “Numerical Analysis",
"266-351", “http:// www.uwgb.edu/~shayw/syll351.htm", “Data Structures",
"266-358", “http:// www.uwgb.edu/~shayw/syll358.htm", “Computer Networks",
};

int i;
int status;
char * srchstring; // search string passed over from html form

status = cgi_init(argc, argv);


srchstring = cgi_info("QUERY_STRING"); // gets search string from environment variable
if (srchstring = strchr(srchstring, ’=’))
srchstring++;
listmatches(mystuff, srchstring);
}

void listmatches(entry mystuff[25], char * srchstring)


{
int i;

cgi_printf("Content-type: text/html\n\n");
cgi_printf("<html>\n");

Figure 8.20 C Code for Server Side CGI Programming (continues on next page)
2942 | Ch 08 Page 596 Wednesday, February 16, 2000 3:32 PM

596 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

cgi_printf("<body>\n");
cgi_printf("<h1>Search results</h1>\n");
cgi_printf("<h3>This is a list of links based on your search of</h3>");
cgi_printf("<h2>%s</h2></Center>\n\n\n", srchstring);
cgi-printf("<img src=http://www.uwgb.edu/~shayw/cool_fli.gif>
for (i=0;i<=2;i++)
{
if (strstr(mystuff[i].cnum, srchstring)||strstr(srchstring, “all") )
{
cgi_printf("<A href=%s> %s </A>\n<BR>",
mystuff[i].url, mystuff[i].cname);
}
}
cgi_printf("</body>\n");
cgi_printf("</html>\n");
}

Figure 8.20 (concluded)

ture consists of a course number (e.g., “266-351”), a URL, and a course title. This pro-
gram will extract a course number from the query_string environment variable, search the
array for a matching number, and return both the course name and URL to the client.
Through the returned URL, the user sees a reference to the selected course.
For example, if the user entered “266-351” as Figure 8.18 shows, then the response
returned would be as shown in Figure 8.21. The search results form echoes the string
the user entered and below it displays a link represented by a course name. Using this
form, the user can click on that name to follow the link. In effect we have mimicked
exactly what a search engine does. There is a provision in our gateway program to
return all URLs if the user enters the search string “all” instead of a course number. This
was done to test whether the gateway program could return multiple links.
The only step left is to describe how the gateway program of Figure 8.20 gener-
ated the results in Figure 8.21. Most of the program is understandable to someone
with a knowledge of C, so we will focus on parts that relate strictly to the exchange
of information with the client. As previously stated, the first thing the gateway pro-
gram must do is get the query string. It does this through the statement
srchstring = cgi_info("QUERY_STRING");
which puts the string into the C variable srchstring. In this example we are assuming that
the form allows only one input box and that the user has entered only a single search
phrase (either a course number or the word all). This simplifies the program logic; we
leave it as an exercise to expand on this program. Since the search string has the form
url?srch=phrase
2942 | Ch 08 Page 598 Wednesday, February 16, 2000 3:32 PM

598 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

user A user B

PC PC

User A can send messages User B can use electronic mail


through the electronic to retrieve messages from his or
mail system. her mailbox.

electronic mail system

Mail system stores and retrieves


messages in mailboxes.

storage area

user B’s mailbox

Figure 8.22 Electronic Mail

8.3 ELECTRONIC MAIL: X.400 AND X.500 STAN-


DARDS

Once again we visit the topic of electronic mail (email), not because we like being
redundant but because the SMTP of Section 8.1 is not the only email protocol. An
entire series of standards developed by ITU-T describes the transfer and delivery of
mail. Recall that electronic mail allows users to exchange messages. The sender
enters a message and an identifier of the intended recipient. The message is then
deposited in that person’s “mailbox.” The recipient can check the mailbox and dis-
play messages at any time.
Figure 8.22 shows how electronic mail works from the user’s perspective. The
electronic mail service is an application with which a user interacts. Sending mail
means interacting with an electronic mail application that accepts mail and deposits
it in local storage near the intended recipient. The recipient then can display the
messages at his or her convenience.
Displaying messages is only a small part of the email service. For example, if a
user is on vacation for several weeks, messages may accumulate. Rather than going
through them sequentially, the user can request a list of them. The list reports
attributes such as the size of each message and who sent it. It also displays a short
comment describing the message. The comment could be “critical information about
2942 | Ch 08 Page 599 Wednesday, February 16, 2000 3:32 PM

8.3 E L E C T R O N I C M A I L : X .400 AND X .500 S T A N D A R D S 599

UA

UA
MTA C
MTA

MTA
MTA

UA
UA
UA: user agent
MTA: message transfer agent

MTS: message transfer system

MHS: message handling system


A B

Figure 8.23 Electronic Mail System Model

your future at this company” or “junk mail.” The sender must include the comment
because the electronic mail system has no idea what the message says. The list also
may specify whether the message is new or has been answered or forwarded. So
when you see 50 new “critical” messages from your boss, you might consider
answering them before perusing your junk mail!

X.400 M AIL S TANDARDS


Due to the popularity of email, the ITU-T issued its own standards for email in
1984. They are referred to collectively as the X.400 family of standards, and they
operate at the OSI application layer. X.400 also forms the foundation of the ISO
email system, MOTIS, and is the ISO analog to TCP/IP’s SMTP. It is based on a
model for message handling systems illustrated by Figure 8.23. The model has four
2942 | Ch 08 Page 600 Wednesday, February 16, 2000 3:32 PM

600 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

main parts: user agent (UA), message transfer agent (MTA), message handling
system (MHS), and message transfer system (MTS).
Superficially, the user agent interacts with the user and essentially defines what
the user can do. The MTAs define a collection of nodes that execute a protocol to
ensure proper routing of mail. They form the backbone of the mail system, and their
physical connections vary. They play a role similar to that of routers in internet-
works but operate at a higher OSI layer. Collectively the MTAs form the message
transfer system. The MTAs and UAs form the message handling system, which
ensures the eventual delivery of mail. Let’s now examine each component in greater
detail.

User Agent The UA is the user interface. It has two main functions. First, it routes
messages between the user and the local MTA, allowing the user to send and receive
mail. Second, it manages the message store (MS), which, as you probably suspect,
is used to store messages. The UA performs its functions at the request of the user
and, to the user at least, defines the system’s capabilities. The following list includes
some of the UA’s functions.
• Send mail. The UA accepts a message and address from a user and gives it to the
MTA for delivery. The UA will invoke an editor to allow the user to write a mes-
sage or it will simply send the contents of a previously constructed file (which
presumably contains the message). It also appends a header (Figure 8.24) to the
user message containing the following information:
a. sender
b. recipients
c. cc recipients (those who get copies)
d. blind copy recipients (those who get copies secretly)
e. subject (short note describing its contents)
f. message ID
g. reply-by date
h. sensitivity (degree of confidentiality)

Figure 8.24 Messages, Headers, and Envelopes

UA MTA MTA UA

envelope envelope
header header header header
user user user user user user
message message message message message message
2942 | Ch 08 Page 603 Wednesday, February 16, 2000 3:32 PM

8.3 E L E C T R O N I C M A I L : X .400 AND X .500 S T A N D A R D S 603

UA UA

MTA MTA

complete complete complete complete


message message message message

packets
handled by
lower
layers

physical-layer transmission physical-layer transmission physical-layer transmission

Figure 8.25 Store-and-Forward Routing

useful when the mail must go through networks running dissimilar network and
transport layers. Protocols such as FTP and SMTP assume similar transport proto-
cols (TCP).

Message Handling System The MHS, the most extensive part of the mail model,
contains all the MTAs and UAs. It also includes specifications on, among other
things, interaction between two UAs, two MTAs, and a UA and MTA. About the
only thing not included is the interface between the UA and user.
The MHS can handle three types of protocol data units (PDUs): messages,
probes, and reports. A message contains the user information, header, and envelope.
A probe consists of an envelope only, a seemingly strange thing to have. Its purpose
is to determine whether a specific destination is reachable without actually sending
anything (perhaps similar to sending an empty envelope through the mail to see if a
destination exists before shipping a warehouse full of furniture). The report (also
called reply) is a response sent to the source of a previous message specifying
whether it has been received.
2942 | Ch 08 Page 605 Wednesday, February 16, 2000 3:32 PM

8.3 E L E C T R O N I C M A I L : X .400 AND X .500 S T A N D A R D S 605

UA UA
P2 protocol
P7 protocol

P3 protocol P3 protocol
MS

MTA MTA
P1 protocol

Figure 8.26 P Protocols

An X.400 system can provide the typical operations of sending and receiving
mail as well as many more services, such as those in the following list (actually
specified by the X.401 protocol):
• Alternate recipient allowed lets the originating UA specify an alternate recip-
ient in case the intended recipient cannot be found. In this case the mail goes to
the alternate.
• Authorizing users indication allows the originator to specify who authorized
the mail being sent.
• Blind copy recipient indication lets the originating UA cc (send copies of the
mail to others). The difference between this and the normal cc function is that
the blind recipients are not identified to those receiving the mail.
• Cross referencing indication specifies other mail related to the current message.
• Deferred delivery service lets the originator specify a time and date after
which the mail should be delivered. The mail should not be delivered before
that date.
• Deferred delivery cancellation lets the originating UA cancel a deferred
delivery message.
• Delivery notification provides an acknowledgment to the originating UA when
the mail has been delivered. Note that it does not mean the recipient has actually
read the mail, just that the mail has been delivered.
• Expiry date indication allows the originator to specify to the recipient a time
and date after which the message is invalid. MHS does not specify what hap-
pens when the time has passed.
2942 | Ch 08 Page 607 Wednesday, February 16, 2000 3:32 PM

8.3 E L E C T R O N I C M A I L : X .400 AND X .500 S T A N D A R D S 607

allowable addresses. Since the ITU-T recommendations are made with the intention
of connecting the entire population of the industrialized world, ITU-T standards take
a different approach to addressing.
As we know, email systems allow users to send messages to others, but there is
always one stipulation: the email address must be provided. Therefore, another
important issue is the mail directory or directory service (Ref. [We13]), which
provides the address of an individual given that he or she is unambiguously identi-
fied. It is similar to the telephone system: You can call almost anywhere in the world,
but you must know the number first. If you don’t know the number, resources such
as telephone books or directory assistance can help, but even they are restrictive.
Telephone books can be up to a year out of date. Using directory assistance requires
that you first know the area code in which the desired person resides. Then you dial
the directory assistance for that code and specify the name of the person you want to
call. Typically you must also specify the person’s address. Dialing directory assis-
tance for the 312 area code (Chicago area) and asking for John Smith’s number will
not be very productive.
After developing the X.400 standards the ITU-T wanted to define standards for
a directory with functions similar to those of the telephone directory. The result is
the X.500 directory service standard, which has several important features:
• Distributed directory. The actual directory would be distributed across many
sites throughout the world. It appears as a single centralized directory to each
user (Figure 8.27), but it is located and maintained at physically separate sites.
This is unlike the telephone system, in which a user has to call a different direc-
tory assistance depending on the area code.
• Hierarchical structure. This is similar to the telephone system, in which the
area code defines a geographic region. Even within the region telephones with
the same three-digit prefix tend to be from the same area of town. It is unlike the
Internet system, however. No, we haven’t forgotten that we described the

Figure 8.27 Distributed Directory

site A
site B
distributed
directory
Contents of directory is
Distributed directory appears physically distributed
the same to all users. site D over many sites.
site C
2942 | Ch 08 Page 609 Wednesday, February 16, 2000 3:32 PM

8.3 E L E C T R O N I C M A I L : X .400 AND X .500 S T A N D A R D S 609

an attribute distinguishing the two Mary Smiths. (Either that, or Mary Smith has a
clone.)
It is worth mentioning that X.500 uses object-oriented terminology to describe
its DIT. Each DIT node corresponds to an object and belongs to an object class. All
entries in an object class have the same attributes and the same parent in the DIT
(Figure 8.29). Furthermore, an object class inherits the attributes from the object
class of its parent and forms a subclass. Consequently, the attribute list that defines a
DIT entry also defines the path from the root to that entry. One main advantage of
using objects and object classes is the ability to create new classes by extending or
modifying other classes. This is one of the prime motivators of the object-oriented
paradigm in many fields of computer science.

Figure 8.28 Directory Information Tree

root

CA US UK

AT &T ACME Internal Revenue Service

customer service engineering marketing

Mary Smith Sr. Engineer (312) 555-1234

Figure 8.29 Object Class

object class: subclass of A’s class


2942 | Ch 08 Page 609 Wednesday, February 16, 2000 3:32 PM

8.3 E L E C T R O N I C M A I L : X .400 AND X .500 S T A N D A R D S 609

an attribute distinguishing the two Mary Smiths. (Either that, or Mary Smith has a
clone.)
It is worth mentioning that X.500 uses object-oriented terminology to describe
its DIT. Each DIT node corresponds to an object and belongs to an object class. All
entries in an object class have the same attributes and the same parent in the DIT
(Figure 8.29). Furthermore, an object class inherits the attributes from the object
class of its parent and forms a subclass. Consequently, the attribute list that defines a
DIT entry also defines the path from the root to that entry. One main advantage of
using objects and object classes is the ability to create new classes by extending or
modifying other classes. This is one of the prime motivators of the object-oriented
paradigm in many fields of computer science.

Figure 8.28 Directory Information Tree

root

CA US UK

AT &T ACME Internal Revenue Service

customer service engineering marketing

Mary Smith Sr. Engineer (312) 555-1234

Figure 8.29 Object Class

object class: subclass of A’s class


2942 | Ch 08 Page 610 Wednesday, February 16, 2000 3:32 PM

610 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

Two more important components of the X.500 model are the directory user
agent (DUA) and directory system agent (DSA) (Figure 8.30). They play roles
similar to the UA and MTA in the X.400 model. A network user typically makes a
request through some application that interfaces with the DUA. The DUA, in turn,
interacts with the distributed directory to provide whatever service the user
requested. Typical services are finding the email address of a user, changing
someone’s address, or inserting and deleting addresses. Remember, however, that
the directory is distributed over many sites (potentially hundreds) and that each site
contains part of the directory managed by the DSA at that site. Thus the DUA,
through network protocols, accesses the proper DSA in response to the user’s
request.

S UMMARY
This section on X.400 and X.500 standards cannot begin to fully describe the com-
plexity of managing and transmitting information on a global scale. In fact, you
should not think of these standards as finished products. Much developmental work
is still being done, and X.400 is not without its detractors. Some cite its “lackluster
performance as a platform for LAN applications” as a shortcoming. It also has stiff
competition from other mail services such as SMTP and Novell’s Message Handling
Service (MHS). Even so, companies such as AT&T, IBM, Sun Microsystems, and
Digital Equipment Corporation are supporting numerous X.400 products. Many
believe these standards will form the foundation for future gateways that will be able
to interpret a wide array of business documents and applications and pave the way
for a truly global communications system.

Figure 8.30 Directory Structure

DSA

DSA

DUA

DSA

DSA

DUA: directory user agent


DSA: directory system agent
distributed directory
2942 | Ch 08 Page 612 Wednesday, February 16, 2000 3:32 PM

612 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

the line, because they would have a second line. (Of course, if they have two chil-
dren they might still be out of luck.)

ISDN S ERVICES
This section lists some of the services that an all-digital system would provide.
Some of them are already implemented in many parts of the world on a regional or
company-wide basis. The eventual goal is to make them available to everyone. Fur-
thermore, an all-digital system would facilitate the implementation of services.
Many of them, for example, would require an on-site video screen and some of the
text-processing ability of a PC.
• One of the B channels could be used to send messages electronically. They
could be routed depending on the recipient’s telephone number and stored in a
local repository near the recipient for eventual access.
• Telephone numbers of incoming calls could be displayed even before the tele-
phone is answered. Remember, digital systems mean that both outgoing data
and incoming signals are digitized. The source number could be encoded in the
received signals. This feature would allow you to decide whether you want to
answer the telephone and would deter obscene or crank phone calls. It also
would facilitate the identification of incoming calls to a 911 emergency system,
a particular advantage if the caller is incoherent or a very small child. The
downside of this ability is that it defeats the purpose of unlisted numbers. Thus,
provisions must be available to turn off the display of such numbers.

Figure 8.31 ISDN Basic Service

telephone
two B channels: 64 Kbps

ISDN
basic
service
PC
D channel: 16 Kbps
bit pipe:
transmits
time-division
control multiplexed signals
1 2345 from the B and D
channels
electric water
meter meter alarm
system
2942 | Ch 08 Page 615 Wednesday, February 16, 2000 3:32 PM

8.4 INTEGRATED SERVICES DIGITAL NETWORK 615

S T S
NT2 NT1 TA
2B+D 23B+D 2B+D
R
TE2 TA

T S
TE1 NT2
NT1
2B+D
2B+D
(a)
S
LAN gateway
T 2B+D
TE1 NT1 (b)
2B+D
(c)

U ISDN ISDN U
NT1 communications NT1
central network central
23B+D office Signaling Signaling office
System System
no. 7 no. 7
(d)

TE1: ISDN device


TE2: non-ISDN device
NT1: physical interface
NT2: e.g., digital PBX
TA: terminal adapter

Figure 8.32 ISDN Reference Points

2. Reference point S separates NT2 equipment from ISDN devices (Figure


8.32a,b). It supports a 2B+D channel and has a bit rate of 192 Kbps.* Effec-
tively, it separates devices dedicated to user functions from devices devoted to
communications functions.
3. Reference point T is the access point to the customer’s site (Figure 8.32a,c).
Generally, it separates the customer’s equipment from the network provider’s
equipment. Typically, if T is an interface between an NT1 and either terminal
equipment or adapter it corresponds to a 2B+D channel. If it lies between two
NT devices it corresponds to a 23B+D channel.

*
The bit rates from the two B channels and the D channel add up to 144 Kbps. Additional overhead bits
push the bit rate up to 192 Kbps, as we will show soon.
2942 | Ch 08 Page 617 Wednesday, February 16, 2000 3:32 PM

8.4 INTEGRATED SERVICES DIGITAL NETWORK 617

user part
signaling network
message
transfer signaling link level
part
signaling data link

Figure 8.33 Signaling System No. 7

ples, and the user–network interface. We will describe a couple of these protocols
shortly.
The Q series, Q.700 to Q.795, describes a layered protocol known as Signaling
System no. 7 (SS7). First issued in 1980, SS7 defines a standard that provides func-
tionality in an integrated digital network (IDN). Note the use of the term IDN as
opposed to ISDN. An IDN represents an outgrowth of the old analog telephone
system, in which signal transmission and switching were handled separately. With
the ability to put all the transmissions in a digital form, the two functions have been
integrated. An ISDN will use an IDN but includes the ability to integrate digitized
voice with many other types of digital data onto the digital links.

Signaling System No. 7 SS7 is a four-layer protocol (Figure 8.33). The bottom
three layers make up the message transfer part (MTP) and perform functions sim-
ilar to the X.25 protocol. Unlike X.25, however, SS7 is concerned with internal net-
work functions such as routing and reliability. For example, it provides for the
reliable transport of messages using a connectionless mode of transfer. The fourth
layer, the user part, contains specifications for call control, message formats, var-
ious applications, and maintenance.
The lowest layer, the signaling data link (ITU-T document Q.702) provides all
the physical and electrical specifications and provides a 64 Kbps full-duplex trans-
mission. The second layer, the signaling link layer (Q.703), provides reliable com-
munications between two consecutive points in the network. As with other layer 2
protocols, it defines the frame format and provides error checking and flow control.
It is similar to HDLC, and another discussion is not useful here.
The third layer, the signaling network layer (Q.704), provides reliable mes-
sage transfer between two signaling points (end points). It performs two major func-
tions: routing and management. For example, it determines whether to transfer a
message to another network node or to deliver it to the fourth layer (user part). In the
former case, it must determine the next node. In the latter case, it must determine
which user part gets the message. Management functions include the exchange of
information among nodes regarding routes, error and congestion recovery, and
rerouting.
The user part actually consists of a telephone user part (TUP) and an ISDN
user part (ISUP). The TUP, described by documents Q.721 to Q.725, describes the
establishment of circuit-switched connections for telephone calls, including types of
2942 | Ch 08 Page 620 Wednesday, February 16, 2000 3:32 PM

620 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

D), resulting in a data rate of 16 Kbps for the D channel. This means that when a TE
has a packet of information to send over the D channel it does so 4 bits at a time.
The remaining bits are for some low-level control functions. As we describe
them it is worth noting that ISDN uses a pseudoternary coding or alternate mark
inversion technique in which a 1 bit is represented by zero volts and a 0 bit is repre-
sented by either a positive or a negative signal. Furthermore, each 0 bit has polarity
opposite that of the most recent 0. This forces the signal representing a string of 0s
to alternate between positive and negative.
The F bit is a framing bit, a positive signal indicating the beginning of the
frame. The L bit is a DC balancing bit. After the F bit it is a negative signal.
Together they provide timing and synchronization of the incoming frame. The
remaining L bits are set to 0 if the number of preceding 0s is odd and set to 1 other-
wise. This is a means of providing electrically balanced signals.
The E bit is an echo bit, and there is one for each D bit. In general, the NT uses
it to echo back each D bit it receives. In cases where several TEs are connected to an
NT via a single physical bus (Figure 8.35), the E bit also is used as a primitive form
of contention for the D channel. When a TE has nothing to send on the D channel, it
transmits a steady stream of 1s. Consequently, if none of the TEs is using the D
channel, the NT receives all 1s in the D bit positions and echoes them back. Thus, by
checking the returning E bits a TE can detect an idle D channel.
When a TE wants to send something on the D channel, it monitors the returning
E bits. If it contains 0s the TE knows that some other TE is using the D channel and
waits. If the returning E bits are all 1s either the D channel is idle or another TE is
transmitting a data stream consisting of all 1s along it. However, a higher-layer pro-

Figure 8.34 ISDN Physical Frame Format

48 bits—250 µsec

F L B1 (8 bits) E D A Fa N B2 (8 bits) E D M B1 (8 bits) E D S B2 (8 bits) E D L

(a) NT to TE

48 bits—250 µsec

F L B1 (8 bits) L D L Fa L B2 (8 bits) L D L B1 (8 bits) L D L B2 (8 bits) L D L

(b) TE to NT

F: framing A: activation bit


L: DC balancing Fa: framing (secondary)
B1: first B channel N: complement of Fa
B2: second B channel S: Future use
D: D channel M: multiframing bit
E: echo bit
2942 | Ch 08 Page 621 Wednesday, February 16, 2000 3:32 PM

8.4 INTEGRATED SERVICES DIGITAL NETWORK 621

tocol performs bit stuffing to limit the number of consecutive 1s that can be sent, so
if a TE detects a number of 1s exceeding this value it concludes the D channel is idle
and starts sending.
The problem is that another TE might start sending along the D channel as well.
However, the mechanism used and the fact that they compete for space in the same
physical frame guarantees that one will be successful. To see how this works, sup-
pose the leftmost TE of Figure 8.35 sent a D bit equal to 1 (no signal). Suppose the
physical frame reaches the next TE, which then deposits a 0 (high or low signal) into
the D bit position. The effect is that the 1 from the first TE is replaced with the 0
from the second TE. Both TEs (and any others that may also be sending) listen to the
returning E bits. If a TE detects an E bit different from the D bit it sent, it concludes
that some other TE has grabbed the D channel and temporarily abandons its attempt
at getting the D channel. If the TE sees its own D bits echoed back as E bits it con-
tinues sending along the D channel. Another contributing factor is that there is a 10-
bit delay time between sending a D bit and receiving the corresponding E bit. Thus,
because the D bits are more than 10 bits apart in the physical frame the determina-
tion is made before the second D bit is sent. If the first and subsequent D bit from
two TEs are the same, both continue sending until there is eventually a difference. At
that point the unsuccessful TE stops transmitting.
Of the remaining physical frame bits, the A bit is an activation bit and can be
used to activate a TE. The Fa and M bits are used for multiframing, which allows
the addition of another channel (Q channel). The S and N bits are reserved for
future use.
The ISDN layer 2 protocol, defined by I.440 and I.441, is known as link access
protocol for channel D (LAP-D). If you have an absolutely fantastic memory you
might recall its mention in Section 5.5. It is very similar to HDLC, and there is very
little to say that has not already been said.
The layer 3 protocol, defined by I.450 and I.451, includes the types and formats
of ISDN messages sent over the D channel, protocols for establishing and clearing
calls, management functions, and facility support. We will discuss ISDN messages
and call control here.
Figure 8.36 shows the ISDN message format. The protocol discriminator
allows the D channel to send messages from multiple protocols by identifying a pro-
tocol corresponding to a message. Currently the protocol discriminator can specify
X.25 messages or the user–network call-control messages that we will describe
shortly. However, the ability exists to include other layer 3 protocols in the future.

Figure 8.35 Multiple TEs Connected to an NT via a Single Bus

2B+D frame S
NT2
2B+D
TE1 TE1 TE1
2942 | Ch 08 Page 622 Wednesday, February 16, 2000 3:32 PM

622 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

The call reference field specifies the call to which the message refers. This is
necessary because the D channel is used to set up and clear calls from many other
channels. Without it there is no way to specify to which call a control refers. The
four-bit field preceding the call reference specifies the number of octets in the call
reference field. This is needed because the basic and primary services have dif-
ferent call reference lengths. The message type field is self-explanatory. The I.451
recommendation specifies about 30 different types of messages, some of which are
listed in Table 8.8.
The remaining field’s content and format depends on the message type and pro-
vides additional information. It contains information similar to that in other message
types we have seen before, such as source and destination address. It can also
specify a B channel, redirection addresses, reasons for specific messages, and call
status.

Call Setup Setting up a call is not terribly different (at this level of discussion)
from other initialization procedures we have discussed in this book. Figure 8.37
shows the exchange of messages during a typical setup. While going through this
example keep in mind that each TE is operating on behalf of a user. If it helps to
think of the user as someone making a telephone call over a circuit-switched net-
work, go ahead.
When a user wants to place a call he makes a request to the TE. The telephone
analogy would be pushing buttons to specify a number. The TE responds by sending
a setup message to the NT. The setup message contains information such as the
source and destination addresses, channel, whether the source address should be for-
warded, or who will be charged for the call. When the network gets the setup mes-
sage, it routes it according to the SS7 protocols, thus determining a route to the other
end. It also sends a setup acknowledge message back to the TE. The latter informs
the TE that the call request has been forwarded and requests more information from
the TE if the setup message contained insufficient information.

Figure 8.36 ISDN Layer 3 Message Format

protocol discriminator (8 bits)

number of octets for


0 0 0 0 call reference (4 bits)

call reference (variable length)

message type (8 bits)

additional information
(variable length)
2942 | Ch 08 Page 624 Wednesday, February 16, 2000 3:32 PM

624 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

calling called
TE NT network NT TE
message sent
setup via SS7

setup ack.
additional information

call proceeding
receipt of setup
alert

connect

receipt of alert

receipt of connect
connect ack.

receipt of connect
ack.
time time
time time

Figure 8.37 ISDN Call Establishment

PCM-coded voice into the proper B channel, as described in the discussion on


Figure 8.34, and the conversation begins.
A call ends when one TE sends a disconnect message to the network, typically
after the user hangs up. The network routes the message over the network and sends
a release message back to the TE. The TE then sends a release complete message
back to the network, clearing the B channel at that end. When the disconnect mes-
sage arrives at the other end, the network and TE there also exchange release and
release complete messages. This procedure clears the B channel at that end also.

B ROADBAND ISDN
The digital nature of ISDN is attractive, but some have criticized the establishment
of a 64 Kbps data rate for B channels. Indeed, in an era of 100 Mbps rates for LANs
and rates in the gigabit range for optical fiber, ISDN’s 64 Kbps pales by comparison.
In response, ITU-T has been developing a new set of documents describing broad-
band ISDN (B-ISDN). The intent is to use current high-bandwidth technologies to
provide services requiring a high transfer rate.
Several services could be provided by a B-ISDN. Videoconferencing and video
telephones are two. Current ISDN standards could provide videophone service, but
only for small screens. For larger screens with a high-quality video image, higher
2942 | Ch 08 Page 628 Wednesday, February 16, 2000 3:32 PM

628 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

entire cell
has arrived

large cell
time incoming
wait t1 outgoing
large cell
first bytes to be forwarded
(a) large cell

cells arrive in succession


1 2 3 4
time incoming
t0 outgoing
1 2 3 4
cells forwarded soon after they arrive
(b) small cells

Figure 8.38 Overlapping Cell Input and Output

Another reason a switch can get small cells through more quickly is the ability
to overlap input and output operations. To see how this works, first understand that a
cell typically arrives in its entirety and is buffered before being forwarded. If a cell
contains a 1000-byte payload, then all 1000 bytes must be received and buffered
before the first byte can be sent through an outgoing link. Figure 8.38 illustrates.
Figure 8.38a shows a timeline during which the incoming bytes from a large cell are
received. The first bytes are not forwarded until time t1, after all bytes have arrived.
Figure 8.38b shows what happens if a large cell is divided among smaller 48-byte
cells. In this case the first cell can be forwarded as soon as it arrives at time t0 (much
earlier than time t1) because it does not have to wait for all the other cells to arrive.
During the timeline of Figure 8.38b, information is being received and forwarded
simultaneously, thus increasing the rate at which cells are forwarded toward their
final destination.
There are other benefits. For example, because information gets forwarded more
quickly, less of it is maintained in the switch, which, in turn, contributes to smaller
outgoing queues. The result is that the payload spends less time sitting in buffers.
Another benefit is that bytes arrive at a more consistent rate at the final destination as
opposed to a burstier arrival pattern in which many bytes arrive quickly in one large
cell followed by longer wait times between cells. This is especially important in
video and voice applications for which data must arrive quickly and consistently.
One last benefit is that small fixed-size cells facilitate designing switches
capable of forwarding multiple packets concurrently. This is especially useful
because it reduces times when one cell must wait for another cell to be forwarded.
2942 | Ch 08 Page 629 Wednesday, February 16, 2000 3:32 PM

8.5 ASYNCHRONOUS TRANSFER MODE 629

television

ATM
switch network-network interface
(NNI)

ATM ATM
switch switch

computer user-network interface


ATM (UNI)
switch LAN

video camera

Figure 8.39 ATM Network

How this works is difficult to understand until we have described some switching
technologies, so we defer this discussion until a bit later.

O VERVIEW OF ATM N ETWORK


We begin by outlining what an ATM network looks like and discussing some of its
components. Figure 8.39 shows that an ATM network consists of ATM switches.
Generally, the ATM switch* is analogous to the IP router in that it’s responsible for
receiving incoming cells and forwarding them outward along the correct link. ATM
switches have links to one another, forming a network with a variety of paths. Each
switch, in turn, can connect to a variety of user-oriented devices such as a computer,
television, video camera, or local area network. The figure doesn’t show it, but each
user device needs an interface card that speaks ATM.
There are two types of links in an ATM network. The Network–Network
Interface (NNI) connects two ATM switches, and the User–Network Interface

*
The difference between a switch and router is not well defined. Some user the term router when
referring to the Internet and its ability to connect a variety of different technologies. Others use the term
switch when referring to a collection of homogeneous links connecting similar technologies. This
suggests that the difference is whether the device can connect different technologies. However, vendors
are advertising switches that are more versatile in their ability to connect different technologies, which
blurs this distinction. In other cases switch refers to a multiport bridge operating at OSI layer 2, in
contrast to a bridge, which was originally designed to connect just two LANs. The bottom line is that at
this level whatever distinction there may be is not important.
2942 | Ch 08 Page 631 Wednesday, February 16, 2000 3:32 PM

8.5 ASYNCHRONOUS TRANSFER MODE 631

stages. The number of stages is related to the number of output lines. For example, if
there are 2k output lines then there are k stages in the switch.
Each cell is associated with a bit string (also called a switching string) of
length k, and each bit in the string takes the cell from one stage to the next. This bit
string might be in the cell or it might be stored in a table along with a virtual path
ID. Its location is not important to the discussion here.
Figure 8.40 shows a Banyan switch with eight inputs and outputs and three
stages between them. A cell can enter any one of the eight inputs and pass to one of
four switching elements (first stage). Based on the first bit of the switching string,
the cell follows one of two possible outputs into one of four elements at the second
stage. There, switching logic examines the second bit of the switching string and
passes the cell along one of two possible outputs into the third stage. The process is
repeated once more using the remaining bit, and the cell is finally forwarded through
one of the switch’s outputs.
Each output in Figure 8.40 is labeled with a unique three-bit string that defines the
output line over which the cell is forwarded. There are a couple of interesting things
about this switch. First, the output depends only on the switching string and is inde-
pendent of the input line over which a cell arrives. For example, Figure 8.40 highlights
three possible paths corresponding to a cell with switching string 100. Cells entering
elements A1 and B1 get passed to A2 in the second stage. From there both would go to
C3. The cell entering D1 passes to C2 and then to C3. As you can see, each starts at a
different element at the first stage but ends up at the output corresponding to 100.
Another interesting feature is that switching logic can handle multiple cells con-
currently. For example, one cell with switching string 100 passes through A1, A2,
and C3. Suppose another cell with switching string 110 arrives at D1. It would pass
through D1, C2, and A3. Since the two cells involve different elements the routing

Figure 8.40 Banyan Switch

left most middle right most


bit bit bit

1 1 1
111
A1 0 A2 0 A3 0
110
1 1 1
011
B1 0 B2 0 B3 0
010
inputs 1 1 1 outputs
101
C1 0 C2 0 C3 0
100
1 1 1
001
D1 0 D2 0 D3 0
000
Stage 1 Stage 2 Stage 3
2942 | Ch 08 Page 633 Wednesday, February 16, 2000 3:32 PM

8.5 ASYNCHRONOUS TRANSFER MODE 633

plane management

layer management

control user
plane plane
upper upper
layers layers

ATM adaption layer


(AAL)

ATM layer

physical layer
(sonet, ect.)

Figure 8.41 ATM/B-ISDN Reference Model

nications Research), SONET is an optical network using time division multiplexing


to accommodate simultaneous channels. Controlled by a clock, it transmits bits at
rates ranging from about 155.5 Mbps to in excess of 2 Gbps. It defines the way in
which telephone companies transmit their data over optical networks. Besides
SONET, ATM can also run on top of FDDI, T-1 and T-3 systems, both shielded and
unshielded twisted pair, and even wireless media [Va97].
Above the physical layer is the ATM layer. It performs activities similar to
those found in OSI layers 2 and 3. For example, it defines the cell format and how to
respond to information found in the header. It also is responsible for setting up and
releasing connections and establishing both virtual circuits and virtual paths (a dis-
tinction we will make shortly). Finally, it also performs congestion control.
The ATM adaptation layer (AAL) provides the interface between applications
and the ATM layer and is divided into two sublayers: the segmentation and reassembly
sublayer (lower sublayer) and the convergence sublayer. The convergence sublayer
provides the interface for a variety of applications to use ATM. What it does depends
on the application and the type of traffic it generates. In fact, later we will see that
there are several versions of AAL depending on whether the traffic is uncompressed
video, compressed video, or a variety of other types. The segmentation and reas-
sembly sublayer stores information from higher layers into ATM cells and may add
its own header to the payload. On the receiving end, it extracts the payload from each
cell and reassembles them into an information stream for the application to process.
2942 | Ch 08 Page 634 Wednesday, February 16, 2000 3:32 PM

634 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

C ELL D EFINITION
This is a good time to provide some details about how ATM works, and a logical
place to start is by defining the ATM cell and describing how ATM handles its con-
tents. As previously mentioned, an ATM cell has 53 bytes, 48 of which are the cell’s
payload. This leaves just 5 bytes for the cell header. Figure 8.42 outlines what they
are as they pass through a Network–Network Interface (NNI). For cells that travel
through the User–Network Interface (UNI) there is a slightly different interpretation
of the header’s contents. In the latter case, the first four bits define a generic flow
control (GFC) field, leaving just 8 bits for the virtual path identifier. However, once
the cell enters the network switches may write over the GFC field using a 12-bit vir-
tual path ID.
The GFC is designed to control the flow of traffic from a device into the ATM
network (but not in the reverse direction). There are essentially two classes of con-
nections, controlled and uncontrolled, which are either part of the configuration or
negotiated during the establishment of a connection. When a connection is con-
trolled the network provides information to the user regarding how many cells it can
send. It’s a bit like the credit mechanism used for flow control in TCP. On uncon-
trolled connections the network simply enables or disables the sending of cells.
When enabled, the user device is free to send cells until the network disables it. It’s
a bit like an X-ON/X-OFF form of flow control.
The small number of header bytes is one contributing factor to ATM’s speed:
there are fewer things to check in each cell when it arrives at a switch. Let’s now
examine each field separately.

Header Error Control The header error control (HEC) field is somewhat self-
explanatory: It provides for error checking. However, there are a few noteworthy
items. First is that it only provides error checking for the other four header bytes,
leaving the payload unprotected. This, of course, makes error checking, and conse-
quently cell delivery, much faster. (Remember, speed is essential in an ATM net-
work.) Of course, leaving the payload unprotected might at first seem a problem,
but, for a couple of reasons, it is not. One is that ATM was designed to run on top of
optical fiber systems, which are very reliable. Consequently, the odds of errors
occurring are very small. Even if they did occur they could be detected at a higher
layer if necessary. Another reason is that many applications involve video or audio.

Figure 8.42 ATM Cell Header (NNI)

1 bit cell
loss priority

virtual path identifier virtual circuit identifier payload type header erron control
12-bits 16-bits 3 bits (HEC) 8-bits
2942 | Ch 08 Page 637 Wednesday, February 16, 2000 3:32 PM

8.5 ASYNCHRONOUS TRANSFER MODE 637

Figure 8.44 there is a logical connection between A and X, B and Y, and C and Z.
However, each connection corresponds to the same path.
Each cell contains a 12-bit virtual circuit ID (8 bits across the UNI) and a 16-
bit virtual path ID. Thus, from a user’s perspective each connection can be defined
by a 24-bit connection identifier that consists of two parts: the circuit ID (8 bits) and
path ID (16 bits). It’s analogous to Internet addressing, where we indicated that a
32-bit address consisted of a network ID and a host ID. The advantage was that
internal routing mechanisms could route based solely on the network ID. The host
ID wasn’t used until the packet reached the destination network and could be sent
directly to the host.
Likewise, ATM switches forward cells based solely on the 16-bit virtual path
ID. Making decisions based on a 16-bit number instead of a full 28-bit identifier
(remember that when a cell enters the network the circuit ID expands to 12 bits)
allows switching to occur more quickly. Again, this is a major goal of ATM. Using
16-bit numbers instead of 28-bit numbers also keeps internal switching tables
smaller (a maximum of 216 entries as opposed to 228 entries). The circuit ID is
needed only when the cell arrives at the last ATM switch, which must forward the
cell directly to the user.
Another advantage of using both circuit and path IDs is realized if there is a
problem in a link. For example, suppose a hundred connections have been established
that all use the same path. If a problem develops along the path, a new one must be

Figure 8.44 Virtual Circuits and Virtual Paths

connection

connection

A X

ATM ATM
B Y
switch switch

ATM
C switch Z

connection
distinct virtual circuits exist between
A and X, B and Y, C and Z.
All use the same virtual path.
2942 | Ch 08 Page 638 Wednesday, February 16, 2000 3:32 PM

638 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

user ATM several ATM user


A UNI switch NNI'S switch UNI B

setup

call
proceeding setup

call
proceeding

connect

connect connect
acknowledgement
connect
acknowledgement

Figure 8.45 Establishing a Connection

found. If switching were based on a 28-bit number, then the internal tables for each
new switch in the alternate route would require a new entry for each connection. In
this case a hundred changes to each table would be made. However, since switching
is based on just the path ID and all connections use the same path, each table requires
just one change to accommodate all the connections. Clearly, this is a lot quicker.

C ONNECTION M ANAGEMENT
There are two types of connections: a permanent virtual circuit and a switched
virtual circuit. The permanent circuit is analogous to a leased telephone line, and
the switched circuit must be established using a connection protocol. The connec-
tion protocol is based on algorithms in ITU-T Q.2931 (itself a subset of Q.931). On
the surface, establishing an ATM connection follows procedures similar to those of
establishing connections in other protocols we have discussed. One side initiates a
call request specifying some of the attributes desired of the connection and waits for
an acknowledgment. The control plane is responsible for setting up the connection.
Figure 8.45 outlines the connection setup logic when A requests a connection to
B. There are four different message types used in setting a connection; the steps
below show how they are used.
2942 | Ch 08 Page 641 Wednesday, February 16, 2000 3:32 PM

8.5 ASYNCHRONOUS TRANSFER MODE 641

higher layers

convergence
sublayer
segmentation and
reassembly sublayer

ATM layer

Figure 8.46 AAL Sublayers

a higher layer. Well, that is true, but the difference lies in what those headers and
trailers contain. However, to make that distinction requires that we introduce the dif-
ferent AAL types.
AAL types differ primarily in the classes of traffic they will handle. AAL 1
deals with Class A traffic, and AAL 2 with Class B traffic. The pattern seems to
suggest that AAL 3 and AAL 4 deal with Class C and D traffic. To some extent that
was true, because ITU-T did develop an AAL 3 and AAL 4. However, as develop-
ment progressed it became apparent that there were no significant differences so

Figure 8.47 General AAL Activities

application generate
byte stream x x x x x x
CS groups bytes
and adds a header
(H) and a tailer (T)
H x x x x T
SAR adds its own
header and tailer
to create a 48-bytes
payload.
H from CS T

5-byte
from SAR
header

ATM cell
2942 | Ch 08 Page 641 Wednesday, February 16, 2000 3:32 PM

8.5 ASYNCHRONOUS TRANSFER MODE 641

higher layers

convergence
sublayer
segmentation and
reassembly sublayer

ATM layer

Figure 8.46 AAL Sublayers

a higher layer. Well, that is true, but the difference lies in what those headers and
trailers contain. However, to make that distinction requires that we introduce the dif-
ferent AAL types.
AAL types differ primarily in the classes of traffic they will handle. AAL 1
deals with Class A traffic, and AAL 2 with Class B traffic. The pattern seems to
suggest that AAL 3 and AAL 4 deal with Class C and D traffic. To some extent that
was true, because ITU-T did develop an AAL 3 and AAL 4. However, as develop-
ment progressed it became apparent that there were no significant differences so

Figure 8.47 General AAL Activities

application generate
byte stream x x x x x x
CS groups bytes
and adds a header
(H) and a tailer (T)
H x x x x T
SAR adds its own
header and tailer
to create a 48-bytes
payload.
H from CS T

5-byte
from SAR
header

ATM cell
2942 | Ch 08 Page 642 Wednesday, February 16, 2000 3:32 PM

642 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

they elected to combine them. One might think the result would be labeled AAL
31/2 but in fact it is called AAL 3/4. After AAL 3/4 was developed, some were con-
cerned about what they perceived as inefficiencies. Consequently, AAL 5 was
developed as a successor to AAL 3/4. We won’t worry about AAL 3, AAL 4, or
AAL 3/4. Reference [Bl 95] discusses all the AAL versions. We will, however, out-
line AAL 1, AAL 2, and AAL 5.

AAL 1 Figure 8.48 outlines how Class A traffic is handled. A video application
generates a real-time uncompressed byte stream. AAL 1 captures 46 or 47 bytes at a
time and puts them in an AAL 1 packet. A difference with Figure 8.47 is that only
the SAR sublayer creates a header, which is either 1 or 2 bytes long. From there
each packet becomes the payload of an ATM cell, which is then transmitted toward
its destination.
Figure 8.49a shows the format of an AAL 1 packet. The first bit indicates
whether an optional second header byte is present. This header byte, if present, is
used when the payload field is not full and locates the data within the payload field.
This method can be used in cases where filling the payload field to capacity takes
more time than the application can tolerate. By only partially filling the payload field,
the information can be passed to the ATM cell and eventually sent more quickly. This
may be necessary to maintain the constant bit rate required by Class A traffic. An
implication of this is that the convergence sublayer must be synchronized with a
clock to deliver the correct amount of data to the SAR sublayer on a timely basis.
Of the remaining seven bits of the first header byte, three are used for a
sequence number. The convergence sublayer provides the sequence number, and the
SAR sublayer creates the header in which to store it. This allows the receiving CS to
detect a loss of information or a misinserted cell. Either of these can occur if an
undetected error occurs in the path ID of the cell en route to a destination. The cell

Figure 8.48 Sending Class A Traffic

video application

byte stream generated


by video application x x x x x x x x x x x

48-byte AAL1 packets


containing a 46 or 47
byte payload.

53-byte cells created


and sent by ATM
2942 | Ch 08 Page 645 Wednesday, February 16, 2000 3:32 PM

8.5 ASYNCHRONOUS TRANSFER MODE 645

application data block

CS sublayer 8 byte tailer

data block

SAR sublayer

sequence of 48 byte payloads.


Each is placed into a 53-byte ATM cell.

Figure 8.50 AAL 5 Dividing a Data Block into ATM Cells

Because the application runs on top of ATM the data is still divided into small
cells. However, an important aspect is that this division is done at a different layer.
In AAL 1 and AAL 2, data was divided into small packets early so that they could be
processed and sent as quickly as possible. Here the convergence sublayer deals with
a potentially large block and creates the tailer for it. Due to the block’s size this will
take longer, which would be unacceptable for Class A or Class B traffic. However,
for Class C or Class D traffic such delays are not a problem.

Service-Specific Connection-Oriented Protocol The AAL protocols we have


described deal primarily with data transfer. We have not yet discussed a protocol
used primarily for providing a reliable connection. Early developers of ATM recog-
nized that error detection and recovery would be needed for signaling and for certain
data applications. Toward this end AAL was divided into two parts: a common part
and a service-specific part. AAL 5 is an example of a common part. Two additional
protocols, the Service-Specific Coordination Function (SSCF) and the Service-
Specific Connection-Oriented Protocol (SSCOP) constitute the service-specific
part. SSCOP and SSCF lie between AAL 5 and a higher-layer signaling protocol
such as Q.2931, with SSCF providing the interface between SSCOP and Q.2931.
Together, SSCF and SSCOP are also called the signaling ATM adaptation layer
(SAAL).
SSCOP is a synchronous bit-oriented protocol whose main functions include
flow control and actions to be taken when errors are detected. It uses a form of
selective repeat sliding window protocol in which the window sizes can be
adjusted dynamically and missing frames can be requested and transmitted
explicitly.
The signaling layer (i.e., Q.2931) communicates with SSCOP through the
SSCF. The SSCOP creates specific packets, which it sends to the peer SSCOP entity
at the other end. The receiving SSCOP extracts information from these packets and,
2942 | Ch 08 Page 647 Wednesday, February 16, 2000 3:32 PM

8.6 SYSTEMS NETWORK ARCHITECTURE 647

Figure 8.51 shows the layered structure of SNA. It shows seven layers, but be
warned that some references present SNA as a six- or even a five-layer protocol. The
discrepancies occur because some people do not consider the lowest or highest
layers to be part of SNA. In some of the older versions the upper two layers were
considered one. At this level of discussion the number of layers is not important, as
we are not going to present a detailed discussion of the questionable layers anyway.
On the surface SNA resembles the OSI model. That is not surprising, because both
are designed to connect a variety of devices.
One difference between SNA and OSI is that each OSI layer has its own header
that it appends to data received from the next-higher layer. This does not occur in
SNA. As with OSI, two SNA users communicate, with the layers providing specified
tasks in the presentation and transmission of the data. Figure 8.52 illustrates the pro-
cess. At the highest layer the user data is divided into one or more request/response
units (RUs). Each layer passes the RU down to a lower one, with some of them
adding extra headers. Transmission control adds an RU header, path control adds a
transmission header, and data link control adds a link header. Some references show
a function header added at the second-highest layer, but others consider it as part of
the RU, as we have done here. Finally, the lowest layer transmits the RU and the
appended headers as a bit stream.
In this last section we will summarize each of the layers and introduce some of
the IBM terminology used in an SNA environment.

L OWER L AYERS
Physical Link Control The physical link control layer provides the physical
and electrical specifications. It allows a variety of communication modes, including
cable, optical fiber, and satellites. In some cases, it also allows multiple and distinct
connections between two points, which lets the user specify a particular type of
transmission, similar to the service type provided by the Internet Protocol (Section
7.4). This layer also can be used to divide data from a long stream into separate units

Figure 8.51 SNA Seven-Layer Protocol

transaction services

presentation services

data flow control

transmission control

path control

data link control

physical link control


2942 | Ch 08 Page 648 Wednesday, February 16, 2000 3:32 PM

648 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

user user data

transaction services request/response unit

presentation services

data flow control


RU header

transmission control request/response unit


transmission header

path control request/response unit


link header

data link control request/response unit

physical link control

Figure 8.52 Packaging Data in SNA

and transmit them separately. Typical transmissions use serial links, although par-
allel transmission can be used between a mainframe and a front-end processor (a
special processor designed to handle requests on behalf of the mainframe).

Data Link Control SNA’s data link control layer uses Synchronous Data Link
Control (SDLC), the protocol on which HDLC is based. The two are very similar.
Since we discussed HDLC in Section 5.5, we will not repeat the discussion for
SDLC. Reference [Me88] discusses SDLC in detail.
2942 | Ch 08 Page 649 Wednesday, February 16, 2000 3:32 PM

8.6 SYSTEMS NETWORK ARCHITECTURE 649

P ATH C ONTROL
The path control layer, like OSI’s network layer, determines paths and makes
routing decisions. One difference is that the paths are all virtual paths that are deter-
mined during the connection establishment phase by a higher layer. SNA does not
provide a connectionless mode of transfer.
Describing path control requires the use of several SNA-related terms and an
understanding of its components. In general we use the word node to represent an
entity in the network. An SNA node is a device capable of executing SNA protocols
and storing data. It can be almost anything, including a terminal, device controller,
workstation, mainframe, or front-end processor. SNA distinguishes between two
types, a peripheral node, which has limited processing capabilities and includes
devices such as terminals, printers, and controllers; and a subarea node,. which has
more extensive capabilities and includes mainframes and communications processors.
Figure 8.53 shows how the two types of nodes typically are arranged and helps
explain some other distinguishing features. SNA divides its network into domains,
or subareas, each containing one subarea node and many peripheral nodes. The sub-
area nodes from all of the subareas communicate and are capable of routing infor-
mation to one another using the full range of SNA protocols. They form the
network’s backbone. Peripheral nodes in a subarea typically communicate directly
only with the subarea node. If they want to communicate with a peripheral node in

Figure 8.53 SNA Node Arrangement

subarea

subarea

subarea node

peripheral nodes

subarea
subarea

subarea
2942 | Ch 08 Page 650 Wednesday, February 16, 2000 3:32 PM

650 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

another subarea they must use intermediate subarea nodes. As a result, subarea
nodes are sometimes called boundary nodes.

Network Addressable Units Each node also contains several network address-
able units (NAUs). As the name implies, an NAU is an entity having its own unique
SNA address. Primarily an NAU is a software construct capable of executing SNA
protocols on the node. In effect it defines the network access point for a user (Figure
8.54) or other application. In some cases an NAU is created when a user logs on to a
system for the purpose of network access. In other cases an NAU is always present
within the node for management, administration, or testing purposes. In all cases,
NAUs correspond to the entities among which SNA connections are established for
the eventual exchange of RUs.
Each NAU’s address contains two parts, the subarea address and the element
address. Together they define the subarea and NAU within the subarea. The element
address of an NAU is unique within its subarea. The subarea nodes route RUs along
the backbone using only the subarea address.
Three types of NAUs are logical unit, physical unit, and system service control
point. The logical unit (LU) defines the access point for an SNA user. It can also be
called the user port. There is one LU for each session,* and it performs necessary
functions for a user to communicate with another. The following list gives brief
descriptions of the several types of LUs. If you are interested in a more detailed
description of LUs, Reference [Me88] provides it.
• LU 0 corresponds to sessions that use SNA transmission and data flow control
layers. The higher layers are not part of the SNA architecture and are often spe-
cific to a particular device or user. Typically this would be used for devices that
have their own proprietary high-layer protocols.

Figure 8.54 Network Access via NAU

NAU

network
NAU

node

*
A session, created by higher layers, is analogous to the TCP connection discussed in Section 7.5. We
will discuss the SNA session in more detail later, but for now just think of it as a connection through
which two NAUs communicate.
2942 | Ch 08 Page 652 Wednesday, February 16, 2000 3:32 PM

652 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

an entire domain or, in the absence of multiple domains, the entire SNA network. It
does this in part by communicating with the various PUs within its domain. SSCP
resides on a host, and its primary functions involve management of all communica-
tions within its subarea, network startup, session establishment, control of domain
resources, maintenance, and error recovery.
With all the new and different terms being introduced, you may be having diffi-
culty keeping them straight. Figure 8.55 attempts to help by showing some typical
components, their connections in an SNA subarea, and where the various NAUs
reside. It shows two terminal controllers, one with three active users at their respec-
tive terminals and the other with none. Consequently the first controller has three
LUs (one for each user) and the other has none. Each of the terminals contains a PU
of type 1. The terminal controllers contain type 2 PUs, the communications con-
troller has a type 4 PU, and the host has a type 5 PU. The communication controller
and host here do not show an LU because the users’ needs are met at the terminal
controller. Certainly a variety of other configurations can exist, and Reference
[Sh90] shows some of them.

Virtual Route Control One of the path control layer’s main functions is the
establishment of a path between two NAUs. It contains three components: the vir-
tual route control, the explicit route control, and transmission group control.
Because all SNA communications are connection oriented, they require the
establishment of a virtual route (similar to the virtual circuit of Section 7.3) before
the exchange of user data. The virtual route control component does this by
defining the logical connection between two NAUs. As with other networks we have
discussed, no one component knows the route, and the route is transparent to the
user. If the route crosses domain boundaries, routing tables at a subarea node
transfer information to the next subarea node along the virtual route.
Each routing table entry contains a destination subarea address, a route number,
and the location of the next node along the specified route to the specified address.

Figure 8.55 Relationship among NAUs in an SNA Network

PU 1
LU
PU 2 LU PU 1 terminals
LU
SSCP terminal controller PU 1
PU 5 PU 4

communication
controller PU 2
host

terminal controller
2942 | Ch 08 Page 654 Wednesday, February 16, 2000 3:32 PM

654 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

allows multiple connections between two subarea nodes (Figure 8.56), the COS
partly determines which one to use. For example, a high-throughput COS is better
served by an optical fiber link, but a coaxial connection might be chosen for a low-
cost COS. A quick-response request would avoid a satellite link. The explicit route
includes the virtual route further qualified by the actual transmission links between
subarea nodes.

Transmission Group Control The last component of path control is the trans-
mission group control. A transmission group consists of one or more parallel
transmission lines between two nodes that all can be assigned to the same explicit
route. The purpose is to transmit different parts of user data in parallel to increase
the overall transmission rate. Figure 8.57 shows an example. Two users at remote
sites establish a connection and appear to communicate at a 50 Mbps rate. Unknown
to each of them, the path control layers defined an explicit path with a three-line
transmission group. One line has a 10 Mbps rate and the other two have 20 Mbps
rates. Assuming everything works correctly and that information is transmitted over
all three lines simultaneously, the perceived rate of transfer is 50 Mbps.
The transmission group control also can increase the data rate using blocking
when there is only one transmission link available. It combines several PIUs into a
single but larger unit called the basic transmission unit (BTU). It then sends the
BTU to the next-lower layer for transmission as a single unit. The receiving path
control layer extracts the PIUs from the BTU. Blocking several PIUs reduces the
overhead bits required in sending otherwise separate units. It also eliminates the
time between sending separate PIUs because they are sent together. You might

Figure 8.56 Explicit Routes between Two Subarea Nodes

satellite

satellite link

subarea node subarea node


coaxial cable link

optical fiber link


2942 | Ch 08 Page 655 Wednesday, February 16, 2000 3:32 PM

8.6 SYSTEMS NETWORK ARCHITECTURE 655

user user
50-Mbps channel (perceived)

10-Mbps link
path control path control

20-Mbps links

Figure 8.57 Gaining Bandwidth via Multiple Links

review Section 5.2, which addressed the issue of effective data rates as a function of
overhead, frame size, and overall bit rate.

T RANSMISSION C ONTROL
The transmission control layer is analogous to the OSI transport layer. It is an end-
to-end protocol defining a logical connection (session) between two NAUs (Figure
8.58). Despite the similar terminology, the SNA session is more like the OSI trans-
port connection than the OSI session. Once established, the session allows the two
NAUs to communicate on a level transparent to the underlying network structure.
The transmission control layer has two main components, the session control and
the connection point manager.

Figure 8.58 Transmission Control Session between Two NAUs

session
NAU NAU

network
2942 | Ch 08 Page 655 Wednesday, February 16, 2000 3:32 PM

8.6 SYSTEMS NETWORK ARCHITECTURE 655

user user
50-Mbps channel (perceived)

10-Mbps link
path control path control

20-Mbps links

Figure 8.57 Gaining Bandwidth via Multiple Links

review Section 5.2, which addressed the issue of effective data rates as a function of
overhead, frame size, and overall bit rate.

T RANSMISSION C ONTROL
The transmission control layer is analogous to the OSI transport layer. It is an end-
to-end protocol defining a logical connection (session) between two NAUs (Figure
8.58). Despite the similar terminology, the SNA session is more like the OSI trans-
port connection than the OSI session. Once established, the session allows the two
NAUs to communicate on a level transparent to the underlying network structure.
The transmission control layer has two main components, the session control and
the connection point manager.

Figure 8.58 Transmission Control Session between Two NAUs

session
NAU NAU

network
2942 | Ch 08 Page 656 Wednesday, February 16, 2000 3:32 PM

656 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

Session Control The session control has the responsibility for starting, main-
taining, and ending sessions. Perhaps the logical place to start is to identify the five
different session types.
The first session type (LU-LU) connects two LUs and handles the actual data
transfer between two users. The second (PU-PU) is used to transfer network control
information between adjacent PUs. The third (SSCP-SSCP) is used in multidomain
networks. It is necessary for any communications between NAUs in different
domains. The fourth (SSCP-PU) establishes communication between an SSCP and
each PU in its domain. As stated previously, SSCP-PU communication is necessary
for maintenance, error recovery, and control of domain resources. The last session
type (SSCP-LU) defines a connection between the SSCP and each LU in its domain.
Such sessions are a prerequisite for the LU to be involved in any other activity.
Session establishment is not a simple task, and the approach varies depending
on the NAU types and whether they reside in the same or different domains. We will
describe one example of establishing a session between two LUs in different
domains (Figure 8.59). References [Sp91] and [Me88] provide details on other ses-
sion types. During this discussion we assume that all necessary SSCP-LU, SSCP-
PU, and SSCP-SSCP sessions already exist. As stated earlier, they are necessary
before LUs can establish sessions with each other.
Similar to previous protocols, there are different types of BIUs (basic informa-
tion units) conveying different information. Session establishment defines the BIUs
exchanged and the various responses to them. Suppose, in our example, LU A
requests that a session be established with LU B. LU A might correspond to a user at
a workstation trying to access a file server represented by LU B. When the user at A
enters the command to request access, the session control protocol goes into action.
Figure 8.60 outlines the series of BIUs the NAUs exchange. First, LU A indi-
cates that it wants a session by sending an INITSELF request to the SSCP in its
domain. LU A has no idea whether LU B is in its domain or not, so the SSCP will
make that determination. The request also identifies the LU making the request and
to whom the request is made. The SSCP in domain A gets the request and deter-
mines whether LU B is in its domain or another one. In this case, LU B is in another
domain, adding complexity to the request. Now SSCP A must communicate with
SSCP B and get it involved in the session establishment.

Figure 8.59 Configuration for Example Session Establishment

SSCP A SSCP B

LU A LU B

domain A domain B
2942 | Ch 08 Page 657 Wednesday, February 16, 2000 3:32 PM

8.6 SYSTEMS NETWORK ARCHITECTURE 657

LU A SSCP A SSCP B LU B
INITSELF
CDINIT

response
CDCINIT

CINIT
response

BIND

response
SESSST
CDSESST

time time time time

Figure 8.60 Request/Response Exchange for LU-LU Session Establishment

Consequently, SSCP A sends a CDINIT (cross-domain initialize) request to


SSCP B. This is a preliminary indication to SSCP B that an LU from domain A
wants a session with an LU in domain B. If SSCP B agrees to help in the session
establishment (specified in the response), SSCP A follows with a CDCINIT (cross-
domain control initialize) request. This request contains all the details regarding
the proposed session and provides information about the LU making the request. It
may seem strange to do this with two separate requests, but it is common to make a
request and get agreement before providing all the information. It’s a bit like a stu-
dent approaching an instructor and saying “May I ask a question?” before actually
asking it.
When SSCP B gets the information in the CDCINIT request, it responds to
SSCP A and then sends a CINIT (control initiate) request to LU B. It tells LU B that
LU A wants a session and requests that LU B send a BIND command all the way
back to LU A. The BIND command actually initiates the session establishment and
also contains some session parameters that B suggests (we will see some examples
when we discuss the higher layers). When LU A gets the BIND, if it agrees with the
controlling parameters it sends a response back to LU B. As far as LU A and LU B are
concerned, the session is now established. The only task left is to inform the SSCPs
that it is established. LU B sends SSCP B a SESSST (session started) message and
SSCP B sends a CDSESSST (cross-domain session started) message to SSCP A.
2942 | Ch 08 Page 659 Wednesday, February 16, 2000 3:32 PM

8.6 SYSTEMS NETWORK ARCHITECTURE 659

With half-duplex contention mode, either station can enter a send mode
and transmit. However, if both do so at the same time a contention results. To
address this, one of the LUs is designated a contention winner (by the BIND
command) during session establishment. It is a bit like determining who is
going to win before playing the game. When contention happens the winner
rejects incoming messages and sends a reject response to the loser. The loser
then must exit the send mode, dequeue the messages it sent, receive the
incoming messages, and try sending later.
• Chaining. Chaining is a way of defining a sequence of RUs going in one direc-
tion (a chain) that must be processed together. Chain indicators in the RU
headers indicate the beginning and end of a chain. The idea is that a particular
request might be made using several RUs. With chaining, the protocols could
recover from an error by restarting the activity from the beginning of the chain.
For example, suppose a small file was being transferred as a chain of RUs to a
file server. If the drive failed and destroyed the information already written, the
protocols could recover, start from the beginning of the chain, and write all the
information to a backup device.
There are three types of chains: no-response chain, exception-response
chain, and definite-response chain. The no-response chain means that no
response is required for any RU in the chain. The exception-response chain
requires a response only in the event of an error detected in one of the chain’s
RUs. The definite-response chain requires a response whether the chain was
received intact or not.
• Bracketing. Chains can be generalized into brackets (Figure 8.61), providing
another level for organizing RUs. A bracket typically corresponds to a transac-
tion, a user-defined unit of work that might actually consist of several request/
response exchanges. A typical example is a database query, in which you enter a
primary key, retrieve the information (and consequently lock the record), make

Figure 8.61 Relationship between Chaining and Bracketing

sender receiver

request request
chain
response
bracketed
exchange
request

response

time time
2942 | Ch 08 Page 666 Wednesday, February 16, 2000 3:32 PM

666 CHAPTER 8 ADDITIONAL NETWORK PROTOCOLS

10. Suppose each of the TE1s in the following figure tries sending something to the NT2
at the same time.

2B+D frame S
NT2
2B+D
TE1 TE1 TE1
A B C

Suppose also that each is trying to send the following over the D channel.
• A sends 10011101.
• B sends 10001100.
• C sends 10011001.
Which TE1 wins the contention?

11. ISDN’s B channel capacities were designed with the intention of transmitting voice.
Section 2.4 showed that to capture most of a voice’s characteristics, 8-bit samples
taken at a frequency of 8000 samples per second is sufficient and requires a bit rate
of 64,000 bps. However, some encoding techniques actually allow voice data to be
transmitted using 32,000 bps, and others will likely allow 16,000 bps to be suffi-
cient. What effect will this have on the ISDN standard?

12. Draw a diagram similar to that of Figure 8.37 showing the ISDN disconnect
procedure.

13. Describe a scenario in which four cells can be routed through the Banyan switch of
Figure 8.40 simultaneously with no collisions.

You might also like