/********************************************************** Checksum.h provide checksum functions using 1's complement for both IP header checksum and ICMP checksum ***********************************************************/ #ifndef SR_CHECKSUM_H #define SR_CHECKSUM_H #include #include "sr_protocol.h" #include "sr_arp.h" #include #include #include "stdlib.h" /* * Author: Denny Chen Dai * * Compute checksum for outgoing packet, store checksum field * * base: the beginning of the data chunck * checksum: the field for storing 16bit checksum * packet_size: number of bytes (8bit) */ void sr_checksum_send(uint16_t *, uint16_t *, int); /* * Author: Denny Chen Dai * Perform error checksum on receiving packet * * base: the base pointer of the packet field * packet_size: number of bytes * Return: if no error, return 1, else return 0 */ int sr_checksum_receive(uint16_t *, int); #endif