xref: /csrg-svn/sys/net/if_arp.h (revision 33183)
125972Skarels /*
225972Skarels  * Copyright (c) 1986 Regents of the University of California.
3*33183Sbostic  * All rights reserved.
425972Skarels  *
5*33183Sbostic  * Redistribution and use in source and binary forms are permitted
6*33183Sbostic  * provided that this notice is preserved and that due credit is given
7*33183Sbostic  * to the University of California at Berkeley. The name of the University
8*33183Sbostic  * may not be used to endorse or promote products derived from this
9*33183Sbostic  * software without specific prior written permission. This software
10*33183Sbostic  * is provided ``as is'' without express or implied warranty.
11*33183Sbostic  *
12*33183Sbostic  *	@(#)if_arp.h	7.2 (Berkeley) 12/30/87
1325972Skarels  */
1425972Skarels 
1525972Skarels /*
1625972Skarels  * Address Resolution Protocol.
1725972Skarels  *
1825972Skarels  * See RFC 826 for protocol description.  ARP packets are variable
1925972Skarels  * in size; the arphdr structure defines the fixed-length portion.
2025972Skarels  * Protocol type values are the same as those for 10 Mb/s Ethernet.
2125972Skarels  * It is followed by the variable-sized fields ar_sha, arp_spa,
2225972Skarels  * arp_tha and arp_tpa in that order, according to the lengths
2325972Skarels  * specified.  Field names used correspond to RFC 826.
2425972Skarels  */
2525972Skarels struct	arphdr {
2625972Skarels 	u_short	ar_hrd;		/* format of hardware address */
2725972Skarels #define ARPHRD_ETHER 	1	/* ethernet hardware address */
2825972Skarels 	u_short	ar_pro;		/* format of protocol address */
2925972Skarels 	u_char	ar_hln;		/* length of hardware address */
3025972Skarels 	u_char	ar_pln;		/* length of protocol address */
3125972Skarels 	u_short	ar_op;		/* one of: */
3225972Skarels #define	ARPOP_REQUEST	1	/* request to resolve address */
3325972Skarels #define	ARPOP_REPLY	2	/* response to previous request */
3425972Skarels /*
3525972Skarels  * The remaining fields are variable in size,
3625972Skarels  * according to the sizes above.
3725972Skarels  */
3825972Skarels /*	u_char	ar_sha[];	/* sender hardware address */
3925972Skarels /*	u_char	ar_spa[];	/* sender protocol address */
4025972Skarels /*	u_char	ar_tha[];	/* target hardware address */
4125972Skarels /*	u_char	ar_tpa[];	/* target protocol address */
4225972Skarels };
4325972Skarels 
4425972Skarels /*
4525972Skarels  * ARP ioctl request
4625972Skarels  */
4725972Skarels struct arpreq {
4825972Skarels 	struct	sockaddr arp_pa;		/* protocol address */
4925972Skarels 	struct	sockaddr arp_ha;		/* hardware address */
5025972Skarels 	int	arp_flags;			/* flags */
5125972Skarels };
5225972Skarels /*  arp_flags and at_flags field values */
5325972Skarels #define	ATF_INUSE	0x01	/* entry in use */
5425972Skarels #define ATF_COM		0x02	/* completed entry (enaddr valid) */
5525972Skarels #define	ATF_PERM	0x04	/* permanent entry */
5625972Skarels #define	ATF_PUBL	0x08	/* publish entry (respond for other host) */
5725972Skarels #define	ATF_USETRAILERS	0x10	/* has requested trailers */
58