Last change
on this file since daa8db7 was
daa8db7,
checked in by Jennifer Averett <Jennifer.Averett@…>, on 09/15/03 at 14:39:41
|
2003-09-15 Jay Monkman <jtm@…>
PR 481/networking
- net/ethernet.h, net/if_arp.h, netinet/if_ether.h: Network structs
should be packed
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | /* |
---|
2 | * Fundamental constants relating to ethernet. |
---|
3 | * |
---|
4 | * $Id$ |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef _NET_ETHERNET_H_ |
---|
9 | #define _NET_ETHERNET_H_ |
---|
10 | |
---|
11 | #include <netinet/in.h> |
---|
12 | |
---|
13 | /* |
---|
14 | * The number of bytes in an ethernet (MAC) address. |
---|
15 | */ |
---|
16 | #define ETHER_ADDR_LEN 6 |
---|
17 | |
---|
18 | /* |
---|
19 | * The number of bytes in the type field. |
---|
20 | */ |
---|
21 | #define ETHER_TYPE_LEN 2 |
---|
22 | |
---|
23 | /* |
---|
24 | * The number of bytes in the trailing CRC field. |
---|
25 | */ |
---|
26 | #define ETHER_CRC_LEN 4 |
---|
27 | |
---|
28 | /* |
---|
29 | * The length of the combined header. |
---|
30 | */ |
---|
31 | #define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) |
---|
32 | |
---|
33 | /* |
---|
34 | * The minimum packet length. |
---|
35 | */ |
---|
36 | #define ETHER_MIN_LEN 64 |
---|
37 | |
---|
38 | /* |
---|
39 | * The maximum packet length. |
---|
40 | */ |
---|
41 | #define ETHER_MAX_LEN 1518 |
---|
42 | |
---|
43 | /* |
---|
44 | * A macro to validate a length with |
---|
45 | */ |
---|
46 | #define ETHER_IS_VALID_LEN(foo) \ |
---|
47 | ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) |
---|
48 | |
---|
49 | /* |
---|
50 | * Structure of a 10Mb/s Ethernet header. |
---|
51 | */ |
---|
52 | struct ether_header { |
---|
53 | u_char ether_dhost[ETHER_ADDR_LEN]; |
---|
54 | u_char ether_shost[ETHER_ADDR_LEN]; |
---|
55 | u_short ether_type BYTE_PACK; |
---|
56 | }; |
---|
57 | |
---|
58 | /* |
---|
59 | * Structure of a 48-bit Ethernet address. |
---|
60 | */ |
---|
61 | struct ether_addr { |
---|
62 | u_char octet[ETHER_ADDR_LEN]; |
---|
63 | }; |
---|
64 | |
---|
65 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.