125972Skarels /* 225972Skarels * Copyright (c) 1986 Regents of the University of California. 333183Sbostic * All rights reserved. 425972Skarels * 544464Sbostic * %sccs.include.redist.c% 633183Sbostic * 7*56561Ssklower * @(#)if_arp.h 7.6 (Berkeley) 10/14/92 825972Skarels */ 925972Skarels 1025972Skarels /* 1125972Skarels * Address Resolution Protocol. 1225972Skarels * 1325972Skarels * See RFC 826 for protocol description. ARP packets are variable 1425972Skarels * in size; the arphdr structure defines the fixed-length portion. 1525972Skarels * Protocol type values are the same as those for 10 Mb/s Ethernet. 1625972Skarels * It is followed by the variable-sized fields ar_sha, arp_spa, 1725972Skarels * arp_tha and arp_tpa in that order, according to the lengths 1825972Skarels * specified. Field names used correspond to RFC 826. 1925972Skarels */ 2025972Skarels struct arphdr { 2125972Skarels u_short ar_hrd; /* format of hardware address */ 22*56561Ssklower #define ARPHRD_ETHER 1 /* ethernet hardware format */ 23*56561Ssklower #define ARPHRD_FRELAY 15 /* frame relay hardware format */ 2425972Skarels u_short ar_pro; /* format of protocol address */ 2525972Skarels u_char ar_hln; /* length of hardware address */ 2625972Skarels u_char ar_pln; /* length of protocol address */ 2725972Skarels u_short ar_op; /* one of: */ 2825972Skarels #define ARPOP_REQUEST 1 /* request to resolve address */ 2925972Skarels #define ARPOP_REPLY 2 /* response to previous request */ 30*56561Ssklower #define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ 31*56561Ssklower #define ARPOP_REVREPLY 4 /* response giving protocol address */ 32*56561Ssklower #define ARPOP_INVREQUEST 8 /* request to identify peer */ 33*56561Ssklower #define ARPOP_INVREPLY 9 /* response identifying peer */ 3425972Skarels /* 3525972Skarels * The remaining fields are variable in size, 3625972Skarels * according to the sizes above. 3725972Skarels */ 3855584Sbostic #ifdef COMMENT_ONLY 3955584Sbostic u_char ar_sha[]; /* sender hardware address */ 4055584Sbostic u_char ar_spa[]; /* sender protocol address */ 4155584Sbostic u_char ar_tha[]; /* target hardware address */ 4255584Sbostic u_char ar_tpa[]; /* target protocol address */ 4355584Sbostic #endif 4425972Skarels }; 4525972Skarels 4625972Skarels /* 4725972Skarels * ARP ioctl request 4825972Skarels */ 4925972Skarels struct arpreq { 5025972Skarels struct sockaddr arp_pa; /* protocol address */ 5125972Skarels struct sockaddr arp_ha; /* hardware address */ 5225972Skarels int arp_flags; /* flags */ 5325972Skarels }; 5425972Skarels /* arp_flags and at_flags field values */ 5525972Skarels #define ATF_INUSE 0x01 /* entry in use */ 5625972Skarels #define ATF_COM 0x02 /* completed entry (enaddr valid) */ 5725972Skarels #define ATF_PERM 0x04 /* permanent entry */ 5825972Skarels #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 5925972Skarels #define ATF_USETRAILERS 0x10 /* has requested trailers */ 60