Download presentation
Presentation is loading. Please wait.
Published byGladys O’Neal’ Modified over 9 years ago
1
Giuseppe Bianchi Layer 2 Framing HDLC (High-level Data Linl Control)
2
Giuseppe Bianchi HDLC Typical Layer 2 protocol Services: Framing Error detection and frame retransmission Flow control Most of current line-based L2 protocols are derived from HDLC PPP (dial-up, ADSL, …) LAP-D (ISDN) LAP-B (X.25) …
3
Giuseppe Bianchi Why framing? 0110110111 Framing received frames 0111110101 transmitted frames PHY: - bit oriented1000101010111010101010111 - byte oriented10001000-01011000-11110110 FRAMES = “structured” information & control fields PHY = bit/byte streams
4
Giuseppe Bianchi HDLC Frame Format Flag 1 byte Address 1-n bytes Control 1-2 bytes Information (variable) FCS 2-4 bytes Flag 1 byte Each frame starts & ends with reserved flag: 0111.1110 = 0x7e Just one flag required between consecutive frames Two consecutive flags = empty frame Just ignore flagHDLC frameflagHDLC frame flagHDLC frameflagHDLC frameflag
5
Giuseppe Bianchi The need for “stuffing” Flag 0111.1110 FRAME 0100.0100..0000.0000..0111.1000..0111.1110..0101.1110..0100.0000 Flag 0111.1110 0111.1110..0100.0100..0000.0000..0111.1000..0111.1110..0101.1110..0100.0000..0111.1110 Flag 0111.1110 FRAME 0100.0100..0000.0000..0111.1000 Flag 0111.1110 FRAME 0101.1110..0100.0000 Flag 0111.1110
6
Giuseppe Bianchi Bit stuffing HDLC Frame delineated by flag character 01111110 Six consecutive 1s Bit stuffing: prevent occurrence of more than five 1s! Transmitter inserts extra 0 after each consecutive five 1s inside the frame Receiver checks for five consecutive 1s if next bit = 0, it is removed if next two bits are 10, then flag is detected If next two bits are 11, then frame has errors
7
Giuseppe Bianchi Bit stuffing example 0110111111111100 Data to be sent: After stuffing and framing 01111110 011011111011111000 01111110 *000111011111-11111-110* Data received After destuffing and deframing 01111110000111011111011111011001111110 EXAMPLE: send EXAMPLE: receive
8
Giuseppe Bianchi Byte stuffing Byte-oriented channels? Same stiffing idea, but stuffing via control escape octes: Send (“reserved” byte) as (control escape octet) + (reserved byte)XOR(0010.0000) Extra XOR (bit 5 complemented) for improved robustness Control escape octet 0111.1101 = 0x7d – of course NOW this is a reserved byte, too! 113F7E027D10 113F7D027D105E5D Receiver detects control escape And removes it restoring original byte as part of the frame (e.g. not as flag) See RFC 1662 for bit-stuffing over bit synchronous links (versus byte-oriented links)
9
Giuseppe Bianchi HDLC Frame Content Flag 1 byte Address 1-n bytes Control 1-2 bytes Information (variable) FCS 2-4 bytes Flag 1 byte Address: Receiving (secondary) station Or Transmitting (secondary) station in case of response 1111.1111 = broadcast address Control Frame type and transmission control information FCS CRC16 or CRC32 for error detection Size of fields decided during link set-up/initialization procedure
10
Giuseppe Bianchi Control field Three types of frames I = Information frame S = Supervisory frame U = Unnumbered frame 0 10 11
11
Giuseppe Bianchi Information Frame N(S) # of currently transmitted frame N(R) # of next frame expected to be received i.e., ACK of all frames until N(R)-1 P/F bit For polling operation 0N(S) P/F 0 8 bit case 16 bit case N(R) P/F N(S)N(R)
12
Giuseppe Bianchi Supervisory Frame Control frame used to manage ACK and flow control S=RR (Receive Ready) Carries cumulative ACK up to N(R)-1 S=RNR (Receive Not Ready) Blocks sender (flow control), carries cumulative ACK as well S=REJ (Reject) Negative ACK for frame # N(R), for Go-Back-N case S=SREJ (Selective Reject) Negative ACK for frame # N(R), for Sel. Repeat case Extension: OTHER frame # to be retransmitted may be included in the frame information field 1 P/F 8 bit case 16 bit case N(R) P/F N(R) 0S 10S0000
13
Giuseppe Bianchi Unnumbered Frame Frames used for datalink management Initialization, Setup/release, Reset, Management and notification of malfunctions and issues Several control messages See details and examples in book Different datalink scenarios Asynchronous Balanced Mode (ABM) LAP-B Two full-duplex stations Normal Response Mode (NRM) Unbalanced (half-duplex) operation: primary station can only access link, secondary station is slave Asynchronous Response Mode (ARM) Like NRM, but secondary station may further initiate an unsolicited transmission 1 P/F M1M
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.