xref: /titanic_52/usr/src/lib/libdladm/common/libdladm.h (revision 1cea05af420c1992d793dc442f4e30c7269fc107)
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 2006 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_t;
69 
70 typedef enum {
71 	DLADM_PROP_VAL_CURRENT = 1,
72 	DLADM_PROP_VAL_DEFAULT,
73 	DLADM_PROP_VAL_MODIFIABLE,
74 	DLADM_PROP_VAL_PERSISTENT
75 } dladm_prop_type_t;
76 
77 #define		DLADM_SECOBJ_CLASS_WEP	0
78 typedef int	dladm_secobj_class_t;
79 
80 typedef void (dladm_walkcb_t)(void *, const char *);
81 
82 extern int	dladm_walk(dladm_walkcb_t *, void *);
83 extern int	dladm_walk_vlan(dladm_walkcb_t *, void *, const char *);
84 extern int	dladm_info(const char *, dladm_attr_t *);
85 
86 extern dladm_status_t	dladm_set_prop(const char *, const char *,
87 			    char **, uint_t, uint_t);
88 extern dladm_status_t	dladm_get_prop(const char *, dladm_prop_type_t,
89 			    const char *, char **, uint_t *);
90 extern dladm_status_t	dladm_walk_prop(const char *, void *,
91 			    boolean_t (*)(void *, const char *));
92 
93 extern dladm_status_t	dladm_set_secobj(const char *, dladm_secobj_class_t,
94 			    uint8_t *, uint_t, uint_t);
95 extern dladm_status_t	dladm_get_secobj(const char *, dladm_secobj_class_t *,
96 			    uint8_t *, uint_t *, uint_t);
97 extern dladm_status_t	dladm_unset_secobj(const char *, uint_t);
98 extern dladm_status_t	dladm_walk_secobj(void *,
99 			    boolean_t (*)(void *, const char *), uint_t);
100 
101 extern const char	*dladm_status2str(dladm_status_t, char *);
102 extern const char	*dladm_secobjclass2str(dladm_secobj_class_t, char *);
103 extern dladm_status_t	dladm_str2secobjclass(const char *,
104 			    dladm_secobj_class_t *);
105 
106 extern dladm_status_t	dladm_init_linkprop(void);
107 extern dladm_status_t	dladm_init_secobj(void);
108 extern dladm_status_t	dladm_set_rootdir(const char *rootdir);
109 
110 #ifdef	__cplusplus
111 }
112 #endif
113 
114 #endif	/* _LIBDLADM_H */
115