|
Packit Service |
82fcde |
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License as published by the Free Software Foundation; either
|
|
Packit Service |
82fcde |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; if not, see
|
|
Packit Service |
82fcde |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#ifndef __NETINET_IF_ETHER_H
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#define __NETINET_IF_ETHER_H 1
|
|
Packit Service |
82fcde |
#include <features.h>
|
|
Packit Service |
82fcde |
#include <sys/types.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Get definitions from kernel header file. */
|
|
Packit Service |
82fcde |
#include <linux/if_ether.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#ifdef __USE_MISC
|
|
Packit Service |
82fcde |
/*
|
|
Packit Service |
82fcde |
* Copyright (c) 1982, 1986, 1993
|
|
Packit Service |
82fcde |
* The Regents of the University of California. All rights reserved.
|
|
Packit Service |
82fcde |
*
|
|
Packit Service |
82fcde |
* Redistribution and use in source and binary forms, with or without
|
|
Packit Service |
82fcde |
* modification, are permitted provided that the following conditions
|
|
Packit Service |
82fcde |
* are met:
|
|
Packit Service |
82fcde |
* 1. Redistributions of source code must retain the above copyright
|
|
Packit Service |
82fcde |
* notice, this list of conditions and the following disclaimer.
|
|
Packit Service |
82fcde |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
Packit Service |
82fcde |
* notice, this list of conditions and the following disclaimer in the
|
|
Packit Service |
82fcde |
* documentation and/or other materials provided with the distribution.
|
|
Packit Service |
82fcde |
* 4. Neither the name of the University nor the names of its contributors
|
|
Packit Service |
82fcde |
* may be used to endorse or promote products derived from this software
|
|
Packit Service |
82fcde |
* without specific prior written permission.
|
|
Packit Service |
82fcde |
*
|
|
Packit Service |
82fcde |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
Packit Service |
82fcde |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit Service |
82fcde |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit Service |
82fcde |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
Packit Service |
82fcde |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit Service |
82fcde |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
Packit Service |
82fcde |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
Packit Service |
82fcde |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
Packit Service |
82fcde |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
Packit Service |
82fcde |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
Packit Service |
82fcde |
* SUCH DAMAGE.
|
|
Packit Service |
82fcde |
*
|
|
Packit Service |
82fcde |
* @(#)if_ether.h 8.3 (Berkeley) 5/2/95
|
|
Packit Service |
82fcde |
* $FreeBSD$
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <net/ethernet.h>
|
|
Packit Service |
82fcde |
#include <net/if_arp.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
__BEGIN_DECLS
|
|
Packit Service |
82fcde |
/*
|
|
Packit Service |
82fcde |
* Ethernet Address Resolution Protocol.
|
|
Packit Service |
82fcde |
*
|
|
Packit Service |
82fcde |
* See RFC 826 for protocol description. Structure below is adapted
|
|
Packit Service |
82fcde |
* to resolving internet addresses. Field names used correspond to
|
|
Packit Service |
82fcde |
* RFC 826.
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
82fcde |
struct ether_arp {
|
|
Packit Service |
82fcde |
struct arphdr ea_hdr; /* fixed-size header */
|
|
Packit Service |
82fcde |
uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */
|
|
Packit Service |
82fcde |
uint8_t arp_spa[4]; /* sender protocol address */
|
|
Packit Service |
82fcde |
uint8_t arp_tha[ETH_ALEN]; /* target hardware address */
|
|
Packit Service |
82fcde |
uint8_t arp_tpa[4]; /* target protocol address */
|
|
Packit Service |
82fcde |
};
|
|
Packit Service |
82fcde |
#define arp_hrd ea_hdr.ar_hrd
|
|
Packit Service |
82fcde |
#define arp_pro ea_hdr.ar_pro
|
|
Packit Service |
82fcde |
#define arp_hln ea_hdr.ar_hln
|
|
Packit Service |
82fcde |
#define arp_pln ea_hdr.ar_pln
|
|
Packit Service |
82fcde |
#define arp_op ea_hdr.ar_op
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/*
|
|
Packit Service |
82fcde |
* Macro to map an IP multicast address to an Ethernet multicast address.
|
|
Packit Service |
82fcde |
* The high-order 25 bits of the Ethernet address are statically assigned,
|
|
Packit Service |
82fcde |
* and the low-order 23 bits are taken from the low end of the IP address.
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
82fcde |
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
|
|
Packit Service |
82fcde |
/* struct in_addr *ipaddr; */ \
|
|
Packit Service |
82fcde |
/* uint8_t enaddr[ETH_ALEN]; */ \
|
|
Packit Service |
82fcde |
{ \
|
|
Packit Service |
82fcde |
(enaddr)[0] = 0x01; \
|
|
Packit Service |
82fcde |
(enaddr)[1] = 0x00; \
|
|
Packit Service |
82fcde |
(enaddr)[2] = 0x5e; \
|
|
Packit Service |
82fcde |
(enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
|
|
Packit Service |
82fcde |
(enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
|
|
Packit Service |
82fcde |
(enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
__END_DECLS
|
|
Packit Service |
82fcde |
#endif /* __USE_MISC */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#endif /* netinet/if_ether.h */
|