if_arp.h revision 52419
1305153Sjkim/* 2305153Sjkim * Copyright (c) 1986, 1993 3299389Sjkim * The Regents of the University of California. All rights reserved. 4299389Sjkim * 5238405Sjkim * Redistribution and use in source and binary forms, with or without 6238405Sjkim * modification, are permitted provided that the following conditions 7238405Sjkim * are met: 8238405Sjkim * 1. Redistributions of source code must retain the above copyright 9238405Sjkim * notice, this list of conditions and the following disclaimer. 10238405Sjkim * 2. Redistributions in binary form must reproduce the above copyright 11238405Sjkim * notice, this list of conditions and the following disclaimer in the 12238405Sjkim * documentation and/or other materials provided with the distribution. 13238405Sjkim * 3. All advertising materials mentioning features or use of this software 14238405Sjkim * must display the following acknowledgement: 15238405Sjkim * This product includes software developed by the University of 16238405Sjkim * California, Berkeley and its contributors. 17238405Sjkim * 4. Neither the name of the University nor the names of its contributors 18238405Sjkim * may be used to endorse or promote products derived from this software 19238405Sjkim * without specific prior written permission. 20238405Sjkim * 21238405Sjkim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22238405Sjkim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23238405Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24238405Sjkim * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25238405Sjkim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26238405Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27238405Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28238405Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29238405Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30238405Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31299389Sjkim * SUCH DAMAGE. 32299389Sjkim * 33299389Sjkim * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 34299389Sjkim * $FreeBSD: head/sys/net/if_arp.h 52419 1999-10-21 09:06:11Z julian $ 35299389Sjkim */ 36299389Sjkim 37299389Sjkim#ifndef _NET_IF_ARP_H_ 38299389Sjkim#define _NET_IF_ARP_H_ 39299389Sjkim 40299389Sjkim/* 41299389Sjkim * Address Resolution Protocol. 42299389Sjkim * 43299389Sjkim * See RFC 826 for protocol description. ARP packets are variable 44299389Sjkim * in size; the arphdr structure defines the fixed-length portion. 45299389Sjkim * Protocol type values are the same as those for 10 Mb/s Ethernet. 46299481Sjkim * It is followed by the variable-sized fields ar_sha, arp_spa, 47299389Sjkim * arp_tha and arp_tpa in that order, according to the lengths 48299481Sjkim * specified. Field names used correspond to RFC 826. 49299389Sjkim */ 50299389Sjkimstruct arphdr { 51299389Sjkim u_short ar_hrd; /* format of hardware address */ 52299481Sjkim#define ARPHRD_ETHER 1 /* ethernet hardware format */ 53299389Sjkim#define ARPHRD_IEEE802 6 /* token-ring hardware format */ 54299389Sjkim#define ARPHRD_FRELAY 15 /* frame relay hardware format */ 55299389Sjkim u_short ar_pro; /* format of protocol address */ 56299389Sjkim u_char ar_hln; /* length of hardware address */ 57299389Sjkim u_char ar_pln; /* length of protocol address */ 58299389Sjkim u_short ar_op; /* one of: */ 59299389Sjkim#define ARPOP_REQUEST 1 /* request to resolve address */ 60299389Sjkim#define ARPOP_REPLY 2 /* response to previous request */ 61299389Sjkim#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ 62299389Sjkim#define ARPOP_REVREPLY 4 /* response giving protocol address */ 63299389Sjkim#define ARPOP_INVREQUEST 8 /* request to identify peer */ 64299389Sjkim#define ARPOP_INVREPLY 9 /* response identifying peer */ 65299389Sjkim/* 66299389Sjkim * The remaining fields are variable in size, 67299389Sjkim * according to the sizes above. 68299389Sjkim */ 69299389Sjkim#ifdef COMMENT_ONLY 70299389Sjkim u_char ar_sha[]; /* sender hardware address */ 71299389Sjkim u_char ar_spa[]; /* sender protocol address */ 72299389Sjkim u_char ar_tha[]; /* target hardware address */ 73299389Sjkim u_char ar_tpa[]; /* target protocol address */ 74299389Sjkim#endif 75299389Sjkim}; 76299389Sjkim 77299389Sjkim/* 78299389Sjkim * ARP ioctl request 79299389Sjkim */ 80299389Sjkimstruct arpreq { 81299389Sjkim struct sockaddr arp_pa; /* protocol address */ 82299389Sjkim struct sockaddr arp_ha; /* hardware address */ 83299389Sjkim int arp_flags; /* flags */ 84299389Sjkim}; 85299389Sjkim/* arp_flags and at_flags field values */ 86299389Sjkim#define ATF_INUSE 0x01 /* entry in use */ 87299389Sjkim#define ATF_COM 0x02 /* completed entry (enaddr valid) */ 88299389Sjkim#define ATF_PERM 0x04 /* permanent entry */ 89299389Sjkim#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 90299389Sjkim#define ATF_USETRAILERS 0x10 /* has requested trailers */ 91299389Sjkim 92299389Sjkim#ifdef KERNEL 93299389Sjkim/* 94299389Sjkim * Structure shared between the ethernet driver modules and 95299389Sjkim * the address resolution code. For example, each ec_softc or il_softc 96299389Sjkim * begins with this structure. 97299389Sjkim */ 98299389Sjkimstruct arpcom { 99299389Sjkim /* 100299389Sjkim * The ifnet struct _must_ be at the head of this structure. 101299389Sjkim */ 102299389Sjkim struct ifnet ac_if; /* network-visible interface */ 103299389Sjkim u_char ac_enaddr[6]; /* ethernet hardware address */ 104299389Sjkim int ac_multicnt; /* length of ac_multiaddrs list */ 105299389Sjkim/* #ifdef NETGRAPH */ 106299389Sjkim void *ac_ng; /* hook to hang netgraph stuff off */ 107299389Sjkim/* #endif */ 108299389Sjkim}; 109299389Sjkim 110299389Sjkimextern u_char etherbroadcastaddr[6]; 111299389Sjkim#endif 112299389Sjkim 113299389Sjkim#endif /* !_NET_IF_ARP_H_ */ 114299389Sjkim