mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:37:35 +00:00
AK: Add Endian.h header to replace NetworkOrdered.h.
This commit is contained in:
parent
ecf6cbbd02
commit
10c6f062b3
20 changed files with 195 additions and 106 deletions
|
@ -26,8 +26,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Endian.h>
|
||||
#include <AK/MACAddress.h>
|
||||
#include <AK/NetworkOrdered.h>
|
||||
#include <Kernel/Net/EtherType.h>
|
||||
#include <Kernel/Net/IPv4.h>
|
||||
|
||||
|
|
|
@ -26,16 +26,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Endian.h>
|
||||
#include <AK/MACAddress.h>
|
||||
#include <AK/NetworkOrdered.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
|
||||
class [[gnu::packed]] EthernetFrameHeader
|
||||
{
|
||||
public:
|
||||
EthernetFrameHeader() {}
|
||||
~EthernetFrameHeader() {}
|
||||
EthernetFrameHeader() { }
|
||||
~EthernetFrameHeader() { }
|
||||
|
||||
MACAddress destination() const { return m_destination; }
|
||||
void set_destination(const MACAddress& address) { m_destination = address; }
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Endian.h>
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/NetworkOrdered.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
|
@ -131,7 +131,7 @@ inline NetworkOrdered<u16> internet_checksum(const void* ptr, size_t count)
|
|||
u32 checksum = 0;
|
||||
auto* w = (const u16*)ptr;
|
||||
while (count > 1) {
|
||||
checksum += convert_between_host_and_network(*w++);
|
||||
checksum += AK::convert_between_host_and_network_endian(*w++);
|
||||
if (checksum & 0x80000000)
|
||||
checksum = (checksum & 0xffff) | (checksum >> 16);
|
||||
count -= 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue