Semi-decennial update. 50% code inflation.
[cbaos.git] / include / net / ethernet.h
blob6f36a27e6b7d3667b9594397367648b119a2870d
1 #ifndef ETHERNET_H_
2 #define ETHERNET_H_
4 #include <list.h>
5 #include <types.h>
6 #include <compiler.h>
7 #include <net.h>
10 /* link layer */
11 #define ETHERTYPE_IP 0x0800
12 #define ETHERTYPE_ARP 0x0806
14 struct ethernet_frame {
15 union {
16 u8 raw[14];
17 struct {
18 mac_t dest;
19 mac_t src;
20 u8 type[2];
21 u8 payload[0];
24 } __packed;
27 struct eth_handler {
28 struct list list;
29 u16 ethertype;
30 int (*handler)(u8 *buf, size_t len);
33 int eth_init(void);
34 int eth_register_handler(struct eth_handler *han);
36 extern const mac_t mac_bcast; // XXX move elsewhere
37 extern const ip_t ip_bcast;
39 #endif