| 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 the above copyright notice and this paragraph are |
| 7 | * duplicated in all such forms and that any documentation, |
| 8 | * advertising materials, and other materials related to such |
| 9 | * distribution and use acknowledge that the software was developed |
| 10 | * by the University of California, Berkeley. The name of the |
| 11 | * University may not be used to endorse or promote products derived |
| 12 | * from this software without specific prior written permission. |
| 13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
| 14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 16 | * |
| 17 | * @(#)if_arp.h 7.3 (Berkeley) %G% |
| 18 | */ |
| 19 | |
| 20 | /* |
| 21 | * Address Resolution Protocol. |
| 22 | * |
| 23 | * See RFC 826 for protocol description. ARP packets are variable |
| 24 | * in size; the arphdr structure defines the fixed-length portion. |
| 25 | * Protocol type values are the same as those for 10 Mb/s Ethernet. |
| 26 | * It is followed by the variable-sized fields ar_sha, arp_spa, |
| 27 | * arp_tha and arp_tpa in that order, according to the lengths |
| 28 | * specified. Field names used correspond to RFC 826. |
| 29 | */ |
| 30 | struct arphdr { |
| 31 | u_short ar_hrd; /* format of hardware address */ |
| 32 | #define ARPHRD_ETHER 1 /* ethernet hardware address */ |
| 33 | u_short ar_pro; /* format of protocol address */ |
| 34 | u_char ar_hln; /* length of hardware address */ |
| 35 | u_char ar_pln; /* length of protocol address */ |
| 36 | u_short ar_op; /* one of: */ |
| 37 | #define ARPOP_REQUEST 1 /* request to resolve address */ |
| 38 | #define ARPOP_REPLY 2 /* response to previous request */ |
| 39 | /* |
| 40 | * The remaining fields are variable in size, |
| 41 | * according to the sizes above. |
| 42 | */ |
| 43 | /* u_char ar_sha[]; /* sender hardware address */ |
| 44 | /* u_char ar_spa[]; /* sender protocol address */ |
| 45 | /* u_char ar_tha[]; /* target hardware address */ |
| 46 | /* u_char ar_tpa[]; /* target protocol address */ |
| 47 | }; |
| 48 | |
| 49 | /* |
| 50 | * ARP ioctl request |
| 51 | */ |
| 52 | struct arpreq { |
| 53 | struct sockaddr arp_pa; /* protocol address */ |
| 54 | struct sockaddr arp_ha; /* hardware address */ |
| 55 | int arp_flags; /* flags */ |
| 56 | }; |
| 57 | /* arp_flags and at_flags field values */ |
| 58 | #define ATF_INUSE 0x01 /* entry in use */ |
| 59 | #define ATF_COM 0x02 /* completed entry (enaddr valid) */ |
| 60 | #define ATF_PERM 0x04 /* permanent entry */ |
| 61 | #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ |
| 62 | #define ATF_USETRAILERS 0x10 /* has requested trailers */ |