| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * INET		An implementation of the TCP/IP protocol suite for the LINUX | 
 | 3 |  *		operating system.  INET is implemented using the  BSD Socket | 
 | 4 |  *		interface as the means of communication with the user level. | 
 | 5 |  * | 
 | 6 |  *		Global definitions for the ARP (RFC 826) protocol. | 
 | 7 |  * | 
 | 8 |  * Version:	@(#)if_arp.h	1.0.1	04/16/93 | 
 | 9 |  * | 
 | 10 |  * Authors:	Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 | 
 | 11 |  *		Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source. | 
| Jesper Juhl | 02c30a8 | 2005-05-05 16:16:16 -0700 | [diff] [blame] | 12 |  *		Ross Biro | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 |  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 
 | 14 |  *		Florian La Roche, | 
 | 15 |  *		Jonathan Layes <layes@loran.com> | 
 | 16 |  *		Arnaldo Carvalho de Melo <acme@conectiva.com.br> ARPHRD_HWX25 | 
 | 17 |  * | 
 | 18 |  *		This program is free software; you can redistribute it and/or | 
 | 19 |  *		modify it under the terms of the GNU General Public License | 
 | 20 |  *		as published by the Free Software Foundation; either version | 
 | 21 |  *		2 of the License, or (at your option) any later version. | 
 | 22 |  */ | 
 | 23 | #ifndef _LINUX_IF_ARP_H | 
 | 24 | #define _LINUX_IF_ARP_H | 
 | 25 |  | 
 | 26 | #include <linux/netdevice.h> | 
 | 27 |  | 
 | 28 | /* ARP protocol HARDWARE identifiers. */ | 
 | 29 | #define ARPHRD_NETROM	0		/* from KA9Q: NET/ROM pseudo	*/ | 
 | 30 | #define ARPHRD_ETHER 	1		/* Ethernet 10Mbps		*/ | 
 | 31 | #define	ARPHRD_EETHER	2		/* Experimental Ethernet	*/ | 
 | 32 | #define	ARPHRD_AX25	3		/* AX.25 Level 2		*/ | 
 | 33 | #define	ARPHRD_PRONET	4		/* PROnet token ring		*/ | 
 | 34 | #define	ARPHRD_CHAOS	5		/* Chaosnet			*/ | 
 | 35 | #define	ARPHRD_IEEE802	6		/* IEEE 802.2 Ethernet/TR/TB	*/ | 
 | 36 | #define	ARPHRD_ARCNET	7		/* ARCnet			*/ | 
 | 37 | #define	ARPHRD_APPLETLK	8		/* APPLEtalk			*/ | 
 | 38 | #define ARPHRD_DLCI	15		/* Frame Relay DLCI		*/ | 
 | 39 | #define ARPHRD_ATM	19		/* ATM 				*/ | 
 | 40 | #define ARPHRD_METRICOM	23		/* Metricom STRIP (new IANA id)	*/ | 
 | 41 | #define	ARPHRD_IEEE1394	24		/* IEEE 1394 IPv4 - RFC 2734	*/ | 
 | 42 | #define ARPHRD_EUI64	27		/* EUI-64                       */ | 
 | 43 | #define ARPHRD_INFINIBAND 32		/* InfiniBand			*/ | 
 | 44 |  | 
 | 45 | /* Dummy types for non ARP hardware */ | 
 | 46 | #define ARPHRD_SLIP	256 | 
 | 47 | #define ARPHRD_CSLIP	257 | 
 | 48 | #define ARPHRD_SLIP6	258 | 
 | 49 | #define ARPHRD_CSLIP6	259 | 
 | 50 | #define ARPHRD_RSRVD	260		/* Notional KISS type 		*/ | 
 | 51 | #define ARPHRD_ADAPT	264 | 
 | 52 | #define ARPHRD_ROSE	270 | 
 | 53 | #define ARPHRD_X25	271		/* CCITT X.25			*/ | 
 | 54 | #define ARPHRD_HWX25	272		/* Boards with X.25 in firmware	*/ | 
| Oliver Hartkopp | cd05acf | 2007-12-16 15:59:24 -0800 | [diff] [blame] | 55 | #define ARPHRD_CAN	280		/* Controller Area Network      */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #define ARPHRD_PPP	512 | 
 | 57 | #define ARPHRD_CISCO	513		/* Cisco HDLC	 		*/ | 
 | 58 | #define ARPHRD_HDLC	ARPHRD_CISCO | 
 | 59 | #define ARPHRD_LAPB	516		/* LAPB				*/ | 
 | 60 | #define ARPHRD_DDCMP    517		/* Digital's DDCMP protocol     */ | 
 | 61 | #define ARPHRD_RAWHDLC	518		/* Raw HDLC			*/ | 
 | 62 |  | 
 | 63 | #define ARPHRD_TUNNEL	768		/* IPIP tunnel			*/ | 
 | 64 | #define ARPHRD_TUNNEL6	769		/* IP6IP6 tunnel       		*/ | 
 | 65 | #define ARPHRD_FRAD	770             /* Frame Relay Access Device    */ | 
 | 66 | #define ARPHRD_SKIP	771		/* SKIP vif			*/ | 
 | 67 | #define ARPHRD_LOOPBACK	772		/* Loopback device		*/ | 
 | 68 | #define ARPHRD_LOCALTLK 773		/* Localtalk device		*/ | 
 | 69 | #define ARPHRD_FDDI	774		/* Fiber Distributed Data Interface */ | 
 | 70 | #define ARPHRD_BIF      775             /* AP1000 BIF                   */ | 
 | 71 | #define ARPHRD_SIT	776		/* sit0 device - IPv6-in-IPv4	*/ | 
 | 72 | #define ARPHRD_IPDDP	777		/* IP over DDP tunneller	*/ | 
 | 73 | #define ARPHRD_IPGRE	778		/* GRE over IP			*/ | 
 | 74 | #define ARPHRD_PIMREG	779		/* PIMSM register interface	*/ | 
 | 75 | #define ARPHRD_HIPPI	780		/* High Performance Parallel Interface */ | 
 | 76 | #define ARPHRD_ASH	781		/* Nexus 64Mbps Ash		*/ | 
 | 77 | #define ARPHRD_ECONET	782		/* Acorn Econet			*/ | 
 | 78 | #define ARPHRD_IRDA 	783		/* Linux-IrDA			*/ | 
 | 79 | /* ARP works differently on different FC media .. so  */ | 
 | 80 | #define ARPHRD_FCPP	784		/* Point to point fibrechannel	*/ | 
 | 81 | #define ARPHRD_FCAL	785		/* Fibrechannel arbitrated loop */ | 
 | 82 | #define ARPHRD_FCPL	786		/* Fibrechannel public loop	*/ | 
 | 83 | #define ARPHRD_FCFABRIC	787		/* Fibrechannel fabric		*/ | 
 | 84 | 	/* 787->799 reserved for fibrechannel media types */ | 
| stephen hemminger | 37c106d | 2012-05-22 11:01:05 +0000 | [diff] [blame] | 85 | #define ARPHRD_IEEE802_TR 800		/* Magic type ident for TR	*/ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | #define ARPHRD_IEEE80211 801		/* IEEE 802.11			*/ | 
 | 87 | #define ARPHRD_IEEE80211_PRISM 802	/* IEEE 802.11 + Prism2 header  */ | 
| James Ketrenos | 3905ec4 | 2005-09-21 11:56:42 -0500 | [diff] [blame] | 88 | #define ARPHRD_IEEE80211_RADIOTAP 803	/* IEEE 802.11 + radiotap header */ | 
| Sergey Lapin | fcb94e4 | 2009-06-08 12:18:47 +0000 | [diff] [blame] | 89 | #define ARPHRD_IEEE802154	  804 | 
| alex.bluesman.smirnov@gmail.com | 0606069 | 2012-05-15 20:50:29 +0000 | [diff] [blame] | 90 | #define ARPHRD_IEEE802154_MONITOR 805	/* IEEE 802.15.4 network monitor */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 |  | 
| Rémi Denis-Courmont | 2d91d78 | 2008-12-17 15:47:29 -0800 | [diff] [blame] | 92 | #define ARPHRD_PHONET	820		/* PhoNet media type		*/ | 
| Rémi Denis-Courmont | 57c81ff | 2008-12-17 15:47:48 -0800 | [diff] [blame] | 93 | #define ARPHRD_PHONET_PIPE 821		/* PhoNet pipe header		*/ | 
| Sjur Braendeland | 70596b6 | 2010-03-30 13:56:19 +0000 | [diff] [blame] | 94 | #define ARPHRD_CAIF	822		/* CAIF media type		*/ | 
| xeb@mail.ru | c12b395 | 2012-08-10 00:51:50 +0000 | [diff] [blame^] | 95 | #define ARPHRD_IP6GRE	823		/* GRE over IPv6		*/ | 
| Rémi Denis-Courmont | 2d91d78 | 2008-12-17 15:47:29 -0800 | [diff] [blame] | 96 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | #define ARPHRD_VOID	  0xFFFF	/* Void type, nothing is known */ | 
 | 98 | #define ARPHRD_NONE	  0xFFFE	/* zero header length */ | 
 | 99 |  | 
 | 100 | /* ARP protocol opcodes. */ | 
 | 101 | #define	ARPOP_REQUEST	1		/* ARP request			*/ | 
 | 102 | #define	ARPOP_REPLY	2		/* ARP reply			*/ | 
 | 103 | #define	ARPOP_RREQUEST	3		/* RARP request			*/ | 
 | 104 | #define	ARPOP_RREPLY	4		/* RARP reply			*/ | 
 | 105 | #define	ARPOP_InREQUEST	8		/* InARP request		*/ | 
 | 106 | #define	ARPOP_InREPLY	9		/* InARP reply			*/ | 
 | 107 | #define	ARPOP_NAK	10		/* (ATM)ARP NAK			*/ | 
 | 108 |  | 
 | 109 |  | 
 | 110 | /* ARP ioctl request. */ | 
 | 111 | struct arpreq { | 
 | 112 |   struct sockaddr	arp_pa;		/* protocol address		*/ | 
 | 113 |   struct sockaddr	arp_ha;		/* hardware address		*/ | 
 | 114 |   int			arp_flags;	/* flags			*/ | 
 | 115 |   struct sockaddr       arp_netmask;    /* netmask (only for proxy arps) */ | 
 | 116 |   char			arp_dev[16]; | 
 | 117 | }; | 
 | 118 |  | 
 | 119 | struct arpreq_old { | 
 | 120 |   struct sockaddr	arp_pa;		/* protocol address		*/ | 
 | 121 |   struct sockaddr	arp_ha;		/* hardware address		*/ | 
 | 122 |   int			arp_flags;	/* flags			*/ | 
 | 123 |   struct sockaddr       arp_netmask;    /* netmask (only for proxy arps) */ | 
 | 124 | }; | 
 | 125 |  | 
 | 126 | /* ARP Flag values. */ | 
 | 127 | #define ATF_COM		0x02		/* completed entry (ha valid)	*/ | 
 | 128 | #define	ATF_PERM	0x04		/* permanent entry		*/ | 
 | 129 | #define	ATF_PUBL	0x08		/* publish entry		*/ | 
 | 130 | #define	ATF_USETRAILERS	0x10		/* has requested trailers	*/ | 
 | 131 | #define ATF_NETMASK     0x20            /* want to use a netmask (only | 
 | 132 | 					   for proxy entries) */ | 
 | 133 | #define ATF_DONTPUB	0x40		/* don't answer this addresses	*/ | 
 | 134 |  | 
 | 135 | /* | 
 | 136 |  *	This structure defines an ethernet arp header. | 
 | 137 |  */ | 
 | 138 |  | 
| Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 139 | struct arphdr { | 
| Al Viro | bd6d610a | 2006-09-27 18:35:47 -0700 | [diff] [blame] | 140 | 	__be16		ar_hrd;		/* format of hardware address	*/ | 
 | 141 | 	__be16		ar_pro;		/* format of protocol address	*/ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | 	unsigned char	ar_hln;		/* length of hardware address	*/ | 
 | 143 | 	unsigned char	ar_pln;		/* length of protocol address	*/ | 
| Al Viro | bd6d610a | 2006-09-27 18:35:47 -0700 | [diff] [blame] | 144 | 	__be16		ar_op;		/* ARP opcode (command)		*/ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 |  | 
 | 146 | #if 0 | 
 | 147 | 	 /* | 
 | 148 | 	  *	 Ethernet looks like this : This bit is variable sized however... | 
 | 149 | 	  */ | 
 | 150 | 	unsigned char		ar_sha[ETH_ALEN];	/* sender hardware address	*/ | 
 | 151 | 	unsigned char		ar_sip[4];		/* sender IP address		*/ | 
 | 152 | 	unsigned char		ar_tha[ETH_ALEN];	/* target hardware address	*/ | 
 | 153 | 	unsigned char		ar_tip[4];		/* target IP address		*/ | 
 | 154 | #endif | 
 | 155 |  | 
 | 156 | }; | 
 | 157 |  | 
| Arnaldo Carvalho de Melo | d0a92be | 2007-03-12 20:56:31 -0300 | [diff] [blame] | 158 | #ifdef __KERNEL__ | 
 | 159 | #include <linux/skbuff.h> | 
 | 160 |  | 
 | 161 | static inline struct arphdr *arp_hdr(const struct sk_buff *skb) | 
 | 162 | { | 
 | 163 | 	return (struct arphdr *)skb_network_header(skb); | 
 | 164 | } | 
| Pavel Emelyanov | 988b705 | 2008-03-03 12:20:57 -0800 | [diff] [blame] | 165 |  | 
 | 166 | static inline int arp_hdr_len(struct net_device *dev) | 
 | 167 | { | 
 | 168 | 	/* ARP header, plus 2 device addresses, plus 2 IP addresses. */ | 
 | 169 | 	return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; | 
 | 170 | } | 
| Arnaldo Carvalho de Melo | d0a92be | 2007-03-12 20:56:31 -0300 | [diff] [blame] | 171 | #endif | 
 | 172 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | #endif	/* _LINUX_IF_ARP_H */ |