Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
EE 482: Communication Networks Lecture 6 Framing in Data Link Layer Instructor Dr. Naif Almakhdhub Original slides prepared by: Dr. Basil AsSadhan Reading: Section 9.1 (Forouzan) 5.4 (Leon-Garcia, Widjaja) 1 Data Link Layer Reference: J. Kursoe and K. Ross 2 Outline • Data Link Layer Functions • Framing • Types of Frames – Fixed Length Frames – Variable Length Frames • Stuffing – Bit Stuffing – Byte Stuffing 3 From Signals to Packets Analog Signal Digital Signal Bit Stream Packets 0 0 1 0 1 1 1 0 0 0 1 0100010101011100101010101011101110000001111010101110101010101101011010111001 Header/Payload Packet Transmission Sender Header/Payload Header/Payload Receiver 4 Data Link Layer Functions • Framing – Map stream of bits into frames – Add header, mark and detect frame boundaries • Error control and recovery – Error detection and correction through coding – Retransmission • Flow control – Avoid sender outrunning receiver – Receiver controls when sender can send a frame 5 Data Link Layer Functions (Cont.) • Medium Access Control (MAC) – Control which frame to be sent next over link • Multiplexing multiple flows • Easy for point-to-point links • Harder for multi-access links: who gets to send? 6 Framing • The physical layer carries information in the form of stream of bits • The data link layer maps stream of bits into frames • How does a receiver detect the boundaries of a frame? 0111010001110111110111011001110 A: Mark the beginning and end of frames 7 Types of Frames • Fixed length frames – E.g., ATM , SONET – Need to only mark beginning of frame (not covered) • Variable length frames – E.g., Ethernet – Need to mark beginning and end of frame (covered) or – Beginning of frame and specify length (not covered) 8 Two Examples of Protocols • HDLC: High-Level Data Link Control – Bit-oriented data link control • PPP: Point-to-Point Protocol – Character-oriented version of HDLC • HDLC & PPP are used in point-to-point communication – E.g., two routers connected by a long-distance link Details of these two protocols are in Sections 11.3 and 11.4 (Forouzan) 5.5 and 5.6 of (Leon-Garcia, Widjaja) 9 Flag-Based Frames • Can have arbitrary number of bits in a frame HDLC frame Flag Address Control Information FCS Flag any number of bits • Flag: the byte 0x7E (01111110) • What to do if the flag occurs inside a frame? A: Bit stuffing FCS: Frame Check Sequence – used to detect/correct bit errors 10 Bit Stuffing in HDLC • Flag: the byte 0x7E (01111110) • Transmitter stuffs a 0 after five consecutive 1s – E.g., 11111111 -> 111110111 – E.g., 11111011 -> 111110011 This is done regardless of what comes after the five 1s! Receiver unstuffs the 0 after five 1s 11 Example: Bit Stuffing & De-Stuffing (a) Data to be sent 0110111111111100 After stuffing and framing 01111110 01101111101111100001111110 (b) Another set of data received 01111110000111011111011111011001111110 After destuffing and deframing *000111011111-11111-110* 12 Byte-Stuffing in PPP • • • • • • PPP is character-oriented version of HDLC PPP uses similar frame structure as HDLC But payload contains an integer number of bytes Flag is the same: 0x7E (01111110) Define a control escape octet 0x7D (01111101) If the flag or control escape values appear inside a frame – It is replaced with 0x7D followed by original octet XORed with 0x20 (00100000) Data to be sent 7E 41 41 7D 7D 5D 42 7E 42 7D 50 70 5E 46 50 After stuffing and framing 70 46 7E 13