xref: /illumos-gate/usr/src/uts/common/netinet/arp.h (revision 7c478bd9)
1 /*
2  * Copyright 1986-2003 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 1982, 1986 Regents of the University of California.
8  * All rights reserved. The Berkeley software License Agreement
9  * specifies the terms and conditions for redistribution.
10  */
11 
12 #ifndef	_NETINET_ARP_H
13 #define	_NETINET_ARP_H
14 
15 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 
17 #ifdef	__cplusplus
18 extern "C" {
19 #endif
20 
21 /*
22  * Address Resolution Protocol.
23  *
24  * See RFC 826 for protocol description.  ARP packets are variable
25  * in size; the arphdr structure defines the fixed-length portion.
26  * Protocol type values are the same as those for 10 Mb/s Ethernet.
27  * It is followed by the variable-sized fields ar_sha, arp_spa,
28  * arp_tha and arp_tpa in that order, according to the lengths
29  * specified.  Field names used correspond to RFC 826.
30  */
31 struct	arphdr {
32 	ushort_t ar_hrd;	/* format of hardware address */
33 #define	ARPHRD_ETHER 	1	/* ethernet hardware address */
34 #define	ARPHRD_IB	32	/* IPoIB hardware address */
35 	ushort_t ar_pro;	/* format of protocol address */
36 	uchar_t	ar_hln;		/* length of hardware address */
37 	uchar_t	ar_pln;		/* length of protocol address */
38 	ushort_t ar_op;		/* one of: */
39 #define	ARPOP_REQUEST	1	/* request to resolve address */
40 #define	ARPOP_REPLY	2	/* response to previous request */
41 #define	REVARP_REQUEST	3	/* Reverse ARP request */
42 #define	REVARP_REPLY	4	/* Reverse ARP reply */
43 	/*
44 	 * The remaining fields are variable in size,
45 	 * according to the sizes above, and are defined
46 	 * as appropriate for specific hardware/protocol
47 	 * combinations.  (E.g., see <netinet/if_ether.h>.)
48 	 */
49 #ifdef	notdef
50 	uchar_t	ar_sha[];	/* sender hardware address */
51 	uchar_t	ar_spa[];	/* sender protocol address */
52 	uchar_t	ar_tha[];	/* target hardware address */
53 	uchar_t	ar_tpa[];	/* target protocol address */
54 #endif	/* notdef */
55 };
56 
57 /*
58  * Ethernet Address Resolution Protocol.
59  *
60  * See RFC 826 for protocol description.  Structure below is adapted
61  * to resolving internet addresses.  Field names used correspond to
62  * RFC 826.
63  */
64 struct	ether_arp {
65 	struct	arphdr ea_hdr;		/* fixed-size header */
66 	struct ether_addr arp_sha;	/* sender hardware address */
67 	uchar_t	arp_spa[4];		/* sender protocol address */
68 	struct ether_addr arp_tha;	/* target hardware address */
69 	uchar_t	arp_tpa[4];		/* target protocol address */
70 };
71 #define	arp_hrd	ea_hdr.ar_hrd
72 #define	arp_pro	ea_hdr.ar_pro
73 #define	arp_hln	ea_hdr.ar_hln
74 #define	arp_pln	ea_hdr.ar_pln
75 #define	arp_op	ea_hdr.ar_op
76 
77 /*
78  * ARP ioctl request
79  */
80 struct arpreq {
81 	struct	sockaddr arp_pa;		/* protocol address */
82 	struct	sockaddr arp_ha;		/* hardware address */
83 	int	arp_flags;			/* flags */
84 };
85 /*  arp_flags and at_flags field values */
86 #define	ATF_INUSE	0x01	/* entry in use */
87 #define	ATF_COM		0x02	/* completed entry (enaddr valid) */
88 #define	ATF_PERM	0x04	/* permanent entry */
89 #define	ATF_PUBL	0x08	/* publish entry (respond for other host) */
90 #define	ATF_USETRAILERS	0x10	/* has requested trailers */
91 
92 #ifdef	__cplusplus
93 }
94 #endif
95 
96 #endif	/* _NETINET_ARP_H */
97