1 /* 2 * Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6 /* 7 * Copyright (c) 1986 Regents of the University of California. 8 * All rights reserved. The Berkeley software License Agreement 9 * specifies the terms and conditions for redistribution. 10 */ 11 /* 12 * This libbc private version of if_arp.h is being created as an 13 * exact copy of <net/if_arp.h> prior to the addition of the 14 * "struct xarpreq" in the standard <net/if_arp.h>. The libbc code 15 * does not understand the structure elements in "struct xarpreq". 16 */ 17 18 19 #ifndef _net_if_arp_h 20 #define _net_if_arp_h 21 22 #pragma ident "%Z%%M% %I% %E% SMI" 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* 29 * Address Resolution Protocol. 30 * 31 * See RFC 826 for protocol description. ARP packets are variable 32 * in size; the arphdr structure defines the fixed-length portion. 33 * Protocol type values are the same as those for 10 Mb/s Ethernet. 34 * It is followed by the variable-sized fields ar_sha, arp_spa, 35 * arp_tha and arp_tpa in that order, according to the lengths 36 * specified. Field names used correspond to RFC 826. 37 */ 38 struct arphdr { 39 ushort_t ar_hrd; /* format of hardware address */ 40 #define ARPHRD_ETHER 1 /* ethernet hardware address */ 41 ushort_t ar_pro; /* format of protocol address */ 42 uchar_t ar_hln; /* length of hardware address */ 43 uchar_t ar_pln; /* length of protocol address */ 44 ushort_t ar_op; /* one of: */ 45 #define ARPOP_REQUEST 1 /* request to resolve address */ 46 #define ARPOP_REPLY 2 /* response to previous request */ 47 #define REVARP_REQUEST 3 /* Reverse ARP request */ 48 #define REVARP_REPLY 4 /* Reverse ARP reply */ 49 /* 50 * The remaining fields are variable in size, 51 * according to the sizes above, and are defined 52 * as appropriate for specific hardware/protocol 53 * combinations. (E.g., see <netinet/if_ether.h>.) 54 */ 55 #ifdef notdef 56 uchar_t ar_sha[]; /* sender hardware address */ 57 uchar_t ar_spa[]; /* sender protocol address */ 58 uchar_t ar_tha[]; /* target hardware address */ 59 uchar_t ar_tpa[]; /* target protocol address */ 60 #endif /* notdef */ 61 }; 62 63 /* 64 * ARP ioctl request 65 */ 66 struct arpreq { 67 struct sockaddr arp_pa; /* protocol address */ 68 struct sockaddr arp_ha; /* hardware address */ 69 int arp_flags; /* flags */ 70 }; 71 /* arp_flags and at_flags field values */ 72 #define ATF_INUSE 0x01 /* entry in use */ 73 #define ATF_COM 0x02 /* completed entry (enaddr valid) */ 74 #define ATF_PERM 0x04 /* permanent entry */ 75 #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 76 #define ATF_USETRAILERS 0x10 /* has requested trailers */ 77 78 /* 79 * This data structure is used by kernel protocol modules to register 80 * their interest in a particular packet type with the Ethernet drivers. 81 * For example, other kinds of ARP would use this, XNS, ApleTalk, etc. 82 */ 83 struct ether_family { 84 int ef_family; /* address family */ 85 ushort_t ef_ethertype; /* ethernet type field */ 86 struct ifqueue *(*ef_infunc)(); /* input function */ 87 int (*ef_outfunc)(); /* output function */ 88 int (*ef_netisr)(); /* soft interrupt function */ 89 struct ether_family *ef_next; /* link to next on list */ 90 }; 91 92 #ifdef __cplusplus 93 } 94 #endif 95 96 #endif /* _net_if_arp_h */ 97