| 1 | /* Modified for emx by hv 1994,1996
|
|---|
| 2 | * Modified for gcc by bird 2003
|
|---|
| 3 | *
|
|---|
| 4 | * Copyright (c) 1982, 1986 Regents of the University of California.
|
|---|
| 5 | * All rights reserved.
|
|---|
| 6 | *
|
|---|
| 7 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 8 | * modification, are permitted provided that the following conditions
|
|---|
| 9 | * are met:
|
|---|
| 10 | * 1. Redistributions of source code must retain the above copyright
|
|---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 12 | * 2. Redistributions in binary form must reproduce the above copyright
|
|---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 14 | * documentation and/or other materials provided with the distribution.
|
|---|
| 15 | * 3. All advertising materials mentioning features or use of this software
|
|---|
| 16 | * must display the following acknowledgement:
|
|---|
| 17 | * This product includes software developed by the University of
|
|---|
| 18 | * California, Berkeley and its contributors.
|
|---|
| 19 | * 4. Neither the name of the University nor the names of its contributors
|
|---|
| 20 | * may be used to endorse or promote products derived from this software
|
|---|
| 21 | * without specific prior written permission.
|
|---|
| 22 | *
|
|---|
| 23 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|---|
| 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|---|
| 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|---|
| 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|---|
| 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|---|
| 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|---|
| 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|---|
| 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|---|
| 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|---|
| 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|---|
| 33 | * SUCH DAMAGE.
|
|---|
| 34 | *
|
|---|
| 35 | * from: @(#)if_ether.h 7.5 (Berkeley) 6/28/90
|
|---|
| 36 | * $Id: if_ether.h,v 1.8 1994/02/02 05:58:54 hpeyerl Exp $
|
|---|
| 37 | */
|
|---|
| 38 |
|
|---|
| 39 | #ifndef _NETINET_IF_ETHER_H_
|
|---|
| 40 | #define _NETINET_IF_ETHER_H_
|
|---|
| 41 |
|
|---|
| 42 | #ifdef TCPV40HDRS
|
|---|
| 43 |
|
|---|
| 44 | /*
|
|---|
| 45 | * Structure of a 10Mb/s Ethernet header.
|
|---|
| 46 | */
|
|---|
| 47 | struct ether_header {
|
|---|
| 48 | u_char ether_dhost[6];
|
|---|
| 49 | u_char ether_shost[6];
|
|---|
| 50 | u_short ether_type;
|
|---|
| 51 | };
|
|---|
| 52 |
|
|---|
| 53 | #define ETHERTYPE_PUP 0x0200 /* PUP protocol */
|
|---|
| 54 | #define ETHERTYPE_IP 0x0800 /* IP protocol */
|
|---|
| 55 | #ifdef OS2 /* hv thinks this is just a dirty hack, but we must include it. */
|
|---|
| 56 | #define ETHERTYPE_ARP 0x0608 /* address resolution protocol */
|
|---|
| 57 | #else
|
|---|
| 58 | #define ETHERTYPE_ARP 0x0806 /* address resolution protocol */
|
|---|
| 59 | #endif
|
|---|
| 60 |
|
|---|
| 61 | /*
|
|---|
| 62 | * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
|
|---|
| 63 | * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
|
|---|
| 64 | * by an ETHER type (as given above) and then the (variable-length) header.
|
|---|
| 65 | */
|
|---|
| 66 | #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
|
|---|
| 67 | #define ETHERTYPE_NTRAILER 16
|
|---|
| 68 |
|
|---|
| 69 | #define ETHERMTU 1500
|
|---|
| 70 | #define ETHERMIN (60-14)
|
|---|
| 71 |
|
|---|
| 72 | /*
|
|---|
| 73 | * Ethernet Address Resolution Protocol.
|
|---|
| 74 | *
|
|---|
| 75 | * See RFC 826 for protocol description. Structure below is adapted
|
|---|
| 76 | * to resolving internet addresses. Field names used correspond to
|
|---|
| 77 | * RFC 826.
|
|---|
| 78 | */
|
|---|
| 79 | struct ether_arp {
|
|---|
| 80 | struct arphdr ea_hdr; /* fixed-size header */
|
|---|
| 81 | u_char arp_sha[6]; /* sender hardware address */
|
|---|
| 82 | u_char arp_spa[4]; /* sender protocol address */
|
|---|
| 83 | u_char arp_tha[6]; /* target hardware address */
|
|---|
| 84 | u_char arp_tpa[4]; /* target protocol address */
|
|---|
| 85 | };
|
|---|
| 86 | #define arp_hrd ea_hdr.ar_hrd
|
|---|
| 87 | #define arp_pro ea_hdr.ar_pro
|
|---|
| 88 | #define arp_hln ea_hdr.ar_hln
|
|---|
| 89 | #define arp_pln ea_hdr.ar_pln
|
|---|
| 90 | #define arp_op ea_hdr.ar_op
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 | /*
|
|---|
| 94 | * Structure shared between the ethernet driver modules and
|
|---|
| 95 | * the address resolution code. For example, each ec_softc or il_softc
|
|---|
| 96 | * begins with this structure.
|
|---|
| 97 | */
|
|---|
| 98 | struct arpcom {
|
|---|
| 99 | struct ifnet ac_if; /* network-visible interface */
|
|---|
| 100 | u_char ac_enaddr[6]; /* ethernet hardware address */
|
|---|
| 101 | struct in_addr ac_ipaddr; /* copy of ip address- XXX */
|
|---|
| 102 | /* not os2 */
|
|---|
| 103 | /* struct ether_multi *ac_multiaddrs;*/ /* list of ether multicast addrs */
|
|---|
| 104 | /* int ac_multicnt;*/ /* length of ac_multiaddrs list */
|
|---|
| 105 | };
|
|---|
| 106 |
|
|---|
| 107 | /*
|
|---|
| 108 | * Internet to ethernet address resolution table.
|
|---|
| 109 | */
|
|---|
| 110 | #pragma pack(1)
|
|---|
| 111 | struct arptab {
|
|---|
| 112 | struct in_addr at_iaddr; /* internet address */
|
|---|
| 113 | u_char at_enaddr[6]; /* ethernet address */
|
|---|
| 114 | u_char at_timer; /* minutes since last reference */
|
|---|
| 115 | u_char at_flags; /* flags */
|
|---|
| 116 | struct mbuf *at_hold; /* last packet until resolved/timeout */
|
|---|
| 117 | /* only os2 */
|
|---|
| 118 | u_short at_rcf; /* token ring routing control field */
|
|---|
| 119 | u_short at_rseg[8]; /* token ring routing segments */
|
|---|
| 120 | #ifdef OS2
|
|---|
| 121 | u_long at_millisec; /* TOD millsecons of last update */
|
|---|
| 122 | short at_interface; /* interface index */
|
|---|
| 123 | #endif
|
|---|
| 124 | };
|
|---|
| 125 | #pragma pack()
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 | #else /*TCPV40HDRS*/
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 | #pragma pack(1)
|
|---|
| 132 | struct sockaddr_inarp {
|
|---|
| 133 | u_char sin_len;
|
|---|
| 134 | u_char sin_family;
|
|---|
| 135 | u_short sin_port;
|
|---|
| 136 | struct in_addr sin_addr;
|
|---|
| 137 | struct in_addr sin_srcaddr;
|
|---|
| 138 | u_short sin_tos;
|
|---|
| 139 | u_short sin_other;
|
|---|
| 140 | #define SIN_PROXY 1
|
|---|
| 141 | };
|
|---|
| 142 | struct oarptab {
|
|---|
| 143 | struct in_addr at_iaddr; /* internet address */
|
|---|
| 144 | u_char at_enaddr[6]; /* ethernet address */
|
|---|
| 145 | u_char at_timer; /* minutes since last reference */
|
|---|
| 146 | u_char at_flags; /* flags */
|
|---|
| 147 | void * at_hold;
|
|---|
| 148 | u_short at_rcf; /* token ring routing control field */
|
|---|
| 149 | u_short at_rseg[8]; /* token ring routing segments */
|
|---|
| 150 | u_long at_millisec; /* TOD milliseconds of last update */
|
|---|
| 151 | u_short at_interface; /* interface index */
|
|---|
| 152 | };
|
|---|
| 153 | #pragma pack()
|
|---|
| 154 |
|
|---|
| 155 | /*
|
|---|
| 156 | * IP and ethernet specific routing flags
|
|---|
| 157 | */
|
|---|
| 158 | #define RTF_USETRAILERS RTF_PROTO1 /* use trailers */
|
|---|
| 159 | #define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 | #endif /*TCPV40HDRS (else) */
|
|---|
| 163 |
|
|---|
| 164 | #endif /* !_NETINET_IF_ETHER_H_ */
|
|---|