Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: fusl/include/net/ethernet.h

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #ifndef _NET_ETHERNET_H 1 #ifndef _NET_ETHERNET_H
2 #define _NET_ETHERNET_H 2 #define _NET_ETHERNET_H
3 3
4 #ifdef __cplusplus 4 #ifdef __cplusplus
5 extern "C" { 5 extern "C" {
6 #endif 6 #endif
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <netinet/if_ether.h> 10 #include <netinet/if_ether.h>
11 11
12 struct ether_addr { 12 struct ether_addr {
13 » uint8_t ether_addr_octet[ETH_ALEN]; 13 uint8_t ether_addr_octet[ETH_ALEN];
14 }; 14 };
15 15
16 struct ether_header { 16 struct ether_header {
17 » uint8_t ether_dhost[ETH_ALEN]; 17 uint8_t ether_dhost[ETH_ALEN];
18 » uint8_t ether_shost[ETH_ALEN]; 18 uint8_t ether_shost[ETH_ALEN];
19 » uint16_t ether_type; 19 uint16_t ether_type;
20 }; 20 };
21 21
22 #define»ETHERTYPE_PUP» » 0x0200 22 #define ETHERTYPE_PUP 0x0200
23 #define ETHERTYPE_SPRITE» 0x0500 23 #define ETHERTYPE_SPRITE 0x0500
24 #define»ETHERTYPE_IP» » 0x0800 24 #define ETHERTYPE_IP 0x0800
25 #define»ETHERTYPE_ARP» » 0x0806 25 #define ETHERTYPE_ARP 0x0806
26 #define»ETHERTYPE_REVARP» 0x8035 26 #define ETHERTYPE_REVARP 0x8035
27 #define ETHERTYPE_AT» » 0x809B 27 #define ETHERTYPE_AT 0x809B
28 #define ETHERTYPE_AARP» » 0x80F3 28 #define ETHERTYPE_AARP 0x80F3
29 #define»ETHERTYPE_VLAN» » 0x8100 29 #define ETHERTYPE_VLAN 0x8100
30 #define ETHERTYPE_IPX» » 0x8137 30 #define ETHERTYPE_IPX 0x8137
31 #define»ETHERTYPE_IPV6» » 0x86dd 31 #define ETHERTYPE_IPV6 0x86dd
32 #define ETHERTYPE_LOOPBACK» 0x9000 32 #define ETHERTYPE_LOOPBACK 0x9000
33 33
34 #define ETHER_ADDR_LEN ETH_ALEN
35 #define ETHER_TYPE_LEN 2
36 #define ETHER_CRC_LEN 4
37 #define ETHER_HDR_LEN ETH_HLEN
38 #define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN)
39 #define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN)
34 40
35 #define»ETHER_ADDR_LEN» ETH_ALEN 41 #define ETHER_IS_VALID_LEN(foo) \
36 #define»ETHER_TYPE_LEN» 2 42 ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
37 #define»ETHER_CRC_LEN» 4
38 #define»ETHER_HDR_LEN» ETH_HLEN
39 #define»ETHER_MIN_LEN» (ETH_ZLEN + ETHER_CRC_LEN)
40 #define»ETHER_MAX_LEN» (ETH_FRAME_LEN + ETHER_CRC_LEN)
41 43
42 #define»ETHER_IS_VALID_LEN(foo)»\ 44 #define ETHERTYPE_TRAIL 0x1000
43 » ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) 45 #define ETHERTYPE_NTRAILER 16
44 46
45 #define»ETHERTYPE_TRAIL»» 0x1000 47 #define ETHERMTU ETH_DATA_LEN
46 #define»ETHERTYPE_NTRAILER» 16 48 #define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
47
48 #define»ETHERMTU» ETH_DATA_LEN
49 #define»ETHERMIN» (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
50 49
51 #ifdef __cplusplus 50 #ifdef __cplusplus
52 } 51 }
53 #endif 52 #endif
54 53
55 #endif 54 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698