June 2025 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
26 | 27 | 28 | 29 | 30 | 31 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 1 | 2 | 3 | 4 | 5 | 6 |
001: /* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. 002: This file is part of the GNU C Library. 003: 004: The GNU C Library is free software; you can redistribute it and/or 005: modify it under the terms of the GNU Lesser General Public 006: License as published by the Free Software Foundation; either 007: version 2.1 of the License, or (at your option) any later version. 008: 009: The GNU C Library is distributed in the hope that it will be useful, 010: but WITHOUT ANY WARRANTY; without even the implied warranty of 011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012: Lesser General Public License for more details. 013: 014: You should have received a copy of the GNU Lesser General Public 015: License along with the GNU C Library; if not, write to the Free 016: Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 017: 02111-1307 USA. */ 018: 019: #ifndef __NETINET_IF_ETHER_H 020: 021: #define __NETINET_IF_ETHER_H 1 022: #include <features.h> 023: #include <sys/types.h> 024: 025: /* Get definitions from kernel header file. */ 026: #include <linux/if_ether.h> 027: 028: #ifdef __USE_BSD 029: /* 030: * Copyright (c) 1982, 1986, 1993 031: * The Regents of the University of California. All rights reserved. 032: * 033: * Redistribution and use in source and binary forms, with or without 034: * modification, are permitted provided that the following conditions 035: * are met: 036: * 1. Redistributions of source code must retain the above copyright 037: * notice, this list of conditions and the following disclaimer. 038: * 2. Redistributions in binary form must reproduce the above copyright 039: * notice, this list of conditions and the following disclaimer in the 040: * documentation and/or other materials provided with the distribution. 041: * 4. Neither the name of the University nor the names of its contributors 042: * may be used to endorse or promote products derived from this software 043: * without specific prior written permission. 044: * 045: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 046: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 047: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 048: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 049: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 050: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 051: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 052: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 053: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 054: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 055: * SUCH DAMAGE. 056: * 057: * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 058: * $FreeBSD$ 059: */ 060: 061: #include <net/ethernet.h> 062: #include <net/if_arp.h> 063: 064: __BEGIN_DECLS 065: /* 066: * Ethernet Address Resolution Protocol. 067: * 068: * See RFC 826 for protocol description. Structure below is adapted 069: * to resolving internet addresses. Field names used correspond to 070: * RFC 826. 071: */ 072: struct ether_arp { 073: struct arphdr ea_hdr; /* fixed-size header */ 074: u_int8_t arp_sha[ETH_ALEN]; /* sender hardware address */ 075: u_int8_t arp_spa[4]; /* sender protocol address */ 076: u_int8_t arp_tha[ETH_ALEN]; /* target hardware address */ 077: u_int8_t arp_tpa[4]; /* target protocol address */ 078: }; 079: #define arp_hrd ea_hdr.ar_hrd 080: #define arp_pro ea_hdr.ar_pro 081: #define arp_hln ea_hdr.ar_hln 082: #define arp_pln ea_hdr.ar_pln 083: #define arp_op ea_hdr.ar_op 084: 085: /* 086: * Macro to map an IP multicast address to an Ethernet multicast address. 087: * The high-order 25 bits of the Ethernet address are statically assigned, 088: * and the low-order 23 bits are taken from the low end of the IP address. 089: */ 090: #define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ 091: /* struct in_addr *ipaddr; */ \ 092: /* u_char enaddr[ETH_ALEN]; */ \ 093: { \ 094: (enaddr)[0] = 0x01; \ 095: (enaddr)[1] = 0x00; \ 096: (enaddr)[2] = 0x5e; \ 097: (enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \ 098: (enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \ 099: (enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \ 100: } 101: 102: __END_DECLS 103: #endif /* __USE_BSD */ 104: 105: #endif /* netinet/if_ether.h */ 106: