17c478bd9Sstevel@tonic-gate /* 2*a6911619SDarren Reed * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. 37c478bd9Sstevel@tonic-gate */ 47c478bd9Sstevel@tonic-gate 57c478bd9Sstevel@tonic-gate /* 67c478bd9Sstevel@tonic-gate * Copyright (c) 1986 Regents of the University of California. 77c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 87c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 97c478bd9Sstevel@tonic-gate */ 107c478bd9Sstevel@tonic-gate 117c478bd9Sstevel@tonic-gate #ifndef _NET_IF_ARP_H 127c478bd9Sstevel@tonic-gate #define _NET_IF_ARP_H 137c478bd9Sstevel@tonic-gate 147c478bd9Sstevel@tonic-gate /* if_arp.h 1.5 88/08/19 SMI; from UCB 7.1 1/24/86 */ 157c478bd9Sstevel@tonic-gate 1669bb4bb4Scarlsonj #include <sys/types.h> 1769bb4bb4Scarlsonj #include <sys/socket.h> 1869bb4bb4Scarlsonj 197c478bd9Sstevel@tonic-gate #ifdef __cplusplus 207c478bd9Sstevel@tonic-gate extern "C" { 217c478bd9Sstevel@tonic-gate #endif 227c478bd9Sstevel@tonic-gate 237c478bd9Sstevel@tonic-gate /* 247c478bd9Sstevel@tonic-gate * Address Resolution Protocol. 257c478bd9Sstevel@tonic-gate * 267c478bd9Sstevel@tonic-gate * See RFC 826 for protocol description. ARP packets are variable 277c478bd9Sstevel@tonic-gate * in size; the arphdr structure defines the fixed-length portion. 287c478bd9Sstevel@tonic-gate * Protocol type values are the same as those for 10 Mb/s Ethernet. 297c478bd9Sstevel@tonic-gate * It is followed by the variable-sized fields ar_sha, arp_spa, 307c478bd9Sstevel@tonic-gate * arp_tha and arp_tpa in that order, according to the lengths 317c478bd9Sstevel@tonic-gate * specified. Field names used correspond to RFC 826. 327c478bd9Sstevel@tonic-gate */ 337c478bd9Sstevel@tonic-gate struct arphdr { 347c478bd9Sstevel@tonic-gate ushort_t ar_hrd; /* format of hardware address */ 357c478bd9Sstevel@tonic-gate #define ARPHRD_ETHER 1 /* ethernet hardware address */ 36*a6911619SDarren Reed #define ARPHRD_EETHER 2 /* experimental ethernet */ 37*a6911619SDarren Reed #define ARPHRD_AX25 3 /* amateur readio ax.25 */ 38*a6911619SDarren Reed #define ARPHRD_CHAOS 5 /* Chaos net */ 3969bb4bb4Scarlsonj #define ARPHRD_IEEE802 6 /* IEEE 802 hardware address */ 40*a6911619SDarren Reed #define ARPHRD_ARCNET 7 /* ARCNET */ 41d04ccbb3Scarlsonj #define ARPHRD_FRAME 15 /* Frame relay */ 42d04ccbb3Scarlsonj #define ARPHRD_ATM 16 /* ATM */ 43d04ccbb3Scarlsonj #define ARPHRD_HDLC 17 /* HDLC */ 44d04ccbb3Scarlsonj #define ARPHRD_FC 18 /* Fibre Channel RFC 4338 */ 45d04ccbb3Scarlsonj #define ARPHRD_IPATM 19 /* ATM RFC 2225 */ 46*a6911619SDarren Reed #define ARPHRD_METRICOM 23 /* Metricom */ 47d04ccbb3Scarlsonj #define ARPHRD_TUNNEL 31 /* IPsec Tunnel RFC 3456 */ 487c478bd9Sstevel@tonic-gate #define ARPHRD_IB 32 /* IPoIB hardware address */ 497c478bd9Sstevel@tonic-gate ushort_t ar_pro; /* format of protocol address */ 507c478bd9Sstevel@tonic-gate uchar_t ar_hln; /* length of hardware address */ 517c478bd9Sstevel@tonic-gate uchar_t ar_pln; /* length of protocol address */ 527c478bd9Sstevel@tonic-gate ushort_t ar_op; /* one of: */ 537c478bd9Sstevel@tonic-gate #define ARPOP_REQUEST 1 /* request to resolve address */ 547c478bd9Sstevel@tonic-gate #define ARPOP_REPLY 2 /* response to previous request */ 557c478bd9Sstevel@tonic-gate #define REVARP_REQUEST 3 /* Reverse ARP request */ 567c478bd9Sstevel@tonic-gate #define REVARP_REPLY 4 /* Reverse ARP reply */ 577c478bd9Sstevel@tonic-gate /* 587c478bd9Sstevel@tonic-gate * The remaining fields are variable in size, 597c478bd9Sstevel@tonic-gate * according to the sizes above, and are defined 607c478bd9Sstevel@tonic-gate * as appropriate for specific hardware/protocol 617c478bd9Sstevel@tonic-gate * combinations. (E.g., see <netinet/if_ether.h>.) 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate #ifdef notdef 647c478bd9Sstevel@tonic-gate uchar_t ar_sha[]; /* sender hardware address */ 657c478bd9Sstevel@tonic-gate uchar_t ar_spa[]; /* sender protocol address */ 667c478bd9Sstevel@tonic-gate uchar_t ar_tha[]; /* target hardware address */ 677c478bd9Sstevel@tonic-gate uchar_t ar_tpa[]; /* target protocol address */ 687c478bd9Sstevel@tonic-gate #endif /* notdef */ 697c478bd9Sstevel@tonic-gate }; 707c478bd9Sstevel@tonic-gate 7169bb4bb4Scarlsonj /* Maximum hardware and protocol address length */ 7269bb4bb4Scarlsonj #define ARP_MAX_ADDR_LEN 255 7369bb4bb4Scarlsonj 747c478bd9Sstevel@tonic-gate /* 757c478bd9Sstevel@tonic-gate * Extended ARP ioctl request 767c478bd9Sstevel@tonic-gate */ 777c478bd9Sstevel@tonic-gate struct xarpreq { 787c478bd9Sstevel@tonic-gate struct sockaddr_storage xarp_pa; /* protocol address */ 797c478bd9Sstevel@tonic-gate struct sockaddr_dl xarp_ha; /* hardware address */ 807c478bd9Sstevel@tonic-gate int xarp_flags; /* flags */ 817c478bd9Sstevel@tonic-gate }; 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* 847c478bd9Sstevel@tonic-gate * BSD ARP ioctl request 857c478bd9Sstevel@tonic-gate */ 867c478bd9Sstevel@tonic-gate struct arpreq { 877c478bd9Sstevel@tonic-gate struct sockaddr arp_pa; /* protocol address */ 887c478bd9Sstevel@tonic-gate struct sockaddr arp_ha; /* hardware address */ 897c478bd9Sstevel@tonic-gate int arp_flags; /* flags */ 907c478bd9Sstevel@tonic-gate }; 9169bb4bb4Scarlsonj /* arp_flags field values */ 927c478bd9Sstevel@tonic-gate #define ATF_INUSE 0x01 /* entry in use */ 937c478bd9Sstevel@tonic-gate #define ATF_COM 0x02 /* completed entry (enaddr valid) */ 947c478bd9Sstevel@tonic-gate #define ATF_PERM 0x04 /* permanent entry */ 957c478bd9Sstevel@tonic-gate #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 967c478bd9Sstevel@tonic-gate #define ATF_USETRAILERS 0x10 /* has requested trailers */ 9769bb4bb4Scarlsonj #define ATF_AUTHORITY 0x20 /* hardware address is authoritative */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* 1007c478bd9Sstevel@tonic-gate * This data structure is used by kernel protocol modules to register 1017c478bd9Sstevel@tonic-gate * their interest in a particular packet type with the Ethernet drivers. 1027c478bd9Sstevel@tonic-gate * For example, other kinds of ARP would use this, XNS, ApleTalk, etc. 1037c478bd9Sstevel@tonic-gate */ 1047c478bd9Sstevel@tonic-gate struct ether_family { 1057c478bd9Sstevel@tonic-gate int ef_family; /* address family */ 1067c478bd9Sstevel@tonic-gate ushort_t ef_ethertype; /* ethernet type field */ 1077c478bd9Sstevel@tonic-gate struct ifqueue *(*ef_infunc)(); /* input function */ 1087c478bd9Sstevel@tonic-gate int (*ef_outfunc)(); /* output function */ 1097c478bd9Sstevel@tonic-gate int (*ef_netisr)(); /* soft interrupt function */ 1107c478bd9Sstevel@tonic-gate struct ether_family *ef_next; /* link to next on list */ 1117c478bd9Sstevel@tonic-gate }; 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1147c478bd9Sstevel@tonic-gate } 1157c478bd9Sstevel@tonic-gate #endif 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #endif /* _NET_IF_ARP_H */ 118