June 2025 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
26 | 27 | 28 | 29 | 30 | 31 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 1 | 2 | 3 | 4 | 5 | 6 |
001: /* Definitions for Address Resolution Protocol. 002: Copyright (C) 1997,1999,2001,2006,2009 Free Software Foundation, Inc. 003: This file is part of the GNU C Library. 004: Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. 005: 006: The GNU C Library is free software; you can redistribute it and/or 007: modify it under the terms of the GNU Lesser General Public 008: License as published by the Free Software Foundation; either 009: version 2.1 of the License, or (at your option) any later version. 010: 011: The GNU C Library is distributed in the hope that it will be useful, 012: but WITHOUT ANY WARRANTY; without even the implied warranty of 013: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014: Lesser General Public License for more details. 015: 016: You should have received a copy of the GNU Lesser General Public 017: License along with the GNU C Library; if not, write to the Free 018: Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 019: 02111-1307 USA. */ 020: 021: /* Based on the 4.4BSD and Linux version of this file. */ 022: 023: #ifndef _NET_IF_ARP_H 024: 025: #define _NET_IF_ARP_H 1 026: #include <sys/cdefs.h> 027: 028: #include <sys/types.h> 029: #include <sys/socket.h> 030: 031: __BEGIN_DECLS 032: 033: /* Some internals from deep down in the kernel. */ 034: #define MAX_ADDR_LEN 7 035: 036: 037: /* This structure defines an ethernet arp header. */ 038: 039: /* ARP protocol opcodes. */ 040: #define ARPOP_REQUEST 1 /* ARP request. */ 041: #define ARPOP_REPLY 2 /* ARP reply. */ 042: #define ARPOP_RREQUEST 3 /* RARP request. */ 043: #define ARPOP_RREPLY 4 /* RARP reply. */ 044: #define ARPOP_InREQUEST 8 /* InARP request. */ 045: #define ARPOP_InREPLY 9 /* InARP reply. */ 046: #define ARPOP_NAK 10 /* (ATM)ARP NAK. */ 047: 048: /* See RFC 826 for protocol description. ARP packets are variable 049: in size; the arphdr structure defines the fixed-length portion. 050: Protocol type values are the same as those for 10 Mb/s Ethernet. 051: It is followed by the variable-sized fields ar_sha, arp_spa, 052: arp_tha and arp_tpa in that order, according to the lengths 053: specified. Field names used correspond to RFC 826. */ 054: 055: struct arphdr 056: { 057: unsigned short int ar_hrd; /* Format of hardware address. */ 058: unsigned short int ar_pro; /* Format of protocol address. */ 059: unsigned char ar_hln; /* Length of hardware address. */ 060: unsigned char ar_pln; /* Length of protocol address. */ 061: unsigned short int ar_op; /* ARP opcode (command). */ 062: #if 0 063: /* Ethernet looks like this : This bit is variable sized 064: however... */ 065: unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */ 066: unsigned char __ar_sip[4]; /* Sender IP address. */ 067: unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */ 068: unsigned char __ar_tip[4]; /* Target IP address. */ 069: #endif 070: }; 071: 072: 073: /* ARP protocol HARDWARE identifiers. */ 074: #define ARPHRD_NETROM 0 /* From KA9Q: NET/ROM pseudo. */ 075: #define ARPHRD_ETHER 1 /* Ethernet 10/100Mbps. */ 076: #define ARPHRD_EETHER 2 /* Experimental Ethernet. */ 077: #define ARPHRD_AX25 3 /* AX.25 Level 2. */ 078: #define ARPHRD_PRONET 4 /* PROnet token ring. */ 079: #define ARPHRD_CHAOS 5 /* Chaosnet. */ 080: #define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB. */ 081: #define ARPHRD_ARCNET 7 /* ARCnet. */ 082: #define ARPHRD_APPLETLK 8 /* APPLEtalk. */ 083: #define ARPHRD_DLCI 15 /* Frame Relay DLCI. */ 084: #define ARPHRD_ATM 19 /* ATM. */ 085: #define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id). */ 086: #define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734. */ 087: #define ARPHRD_EUI64 27 /* EUI-64. */ 088: #define ARPHRD_INFINIBAND 32 /* InfiniBand. */ 089: 090: /* Dummy types for non ARP hardware */ 091: #define ARPHRD_SLIP 256 092: #define ARPHRD_CSLIP 257 093: #define ARPHRD_SLIP6 258 094: #define ARPHRD_CSLIP6 259 095: #define ARPHRD_RSRVD 260 /* Notional KISS type. */ 096: #define ARPHRD_ADAPT 264 097: #define ARPHRD_ROSE 270 098: #define ARPHRD_X25 271 /* CCITT X.25. */ 099: #define ARPHRD_HWX25 272 /* Boards with X.25 in firmware. */ 100: #define ARPHRD_PPP 512 101: #define ARPHRD_CISCO 513 /* Cisco HDLC. */ 102: #define ARPHRD_HDLC ARPHRD_CISCO 103: #define ARPHRD_LAPB 516 /* LAPB. */ 104: #define ARPHRD_DDCMP 517 /* Digital's DDCMP. */ 105: #define ARPHRD_RAWHDLC 518 /* Raw HDLC. */ 106: 107: #define ARPHRD_TUNNEL 768 /* IPIP tunnel. */ 108: #define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel. */ 109: #define ARPHRD_FRAD 770 /* Frame Relay Access Device. */ 110: #define ARPHRD_SKIP 771 /* SKIP vif. */ 111: #define ARPHRD_LOOPBACK 772 /* Loopback device. */ 112: #define ARPHRD_LOCALTLK 773 /* Localtalk device. */ 113: #define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface. */ 114: #define ARPHRD_BIF 775 /* AP1000 BIF. */ 115: #define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4. */ 116: #define ARPHRD_IPDDP 777 /* IP-in-DDP tunnel. */ 117: #define ARPHRD_IPGRE 778 /* GRE over IP. */ 118: #define ARPHRD_PIMREG 779 /* PIMSM register interface. */ 119: #define ARPHRD_HIPPI 780 /* High Performance Parallel I'face. */ 120: #define ARPHRD_ASH 781 /* (Nexus Electronics) Ash. */ 121: #define ARPHRD_ECONET 782 /* Acorn Econet. */ 122: #define ARPHRD_IRDA 783 /* Linux-IrDA. */ 123: #define ARPHRD_FCPP 784 /* Point to point fibrechanel. */ 124: #define ARPHRD_FCAL 785 /* Fibrechanel arbitrated loop. */ 125: #define ARPHRD_FCPL 786 /* Fibrechanel public loop. */ 126: #define ARPHRD_FCFABRIC 787 /* Fibrechanel fabric. */ 127: #define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR. */ 128: #define ARPHRD_IEEE80211 801 /* IEEE 802.11. */ 129: #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header. */ 130: #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header. */ 131: #define ARPHRD_IEEE802154 804 /* IEEE 802.15.4 header. */ 132: #define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */ 133: 134: #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known. */ 135: #define ARPHRD_NONE 0xFFFE /* Zero header length. */ 136: 137: 138: /* ARP ioctl request. */ 139: struct arpreq 140: { 141: struct sockaddr arp_pa; /* Protocol address. */ 142: struct sockaddr arp_ha; /* Hardware address. */ 143: int arp_flags; /* Flags. */ 144: struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */ 145: char arp_dev[16]; 146: }; 147: 148: struct arpreq_old 149: { 150: struct sockaddr arp_pa; /* Protocol address. */ 151: struct sockaddr arp_ha; /* Hardware address. */ 152: int arp_flags; /* Flags. */ 153: struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */ 154: }; 155: 156: /* ARP Flag values. */ 157: #define ATF_COM 0x02 /* Completed entry (ha valid). */ 158: #define ATF_PERM 0x04 /* Permanent entry. */ 159: #define ATF_PUBL 0x08 /* Publish entry. */ 160: #define ATF_USETRAILERS 0x10 /* Has requested trailers. */ 161: #define ATF_NETMASK 0x20 /* Want to use a netmask (only 162: for proxy entries). */ 163: #define ATF_DONTPUB 0x40 /* Don't answer this addresses. */ 164: #define ATF_MAGIC 0x80 /* Automatically added entry. */ 165: 166: 167: /* Support for the user space arp daemon, arpd. */ 168: #define ARPD_UPDATE 0x01 169: #define ARPD_LOOKUP 0x02 170: #define ARPD_FLUSH 0x03 171: 172: struct arpd_request 173: { 174: unsigned short int req; /* Request type. */ 175: u_int32_t ip; /* IP address of entry. */ 176: unsigned long int dev; /* Device entry is tied to. */ 177: unsigned long int stamp; 178: unsigned long int updated; 179: unsigned char ha[MAX_ADDR_LEN]; /* Hardware address. */ 180: }; 181: 182: __END_DECLS 183: 184: #endif /* net/if_arp.h */ 185: