3.6
Example Data Link Protocols
In the following sections we will
examine several widely-used data link protocols. The first one, HDLC, is a
classical bit-oriented protocol whose variants have been in use for decades in
many applications. The second one, PPP, is the data link protocol used to
connect home computers to the Internet.
In this section we will examine a
group of closely related protocols that are a bit old but are still heavily
used. They are all derived from the data link protocol first used in the IBM
mainframe world: SDLC (Synchronous Data Link Control) protocol. After
developing SDLC, IBM submitted it to ANSI and ISO for acceptance as U.S. and
international standards, respectively. ANSI modified it to become ADCCP (Advanced
Data Communication Control Procedure), and ISO modified it to become HDLC (High-level
Data Link Control). CCITT then adopted and modified HDLC for its LAP (Link
Access Procedure) as part of the X.25 network interface standard but later
modified it again to LAPB, to make it more compatible with a later version of
HDLC. The nice thing about standards is that you have so many to choose from.
Furthermore, if you do not like any of them, you can just wait for next year's
model.
These protocols are based on the
same principles. All are bit oriented, and all use bit stuffing for data transparency.
They differ only in minor, but nevertheless irritating, ways. The discussion of
bit-oriented protocols that follows is intended as a general introduction. For
the specific details of any one protocol, please consult the appropriate
definition.
All the bit-oriented protocols use
the frame structure shown in Fig. 3-24. The Address field is primarily of
importance on lines with multiple terminals, where it is used to identify one
of the terminals. For point-to-point lines, it is sometimes used to distinguish
commands from responses.
The Control field is used for
sequence numbers, acknowledgements, and other purposes, as discussed below.
The Data field may contain any
information. It may be arbitrarily long, although the efficiency of the
checksum falls off with increasing frame length due to the greater probability
of multiple burst errors.
The Checksum field is a cyclic
redundancy code using the technique we examined in Sec. 3-2.2.
The frame is delimited with another
flag sequence (01111110). On idle point-to-point lines, flag sequences are
transmitted continuously. The minimum frame contains three fields and totals 32
bits, excluding the flags on either end.
There are three kinds of frames: Information,
Supervisory, and Unnumbered. The contents of the Control field for these three
kinds are shown in Fig. 3-25. The protocol uses a sliding window,
with a 3-bit sequence number. Up to seven unacknowledged frames may be
outstanding at any instant. The Seq field in Fig. 3-25(a) is the frame sequence number. The Next
field is a piggybacked acknowledgement. However, all the protocols adhere to
the convention that instead of piggybacking the number of the last frame
received correctly, they use the number of the first frame not yet received
(i.e., the next frame expected). The choice of using the last frame received or
the next frame expected is arbitrary; it does not matter which convention is
used, provided that it is used consistently.
Figure 3-25. Control field of (a) an information frame, (b)
a supervisory frame, (c) an unnumbered frame.
The P/F bit stands for Poll/Final.
It is used when a computer (or concentrator) is polling a group of terminals.
When used as P, the computer is inviting the terminal to send data. All the
frames sent by the terminal, except the final one, have the P/F bit set to P.
The final one is set to F.
In some of the protocols, the P/F
bit is used to force the other machine to send a Supervisory frame immediately
rather than waiting for reverse traffic onto which to piggyback the window
information. The bit also has some minor uses in connection with the Unnumbered
frames.
The various kinds of Supervisory
frames are distinguished by the Type field. Type 0 is an acknowledgement frame
(officially called RECEIVE READY) used to indicate the next frame expected.
This frame is used when there is no reverse traffic to use for piggybacking.
Type 1 is a negative acknowledgement
frame (officially called REJECT). It is used to indicate that a transmission
error has been detected. The Next field indicates the first frame in sequence
not received correctly (i.e., the frame to be retransmitted). The sender is
required to retransmit all outstanding frames starting at Next. This strategy
is similar to our protocol 5 rather than our protocol 6.
Type 2 is RECEIVE NOT READY. It
acknowledges all frames up to but not including Next, just as RECEIVE READY
does, but it tells the sender to stop sending. RECEIVE NOT READY is intended to
signal certain temporary problems with the receiver, such as a shortage of
buffers, and not as an alternative to the sliding window flow control. When the
condition has been repaired, the receiver sends a RECEIVE READY, REJECT, or
certain control frames.
Type 3 is the SELECTIVE REJECT. It
calls for retransmission of only the frame specified. In this sense it is like
our protocol 6 rather than 5 and is therefore most useful when the sender's
window size is half the sequence space size, or less. Thus, if a receiver
wishes to buffer out-of-sequence frames for potential future use, it can force
the retransmission of any specific frame using Selective Reject. HDLC and ADCCP
allow this frame type, but SDLC and LAPB do not allow it (i.e., there is no
Selective Reject), and type 3 frames are undefined.
The third class of frame is the
Unnumbered frame. It is sometimes used for control purposes but can also carry
data when unreliable connectionless service is called for. The various
bit-oriented protocols differ considerably here, in contrast with the other two
kinds, where they are nearly identical. Five bits are available to indicate the
frame type, but not all 32 possibilities are used.
All the protocols provide a command,
DISC (DISConnect), that allows a machine to announce that it is going down
(e.g., for preventive maintenance). They also have a command that allows a
machine that has just come back on-line to announce its presence and force all
the sequence numbers back to zero. This command is called SNRM (Set Normal
Response Mode). Unfortunately, ''Normal Response Mode'' is anything but normal.
It is an unbalanced (i.e., asymmetric) mode in which one end of the line is the
master and the other the slave. SNRM dates from a time when data communication
meant a dumb terminal talking to a big host computer, which clearly is
asymmetric. To make the protocol more suitable when the two partners are
equals, HDLC and LAPB have an additional command, SABM (Set Asynchronous
Balanced Mode), which resets the line and declares both parties to be equals.
They also have commands SABME and SNRME, which are the same as SABM and SNRM,
respectively, except that they enable an extended frame format that uses 7-bit
sequence numbers instead of 3-bit sequence numbers.
A third command provided by all the
protocols is FRMR (FRaMe Reject), used to indicate that a frame with a correct
checksum but impossible semantics arrived. Examples of impossible semantics are
a type 3 Supervisory frame in LAPB, a frame shorter than 32 bits, an illegal
control frame, and an acknowledgement of a frame that was outside the window,
etc. FRMR frames contain a 24-bit data field telling what was wrong with the
frame. The data include the control field of the bad frame, the window
parameters, and a collection of bits used to signal specific errors.
Control frames can be lost or
damaged, just like data frames, so they must be acknowledged too. A special
control frame, called UA (Unnumbered Acknowledgement), is provided for this
purpose. Since only one control frame may be outstanding, there is never any
ambiguity about which control frame is being acknowledged.
The remaining control frames deal
with initialization, polling, and status reporting. There is also a control
frame that may contain arbitrary information, UI (Unnumbered Information).
These data are not passed to the network layer but are for the receiving data
link layer itself.
Despite its widespread use, HDLC is
far from perfect. A discussion of a variety of problems associated with it can
be found in (Fiorini et al., 1994).
The Internet consists of individual
machines (hosts and routers) and the communication infrastructure that connects
them. Within a single building, LANs are widely used for interconnection, but
most of the wide area infrastructure is built up from point-to-point leased
lines.
In practice, point-to-point
communication is primarily used in two situations. First, thousands of
organizations have one or more LANs, each with some number of hosts (personal
computers, user workstations, servers, and so on) along with a router (or a
bridge, which is functionally similar). Often, the routers are interconnected
by a backbone LAN. Typically, all connections to the outside world go through
one or two routers that have point-to-point leased lines to distant routers. It
is these routers and their leased lines that make up the communication subnets
on which the Internet is built.
The second situation in which
point-to-point lines play a major role in the Internet is the millions of
individuals who have home connections to the Internet using modems and dial-up
telephone lines. Usually, what happens is that the user's home PC calls up an
Internet service provider's router and then acts like a full-blown Internet
host. This method of operation is no different from having a leased line
between the PC and the router, except that the connection is terminated when
the user ends the session. A home PC calling an Internet service provider is
illustrated in Fig. 3-26. The modem is shown external to the
computer to emphasize its role, but modern computers have internal modems.
The Internet needs a point-to-point
protocol for a variety of purposes, including router-to-router traffic and home
user-to-ISP traffic. This protocol is PPP (Point-to-Point Protocol), which is
defined in RFC 1661 and further elaborated on in several other RFCs (e.g., RFCs
1662 and 1663). PPP handles error detection, supports multiple protocols,
allows IP addresses to be negotiated at connection time, permits
authentication, and has many other features.
PPP provides three features:
- A framing method that unambiguously delineates the end of one frame and the start of the next one. The frame format also handles error detection.
- A link control protocol for bringing lines up, testing them, negotiating options, and bringing them down again gracefully when they are no longer needed. This protocol is called LCP (Link Control Protocol). It supports synchronous and asynchronous circuits and byte-oriented and bit-oriented encodings.
- A way to negotiate network-layer options in a way that is independent of the network layer protocol to be used. The method chosen is to have a different NCP (Network Control Protocol) for each network layer supported.
To see how these pieces fit
together, let us consider the typical scenario of a home user calling up an
Internet service provider to make a home PC a temporary Internet host. The PC
first calls the provider's router via a modem. After the router's modem has
answered the phone and established a physical connection, the PC sends the
router a series of LCP packets in the payload field of one or more PPP frames.
These packets and their responses select the PPP parameters to be used.
Once the parameters have been agreed
upon, a series of NCP packets are sent to configure the network layer.
Typically, the PC wants to run a TCP/IP protocol stack, so it needs an IP
address. There are not enough IP addresses to go around, so normally each
Internet provider gets a block of them and then dynamically assigns one to each
newly attached PC for the duration of its login session. If a provider owns n
IP addresses, it can have up to n machines logged in simultaneously, but its
total customer base may be many times that. The NCP for IP assigns the IP address.
At this point, the PC is now an
Internet host and can send and receive IP packets, just as hardwired hosts can.
When the user is finished, NCP tears down the network layer connection and
frees up the IP address. Then LCP shuts down the data link layer connection.
Finally, the computer tells the modem to hang up the phone, releasing the
physical layer connection.
The PPP frame format was chosen to
closely resemble the HDLC frame format, since there was no reason to reinvent
the wheel. The major difference between PPP and HDLC is that PPP is character
oriented rather than bit oriented. In particular, PPP uses byte stuffing on
dial-up modem lines, so all frames are an integral number of bytes. It is not
possible to send a frame consisting of 30.25 bytes, as it is with HDLC. Not
only can PPP frames be sent over dial-up telephone lines, but they can also be
sent over SONET or true bit-oriented HDLC lines (e.g., for router-router
connections). The PPP frame format is shown in Fig. 3-27.
All PPP frames begin with the
standard HDLC flag byte (01111110), which is byte stuffed if it occurs within
the payload field. Next comes the Address field, which is always set to the binary
value 11111111 to indicate that all stations are to accept the frame. Using
this value avoids the issue of having to assign data link addresses.
The Address field is followed by the
Control field, the default value of which is 00000011. This value indicates an
unnumbered frame. In other words, PPP does not provide reliable transmission
using sequence numbers and acknowledgements as the default. In noisy
environments, such as wireless networks, reliable transmission using numbered
mode can be used. The exact details are defined in RFC 1663, but in practice it
is rarely used.
Since the Address and Control fields
are always constant in the default configuration, LCP provides the necessary
mechanism for the two parties to negotiate an option to just omit them
altogether and save 2 bytes per frame.
The fourth PPP field is the Protocol
field. Its job is to tell what kind of packet is in the Payload field. Codes
are defined for LCP, NCP, IP, IPX, AppleTalk, and other protocols. Protocols
starting with a 0 bit are network layer protocols such as IP, IPX, OSI CLNP,
XNS. Those starting with a 1 bit are used to negotiate other protocols. These
include LCP and a different NCP for each network layer protocol supported. The
default size of the Protocol field is 2 bytes, but it can be negotiated down to
1 byte using LCP.
The Payload field is variable
length, up to some negotiated maximum. If the length is not negotiated using
LCP during line setup, a default length of 1500 bytes is used. Padding may
follow the payload if need be.
After the Payload field comes the Checksum
field, which is normally 2 bytes, but a 4-byte checksum can be negotiated.
In summary, PPP is a multiprotocol
framing mechanism suitable for use over modems, HDLC bit-serial lines, SONET,
and other physical layers. It supports error detection, option negotiation,
header compression, and, optionally, reliable transmission using an HDLC-type
frame format.
Let us now turn from the PPP frame
format to the way lines are brought up and down. The (simplified) diagram of Fig. 3-28 shows the phases that a line goes
through when it is brought up, used, and taken down again. This sequence
applies both to modem connections and to router-router connections.
The protocol starts with the line in
the DEAD state, which means that no physical layer carrier is present and no
physical layer connection exists. After physical connection is established, the
line moves to ESTABLISH. At that point LCP option negotiation begins, which, if
successful, leads to AUTHENTICATE. Now the two parties can check on each
other's identities if desired. When the NETWORK phase is entered, the
appropriate NCP protocol is invoked to configure the network layer. If the
configuration is successful, OPEN is reached and data transport can take place.
When data transport is finished, the line moves into the TERMINATE phase, and
from there, back to DEAD when the carrier is dropped.
LCP negotiates data link protocol
options during the ESTABLISH phase. The LCP protocol is not actually concerned
with the options themselves, but with the mechanism for negotiation. It
provides a way for the initiating process to make a proposal and for the responding
process to accept or reject it, in whole or in part. It also provides a way for
the two processes to test the line quality to see if they consider it good
enough to set up a connection. Finally, the LCP protocol also allows lines to
be taken down when they are no longer needed.
Eleven types of LCP frames are
defined in RFC 1661. These are listed in Fig. 3-29. The four Configure- types allow the
initiator (I) to propose option values and the responder (R) to accept or
reject them. In the latter case, the responder can make an alternative proposal
or announce that it is not willing to negotiate certain options at all. The
options being negotiated and their proposed values are part of the LCP frames.
The Terminate- codes shut a line
down when it is no longer needed. The Code-reject and Protocol-reject codes
indicate that the responder got something that it does not understand. This
situation could mean that an undetected transmission error has occurred, but
more likely it means that the initiator and responder are running different
versions of the LCP protocol. The Echo- types are used to test the line
quality. Finally, Discard-request help debugging. If either end is having
trouble getting bits onto the wire, the programmer can use this type for
testing. If it manages to get through, the receiver just throws it away, rather
than taking some other action that might confuse the person doing the testing.
The options that can be negotiated
include setting the maximum payload size for data frames, enabling
authentication and choosing a protocol to use, enabling line-quality monitoring
during normal operation, and selecting various header compression options.
There is
little to say about the NCP protocols in a general way. Each one is specific to
some network layer protocol and allows configuration requests to be made that
are specific to that protocol. For IP, for example, dynamic address assignment
is the most important possibility.
No comments:
Post a Comment
silahkan membaca dan berkomentar