If I understand correctly both error detection/correction and framing are done at the link layer. I understand how popular error detection/correction and framing techniques work. But I struggle with the following: If we use for example bit stuffing to send frames over a link, how can we detect errors in the flag bits?
The problem is: If we only use error detection on the actual data bits and do bit stuffing after we add the correction bits then this would mean that we do not detect errors in the flag bits. So how would we do bit stuffing first and then add error detection bits?
Would you say the following works/is used? We use some fixed amount of error detection bits which we always append after the "end-flag" of some frame.
Would be grateful if someone could help me with this.
Edit: What is the intent of doing bitstuffing here? Assume I want to send a frame from one node to another. The physical layer provides an interface to send bit streams. So ultimately the receiving node receives a bit stream and must know how to convert it to single frames again. To achieve this the sending node uses bit stuffing on the frame and then sends the stuffed frame as bitstream. This allows the receiving node to find out where a frame starts and ends.