Sunteți pe pagina 1din 34

3

THE DATA LINK LAYER

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

Host 1

Host 2

Host 1

Host 2

3 Virtual data path

2 1

2 1

2 1 Actual data path

2 1

(a)

(b)

Fig. 3-1. (a) Virtual communication. (b) Actual communication.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

Router

Data link layer process

Routing process

2 Frames Packets here here

2 Data link protocol

Transmission line to a router

Fig. 3-2. Placement of the data link protocol.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

Character count

One character

(a) 5

3 4

Frame 1 5 characters

Frame 2 5 characters Error

Frame 3 8 characters

Frame 4 8 characters

(b) 5

4 5

Frame 1

Frame 2 (Wrong)

Now a character count

Fig. 3-3. A character stream. (a) Without errors. (b) With one error.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

DLE

STX

DLE

DLE

(a) DLE

STX

DLE

DLE

(b) Stuffed DLE DLE ETX

DLE

STX

DLE

(c)

Fig. 3-4. (a) Data sent by the network layer. (b) Data after being character stuffed by the data link layer. (c) Data passed to the network layer on the receiving side.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

ETX

DLE

ETX

(a) 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 (b) 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 0

(c) 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0

Fig. 3-5. Bit stuffing. (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in the receivers memory after destuffing.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

Stuffed bits

1996 Prentice Hall

Fig. 3-6. Use of a Hamming code to correct burst errors.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

c o d e

H a m m i n g
   

1001000 00110010000 10111001001 1100001 11101010101 1101101 11101010101 1101101 01101011001 1101001 01101010110 1101110 11111001111 1100111 10011000000 0100000 11111000011 1100011 00101011111 1101111 11111001100 1100100 00111000101 1100101 Order of bit transmission

Char.

ASCII

Check bits

Frame : 1101011011 Generator: 1 0 0 1 1 Message after appending 4 zero bits: 1 1 0 1 0 1 1 0 0 0 0 1 1 0 0 0 0 1 0 1 0 10011 1 1 0 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 0 0 0 0 1 1 1 0 Remainder

Transmitted frame: 1 1 0 1 0 1 1 0 1 1 1 1 1 0

Fig. 3-7. Calculation of the polynomial code checksum.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

#define MAX PKT 1024

/* determines packet size in bytes */

typedef enum {false, true} boolean; /* boolean type */ typedef unsigned int seq nr; /* sequence or ack numbers */ typedef struct {unsigned char data[MAX PKT];} packet;/* packet definition */ typedef enum {data, ack, nak} frame kind; /* frame kind definition */ typedef struct { frame kind kind; seq nr seq; seq nr ack; packet info; } frame; /* frames are transported in this layer */ /* what kind of a frame is it? */ /* sequence number */ /* acknowledgement number */ /* the network layer packet */

/* Wait for an event to happen; return its type in event. */ void wait for event(event type *event); /* Fetch a packet from the network layer for transmission on the channel. */ void from network layer(packet *p); /* Deliver information from an inbound frame to the network layer. */ void to network layer(packet *p); /* Go get an inbound frame from the physical layer and copy it to r. */ void from physical layer(frame *r); /* Pass the frame to the physical layer for transmission. */ void to physical layer(frame *s); /* Start the clock running and enable the timeout event. */ void start timer(seq nr k); /* Stop the clock and disable the timeout event. */ void stop timer(seq nr k); /* Start an auxiliary timer and enable the ack timeout event. */ void start ack timer(void); /* Stop the auxiliary timer and disable the ack timeout event. */ void stop ack timer(void); /* Allow the network layer to cause a network layer ready event. */ void enable network layer(void); /* Forbid the network layer from causing a network layer ready event. */ void disable network layer(void); /* Macro inc is expanded in-line: Increment k circularly. */ #define inc(k) if (k < MAX SEQ) k = k + 1; else k = 0
From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

Fig. 3-8. Some definitions needed in the protocols to follow.

 

/* Protocol 1 (utopia) provides for data transmission in one direction only, from sender to receiver. The communication channel is assumed to be error free, and the receiver is assumed to be able to process all the input infinitely fast. Consequently, the sender just sits in a loop pumping data out onto the line as fast as it can. */ typedef enum {frame arrival} event type; #include "protocol.h" void sender1(void) { frame s; packet buffer;

/* buffer for an outbound frame */ /* buffer for an outbound packet */

while (true) { from network layer(&buffer); /* go get something to send */ s.info = buffer; /* copy it into s for transmission */ to physical layer(&s); /* send it on its way */ } /* Tomorrow, and tomorrow, and tomorrow, Creeps in this petty pace from day to day To the last syllable of recorded time - Macbeth, V, v */

void receiver1(void) { frame r; event type event;

/* filled in by wait, but not used here */

while (true) { wait for event(&event); /* only possibility is frame arrival */ from physical layer(&r); /* go get the inbound frame */ to network layer(&r.info); /* pass the data to the network layer */ } }

Fig. 3-9. An unrestricted simplex protocol.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

 

 

/* Protocol 2 (stop-and-wait) also provides for a one-directional flow of data from sender to receiver. The communication channel is once again assumed to be error free, as in protocol 1. However, this time, 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. */ typedef enum {frame arrival} event type; #include "protocol.h" void sender2(void) { frame s; packet buffer; event type event;

/* buffer for an outbound frame */ /* buffer for an outbound packet */ /* frame arrival is the only possibility */

while (true) { from network layer(&buffer); /* go get something to send */ s.info = buffer; /* copy it into s for transmission */ to physical layer(&s); /* bye bye little frame */ wait for event(&event); /* do not proceed until given the go ahead */ } } void receiver2(void) { frame r, s; /* buffers for frames */ event type event; /* frame arrival is the only possibility */ while (true) { wait for event(&event); /* only possibility is frame arrival */ from physical layer(&r); /* go get the inbound frame */ to network layer(&r.info); /* pass the data to the network layer */ to physical layer(&s); /* send a dummy frame to awaken sender */ } }

Fig. 3-10. A simplex stop-and-wait protocol.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

 

 

/* Protocol 3 (par) allows unidirectional data flow over an unreliable channel. */ #define MAX SEQ 1 /* must be 1 for protocol 3 */ typedef enum {frame arrival, cksum err, timeout} event type; #include "protocol.h" void sender3(void) { seq nr next frame to send; frame s; packet buffer; event type event;

/* seq number of next outgoing frame */ /* scratch variable */ /* buffer for an outbound packet */

next frame to send = 0; /* initialize outbound sequence numbers */ from network layer(&buffer); /* fetch first packet */ while (true) { s.info = buffer; /* construct a frame for transmission */ s.seq = next frame to send; /* insert sequence number in frame */ to physical layer(&s); /* send it on its way */ start timer(s.seq); /* if (answer takes too long, time out */ wait for event(&event); /* frame arrival, cksum err, timeout */ if (event == frame arrival) { from physical layer(&s); /* get the acknowledgement */ if (s.ack == next frame to send) { from network layer(&buffer); /* get the next one to send */ inc(next frame to send); /* invert next frame to send */ } } } } void receiver3(void) { seq nr frame expected; frame r, s; event type event; frame expected = 0; while (true) { wait for event(&event); /* possibilities: frame arrival, cksum err */ if (event == frame arrival) { /* a valid frame has arrived. */ from physical layer(&r); /* go get the newly arrived frame */ if (r.seq == frame expected) { /* this is what we have been waiting for. */ to network layer(&r.info); /* pass the data to the network layer */ inc(frame expected); /* next time expect the other sequence nr */ } s.ack = 1 frame expected; /* tell which frame is being acked */ to physical layer(&s); /* none of the fields are used */ } } }

Fig. 3-11. A positive acknowledgement/retransmission protocol.


From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

 

 

 

Sender 6 5

0 1 2 6 5

0 1 2 6 5

0 1 2 6 5

0 1 2

Receiver 7 6 5 4 (a) 3 0 1 2 6 5 4 (b) 3 7 0 1 2 6 5 4 (c) 3 7 0 1 2 6 5 4 (d) 3 7 0 1 2

Fig. 3-12. A sliding window of size 1, with a 3-bit sequence number. (a) Initially. (b) After the first frame has been sent. (c) After the first frame has been received. (d) After the first acknowledgement has been received.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

/* Protocol 4 (sliding window) is bidirectional and is more robust than protocol 3. */ /* must be 1 for protocol 4 */ #define MAX SEQ 1 typedef enum {frame arrival, cksum err, timeout} event type; #include "protocol.h" void protocol4 (void) { seq nr next frame to send; /* 0 or 1 only */ seq nr frame expected; /* 0 or 1 only */ frame r, s; /* scratch variables */ packet buffer; /* current packet being sent */ event type event; next frame to send = 0; /* next frame on the outbound stream */ frame expected = 0; /* number of frame arriving frame expected */ from network layer(&buffer); /* fetch a packet from the network layer */ s.info = buffer; /* prepare to send the initial frame */ s.seq = next frame to send; /* insert sequence number into frame */ s.ack = 1 frame expected; /* piggybacked ack */ to physical layer(&s); /* transmit the frame */ /* start the timer running */ start timer(s.seq); while (true) { wait for event(&event); /* frame arrival, cksum err, or timeout */ if (event == frame arrival) { /* a frame has arrived undamaged. */ from physical layer(&r); /* go get it */ if (r.seq == frame expected) { /* Handle inbound frame stream. */ to network layer(&r.info); /* pass packet to network layer */ inc(frame expected); /* invert sequence number expected next */ } if (r.ack == next frame to send) { /* handle outbound frame stream. */ from network layer(&buffer); /* fetch new pkt from network layer */ inc(next frame to send); /* invert senders sequence number */ } } s.info = buffer; s.seq = next frame to send; s.ack = 1 frame expected; to physical layer(&s); start timer(s.seq); } } /* construct outbound frame */ /* insert sequence number into it */ /* seq number of last received frame */ /* transmit a frame */ /* start the timer running */

Fig. 3-13. A 1-bit sliding window protocol.


From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

A sends (0, 1, A0) B gets (0, 1, A0)* B sends (0, 0, B0)

B gets (1, 0, A1)* B sends (1, 1, B1) A gets (1, 1, B1)* A sends (0, 1, A2) B gets (0, 1, A2)* B sends (0, 0, B2) A gets (0, 0, B2)* A sends (1, 0, A3) B gets (1, 0, A3)* B sends (1, 1, B3)

(a)

Time

Fig. 3-14. Two scenarios for protocol 4. The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

A gets (0, 0, B0)* A sends (1, 0, A1)

! !

A sends (0, 1, A0)

B sends (0, 1, B0) B gets (0, 1, A0)* B sends (0, 0, B0)

A gets (0, 1, B0)* A sends (0, 0, A0) B gets (0, 0, A0) B sends (1, 0, B1) A gets (0, 0, B0) A sends (1, 0, A1) B gets (1, 0, A1)* B sends (1, 1, B1)

A gets (1, 0, B1)* A sends (1, 1, A1)

B gets (1, 1, A1) B sends (0, 1, B2)

(b)

1996 Prentice Hall

Timeout interval 0 1 2 3 4 5 6 7 8 2 3 4 5 6 7 8 9 10

k0

Ac k1

Ac

Ac

Ac

Ac

Ac

Ac

1 Error

Frames discarded by data link layer Time (a) Timeout interval

10

11

12

13

14

1 Error

10

Buffered by data link layer (b)

Packets 2-8 passed to network layer

Fig. 3-15. (a) Effect of an error when the receiver window size is 1. (b) Effect of an error when the receiver window size is large.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

"

Ac

"

"

Ac

Ac

Ac

Ac

Ac

Ac

Ac

Ac

Ac

k Ac

10

11

12

"

"

"

"

"

Ac

"

/* Protocol 5 (pipelining) allows multiple outstanding frames. The sender may transmit up to MAX SEQ frames without waiting for an ack. In addition, unlike the previous protocols, the network layer is not assumed to have a new packet all the time. Instead, the network layer causes a network layer ready event when there is a packet to send. */ #define MAX SEQ 7 /* should be 2n 1 */ typedef enum {frame arrival, cksum err, timeout, network layer ready} event type; #include "protocol.h" static boolean between(seq nr a, seq nr b, seq nr c) { /* Return true if (a <=b < c circularly; false otherwise. */ if (((a <= b) && (b < c)) || ((c < a) && (a <= b)) || ((b < c) && (c < a))) return(true); else return(false); } static void send data(seq nr frame nr, seq nr frame expected, packet buffer[]) { /* Construct and send a data frame. */ frame s; /* scratch variable */ s.info = buffer[frame nr]; s.seq = frame nr; s.ack = (frame expected + MAX to physical layer(&s); start timer(frame nr); } void protocol5(void) { seq nr next frame to send; seq nr ack expected; seq nr frame expected; frame r; packet buffer[MAX SEQ + 1]; seq nr nbuffered; seq nr i; event type event; enable network layer(); ack expected = 0; next frame to send = 0; frame expected = 0; nbuffered = 0; /* insert packet into frame */ /* insert sequence number into frame */ SEQ) % (MAX SEQ + 1);/* piggyback ack */ /* transmit the frame */ /* start the timer running */

/* MAX SEQ > 1; used for outbound stream */ /* oldest frame as yet unacknowledged */ /* next frame expected on inbound stream */ /* scratch variable */ /* buffers for the outbound stream */ /* # output buffers currently in use */ /* used to index into the buffer array */ /* allow network layer ready events */ /* next ack expected inbound */ /* next frame going out */ /* number of frame expected inbound */ /* initially no packets are buffered */

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

while (true) { wait for event(&event);

/* four possibilities: see event type above */

switch(event) { case network layer ready: /* the network layer has a packet to send */ /* Accept, save, and transmit a new frame. */ from network layer(&buffer[next frame to send]); /* fetch new packet */ nbuffered = nbuffered + 1; /* expand the senders window */ send data(next frame to send, frame expected, buffer);/* transmit the frame */ inc(next frame to send); /* advance senders upper window edge */ break; case frame arrival: /* a data or control frame has arrived */ from physical layer(&r); /* get incoming frame from physical layer */ if (r.seq == frame expected) { /* Frames are accepted only in order. */ to network layer(&r.info); /* pass packet to network layer */ inc(frame expected); /* advance lower edge of receivers window */ } /* Ack n implies n 1, n 2, etc. Check for this. */ while (between(ack expected, r.ack, next frame to send)) { /* Handle piggybacked ack. */ nbuffered = nbuffered 1; /* one frame fewer buffered */ stop timer(ack expected); /* frame arrived intact; stop timer */ inc(ack expected); /* contract senders window */ } break; case cksum err: break; /* just ignore bad frames */

case timeout: /* trouble; retransmit all outstanding frames */ next frame to send = ack expected; /* start retransmitting here */ for (i = 1; i <= nbuffered; i++) { send data(next frame to send, frame expected, buffer);/ * resend 1 frame */ inc(next frame to send); /* prepare to send the next one */ } } if (nbuffered < MAX SEQ) enable network layer(); else disable network layer(); } }
From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

Fig. 3-16. A sliding window protocol using go back n.

1996 Prentice Hall

Real time 10:00:00.0 10:00:00.5

Pointer to next timeout Frame being timed Ticks to go (a) (b)

Fig. 3-17. Simulation of multiple timers in software.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

/* Protocol 6 (nonsequential 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, as in protocol 5. */ #define MAX SEQ 7 /* should be 2n 1 */ #define NR BUFS ((MAX SEQ + 1)/2) typedef enum {frame arrival, cksum err, timeout, network layer ready, ack timeout} event type; #include "protocol.h" boolean no nak = true; /* no nak has been sent yet */ seq nr oldest frame = MAX SEQ + 1; /* initial value is only for the simulator */ static boolean between(seq nr a, seq nr b, seq nr c) { /* Same as between in protocol5, but shorter and more obscure. */ return ((a <= b) && (b < c)) || ((c < a) && (a <= b)) || ((b < c) && (c < a)); } static void send frame(frame kind fk, seq nr frame nr, seq nr frame expected, packet buffer[]) { /* Construct and send a data, ack, or nak frame. */ frame s; /* scratch variable */ s.kind = fk; /* kind == data, ack, or nak */ if (fk == data) s.info = buffer[frame nr % NR BUFS]; s.seq = frame nr; /* only meaningful for data frames */ s.ack = (frame expected + MAX SEQ) % (MAX SEQ + 1); if (fk == nak) no nak = false; /* one nak per frame, please */ to physical layer(&s); /* transmit the frame */ if (fk == data) start timer(frame nr % NR BUFS); stop ack timer(); /* no need for separate ack frame */

void protocol6(void) { seq nr ack expected; seq nr next frame to send; seq nr frame expected; seq nr too far; int i; frame r; packet out buf[NR BUFS]; packet in buf[NR BUFS]; boolean arrived[NR BUFS]; seq nr nbuffered; event type event; enable network layer(); ack expected = 0; next frame to send = 0; frame expected = 0; too far = NR BUFS; nbuffered = 0; for (i = 0; i < NR BUFS; i++) arrived[i]

/* lower edge of senders window */ /* upper edge of senders window + 1 */ /* lower edge of receivers window */ /* upper edge of receivers window + 1 */ /* index into buffer pool */ /* scratch variable */ /* buffers for the outbound stream */ /* buffers for the inbound stream */ /* inbound bit map */ /* how many output buffers currently used */ /* initialize */ /* next ack expected on the inbound stream */ /* number of next outgoing frame */ /* initially no packets are buffered */ = false;

while (true) { wait for event(&event); /* five possibilities: see event type above */ switch(event) { case network layer ready: /* accept, save, and transmit a new frame */ nbuffered = nbuffered + 1; /* expand the window */ from network layer(&out buf[next frame to send % NR BUFS]); /* fetch new packet */ send frame(data, next frame to send, frame expected, out buf);/ * transmit the frame */ inc(next frame to send); /* advance upper window edge */ break; case frame arrival: /* a data or control frame has arrived */ from physical layer(&r); /* fetch incoming frame from physical layer */ if (r.kind == data) { /* An undamaged frame has arrived. */ if ((r.seq != frame expected) && no nak) send frame(nak, 0, frame expected, out buf); else start ack timer(); if (between(frame expected, r.seq, too far) && (arrived[r.seq%NR BUFS] == false)) { /* Frames may be accepted in any order. */ arrived[r.seq % NR BUFS] = true;/ * mark buffer as full */ in buf[r.seq % NR BUFS] = r.info;/ * insert data into buffer */ while (arrived[frame expected % NR BUFS]) { /* Pass frames and advance window. */ to network layer(&in buf[frame expected % NR BUFS]); no nak = true; arrived[frame expected % NR BUFS] = false; inc(frame expected); /* advance lower edge of receivers window */ inc(too far); /* advance upper edge of receivers window */ start ack timer(); /* to see if a separate ack is needed */ } } } if((r.kind==nak) && between(ack expected,(r.ack+1)%(MAX SEQ+1),next frame to send)) send frame(data, (r.ack+1) % (MAX SEQ + 1), frame expected, out buf); while (between(ack expected, r.ack, next frame to send)) { nbuffered = nbuffered 1; /* handle piggybacked ack */ stop timer(ack expected % NR BUFS);/* frame arrived intact */ inc(ack expected); /* advance lower edge of senders window */ } break; case cksum err: if (no nak) send frame(nak, 0, frame expected, out buf);/* damaged frame */ break; case timeout: send frame(data, oldest frame, frame expected, out buf);/ * we timed out */ break; case ack timeout: send frame(ack,0,frame expected, out buf);/* ack timer expired; send ack */

} } }

if (nbuffered < NR BUFS) enable network layer(); else disable network layer();

Fig. 3-18. A sliding window protocol using selective repeat.

Sender

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6

0 1 2 3 4 5 6 7

Receiver

0 1 2 3 4 5 6 7 (a)

0 1 2 3 4 5 6 7 (b)

0 1 2 3 4 5 6 (c)

0 1 2 3 4 5 6 7 (d)

Fig. 3-19. (a) Initial situation with a window of size seven. (b) After seven frames have been sent and received but not acknowledged. (c) Initial situation with a window size of four. (d) After four frames have been sent and received but not acknowledged.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

0 00 0 000 4 10A 6 101 8 (a) 0 0 10 3 111 0 11 8 7 1 01 0 7 01A 2 010 5

To Frame network Frame Who Transition runs? accepted emitted layer 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

(b)

Fig. 3-20. (a) State diagram for protocol 3. (b) Transitions.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

000A 0 00A 4+6 7

0 0

00 0 000 7 1

010A 0 7 01A

0 0

01 0 7

010 2+5

101A 0

8 6 8 0

10A 0 10

111 0 11 8 0 0

11 A 0 11 1A 8

101 0

1+2 3+4 (a)

(0 0 0 ), (0 1 A), (0 1 0 A), (1 1 1 A), (1 1 A), (0 1 0 ), (0 1 A), (1 1 1 ) (b)

Fig. 3-21. (a) State graph for protocol 3 and a full-duplex channel. (b) Sequence of states causing the protocol to fail.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

Fig. 3-22. A Petri net with two places and two transitions.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

C: Seq 0 on the line D: Ack on the line E: Seq 1 on the line C Emit 0 A Wait for Ack 0 1 2 5 Timeout Loss Reject 0 0 8 F Expect 1 10 Process 0

D Emit 1 3 Ack 11 Process 1

Wait for Ack 1

6 E

Loss

Expect 0

Timeout

Reject 1

7 Sender's state

Loss Channel Receiver's state

Fig. 3-23. A Petri net model for protocol 3.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

Bits

8 01111110

8 Address

8 Control

>0 Data

16 Checksum

8 01111110

Fig. 3-24. Frame format for bit-oriented protocols.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

Bits (a)
( 3 3 3

1 0
) (

1 P/F

Seq

Next

(b)

Type

P/F

Next

(c)

Type

P/F

Modifier

Fig. 3-25. Control field of (a) an information frame, (b) a supervisory frame, (c) an unnumbered frame.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

' 2

'

&

User's home PC Client process using TCP/IP Dial-up telephone line

Internet provider's office Modems

Modem TCP/IP connection using SLIP or PPP Router Routing process

Fig. 3-26. A home personal computer acting as an Internet host.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

Bytes

1 Flag 01111110

1 Address 11111111

1 Control 00000011

1 or 2 Protocol

Variable Payload

2 or 4 Checksum

1 Flag 01111110

Fig. 3-27. The PPP full frame format for unnumbered mode operation.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

Establish Failed
C

Authenticate

Dead

Failed

Terminate Done

Open NCP configuration


B

Carrier dropped
9

Fig. 3-28. A simplified phase diagram for bringing a line up and down.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

1996 Prentice Hall

@ 6 4

Carrier detected
9

Both sides agree on options

Authentication successful

Network

D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEEEEEEEEEFEEEEEEEEEEEFEEEEEED GG GG GG D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D DG D D D D D D D D D D D D D D D D G EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEG EEEEEEEEFEEEEEEEEEEEFEEEEEED G EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEG EEEEEEEEFEEEEEEEEEEEFEEEEEED D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D DG D D D D D D D D D D D D D D D D G G G G DEDEDEDEDEDEDEDFDEDEDEDEDEDEDEDEDEDEDEDFDEDEDEDEDEDEDEDEDEDEDEDFDEDEDEG DEDEDEDEDEDEDEDEDFDEDEDEDEDEDEDEDEDEDEDEDFDEDEDEDEDEDED G G G G D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D DG D D D D D D D D D D D D D D D D G EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEG EEEEEEEEFEEEEEEEEEEEFEEEEEED G G G D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D DG D D D D D D D D D D D D D D D D G EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEG EEEEEEEEFEEEEEEEEEEEFEEEEEED G EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEG EEEEEEEEFEEEEEEEEEEEFEEEEEED D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D DG D D D D D D D D D D D D D D D D G G G G G DEDEDEDEDEDEDEDFDEDEDEDEDEDEDEDEDEDEDEDFDEDEDEDEDEDEDEDEDEDEDEDFDEDEDEG DEDEDEDEDEDEDEDEDFDEDEDEDEDEDEDEDEDEDEDEDFDEDEDEDEDEDED G G G D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D DG D D D D D D D D D D D D D D D D G EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEG EEEEEEEEFEEEEEEEEEEEFEEEEEED G G G D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D DG D D D D D D D D D D D D D D D D G EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEG EEEEEEEEFEEEEEEEEEEEFEEEEEED G EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEG EEEEEEEEFEEEEEEEEEEEFEEEEEED D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D DG D D D D D D D D D D D D D D D D G G G G DEDEDEDEDEDEDEDFDEDEDEDEDEDEDEDEDEDEDEDFDEDEDEDEDEDEDEDEDEDEDEDFDEDEDEG DEDEDEDEDEDEDEDEDFDEDEDEDEDEDEDEDEDEDEDEDFDEDEDEDEDEDED G G G G G EEDEEDEEDEFEDEEDEEDEEDEEEDEFDEEEDEEDEEDEEDEEFDEEDEG EEEEEEEEFEEEEEEEEEEEFEEEEEED D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D DG D D D D D D D D D D D D D D D D

Fig. 3-29. The LCP packet types.

Discard-request

Echo-reply

Echo-request

Protocol-reject

Code-reject

Terminate-ack

Terminate-request I R

Configure-reject

Configure-nak

Configure-ack

Configure-request I R

Name

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

Direction

IR

IR

IR

IR

IR

IR

IR

IR

IR

Just discard this frame (for testing)

Here is the frame back

Please send this frame back

Unknown protocol requested

Unknown request received

OK, line shut down

Request to shut the line down

Some options are not negotiable

Some options are not accepted

All options are accepted

List of proposed options and values

1996 Prentice Hall

D DG DG DG DG DG DG DG DG DG DG DG DG G G G G G G G G GG

Description

Correct

HEC

d ete cte d

HUNT
HEC
W V U

PRESYNCH
Incorrec t

detected
Consecutive correct HECs
X Y a

Fig. 3-30. The cell delineation heuristic.

From: Computer Networks, 3rd ed. by Andrew S. Tanenbaum,

Consecutive incorrect HECs


` Y

SYNCH

1996 Prentice Hall

R Q

T S

Bit-by-bit check
X

Cell-by-cell check

S-ar putea să vă placă și