feat: add ethernet & TCP/IP stack

This commit is contained in:
2026-02-17 13:19:11 +01:00
parent f7e6ce70a0
commit 20fa8a9be2
23 changed files with 2409 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
/*
* ByteOrder.hpp
* Network byte order conversion utilities
* Copyright (c) 2025 Daniel Hammer
*/
#pragma once
#include <cstdint>
namespace Net {
inline uint16_t Htons(uint16_t host) {
return (uint16_t)((host >> 8) | (host << 8));
}
inline uint16_t Ntohs(uint16_t net) {
return Htons(net);
}
inline uint32_t Htonl(uint32_t host) {
return ((host >> 24) & 0x000000FF)
| ((host >> 8) & 0x0000FF00)
| ((host << 8) & 0x00FF0000)
| ((host << 24) & 0xFF000000);
}
inline uint32_t Ntohl(uint32_t net) {
return Htonl(net);
}
}