1 /* 2 * Copyright (c) 1986 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that this notice is preserved and that due credit is given 7 * to the University of California at Berkeley. The name of the University 8 * may not be used to endorse or promote products derived from this 9 * software without specific prior written permission. This software 10 * is provided ``as is'' without express or implied warranty. 11 * 12 * @(#)if_arp.h 7.2 (Berkeley) 12/30/87 13 */ 14 15 /* 16 * Address Resolution Protocol. 17 * 18 * See RFC 826 for protocol description. ARP packets are variable 19 * in size; the arphdr structure defines the fixed-length portion. 20 * Protocol type values are the same as those for 10 Mb/s Ethernet. 21 * It is followed by the variable-sized fields ar_sha, arp_spa, 22 * arp_tha and arp_tpa in that order, according to the lengths 23 * specified. Field names used correspond to RFC 826. 24 */ 25 struct arphdr { 26 u_short ar_hrd; /* format of hardware address */ 27 #define ARPHRD_ETHER 1 /* ethernet hardware address */ 28 u_short ar_pro; /* format of protocol address */ 29 u_char ar_hln; /* length of hardware address */ 30 u_char ar_pln; /* length of protocol address */ 31 u_short ar_op; /* one of: */ 32 #define ARPOP_REQUEST 1 /* request to resolve address */ 33 #define ARPOP_REPLY 2 /* response to previous request */ 34 /* 35 * The remaining fields are variable in size, 36 * according to the sizes above. 37 */ 38 /* u_char ar_sha[]; /* sender hardware address */ 39 /* u_char ar_spa[]; /* sender protocol address */ 40 /* u_char ar_tha[]; /* target hardware address */ 41 /* u_char ar_tpa[]; /* target protocol address */ 42 }; 43 44 /* 45 * ARP ioctl request 46 */ 47 struct arpreq { 48 struct sockaddr arp_pa; /* protocol address */ 49 struct sockaddr arp_ha; /* hardware address */ 50 int arp_flags; /* flags */ 51 }; 52 /* arp_flags and at_flags field values */ 53 #define ATF_INUSE 0x01 /* entry in use */ 54 #define ATF_COM 0x02 /* completed entry (enaddr valid) */ 55 #define ATF_PERM 0x04 /* permanent entry */ 56 #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 57 #define ATF_USETRAILERS 0x10 /* has requested trailers */ 58