xref: /netbsd-src/sys/netinet/if_ether.h (revision 157195c85ee5877687c982b7f2ec8ba3049f3bf3)
1*157195c8Sroy /*	$NetBSD: if_ether.h,v 1.37 2021/02/03 17:10:13 roy Exp $	*/
2240cc291Sis 
3240cc291Sis /*
4240cc291Sis  * Copyright (c) 1982, 1986, 1993
5240cc291Sis  *	The Regents of the University of California.  All rights reserved.
6240cc291Sis  *
7240cc291Sis  * Redistribution and use in source and binary forms, with or without
8240cc291Sis  * modification, are permitted provided that the following conditions
9240cc291Sis  * are met:
10240cc291Sis  * 1. Redistributions of source code must retain the above copyright
11240cc291Sis  *    notice, this list of conditions and the following disclaimer.
12240cc291Sis  * 2. Redistributions in binary form must reproduce the above copyright
13240cc291Sis  *    notice, this list of conditions and the following disclaimer in the
14240cc291Sis  *    documentation and/or other materials provided with the distribution.
15aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
16240cc291Sis  *    may be used to endorse or promote products derived from this software
17240cc291Sis  *    without specific prior written permission.
18240cc291Sis  *
19240cc291Sis  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20240cc291Sis  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21240cc291Sis  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22240cc291Sis  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23240cc291Sis  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24240cc291Sis  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25240cc291Sis  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26240cc291Sis  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27240cc291Sis  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28240cc291Sis  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29240cc291Sis  * SUCH DAMAGE.
30240cc291Sis  *
31e5e283e0Sthorpej  *	@(#)if_ether.h	8.3 (Berkeley) 5/2/95
32240cc291Sis  */
33240cc291Sis 
34f73530baSperry #ifndef _NETINET_IF_ETHER_H_
35f73530baSperry #define _NETINET_IF_ETHER_H_
36f73530baSperry 
37240cc291Sis 
38240cc291Sis #ifdef _KERNEL
39240cc291Sis #error You should NOT be doing this.
40240cc291Sis /*
41240cc291Sis  * XXX This file is for compatibility to externally maintained packages
42240cc291Sis  * ONLY, or to help porting them if the other way round is not possible.
43240cc291Sis  * Kernel drivers should be properly ported.
44240cc291Sis  */
45240cc291Sis #endif
46240cc291Sis 
47240cc291Sis 
48240cc291Sis #ifndef _netinet_if_ether_compat_h_
49240cc291Sis #define _netinet_if_ether_compat_h_
50240cc291Sis 
51240cc291Sis /* pull in Ethernet-specific definitions and packet structures */
52240cc291Sis 
53240cc291Sis #include <net/if_ether.h>
54240cc291Sis 
55240cc291Sis /* pull in ARP-specific definitions and packet structures */
56240cc291Sis 
57240cc291Sis #include <net/if_arp.h>
58240cc291Sis 
59240cc291Sis /* pull in ARP-over-Ethernet-specific definitions and packet structures */
60240cc291Sis #include <netinet/if_inarp.h>
61240cc291Sis 
62240cc291Sis /* ... and define some more which we don't need anymore: */
63240cc291Sis 
64240cc291Sis /*
65240cc291Sis  * Ethernet Address Resolution Protocol.
66240cc291Sis  *
67240cc291Sis  * See RFC 826 for protocol description.  Structure below is not
68a38b4eceSsketch  * used by our kernel!!! Only for userland programs which are externally
69240cc291Sis  * maintained and need it.
70240cc291Sis  */
71240cc291Sis 
72240cc291Sis struct	ether_arp {
73240cc291Sis 	struct	 arphdr ea_hdr;			/* fixed-size header */
74240cc291Sis 	u_int8_t arp_sha[ETHER_ADDR_LEN];	/* sender hardware address */
75240cc291Sis 	u_int8_t arp_spa[4];			/* sender protocol address */
76240cc291Sis 	u_int8_t arp_tha[ETHER_ADDR_LEN];	/* target hardware address */
77240cc291Sis 	u_int8_t arp_tpa[4];			/* target protocol address */
781ca39e87Sroy };
79*157195c8Sroy #ifdef CTASSERT
807a849d03Sroy CTASSERT(sizeof(struct ether_arp) == 28);
81*157195c8Sroy #endif
82240cc291Sis #define	arp_hrd	ea_hdr.ar_hrd
83240cc291Sis #define	arp_pro	ea_hdr.ar_pro
84240cc291Sis #define	arp_hln	ea_hdr.ar_hln
85240cc291Sis #define	arp_pln	ea_hdr.ar_pln
86240cc291Sis #define	arp_op	ea_hdr.ar_op
87240cc291Sis 
88240cc291Sis #endif /* _netinet_if_ether_compat_h_ */
89f73530baSperry 
909702e987Selad #endif /* !_NETINET_IF_ETHER_H_ */
91