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 | 5 | * Redistribution and use in source and binary forms are permitted |
616d42db KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
2b6b6284 | 16 | * |
0d246a40 | 17 | * @(#)if_ether.h 7.4 (Berkeley) %G% |
8ae0e4b4 | 18 | */ |
66b2ba82 SL |
19 | |
20 | /* | |
21 | * Structure of a 10Mb/s Ethernet header. | |
22 | */ | |
3fa8d9bb | 23 | struct ether_header { |
12026cce MK |
24 | u_char ether_dhost[6]; |
25 | u_char ether_shost[6]; | |
3fa8d9bb | 26 | u_short ether_type; |
66b2ba82 SL |
27 | }; |
28 | ||
12026cce MK |
29 | #define ETHERTYPE_PUP 0x0200 /* PUP protocol */ |
30 | #define ETHERTYPE_IP 0x0800 /* IP protocol */ | |
31 | #define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ | |
66b2ba82 SL |
32 | |
33 | /* | |
12026cce | 34 | * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have |
8a0ea807 MK |
35 | * (type-ETHERTYPE_TRAIL)*512 bytes of data followed |
36 | * by an ETHER type (as given above) and then the (variable-length) header. | |
66b2ba82 | 37 | */ |
12026cce MK |
38 | #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ |
39 | #define ETHERTYPE_NTRAILER 16 | |
3fa8d9bb SL |
40 | |
41 | #define ETHERMTU 1500 | |
42 | #define ETHERMIN (60-14) | |
8ae4cebd | 43 | |
8ae4cebd SL |
44 | /* |
45 | * Ethernet Address Resolution Protocol. | |
46 | * | |
47 | * See RFC 826 for protocol description. Structure below is adapted | |
48 | * to resolving internet addresses. Field names used correspond to | |
49 | * RFC 826. | |
50 | */ | |
51 | struct ether_arp { | |
8a0ea807 | 52 | struct arphdr ea_hdr; /* fixed-size header */ |
12026cce MK |
53 | u_char arp_sha[6]; /* sender hardware address */ |
54 | u_char arp_spa[4]; /* sender protocol address */ | |
55 | u_char arp_tha[6]; /* target hardware address */ | |
56 | u_char arp_tpa[4]; /* target protocol address */ | |
8ae4cebd | 57 | }; |
8a0ea807 MK |
58 | #define arp_hrd ea_hdr.ar_hrd |
59 | #define arp_pro ea_hdr.ar_pro | |
60 | #define arp_hln ea_hdr.ar_hln | |
61 | #define arp_pln ea_hdr.ar_pln | |
62 | #define arp_op ea_hdr.ar_op | |
63 | ||
8ae4cebd | 64 | |
8ae4cebd SL |
65 | /* |
66 | * Structure shared between the ethernet driver modules and | |
67 | * the address resolution code. For example, each ec_softc or il_softc | |
68 | * begins with this structure. | |
69 | */ | |
70 | struct arpcom { | |
12026cce MK |
71 | struct ifnet ac_if; /* network-visible interface */ |
72 | u_char ac_enaddr[6]; /* ethernet hardware address */ | |
73 | struct in_addr ac_ipaddr; /* copy of ip address- XXX */ | |
187456a2 MK |
74 | }; |
75 | ||
76 | /* | |
77 | * Internet to ethernet address resolution table. | |
78 | */ | |
79 | struct arptab { | |
80 | struct in_addr at_iaddr; /* internet address */ | |
12026cce | 81 | u_char at_enaddr[6]; /* ethernet address */ |
187456a2 MK |
82 | u_char at_timer; /* minutes since last reference */ |
83 | u_char at_flags; /* flags */ | |
7f8f32af | 84 | struct mbuf *at_hold; /* last packet until resolved/timeout */ |
8ae4cebd SL |
85 | }; |
86 | ||
5ebce7c6 | 87 | #ifdef KERNEL |
0d246a40 | 88 | u_char etherbroadcastaddr[6]; |
8ae4cebd | 89 | struct arptab *arptnew(); |
0d246a40 MK |
90 | int ether_output(), ether_input(); |
91 | char *ether_sprintf(); | |
8ae4cebd | 92 | #endif |