You are on page 1of 35

Computer Networks

UNIT - II
2.0 Introduction
This unit provides a general description of how the Data Transmitting Equipments (DTE) or the end user machines exchange data among them. The term protocol describes the procedures and logic used for this purpose. Several protocols are available to manage the communication. Two important protocols are 1. Link or Line Protocol: This is responsible for controlling the flow of the traffic on each channel. 2. Switching or Routing Protocol: This selects the best among several available channels for the line protocol.

2.1 Objective
This unit provides a detailed description about the Elementary Data link protocols and Bit oriented and Character oriented protocols. It includes Simplex stop and wait protocol, Sliding window protocols, Binary Synchronous Control and High Level Data Link Control. HDLC is a bit-oriented, link layer protocol for the transmission of data over synchronous networks and is defined by the ISO. At the end of the lesson you learn about how the end user machines exchange data among them.

2.2 Content
2.2.1 A Simplex Stop-and-Wait Protocol One of the simplest and oldest protocol is the stop-and-wait protocol. It is so named because a DTE transmits a frame and waits for a reply. The sender starts out by fetching a packet from the network layer, uses it to construct a frame and sends it on its way. The sender must now wait until an acknowledgement frame arrives from the receiver before looping back and fetching the next packet from the network layer. The sending data link layer need not inspect the incoming frame because it is only an acknowledgement.

Page 27

Computer Networks

Figure 2.1: Stop-and-Wait Sequencing This protocol is halfduplex (two-way alternate) because the transmissions are in both the directions, but only in one direction at a time. This protocol is widely used because it is inexpensive and simple. Stop and wait protocols use sequence numbers during data transmissions. In the figure data are transmitted with sequence number starting from 0, from site A to site B. Sequence numbers are added to each transmission. Data transmitted from site A are checked in site B. The computer then responds with an ACK (event 2). The ACK has the same sequence number as that of its data. On receiving ACK, site A transmits another data with sequence number 1 (event 3). The data is checked for error in site B and ACK of 1 is sent. Since there is a frame loss during ACK 1 of event 4, site A performs a timeout. After not receiving reply to its transmission within a given period, it retransmits the data. Hence data transmitted in event 5 and event 3 are the same. If the sequence number does not exist, this kind of loss cannot be compensated. Since the sequence number received by site B is the same as the one received previously, it discards it to avoid redundancy and retransmits ACK 1, to complete the accountability. The stop-and-wait protocol (Protocol 2) provides for a one directional flow of data from sender to receiver. The communications channel is assumed to be error free. However, the receiver has only a finite buffer capacity and a finite processing speed, so the protocol must explicitly prevent the sender from flooding the receiver with data faster than it can be handled. The following program illustrates the protocol: type EvType = (FrameArrival); procedure sender 2; var s: frame; buffer: packet; event : EvType; begin

Page 28

Computer Networks
repeat FromNetworkLayer (buffer); s.info : = buffer; ToPhysicalLayer(s); Wait (event) until doomsday end; {sender2} procedure receiver2; var r,s: frame; event : EvType; begin repeat wait (event); {only possibility is FrameArrival} FromPhysicalLayer(r); {go get the frame} ToNetworkLayer (r.info); {give the packet to the network layer} ToPhysicalLayer(s) {send a dummy frame as a go ahead signal} until doomsday end; {receiver2} 2.2.2 Sliding Window Protocols Sliding window or continuous ARQ (Automatic request for repeat) technique is so named because a station is allowed to request automatically a retransmission from another station. This approach utilizes full-duplex (two-way simultaneous) transmission, which allows transmission in both directions between the communicating devices. Continuous ARQ devices use the concept of transmitting (sending) and receiving windows. A window is established on each link to provide a reservation of resources at both DTEs. These resources may be the allocation of specific computer resources or the reservation of buffer space. The windowing concept entails a continuous flow of frames into the receiving site without the intermittent stop-and-wait acknowledgements. The essence of all sliding window protocol is that at any instance of time, the sender maintains a list of consecutive sequence numbers corresponding to frames it is permitted to send. These frames are said to fall within the sending window. The receiver also maintains a receiving window corresponding to frames it is permitted to accept. State variable or counters control the windows at the transmitting and receiving site. The transmitting site maintains a send state variable [V(S)], which is the sequence number of the next frame to be transmitted. The receiving site maintains a receive state variable [V(R)], which contains the number that is expected to be in the sequence number of the next frame. The V(S) is incremented with each frame transmitted and placed in the send sequence field in the frame. Upon receiving the frame, the receiving site checks for a transmission error and the send sequence number with its V(R). If the Page 29 {fetch information from the network layer} {copy it into s for subsequent transmission} {bye bye little frame} {do not proceed until given go ahead}

Computer Networks
frame is acceptable, it increments V(R) by one, places it into a receive sequence number field in an acknowledgement (ACK) frame, and sends it to the original transmitting site to complete the accountability for the transmission. If the V(R) does not match the send sequence number in the frame, an error is detected. After a timeout occurs, a NAK (Negative Acknowledgement) is sent to the original transmitting site. The transmitting site on receiving NAK, reset its V(S) and retransmit the frame whose sequence number matches the value of V(R). Window size is an important design consideration. The larger the window, the more frames can be transmitted without a response from the receiver. Yet the larger window size also means that the receiver must allocate more resources and larger buffer to handle the incoming transmissions. One Bit Sliding Window Protocol This protocol uses stop-and wait, since the sender transmits a frame and waits for its acknowledgement before sending the next one. One of the two data link layers goes first. The starting machine fetches the first packet from its network layer, builds a frame from it, and sends it. When this (or any) frame arrives, the receiving data link layer checks to see if it is a duplicate. If the frame is the one expected, it is passed to the network layer and the receivers window is slid up. The acknowledgement field contains the number of the last frame received without error. If this number agrees with the sequence number of the frame the sender is trying to send, the sender knows it is done with the frame stored in buffer and can fetch the next packet from its network layer. If the sequence number disagrees, it must continue trying to send the same frame. Whenever a frame is received, a frame is also sent back. For example, assume that A is trying to send its frame 0 to B and that B is trying to send its frame 0 to A. Suppose that A sends a frame to B, but As timeout interval is short. Consequently, A may time out repeatedly, sending a series of identical frames, all with seq No = 0 and ack = 1. When the first valid frame arrives at B, it will be accepted. All the subsequent frames will be rejected, because their sequence numbers will be wrong. Furthermore, since all the duplicates have ack = 1 and B is still waiting for an acknowledgement of 0, B will not fetch a new packet from its network layer. After every rejected duplicate comes in, B sends A a frame containing seq No = 0 and ack = 0. Eventually, one of these arrives correctly at A, causing A to begin sending the next packet. There is no possibility of duplicate packets being sent or deadlock. The following program explains the protocol. NextFrameToSend tells which frame the sender is trying to send. Similarly, FrameExpected tells which frame the receiver is expecting. In both cases, 0 and 1 are the only possibilities. This protocol is bi-directional. It can withstand any combination of errors and timeouts without losing or duplicating network layer packets. const MaxSeq = 1;

Page 30

Computer Networks
type EvType = (FrameArrival, CksumErr, TimeOut); procedure protocol4; var NextFrameToSend : SequenceNr; FrameExpected : SequenceNr; r,s : frame; buffer : packet; event : EvType; {0 or 1 only} {0 or 1 only} {scratch variables} {current packet being sent}

begin NextFrameToSend := 0; {initialize outbound stream} FrameExpected := 0; {initialize inbound stream} FromNetworkLayer(buffer); {fetch packet from network layer} s.info := buffer; {prepare to send initial frame} s.seq := NextFrameToSend; {frame sequence number} s.ack := 1 FrameExpected; {piggybacked ack} ToPhysicalLayer(s); {transmit the frame} StartTimer (s.seq); {start the timer running} repeat wait(event); if event = FrameArrival then begin FromPhysicalLayer(r); if r.sqe = FrameExpected then begin ToNetworkLayer(r.info); inc(FrameExpected) end; if r.ack = NextFrameToSend then begin FromNetworkLayer(buffer); inc(NextFrameToSend) end; end; s.info := buffer; s.seq := NextFrameToSend; s.ack := 1 Frame Expected; ToPhysicalLayer(s); StartTimer(s.seq) {FrameArrival,CksumErr,Timeout} {an inbound frame made it without error} {go get it} {handle inbound frame stream) {pass the packet to the network layer} {invert the receiver seq number}

{handle outbound frame stream} {fetch a new packet from network layer} {invert sender sequence number}

{construct outbound frame} {insert sequence number into it} {this is sequence number of last received frame} {transmit a frame} {Start the timer running}

Page 31

Computer Networks
until doomsday end; {protocol 4} However, there will be synchronization problems, if both sides simultaneously send an initial packet. Figure 2.2 illustrates such a synchronization difficulty.

Figure 2.2: Two scenarios for protocol 4. The notation is (seq, ack, packet, number). An asterisk indicates where a network layer accepts a packet. In part (a) the normal operation of the protocol is shown. In part B the peculiarity is illustrated. If B waits for As first frame before sending its own, the sequence is as shown in (a), and every frame is accepted. But if A and B simultaneously initiate communication, their first frames cross, and the data link layers then get into situation (b). In (a) each frame arrival brings a new packet for the network layer and there are no duplicates. In (b) half of the frames contain duplicates, even though there are no transmission errors. Protocol Using Go Back n The time required for a frame to arrive at the receiver plus the transmission m acknowledgement frame was assumed negligible in the other protocols. In case of satellite communication, it takes 270 millisecond to transmit a frame and 520 millisecond is needed before the acknowledgement arrives. The solution here is the sender is allowed to send up to w frames and the acknowledgement will arrive after the roundtrip time gets equal. The technique of allowing the sender to send the data and receiver acknowledging them in parallel is called Pipelining. If the channel capacity is b bits/sec and frame size l bits and the roundtrip propagation time R sec, the time required to transmit a single frame is l/b sec. There is a Page 32

Computer Networks
delay of R/2 before the last bit arrives and another R/2 before acknowledgement arrives. The line utilization for the stop-and-wait is l/(l+bR). Pipelining has a serious drawback when one of the frames gets damaged in the middle. This could be overcome by the Go Back n protocol. This approach is mainly used for dealing with errors when the frames are pipelined. The receiver simply discards all subsequent frames, sending no acknowledgements. Here the receiver window is of size 1. In other words, the data link layer refuses to accept any frame except the next one it must give to the network layer. If the senders window fills up before the timer runs out, the pipeline will begin to empty. Eventually, the sender will time out and retransmit all unacknowledged frames in order, starting with the damaged or lost one. This approach can waste a lot of bandwidth if the error rate is high. This approach is shown in the figure 2.3

Figure 2.3: Effect of error when the receiver window size is 1 This protocol (Protocol 5 Pipelining) allows multiple outstanding frames. The sender may transmit up to MaxSeq frames without waiting for an acknowledgement. In addition, the network layer is not assumed to have a new packet all the time. Instead, the network layer causes NetworkLayerReady events when there is a packet to be sent. type EvType = (FrameArrival, CksumErr, TimeOut, NetworkLayerReady); procedure protocol5; var NextFrameToSend: SequenceNr; AckExpected:SequenceNr; FrameExpected:SequenceNr; r.s:frame; buffer:array[sequenceNr] of packet; nbuffered:SequenceNr; i:SequenceNr; event:EvType; {MaxSeq.1; used for outbound frame stream} {oldest frame as yet unacknowledged} {next frame expected on inbound stream} {Scratch variables} {buffers for the outbound stream} {how many buffer slots are currently in use} {used to index into buffer}

function between (a, b, c:SequenceNr):boolean;

Page 33

Computer Networks
{Return true if a< = b < c circularly, false otherwise} begin if ((a < = b) and (b < c)) or ((c < a) and (a < = b)) or ((b < c) and (c < a)) then between := true else between := false end; {between} procedure SendData(FrameNr : SequenceNr); {Construct and send a data frame} begin s.info := buffer[FrameNr]; s.seq := FrameNr; s.ack := (FrameExpected + Maxseq) ToPhysicalLayer(s); StartTimer(FrameNr) end; {SendData} Begin EnableNetworkLayer; NextFrameToSend := 0; AckExpected := 0; FrameExpected := 0; nbuffered := 0; {insert packet into frame} {insert seq into frame} Mod(MaxSeq + 1); {piggyback ack} {transmit the frame} {start the timer running}

{allow NetworkLayerReady events} {initialize} {next ack expected on inbound stream} {next data frame expected inbound} {Initially no packets are buffered} {FrameArrival, CksumErr, NetworkLayerReady} TimeOUt,

Repeat
wait(event); case event of NetworkLayerReady: Begin FromNetworkLayer(buffer[NextFrame ToSend]); nbuffered := nbuffered + 1; SendData(NextFrameToSend); inc(NextFrameToSend) end; FrameArrival: Begin FromPhysicalLayer(r); if r.seq = FrameExpected then Begin ToNetworkLayer(r.info); inc(FrameExpected) end;

{the network layer has a packet to send} {accept, save and transmit a new frame} {accept packet from network layer) {one more frame buffered now} {transmit the frame} {expand senders window} {a data or control frame has just arrived} {fetch the frame from the physical layer} {frames are only accepted in proper order} {pass packet to network layer} {advance receivers window}

Page 34

Computer Networks
{ack n implles n 1 , n 2, etc; check for this} while between (AckExpected, r.ack, NextFrameToSend) do Begin nbuffered := nbuffered 1; StopTimer(AckExpected); inc(AckExpected) End end; CksumErr: ; TimeOut: Begin NextFrameToSend := AckExpected; for i := 1 to nbuffered do Begin SendData(NextFrameToSend) inc(NextFrameToSend) End end end; if nbuffered < MaxSeq then EnableNetworkLayer else DiasableNetworkLayer until doomsday end; {protocol5} The maximum number of outstanding frames is restricted to max seq to distinguish between frames belonging to another batch. This protocol does not escape from the problem of buffering because the sender must keep the unacknowledged frames. This has multiple outstanding frames and hence it needs multiple timers. A hardware clock can be used to cause interrupts periodically. Protocol Using Selective Repeat The other general strategy for handling errors when frames are pipelined, called selective repeat is to have the receiving data link layer store all the correct frames following the bad one. When the sender finally notices that something is wrong, it just retransmits the one bad frame, not all its successors. If the second try succeeds, the receiving data link layer will now have many correct frames in sequence, so they can all be handed off to the network layer quickly and the highest number acknowledged. This strategy corresponds to a receiver window larger than 1. Any frame within the window may be accepted and buffered until all the preceding ones have been passed

{handle the piggybacked ack} One frame fewer buffered} {frame not lost, stop timer} {contract senders window} {just ignore bad frames} {trouble;retransmit all frames} {start retransmitting here}

outstanding

Page 35

Computer Networks
to the network layer. This approach can require large amounts of data link layer memory if the window is large.

Figure 2.4: Effect of an error when the receiver window size is large In this protocol, both sender and receiver maintain a window of acceptable sequence numbers. The senders window size starts out at 0 and grows to some predefined maximum, MaxSeq. The receivers window, in contrast, is always fixed in size and equal to MaxSeq. The receiver has a buffer reserved for each sequence number within its window. Associated with each buffer is a bit (arrived) telling whether the buffer is full or empty. Whenever a frame arrives, its sequence number is checked to see if it falls within the window. If it falls and if it has not already been received, it is accepted and stored. This action is taken without regard to whether or not it contains the next packet expected by the network layer. Non-sequential receiver can introduce problems. In a 3-bit sequence number, the sender sends frames 0 through 6. The receiver window accepts frames from 0 to 6. The sender times out and retransmits frame 0. It is here the problem occurs. This is with the receiver window, so it will be accepted. The problem here is that after the receiver has advanced its window, the new range of sequence numbers overlapped the old one. To overcome this, the maximum window size must be half the range of sequence numbers. In general, the window size for this protocol will be (Max.seq + 1). The number of buffers, number of timers is equal to the window size. This protocol uses an efficient strategy by sending a Negative Acknowledgement (NAK) when it suspects an error. The variable NAK is true if NAK has not yet been sent. The variable processing time within the receiver can also be a problem. The timer must be set tight or loose according to the acknowledgement interval. The following program illustrates this more general protocol.

Page 36

Computer Networks
This protocol (Protocol 6 non-sequential receive) accepts frames out of order, but passes packets to the network layer in order. Associated with each outstanding frame is a timer. When the timer goes off, only that frame is retransmitted, not all the outstanding frames. A sliding window protocol using selective repeat const NrBufs = ; {NrBufs = (MaxSeq + 1) div 2} MaxBuf = ; {MaxBuf = NrBufs 1} type bufnr = 0 .. MaxBuf; EvType = (FrameArrival, CksumErr, TimeOut, NetworkLayerReady, NetworkLayerIdle); procedure protocol6; var AckExpected: SequenceNr; {lower edge of senders window} NextFrameToSend:SequenceNr; {upper edge of senders window + 1} FrameExpected:SequenceNr; {lower edge of receiver window} TooFar: SequenceNr;; {upper edge of receiver window + 1} OldestFrame:SequenceNr; {which frame timed out?} i;bufnr; {index into buffer pool} r,s:frame {scratch variables} OutBuf:array{bufnr}of packet; {buffers for outbound stream} InBuf:arrayPbufnr)of packet {buffers for inbound stream arrived:array(bufnr) of Boolean; {inbound bit map} nbuffered:SequenceNr; {how many output buffers currently used} NoNak: Boolean; {set to false when a nak is sent} event: EvType; function between (a, b, c: SequenceNr):boolean: begin if ((a < = b) and (b<c)) or ((c < a) and (a < = b)) or ((b < c) and (c < a)) then between := true else between := false end; {between} procedure SendFrame(fk:FrameKind; FrameNr:SequenceNr); begin s.kind := fk; if fk = data then s.info: = OutBuf [Frame Nr mod NrBufs]; s.seq := FrameNr; {only meaningful for data frames} s.ack := (FrameExpected + MaxSeq) mod(MaxSeq+1); If fk = nak then NoNak := false; {one nak per frame, please} ToPhysicsLayer(s) {transmit the frame} If fk = data then StartTimer(FrameNr mod NrBufs); StopAckTimer {no need for separate ack frame} end; {sendFrame}

Page 37

Computer Networks
Begin EnableNetworkLayer; {initialization begins here} NextFrameToSend := 0;AckExpected := 0 FrameExpected:= 0 TooFar := NrBuf; nbuffered := 0; NoNak := true; for i : = 0 to MaxBuf do arrived[i] := false; Repeat wait(event); {five possibilities; see EvType above} case event of NetworkLayerReady: {accept, save, and transmit a new frame} Begin nbuffered := nbuffered + 1; {expand window} FromNetworkLayer(OutBuf[NextFrameToSend {fetch new packet} mod NrBufs]): SendFrame(data, {transmit frame} NextFrameToSend); Inc(NextFrameToSend) {advance upper window edge} end; FrameArrival: {a data or control frame has arrived} begin FromPhysicalLayer (r); {fetch the frame from the physical layer} if r.kind = data then Begin {frames may be accepted in any order} arrived [r.seq mod NrBufs] {mark buffer as full} := true InBuf[r.seq mod NrBusf] := [insert data in buffer} r.info; while arrived [FrameExpected mod NrBufs] do Begin {pass frames and advance window} To NetworkLayer(InBuf[FrameExpected mod NrBufs]); NoNak := true; arrived [FrameExpected mod NrBufs] := false; inc(FrameExpected); {advance lower edge of receiver window} inc(TooFar); {advance upper edge + 1 of receiver window StartAckTimer {to see if separate ack needed} End End end; {end of code for data frame} if (r.kind = nak) and between (AckExpected, (r.ack + 1) mod (MaxSeq + 1),

Page 38

Computer Networks
NextFrameToSend) then SendFrame(ack, (r.ack + 1) mod(MaxSeq + 1)); while between (AckExpected, r.ack, NextFrameToSend) do begin nbuffered := nbuffered = 1: StopTimer(ACKExpected mod NrBufs); inc(AckExpected) End end; CksumErr: if NoNak then SendFrame(nak, 0) TimeOut : SendFrame(data,OldestFrame); NetworkLayerIdle: Send Frame(ack, 0) end; if nbuffered < NrBufs then EnableNetworkLayer else Diable NetworkLayer until doomsday end; {protocol6} 2.2.3 Protocol Performance Performance of the Stop-and-Wait Protocol The factors influencing the efficiency of a protocol are: 1) 2) 3) 4) Whether frames are variable length or fixed length, Whether the protocol is pipelined or stop-and-wait, Whether the line is half or full duplex, The statistical characteristics of transmission errors.

{handle piggybacked ack} {frame arrived intact} {advance lower window edge} {end of Frame Arrival code} {damaged frame received} {we timed out} {network layer idle too long, send ack} {end of case}

The basic approach for determining the efficiency of any protocol is to determine how much bandwidth is utilized to send the statistically average frame, considering all retransmissions and timeouts. The following notations are used for the derivation: A C D E F H = number of bits in an ACK frame = channel capacity in bps = number of data bits per frame = probability of a bit being in error = D + H (total frame length) = number of bits in the frame header

Page 39

Computer Networks
I = interrupt and service time + propagation delay L = probability that a frame or its ACK is lost or damaged P1 = probability that a data frame is lost or damaged P2 = probability that an ACK frame is lost or damaged R = mean number of retransmissions per data frame T = timeout interval U = channel utilization (efficiency) W = window size The channel efficiency is calculated as follows. The sender begins to send a frame at time 0. At time (F/C), the last bit has been sent. At time (F/C) + I the receiver received the last bit, the interrupt has been serviced and the acknowledgement frame is ready for transmission. The last bit of the acknowledgment comes at time (F/C) + I + (A/C). The sender has processed the acknowledgement and is ready to send the next data frame at time (F/C) + I + (A/C) + I. The bandwidth occupied by the frame is F + A + 2CI. The number of data bits transferred is D. Therefore the channel efficiency is D/(H + D + A + 2CI). When the frame is damaged or lost, the sender times out T sec after the last bit has been sent. The total channel capacity used for the mean number of retransmissions, R bad frames and one good one is , R(F + CT) + (F + A+ 2CI). The probability of success is (1- P2)(1-P1). The probability of failure therefore is, L = 1 (1- P2)(1-P1). The probability that exactly K attempts are needed is, (1 L)L K-1 . The expected number of transmissions per frame is 1/(1 L) and retransmissions is R = L/(1-L). Using this value of R, one arrives at channel utilization D U = (L/(1 L)) (F + CT) + (F + A + 2CI) If the receivers time has a low variance, the sender adjusts its time just above the time required for the acknowledgement to arrive T = A/C +2I approximately. The channel efficiency then becomes, D U = H+D x (1 - P1) (1 - P2) x 1 + CT/(H + D) 1

The first factor represents the loss due to header overhead. The second due to errors and the third due to stop-and-wait. Each bit has a probability E of being in error, independent of its predecessors and successors is assumed. With this assumption and A = H the channel utilization is given by the formula, D Page 40 1

Computer Networks
U = H+D x (1 - E) H+D (1 - E)H x 1 + CT/(H + D)

The frame size must neither be too short nor too long. So, the optimum frame size is chosen depending on the header size, error rate, raw bandwidth and timeout interval. By taking the partial derivative of U with respect to D and set it to zero, H + CT D2 + D(H + CT) + ln(1 E) with solution, H + CT Dopt = 2 If E is very small =0

1 4 /[H + CT) ln(1 E)] - 1

Dopt (H + CT)/E The telephone systems actual measurement shows that the errors are not random but in burst. So, P1 = 1 (1 E)H + D is not accurate. P1 =K(H = D) provides a better fit. For the protocol with Go Back n, the efficiency can also be determined by assuming that piggybacked acknowledgements are free. The total bandwidth occupied is, H + D + R[W(H + D) + CT]. The channel efficiency then becomes, D U = H + D + R[W(H + D) + CT] Performance of Sliding Window Protocol Certain assumptions are made to begin with: the acknowledgements are piggybacked onto reverse traffic, interrupt-processing time is negligible, so I is equal to the one-way propagation time T. There are two cases to consider when considering an error free channel. If the window is large enough, the sender can just keep going full speed because the acknowledgements get back before the senders window fills up. The frame transmission time is F/C, so the sender may continue for a time WF/C at which point it must stop if the first frame has not yet been acknowledged. The first acknowledgement can come back 2I after the first frame has been transmitted so the acknowledgement arrives at F/C + 2I. The transmitter will be able to run continuously if WF/C F/C + 2I. This can be solved for W giving: Case 1: W 1 + 2CI/F (large window, no errors) D U= H+D

Page 41

Computer Networks
The channel runs at full speed, with the header bits being the only overhead. If the window is small, the sender will have to stop at some point and wait for the first acknowledgement. Then it may send one more frame, at which time the next acknowledgement arrives and so on. Each cycle takes F/C + 2I and is good for W frames or WD data bits. Thus U = WD/ (F + 2CI) where the denominator represents the amount of bandwidth used by each cycle. Simplifications leads to Case 2: W < 1 2CI/F (small window, no errors) D U= H+D x 1 + 2CI/(H + D) W

Considering the effect of errors, the performances are different due to the number of transmissions. In the large window case, transmission is still continuous, except that now extra frames must be sent to correct damaged frames. The expected number of transmissions per frame is 1/(1 L), so to receive W frames without error, W/(1 l) of them must be transmitted. This implies, Case 3: W 1 + 2CI/F (large window, with errors) D U= H+D Similarly with a small window the efficiency also drops by the same factor due to retransmissions, this results in, Case 4: W < 1 = 2CI/F (small window, with errors) D U= H+D 2.2.4 Protocol Specifications and Verification Protocols and the programs that implement them are quite complicated. Following are some popular protocol specifying and verifying models and techniques. Finite State Machine Models In this technique, each protocol machine (i.e., sender or receiver) is always in a specific state at every instant of time. Its state consists of all the values of its variables, including the program counter. x (1 L) x 1 + 2CI/(H + D) W x (1 L)

Page 42

Computer Networks
A large number of states can be grouped together for purposes of analysis. For example, considering the receiver in protocol 3, one could abstract out from all the possible states two important ones: waiting for frame 0 or waiting for frame 1. All other states can be thought of as transient, just steps on the way to one of the main states. Typically, the states are chosen to be those instants that the protocol machine is waiting for the next event to happen. At this point the state of the protocol machine is completely determined by the states of its variables. The number of states is then 2n, where n is the number of bits needed to represent all the variables combined. The state of the complete system is the combination of all the state of the two protocol machines and the channel. The state of the channel is determined by its contents. The channel has four possible states: a zero frame or a one frame moving from sender to receiver, an acknowledgement frame going the other way, or an empty channel. If one models the sender and receiver as each having two states, the complete system has 16 distinct states. By saying a frame being on the channel, what one really means is that a frame has been partially transmitted, partially received, but not yet processed at the destination. A frame remains on the channel until the protocol machine executes from the Physical Layer and processes it. From each state, there are zero or more possible transitions to other states. Transitions occur when some event happens. For a protocol machine a transition might occur when a frame is sent, when a frame arrives, when a timer goes off, when an interrupt occurs, etc. For the channel, typical events are insertion of a new frame onto the channel by a protocol machine, delivery of a frame to a protocol machine, or loss of a frame due to a noise burst. When the complete description of the protocol machine and the channel characteristics is available, it is possible to draw a directed graph showing all the states as nodes and all the transitions as directed arcs. One particular state is designated as the initial state. This state corresponds to the description of the system when it starts running, or some convenient starting place shortly afterwards. From the initial state all the other states can be reached by a sequence of transitions. It is possible to determine which states are reachable and which are not using graph theory. This technique is called reachability analysis. This analysis can be helpful in determining if a protocol is correct or not. A finite state machine model of a protocol can be regarded as a quadruple: (S,M,I,T), where ; S is the set of states the processes and channel can be in. M is the set of frames that can be exchanged over the cannel. I is the set of initial states of the processes. T is the set of transitions between states. At the beginning of time, all processes are in their initial states. Then events begin to happen, such as frames becoming available for transmission or timers going off. Each event may cause one of the processes or the channel to take an action and switch to a new state. By carefully enumerating each possible successor to each state, one can

Page 43

Computer Networks
build the rechability graph and analyze the protocol. Reachability analysis can be used to detect a variety of errors in the protocol specification. As an example of the finite state machine model, consider the figure 2.5.

(a) Transition 0 1 2 3 4 5 6 7 8 who Frame runs? accepted R S R S R R S S 0 A 1 A 0 1 (Timeout) (Timeout) (b) Figure 2.5: (a) State diagram of the Protocols (b) Transitions Each protocol machine has two states and the channel has four states. Each state is labeled by three characters, XYZ, where X is 0 or 1, corresponding to the frame the sender is trying to send; Y is also 0 or 1, corresponding to the frame the receiver expects, and Z is 0,1,A or empty (--), corresponding to the state of the channel. Here the initial state has been chosen as (000). The sender has just sent frame 0, the receiver expects frame 0, and frame 0 is currently on the channel. Transition 0 consists of the channel losing its contents. Transition 1 consists of the channel correctly delivering packet 0 to the receiver, with the receiver then changing its state to expect frame 1 and emitting an acknowledgement. Transition 1 also corresponds to the receiver-delivering packet 0 to the network layer. The other transitions are listed in table below: Transitions for the Protocol Transition Who runs? Frame accepted Page 44 Frame emitted To network layer Frame emitted A 1 A 0 A A 0 1 To network layer Yes Yes No No -

(Frame lost)

Computer Networks

0 1 2 3 4 5 6 7 8

R S R S R R S s

(frame lost) 0 A 1 A 0 1 (timeout) (timeout) A 1 A 0 A A 0 1

YES YES NO NO -

The arrival of a frame with a checksum error does not change the state. During normal operation, transitions 1,2,3, and 5 are repeated in order over and over. In each cycle, two packets are delivered, bringing the sender back to the initial state of trying to send a new frame with sequence number 0. If the channel loses frame 0, it makes a transition from state (000) to state (00-). The sender times out (transition 7) and the system moves back to (000). The loss of an acknowledgement is more complicated, requiring two transitions, 7 and 5, or 8 and 6, to repair the damage. The following table gives a simplified version of the 802.5 token ring protocol, which is fully specified in the standard as a finite state machine. A simplified finite state machine for IEEE 802.5
Current Event State Number Event/Action New State

1 1 1 1 2 2 3 3 4 4

1 2 3 4 5 6 7 8 9 10

Frame available and token captured Frame error/Set E=1 Destination = MA / Set A = 1 Frame copied/Set C=1 Error (e.g. control frame seen)/Put token End of frame transmission Frame header comes around Timer expires/Put token on ring Frame drained/Put token on ring Timer expires/Put on ring

2 1 1 1 1 3 4 1 1 1

In this model the station can be of the four states: 1. 2. 3. 4. In repeat mode, copying bits (i.e., not transmitting) Transmitting a frame Waiting for the newly transmitted frame to come around Draining the frame from the ring

In each state one or more events are possible. Some of the events trigger actions like setting bits in the frame passing through the station in addition to possible state changes. A brief description of the ten possible events follows: 1. The station has a frame to send and has captured the token. Page 45

Computer Networks
2. An error has been detected on a frame being copied. 3. The frame is directed to the station (My Address, station busy). 4. The frame can be copied to the station (MY Address, station idle). 5. Error detected after token capture (e.g., claim token frame seen). 6. The frame has been fully transmitted. 7. The header of the transmitted frame has circumnavigated the ring. 8. The frame just transmitted has apparently been lost. 9. The entire frame just transmitted has been removed from the ring. 10. The end-to-frame sequence has apparently been damaged. The Estelle Protocol Specification Language The main problem with finite state machines is that with any realistic protocol the number of states required is immense. This observation has led to the idea of extended state machines, in which states can have variables. An Estelle (Extended State Transition Language) specification is a collection of modules (typically one for each process being modeled) and channels over which the modules exchange frames. Each module contains of collection of transition rules. Each transition rule belongs to a specific state and tells what events trigger the transition, what actions are performed when the transition is triggered, and what state the process moves to after the event. The following are the transition specification in Estelle trans from state_1 to state_2 when event provided predicate priority expression begin . end. {current state} {new state} {some even occurs} {some Boolean condition holds} {priority of this transition} {actions to take}

The Estelle programmer can define protocol states and give them symbolic names. These names appear in the from and to clauses of the transition. When the process is in state State _ 1, the transition described can occur. Otherwise it cannot occur. The when clause tells what event triggers the transition. Often this will be the arrival of a certain frame. The provided clause allows the programmer to specify a Boolean condition of the process state variables that must hold in order for the transition to happen. The priority clause makes it possible to assign priorities to transitions. When the transition is triggered, the body of the transition is carried out. A module consists of a set of definitions for data types, variables, auxiliary procedures, and a list of transitions. An Estelle specification is composed of one or more modules and channel definitions. Channel definitions provide a way to specify the external behavior of modules at interaction points. Mechanisms are provided to attach modules to channels. Petri Net Models Page 46

Computer Networks
A Petri net has four basic elements: places, transitions, arcs, and tokens. A place represents a state which (part of) the system may be in. Figure 2.6(a) shows a Petri net with two places, A and B, both shown as circles. The system is currently in state A, indicated by the token (heavy dot) in place A. A horizontal or vertical bar indicates a transition. Each transition has zero or more input arcs, coming from its input places, and zero or more output arcs, going to its places. A transition is enabled if there is at least one input token in each of its input places. Any enabled transition may fire at will, removing one token from each input place and depositing a token in each output place. If the number of input arcs and output arcs differ, tokens will not be conserved. If two or more transitions are enabled, one

Figure 2.6: (a) Petri Net with two places and two transitions of them may fire. The choice of a transition to fire is indeterminate, which is why Petri nets are useful for modeling protocols. The Petri Net Model of Figure 2.6(a) is deterministic, and can be used to model any two-phase process.

Figure 2.6: (b) A Petri Net Model In figure 2.6(b), unlike the finite state machine model, there are no composite states here; the senders state, channel state, and receivers state are represented separately. Transitions 1 and 2 correspond to transmission of frame 0 by the sender, normally, and on a timeout respectively. Transitions 3 and 4 are analogous for frame 1. Transitions 5, 6, and 7 correspond to the loss of frame 0, an acknowledgement, and frame 1, respectively. Transitions 8 and 9 occur when a data frame with the wrong sequence number arrives at the receiver. Transitions 10 and 11 represent the arrival at the receiver

Page 47

Computer Networks
of the next frame in sequence and its delivery to the network layer. Petri nets can be used to detect protocol failures. 2.2.5 Polling / Selection Protocol With only one O/P line, all terminals might try to send data at once. Polling is a technique that solves this problem. This technique requires each terminal to keep quiet until the controller gives Go ahead signal. Polling / selection systems revolve around two commands poll and select. The purpose of poll command is to transmit data to the primary site and the select command transmits data from the primary site to the secondary site. 2.2.6 Binary Synchronous Control (BSC) This protocol supports multiunit and point to point configuration as well as switched & non-switched channels and is wisely used for following remote terminals BSC is a half-duplex protocol. Transmissions are provided two ways, alternately. BSC is a code-sensitive protocol, and every character transmitted across a BSC channel must be decoded at the receiver to see if it is either a control character or end-user data. The control codes have several functions, which depend on the particular line mode at a given moment. Since BSC is a character-oriented protocol, it has a problem in distinguishing user data fields from control fields. It is possible that the user application process could create a code recognized as BSC control. BSC addresses the problem with the DLE control code. This code is placed in front of the control codes STX, ETX, ETB, ITB, and SOH to identify these characters as valid line control characters. The simplest means to achieve code transparency is the use of DLE.STX or DLE.SOH to signify the beginning of noncontrol data (user data) and DLE.ETX, DLE.ETB, or DLE.ITB to signify the end of user data. If bit patterns resembling any of these control characters are created in the user text, the receiving station assumes they are valid user data, because the DLE does not precede them. BSC Message Formats and Control Codes BISYNC supports three character sets: ASCII, EBCDIC, and IBMs 6-bit Transcode. The BISYNC message format is shown in figure 2.7. The contents of the header field are up to the network; they are not defined by the protocol. ETB is used to terminate a block when there are more blocks to follow. ETX is used to terminate the last block. Addressing of terminals on a multidrop line is not done in the header, but by a separate control message. SYN SYN SOH Header STX Data ETB Or ETX Checksum

Page 48

Computer Networks

Figure 2.7: BISYNC Message Format BSC Formats and Control Codes Character SYN PAD DEL ENQ SOH STX ITB ETB ETX EOT BCC Functions Synchronous idle (keeps channel active) Frame pad (time fill between transmissions) Data link escape (used to achieve code transparency Enquiry (used with polls/selects and bids) Start of heading Start of text (puts line in text mode) End of intermediate block End of transmission block End of text End of transmission (puts line in control mode) Block check count

When ASCII code is used, the party bit is set and the checksum is simply a vertical party check. With EBCDIC or 6-bit Transcode, the individual characters are not parity-checked. BSC is a half-duplex protocol. Transmissions are provided two ways, alternately. BSC is a code-sensitive protocol, and every character transmitted across a BSC channel must be decoded at the receiver to see if it is either a control character or end-user data. The control codes have several functions which depend on the particular line mode at a given moment. Since BSC is a character-oriented protocol, it has a problem in distinguishing user data fields from control fields. It is possible that the user application process could create a code recognized as BSC control. BSC addresses the problem with the DLE control code. This code is placed in front of the control codes STX, ETX, ETB, ITB, and SOH to identify these characters as valid line control characters. The simplest means to achieve code transparency is the use of DLE.STX or DLE.SOH to signify the beginning of noncontrol data (user data) and DLE.ETX, DLE.ETB, or DLE.ITB to signify the end of user data. If bit patterns resembling any of these control characters are created in the user text the receiving station assumes they are valid user data, because the DLE does not precede them. The DLE places the line into a transparent text mode, which allows the transmission of any bit pattern. This capability is important when BSC is used on different types of application. The DLE presents a special problem if it is generated by the end-user application process, since it could be recognized as a control code. BSC handles this situation by inserting a DLE next to a data DLE character. The receiver discards the first DLE of two successive DLEs and accepts the second DLE as valid user data. Line Modes Page 49

Computer Networks
The BSC channel or link operates in one of two modes. The control mode is used by a master station to control the operations on the link, such as the transmission of polling and selection frames. The message of text mode is used for the transmission of an information block or blocks to and from the stations. Upon receiving an invitation to send data (a poll), the slave station transmits user data with either an STX or SOH in front of the data or heading. These control characters place the channel in the message or text mode. Thereafter, data are exchanged under the text mode until an EOT is received, which changes the mode back to control. During the time the channel is in text mode, it is dedicated to the exchange of data between two stations only. All other stations must remain passive. The two-station text mode is also called the select-hold mode. The polls and selects are initiated by a frame with the contents: Address.ENQ (where address is the address of the station). The control station is responsible for sending polls and selects. A select performs one of the two functions: 1. it places the selected station into a slave mode and 2. it places all other stations (on a multipoint channel) into passive mode. The STX or STH initiates the passive state. The selected station maintains the slave mode condition until it receives an EOT, ETB or ETX. The passive stations maintain the passive mode condition until they receive an EOT. BSC also provides for contention operation on a point-to-point circuit. The ENQ code plays an important role in BSC control modes. Its functions are: Poll. Control station sends with an address prefix. Select Control station sends with an address prefix. Bid Point-to-point stations send to contend for control stations status. The lower-case code of a station address is used to indicate a select, and the upper case is used to indicate a poll. Line Control The transmitting station knows the order of frames it transmits, and it expects to receive ACKs to its transmissions. The receiving site transmits the ACKs with sequence numbers. Only two numbers are used, a 0 and a 1. This sequencing technique is sufficient, since the channel is inherently half duplex and only one frame can be outstanding at one time. An ACK0 indicates the correct receipt of even-numbered frames; and ACK1 indicates the receipt of odd-numbered frames. BSC uses several other line control codes: ACK0 ACK1 WACK Positive acknowledgement to even-sequenced blocks of data or a response to a select or bid. Positive acknowledgement to odd-sequenced blocks of data. (Wait Before Transmit Positive Acknowledgement) Receiving station temporarily unable to continue processing or receive transmissions.

Page 50

Computer Networks
Signifies a line reversal. Also used as a positive acknowledgement of a transmission. Station will continue to send WACK until it is ready to receive. RVI DISC TTD (Reverse Interrupt) Indicates station has data to send at the earliest opportunity. This causes an interrupt of the transmission process. For switched lines, forces a disconnection. (Temporary Text Delay) Indicates sending DTE cannot send data immediately, but wishes to maintain control of line.

2.2.7 High-Level Data Link Control (HDLC) HDLC is a standard published by ISO. It is a bit-oriented protocol. The several options of HDLC make it more of a hybrid type. HDLC Frame Structure The frame structure for all the bit-oriented protocol is shown in figure 2.8. Bits 8 0111110 8 Address 8 Control >8 Data or Information 16 Checksum 8 01111110

Figure 2.8: Frame format for bit-oriented protocols The Address field is used to identify one of the terminals and to distinguish commands from responses. The Control field is used for sequence numbers, acknowledgements, and other purposes. The Data field may contain arbitrary information. The Checksum field allows lost flag bytes to be detected. The address field identifies the primary or secondary station involved in the particular frame transmission. The control field contains the command and responses as well as the sequence numbers used to maintain the data-flow accountability of the link between the primary and secondary station. The information or data field contains the actual user data. The frame check-sequence field (FCS) or checksum field is used to check for transmission errors between the two data-link stations. Three types of frames are used. The information format frame is used to transmit end-user data between the two devices. The information frame may also acknowledge receipt of data from a transmitting station. It can perform certain limited functions, such as a poll command. The supervisory format frame performs control functions such as the acknowledgement of frames, the request for the retransmission of frames, and the

Page 51

Computer Networks
request for the temporary suspension of the transmission of frames. Supervisory frame is dependent on the operational mode of the link. The unnumbered format frame is also used for control purposes. The frame is used to perform link initialization on link disconnection and other link control functions. The frame contains five bit positions, which allows for a definition up to 32 commands and 32 responses. The contents of the control field for these kinds are shown in figure 2.9. Bits 1 0 3 Seq 1 P/F 3 Next (a) (b) (c)

1 1

0 1

Type Type

P/F P/F

Next Modifier

Figure 2.9: Control field of (a) an information frame (b) a supervisory frame (c) an unnumbered frame 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 figure 2.9 (a) is the frame sequence number. The Next field is a piggybacked acknowledgement. The P/F bit stands for a Poll/Final. It is used when a computer 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. HDLC Options HDLC provides for a number of options in its implementation. It supports both half-duplex and full-duplex transmission, point-to-point and multipoint configurations, as well as switched or nonswitched channels. An HDLC station is classified as one of three types: The primary station is in control of the data link (channel). This station transmits command frames to the secondary stations on the channel. In turn, it receives response frames from those stations. The secondary station acts as a slave to the primary station. It responds to the commands from the primary station in the form of responses. It maintains only one session, that being with the primary station. It has no responsibility for control of the link. The combined station transmits both commands and responses and receives both commands and responses from another combined station. It maintains a session with one other combined station. Page 52

Computer Networks
Stations communicate with each other through one of these logical states: The Logically Disconnected State (LDS) prohibits a station from transmitting or receiving information. If the secondary station is under a normal disconnected mode, it can transmit a frame only after receiving explicit permission from the primary station to do so. If the station is under an asynchronous disconnected mode, the secondary station may initiate a transmission without receiving explicit permission to do so, but the frame must be a single frame, indicating the secondary station status. The Initialization State (IS) is defined by specific vendors and is outside the standards of HDLC. The Information Transfer State (ITS) permits the secondary, primary, and combined stations to transmit and receive user information. The information transfer state can be changed by the issuance of disconnect commands. While the stations are in an information transfer state, they are allowed to communicate in one of three modes of operation. Normal Response Mode (NRM) requires the secondary station to receive explicit permission from the primary station before transmitting. After receiving permission, the secondary station initiates a response transmission, which may contain data. The transmission may consist of one or more frames while the secondary station is using the channel. After the last frame transmission, the secondary station must again await explicit permission before it can transmit again. Asynchronous Response Mode (ARM) allows a secondary station to initiate transmissions without receiving explicit permission from the primary station (usually when the channel is idle). The transmission may contain single or multiple frames of data, or it may contain control information reflecting status changes of the secondary station. ARM can decrease overhead because the secondary station does not need a poll sequence in order to send data. Asynchronous balanced mode (ABM) uses combined stations. The combined station may initiate transmissions without receiving prior permission from the other combined station. HDLC provides for three ways of configuring the channel for primary, secondary and combined station use. An unbalanced configuration provides for one primary station and one or more secondary stations to operate as point-to-point or multipoint, half-duplex or full duplex, or switched or nonswitched. The configuration is called unbalanced because the primary station is responsible for controlling each secondary station and for establishing the mode-setting commands. The Symmetrical configuration provides for two independent, point-to-point unbalanced station configurations. Each station has a primary and secondary status, and therefore each station is considered logically to be two stations: a primary and a secondary station. The primary station transmits commands to the secondary station at the other end of the channel and vice versa.

Page 53

Computer Networks
A balanced configuration consists of two combined stations connected by pointto-point only, half-duplex or full duplex, switched or nonswitched. The combined stations have equal status on the channel and may send unsolicited traffic to each other. Each station has equal responsibility for link control. HDLC Control Fields Control field determines how HDLC controls the communication process. The control field defines the function of the frame, and therefore invokes the procedures to control the movement of the traffic between the receiving and sending stations. The control field identifies the commands and responses used to control the traffic flow on the link. The actual format of the control field (information, supervisory, or unnumbered) determines how the field is coded and used. The simplest format is the information format. The information frame control field contains two sequence numbers. The N(S) (send sequence) number indicates the sequence number, and indicates the next sequence number that is expected at the receiving site. The N(R) serves as an acknowledgement of the previous frames. For example, if the N(R) field was set to 4, the station, upon receiving N(R) = 4, would understand that its transmissions of frames 0,1,2, and 3 had been received correctly, and that the station with which it is communicating is expecting the next frame to have a send sequence number of 4 in it. The N(R) field provides for inclusive acknowledgement; that is, the N(R) of 4 could inclusively acknowledge more than one message that had preceded it. The concept of send [V(S)] and receive state [V(R)] variables are used with the HDLC N(S) and N(R) fields. The fifth-bit position, the P/F or poll/final is recognized only when set to 1 and is used by the primary and secondary stations to provide the following functions: The primary station uses the P bit to solicit a status response from a secondary station. The P bit also can signify a poll. The secondary station responds to a P bit with data or a status frame and on F bit. The F bit also can signify the end of the transmission from the secondary station under normal response mode (NRM). The P/F bit is termed the P bit when used by the primary station and F bit when used by the secondary. Only one P bit should be outstanding at any time on the link. A P bit set to 1 can be used as a checkpoint. The P/F bit is used and interpreted in several ways. Commands and Responses HDLC Commands / Responses
Control Field Bit Encoding
Format Information Supervisory 1 2 3 4 5 6 7 8 Commands I-Information RR-Receive Ready REJ-Reject RNR-Receive Not Ready SREJ-Selective Reject Responses I-Information RR-Receive Ready REJ-Reject RNJ-Receive Not Ready SREJ-Selective Reject 0 __N(S)__ * ___N(S)___ 1 1 1 1 0 0 0 0 0 0 1 1 0 1 0 1 * ___N(R)___ * ___N(R)___ * ___N(R)___ * ___N(R)___

Page 54

Computer Networks
Unnumbered 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 * 0 * 0 * 0 * 0 * 0 * 0 * 0 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 0 0 0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 1 0 1 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 UI_Unnumbered Information UI_Unnumbered Information SNRM-Set Normal Response Mode DISC_Disconnect RD-Request Disconnect UP-Unnumbered Poll UA-Unnumbered Acknowledge Test Test SIM-Set Initialization Mode RIM-Request Initialization Mode FRMR-Frame Reject SARM-Set ARM DM-Disconnect Mode RSET-Reset SARME-Set ARM Extended SNRME-Set NRM Extended SABM-Set SABM XID-Exchange Identification XID-Exchange Identification SABME-Set ABM Extended

The supervisory format provides four of the commands and responses. These are: Receive Ready (RR) Reject (REJ) Receive Not Ready (RNR) Selective Reject (SREJ)

The purpose of this format and the four commands and responses is to perform numbered supervisory functions, such as acknowledgement polling, temporary suspension of data transfer, and error recovery. Supervisory format frames do not contain an information field. The supervisory format can be used to acknowledge the receipt of frames from the transmitting station. The commands and responses used by the supervisory format include the following: Receive Ready (RR), used by the primary or secondary station to indicate that it is ready to receive an information frame and/or acknowledge previously received frames by using the N(R) field. If the station has indicated that it was previously busy by using a Receive Not Ready command, it then uses the Receive Ready command to indicate it is now free to receive data. The primary station may also use the Receive Ready command to poll a secondary station. Receive Not Ready (RNR) is used by the station to indicate a busy condition. This tells the transmitting station that the receiving station is unable to accept additional incoming data. The (RNR) frame may acknowledge previously transmitted frames by using the N(R) field. Sending the RR frame, as well as several other frames can clear the busy condition. A station to request the retransmission of a single frame that is established in the N(R) field uses selective Reject (SREJ). All information frames numbered up to N(R) are acknowledged. Selective Reject provides the selective repeat capability. Once the SREJ has been transmitted, subsequent frames are accepted and held for the retransmitted frame. Reject (REJ) is used to request the retransmission of frames starting with the frame numbered in the N(R) field. Frames numbered N(R) 1 are all acknowledged. The REJ frame can be used to implement the Reject Technique.

Page 55

Computer Networks
The unnumbered format provides for unnumbered commands and responses. This format is used to send the majority of the command and response indicators. Unnumbered commands are further grouped by the function performed: Mode-setting commands: SNRM, SABM, SNRME, SARME, SABME, SIM, DISC (SNRME, SARME, SARME for extended addressing) Information transfer commands: UI, UP Recovery commands: RESET Miscellaneous commands: XID, TEST. The commands and responses for the unnumbered formats are: UI (Unnumbered Information): This command allows for transmission of user data in an unnumbered (i.e., unsequenced) frame. RIM (Request Initialization Mode): The RIM frame is a request from a secondary station to a primary station for an SIM command. SIM (Set Initialization Mode): This command is used to initialize the primary/secondary session. UA is the expected response. SNRM (Set Normal Response Mode): This places the secondary station in a NRM (Normal response mode). The NRM preludes the secondary station from sending any unsolicited frames. This means the primary station controls all message flow on the line. DM (Disconnect Mode): This frame is transmitted from a secondary station to indicate that it is in the disconnect mode (in-operational). DISC (Disconnect): This command from the primary station places the secondary station in the disconnected mode. This command is valuable for switched lines. UA is the expected response. UA (Unnumbered acknowledgement): This is an ACK to set mode commands and SIM, DISC, RESET. UA is also used to report the end of a station-busycondition. FRMR (Frame Reject): The secondary station sends this frame when it encounters an invalid frame. This is not used for a bit error indicated in the frame checksequence field, but for more unusual conditions. The information field contains the reason. RD (Request Disconnect): This is a request from a secondary station to be disconnected and placed in a logically disconnected state. XID (Exchange Station Identification): This command asks for the identification of a secondary station. It is useful on switched facilities to identify the calling station. UP (Unnumbered Polls): This is used in loop configurations.

Page 56

Computer Networks
TEST (Test): This frame is used to solicit testing responses from the secondary station. ARM (Set Asynchronous Response Mode): Sets mode to allow secondary station to transmit without a poll from the primary station. It places the secondary station in the information transfer state (IS) of ARM. Since SARM establishes two unbalanced stations, SARM must be issued in both directions on the link. SABM (Set Asynchronous Balanced Mode): Sets mode to SABM, in which stations are peers with each other. No polls required to transmit, since each station is a combined station. SNRME (Set Asynchronous Balanced Mode Extended): Sets SABM with two more bytes in the control field. UP (Unnumbered Poll): Polls a station without regard to sequencing or acknowledgement. Response is optional of poll bit I set to 0. Provides for one response opportunity. RSET (Reset): Transmitting station resets its N(S) and receiving station resets its N(R). The command is used for recovery. HDLC also utilizes the timeout (T1 timer) which is started with the transmission of every frame. T1 is used to initiate a retransmission if it expires. Also the N2 counter determines the maximum number of transmissions to be performed upon the expiration of T1. 2.2.8 Synchronous Data Link Control (SDLC) SDLC uses the unbalanced normal response mode. It also uses several options of HDLC. SDLC consists of several commands which are not found in the HDLC standard. These commands and responses provide the ability to establish a loop topology and perform loop or ring polling operations. SDLC provides support for point-to-point, multipoint, or loop configurations. The specific differences between SDLC and HDLC are as follows: HDLC provides an option to extend the 8-bit address field by the use of extended bytes. The purpose is to address more terminals or more groups of terminals and devices in computers. SDLC implementations support only a single-byte address field. HDLC permits the control field to be extended, a well. Under the extendedformat option, HDLC system may have the control field extended to 16 bits. This provides for extended sequence numbers for the N(R) and N(S) fields. IBM supports only the basic 8-bit format. This becomes an important consideration when using satellite links. SDLC implementations restrict the information field to an even integral number of bytes. HDLC does not have this restriction.

Page 57

Computer Networks
IBMs SDLC provides some additional commands and responses for loop operations.

2.3

Revision Points

Flow Control Flow-control mechanisms are designed to control the flow of data between sender and receiver so that the receivers buffers do not overflow. If overflow occurs, frames or packets will be lost. Flow controls are used in the data link layer to control flow on pointto-point links and in the transport layer to control end-to-end flow on a routed network. Stop and Wait Protocol The simplest flow control is called stop and wait. It uses ACKs (acknowledgments). First, the sender transmits a frame to the destination. The destination then returns an acknowledgment frame to the receiver, indicating that it is ready to receive data. This technique is useful if information can be sent in just a few frames. Sliding Window Protocol The sliding-window technique basically lets the sender transmit multiple frames at a time to utilize the transmission channel as much as possible. The purpose of the slidingwindow flow control is to efficiently use the network bandwidth that is wasted in the stop-and-wait technique when the sender waits for an acknowledgment. High Level Data Link Control HDLC is a bit-oriented, link layer protocol for the transmission of data over synchronous networks and is defined by the ISO. HDLC is bit-oriented, meaning that the data is monitored bit by bit. Synchronous Data Link Control Synchronous Data Link Control (SDLC) is an IBM-defined Data Link Control protocol for communication over wide area links to IBM host systems in Systems Network Architecture (SNA) environments. SDLC is based on synchronous, bit-oriented operations as compared to byte-oriented protocols such as Binary Synchronous Communications (BISYNC).

2.4

Intext Questions
1. Discuss in detail about Simplex stop and wait protocol. 2. Write a brief note on sliding window protocols. 3. Compare the performance of stop and wait protocol and sliding window protocol. 4. Write short notes on Binary Synchronous Control. 5. Write a brief note on HDLC.

2.5

Summary

Page 58

Computer Networks
A computer network consists of a wide variety of communications protocols. Protocols describe the procedures and logic used for data exchange between DTEs or end user machines. Protocols in which the sender sends one frame and then waits for an acknowledgement before proceeding are called stop-and-wait protocol. The Sliding Window mechanism is widely used to integrate error control and flow control in a convenient way. Sliding window protocols can be categorized by the size of the senders window and the size of the receivers window. When both are equal to 1, the protocol is stop-and-wait. When the senders window is greater than 1, for example to prevent the sender from blocking on a circuit with a long propagation delay, the receiver can be programmed either to discard all frames other than the next one in sequence (protocol using go back n) or buffer outof-order frames until they are needed (protocol using selective repeat). Protocols can be analyzed for a variety of properties, for example performance and correctness. Popular models for protocol specification and verification are Finite State Models, Estelle Protocol Specification Language and Petri Net Models. BSC is a character-oriented code sensitive protocol. It supports multipoint and point-to-point configurations. It is widely used for polling remote terminals. Many networks use bit-oriented protocols like HDLC, SDLC. All of these protocols use flag bytes to delimit frames, and bit stuffing to prevent flag bytes from occurring in the data. All of them also use a sliding window for flow control. HDLC is a standard published by ISO. It provides for many functions and covers a wide range of applications. It is a bit-oriented protocol and the various options it provides make it more of a hybrid type. SDLC is IBMs version of HDLC. It used unbalanced normal response mode. SDLC, a bit-oriented protocol provides support for point-to-point, multipoint or loop configurations.

2.6

Terminal Exercises
1. In sliding window flow control, the frames to the left of the receiver window are the frames __________ 2. Regulation of the rate of transmission of data frames is known as __________ 3. Poll/select line discipline requires____________ to identify packet recipient. 4. BSC stands for ___________________

Page 59

Computer Networks
5. The HDLC __________ field defines the beginning and end of frame.

2.7

Supplementary Materials
1. Andrew S.Tannenbaum, Computer Networks, 4th Edition, Pearson Education. 2. Behrouz A.Forouzan, Data Communication and Networking, Tata McGraw Hill Edition. 3. William Stallings, Data and Computer Communications, Pearson Education.

2.8

Assignments
1. In stop and wait protocol, define and discuss the handling of a. A damaged frame b. A lost frame 2. A sliding window protocol uses a window of size 15. How many bits are needed to define the sequence number? 3. Which sliding window ARQ is more popular? Why?

2.9

Suggested Reading/Reference Books/Set Books


1. http://www.linktionary.com/H 2. http://www.internic.net/rfc/rfc793.txt 3. http://www.ncsa.uiuc.edu/People/vwelch/net_perf/tcp_windows.html

2.10 Learning Activities


Collect research reports and information on Datalink Protocols in the Internet and in Networking Journals.

2.11 Keywords
Stop and wait protocol Sliding Window protocol Binary Synchronous Control (BSC)

Page 60

Computer Networks
High Level Data Link Control (HDLC) Synchronous Data Link Control (SDLC)

Page 61

You might also like