1 /*
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _LIBDLETHER_H
27 #define	_LIBDLETHER_H
28 
29 #include <sys/types.h>
30 #include <libdladm.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct dladm_ether_spdx_s {
37 	int			lesd_speed;
38 	link_duplex_t		lesd_duplex;
39 } dladm_ether_spdx_t;
40 
41 typedef struct dladm_ether_attr_s {
42 	boolean_t		le_autoneg;
43 	boolean_t		le_pause;
44 	boolean_t		le_asmpause;
45 	boolean_t		le_fault;
46 	uint32_t		le_num_spdx;
47 	dladm_ether_spdx_t	*le_spdx;
48 } dladm_ether_attr_t;
49 
50 /*
51  * Supported PTYPE values
52  */
53 #define	CURRENT	0
54 #define	CAPABLE	1
55 #define	ADV	2
56 #define	PEERADV	3
57 
58 /* Names of the lei_attr[] PTYPE slots for use in arrays */
59 #define	LEI_ATTR_NAMES "current", "capable", "adv", "peeradv"
60 
61 typedef struct dladm_ether_info {
62 	datalink_id_t		lei_linkid;
63 	char			lei_linkname[MAXLINKNAMELEN];
64 	link_state_t		lei_state;
65 	dladm_ether_attr_t	lei_attr[PEERADV+1];
66 } dladm_ether_info_t;
67 
68 extern dladm_status_t	dladm_ether_info(dladm_handle_t, datalink_id_t,
69 			    dladm_ether_info_t *);
70 extern char		*dladm_ether_autoneg2str(char *, size_t,
71 			    dladm_ether_info_t *, int);
72 extern char		*dladm_ether_pause2str(char *, size_t,
73 			    dladm_ether_info_t *, int);
74 extern char		*dladm_ether_spdx2str(char *, size_t,
75 			    dladm_ether_info_t *, int);
76 extern void		dladm_ether_info_done(dladm_ether_info_t *);
77 
78 #ifdef	__cplusplus
79 }
80 #endif
81 
82 #endif	/* _LIBDLETHER_H */
83