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