1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright 1997-2003 Sun Microsystems, Inc.  All rights reserved.
3*0Sstevel@tonic-gate  * Use is subject to license terms.
4*0Sstevel@tonic-gate  */
5*0Sstevel@tonic-gate 
6*0Sstevel@tonic-gate /*
7*0Sstevel@tonic-gate  * Copyright (c) 1986 Regents of the University of California.
8*0Sstevel@tonic-gate  * All rights reserved.  The Berkeley software License Agreement
9*0Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
10*0Sstevel@tonic-gate  */
11*0Sstevel@tonic-gate 
12*0Sstevel@tonic-gate #ifndef	_NET_IF_ARP_H
13*0Sstevel@tonic-gate #define	_NET_IF_ARP_H
14*0Sstevel@tonic-gate 
15*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
16*0Sstevel@tonic-gate /* if_arp.h 1.5 88/08/19 SMI; from UCB 7.1 1/24/86	*/
17*0Sstevel@tonic-gate 
18*0Sstevel@tonic-gate #ifdef	__cplusplus
19*0Sstevel@tonic-gate extern "C" {
20*0Sstevel@tonic-gate #endif
21*0Sstevel@tonic-gate 
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Address Resolution Protocol.
24*0Sstevel@tonic-gate  *
25*0Sstevel@tonic-gate  * See RFC 826 for protocol description.  ARP packets are variable
26*0Sstevel@tonic-gate  * in size; the arphdr structure defines the fixed-length portion.
27*0Sstevel@tonic-gate  * Protocol type values are the same as those for 10 Mb/s Ethernet.
28*0Sstevel@tonic-gate  * It is followed by the variable-sized fields ar_sha, arp_spa,
29*0Sstevel@tonic-gate  * arp_tha and arp_tpa in that order, according to the lengths
30*0Sstevel@tonic-gate  * specified.  Field names used correspond to RFC 826.
31*0Sstevel@tonic-gate  */
32*0Sstevel@tonic-gate struct	arphdr {
33*0Sstevel@tonic-gate 	ushort_t ar_hrd;	/* format of hardware address */
34*0Sstevel@tonic-gate #define	ARPHRD_ETHER 	1	/* ethernet hardware address */
35*0Sstevel@tonic-gate #define	ARPHRD_IB 	32	/* IPoIB hardware address */
36*0Sstevel@tonic-gate 	ushort_t ar_pro;	/* format of protocol address */
37*0Sstevel@tonic-gate 	uchar_t	ar_hln;		/* length of hardware address */
38*0Sstevel@tonic-gate 	uchar_t	ar_pln;		/* length of protocol address */
39*0Sstevel@tonic-gate 	ushort_t ar_op;		/* one of: */
40*0Sstevel@tonic-gate #define	ARPOP_REQUEST	1	/* request to resolve address */
41*0Sstevel@tonic-gate #define	ARPOP_REPLY	2	/* response to previous request */
42*0Sstevel@tonic-gate #define	REVARP_REQUEST	3	/* Reverse ARP request */
43*0Sstevel@tonic-gate #define	REVARP_REPLY	4	/* Reverse ARP reply */
44*0Sstevel@tonic-gate 	/*
45*0Sstevel@tonic-gate 	 * The remaining fields are variable in size,
46*0Sstevel@tonic-gate 	 * according to the sizes above, and are defined
47*0Sstevel@tonic-gate 	 * as appropriate for specific hardware/protocol
48*0Sstevel@tonic-gate 	 * combinations.  (E.g., see <netinet/if_ether.h>.)
49*0Sstevel@tonic-gate 	 */
50*0Sstevel@tonic-gate #ifdef	notdef
51*0Sstevel@tonic-gate 	uchar_t	ar_sha[];	/* sender hardware address */
52*0Sstevel@tonic-gate 	uchar_t	ar_spa[];	/* sender protocol address */
53*0Sstevel@tonic-gate 	uchar_t	ar_tha[];	/* target hardware address */
54*0Sstevel@tonic-gate 	uchar_t	ar_tpa[];	/* target protocol address */
55*0Sstevel@tonic-gate #endif	/* notdef */
56*0Sstevel@tonic-gate };
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate /*
59*0Sstevel@tonic-gate  * Extended ARP ioctl request
60*0Sstevel@tonic-gate  */
61*0Sstevel@tonic-gate struct xarpreq {
62*0Sstevel@tonic-gate 	struct	sockaddr_storage xarp_pa;	/* protocol address */
63*0Sstevel@tonic-gate 	struct	sockaddr_dl	 xarp_ha;	/* hardware address */
64*0Sstevel@tonic-gate 	int	xarp_flags;			/* flags */
65*0Sstevel@tonic-gate };
66*0Sstevel@tonic-gate 
67*0Sstevel@tonic-gate /*
68*0Sstevel@tonic-gate  * BSD ARP ioctl request
69*0Sstevel@tonic-gate  */
70*0Sstevel@tonic-gate struct arpreq {
71*0Sstevel@tonic-gate 	struct	sockaddr arp_pa;		/* protocol address */
72*0Sstevel@tonic-gate 	struct	sockaddr arp_ha;		/* hardware address */
73*0Sstevel@tonic-gate 	int	arp_flags;			/* flags */
74*0Sstevel@tonic-gate };
75*0Sstevel@tonic-gate /*  arp_flags and at_flags field values */
76*0Sstevel@tonic-gate #define	ATF_INUSE	0x01	/* entry in use */
77*0Sstevel@tonic-gate #define	ATF_COM		0x02	/* completed entry (enaddr valid) */
78*0Sstevel@tonic-gate #define	ATF_PERM	0x04	/* permanent entry */
79*0Sstevel@tonic-gate #define	ATF_PUBL	0x08	/* publish entry (respond for other host) */
80*0Sstevel@tonic-gate #define	ATF_USETRAILERS	0x10	/* has requested trailers */
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate /*
83*0Sstevel@tonic-gate  * This data structure is used by kernel protocol modules to register
84*0Sstevel@tonic-gate  * their interest in a particular packet type with the Ethernet drivers.
85*0Sstevel@tonic-gate  * For example, other kinds of ARP would use this, XNS, ApleTalk, etc.
86*0Sstevel@tonic-gate  */
87*0Sstevel@tonic-gate struct ether_family {
88*0Sstevel@tonic-gate 	int		ef_family;	/* address family */
89*0Sstevel@tonic-gate 	ushort_t	ef_ethertype;	/* ethernet type field */
90*0Sstevel@tonic-gate 	struct ifqueue *(*ef_infunc)();	/* input function */
91*0Sstevel@tonic-gate 	int		(*ef_outfunc)();	/* output function */
92*0Sstevel@tonic-gate 	int		(*ef_netisr)();	/* soft interrupt function */
93*0Sstevel@tonic-gate 	struct ether_family *ef_next;	/* link to next on list */
94*0Sstevel@tonic-gate };
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate #ifdef	__cplusplus
97*0Sstevel@tonic-gate }
98*0Sstevel@tonic-gate #endif
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate #endif	/* _NET_IF_ARP_H */
101