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