Kernel: Make better abstractions for networking

This commit is contained in:
2024-02-06 12:30:01 +02:00
parent f804e87f7d
commit 5da59c9151
19 changed files with 566 additions and 264 deletions

View File

@@ -32,19 +32,4 @@ namespace Kernel
m_name[3] = minor(m_rdev) + '0';
}
size_t NetworkInterface::interface_header_size() const
{
ASSERT(m_type == Type::Ethernet);
return sizeof(EthernetHeader);
}
void NetworkInterface::add_interface_header(BAN::ByteSpan packet, BAN::MACAddress destination)
{
ASSERT(m_type == Type::Ethernet);
auto& header = packet.as<EthernetHeader>();
header.dst_mac = destination;
header.src_mac = get_mac_address();
header.ether_type = 0x0800;
}
}