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