2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * ethernet.h header for common Ethernet declarations.
28 */
29
30 #ifndef _SYS_ETHERNET_H
31 #define _SYS_ETHERNET_H
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #define ETHERADDRL (6) /* ethernet address length in octets */
38 #define ETHERFCSL (4) /* ethernet FCS length in octets */
39
40 /*
41 * Ethernet address - 6 octets
124 #endif
125
126 /*
127 * Copy Ethernet addresses from a to b - assumes that the two given
128 * pointers can be referenced as shorts. On architectures
129 * where this is not the case, use bcopy instead.
130 */
131
132 #if defined(__sparc) || defined(__i386) || defined(__amd64)
133 #define ether_copy(a, b) { ((short *)b)[0] = ((short *)a)[0]; \
134 ((short *)b)[1] = ((short *)a)[1]; ((short *)b)[2] = ((short *)a)[2]; }
135 #else
136 #define ether_copy(a, b) (bcopy((caddr_t)a, (caddr_t)b, 6))
137 #endif
138
139 #ifdef _KERNEL
140 extern int localetheraddr(struct ether_addr *, struct ether_addr *);
141 extern char *ether_sprintf(struct ether_addr *);
142 extern int ether_aton(char *, uchar_t *);
143 #else /* _KERNEL */
144 #ifdef __STDC__
145 extern char *ether_ntoa(const struct ether_addr *);
146 extern struct ether_addr *ether_aton(const char *);
147 extern int ether_ntohost(char *, const struct ether_addr *);
148 extern int ether_hostton(const char *, struct ether_addr *);
149 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 #endif /* _KERNEL */
158
159 #ifdef __cplusplus
160 }
161 #endif
162
163 #endif /* _SYS_ETHERNET_H */
|
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 *
24 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 /*
29 * ethernet.h header for common Ethernet declarations.
30 */
31
32 #ifndef _SYS_ETHERNET_H
33 #define _SYS_ETHERNET_H
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #define ETHERADDRL (6) /* ethernet address length in octets */
40 #define ETHERFCSL (4) /* ethernet FCS length in octets */
41
42 /*
43 * Ethernet address - 6 octets
126 #endif
127
128 /*
129 * Copy Ethernet addresses from a to b - assumes that the two given
130 * pointers can be referenced as shorts. On architectures
131 * where this is not the case, use bcopy instead.
132 */
133
134 #if defined(__sparc) || defined(__i386) || defined(__amd64)
135 #define ether_copy(a, b) { ((short *)b)[0] = ((short *)a)[0]; \
136 ((short *)b)[1] = ((short *)a)[1]; ((short *)b)[2] = ((short *)a)[2]; }
137 #else
138 #define ether_copy(a, b) (bcopy((caddr_t)a, (caddr_t)b, 6))
139 #endif
140
141 #ifdef _KERNEL
142 extern int localetheraddr(struct ether_addr *, struct ether_addr *);
143 extern char *ether_sprintf(struct ether_addr *);
144 extern int ether_aton(char *, uchar_t *);
145 #else /* _KERNEL */
146 extern char *ether_ntoa(const struct ether_addr *);
147 extern struct ether_addr *ether_aton(const char *);
148 extern int ether_ntohost(char *, const struct ether_addr *);
149 extern int ether_hostton(const char *, struct ether_addr *);
150 extern int ether_line(const char *, struct ether_addr *, char *);
151 #endif /* _KERNEL */
152
153 #ifdef __cplusplus
154 }
155 #endif
156
157 #endif /* _SYS_ETHERNET_H */
|