2.9
[glibc/nacl-glibc.git] / sysdeps / unix / sysv / linux / netinet / if_ether.h
blobaadb59bea773a872cddcbdad525d02d94267e95c
1 /* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 #ifndef __NETINET_IF_ETHER_H
21 #define __NETINET_IF_ETHER_H 1
22 #include <features.h>
23 #include <sys/types.h>
25 /* Get definitions from kernel header file. */
26 #include <linux/if_ether.h>
28 #ifdef __USE_BSD
30 * Copyright (c) 1982, 1986, 1993
31 * The Regents of the University of California. All rights reserved.
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 4. Neither the name of the University nor the names of its contributors
42 * may be used to endorse or promote products derived from this software
43 * without specific prior written permission.
45 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
57 * @(#)if_ether.h 8.3 (Berkeley) 5/2/95
58 * $FreeBSD$
61 #include <net/ethernet.h>
62 #include <net/if_arp.h>
64 __BEGIN_DECLS
66 * Ethernet Address Resolution Protocol.
68 * See RFC 826 for protocol description. Structure below is adapted
69 * to resolving internet addresses. Field names used correspond to
70 * RFC 826.
72 struct ether_arp {
73 struct arphdr ea_hdr; /* fixed-size header */
74 u_int8_t arp_sha[ETH_ALEN]; /* sender hardware address */
75 u_int8_t arp_spa[4]; /* sender protocol address */
76 u_int8_t arp_tha[ETH_ALEN]; /* target hardware address */
77 u_int8_t arp_tpa[4]; /* target protocol address */
79 #define arp_hrd ea_hdr.ar_hrd
80 #define arp_pro ea_hdr.ar_pro
81 #define arp_hln ea_hdr.ar_hln
82 #define arp_pln ea_hdr.ar_pln
83 #define arp_op ea_hdr.ar_op
86 * Macro to map an IP multicast address to an Ethernet multicast address.
87 * The high-order 25 bits of the Ethernet address are statically assigned,
88 * and the low-order 23 bits are taken from the low end of the IP address.
90 #define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
91 /* struct in_addr *ipaddr; */ \
92 /* u_char enaddr[ETH_ALEN]; */ \
93 { \
94 (enaddr)[0] = 0x01; \
95 (enaddr)[1] = 0x00; \
96 (enaddr)[2] = 0x5e; \
97 (enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \
98 (enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \
99 (enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \
102 __END_DECLS
103 #endif /* __USE_BSD */
105 #endif /* netinet/if_ether.h */