mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 18:45:07 +00:00
Kernel: Use UnixDateTime wherever applicable
"Wherever applicable" = most places, actually :^), especially for networking and filesystem timestamps. This includes changes to unzip, which uses DOSPackedTime, since that is changed for the FAT file systems.
This commit is contained in:
parent
c1323febc2
commit
939600d2d4
41 changed files with 115 additions and 125 deletions
|
@ -26,10 +26,10 @@
|
|||
namespace Kernel {
|
||||
|
||||
static void handle_arp(EthernetFrameHeader const&, size_t frame_size);
|
||||
static void handle_ipv4(EthernetFrameHeader const&, size_t frame_size, Duration const& packet_timestamp);
|
||||
static void handle_icmp(EthernetFrameHeader const&, IPv4Packet const&, Duration const& packet_timestamp);
|
||||
static void handle_udp(IPv4Packet const&, Duration const& packet_timestamp);
|
||||
static void handle_tcp(IPv4Packet const&, Duration const& packet_timestamp);
|
||||
static void handle_ipv4(EthernetFrameHeader const&, size_t frame_size, UnixDateTime const& packet_timestamp);
|
||||
static void handle_icmp(EthernetFrameHeader const&, IPv4Packet const&, UnixDateTime const& packet_timestamp);
|
||||
static void handle_udp(IPv4Packet const&, UnixDateTime const& packet_timestamp);
|
||||
static void handle_tcp(IPv4Packet const&, UnixDateTime const& packet_timestamp);
|
||||
static void send_delayed_tcp_ack(TCPSocket& socket);
|
||||
static void send_tcp_rst(IPv4Packet const& ipv4_packet, TCPPacket const& tcp_packet, RefPtr<NetworkAdapter> adapter);
|
||||
static void flush_delayed_tcp_acks();
|
||||
|
@ -74,7 +74,7 @@ void NetworkTask_main(void*)
|
|||
};
|
||||
});
|
||||
|
||||
auto dequeue_packet = [&pending_packets](u8* buffer, size_t buffer_size, Duration& packet_timestamp) -> size_t {
|
||||
auto dequeue_packet = [&pending_packets](u8* buffer, size_t buffer_size, UnixDateTime& packet_timestamp) -> size_t {
|
||||
if (pending_packets == 0)
|
||||
return 0;
|
||||
size_t packet_size = 0;
|
||||
|
@ -94,7 +94,7 @@ void NetworkTask_main(void*)
|
|||
TODO();
|
||||
auto buffer_region = region_or_error.release_value();
|
||||
auto buffer = (u8*)buffer_region->vaddr().get();
|
||||
Duration packet_timestamp;
|
||||
UnixDateTime packet_timestamp;
|
||||
|
||||
for (;;) {
|
||||
flush_delayed_tcp_acks();
|
||||
|
@ -177,7 +177,7 @@ void handle_arp(EthernetFrameHeader const& eth, size_t frame_size)
|
|||
}
|
||||
}
|
||||
|
||||
void handle_ipv4(EthernetFrameHeader const& eth, size_t frame_size, Duration const& packet_timestamp)
|
||||
void handle_ipv4(EthernetFrameHeader const& eth, size_t frame_size, UnixDateTime const& packet_timestamp)
|
||||
{
|
||||
constexpr size_t minimum_ipv4_frame_size = sizeof(EthernetFrameHeader) + sizeof(IPv4Packet);
|
||||
if (frame_size < minimum_ipv4_frame_size) {
|
||||
|
@ -222,7 +222,7 @@ void handle_ipv4(EthernetFrameHeader const& eth, size_t frame_size, Duration con
|
|||
}
|
||||
}
|
||||
|
||||
void handle_icmp(EthernetFrameHeader const& eth, IPv4Packet const& ipv4_packet, Duration const& packet_timestamp)
|
||||
void handle_icmp(EthernetFrameHeader const& eth, IPv4Packet const& ipv4_packet, UnixDateTime const& packet_timestamp)
|
||||
{
|
||||
auto& icmp_header = *static_cast<ICMPHeader const*>(ipv4_packet.payload());
|
||||
dbgln_if(ICMP_DEBUG, "handle_icmp: source={}, destination={}, type={:#02x}, code={:#02x}", ipv4_packet.source().to_string(), ipv4_packet.destination().to_string(), icmp_header.type(), icmp_header.code());
|
||||
|
@ -273,7 +273,7 @@ void handle_icmp(EthernetFrameHeader const& eth, IPv4Packet const& ipv4_packet,
|
|||
}
|
||||
}
|
||||
|
||||
void handle_udp(IPv4Packet const& ipv4_packet, Duration const& packet_timestamp)
|
||||
void handle_udp(IPv4Packet const& ipv4_packet, UnixDateTime const& packet_timestamp)
|
||||
{
|
||||
if (ipv4_packet.payload_size() < sizeof(UDPPacket)) {
|
||||
dbgln("handle_udp: Packet too small ({}, need {})", ipv4_packet.payload_size(), sizeof(UDPPacket));
|
||||
|
@ -367,7 +367,7 @@ void send_tcp_rst(IPv4Packet const& ipv4_packet, TCPPacket const& tcp_packet, Re
|
|||
routing_decision.adapter->release_packet_buffer(*packet);
|
||||
}
|
||||
|
||||
void handle_tcp(IPv4Packet const& ipv4_packet, Duration const& packet_timestamp)
|
||||
void handle_tcp(IPv4Packet const& ipv4_packet, UnixDateTime const& packet_timestamp)
|
||||
{
|
||||
if (ipv4_packet.payload_size() < sizeof(TCPPacket)) {
|
||||
dbgln("handle_tcp: IPv4 payload is too small to be a TCP packet ({}, need {})", ipv4_packet.payload_size(), sizeof(TCPPacket));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue