mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:48:11 +00:00
LibC: Add definition for 'struct ip' in netinet/ip.h
The definition is equal to the one defined by the BSDs.
This commit is contained in:
parent
0c4977161f
commit
8b61667924
1 changed files with 28 additions and 0 deletions
|
@ -6,4 +6,32 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <bits/stdint.h>
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
#include "in.h"
|
#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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue