1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright 1986-2003 Sun Microsystems, Inc. All rights reserved. 3*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 4*7c478bd9Sstevel@tonic-gate */ 5*7c478bd9Sstevel@tonic-gate 6*7c478bd9Sstevel@tonic-gate /* 7*7c478bd9Sstevel@tonic-gate * Copyright (c) 1982, 1986 Regents of the University of California. 8*7c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 9*7c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 10*7c478bd9Sstevel@tonic-gate */ 11*7c478bd9Sstevel@tonic-gate 12*7c478bd9Sstevel@tonic-gate #ifndef _NETINET_ARP_H 13*7c478bd9Sstevel@tonic-gate #define _NETINET_ARP_H 14*7c478bd9Sstevel@tonic-gate 15*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 16*7c478bd9Sstevel@tonic-gate 17*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 18*7c478bd9Sstevel@tonic-gate extern "C" { 19*7c478bd9Sstevel@tonic-gate #endif 20*7c478bd9Sstevel@tonic-gate 21*7c478bd9Sstevel@tonic-gate /* 22*7c478bd9Sstevel@tonic-gate * Address Resolution Protocol. 23*7c478bd9Sstevel@tonic-gate * 24*7c478bd9Sstevel@tonic-gate * See RFC 826 for protocol description. ARP packets are variable 25*7c478bd9Sstevel@tonic-gate * in size; the arphdr structure defines the fixed-length portion. 26*7c478bd9Sstevel@tonic-gate * Protocol type values are the same as those for 10 Mb/s Ethernet. 27*7c478bd9Sstevel@tonic-gate * It is followed by the variable-sized fields ar_sha, arp_spa, 28*7c478bd9Sstevel@tonic-gate * arp_tha and arp_tpa in that order, according to the lengths 29*7c478bd9Sstevel@tonic-gate * specified. Field names used correspond to RFC 826. 30*7c478bd9Sstevel@tonic-gate */ 31*7c478bd9Sstevel@tonic-gate struct arphdr { 32*7c478bd9Sstevel@tonic-gate ushort_t ar_hrd; /* format of hardware address */ 33*7c478bd9Sstevel@tonic-gate #define ARPHRD_ETHER 1 /* ethernet hardware address */ 34*7c478bd9Sstevel@tonic-gate #define ARPHRD_IB 32 /* IPoIB hardware address */ 35*7c478bd9Sstevel@tonic-gate ushort_t ar_pro; /* format of protocol address */ 36*7c478bd9Sstevel@tonic-gate uchar_t ar_hln; /* length of hardware address */ 37*7c478bd9Sstevel@tonic-gate uchar_t ar_pln; /* length of protocol address */ 38*7c478bd9Sstevel@tonic-gate ushort_t ar_op; /* one of: */ 39*7c478bd9Sstevel@tonic-gate #define ARPOP_REQUEST 1 /* request to resolve address */ 40*7c478bd9Sstevel@tonic-gate #define ARPOP_REPLY 2 /* response to previous request */ 41*7c478bd9Sstevel@tonic-gate #define REVARP_REQUEST 3 /* Reverse ARP request */ 42*7c478bd9Sstevel@tonic-gate #define REVARP_REPLY 4 /* Reverse ARP reply */ 43*7c478bd9Sstevel@tonic-gate /* 44*7c478bd9Sstevel@tonic-gate * The remaining fields are variable in size, 45*7c478bd9Sstevel@tonic-gate * according to the sizes above, and are defined 46*7c478bd9Sstevel@tonic-gate * as appropriate for specific hardware/protocol 47*7c478bd9Sstevel@tonic-gate * combinations. (E.g., see <netinet/if_ether.h>.) 48*7c478bd9Sstevel@tonic-gate */ 49*7c478bd9Sstevel@tonic-gate #ifdef notdef 50*7c478bd9Sstevel@tonic-gate uchar_t ar_sha[]; /* sender hardware address */ 51*7c478bd9Sstevel@tonic-gate uchar_t ar_spa[]; /* sender protocol address */ 52*7c478bd9Sstevel@tonic-gate uchar_t ar_tha[]; /* target hardware address */ 53*7c478bd9Sstevel@tonic-gate uchar_t ar_tpa[]; /* target protocol address */ 54*7c478bd9Sstevel@tonic-gate #endif /* notdef */ 55*7c478bd9Sstevel@tonic-gate }; 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate /* 58*7c478bd9Sstevel@tonic-gate * Ethernet Address Resolution Protocol. 59*7c478bd9Sstevel@tonic-gate * 60*7c478bd9Sstevel@tonic-gate * See RFC 826 for protocol description. Structure below is adapted 61*7c478bd9Sstevel@tonic-gate * to resolving internet addresses. Field names used correspond to 62*7c478bd9Sstevel@tonic-gate * RFC 826. 63*7c478bd9Sstevel@tonic-gate */ 64*7c478bd9Sstevel@tonic-gate struct ether_arp { 65*7c478bd9Sstevel@tonic-gate struct arphdr ea_hdr; /* fixed-size header */ 66*7c478bd9Sstevel@tonic-gate struct ether_addr arp_sha; /* sender hardware address */ 67*7c478bd9Sstevel@tonic-gate uchar_t arp_spa[4]; /* sender protocol address */ 68*7c478bd9Sstevel@tonic-gate struct ether_addr arp_tha; /* target hardware address */ 69*7c478bd9Sstevel@tonic-gate uchar_t arp_tpa[4]; /* target protocol address */ 70*7c478bd9Sstevel@tonic-gate }; 71*7c478bd9Sstevel@tonic-gate #define arp_hrd ea_hdr.ar_hrd 72*7c478bd9Sstevel@tonic-gate #define arp_pro ea_hdr.ar_pro 73*7c478bd9Sstevel@tonic-gate #define arp_hln ea_hdr.ar_hln 74*7c478bd9Sstevel@tonic-gate #define arp_pln ea_hdr.ar_pln 75*7c478bd9Sstevel@tonic-gate #define arp_op ea_hdr.ar_op 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* 78*7c478bd9Sstevel@tonic-gate * ARP ioctl request 79*7c478bd9Sstevel@tonic-gate */ 80*7c478bd9Sstevel@tonic-gate struct arpreq { 81*7c478bd9Sstevel@tonic-gate struct sockaddr arp_pa; /* protocol address */ 82*7c478bd9Sstevel@tonic-gate struct sockaddr arp_ha; /* hardware address */ 83*7c478bd9Sstevel@tonic-gate int arp_flags; /* flags */ 84*7c478bd9Sstevel@tonic-gate }; 85*7c478bd9Sstevel@tonic-gate /* arp_flags and at_flags field values */ 86*7c478bd9Sstevel@tonic-gate #define ATF_INUSE 0x01 /* entry in use */ 87*7c478bd9Sstevel@tonic-gate #define ATF_COM 0x02 /* completed entry (enaddr valid) */ 88*7c478bd9Sstevel@tonic-gate #define ATF_PERM 0x04 /* permanent entry */ 89*7c478bd9Sstevel@tonic-gate #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 90*7c478bd9Sstevel@tonic-gate #define ATF_USETRAILERS 0x10 /* has requested trailers */ 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 93*7c478bd9Sstevel@tonic-gate } 94*7c478bd9Sstevel@tonic-gate #endif 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate #endif /* _NETINET_ARP_H */ 97