12using namespace MaxOS::common;
13using namespace MaxOS::net;
24 this -> error_messages = error_messages;
29InternetControlMessageProtocol::~InternetControlMessageProtocol() =
default;
49 error_messages -> write(
"ICMP received a packet\n");
59 switch (
icmp -> type) {
86 error_messages -> write(
"ICMP: Sending echo request\n");
98 error_messages -> write(
"ICMP: Echo request sent\n");
A stream that strings can be written to.
Stores the left, top, width and height of a rectangle.
Handles the payload of a specific IP protocol.
void send(InternetProtocolAddress destination_ip, uint8_t *payload_data, uint32_t size)
Sends an IP packet.
InternetControlMessageProtocol(InternetProtocolHandler *internet_protocol_handler, common::OutputStream *error_messages)
Constructs an InternetControlMessageProtocol handler.
bool handle_internet_protocol_payload(net::InternetProtocolAddress src_ip_be, net::InternetProtocolAddress dst_ip_be, uint8_t *payload_data, uint32_t size) final
Called by the InternetProtocolProvider when a new packet has arrived.
void request_echo_reply(uint32_t ip_be)
Sends an ICMP echo request to the specified IP address.
Handles IPv4 packets over Ethernet frames.
static uint16_t checksum(const uint16_t *data, uint32_t length_in_bytes)
Creates a checksum for the given data.
Defines the Internet Control Message Protocol (ICMP) handler for network communication.
uint32_t InternetProtocolAddress
An IPv4 address.