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