2

I need to implement an 'ethernet-wannabe protocol' with a sender and a receiver.(only layers 1,2).

Assuming a sender\receiver model for an Ethernet frame with varying payload length. As for the sender- I have no issues. The frame consists of the MAC's of the sender and receiver, type and length of the payload and a payload, and a 4 byte CRC calculation afterwards.

Layer 1 merely sends the bits to the receiver.

The receiver's layer 1 reads those bits and adds them up to form a frame. How do I know when has the frame ended? I know I have the length field to know how many bytes are reserved for the payload and then the CRC bytes afterwards.

However, what if an error occurred and the length byte was changed? I can't rely on it no more. Another solution is to put an 'end of frame' character after the CRC so the receiver knows this marks the end of the frame(assuming it can't be in the payload\macs\etc). But the same problem arises, what if any other byte was mistakenly changed into this special character , or this byte has changed?

0

1 Answer 1

3

You need to look at the entire ethernet scheme, including outside the frame. It starts with the Preamble of seven octets, then the one-octet Start-of-Frame delimiter. The frame follows that, and after the frame comes the 12-octet Inter-Packet gap, which is basically silence on the line (no bits).

The Preamble, SoF, and Inter-Packet gap are all dealt with by the hardware, as is the FCS for modern ethernet interfaces. Generally, only the frame (usually minus the CRC) is passed to the software.

2
  • So the surefire way to know it is the end of frame is if the line is silent, meaning we reached the IFG timer? Apr 30, 2022 at 23:06
  • 1
    Yes. Starting from the Preamble all the way through the FCS, there will be activity in the carrier, but the Inter-Packet GAP is just the carrier with no modulation.
    – Ron Maupin
    Apr 30, 2022 at 23:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.