From 8b61667924249420b6c2593458a2ce622df18429 Mon Sep 17 00:00:00 2001 From: Thomas Wagenveld Date: Mon, 2 Aug 2021 19:36:24 +0200 Subject: [PATCH] LibC: Add definition for 'struct ip' in netinet/ip.h The definition is equal to the one defined by the BSDs. --- Userland/Libraries/LibC/netinet/ip.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Userland/Libraries/LibC/netinet/ip.h b/Userland/Libraries/LibC/netinet/ip.h index 50f6a8b327..ba606d12b9 100644 --- a/Userland/Libraries/LibC/netinet/ip.h +++ b/Userland/Libraries/LibC/netinet/ip.h @@ -6,4 +6,32 @@ #pragma once +#include +#include +#include + #include "in.h" + +__BEGIN_DECLS + +struct ip { +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + uint8_t ip_v : 4; + uint8_t ip_hl : 4; +#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + uint8_t ip_hl : 4; + uint8_t ip_v : 4; +#endif + uint8_t ip_tos; + uint16_t ip_len; + uint16_t ip_id; + uint16_t ip_off; + uint8_t ip_ttl; + uint8_t ip_p; + uint16_t ip_sum; + struct in_addr ip_src; + struct in_addr ip_dst; +} __attribute__((packed)); +static_assert(sizeof(struct ip) == 20, "struct ip: invalid length"); + +__END_DECLS