Last change
on this file since 302 was 279, checked in by coas-nagasima, 7 years ago |
ファイルを追加、更新。
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Id
-
Property svn:mime-type
set to
text/x-chdr
|
File size:
1.1 KB
|
Line | |
---|
1 | #ifndef _NET_ETHERNET_H
|
---|
2 | #define _NET_ETHERNET_H
|
---|
3 |
|
---|
4 | #ifdef __cplusplus
|
---|
5 | extern "C" {
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #include <stdint.h>
|
---|
9 | #include <sys/types.h>
|
---|
10 | #include <netinet/if_ether.h>
|
---|
11 |
|
---|
12 | struct ether_addr {
|
---|
13 | uint8_t ether_addr_octet[ETH_ALEN];
|
---|
14 | };
|
---|
15 |
|
---|
16 | struct ether_header {
|
---|
17 | uint8_t ether_dhost[ETH_ALEN];
|
---|
18 | uint8_t ether_shost[ETH_ALEN];
|
---|
19 | uint16_t ether_type;
|
---|
20 | };
|
---|
21 |
|
---|
22 | #define ETHERTYPE_PUP 0x0200
|
---|
23 | #define ETHERTYPE_SPRITE 0x0500
|
---|
24 | #define ETHERTYPE_IP 0x0800
|
---|
25 | #define ETHERTYPE_ARP 0x0806
|
---|
26 | #define ETHERTYPE_REVARP 0x8035
|
---|
27 | #define ETHERTYPE_AT 0x809B
|
---|
28 | #define ETHERTYPE_AARP 0x80F3
|
---|
29 | #define ETHERTYPE_VLAN 0x8100
|
---|
30 | #define ETHERTYPE_IPX 0x8137
|
---|
31 | #define ETHERTYPE_IPV6 0x86dd
|
---|
32 | #define ETHERTYPE_LOOPBACK 0x9000
|
---|
33 |
|
---|
34 |
|
---|
35 | #define ETHER_ADDR_LEN ETH_ALEN
|
---|
36 | #define ETHER_TYPE_LEN 2
|
---|
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 |
|
---|
42 | #define ETHER_IS_VALID_LEN(foo) \
|
---|
43 | ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
|
---|
44 |
|
---|
45 | #define ETHERTYPE_TRAIL 0x1000
|
---|
46 | #define ETHERTYPE_NTRAILER 16
|
---|
47 |
|
---|
48 | #define ETHERMTU ETH_DATA_LEN
|
---|
49 | #define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
|
---|
50 |
|
---|
51 | #ifdef __cplusplus
|
---|
52 | }
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.