xref: /titanic_52/usr/src/lib/libdladm/common/libdllink.h (revision 1959748cbddf37d4734c107dadfa449e076045e3)
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 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _LIBDLLINK_H
27 #define	_LIBDLLINK_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * This file includes strcutures, macros and routines used by general
33  * link administration, which applies not limited to one specific
34  * type of link.
35  */
36 
37 #include <sys/types.h>
38 #include <sys/param.h>
39 #include <sys/mac.h>
40 #include <libdladm.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 typedef struct dladm_attr {
47 	char		da_dev[MAXNAMELEN];
48 	uint_t		da_max_sdu;
49 	uint16_t	da_vid;
50 } dladm_attr_t;
51 
52 /*
53  * Maximum size of secobj value. Note that it should not be greater than
54  * DLD_SECOBJ_VAL_MAX.
55  */
56 #define	DLADM_SECOBJ_VAL_MAX	256
57 
58 /*
59  * Maximum size of secobj name. Note that it should not be greater than
60  * DLD_SECOBJ_NAME_MAX.
61  */
62 #define	DLADM_SECOBJ_NAME_MAX	32
63 
64 #define	DLADM_PROP_VAL_MAX	25
65 
66 #define		DLADM_SECOBJ_CLASS_WEP	0
67 #define		DLADM_SECOBJ_CLASS_WPA	1
68 typedef int	dladm_secobj_class_t;
69 
70 typedef void (dladm_walkcb_t)(void *, const char *);
71 
72 extern int	dladm_walk(dladm_walkcb_t *, void *);
73 extern int	dladm_mac_walk(void (*fn)(void *, const char *), void *);
74 extern int	dladm_info(const char *, dladm_attr_t *);
75 extern int	dladm_hold_link(const char *, zoneid_t, boolean_t);
76 extern int	dladm_rele_link(const char *, zoneid_t, boolean_t);
77 
78 extern dladm_status_t	dladm_set_prop(const char *, const char *,
79 			    char **, uint_t, uint_t, char **);
80 extern dladm_status_t	dladm_get_prop(const char *, dladm_prop_type_t,
81 			    const char *, char **, uint_t *);
82 extern dladm_status_t	dladm_walk_prop(const char *, void *,
83 			    boolean_t (*)(void *, const char *));
84 extern dladm_status_t	dladm_set_secobj(const char *, dladm_secobj_class_t,
85 			    uint8_t *, uint_t, uint_t);
86 extern dladm_status_t	dladm_get_secobj(const char *, dladm_secobj_class_t *,
87 			    uint8_t *, uint_t *, uint_t);
88 extern dladm_status_t	dladm_unset_secobj(const char *, uint_t);
89 extern dladm_status_t	dladm_walk_secobj(void *,
90 			    boolean_t (*)(void *, const char *), uint_t);
91 
92 extern const char	*dladm_linkstate2str(link_state_t, char *);
93 extern const char	*dladm_linkduplex2str(link_duplex_t, char *);
94 extern const char	*dladm_secobjclass2str(dladm_secobj_class_t, char *);
95 extern dladm_status_t	dladm_str2secobjclass(const char *,
96 			    dladm_secobj_class_t *);
97 
98 extern dladm_status_t	dladm_init_linkprop(void);
99 extern dladm_status_t	dladm_init_secobj(void);
100 
101 #ifdef	__cplusplus
102 }
103 #endif
104 
105 #endif	/* _LIBDLLINK_H */
106