xref: /titanic_50/usr/src/lib/libdladm/common/libdladm.h (revision e127a3e717f822eb855235fa3bd08235b2cf533d)
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 _LIBDLADM_H
27 #define	_LIBDLADM_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/types.h>
32 #include <sys/param.h>
33 #include <sys/dls.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 typedef struct dladm_attr {
40 	char		da_dev[MAXNAMELEN];
41 	uint_t		da_max_sdu;
42 	uint16_t	da_vid;
43 } dladm_attr_t;
44 
45 #define	DLADM_STRSIZE		256
46 #define	DLADM_SECOBJ_VAL_MAX	256
47 #define	DLADM_PROP_VAL_MAX	256
48 #define	DLADM_OPT_TEMP		0x00000001
49 #define	DLADM_OPT_CREATE	0x00000002
50 #define	DLADM_OPT_PERSIST	0x00000004
51 
52 typedef enum {
53 	DLADM_STATUS_OK = 0,
54 	DLADM_STATUS_BADARG,
55 	DLADM_STATUS_FAILED,
56 	DLADM_STATUS_TOOSMALL,
57 	DLADM_STATUS_NOTSUP,
58 	DLADM_STATUS_NOTFOUND,
59 	DLADM_STATUS_BADVAL,
60 	DLADM_STATUS_NOMEM,
61 	DLADM_STATUS_EXIST,
62 	DLADM_STATUS_LINKINVAL,
63 	DLADM_STATUS_PROPRDONLY,
64 	DLADM_STATUS_BADVALCNT,
65 	DLADM_STATUS_DBNOTFOUND,
66 	DLADM_STATUS_DENIED,
67 	DLADM_STATUS_IOERR,
68 	DLADM_STATUS_TEMPONLY
69 } dladm_status_t;
70 
71 typedef enum {
72 	DLADM_PROP_VAL_CURRENT = 1,
73 	DLADM_PROP_VAL_DEFAULT,
74 	DLADM_PROP_VAL_MODIFIABLE,
75 	DLADM_PROP_VAL_PERSISTENT
76 } dladm_prop_type_t;
77 
78 #define		DLADM_SECOBJ_CLASS_WEP	0
79 typedef int	dladm_secobj_class_t;
80 
81 typedef void (dladm_walkcb_t)(void *, const char *);
82 
83 extern int	dladm_walk(dladm_walkcb_t *, void *);
84 extern int	dladm_walk_vlan(dladm_walkcb_t *, void *, const char *);
85 extern int	dladm_info(const char *, dladm_attr_t *);
86 extern int	dladm_hold_link(const char *, zoneid_t, boolean_t);
87 extern int	dladm_rele_link(const char *, zoneid_t, boolean_t);
88 
89 extern dladm_status_t	dladm_set_prop(const char *, const char *,
90 			    char **, uint_t, uint_t, char **);
91 extern dladm_status_t	dladm_get_prop(const char *, dladm_prop_type_t,
92 			    const char *, char **, uint_t *);
93 extern dladm_status_t	dladm_walk_prop(const char *, void *,
94 			    boolean_t (*)(void *, const char *));
95 extern boolean_t	dladm_is_prop_temponly(const char *, char **);
96 
97 extern dladm_status_t	dladm_set_secobj(const char *, dladm_secobj_class_t,
98 			    uint8_t *, uint_t, uint_t);
99 extern dladm_status_t	dladm_get_secobj(const char *, dladm_secobj_class_t *,
100 			    uint8_t *, uint_t *, uint_t);
101 extern dladm_status_t	dladm_unset_secobj(const char *, uint_t);
102 extern dladm_status_t	dladm_walk_secobj(void *,
103 			    boolean_t (*)(void *, const char *), uint_t);
104 
105 extern const char	*dladm_status2str(dladm_status_t, char *);
106 extern const char	*dladm_secobjclass2str(dladm_secobj_class_t, char *);
107 extern dladm_status_t	dladm_str2secobjclass(const char *,
108 			    dladm_secobj_class_t *);
109 
110 extern dladm_status_t	dladm_init_linkprop(void);
111 extern dladm_status_t	dladm_init_secobj(void);
112 extern dladm_status_t	dladm_set_rootdir(const char *rootdir);
113 
114 #ifdef	__cplusplus
115 }
116 #endif
117 
118 #endif	/* _LIBDLADM_H */
119