2 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
7 * Copyright (c) 1982, 1986 Regents of the University of California.
10 * Redistribution and use in source and binary forms are permitted
11 * provided that this notice is preserved and that due credit is given
12 * to the University of California at Berkeley. The name of the University
13 * may not be used to endorse or promote products derived from this
14 * software without specific prior written permission. This software
15 * is provided ``as is'' without express or implied warranty.
18 #ifndef _NETINET_IF_ETHER_H
19 #define _NETINET_IF_ETHER_H
21 #pragma ident "%Z%%M% %I% %E% SMI"
22 /* if_ether.h 1.28 89/08/04 SMI; from UCB 7.2 12/7/87 */
24 #include <sys/ethernet.h>
27 * The following include is for compatibility with SunOS 3.x and
28 * 4.3bsd. Newly written programs should include it separately.
30 #include <net/if_arp.h>
37 * Ethernet Address Resolution Protocol.
39 * See RFC 826 for protocol description. Structure below is adapted
40 * to resolving internet addresses. Field names used correspond to
44 struct arphdr ea_hdr
; /* fixed-size header */
45 ether_addr_t arp_sha
; /* sender hardware address */
46 uchar_t arp_spa
[4]; /* sender protocol address */
47 ether_addr_t arp_tha
; /* target hardware address */
48 uchar_t arp_tpa
[4]; /* target protocol address */
50 #define arp_hrd ea_hdr.ar_hrd
51 #define arp_pro ea_hdr.ar_pro
52 #define arp_hln ea_hdr.ar_hln
53 #define arp_pln ea_hdr.ar_pln
54 #define arp_op ea_hdr.ar_op
57 * multicast address structure
59 * Keep a reference count for each multicast address so
60 * addresses loaded into chip are unique.
63 struct ether_addr mc_enaddr
; /* multicast address */
64 ushort_t mc_count
; /* reference count */
66 #define MCADDRMAX 64 /* multicast addr table length */
67 #define MCCOUNTMAX 4096 /* multicast addr max reference count */
70 * Structure shared between the ethernet driver modules and
71 * the address resolution code. For example, each ec_softc or il_softc
72 * begins with this structure.
74 * The structure contains a pointer to an array of multicast addresses.
75 * This pointer is NULL until the first successful SIOCADDMULTI ioctl
76 * is issued for the interface.
79 struct ifnet ac_if
; /* network-visible interface */
80 struct ether_addr ac_enaddr
; /* ethernet hardware address */
81 struct in_addr ac_ipaddr
; /* copy of ip address- XXX */
82 struct mcaddr
*ac_mcaddr
; /* table of multicast addrs */
83 ushort_t ac_nmcaddr
; /* count of M/C addrs in use */
84 struct in_addr ac_lastip
; /* cache of last ARP lookup */
85 struct ether_addr ac_lastarp
; /* result of the last ARP */
89 * Internet to ethernet address resolution table.
92 struct in_addr at_iaddr
; /* internet address */
94 struct ether_addr atu_enaddr
; /* ethernet address */
95 long atu_tvsec
; /* timestamp if incomplete */
97 uchar_t at_timer
; /* minutes since last reference */
98 uchar_t at_flags
; /* flags */
99 struct mbuf
*at_hold
; /* last packet until resolved/timeout */
102 #define at_enaddr at_union.atu_enaddr
103 #define at_tvsec at_union.atu_tvsec
106 * Copy IP addresses from a to b - assumes that the two given
107 * pointers can be referenced as shorts. On architectures
108 * where this is not the case, use bcopy instead.
110 #if defined(__sparc) || defined(__i386) || defined(__amd64)
111 #define ip_copy(a, b) { ((short *)b)[0] = ((short *)a)[0]; \
112 ((short *)b)[1] = ((short *)a)[1]; }
114 #define ip_copy(a, b) (bcopy((caddr_t)a, (caddr_t)b, 4))
121 #endif /* _NETINET_IF_ETHER_H */