hdr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for
6  * more details.
7  */
8 
22 #ifndef NET_ETHERNET_HDR_H
23 #define NET_ETHERNET_HDR_H
24 
25 #include <inttypes.h>
26 
27 #include "byteorder.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define ETHERNET_ADDR_LEN (6)
35 #ifndef ETH_ALEN
36 #define ETH_ALEN ETHERNET_ADDR_LEN
39 #endif
40 
44 typedef struct __attribute__((packed)) {
45  uint8_t dst[ETHERNET_ADDR_LEN];
46  uint8_t src[ETHERNET_ADDR_LEN];
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif /* NET_ETHERNET_HDR_H */
55 
byteorder.h
Functions to work with different byte orders.
be_uint16_t
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:77
ethernet_hdr_t
Ethernet header.
Definition: hdr.h:44
ETHERNET_ADDR_LEN
#define ETHERNET_ADDR_LEN
Length of an Ethernet address.
Definition: hdr.h:33
ethernet_hdr_t::type
network_uint16_t type
ether type (see Ether types)
Definition: hdr.h:47
inttypes.h
Adds include for missing inttype definitions.