The data link layer is often divided into two sublayers:
logical link control (LLC) and
media access control (MAC).
Logical link control sublayer The uppermost sublayer, LLC,
multiplexes protocols running at the top of the data link layer, and optionally provides flow control, acknowledgment, and error notification. The LLC provides addressing and control of the data link. It specifies which mechanisms are to be used for addressing stations over the transmission medium and for controlling the data exchanged between the originator and recipient machines.
Media access control sublayer MAC may refer to the sublayer that determines who is allowed to access the media at any one time (e.g.,
CSMA/CD). Other times it refers to a
frame structure delivered based on
MAC addresses inside. There are generally two forms of media access control: distributed and centralized. Both of these may be compared to communication between people. In a network made up of people speaking, i.e., a conversation, they will each pause a random amount of time and then attempt to speak again, effectively establishing a long and elaborate game of saying "no, you first". The Media Access Control sublayer also performs
frame synchronization, which determines the start and end of each frame of data in the transmission
bitstream. It entails one of several methods: timing-based detection, character counting, byte stuffing, and bit stuffing. • The time-based approach expects a specified amount of time between frames. • Character counting tracks the count of remaining characters in the frame header. This method, however, is easily disturbed if this field is corrupted. •
Byte stuffing precedes the frame with a special byte sequence such as
DLE STX and succeeds it with DLE
ETX. Appearances of DLE (byte value 0x10) have to be
escaped with another DLE. The start and stop marks are detected at the receiver and removed, as well as the inserted DLE characters. • Similarly,
bit stuffing replaces these start and end marks with flags consisting of a special bit pattern (e.g., a 0, six 1 bits and a 0). Occurrences of this bit pattern in the data to be transmitted are avoided by inserting a bit. To use the example where the flag is 01111110, a 0 is inserted after 5 consecutive 1's in the data stream. The flags and the inserted 0's are removed at the receiving end. This makes for arbitrarily long frames and easy synchronization for the recipient. The stuffed bit is added even if the following data bit is 0, which could not be mistaken for a
sync sequence, so that the receiver can unambiguously distinguish stuffed bits from normal bits. ==Services==