Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / mach / hurd / net / ethernet.h
blob3b2b47398033b6dcd6835cdeb2bdbfbedecb2793
1 /* Copyright (C) 1997-2014 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, see
16 <http://www.gnu.org/licenses/>. */
18 /* Based on the FreeBSD version of this file. Curiously, that file
19 lacks a copyright in the header. */
21 #ifndef __NET_ETHERNET_H
22 #define __NET_ETHERNET_H 1
24 #include <sys/cdefs.h>
25 #include <sys/types.h>
26 #include <net/if_ether.h> /* IEEE 802.3 Ethernet constants */
28 __BEGIN_DECLS
30 /* This is a name for the 48 bit ethernet address available on many
31 systems. */
32 struct ether_addr
34 u_int8_t ether_addr_octet[ETH_ALEN];
37 /* 10Mb/s ethernet header */
38 struct ether_header
40 u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
41 u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */
42 u_int16_t ether_type; /* packet type ID field */
45 /* Ethernet protocol ID's */
46 #define ETHERTYPE_PUP 0x0200 /* Xerox PUP */
47 #define ETHERTYPE_IP 0x0800 /* IP */
48 #define ETHERTYPE_ARP 0x0806 /* Address resolution */
49 #define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */
51 #define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */
52 #define ETHER_TYPE_LEN 2 /* bytes in type field */
53 #define ETHER_CRC_LEN 4 /* bytes in CRC field */
54 #define ETHER_HDR_LEN ETH_HLEN /* total octets in header */
55 #define ETHER_MIN_LEN (ETH_ZLEN + ETH_CRC_LEN) /* min packet length */
56 #define ETHER_MAX_LEN (ETH_FRAME_LEN + ETH_CRC_LEN) /* max packet length */
58 /* make sure ethenet length is valid */
59 #define ETHER_IS_VALID_LEN(foo) \
60 ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
63 * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
64 * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
65 * by an ETHER type (as given above) and then the (variable-length) header.
67 #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
68 #define ETHERTYPE_NTRAILER 16
70 #define ETHERMTU ETH_DATA_LEN
71 #define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
73 __END_DECLS
75 #endif /* net/ethernet.h */