Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 6: Framing and Error Detection-Data Link Layer Functions

Similar presentations


Presentation on theme: "Lecture 6: Framing and Error Detection-Data Link Layer Functions"— Presentation transcript:

1 Lecture 6: Framing and Error Detection-Data Link Layer Functions

2 Review of Lecture 5 Level 1: Physical or Hardware Layer
Deals with the transmission of bits Signal Generation and Modulation Encoding Implemented by adapters and device drivers

3 Review of Lecture 5 Level 2: Data Link Layer
Deals with reliable transmission of data over a single link (does not include routing over a network of links) Framing Error Detection

4 Review of Lecture 5 Last time—Bit oriented protocol with sentinel strings ( at beginning and end of frame Uses bit-stuffing to identify sentinel strings in the payload Sender inserts zero after string of five 1’s Receiver deletes stuffed bits Header Body 8 16 CRC Beginning sequence Ending

5 Byte oriented framing-Byte counting approach
include payload length in header e.g., Digital Data Communication Message Protocol (DDCMP) problem: count field corrupted solution: catch when CRC fails

6 Byte-oriented framing: Sentinel Approach
DLE character precedes ETX within the body

7 Clock-based framing SONET: Synchronous Optical Network
each frame is 125us long STS-n (STS-1 = Mbps)

8 Error Detection and Correction
Two dimensional Parity Cyclic Redundency Check Internet checksum

9 Two Dimensional Parity
Detects and corrects single bit errors Detects 2 and 3 bit errors Fails for 4 errors at the corners of box

10 Cyclic Redundancy Check
Add k bits of extra data (the CRC field) to an n-bit message to provide error detection function For efficiency, want k << n e.g., k = 32 for Ethernet and n = 12,000 (1500 bytes) Header Body 8 16 CRC Beginning sequence Ending

11 Polynomials with binary coefficients
Represent n-bit message as n-1 degree polynomial e.g., MSG= as M(x) = x7 + x4 + x3 + x1 Addition (no carry) Subtraction (no borrow) A-B=AXORB

12 Polynomials with binary coefficients
Multiplication The usual without carrying

13 Polynomials with binary coefficients
Division The usual ÷ without the borrowing

14 CRC strategy Sender and Receiver know the “divisor polynomial”
e.g. C(x)=x3+x2+1=1101 Send Message÷ CRC with CRC chosen so that the whole thing is evenly divisible by C(x) Receiver calculates the remainder of Message÷ CRC/C(x) There’s an error if it is not zero

15 CRC example Message=10011010 C=1101(3 rd order)
Message÷ CRC= XYZ Choose XYZ so that remainder is zero for Message÷ CRC/C

16 CRC Example cont. ÷ XYZ X= Y= Z= xyz Message÷ CRC= ÷ 101

17 CRC Example cont. ÷ Message÷ CRC= (xor) 101

18 CRC (cont) Let k be the degree of some divisor polynomial
e.g., C(x) = x3 + x2 + 1 Transmit polynomial P(x) that is evenly divisible by C(x) shift left k bits, i.e., M(x)xk subtract remainder of M(x)xk / C(x) from M(x)xk Receiver polynomial P(x) + E(x) E(x) = 0 implies no errors Divide (P(x) + E(x)) by C(x); remainder zero if: E(x) was zero (no error), or E(x) is exactly divisible by C(x) (unlikely for CRC-32)

19 Selecting C(x) All single-bit errors, as long as the xk and x0 terms have non-zero coefficients. All double-bit errors, as long as C(x) contains a factor with at least three terms Any odd number of errors, as long as C(x) contains the factor (x + 1) Any ‘burst’ error (i.e., sequence of consecutive error bits) for which the length of the burst is less than k bits. Most burst errors of larger than k bits can also be detected See Table 2.6 on page 102 for common C(x)

20 Internet Checksum Algorithm
View message as a sequence of 16-bit integers; sum using 16-bit ones-complement arithmetic; take ones-complement of the result. u_short cksum(u_short *buf, int count) { register u_long sum = 0; while (count--) sum += *buf++; if (sum & 0xFFFF0000) /* carry occurred, so wrap around */ sum &= 0xFFFF; sum++; } return ~(sum & 0xFFFF);


Download ppt "Lecture 6: Framing and Error Detection-Data Link Layer Functions"

Similar presentations


Ads by Google