My Kernel v0.1.0
net.h
1
49#ifndef KERNEL_NET_H
50#define KERNEL_NET_H
51
52#include <kernel/types.h>
53#include <uapi/kernel/net.h>
54
55#include <utils/bits.h>
56
57struct sockaddr_mac {
58 sa_family_t mac_family; /* AF_UNSPEC */
59 uint8_t mac_addr[6];
60};
61
62#define htons htobe16
63#define ntohs be16toh
64#define htonl htobe32
65#define ntohl be32toh
66
68#define hton(_x) \
69 _Generic((_x), uint16_t \
70 : htons((_x)), uint32_t \
71 : htonl((_x)), default \
72 : (_x))
73
75#define ntoh(_x) \
76 _Generic((_x), uint16_t \
77 : ntohs((_x)), uint32_t \
78 : ntohl((_x)), default \
79 : (_x))
80
85u16 net_internet_checksum(const u16 *addr, size_t size);
86
87#endif /* KERNEL_NET_H */
88
u16 net_internet_checksum(const u16 *addr, size_t size)
Compute Internet Checksum for size bytes beginning at location addr.
Definition: net.c:4