HDLC's frame structure:
The beginning and end of an HDLC frame are marked by flag characters - 01111110 binary. No flag character may appear in the intervening data. To enforce this requirement, the data may need to be modified (in a transparent manner). On bit-synchronous links, a binary 0 is inserted after every sequence of five 1s (bit stuffing). Thus, the longest sequence of 1s that may appear of the link is 0111110 - one less than the flag character. The receiver, upon seeing five 1s, examines the next bit. If 0, the bit is discarded and the frame continues. If 1, then this must be the flag sequence at the end of the frame.
At the end of the frame, a Frame Check Sequence (FCS) is used to verify the data integrity. The FCS is a CRC calculated using polynomial x^16 + x^12 + x^5 + 1.
Between HDLC frames, the link idles. Most synchronous links constantly transmit data; these links can transmit all 1s during the inter-frame period (mark idle), or all flag characters (flag idle).
Many varients of HDLC have been developed. Both PPP and SLIP use a subnet of HDLC's functionality. ISDN's D channel uses a slightly modified version of HDLC. Cisco routers' default serial link encapsulation is HDLC.