10Sstevel@tonic-gate /* 2*13095SDarren.Reed@Oracle.COM * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. 30Sstevel@tonic-gate */ 40Sstevel@tonic-gate 50Sstevel@tonic-gate /* 60Sstevel@tonic-gate * Copyright (c) 1986 Regents of the University of California. 70Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 80Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 90Sstevel@tonic-gate */ 100Sstevel@tonic-gate 110Sstevel@tonic-gate #ifndef _NET_IF_ARP_H 120Sstevel@tonic-gate #define _NET_IF_ARP_H 130Sstevel@tonic-gate 140Sstevel@tonic-gate /* if_arp.h 1.5 88/08/19 SMI; from UCB 7.1 1/24/86 */ 150Sstevel@tonic-gate 162546Scarlsonj #include <sys/types.h> 172546Scarlsonj #include <sys/socket.h> 182546Scarlsonj 190Sstevel@tonic-gate #ifdef __cplusplus 200Sstevel@tonic-gate extern "C" { 210Sstevel@tonic-gate #endif 220Sstevel@tonic-gate 230Sstevel@tonic-gate /* 240Sstevel@tonic-gate * Address Resolution Protocol. 250Sstevel@tonic-gate * 260Sstevel@tonic-gate * See RFC 826 for protocol description. ARP packets are variable 270Sstevel@tonic-gate * in size; the arphdr structure defines the fixed-length portion. 280Sstevel@tonic-gate * Protocol type values are the same as those for 10 Mb/s Ethernet. 290Sstevel@tonic-gate * It is followed by the variable-sized fields ar_sha, arp_spa, 300Sstevel@tonic-gate * arp_tha and arp_tpa in that order, according to the lengths 310Sstevel@tonic-gate * specified. Field names used correspond to RFC 826. 320Sstevel@tonic-gate */ 330Sstevel@tonic-gate struct arphdr { 340Sstevel@tonic-gate ushort_t ar_hrd; /* format of hardware address */ 350Sstevel@tonic-gate #define ARPHRD_ETHER 1 /* ethernet hardware address */ 36*13095SDarren.Reed@Oracle.COM #define ARPHRD_EETHER 2 /* experimental ethernet */ 37*13095SDarren.Reed@Oracle.COM #define ARPHRD_AX25 3 /* amateur readio ax.25 */ 38*13095SDarren.Reed@Oracle.COM #define ARPHRD_CHAOS 5 /* Chaos net */ 392546Scarlsonj #define ARPHRD_IEEE802 6 /* IEEE 802 hardware address */ 40*13095SDarren.Reed@Oracle.COM #define ARPHRD_ARCNET 7 /* ARCNET */ 413431Scarlsonj #define ARPHRD_FRAME 15 /* Frame relay */ 423431Scarlsonj #define ARPHRD_ATM 16 /* ATM */ 433431Scarlsonj #define ARPHRD_HDLC 17 /* HDLC */ 443431Scarlsonj #define ARPHRD_FC 18 /* Fibre Channel RFC 4338 */ 453431Scarlsonj #define ARPHRD_IPATM 19 /* ATM RFC 2225 */ 46*13095SDarren.Reed@Oracle.COM #define ARPHRD_METRICOM 23 /* Metricom */ 473431Scarlsonj #define ARPHRD_TUNNEL 31 /* IPsec Tunnel RFC 3456 */ 482546Scarlsonj #define ARPHRD_IB 32 /* IPoIB hardware address */ 490Sstevel@tonic-gate ushort_t ar_pro; /* format of protocol address */ 500Sstevel@tonic-gate uchar_t ar_hln; /* length of hardware address */ 510Sstevel@tonic-gate uchar_t ar_pln; /* length of protocol address */ 520Sstevel@tonic-gate ushort_t ar_op; /* one of: */ 530Sstevel@tonic-gate #define ARPOP_REQUEST 1 /* request to resolve address */ 540Sstevel@tonic-gate #define ARPOP_REPLY 2 /* response to previous request */ 550Sstevel@tonic-gate #define REVARP_REQUEST 3 /* Reverse ARP request */ 560Sstevel@tonic-gate #define REVARP_REPLY 4 /* Reverse ARP reply */ 570Sstevel@tonic-gate /* 580Sstevel@tonic-gate * The remaining fields are variable in size, 590Sstevel@tonic-gate * according to the sizes above, and are defined 600Sstevel@tonic-gate * as appropriate for specific hardware/protocol 610Sstevel@tonic-gate * combinations. (E.g., see <netinet/if_ether.h>.) 620Sstevel@tonic-gate */ 630Sstevel@tonic-gate #ifdef notdef 640Sstevel@tonic-gate uchar_t ar_sha[]; /* sender hardware address */ 650Sstevel@tonic-gate uchar_t ar_spa[]; /* sender protocol address */ 660Sstevel@tonic-gate uchar_t ar_tha[]; /* target hardware address */ 670Sstevel@tonic-gate uchar_t ar_tpa[]; /* target protocol address */ 680Sstevel@tonic-gate #endif /* notdef */ 690Sstevel@tonic-gate }; 700Sstevel@tonic-gate 712546Scarlsonj /* Maximum hardware and protocol address length */ 722546Scarlsonj #define ARP_MAX_ADDR_LEN 255 732546Scarlsonj 740Sstevel@tonic-gate /* 750Sstevel@tonic-gate * Extended ARP ioctl request 760Sstevel@tonic-gate */ 770Sstevel@tonic-gate struct xarpreq { 780Sstevel@tonic-gate struct sockaddr_storage xarp_pa; /* protocol address */ 790Sstevel@tonic-gate struct sockaddr_dl xarp_ha; /* hardware address */ 800Sstevel@tonic-gate int xarp_flags; /* flags */ 810Sstevel@tonic-gate }; 820Sstevel@tonic-gate 830Sstevel@tonic-gate /* 840Sstevel@tonic-gate * BSD ARP ioctl request 850Sstevel@tonic-gate */ 860Sstevel@tonic-gate struct arpreq { 870Sstevel@tonic-gate struct sockaddr arp_pa; /* protocol address */ 880Sstevel@tonic-gate struct sockaddr arp_ha; /* hardware address */ 890Sstevel@tonic-gate int arp_flags; /* flags */ 900Sstevel@tonic-gate }; 912546Scarlsonj /* arp_flags field values */ 920Sstevel@tonic-gate #define ATF_INUSE 0x01 /* entry in use */ 930Sstevel@tonic-gate #define ATF_COM 0x02 /* completed entry (enaddr valid) */ 940Sstevel@tonic-gate #define ATF_PERM 0x04 /* permanent entry */ 950Sstevel@tonic-gate #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 960Sstevel@tonic-gate #define ATF_USETRAILERS 0x10 /* has requested trailers */ 972546Scarlsonj #define ATF_AUTHORITY 0x20 /* hardware address is authoritative */ 980Sstevel@tonic-gate 990Sstevel@tonic-gate /* 1000Sstevel@tonic-gate * This data structure is used by kernel protocol modules to register 1010Sstevel@tonic-gate * their interest in a particular packet type with the Ethernet drivers. 1020Sstevel@tonic-gate * For example, other kinds of ARP would use this, XNS, ApleTalk, etc. 1030Sstevel@tonic-gate */ 1040Sstevel@tonic-gate struct ether_family { 1050Sstevel@tonic-gate int ef_family; /* address family */ 1060Sstevel@tonic-gate ushort_t ef_ethertype; /* ethernet type field */ 1070Sstevel@tonic-gate struct ifqueue *(*ef_infunc)(); /* input function */ 1080Sstevel@tonic-gate int (*ef_outfunc)(); /* output function */ 1090Sstevel@tonic-gate int (*ef_netisr)(); /* soft interrupt function */ 1100Sstevel@tonic-gate struct ether_family *ef_next; /* link to next on list */ 1110Sstevel@tonic-gate }; 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate #ifdef __cplusplus 1140Sstevel@tonic-gate } 1150Sstevel@tonic-gate #endif 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate #endif /* _NET_IF_ARP_H */ 118