Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/ethernet.h
+++ new/usr/src/uts/common/sys/ethernet.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 + *
22 24 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 25 * Use is subject to license terms.
24 26 */
25 27
26 28 /*
27 29 * ethernet.h header for common Ethernet declarations.
28 30 */
29 31
30 32 #ifndef _SYS_ETHERNET_H
31 33 #define _SYS_ETHERNET_H
32 34
33 35 #ifdef __cplusplus
34 36 extern "C" {
35 37 #endif
36 38
37 39 #define ETHERADDRL (6) /* ethernet address length in octets */
38 40 #define ETHERFCSL (4) /* ethernet FCS length in octets */
39 41
40 42 /*
41 43 * Ethernet address - 6 octets
42 44 */
43 45 typedef uchar_t ether_addr_t[ETHERADDRL];
44 46
45 47 /*
46 48 * Ethernet address - 6 octets
47 49 */
48 50 struct ether_addr {
49 51 ether_addr_t ether_addr_octet;
50 52 };
51 53
52 54 /*
53 55 * Structure of a 10Mb/s Ethernet header.
54 56 */
55 57 struct ether_header {
56 58 struct ether_addr ether_dhost;
57 59 struct ether_addr ether_shost;
58 60 ushort_t ether_type;
59 61 };
60 62
61 63 #define ETHER_CFI 0
62 64
63 65 struct ether_vlan_header {
64 66 struct ether_addr ether_dhost;
65 67 struct ether_addr ether_shost;
66 68 ushort_t ether_tpid;
67 69 ushort_t ether_tci;
68 70 ushort_t ether_type;
69 71 };
70 72
71 73 /*
72 74 * The VLAN tag. Available for applications that cannot make use of struct
73 75 * ether_vlan_header because they assume Ethernet encapsulation.
74 76 */
75 77 struct ether_vlan_extinfo {
76 78 ushort_t ether_tci;
77 79 ushort_t ether_type;
78 80 };
79 81
80 82 #define ETHERTYPE_PUP (0x0200) /* PUP protocol */
81 83 #define ETHERTYPE_802_MIN (0x0600) /* Min valid ethernet type */
82 84 /* under IEEE 802.3 rules */
83 85 #define ETHERTYPE_IP (0x0800) /* IP protocol */
84 86 #define ETHERTYPE_ARP (0x0806) /* Addr. resolution protocol */
85 87 #define ETHERTYPE_REVARP (0x8035) /* Reverse ARP */
86 88 #define ETHERTYPE_AT (0x809b) /* AppleTalk protocol */
87 89 #define ETHERTYPE_AARP (0x80f3) /* AppleTalk ARP */
88 90 #define ETHERTYPE_VLAN (0x8100) /* 802.1Q VLAN */
89 91 #define ETHERTYPE_IPV6 (0x86dd) /* IPv6 */
90 92 #define ETHERTYPE_SLOW (0x8809) /* Slow Protocol */
91 93 #define ETHERTYPE_PPPOED (0x8863) /* PPPoE Discovery Stage */
92 94 #define ETHERTYPE_PPPOES (0x8864) /* PPPoE Session Stage */
93 95 #define ETHERTYPE_EAPOL (0x888e) /* EAPOL protocol */
94 96 #define ETHERTYPE_RSN_PREAUTH (0x88c7) /* RSN PRE-Authentication */
95 97 #define ETHERTYPE_TRILL (0x88c8) /* TBD. TRILL frame */
96 98 #define ETHERTYPE_FCOE (0x8906) /* FCoE */
97 99 #define ETHERTYPE_MAX (0xffff) /* Max valid ethernet type */
98 100
99 101 /*
100 102 * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
101 103 * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
102 104 * by an ETHER type (as given above) and then the (variable-length) header.
103 105 */
104 106 #define ETHERTYPE_TRAIL (0x1000) /* Trailer packet */
105 107 #define ETHERTYPE_NTRAILER (16)
106 108
107 109 #define ETHERMTU (1500) /* max frame w/o header or fcs */
108 110 #define ETHERMIN (60) /* min frame w/header w/o fcs */
109 111 #define ETHERMAX (1514) /* max frame w/header w/o fcs */
110 112
111 113 /*
112 114 * Compare two Ethernet addresses - assumes that the two given
113 115 * pointers can be referenced as shorts. On architectures
114 116 * where this is not the case, use bcmp instead. Note that like
115 117 * bcmp, we return zero if they are the SAME.
116 118 */
117 119
118 120 #if defined(__sparc) || defined(__i386) || defined(__amd64)
119 121 #define ether_cmp(a, b) (((short *)b)[2] != ((short *)a)[2] || \
120 122 ((short *)b)[1] != ((short *)a)[1] || \
121 123 ((short *)b)[0] != ((short *)a)[0])
122 124 #else
123 125 #define ether_cmp(a, b) (bcmp((caddr_t)a, (caddr_t)b, 6))
124 126 #endif
125 127
126 128 /*
127 129 * Copy Ethernet addresses from a to b - assumes that the two given
128 130 * pointers can be referenced as shorts. On architectures
129 131 * where this is not the case, use bcopy instead.
130 132 */
131 133
132 134 #if defined(__sparc) || defined(__i386) || defined(__amd64)
133 135 #define ether_copy(a, b) { ((short *)b)[0] = ((short *)a)[0]; \
↓ open down ↓ |
102 lines elided |
↑ open up ↑ |
134 136 ((short *)b)[1] = ((short *)a)[1]; ((short *)b)[2] = ((short *)a)[2]; }
135 137 #else
136 138 #define ether_copy(a, b) (bcopy((caddr_t)a, (caddr_t)b, 6))
137 139 #endif
138 140
139 141 #ifdef _KERNEL
140 142 extern int localetheraddr(struct ether_addr *, struct ether_addr *);
141 143 extern char *ether_sprintf(struct ether_addr *);
142 144 extern int ether_aton(char *, uchar_t *);
143 145 #else /* _KERNEL */
144 -#ifdef __STDC__
145 146 extern char *ether_ntoa(const struct ether_addr *);
146 147 extern struct ether_addr *ether_aton(const char *);
147 148 extern int ether_ntohost(char *, const struct ether_addr *);
148 149 extern int ether_hostton(const char *, struct ether_addr *);
149 150 extern int ether_line(const char *, struct ether_addr *, char *);
150 -#else /* __STDC__ */
151 -extern char *ether_ntoa();
152 -extern struct ether_addr *ether_aton();
153 -extern int ether_ntohost();
154 -extern int ether_hostton();
155 -extern int ether_line();
156 -#endif /* __STDC__ */
157 151 #endif /* _KERNEL */
158 152
159 153 #ifdef __cplusplus
160 154 }
161 155 #endif
162 156
163 157 #endif /* _SYS_ETHERNET_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX