/****************************************************** * SR_ICMP.H * Package for handling ICMP Protocols * *******************************************************/ #ifndef SR_ICMP_H #define SR_ICMP_H /* * Author: Denny Chen Dai * Construction of ICMP Packet Data from scracth * * len: totol lenth of packet data created * dhost[]: destination MAC address * shost[]: src MAC address * dest_ip: dest ip * src_ip: src_ip * icmp_type: ICMP protocol type * icmp_code: ICMP protocol type code * ip_hdr: pointer to ip protocol header address */ uint8_t *sr_construct_ICMP(unsigned int *, unsigned char [ETHER_ADDR_LEN], unsigned char [ETHER_ADDR_LEN], uint32_t, uint32_t, uint8_t, uint8_t, struct ip *); /* * Author: Denny Chen Dai * ICMP Protocol Handling Function * * v1. Handling ICMP ECHO_REQUEST * */ void sr_handle_ICMP(struct sr_instance*, uint8_t *, unsigned int, char*, struct ip *, struct sr_ethernet_hdr *); /* * Author: Nicholas, Denny * Display ICMP packet content * * base: pointer to the starting addr of ICMP packet */ void display_ICMP(uint8_t *base); #endif