xref: /onnv-gate/usr/src/lib/libbc/inc/include/net/if_arp.h (revision 0:68f95e015346)
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  * This libbc private version of if_arp.h is being created as an
13*0Sstevel@tonic-gate  * exact copy of <net/if_arp.h> prior to the addition of the
14*0Sstevel@tonic-gate  * "struct xarpreq" in the standard <net/if_arp.h>. The libbc code
15*0Sstevel@tonic-gate  * does not understand the structure elements in "struct xarpreq".
16*0Sstevel@tonic-gate  */
17*0Sstevel@tonic-gate 
18*0Sstevel@tonic-gate 
19*0Sstevel@tonic-gate #ifndef	_net_if_arp_h
20*0Sstevel@tonic-gate #define	_net_if_arp_h
21*0Sstevel@tonic-gate 
22*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
23*0Sstevel@tonic-gate 
24*0Sstevel@tonic-gate #ifdef	__cplusplus
25*0Sstevel@tonic-gate extern "C" {
26*0Sstevel@tonic-gate #endif
27*0Sstevel@tonic-gate 
28*0Sstevel@tonic-gate /*
29*0Sstevel@tonic-gate  * Address Resolution Protocol.
30*0Sstevel@tonic-gate  *
31*0Sstevel@tonic-gate  * See RFC 826 for protocol description.  ARP packets are variable
32*0Sstevel@tonic-gate  * in size; the arphdr structure defines the fixed-length portion.
33*0Sstevel@tonic-gate  * Protocol type values are the same as those for 10 Mb/s Ethernet.
34*0Sstevel@tonic-gate  * It is followed by the variable-sized fields ar_sha, arp_spa,
35*0Sstevel@tonic-gate  * arp_tha and arp_tpa in that order, according to the lengths
36*0Sstevel@tonic-gate  * specified.  Field names used correspond to RFC 826.
37*0Sstevel@tonic-gate  */
38*0Sstevel@tonic-gate struct	arphdr {
39*0Sstevel@tonic-gate 	ushort_t ar_hrd;	/* format of hardware address */
40*0Sstevel@tonic-gate #define	ARPHRD_ETHER 	1	/* ethernet hardware address */
41*0Sstevel@tonic-gate 	ushort_t ar_pro;	/* format of protocol address */
42*0Sstevel@tonic-gate 	uchar_t	ar_hln;		/* length of hardware address */
43*0Sstevel@tonic-gate 	uchar_t	ar_pln;		/* length of protocol address */
44*0Sstevel@tonic-gate 	ushort_t ar_op;		/* one of: */
45*0Sstevel@tonic-gate #define	ARPOP_REQUEST	1	/* request to resolve address */
46*0Sstevel@tonic-gate #define	ARPOP_REPLY	2	/* response to previous request */
47*0Sstevel@tonic-gate #define	REVARP_REQUEST	3	/* Reverse ARP request */
48*0Sstevel@tonic-gate #define	REVARP_REPLY	4	/* Reverse ARP reply */
49*0Sstevel@tonic-gate 	/*
50*0Sstevel@tonic-gate 	 * The remaining fields are variable in size,
51*0Sstevel@tonic-gate 	 * according to the sizes above, and are defined
52*0Sstevel@tonic-gate 	 * as appropriate for specific hardware/protocol
53*0Sstevel@tonic-gate 	 * combinations.  (E.g., see <netinet/if_ether.h>.)
54*0Sstevel@tonic-gate 	 */
55*0Sstevel@tonic-gate #ifdef	notdef
56*0Sstevel@tonic-gate 	uchar_t	ar_sha[];	/* sender hardware address */
57*0Sstevel@tonic-gate 	uchar_t	ar_spa[];	/* sender protocol address */
58*0Sstevel@tonic-gate 	uchar_t	ar_tha[];	/* target hardware address */
59*0Sstevel@tonic-gate 	uchar_t	ar_tpa[];	/* target protocol address */
60*0Sstevel@tonic-gate #endif	/* notdef */
61*0Sstevel@tonic-gate };
62*0Sstevel@tonic-gate 
63*0Sstevel@tonic-gate /*
64*0Sstevel@tonic-gate  * ARP ioctl request
65*0Sstevel@tonic-gate  */
66*0Sstevel@tonic-gate struct arpreq {
67*0Sstevel@tonic-gate 	struct	sockaddr arp_pa;		/* protocol address */
68*0Sstevel@tonic-gate 	struct	sockaddr arp_ha;		/* hardware address */
69*0Sstevel@tonic-gate 	int	arp_flags;			/* flags */
70*0Sstevel@tonic-gate };
71*0Sstevel@tonic-gate /*  arp_flags and at_flags field values */
72*0Sstevel@tonic-gate #define	ATF_INUSE	0x01	/* entry in use */
73*0Sstevel@tonic-gate #define	ATF_COM		0x02	/* completed entry (enaddr valid) */
74*0Sstevel@tonic-gate #define	ATF_PERM	0x04	/* permanent entry */
75*0Sstevel@tonic-gate #define	ATF_PUBL	0x08	/* publish entry (respond for other host) */
76*0Sstevel@tonic-gate #define	ATF_USETRAILERS	0x10	/* has requested trailers */
77*0Sstevel@tonic-gate 
78*0Sstevel@tonic-gate /*
79*0Sstevel@tonic-gate  * This data structure is used by kernel protocol modules to register
80*0Sstevel@tonic-gate  * their interest in a particular packet type with the Ethernet drivers.
81*0Sstevel@tonic-gate  * For example, other kinds of ARP would use this, XNS, ApleTalk, etc.
82*0Sstevel@tonic-gate  */
83*0Sstevel@tonic-gate struct ether_family {
84*0Sstevel@tonic-gate 	int		ef_family;	/* address family */
85*0Sstevel@tonic-gate 	ushort_t	ef_ethertype;	/* ethernet type field */
86*0Sstevel@tonic-gate 	struct ifqueue *(*ef_infunc)();	/* input function */
87*0Sstevel@tonic-gate 	int		(*ef_outfunc)();	/* output function */
88*0Sstevel@tonic-gate 	int		(*ef_netisr)();	/* soft interrupt function */
89*0Sstevel@tonic-gate 	struct ether_family *ef_next;	/* link to next on list */
90*0Sstevel@tonic-gate };
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate #ifdef	__cplusplus
93*0Sstevel@tonic-gate }
94*0Sstevel@tonic-gate #endif
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate #endif	/* _net_if_arp_h */
97