xref: /illumos-gate/usr/src/uts/common/net/if_arp.h (revision e56998eefc33ead0f12b364be915dd6bfc12a3f5)
1 /*
2  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
3  */
4 
5 /*
6  * Copyright (c) 1986 Regents of the University of California.
7  * All rights reserved.  The Berkeley software License Agreement
8  * specifies the terms and conditions for redistribution.
9  */
10 
11 #ifndef	_NET_IF_ARP_H
12 #define	_NET_IF_ARP_H
13 
14 /* if_arp.h 1.5 88/08/19 SMI; from UCB 7.1 1/24/86	*/
15 
16 #include <sys/types.h>
17 #include <sys/socket.h>
18 
19 #ifdef	__cplusplus
20 extern "C" {
21 #endif
22 
23 /*
24  * Address Resolution Protocol.
25  *
26  * See RFC 826 for protocol description.  ARP packets are variable
27  * in size; the arphdr structure defines the fixed-length portion.
28  * Protocol type values are the same as those for 10 Mb/s Ethernet.
29  * It is followed by the variable-sized fields ar_sha, arp_spa,
30  * arp_tha and arp_tpa in that order, according to the lengths
31  * specified.  Field names used correspond to RFC 826.
32  */
33 struct	arphdr {
34 	ushort_t ar_hrd;	/* format of hardware address */
35 #define	ARPHRD_ETHER 	1	/* ethernet hardware address */
36 #define	ARPHRD_EETHER	2	/* experimental ethernet */
37 #define	ARPHRD_AX25	3	/* amateur readio ax.25 */
38 #define	ARPHRD_CHAOS	5	/* Chaos net */
39 #define	ARPHRD_IEEE802 	6	/* IEEE 802 hardware address */
40 #define	ARPHRD_ARCNET	7	/* ARCNET */
41 #define	ARPHRD_FRAME	15	/* Frame relay */
42 #define	ARPHRD_ATM	16	/* ATM */
43 #define	ARPHRD_HDLC	17	/* HDLC */
44 #define	ARPHRD_FC	18	/* Fibre Channel RFC 4338 */
45 #define	ARPHRD_IPATM	19	/* ATM RFC 2225 */
46 #define	ARPHRD_METRICOM	23	/* Metricom */
47 #define	ARPHRD_TUNNEL	31	/* IPsec Tunnel RFC 3456 */
48 #define	ARPHRD_IB	32	/* IPoIB hardware address */
49 	ushort_t ar_pro;	/* format of protocol address */
50 	uchar_t	ar_hln;		/* length of hardware address */
51 	uchar_t	ar_pln;		/* length of protocol address */
52 	ushort_t ar_op;		/* one of: */
53 #define	ARPOP_REQUEST	1	/* request to resolve address */
54 #define	ARPOP_REPLY	2	/* response to previous request */
55 #define	REVARP_REQUEST	3	/* Reverse ARP request */
56 #define	REVARP_REPLY	4	/* Reverse ARP reply */
57 	/*
58 	 * The remaining fields are variable in size,
59 	 * according to the sizes above, and are defined
60 	 * as appropriate for specific hardware/protocol
61 	 * combinations.  (E.g., see <netinet/if_ether.h>.)
62 	 */
63 #ifdef	notdef
64 	uchar_t	ar_sha[];	/* sender hardware address */
65 	uchar_t	ar_spa[];	/* sender protocol address */
66 	uchar_t	ar_tha[];	/* target hardware address */
67 	uchar_t	ar_tpa[];	/* target protocol address */
68 #endif	/* notdef */
69 };
70 
71 /* Maximum hardware and protocol address length */
72 #define	ARP_MAX_ADDR_LEN	255
73 
74 /*
75  * Extended ARP ioctl request
76  */
77 struct xarpreq {
78 	struct	sockaddr_storage xarp_pa;	/* protocol address */
79 	struct	sockaddr_dl	 xarp_ha;	/* hardware address */
80 	int	xarp_flags;			/* flags */
81 };
82 
83 /*
84  * BSD ARP ioctl request
85  */
86 struct arpreq {
87 	struct	sockaddr arp_pa;		/* protocol address */
88 	struct	sockaddr arp_ha;		/* hardware address */
89 	int	arp_flags;			/* flags */
90 };
91 /*  arp_flags field values */
92 #define	ATF_INUSE	0x01	/* entry in use */
93 #define	ATF_COM		0x02	/* completed entry (enaddr valid) */
94 #define	ATF_PERM	0x04	/* permanent entry */
95 #define	ATF_PUBL	0x08	/* publish entry (respond for other host) */
96 #define	ATF_USETRAILERS	0x10	/* has requested trailers */
97 #define	ATF_AUTHORITY	0x20	/* hardware address is authoritative */
98 
99 /*
100  * This data structure is used by kernel protocol modules to register
101  * their interest in a particular packet type with the Ethernet drivers.
102  * For example, other kinds of ARP would use this, XNS, ApleTalk, etc.
103  */
104 struct ether_family {
105 	int		ef_family;	/* address family */
106 	ushort_t	ef_ethertype;	/* ethernet type field */
107 	struct ifqueue *(*ef_infunc)();	/* input function */
108 	int		(*ef_outfunc)();	/* output function */
109 	int		(*ef_netisr)();	/* soft interrupt function */
110 	struct ether_family *ef_next;	/* link to next on list */
111 };
112 
113 #ifdef	__cplusplus
114 }
115 #endif
116 
117 #endif	/* _NET_IF_ARP_H */
118