CITS3002 Computer Networks  
prev
next CITS3002 help3002 CITS3002 schedule  

Detecting Frame Corruption, continued

In the receiver we need to ensure that the checksum as received is in fact the checksum that the sender should have calculated.
If the two are different, then the frame has been corrupted (Labsheet 1).

In the receiver:

FRAME frame;
int   len, link;
int   got_checksum;

while( true ) {
    READ_PHYSICAL_LAYER(&link, &frame, &len);

    got_checksum   = frame.checksum;
    frame.checksum = 0;

    if(got_checksum == checksum_crc16(&frame, len)) {
        WRITE_NETWORK_LAYER(frame.data, frame.len);
        frame.type = DLL_ACK;
    }
    else {
        frame.type = DLL_NACK;
    }

    link      = 1;
    frame.len = 0;
    WRITE_PHYSICAL_LAYER(link, &frame, FRAME_SIZE(frame));
}




CITS3002 Computer Networks, Lecture 3, Data Link Layer protocols, p7, 13th March 2024.