7/30/2019 4 Framing CN 1112
1/19
Communication Networks
MAP-TELE
2011/12
Jos Ruela
7/30/2019 4 Framing CN 1112
2/19
Network basic mechanisms
7/30/2019 4 Framing CN 1112
3/19
Framing
7/30/2019 4 Framing CN 1112
4/19
Need for framing
Data communications is based on the exchange of data units (usuallycalled frames), with a known structure (format)
In general, frames are of variable length (up to a predefined maximum thatdepends on a number of factors, such as type of network technology and physicalmedium, Bit Error Ratio on the channel, etc.)
In ATM the basic communication unit has fixed size and is calleda cell
This structure must be recovered (recognized) by the receiver out of asequence of raw bits, which requires identifying the frame boundaries
Frame synchronization or delineation (or simply framing) is theprocess of defining and locating frame boundaries (start and end ofthe frame) on a bit sequence
When channel multiplexing at the physical layer is based on a physicalframe structure, frame synchronization is also required (it is differentand can coexist with data framing performed on each channel)
Examples are the plesiochronous (PDH) and the synchronous (SONET/SDH)multiplexing digital hierarchies based on STDM
7/30/2019 4 Framing CN 1112
5/19
Framing methods
The problem of framing is solved in different ways depending on theframes having a fixed (known) length or a variable length
For frames of fixed length (e.g., a physical layer SONET/SDH frameor an ATM cell), it is only necessary to identify the start of the frameand add the frame size to locate the end of the frame framingmethods can thus exploit the occurrence of either periodic patterns orknown correlations that occur periodically in bit sequences (the latteris exploited in ATM)
For frames of variable size, special synchronization characters or bitpatterns are used to identify the start of a frame, while different
explicit or implicit methods can be used for identifying the end of aframe (e.g., special characters or bit patterns, a length field or someevent that may be associated with the end of the frame)
7/30/2019 4 Framing CN 1112
6/19
Stuffing techniques
Earlier data link layer protocols were character oriented the codeused to represent sequences of printable characters (e.g., ASCII) wasalso used to support other protocol functions, such as framesynchronization, by means of special (non printable) characters
This method, in its basic form, is not transparent, since a frame cannotcarry any arbitrary sequence of bits as data
To achieve transparency it is necessary to use special charactersequences based on an escape character (character stuffing)
Bit oriented protocols were developed to overcome the limitations ofcharacter oriented protocols and, in particular, to allow independenceof codes (transparency)
In point-to-point links, frames are usually delimited with a special bitsequence (flag) and transparency is achieved by means ofbit stuffing
Frames delimited with flags may also be organized as a collection ofbytes (byte oriented protocols)
Transparency in this case is achieved by means ofbyte stuffing, which isdifferent from character stuffing used in character oriented protocols
7/30/2019 4 Framing CN 1112
7/19
Character oriented protocols and character stuffing
In character oriented protocols, a frame starts with synchronizationcharacters (one or more) the ASCII character used for this purpose is SYN(Synchronous Idle) and is coded as 0x16
Other ASCII characters are used to organize the frame
SOH (Start of Heading) precedes a header (when there is one)
STX (Start of Text) indicates that a data field (text) follows
ETX (End of Text) or ETB (End of Transmission Block) indicate the end of a datafield initiated with STX when a message is fragmented to be transmitted in
multiple frames, ETB is used in intermediate frames and ETX in the last oneWith this basic method it is only possible to carry data coded with the same
code used by the protocol (the original objective in text-based applications)
Transparency is achieved by using an escape character DLE (Data Link
Escape) in ASCII and delimiting the transparent data field with DLE STXand DLE ETX (or DLE ETB)
If the DLE character appears in the data field it must be replaced by thesequence DLE DLE (character stuffing)
Bisync (Binary Synchronous) was one popular example of a characteroriented protocol
7/30/2019 4 Framing CN 1112
8/19
Normal frame format Used to carry characters coded with the protocol code (e.g., ASCII)
Modified frame format Used to carry transparent data
A DLE character that occurs in the transparent data field must bereplaced with DLE DLE (one DLE is removed by the receiver)
Escape sequences (starting with DLE) may be used for other purposes
BCC Binary Check Character (for error detection)
SYN SYN SOH STX ETX BCCHeader Data
ETX BCCSYN SYN SOH DLE STX DLEHeader Transparent Data
Character oriented frames and transparency
7/30/2019 4 Framing CN 1112
9/19
Bit oriented protocols and bit stuffing
In bit oriented protocols, a frame is a collection of bits, organized infields typically an address field, a control field, a data field and aFrame Check Sequence (FCS) field for error detection
The frame is delimited (at the beginning and at the end) with a special
bit sequence (01111110) known as flag a single flag may be used toterminate a frame and to start the next frame (if they are contiguous)
The data field may be any arbitrary sequence of bits it is not tied to aparticular code (transparency) and its size is not necessarily a multiple
of eight bits (byte), since code words may be of any sizeThe other fields may also have any possible pattern, since they are
coded to support a variety of protocol functions
To achieve total transparency and to prevent a sequence 01111110 to
be interpreted by the receiver as a real flag, it is necessary to avoid itsoccurrence inside the frame (in all fields except the real flags)
The technique used for this purpose is called bit stuffing and consists ininserting one zero after five consecutive ones (no matter the value ofthe following bit) at the sender and removing it at the receiver
Bit stuffing is used in HDLC and its variants (except PPP)
7/30/2019 4 Framing CN 1112
10/19
Bit stuffing
Frame format
Example of bit stuffing / destuffing
Flag FlagAddress Control Data FCS
00111111011111111111000111110100
001111101011111011111010001111100100
00111111011111111111000111110100
Original sequence
Transmitted sequence
(after stuffing)
Recovered sequence
(after destuffing)
Stuffing
Destuffing
7/30/2019 4 Framing CN 1112
11/19
Byte oriented protocols and byte stuffing
Some protocols adopt the same frame structure as bit orientedprotocols like HDLC, but with a restriction that the frame fields aremade up of an integer number of bytes the Point to Point Protocol(PPP) is one such example
Such byte oriented protocols are also inherently transparent sinceframing and other protocol functions are independent of the codeused to represent the information
They are less flexible than bit oriented protocols, due to the restriction ofusing code words with a length multiple of eight bits
To achieve transparency, it is also necessary to prevent any bytewithin a frame to coincide with the flag pattern
For this purpose, a special escape byte (ESC) is inserted before thebyte with the flag pattern this is called byte stuffing
The use of the escape byte to achieve transparency means that theoccurrence of a byte with the ESC pattern must also be stuffed
7/30/2019 4 Framing CN 1112
12/19
Byte stuffing in PPP
The Point to Point Protocol uses the same frame structure as HDLC
The Flag is 01111110 (0x7E), as in HDLC
In PPP the escape byte (ESC) is 01111101 (0x7D)
Byte stuffing is performed when a byte within a frame has the samepattern as the Flag or ESC
The Flag is replaced with two bytes ESC followed by 0x5E (theexclusive OR of the Flag with 0x20)
ESC is also replaced with two bytes ESC followed by 0x5D (theexclusive OR of ESC with 0x20)
The receiver performs the reverse operation when ESC is found inthe byte stream, it is removed, and the following byte is replaced by
performing an exclusive OR with 0x20 (thus obtaining 0x7E or 0x7Dand recovering the Flag or ESC, respectively)
7/30/2019 4 Framing CN 1112
13/19
Byte count method
In this method, the length of the frame is included as a field in the frameheader (byte count) the length field occupies a well defined position in theframe header, which is easily determined after the start of the frame isidentified by any of the usual methods
This method has a serious drawback if the count field is corrupted (due totransmission errors) the end of the frame is not correctly detected (a wrongnumber of bytes will be assembled)
Hopefully the error detection mechanism will in most cases detect that there issuch a framing error, because error detection will be performed over a wrongnumber of bytes, using for error checking a sequence of bits not related with thegroup of bits it was supposed to protect
The receiver will synchronize on the next frame
The method can be improved by protecting the header as well
This method was used in DECNETs DDCMP (Digital Data Communications
Message Protocol)A length field can be used together with end of frame delimiters, thus
providing an extra verification mechanism
A frame will be accepted only if the end delimiter appears in the positiondetermined by the length field and the error checking mechanism does not detect
an error
7/30/2019 4 Framing CN 1112
14/19
Framing in Ethernet / IEEE 802.3
In Ethernet, biphase (or Manchester) coding is used for transmission A 0 and a 1 are coded with two elementary pulses with different levels,
with a transition in the middle
The protocol used in the original Ethernet is based on listening to the
activity on a shared medium (carrier sense) A station detects that there is no transmission in course when no carrier
is present (no transitions detected)
When a station acquires the medium it starts to transmit a frame and
at the end of the frame it simply ceases to transmit coded bitsAt a receiving station the start of a frame is identified by a known
pattern that consists in A Preamble that is made up of seven bytes with the pattern 10101010
and is used for bit synchronization A Start of Frame Delimiter(SFD) with the pattern10101011 that precedesthe remaining fields of the frame
At a receiving station, the end of a frame is detected by the absenceof transitions in the coded signal (no carrier present)
7/30/2019 4 Framing CN 1112
15/19
Framing in IEEE 802. 5 Token Ring
A method based on Physical layer code violations may be used when thetransmission code has some redundancy the biphase (or Manchester)code (including its differential variants) has this property
This method is used in the IEEE 802.5 Token Ring LAN, which uses
differential Manchester coding The line signal used to represent data symbols (binary 0 and 1) has a transition(the signal changes value) at the middle of the bit interval
Binary 0 is coded such that the line signal has another transition at the start ofthe bit interval, while there is no such transition when coding binary 1
The start and the end of a frame are identified by a Start of Frame Delimiter(SFD) and an End of Frame Delimiter(EFD), respectively
Two symbols (called J and K) with a duration of one bit interval are used inSFD and EFD as code violations of the differential Manchester code
J and K are represented as line signals without any transition at the middle of abit interval
K is coded such that the line signal has a transition at the start of the bit interval(like binary 0), while J is coded without such a transition (like binary 1)
The first six bits of SFD and EFD are coded as J K0J K0 and J K1J K1,
respectively (the other two bits are used for other purposes)
7/30/2019 4 Framing CN 1112
16/19
IEEE 802.5 example of line coding and violations
1 0 1 1 0 J K
NONE NONE BINARY NRZ
DIFFERENTIAL MANCHESTER
NOYESK
NONOJ
YESNO1
YESYES0
Transition in
the middle
Transition at
the start
NOYESK
NONOJ
YESNO1
YESYES0
Transition in
the middle
Transition at
the start
7/30/2019 4 Framing CN 1112
17/19
Framing in FDDI Token Ring
The method used in the Fiber Distributed Data Interface (FDDI) Token RingLAN is also based on exploiting the redundancy of the line code (4B5B)
In a 4B5B code, 16 code words (5 bits long) represent data symbols (4 bitslong) and the remaining 16 code words may represent non-data symbols,
which can be used for different purposes In FDDI, four non-data symbols are used for framing: 11111 (I), 11000 (J ),
10001 (K) and 01101 (T)
A frame starts with a Preamble of at least sixteen I symbols (idle state)
followed by a Start Delimitermade up of a J K pair Since the 4B5B line code is used together with NRZI signaling, the sixteen I
symbols generate a square wave signal that is used to synchronize the receiver
The End Delimiteris represented by a single T symbol and is followed by
three frame status control symbolsThe FDDI physical interface (and 4B5B coding) was also adopted by the
ATM Forum in the specification of an ATM private interface at 100 Mbit/s
Transmission of cells in not necessarily contiguous and, in the absence of cellsto transmit, pairs of J K symbols are inserted (11000 1001)
Each cell is preceded by a TT pair (01101 01101)
7/30/2019 4 Framing CN 1112
18/19
ATM cell delineation
ATM cells are of fixed size (a 5-byte header and a 48-byte payload)and are transmitted contiguously in most physical interfaces (e.g., anSDH-based or a cell-based Physical Layer)
Cell delineation thus reduces to identifying the start of a cell andrepeating (and verifying) the process every 53 bytes
The general method of ATM cell delineation is based on the fact thatthe fifth byte of the cell header is a Header Error Control (HEC) field
used to protect the whole headerSince there is a correlation between the HEC bits and the remaining
bits of the header, the method is based on searching for such acorrelation over multiple cells and, once synchronization is achieved,
verifying that it is kept by analysing that the expected HEC field isstill correct
To improve the robustness of the method, the cell payload isscrambled
7/30/2019 4 Framing CN 1112
19/19
ATM cell delineation state machine
presynch
cell by cell
hunt
sync
bit by bit
consecutiveincorrect HEC
Correct HEC
Incorrect HEC
consecutivecorrect HEC
= 7
= 6 (SDH-based Physical Layer)
8 (cell-based Physical Layer)
cell by cell