]>
Commit | Line | Data |
---|---|---|
fd26970f UD |
1 | /* Definitions for Address Resolution Protocol. |
2 | Copyright (C) 1997 Free Software Foundation, Inc. | |
3 | This file is part of the GNU C Library. | |
4 | Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Library General Public License as | |
8 | published by the Free Software Foundation; either version 2 of the | |
9 | License, or (at your option) any later version. | |
10 | ||
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Library General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Library General Public | |
17 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
18 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | /* Based on the 4.4BSD and Linux version of this file. */ | |
22 | ||
23 | #ifndef _NET_IF_ARP_H | |
24 | ||
25 | #define _NET_IF_ARP_H 1 | |
26 | #include <sys/cdefs.h> | |
27 | ||
28 | #include <sys/types.h> | |
29 | ||
30 | __BEGIN_DECLS | |
31 | ||
32 | /* This structure defines an ethernet arp header. */ | |
33 | ||
34 | /* ARP protocol opcodes. */ | |
35 | #define ARPOP_REQUEST 1 /* ARP request. */ | |
36 | #define ARPOP_REPLY 2 /* ARP reply. */ | |
37 | #define ARPOP_RREQUEST 3 /* RARP request. */ | |
38 | #define ARPOP_RREPLY 4 /* RARP reply. */ | |
39 | ||
40 | /* See RFC 826 for protocol description. ARP packets are variable | |
41 | in size; the arphdr structure defines the fixed-length portion. | |
42 | Protocol type values are the same as those for 10 Mb/s Ethernet. | |
43 | It is followed by the variable-sized fields ar_sha, arp_spa, | |
44 | arp_tha and arp_tpa in that order, according to the lengths | |
45 | specified. Field names used correspond to RFC 826. */ | |
46 | ||
47 | struct arphdr | |
48 | { | |
49 | unsigned short int ar_hrd; /* Format of hardware address. */ | |
50 | unsigned short int ar_pro; /* Format of protocol address. */ | |
51 | unsigned char ar_hln; /* Length of hardware address. */ | |
52 | unsigned char ar_pln; /* Length of protocol address. */ | |
53 | unsigned short int ar_op; /* ARP opcode (command). */ | |
54 | #if 0 | |
55 | /* Ethernet looks like this : This bit is variable sized | |
56 | however... */ | |
57 | unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */ | |
58 | unsigned char __ar_sip[4]; /* Sender IP address. */ | |
59 | unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */ | |
60 | unsigned char __ar_tip[4]; /* Target IP address. */ | |
61 | #endif | |
62 | }; | |
63 | ||
64 | ||
65 | /* ARP protocol HARDWARE identifiers. */ | |
66 | #define ARPHRD_NETROM 0 /* From KA9Q: NET/ROM pseudo. */ | |
67 | #define ARPHRD_ETHER 1 /* Ethernet 10Mbps. */ | |
68 | #define ARPHRD_EETHER 2 /* Experimental Ethernet. */ | |
69 | #define ARPHRD_AX25 3 /* AX.25 Level 2. */ | |
70 | #define ARPHRD_PRONET 4 /* PROnet token ring. */ | |
71 | #define ARPHRD_CHAOS 5 /* Chaosnet. */ | |
72 | #define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB. */ | |
73 | #define ARPHRD_ARCNET 7 /* ARCnet. */ | |
74 | #define ARPHRD_APPLETLK 8 /* APPLEtalk. */ | |
75 | #define ARPHRD_DLCI 15 /* Frame Relay DLCI. */ | |
76 | #define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id). */ | |
77 | ||
78 | /* Dummy types for non ARP hardware */ | |
79 | #define ARPHRD_SLIP 256 | |
80 | #define ARPHRD_CSLIP 257 | |
81 | #define ARPHRD_SLIP6 258 | |
82 | #define ARPHRD_CSLIP6 259 | |
83 | #define ARPHRD_RSRVD 260 /* Notional KISS type. */ | |
84 | #define ARPHRD_ADAPT 264 | |
85 | #define ARPHRD_ROSE 270 | |
86 | #define ARPHRD_X25 271 /* CCITT X.25. */ | |
87 | #define ARPHRD_PPP 512 | |
88 | ||
89 | #define ARPHRD_TUNNEL 768 /* IPIP tunnel. */ | |
90 | #define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel. */ | |
91 | #define ARPHRD_FRAD 770 /* Frame Relay Access Device. */ | |
92 | #define ARPHRD_SKIP 771 /* SKIP vif. */ | |
93 | #define ARPHRD_LOOPBACK 772 /* Loopback device. */ | |
94 | #define ARPHRD_LOCALTLK 773 /* Localtalk device. */ | |
95 | #define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface. */ | |
96 | #define ARPHRD_BIF 775 /* AP1000 BIF. */ | |
97 | #define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4. */ | |
98 | ||
99 | ||
100 | /* ARP ioctl request. */ | |
101 | struct arpreq | |
102 | { | |
103 | struct sockaddr arp_pa; /* Protocol address. */ | |
104 | struct sockaddr arp_ha; /* Hardware address. */ | |
105 | int arp_flags; /* Flags. */ | |
106 | struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */ | |
107 | char arp_dev[16]; | |
108 | }; | |
109 | ||
110 | struct arpreq_old | |
111 | { | |
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 | }; | |
117 | ||
118 | /* ARP Flag values. */ | |
119 | #define ATF_COM 0x02 /* Completed entry (ha valid). */ | |
120 | #define ATF_PERM 0x04 /* Permanent entry. */ | |
121 | #define ATF_PUBL 0x08 /* Publish entry. */ | |
122 | #define ATF_USETRAILERS 0x10 /* Has requested trailers. */ | |
123 | #define ATF_NETMASK 0x20 /* Want to use a netmask (only | |
124 | for proxy entries). */ | |
125 | #define ATF_DONTPUB 0x40 /* Don't answer this addresses. */ | |
126 | #define ATF_MAGIC 0x80 /* Automatically added entry. */ | |
127 | ||
128 | ||
129 | /* Support for the user space arp daemon, arpd. */ | |
130 | #define ARPD_UPDATE 0x01 | |
131 | #define ARPD_LOOKUP 0x02 | |
132 | #define ARPD_FLUSH 0x03 | |
133 | ||
134 | struct arpd_request | |
135 | { | |
136 | unsigned short int req; /* Request type. */ | |
137 | u_int32_t ip; /* IP address of entry. */ | |
138 | unsigned long int dev; /* Device entry is tied to. */ | |
139 | unsigned long int stamp; | |
140 | unsigned long int updated; | |
141 | unsigned char ha[MAX_ADDR_LEN]; /* Hardware address. */ | |
142 | }; | |
143 | ||
144 | __END_DECLS | |
145 | ||
146 | #endif /* net/if_arp.h */ |