Files
serenity/Kernel/Net/ICMP.h
sdomi 17e0ba4914 Kernel/Net: Rename IPv4 directory to IP
Commit ad73adef5d needlessly introduced an IPv4 directory.
If we were to keep it, sharing common headers between IPv4 and IPv6
would be much messier, and may potentially increase code duplication.

This change renames the IPv4 directory to IP to aid with later IPv6
porting efforts.
2024-10-04 12:04:17 +02:00

31 lines
592 B
C

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/MACAddress.h>
#include <Kernel/Net/IP/IPv4.h>
enum class ICMPType : u8 {
EchoReply = 0,
EchoRequest = 8,
};
struct [[gnu::packed]] ICMPHeader {
ICMPType type { 0 };
u8 code { 0 };
NetworkOrdered<u16> checksum { 0 };
};
static_assert(AssertSize<ICMPHeader, 4>());
struct [[gnu::packed]] ICMPEchoPacket {
ICMPHeader header;
NetworkOrdered<u16> identifier;
NetworkOrdered<u16> sequence_number;
u8 payload[];
};