1df8bae1dSRodney W. Grimes /* 2df8bae1dSRodney W. Grimes * Copyright (c) 1986, 1993 3df8bae1dSRodney W. Grimes * The Regents of the University of California. All rights reserved. 4df8bae1dSRodney W. Grimes * 5df8bae1dSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 6df8bae1dSRodney W. Grimes * modification, are permitted provided that the following conditions 7df8bae1dSRodney W. Grimes * are met: 8df8bae1dSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 9df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer. 10df8bae1dSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 11df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 12df8bae1dSRodney W. Grimes * documentation and/or other materials provided with the distribution. 13df8bae1dSRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 14df8bae1dSRodney W. Grimes * must display the following acknowledgement: 15df8bae1dSRodney W. Grimes * This product includes software developed by the University of 16df8bae1dSRodney W. Grimes * California, Berkeley and its contributors. 17df8bae1dSRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 18df8bae1dSRodney W. Grimes * may be used to endorse or promote products derived from this software 19df8bae1dSRodney W. Grimes * without specific prior written permission. 20df8bae1dSRodney W. Grimes * 21df8bae1dSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22df8bae1dSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23df8bae1dSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24df8bae1dSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25df8bae1dSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26df8bae1dSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27df8bae1dSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28df8bae1dSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29df8bae1dSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30df8bae1dSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31df8bae1dSRodney W. Grimes * SUCH DAMAGE. 32df8bae1dSRodney W. Grimes * 33df8bae1dSRodney W. Grimes * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 34722012ccSJulian Elischer * $Id: if_arp.h,v 1.10 1998/01/10 07:29:10 bde Exp $ 35df8bae1dSRodney W. Grimes */ 36df8bae1dSRodney W. Grimes 37cea1da3bSPaul Richards #ifndef _NET_IF_ARP_H_ 38cea1da3bSPaul Richards #define _NET_IF_ARP_H_ 39cea1da3bSPaul Richards 40df8bae1dSRodney W. Grimes /* 41df8bae1dSRodney W. Grimes * Address Resolution Protocol. 42df8bae1dSRodney W. Grimes * 43df8bae1dSRodney W. Grimes * See RFC 826 for protocol description. ARP packets are variable 44df8bae1dSRodney W. Grimes * in size; the arphdr structure defines the fixed-length portion. 45df8bae1dSRodney W. Grimes * Protocol type values are the same as those for 10 Mb/s Ethernet. 46df8bae1dSRodney W. Grimes * It is followed by the variable-sized fields ar_sha, arp_spa, 47df8bae1dSRodney W. Grimes * arp_tha and arp_tpa in that order, according to the lengths 48df8bae1dSRodney W. Grimes * specified. Field names used correspond to RFC 826. 49df8bae1dSRodney W. Grimes */ 50df8bae1dSRodney W. Grimes struct arphdr { 51df8bae1dSRodney W. Grimes u_short ar_hrd; /* format of hardware address */ 52df8bae1dSRodney W. Grimes #define ARPHRD_ETHER 1 /* ethernet hardware format */ 53722012ccSJulian Elischer #define ARPHRD_IEEE802 6 /* token-ring hardware format */ 54df8bae1dSRodney W. Grimes #define ARPHRD_FRELAY 15 /* frame relay hardware format */ 55df8bae1dSRodney W. Grimes u_short ar_pro; /* format of protocol address */ 56df8bae1dSRodney W. Grimes u_char ar_hln; /* length of hardware address */ 57df8bae1dSRodney W. Grimes u_char ar_pln; /* length of protocol address */ 58df8bae1dSRodney W. Grimes u_short ar_op; /* one of: */ 59df8bae1dSRodney W. Grimes #define ARPOP_REQUEST 1 /* request to resolve address */ 60df8bae1dSRodney W. Grimes #define ARPOP_REPLY 2 /* response to previous request */ 61df8bae1dSRodney W. Grimes #define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ 62df8bae1dSRodney W. Grimes #define ARPOP_REVREPLY 4 /* response giving protocol address */ 63df8bae1dSRodney W. Grimes #define ARPOP_INVREQUEST 8 /* request to identify peer */ 64df8bae1dSRodney W. Grimes #define ARPOP_INVREPLY 9 /* response identifying peer */ 65df8bae1dSRodney W. Grimes /* 66df8bae1dSRodney W. Grimes * The remaining fields are variable in size, 67df8bae1dSRodney W. Grimes * according to the sizes above. 68df8bae1dSRodney W. Grimes */ 69df8bae1dSRodney W. Grimes #ifdef COMMENT_ONLY 70df8bae1dSRodney W. Grimes u_char ar_sha[]; /* sender hardware address */ 71df8bae1dSRodney W. Grimes u_char ar_spa[]; /* sender protocol address */ 72df8bae1dSRodney W. Grimes u_char ar_tha[]; /* target hardware address */ 73df8bae1dSRodney W. Grimes u_char ar_tpa[]; /* target protocol address */ 74df8bae1dSRodney W. Grimes #endif 75df8bae1dSRodney W. Grimes }; 76df8bae1dSRodney W. Grimes 77df8bae1dSRodney W. Grimes /* 78df8bae1dSRodney W. Grimes * ARP ioctl request 79df8bae1dSRodney W. Grimes */ 80df8bae1dSRodney W. Grimes struct arpreq { 81df8bae1dSRodney W. Grimes struct sockaddr arp_pa; /* protocol address */ 82df8bae1dSRodney W. Grimes struct sockaddr arp_ha; /* hardware address */ 83df8bae1dSRodney W. Grimes int arp_flags; /* flags */ 84df8bae1dSRodney W. Grimes }; 85df8bae1dSRodney W. Grimes /* arp_flags and at_flags field values */ 86df8bae1dSRodney W. Grimes #define ATF_INUSE 0x01 /* entry in use */ 87df8bae1dSRodney W. Grimes #define ATF_COM 0x02 /* completed entry (enaddr valid) */ 88df8bae1dSRodney W. Grimes #define ATF_PERM 0x04 /* permanent entry */ 89df8bae1dSRodney W. Grimes #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 90df8bae1dSRodney W. Grimes #define ATF_USETRAILERS 0x10 /* has requested trailers */ 91cea1da3bSPaul Richards 927fa939e2SBruce Evans #ifdef KERNEL 931d5e9e22SEivind Eklund /* 941d5e9e22SEivind Eklund * Structure shared between the ethernet driver modules and 951d5e9e22SEivind Eklund * the address resolution code. For example, each ec_softc or il_softc 961d5e9e22SEivind Eklund * begins with this structure. 971d5e9e22SEivind Eklund */ 981d5e9e22SEivind Eklund struct arpcom { 991d5e9e22SEivind Eklund /* 1001d5e9e22SEivind Eklund * The ifnet struct _must_ be at the head of this structure. 1011d5e9e22SEivind Eklund */ 1021d5e9e22SEivind Eklund struct ifnet ac_if; /* network-visible interface */ 1037fa939e2SBruce Evans u_char ac_enaddr[6]; /* ethernet hardware address */ 1041d5e9e22SEivind Eklund int ac_multicnt; /* length of ac_multiaddrs list */ 1051d5e9e22SEivind Eklund }; 1061d5e9e22SEivind Eklund 1077fa939e2SBruce Evans extern u_char etherbroadcastaddr[6]; 1081d5e9e22SEivind Eklund #endif 1091d5e9e22SEivind Eklund 110df708ff1SBruce Evans #endif /* !_NET_IF_ARP_H_ */ 111