xref: /onnv-gate/usr/src/uts/common/net/if_arp.h (revision 2546)
10Sstevel@tonic-gate /*
2*2546Scarlsonj  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
30Sstevel@tonic-gate  * Use is subject to license terms.
40Sstevel@tonic-gate  */
50Sstevel@tonic-gate 
60Sstevel@tonic-gate /*
70Sstevel@tonic-gate  * Copyright (c) 1986 Regents of the University of California.
80Sstevel@tonic-gate  * All rights reserved.  The Berkeley software License Agreement
90Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
100Sstevel@tonic-gate  */
110Sstevel@tonic-gate 
120Sstevel@tonic-gate #ifndef	_NET_IF_ARP_H
130Sstevel@tonic-gate #define	_NET_IF_ARP_H
140Sstevel@tonic-gate 
150Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
160Sstevel@tonic-gate /* if_arp.h 1.5 88/08/19 SMI; from UCB 7.1 1/24/86	*/
170Sstevel@tonic-gate 
18*2546Scarlsonj #include <sys/types.h>
19*2546Scarlsonj #include <sys/socket.h>
20*2546Scarlsonj 
210Sstevel@tonic-gate #ifdef	__cplusplus
220Sstevel@tonic-gate extern "C" {
230Sstevel@tonic-gate #endif
240Sstevel@tonic-gate 
250Sstevel@tonic-gate /*
260Sstevel@tonic-gate  * Address Resolution Protocol.
270Sstevel@tonic-gate  *
280Sstevel@tonic-gate  * See RFC 826 for protocol description.  ARP packets are variable
290Sstevel@tonic-gate  * in size; the arphdr structure defines the fixed-length portion.
300Sstevel@tonic-gate  * Protocol type values are the same as those for 10 Mb/s Ethernet.
310Sstevel@tonic-gate  * It is followed by the variable-sized fields ar_sha, arp_spa,
320Sstevel@tonic-gate  * arp_tha and arp_tpa in that order, according to the lengths
330Sstevel@tonic-gate  * specified.  Field names used correspond to RFC 826.
340Sstevel@tonic-gate  */
350Sstevel@tonic-gate struct	arphdr {
360Sstevel@tonic-gate 	ushort_t ar_hrd;	/* format of hardware address */
370Sstevel@tonic-gate #define	ARPHRD_ETHER 	1	/* ethernet hardware address */
38*2546Scarlsonj #define	ARPHRD_IEEE802 	6	/* IEEE 802 hardware address */
39*2546Scarlsonj #define	ARPHRD_IB	32	/* IPoIB hardware address */
400Sstevel@tonic-gate 	ushort_t ar_pro;	/* format of protocol address */
410Sstevel@tonic-gate 	uchar_t	ar_hln;		/* length of hardware address */
420Sstevel@tonic-gate 	uchar_t	ar_pln;		/* length of protocol address */
430Sstevel@tonic-gate 	ushort_t ar_op;		/* one of: */
440Sstevel@tonic-gate #define	ARPOP_REQUEST	1	/* request to resolve address */
450Sstevel@tonic-gate #define	ARPOP_REPLY	2	/* response to previous request */
460Sstevel@tonic-gate #define	REVARP_REQUEST	3	/* Reverse ARP request */
470Sstevel@tonic-gate #define	REVARP_REPLY	4	/* Reverse ARP reply */
480Sstevel@tonic-gate 	/*
490Sstevel@tonic-gate 	 * The remaining fields are variable in size,
500Sstevel@tonic-gate 	 * according to the sizes above, and are defined
510Sstevel@tonic-gate 	 * as appropriate for specific hardware/protocol
520Sstevel@tonic-gate 	 * combinations.  (E.g., see <netinet/if_ether.h>.)
530Sstevel@tonic-gate 	 */
540Sstevel@tonic-gate #ifdef	notdef
550Sstevel@tonic-gate 	uchar_t	ar_sha[];	/* sender hardware address */
560Sstevel@tonic-gate 	uchar_t	ar_spa[];	/* sender protocol address */
570Sstevel@tonic-gate 	uchar_t	ar_tha[];	/* target hardware address */
580Sstevel@tonic-gate 	uchar_t	ar_tpa[];	/* target protocol address */
590Sstevel@tonic-gate #endif	/* notdef */
600Sstevel@tonic-gate };
610Sstevel@tonic-gate 
62*2546Scarlsonj /* Maximum hardware and protocol address length */
63*2546Scarlsonj #define	ARP_MAX_ADDR_LEN	255
64*2546Scarlsonj 
650Sstevel@tonic-gate /*
660Sstevel@tonic-gate  * Extended ARP ioctl request
670Sstevel@tonic-gate  */
680Sstevel@tonic-gate struct xarpreq {
690Sstevel@tonic-gate 	struct	sockaddr_storage xarp_pa;	/* protocol address */
700Sstevel@tonic-gate 	struct	sockaddr_dl	 xarp_ha;	/* hardware address */
710Sstevel@tonic-gate 	int	xarp_flags;			/* flags */
720Sstevel@tonic-gate };
730Sstevel@tonic-gate 
740Sstevel@tonic-gate /*
750Sstevel@tonic-gate  * BSD ARP ioctl request
760Sstevel@tonic-gate  */
770Sstevel@tonic-gate struct arpreq {
780Sstevel@tonic-gate 	struct	sockaddr arp_pa;		/* protocol address */
790Sstevel@tonic-gate 	struct	sockaddr arp_ha;		/* hardware address */
800Sstevel@tonic-gate 	int	arp_flags;			/* flags */
810Sstevel@tonic-gate };
82*2546Scarlsonj /*  arp_flags field values */
830Sstevel@tonic-gate #define	ATF_INUSE	0x01	/* entry in use */
840Sstevel@tonic-gate #define	ATF_COM		0x02	/* completed entry (enaddr valid) */
850Sstevel@tonic-gate #define	ATF_PERM	0x04	/* permanent entry */
860Sstevel@tonic-gate #define	ATF_PUBL	0x08	/* publish entry (respond for other host) */
870Sstevel@tonic-gate #define	ATF_USETRAILERS	0x10	/* has requested trailers */
88*2546Scarlsonj #define	ATF_AUTHORITY	0x20	/* hardware address is authoritative */
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /*
910Sstevel@tonic-gate  * This data structure is used by kernel protocol modules to register
920Sstevel@tonic-gate  * their interest in a particular packet type with the Ethernet drivers.
930Sstevel@tonic-gate  * For example, other kinds of ARP would use this, XNS, ApleTalk, etc.
940Sstevel@tonic-gate  */
950Sstevel@tonic-gate struct ether_family {
960Sstevel@tonic-gate 	int		ef_family;	/* address family */
970Sstevel@tonic-gate 	ushort_t	ef_ethertype;	/* ethernet type field */
980Sstevel@tonic-gate 	struct ifqueue *(*ef_infunc)();	/* input function */
990Sstevel@tonic-gate 	int		(*ef_outfunc)();	/* output function */
1000Sstevel@tonic-gate 	int		(*ef_netisr)();	/* soft interrupt function */
1010Sstevel@tonic-gate 	struct ether_family *ef_next;	/* link to next on list */
1020Sstevel@tonic-gate };
1030Sstevel@tonic-gate 
1040Sstevel@tonic-gate #ifdef	__cplusplus
1050Sstevel@tonic-gate }
1060Sstevel@tonic-gate #endif
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate #endif	/* _NET_IF_ARP_H */
109