1 /* 2 * Copyright (c) 1986 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)if_arp.h 7.5 (Berkeley) 07/23/92 8 */ 9 10 /* 11 * Address Resolution Protocol. 12 * 13 * See RFC 826 for protocol description. ARP packets are variable 14 * in size; the arphdr structure defines the fixed-length portion. 15 * Protocol type values are the same as those for 10 Mb/s Ethernet. 16 * It is followed by the variable-sized fields ar_sha, arp_spa, 17 * arp_tha and arp_tpa in that order, according to the lengths 18 * specified. Field names used correspond to RFC 826. 19 */ 20 struct arphdr { 21 u_short ar_hrd; /* format of hardware address */ 22 #define ARPHRD_ETHER 1 /* ethernet hardware address */ 23 u_short ar_pro; /* format of protocol address */ 24 u_char ar_hln; /* length of hardware address */ 25 u_char ar_pln; /* length of protocol address */ 26 u_short ar_op; /* one of: */ 27 #define ARPOP_REQUEST 1 /* request to resolve address */ 28 #define ARPOP_REPLY 2 /* response to previous request */ 29 /* 30 * The remaining fields are variable in size, 31 * according to the sizes above. 32 */ 33 #ifdef COMMENT_ONLY 34 u_char ar_sha[]; /* sender hardware address */ 35 u_char ar_spa[]; /* sender protocol address */ 36 u_char ar_tha[]; /* target hardware address */ 37 u_char ar_tpa[]; /* target protocol address */ 38 #endif 39 }; 40 41 /* 42 * ARP ioctl request 43 */ 44 struct arpreq { 45 struct sockaddr arp_pa; /* protocol address */ 46 struct sockaddr arp_ha; /* hardware address */ 47 int arp_flags; /* flags */ 48 }; 49 /* arp_flags and at_flags field values */ 50 #define ATF_INUSE 0x01 /* entry in use */ 51 #define ATF_COM 0x02 /* completed entry (enaddr valid) */ 52 #define ATF_PERM 0x04 /* permanent entry */ 53 #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 54 #define ATF_USETRAILERS 0x10 /* has requested trailers */ 55