framing

advertisement
Communication Networks
MAP-TELE
2011/12
José Ruela
Network basic mechanisms
Framing
Need for framing
• Data communications is based on the exchange of data units (usually
called frames), with a known structure (format)
– In general, frames are of variable length (up to a predefined maximum that
depends on a number of factors, such as type of network technology and physical
medium, Bit Error Ratio on the channel, etc.)
– In ATM the basic communication unit has fixed size and is called a cell
• This structure must be recovered (recognized) by the receiver out of a
sequence of raw bits, which requires identifying the frame boundaries
• Frame synchronization or delineation (or simply framing) is the
process of defining and locating frame boundaries (start and end of
the frame) on a bit sequence
• When channel multiplexing at the physical layer is based on a physical
frame structure, frame synchronization is also required (it is different
and 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
Framing methods
• The problem of framing is solved in different ways depending on the
frames having a fixed (known) length or a variable length
• For frames of fixed length (e.g., a physical layer SONET/SDH frame
or an ATM cell), it is only necessary to identify the start of the frame
and add the frame size to locate the end of the frame – framing
methods can thus exploit the occurrence of either periodic patterns or
known correlations that occur periodically in bit sequences (the latter
is exploited in ATM)
• For frames of variable size, special synchronization characters or bit
patterns are used to identify the start of a frame, while different
explicit or implicit methods can be used for identifying the end of a
frame (e.g., special characters or bit patterns, a length field or some
event that may be associated with the end of the frame)
Stuffing techniques
• Earlier data link layer protocols were character oriented – the code
used to represent sequences of printable characters (e.g., ASCII) was
also used to support other protocol functions, such as frame
synchronization, by means of special (non printable) characters
– This method, in its basic form, is not transparent, since a frame cannot
carry any arbitrary sequence of bits as data
– To achieve transparency it is necessary to use special character
sequences based on an escape character (character stuffing)
• Bit oriented protocols were developed to overcome the limitations of
character oriented protocols and, in particular, to allow independence
of codes (transparency)
– In point-to-point links, frames are usually delimited with a special bit
sequence (flag) and transparency is achieved by means of bit stuffing
• Frames delimited with flags may also be organized as a collection of
bytes (byte oriented protocols)
– Transparency in this case is achieved by means of byte stuffing, which is
different from character stuffing used in character oriented protocols
Character oriented protocols and character stuffing
• In character oriented protocols, a frame starts with synchronization
characters (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 data
field 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 one
• With 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 STX
and DLE ETX (or DLE ETB)
– If the DLE character appears in the data field it must be replaced by the
sequence DLE DLE (character stuffing)
• Bisync (Binary Synchronous) was one popular example of a character
oriented protocol
Character oriented frames and transparency
• Normal frame format
– Used to carry characters coded with the protocol code (e.g., ASCII)
SYN
SYN
SOH
Header
STX
Data
ETX
BCC
• Modified frame format
– Used to carry transparent data
– A DLE character that occurs in the transparent data field must be
replaced with DLE DLE (one DLE is removed by the receiver)
– Escape sequences (starting with DLE) may be used for other purposes
SYN
SYN
SOH
Header
DLE
STX
Transparent Data
BCC – Binary Check Character (for error detection)
DLE
ETX
BCC
Bit oriented protocols and bit stuffing
• In bit oriented protocols, a frame is a collection of bits, organized in
fields – typically an address field, a control field, a data field and a
Frame 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 to
terminate 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 a
particular code (transparency) and its size is not necessarily a multiple
of eight bits (byte), since code words may be of any size
• The 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 its
occurrence inside the frame (in all fields except the real flags)
• The technique used for this purpose is called bit stuffing and consists in
inserting one zero after five consecutive ones (no matter the value of
the following bit) at the sender and removing it at the receiver
• Bit stuffing is used in HDLC and its variants (except PPP)
Bit stuffing
• Frame format
Flag
Address Control
Data
FCS
Flag
• Example of bit stuffing / destuffing
Original sequence
00111111011111111111000111110100
Stuffing
Transmitted sequence
(after stuffing)
001111101011111011111010001111100100
Destuffing
Recovered sequence
(after destuffing)
00111111011111111111000111110100
Byte oriented protocols and byte stuffing
• Some protocols adopt the same frame structure as bit oriented
protocols like HDLC, but with a restriction that the frame fields are
made 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 since
framing and other protocol functions are independent of the code
used to represent the information
– They are less flexible than bit oriented protocols, due to the restriction of
using code words with a length multiple of eight bits
• To achieve transparency, it is also necessary to prevent any byte
within a frame to coincide with the flag pattern
• For this purpose, a special escape byte (ESC) is inserted before the
byte with the flag pattern – this is called byte stuffing
• The use of the escape byte to achieve transparency means that the
occurrence of a byte with the ESC pattern must also be stuffed
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 same
pattern as the Flag or ESC
– The Flag is replaced with two bytes – ESC followed by 0x5E (the
exclusive OR of the Flag with 0x20)
– ESC is also replaced with two bytes – ESC followed by 0x5D (the
exclusive OR of ESC with 0x20)
• The receiver performs the reverse operation – when ESC is found in
the byte stream, it is removed, and the following byte is replaced by
performing an exclusive OR with 0x20 (thus obtaining 0x7E or 0x7D
and recovering the Flag or ESC, respectively)
Byte count method
• In this method, the length of the frame is included as a field in the frame
header (byte count) – the length field occupies a well defined position in the
frame header, which is easily determined after the start of the frame is
identified by any of the usual methods
• This method has a serious drawback – if the count field is corrupted (due to
transmission errors) the end of the frame is not correctly detected (a wrong
number of bytes will be assembled)
– Hopefully the error detection mechanism will in most cases detect that there is
such a framing error, because error detection will be performed over a wrong
number of bytes, using for error checking a sequence of bits not related with the
group 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 DECNET’s 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 position
determined by the length field and the error checking mechanism does not detect
an error
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 bits
• At 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 precedes
the remaining fields of the frame
• At a receiving station, the end of a frame is detected by the absence
of transitions in the coded signal (no carrier present)
Framing in IEEE 802. 5 Token Ring
• A method based on Physical layer code violations may be used when the
transmission 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 of
the 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 in
SFD 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 a
bit 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 JK0JK0 and JK1JK1,
respectively (the other two bits are used for other purposes)
IEEE 802.5 – example of line coding and violations
1
0
1
1
0
J
K
NONE
NONE
BINARY NRZ
DIFFERENTIAL MANCHESTER
Transition at
the start
Transition in
the middle
0
YES
YES
1
NO
YES
J
NO
NO
K
YES
NO
Framing in FDDI Token Ring
• The method used in the Fiber Distributed Data Interface (FDDI) Token Ring
LAN 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 bits
long) 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 Delimiter made up of a JK 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 Delimiter is represented by a single T symbol and is followed by
three frame status control symbols
• The 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 cells
to transmit, pairs of JK symbols are inserted (11000 1001)
– Each cell is preceded by a TT pair (01101 01101)
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., an
SDH-based or a cell-based Physical Layer)
• Cell delineation thus reduces to identifying the start of a cell and
repeating (and verifying) the process every 53 bytes
• The general method of ATM cell delineation is based on the fact that
the fifth byte of the cell header is a Header Error Control (HEC) field
used to protect the whole header
• Since there is a correlation between the HEC bits and the remaining
bits of the header, the method is based on searching for such a
correlation over multiple cells and, once synchronization is achieved,
verifying that it is kept by analysing that the expected HEC field is
still correct
• To improve the robustness of the method, the cell payload is
scrambled
ATM cell delineation – state machine
bit by bit
Correct HEC
cell by cell
hunt
presynch
Incorrect HEC
 consecutive
incorrect HEC
 consecutive
correct HEC
sync
cell by cell
= 7
 = 6 (SDH-based Physical Layer)
8 (cell-based Physical Layer)
Download