Commit | Line | Data |
---|---|---|
8ae0e4b4 KM |
1 | /* |
2 | * Copyright (c) 1982 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
8a0ea807 | 6 | * @(#)if_ether.h 6.7 (Berkeley) %G% |
8ae0e4b4 | 7 | */ |
66b2ba82 SL |
8 | |
9 | /* | |
10 | * Structure of a 10Mb/s Ethernet header. | |
11 | */ | |
3fa8d9bb | 12 | struct ether_header { |
12026cce MK |
13 | u_char ether_dhost[6]; |
14 | u_char ether_shost[6]; | |
3fa8d9bb | 15 | u_short ether_type; |
66b2ba82 SL |
16 | }; |
17 | ||
12026cce MK |
18 | #define ETHERTYPE_PUP 0x0200 /* PUP protocol */ |
19 | #define ETHERTYPE_IP 0x0800 /* IP protocol */ | |
20 | #define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ | |
66b2ba82 SL |
21 | |
22 | /* | |
12026cce | 23 | * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have |
8a0ea807 MK |
24 | * (type-ETHERTYPE_TRAIL)*512 bytes of data followed |
25 | * by an ETHER type (as given above) and then the (variable-length) header. | |
66b2ba82 | 26 | */ |
12026cce MK |
27 | #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ |
28 | #define ETHERTYPE_NTRAILER 16 | |
3fa8d9bb SL |
29 | |
30 | #define ETHERMTU 1500 | |
31 | #define ETHERMIN (60-14) | |
8ae4cebd | 32 | |
8ae4cebd SL |
33 | /* |
34 | * Ethernet Address Resolution Protocol. | |
35 | * | |
36 | * See RFC 826 for protocol description. Structure below is adapted | |
37 | * to resolving internet addresses. Field names used correspond to | |
38 | * RFC 826. | |
39 | */ | |
40 | struct ether_arp { | |
8a0ea807 | 41 | struct arphdr ea_hdr; /* fixed-size header */ |
12026cce MK |
42 | u_char arp_sha[6]; /* sender hardware address */ |
43 | u_char arp_spa[4]; /* sender protocol address */ | |
44 | u_char arp_tha[6]; /* target hardware address */ | |
45 | u_char arp_tpa[4]; /* target protocol address */ | |
8ae4cebd | 46 | }; |
8a0ea807 MK |
47 | #define arp_hrd ea_hdr.ar_hrd |
48 | #define arp_pro ea_hdr.ar_pro | |
49 | #define arp_hln ea_hdr.ar_hln | |
50 | #define arp_pln ea_hdr.ar_pln | |
51 | #define arp_op ea_hdr.ar_op | |
52 | ||
8ae4cebd | 53 | |
8ae4cebd SL |
54 | /* |
55 | * Structure shared between the ethernet driver modules and | |
56 | * the address resolution code. For example, each ec_softc or il_softc | |
57 | * begins with this structure. | |
58 | */ | |
59 | struct arpcom { | |
12026cce MK |
60 | struct ifnet ac_if; /* network-visible interface */ |
61 | u_char ac_enaddr[6]; /* ethernet hardware address */ | |
62 | struct in_addr ac_ipaddr; /* copy of ip address- XXX */ | |
187456a2 MK |
63 | }; |
64 | ||
65 | /* | |
66 | * Internet to ethernet address resolution table. | |
67 | */ | |
68 | struct arptab { | |
69 | struct in_addr at_iaddr; /* internet address */ | |
12026cce | 70 | u_char at_enaddr[6]; /* ethernet address */ |
187456a2 MK |
71 | u_char at_timer; /* minutes since last reference */ |
72 | u_char at_flags; /* flags */ | |
7f8f32af | 73 | struct mbuf *at_hold; /* last packet until resolved/timeout */ |
8ae4cebd SL |
74 | }; |
75 | ||
5ebce7c6 | 76 | #ifdef KERNEL |
12026cce | 77 | u_char etherbroadcastaddr[6]; |
8ae4cebd | 78 | struct arptab *arptnew(); |
8a0ea807 | 79 | char *ether_sprintf(); |
8ae4cebd | 80 | #endif |